// Path: app/src/main/java/com/konifar/annict/model/Status.java
// public enum Status {
// 
//     WANNA_WATCH(R.string.status_wanna_watch),
//     WATCHING(R.string.status_watching),
//     WATCHED(R.string.status_watched),
//     ON_HOLD(R.string.status_on_hold),
//     STOP_WATCHING(R.string.status_stop_watching),
//     NO_SELECT(R.string.status_no_select);
// 
//     @StringRes
//     public int stringRes;
// 
//     Status(@StringRes int stringRes) {
//         this.stringRes = stringRes;
//     }
// 
//     public static List<Status> all() {
//         return Arrays.asList(NO_SELECT, WANNA_WATCH, WATCHING, WATCHED, ON_HOLD, STOP_WATCHING);
//     }
// 
//     @Override
//     public String toString() {
//         return super.toString().toLowerCase();
//     }
// }
// 
// Path: app/src/main/java/com/konifar/annict/viewmodel/MainViewModel.java
// public class MainViewModel implements ViewModel {
// 
//     private final PageNavigator navigator;
// 
//     @Inject
//     public MainViewModel(PageNavigator navigator) {
//         this.navigator = navigator;
//     }
// 
//     public void showData(@Nullable String accessToken, @Nullable String authCode,
//         @IdRes int layoutResId) {
//         if (!TextUtils.isEmpty(accessToken)) {
//             navigator.replaceMainFragment(layoutResId);
//         } else {
//             // After authentication, intent has uri data including auth code.
//             if (TextUtils.isEmpty(authCode)) {
//                 navigator.startLoginActivity();
//                 navigator.finish();
//             } else {
//                 navigator.replaceMainFragment(authCode, layoutResId);
//             }
//         }
//     }
// 
//     @Override
//     public void destroy() {
//         // Do nothing
//     }
// 
//     public void onClickSearchMenu() {
//         navigator.startSearchActivity();
//     }
// 
//     public void onClickSettingMenu() {
//         navigator.startSettingsActivity();
//     }
// }


import com.annimon.stream.Stream;
import com.konifar.annict.R;
import com.konifar.annict.databinding.FragmentMainBinding;
import com.konifar.annict.model.Status;
import com.konifar.annict.viewmodel.MainViewModel;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.item_search:
                viewModel.onClickSearchMenu();
                break;
            case R.id.item_settings:
                viewModel.onClickSettingMenu();
                break;
        }
        return super.onOptionsItemSelected(item);
    }

    private class MainPagerAdapter extends FragmentStatePagerAdapter {

        private final List<String> titles = new ArrayList<>();

        private final List<TabPage> pages = new ArrayList<>();

        public MainPagerAdapter(FragmentManager fm) {
            super(fm);
            createPages();
        }

        private void createPages() {
            titles.add(getString(R.string.my_programs_title));
            pages.add(MyProgramsFragment.newInstance(authCode));

// Path: app/src/main/java/com/konifar/annict/model/Status.java
// public enum Status {
// 
//     WANNA_WATCH(R.string.status_wanna_watch),
//     WATCHING(R.string.status_watching),
//     WATCHED(R.string.status_watched),
//     ON_HOLD(R.string.status_on_hold),
//     STOP_WATCHING(R.string.status_stop_watching),
//     NO_SELECT(R.string.status_no_select);
// 
//     @StringRes
//     public int stringRes;
// 
//     Status(@StringRes int stringRes) {
//         this.stringRes = stringRes;
//     }
// 
//     public static List<Status> all() {
//         return Arrays.asList(NO_SELECT, WANNA_WATCH, WATCHING, WATCHED, ON_HOLD, STOP_WATCHING);
//     }
// 
//     @Override
//     public String toString() {
//         return super.toString().toLowerCase();
//     }
// }
// 
// Path: app/src/main/java/com/konifar/annict/viewmodel/MainViewModel.java
// public class MainViewModel implements ViewModel {
// 
//     private final PageNavigator navigator;
// 
//     @Inject
//     public MainViewModel(PageNavigator navigator) {
//         this.navigator = navigator;
//     }
// 
//     public void showData(@Nullable String accessToken, @Nullable String authCode,
//         @IdRes int layoutResId) {
//         if (!TextUtils.isEmpty(accessToken)) {
//             navigator.replaceMainFragment(layoutResId);
//         } else {
//             // After authentication, intent has uri data including auth code.
//             if (TextUtils.isEmpty(authCode)) {
//                 navigator.startLoginActivity();
//                 navigator.finish();
//             } else {
//                 navigator.replaceMainFragment(authCode, layoutResId);
//             }
//         }
//     }
// 
//     @Override
//     public void destroy() {
//         // Do nothing
//     }
// 
//     public void onClickSearchMenu() {
//         navigator.startSearchActivity();
//     }
// 
//     public void onClickSettingMenu() {
//         navigator.startSettingsActivity();
//     }
// }


// Path: app/src/main/java/com/konifar/annict/view/fragment/MainFragment.java
import com.annimon.stream.Stream;
import com.konifar.annict.R;
import com.konifar.annict.databinding.FragmentMainBinding;
import com.konifar.annict.model.Status;
import com.konifar.annict.viewmodel.MainViewModel;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;

    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.item_search:
                viewModel.onClickSearchMenu();
                break;
            case R.id.item_settings:
                viewModel.onClickSettingMenu();
                break;
        }
        return super.onOptionsItemSelected(item);
    }

    private class MainPagerAdapter extends FragmentStatePagerAdapter {

        private final List<String> titles = new ArrayList<>();

        private final List<TabPage> pages = new ArrayList<>();

        public MainPagerAdapter(FragmentManager fm) {
            super(fm);
            createPages();
        }

        private void createPages() {
            titles.add(getString(R.string.my_programs_title));
            pages.add(MyProgramsFragment.newInstance(authCode));

            Stream.of(Status.WATCHING, Status.WANNA_WATCH, Status.WATCHED).forEach(status -> {