// Path: androidsample/src/main/java/io/appflate/restmock/androidsample/view/activities/MainActivity.java
// public class MainActivity extends AppCompatActivity {
// 
//     private static final int POSITION_CONTENT_VIEW = 0;
//     private static final int POSITION_PROGRESS_VIEW = 1;
//     @Inject GithubApi githubApi;
// 
//     @BindView(R.id.fullNameText) TextView fullNameTextView;
//     @BindView(R.id.showReposButton) Button showReposButton;
//     @BindView(R.id.usernameEditText) EditText usernameEditText;
//     @BindView(R.id.resultAnimator) ViewAnimator resultAnimator;
//     private String currentUsername;
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_main);
//         ButterKnife.bind(this);
//         SampleApplication.getComponent().inject(this);
//     }
// 
//     @OnClick(R.id.submitButton)
//     public void onSubmitClicked() {
//         Utils.hideKeyboard(this);
//         currentUsername = usernameEditText.getText().toString();
//         resultAnimator.setDisplayedChild(POSITION_PROGRESS_VIEW);
//         githubApi.getUserProfile(currentUsername).enqueue(new Callback<User>() {
//             @Override
//             public void onResponse(Call<User> call,
//                                    Response<User> response) {
//                 if (response.isSuccessful()) {
//                     User body = response.body();
//                     String name = body.name == null ? body.login : body.name;
//                     fullNameTextView.setText(String.format(Locale.US,
//                             "Hello %s!",
//                             name));
//                     showReposButton.setVisibility(View.VISIBLE);
//                     resultAnimator.setDisplayedChild(POSITION_CONTENT_VIEW);
//                 } else {
//                     onRequestError();
//                 }
//             }
// 
//             @Override
//             public void onFailure(Call<User> call,
//                                   Throwable t) {
//                 onRequestError();
//             }
//         });
//     }
// 
//     @OnClick(R.id.showReposButton)
//     public void onShowReposClicked() {
//         startActivity(ReposActivity.intent(this, currentUsername));
// 
//     }
// 
//     private void onRequestError() {
//         fullNameTextView.setText(R.string.something_went_wrong);
//         showReposButton.setVisibility(View.GONE);
//         resultAnimator.setDisplayedChild(POSITION_CONTENT_VIEW);
//     }
// 
//     public GithubApi getApi() {
//         return githubApi;
//     }
// }
// 
// Path: androidsample/src/main/java/io/appflate/restmock/androidsample/view/activities/ReposActivity.java
// public class ReposActivity extends AppCompatActivity implements Callback<List<Repository>> {
// 
//     private static final String PARAM_USERNAME = "username";
//     private String username;
// 
//     @Inject GithubApi githubApi;
// 
//     @BindView(R.id.reposRecyclerView) RecyclerView reposRecyclerView;
//     @BindView(R.id.reposAnimator) ViewAnimator reposAnimator;
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_repos);
//         ButterKnife.bind(this);
//         SampleApplication.getComponent().inject(this);
//         if (getIntent() != null) {
//             username = getIntent().getStringExtra(PARAM_USERNAME);
//         }
//         setTitle(username);
//         githubApi.getUserRepos(username).enqueue(this);
//     }
// 
//     public static Intent intent(Activity activity, String username) {
//         Intent intent = new Intent(activity, ReposActivity.class);
//         intent.putExtra(PARAM_USERNAME, username);
//         return intent;
//     }
// 
//     @Override
//     public void onResponse(Call<List<Repository>> call, Response<List<Repository>> response) {
//         if (response.isSuccessful()) {
//             reposRecyclerView.setLayoutManager(new LinearLayoutManager(this, RecyclerView.VERTICAL, false));
//             reposRecyclerView.setAdapter(new ReposRecyclerAdapter(response.body()));
//             reposAnimator.setDisplayedChild(1);
//         } else {
//             onResponseFailure();
//         }
//     }
// 
//     @Override
//     public void onFailure(Call<List<Repository>> call, Throwable t) {
//         onResponseFailure();
//     }
// 
//     private void onResponseFailure() {
//         Toast.makeText(this, "Something went wrong", Toast.LENGTH_LONG).show();
//     }
// }
// 
// Path: androidsample/src/main/java/io/appflate/restmock/androidsample/domain/GithubApi.java
// public interface GithubApi {
// 
//     @GET("users/{username}")
//     Call<User> getUserProfile(@Path("username") String username);
// 
//     @GET("users/{username}/repos")
//     Call<List<Repository>>  getUserRepos(@Path("username") String username);
// 
// }


import javax.inject.Singleton;
import dagger.Component;
import io.appflate.restmock.androidsample.view.activities.MainActivity;
import io.appflate.restmock.androidsample.view.activities.ReposActivity;
import io.appflate.restmock.androidsample.domain.GithubApi;
/*
 * Copyright (C) 2016 Appflate.io
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package io.appflate.restmock.androidsample.di;



/**
 * Created by andrzejchm on 23/04/16.
 */
