// Path: app/src/main/java/com/testerhome/nativeandroid/fragments/AccountNotificationFragment.java
// public class AccountNotificationFragment extends BaseFragment {
// 
//     @Bind(R.id.rv_topic_list)
//     RecyclerView recyclerViewTopicList;
// 
//     @Bind(R.id.srl_refresh)
//     SwipeRefreshLayout swipeRefreshLayout;
// 
//     private int mNextCursor = 0;
// 
//     private NotificationAdapter mAdatper;
// 
// 
//     public static AccountNotificationFragment newInstance() {
//         AccountNotificationFragment fragment = new AccountNotificationFragment();
//         return fragment;
//     }
// 
//     @Override
//     protected int getLayoutRes() {
//         return R.layout.fragment_topics;
//     }
// 
//     @Override
//     public void onActivityCreated(Bundle savedInstanceState) {
//         super.onActivityCreated(savedInstanceState);
//         if (mTesterHomeAccount == null){
//             getUserInfo();
//         }
//         setupView();
// 
// 
//     }
// 
//     private void setupView() {
//         mAdatper = new NotificationAdapter(getActivity());
//         mAdatper.setListener(new NotificationAdapter.EndlessListener() {
//             @Override
//             public void onListEnded() {
//                 if (mNextCursor > 0) {
//                     loadNotification();
//                 }
//             }
//         });
//         swipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_light, android.R.color.holo_red_light, android.R.color.holo_orange_light, android.R.color.holo_green_light);
//         recyclerViewTopicList.setLayoutManager(new LinearLayoutManager(getActivity()));
//         recyclerViewTopicList.addItemDecoration(new DividerItemDecoration(getActivity(),
//                 DividerItemDecoration.VERTICAL_LIST));
//         recyclerViewTopicList.setAdapter(mAdatper);
// 
//         swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
//             @Override
//             public void onRefresh() {
//                 mNextCursor = 0;
//                 loadNotification();
//             }
//         });
// 
//         loadNotification();
//     }
// 
//     private TesterUser mTesterHomeAccount;
// 
//     private void getUserInfo(){
//         mTesterHomeAccount = TesterHomeAccountService.getInstance(getContext()).getActiveAccountInfo();
//     }
// 
// 
//     private void loadNotification() {
// 
//         TesterHomeApi.getInstance().getTopicsService().getNotifications(mTesterHomeAccount.getAccess_token(),
//                 mNextCursor * 20,
//                 new Callback<NotificationResponse>() {
//                     @Override
//                     public void success(NotificationResponse notificationResponse, Response response) {
// 
//                         if (swipeRefreshLayout.isRefreshing()) {
//                             swipeRefreshLayout.setRefreshing(false);
//                         }
//                         if (notificationResponse.getNotifications().size() > 0) {
//                             if (mNextCursor == 0) {
//                                 mAdatper.setItems(notificationResponse.getNotifications());
//                             } else {
//                                 mAdatper.addItems(notificationResponse.getNotifications());
//                             }
//                             if (notificationResponse.getNotifications().size() == 20) {
//                                 mNextCursor += 1;
//                             } else {
//                                 mNextCursor = 0;
//                             }
// 
//                         } else {
//                             mNextCursor = 0;
//                         }
//                     }
// 
//                     @Override
//                     public void failure(RetrofitError error) {
//                         if (swipeRefreshLayout != null && swipeRefreshLayout.isRefreshing()) {
//                             swipeRefreshLayout.setRefreshing(false);
//                         }
//                         Log.e("demo", "failure() called with: " + "error = [" + error + "]"
//                                 + error.getUrl());
//                     }
//                 });
//     }
// 
// 
// }
// 
// Path: app/src/main/java/com/testerhome/nativeandroid/views/base/BackBaseActivity.java
// public abstract class BackBaseActivity extends BaseActivity {
// 
//     @Override
//     protected void setupToolbar() {
//         super.setupToolbar();
//         if (toolbar != null)
//             toolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
//     }
// 
//     @Override
//     public boolean onOptionsItemSelected(MenuItem item) {
//         if (item.getItemId() == android.R.id.home){
//             this.onBackPressed();
//         }
//         return super.onOptionsItemSelected(item);
//     }
// }


import android.os.Bundle;
import com.testerhome.nativeandroid.R;
import com.testerhome.nativeandroid.fragments.AccountNotificationFragment;
import com.testerhome.nativeandroid.views.base.BackBaseActivity;
package com.testerhome.nativeandroid.views;



/**
 * Created by cvtpc on 2015/10/18.
 */
