package com.anotherdev.stackapp.app;

public class HomeActivity extends StackActivity {

    @Override
    protected int getActivityLayout() {
        return 0;
    }
}

@@ -35,135 +35,2341 @@
 p;%0A%0A
-public class HomeActivity extends StackActivity %7B%0A%0A    @Override%0A    protected int getActivityLayout() %7B%0A        return 0;%0A    %7D
+import android.os.Bundle;%0Aimport android.support.v7.widget.DefaultItemAnimator;%0Aimport android.support.v7.widget.LinearLayoutManager;%0Aimport android.support.v7.widget.RecyclerView;%0Aimport android.text.TextUtils;%0A%0Aimport com.anotherdev.stackapp.R;%0Aimport com.anotherdev.stackapp.adapter.QuestionAdapter;%0Aimport com.anotherdev.stackapp.api.ApiComponent;%0Aimport com.anotherdev.stackapp.api.DaggerApiComponent;%0Aimport com.anotherdev.stackapp.api.stackexchange.Questions;%0Aimport com.anotherdev.stackapp.api.stackexchange.StackOverflowApi;%0Aimport com.anotherdev.stackapp.rx.Actions;%0A%0Aimport butterknife.Bind;%0Aimport rx.Observable;%0Aimport rx.android.schedulers.AndroidSchedulers;%0Aimport rx.functions.Action1;%0A%0Apublic class HomeActivity extends StackActivity %7B%0A%0A    private static final String TAG = HomeActivity.class.getSimpleName();%0A%0A    private StackOverflowApi mStackOverflow;%0A%0A    @Bind(R.id.recyclerview) RecyclerView mRecyclerView;%0A%0A%0A    @Override%0A    protected void onCreate(Bundle savedInstanceState) %7B%0A        super.onCreate(savedInstanceState);%0A        ApiComponent apiComponent = DaggerApiComponent.create();%0A        mStackOverflow = apiComponent.stackoverflow();%0A%0A        mRecyclerView.setLayoutManager(new LinearLayoutManager(this));%0A        mRecyclerView.setItemAnimator(new DefaultItemAnimator());%0A%0A        search(%22%22);%0A    %7D%0A%0A    @Override%0A    protected int getActivityLayout() %7B%0A        return R.layout.activity_home;%0A    %7D%0A%0A    private void search(final String text) %7B%0A        Observable%3CQuestions%3E questions;%0A        if (TextUtils.isEmpty(text)) %7B%0A            questions = mStackOverflow.questions();%0A        %7D else %7B%0A            questions = mStackOverflow.search(text);%0A        %7D%0A%0A        questions.observeOn(AndroidSchedulers.mainThread())%0A                .subscribe(%0A                        new Action1%3CQuestions%3E() %7B%0A                            @Override%0A                            public void call(Questions questions) %7B%0A                                updateQuestions(questions);%0A                            %7D%0A                        %7D,%0A                        mOnError);%0A    %7D%0A%0A    private void updateQuestions(Questions questions) %7B%0A        QuestionAdapter adapter = new QuestionAdapter(questions);%0A        mRecyclerView.setAdapter(adapter);%0A    %7D%0A%0A%0A    private Action1%3CThrowable%3E mOnError = Actions.logError(TAG);
 %0A%7D%0A

add api, view, adapter, observable