@Singleton
@Component(modules = { AppModule.class})
public interface AppComponent {
// Path: androidsample/src/main/java/io/appflate/restmock/androidsample/view/activities/MainActivity.java
// public class MainActivity extends AppCompatActivity {
// 
//     private static final int POSITION_CONTENT_VIEW = 0;
//     private static final int POSITION_PROGRESS_VIEW = 1;
//     @Inject GithubApi githubApi;
// 
//     @BindView(R.id.fullNameText) TextView fullNameTextView;
//     @BindView(R.id.showReposButton) Button showReposButton;
//     @BindView(R.id.usernameEditText) EditText usernameEditText;
//     @BindView(R.id.resultAnimator) ViewAnimator resultAnimator;
//     private String currentUsername;
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_main);
//         ButterKnife.bind(this);
//         SampleApplication.getComponent().inject(this);
//     }
// 
//     @OnClick(R.id.submitButton)
//     public void onSubmitClicked() {
//         Utils.hideKeyboard(this);
//         currentUsername = usernameEditText.getText().toString();
//         resultAnimator.setDisplayedChild(POSITION_PROGRESS_VIEW);
//         githubApi.getUserProfile(currentUsername).enqueue(new Callback<User>() {
//             @Override
//             public void onResponse(Call<User> call,
//                                    Response<User> response) {
//                 if (response.isSuccessful()) {
//                     User body = response.body();
//                     String name = body.name == null ? body.login : body.name;
//                     fullNameTextView.setText(String.format(Locale.US,
//                             "Hello %s!",
//                             name));
//                     showReposButton.setVisibility(View.VISIBLE);
//                     resultAnimator.setDisplayedChild(POSITION_CONTENT_VIEW);
//                 } else {
//                     onRequestError();
//                 }
//             }
// 
//             @Override
//             public void onFailure(Call<User> call,
//                                   Throwable t) {
//                 onRequestError();
//             }
//         });
//     }
// 
//     @OnClick(R.id.showReposButton)
//     public void onShowReposClicked() {
//         startActivity(ReposActivity.intent(this, currentUsername));
// 
//     }
// 
//     private void onRequestError() {
//         fullNameTextView.setText(R.string.something_went_wrong);
//         showReposButton.setVisibility(View.GONE);
//         resultAnimator.setDisplayedChild(POSITION_CONTENT_VIEW);
//     }
// 
//     public GithubApi getApi() {
//         return githubApi;
//     }
// }
// 
// Path: androidsample/src/main/java/io/appflate/restmock/androidsample/view/activities/ReposActivity.java
// public class ReposActivity extends AppCompatActivity implements Callback<List<Repository>> {
// 
//     private static final String PARAM_USERNAME = "username";
//     private String username;
// 
//     @Inject GithubApi githubApi;
// 
//     @BindView(R.id.reposRecyclerView) RecyclerView reposRecyclerView;
//     @BindView(R.id.reposAnimator) ViewAnimator reposAnimator;
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_repos);
//         ButterKnife.bind(this);
//         SampleApplication.getComponent().inject(this);
//         if (getIntent() != null) {
//             username = getIntent().getStringExtra(PARAM_USERNAME);
//         }
//         setTitle(username);
//         githubApi.getUserRepos(username).enqueue(this);
//     }
// 
//     public static Intent intent(Activity activity, String username) {
//         Intent intent = new Intent(activity, ReposActivity.class);
//         intent.putExtra(PARAM_USERNAME, username);
//         return intent;
//     }
// 
//     @Override
//     public void onResponse(Call<List<Repository>> call, Response<List<Repository>> response) {
//         if (response.isSuccessful()) {
//             reposRecyclerView.setLayoutManager(new LinearLayoutManager(this, RecyclerView.VERTICAL, false));
//             reposRecyclerView.setAdapter(new ReposRecyclerAdapter(response.body()));
//             reposAnimator.setDisplayedChild(1);
//         } else {
//             onResponseFailure();
//         }
//     }
// 
//     @Override
//     public void onFailure(Call<List<Repository>> call, Throwable t) {
//         onResponseFailure();
//     }
// 
//     private void onResponseFailure() {
//         Toast.makeText(this, "Something went wrong", Toast.LENGTH_LONG).show();
//     }
// }
// 
// Path: androidsample/src/main/java/io/appflate/restmock/androidsample/domain/GithubApi.java
// public interface GithubApi {
// 
//     @GET("users/{username}")
//     Call<User> getUserProfile(@Path("username") String username);
// 
//     @GET("users/{username}/repos")
//     Call<List<Repository>>  getUserRepos(@Path("username") String username);
// 
// }


// Path: androidsample/src/main/java/io/appflate/restmock/androidsample/di/AppComponent.java
import javax.inject.Singleton;
import dagger.Component;
import io.appflate.restmock.androidsample.view.activities.MainActivity;
import io.appflate.restmock.androidsample.view.activities.ReposActivity;
import io.appflate.restmock.androidsample.domain.GithubApi;

/*
 * Copyright (C) 2016 Appflate.io
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package io.appflate.restmock.androidsample.di;



/**
 * Created by andrzejchm on 23/04/16.
 */
@Singleton
@Component(modules = { AppModule.class})
public interface AppComponent {
    GithubApi getRestService();