public class AccountNotificationActivity extends BackBaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_back_base);
        setCustomTitle("我的通知");
        setupView();
    }

    private void setupView() {
        getSupportFragmentManager().beginTransaction().replace(R.id.container,
// Path: app/src/main/java/com/testerhome/nativeandroid/fragments/AccountNotificationFragment.java
// public class AccountNotificationFragment extends BaseFragment {
// 
//     @Bind(R.id.rv_topic_list)
//     RecyclerView recyclerViewTopicList;
// 
//     @Bind(R.id.srl_refresh)
//     SwipeRefreshLayout swipeRefreshLayout;
// 
//     private int mNextCursor = 0;
// 
//     private NotificationAdapter mAdatper;
// 
// 
//     public static AccountNotificationFragment newInstance() {
//         AccountNotificationFragment fragment = new AccountNotificationFragment();
//         return fragment;
//     }
// 
//     @Override
//     protected int getLayoutRes() {
//         return R.layout.fragment_topics;
//     }
// 
//     @Override
//     public void onActivityCreated(Bundle savedInstanceState) {
//         super.onActivityCreated(savedInstanceState);
//         if (mTesterHomeAccount == null){
//             getUserInfo();
//         }
//         setupView();
// 
// 
//     }
// 
//     private void setupView() {
//         mAdatper = new NotificationAdapter(getActivity());
//         mAdatper.setListener(new NotificationAdapter.EndlessListener() {
//             @Override
//             public void onListEnded() {
//                 if (mNextCursor > 0) {
//                     loadNotification();
//                 }
//             }
//         });
//         swipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_light, android.R.color.holo_red_light, android.R.color.holo_orange_light, android.R.color.holo_green_light);
//         recyclerViewTopicList.setLayoutManager(new LinearLayoutManager(getActivity()));
//         recyclerViewTopicList.addItemDecoration(new DividerItemDecoration(getActivity(),
//                 DividerItemDecoration.VERTICAL_LIST));
//         recyclerViewTopicList.setAdapter(mAdatper);
// 
//         swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
//             @Override
//             public void onRefresh() {
//                 mNextCursor = 0;
//                 loadNotification();
//             }
//         });
// 
//         loadNotification();
//     }
// 
//     private TesterUser mTesterHomeAccount;
// 
//     private void getUserInfo(){
//         mTesterHomeAccount = TesterHomeAccountService.getInstance(getContext()).getActiveAccountInfo();
//     }
// 
// 
//     private void loadNotification() {
// 
//         TesterHomeApi.getInstance().getTopicsService().getNotifications(mTesterHomeAccount.getAccess_token(),
//                 mNextCursor * 20,
//                 new Callback<NotificationResponse>() {
//                     @Override
//                     public void success(NotificationResponse notificationResponse, Response response) {
// 
//                         if (swipeRefreshLayout.isRefreshing()) {
//                             swipeRefreshLayout.setRefreshing(false);
//                         }
//                         if (notificationResponse.getNotifications().size() > 0) {
//                             if (mNextCursor == 0) {
//                                 mAdatper.setItems(notificationResponse.getNotifications());
//                             } else {
//                                 mAdatper.addItems(notificationResponse.getNotifications());
//                             }
//                             if (notificationResponse.getNotifications().size() == 20) {
//                                 mNextCursor += 1;
//                             } else {
//                                 mNextCursor = 0;
//                             }
// 
//                         } else {
//                             mNextCursor = 0;
//                         }
//                     }
// 
//                     @Override
//                     public void failure(RetrofitError error) {
//                         if (swipeRefreshLayout != null && swipeRefreshLayout.isRefreshing()) {
//                             swipeRefreshLayout.setRefreshing(false);
//                         }
//                         Log.e("demo", "failure() called with: " + "error = [" + error + "]"
//                                 + error.getUrl());
//                     }
//                 });
//     }
// 
// 
// }
// 
// Path: app/src/main/java/com/testerhome/nativeandroid/views/base/BackBaseActivity.java
// public abstract class BackBaseActivity extends BaseActivity {
// 
//     @Override
//     protected void setupToolbar() {
//         super.setupToolbar();
//         if (toolbar != null)
//             toolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
//     }
// 
//     @Override
//     public boolean onOptionsItemSelected(MenuItem item) {
//         if (item.getItemId() == android.R.id.home){
//             this.onBackPressed();
//         }
//         return super.onOptionsItemSelected(item);
//     }
// }


// Path: app/src/main/java/com/testerhome/nativeandroid/views/AccountNotificationActivity.java
import android.os.Bundle;
import com.testerhome.nativeandroid.R;
import com.testerhome.nativeandroid.fragments.AccountNotificationFragment;
import com.testerhome.nativeandroid.views.base.BackBaseActivity;

package com.testerhome.nativeandroid.views;



/**
 * Created by cvtpc on 2015/10/18.
 */
public class AccountNotificationActivity extends BackBaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_back_base);
        setCustomTitle("我的通知");
        setupView();
    }

    private void setupView() {
        getSupportFragmentManager().beginTransaction().replace(R.id.container,
                AccountNotificationFragment.newInstance())