Search in sources :

Example 1 with SlidingTabLayout

use of com.quran.labs.androidquran.widgets.SlidingTabLayout in project quran_android by quran.

the class QuranActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    QuranApplication quranApp = (QuranApplication) getApplication();
    quranApp.refreshLocale(this, false);
    super.onCreate(savedInstanceState);
    quranApp.getApplicationComponent().inject(this);
    setContentView(R.layout.quran_index);
    compositeDisposable = new CompositeDisposable();
    settings = QuranSettings.getInstance(this);
    isRtl = isRtl();
    final Toolbar tb = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(tb);
    final ActionBar ab = getSupportActionBar();
    if (ab != null) {
        ab.setTitle(R.string.app_name);
    }
    final ViewPager pager = (ViewPager) findViewById(R.id.index_pager);
    pager.setOffscreenPageLimit(3);
    PagerAdapter pagerAdapter = new PagerAdapter(getSupportFragmentManager());
    pager.setAdapter(pagerAdapter);
    final SlidingTabLayout indicator = (SlidingTabLayout) findViewById(R.id.indicator);
    indicator.setViewPager(pager);
    if (isRtl) {
        pager.setCurrentItem(TITLES.length - 1);
    }
    if (savedInstanceState != null) {
        showedTranslationUpgradeDialog = savedInstanceState.getBoolean(SI_SHOWED_UPGRADE_DIALOG, false);
    }
    recentPages = recentPageModel.getLatestPageObservable();
    Intent intent = getIntent();
    if (intent != null) {
        Bundle extras = intent.getExtras();
        if (extras != null) {
            if (extras.getBoolean(EXTRA_SHOW_TRANSLATION_UPGRADE, false)) {
                if (!showedTranslationUpgradeDialog) {
                    showTranslationsUpgradeDialog();
                }
            }
        }
        if (ShortcutsActivity.ACTION_JUMP_TO_LATEST.equals(intent.getAction())) {
            jumpToLastPage();
        }
    }
    updateTranslationsListAsNeeded();
}
Also used : Bundle(android.os.Bundle) SlidingTabLayout(com.quran.labs.androidquran.widgets.SlidingTabLayout) Intent(android.content.Intent) ViewPager(android.support.v4.view.ViewPager) CompositeDisposable(io.reactivex.disposables.CompositeDisposable) ActionBar(android.support.v7.app.ActionBar) FragmentPagerAdapter(android.support.v4.app.FragmentPagerAdapter) QuranApplication(com.quran.labs.androidquran.QuranApplication) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

Intent (android.content.Intent)1 Bundle (android.os.Bundle)1 FragmentPagerAdapter (android.support.v4.app.FragmentPagerAdapter)1 ViewPager (android.support.v4.view.ViewPager)1 ActionBar (android.support.v7.app.ActionBar)1 Toolbar (android.support.v7.widget.Toolbar)1 QuranApplication (com.quran.labs.androidquran.QuranApplication)1 SlidingTabLayout (com.quran.labs.androidquran.widgets.SlidingTabLayout)1 CompositeDisposable (io.reactivex.disposables.CompositeDisposable)1