Search in sources :

Example 1 with FirstrunUpgradePagerAdapter

use of org.mozilla.focus.firstrun.FirstrunUpgradePagerAdapter in project Rocket by mozilla-tw.

the class FirstrunFragment method findPagerAdapter.

private PagerAdapter findPagerAdapter(Context context, View.OnClickListener onClickListener) {
    final PagerAdapter pagerAdapter;
    SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
    boolean shown = sharedPreferences.getBoolean(PREF_KEY_BOOLEAN_FIRSTRUN_SHOWN, false);
    int firstrunUpgradeVersion = sharedPreferences.getInt(PREF_KEY_INT_FIRSTRUN_UPGRADE_VERSION, 0);
    if (!shown) {
        pagerAdapter = new FirstrunPagerAdapter(context, onClickListener);
    } else if (FIRSTRUN_UPGRADE_VERSION > firstrunUpgradeVersion) {
        pagerAdapter = new FirstrunUpgradePagerAdapter(context, onClickListener);
    } else {
        pagerAdapter = null;
    }
    return pagerAdapter;
}
Also used : FirstrunUpgradePagerAdapter(org.mozilla.focus.firstrun.FirstrunUpgradePagerAdapter) SharedPreferences(android.content.SharedPreferences) FirstrunPagerAdapter(org.mozilla.focus.firstrun.FirstrunPagerAdapter) PagerAdapter(android.support.v4.view.PagerAdapter) FirstrunUpgradePagerAdapter(org.mozilla.focus.firstrun.FirstrunUpgradePagerAdapter) FirstrunPagerAdapter(org.mozilla.focus.firstrun.FirstrunPagerAdapter)

Aggregations

SharedPreferences (android.content.SharedPreferences)1 PagerAdapter (android.support.v4.view.PagerAdapter)1 FirstrunPagerAdapter (org.mozilla.focus.firstrun.FirstrunPagerAdapter)1 FirstrunUpgradePagerAdapter (org.mozilla.focus.firstrun.FirstrunUpgradePagerAdapter)1