// Path: app/src/main/java/com/example/offline/view/CommentsActivity.java
// public class CommentsActivity extends AppCompatActivity implements LifecycleRegistryOwner {
// 
//     @Inject
//     CommentsViewModelFactory viewModelFactory;
// 
//     @Inject
//     SyncCommentLifecycleObserver syncCommentLifecycleObserver;
// 
//     @BindView(R.id.add_comment_edittext)
//     EditText addCommentEditText;
// 
//     @BindView(R.id.comments_recycler_view)
//     RecyclerView recyclerView;
// 
//     private CommentListAdapter recyclerViewAdapter;
// 
//     private CommentsViewModel viewModel;
// 
//     private LifecycleRegistry registry = new LifecycleRegistry(this);
// 
//     @Override
//     public LifecycleRegistry getLifecycle() {
//         return registry;
//     }
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         AndroidInjection.inject(this);
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.comments_activity);
// 
//         ButterKnife.bind(this);
// 
//         initRecyclerView();
// 
//         getLifecycle().addObserver(syncCommentLifecycleObserver);
// 
//         viewModel = ViewModelProviders.of(this, viewModelFactory).get(CommentsViewModel.class);
// 
//         viewModel.comments().observe(this, recyclerViewAdapter::updateCommentList);
//     }
// 
//     @OnClick(R.id.add_comment_button)
//     void onAddCommentButtonClicked() {
// 
//         hideKeyboard();
// 
//         // TODO add comment validation
//         viewModel.addComment(addCommentEditText.getText().toString());
// 
//         clearEditText();
//     }
// 
//     private void hideKeyboard() {
//         InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
//         if (getCurrentFocus() != null) {
//             imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
//         }
//     }
// 
//     private void clearEditText() {
//         addCommentEditText.getText().clear();
//     }
// 
//     private void initRecyclerView() {
//         recyclerView.setHasFixedSize(true);
// 
//         RecyclerView.LayoutManager recyclerViewLayoutManager = new LinearLayoutManager(this);
//         recyclerView.setLayoutManager(recyclerViewLayoutManager);
// 
//         recyclerViewAdapter = new CommentListAdapter(new ArrayList<>());
//         recyclerView.setAdapter(recyclerViewAdapter);
//     }
// }


import com.example.offline.view.CommentsActivity;
import dagger.Module;
import dagger.android.ContributesAndroidInjector;
package com.example.offline.di;



/**
 * Binds all sub-components within the app.
 */
@Module
public abstract class BuildersModule {

    @ContributesAndroidInjector(modules = CommentsActivityModule.class)
// Path: app/src/main/java/com/example/offline/view/CommentsActivity.java
// public class CommentsActivity extends AppCompatActivity implements LifecycleRegistryOwner {
// 
//     @Inject
//     CommentsViewModelFactory viewModelFactory;
// 
//     @Inject
//     SyncCommentLifecycleObserver syncCommentLifecycleObserver;
// 
//     @BindView(R.id.add_comment_edittext)
//     EditText addCommentEditText;
// 
//     @BindView(R.id.comments_recycler_view)
//     RecyclerView recyclerView;
// 
//     private CommentListAdapter recyclerViewAdapter;
// 
//     private CommentsViewModel viewModel;
// 
//     private LifecycleRegistry registry = new LifecycleRegistry(this);
// 
//     @Override
//     public LifecycleRegistry getLifecycle() {
//         return registry;
//     }
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         AndroidInjection.inject(this);
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.comments_activity);
// 
//         ButterKnife.bind(this);
// 
//         initRecyclerView();
// 
//         getLifecycle().addObserver(syncCommentLifecycleObserver);
// 
//         viewModel = ViewModelProviders.of(this, viewModelFactory).get(CommentsViewModel.class);
// 
//         viewModel.comments().observe(this, recyclerViewAdapter::updateCommentList);
//     }
// 
//     @OnClick(R.id.add_comment_button)
//     void onAddCommentButtonClicked() {
// 
//         hideKeyboard();
// 
//         // TODO add comment validation
//         viewModel.addComment(addCommentEditText.getText().toString());
// 
//         clearEditText();
//     }
// 
//     private void hideKeyboard() {
//         InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
//         if (getCurrentFocus() != null) {
//             imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
//         }
//     }
// 
//     private void clearEditText() {
//         addCommentEditText.getText().clear();
//     }
// 
//     private void initRecyclerView() {
//         recyclerView.setHasFixedSize(true);
// 
//         RecyclerView.LayoutManager recyclerViewLayoutManager = new LinearLayoutManager(this);
//         recyclerView.setLayoutManager(recyclerViewLayoutManager);
// 
//         recyclerViewAdapter = new CommentListAdapter(new ArrayList<>());
//         recyclerView.setAdapter(recyclerViewAdapter);
//     }
// }


// Path: app/src/main/java/com/example/offline/di/BuildersModule.java
import com.example.offline.view.CommentsActivity;
import dagger.Module;
import dagger.android.ContributesAndroidInjector;

package com.example.offline.di;



/**
 * Binds all sub-components within the app.
 */
@Module
public abstract class BuildersModule {

    @ContributesAndroidInjector(modules = CommentsActivityModule.class)
    abstract CommentsActivity bindCommentsActivity();