Search in sources :

Example 1 with JumpFragment

use of com.quran.labs.androidquran.ui.fragment.JumpFragment in project quran_android by quran.

the class PagerActivity method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    final int itemId = item.getItemId();
    if (itemId == R.id.favorite_item) {
        int page = getCurrentPage();
        toggleBookmark(null, null, page);
        return true;
    } else if (itemId == R.id.goto_quran) {
        switchToQuran();
        return true;
    } else if (itemId == R.id.goto_translation) {
        switchToTranslation();
        return true;
    } else if (itemId == R.id.night_mode) {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
        SharedPreferences.Editor prefsEditor = prefs.edit();
        final boolean isNightMode = !item.isChecked();
        prefsEditor.putBoolean(Constants.PREF_NIGHT_MODE, isNightMode).apply();
        item.setIcon(isNightMode ? R.drawable.ic_night_mode : R.drawable.ic_day_mode);
        item.setChecked(isNightMode);
        refreshQuranPages();
        return true;
    } else if (itemId == R.id.settings) {
        Intent i = new Intent(this, QuranPreferenceActivity.class);
        startActivity(i);
        return true;
    } else if (itemId == R.id.help) {
        Intent i = new Intent(this, HelpActivity.class);
        startActivity(i);
        return true;
    } else if (itemId == android.R.id.home) {
        finish();
        return true;
    } else if (itemId == R.id.jump) {
        FragmentManager fm = getSupportFragmentManager();
        JumpFragment jumpDialog = new JumpFragment();
        jumpDialog.show(fm, JumpFragment.TAG);
        return true;
    }
    return super.onOptionsItemSelected(item);
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) HelpActivity(com.quran.labs.androidquran.HelpActivity) SharedPreferences(android.content.SharedPreferences) Intent(android.content.Intent) JumpFragment(com.quran.labs.androidquran.ui.fragment.JumpFragment)

Example 2 with JumpFragment

use of com.quran.labs.androidquran.ui.fragment.JumpFragment in project quran_android by quran.

the class QuranActivity method gotoPageDialog.

private void gotoPageDialog() {
    if (!isPaused) {
        FragmentManager fm = getSupportFragmentManager();
        JumpFragment jumpDialog = new JumpFragment();
        jumpDialog.show(fm, JumpFragment.TAG);
    }
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) JumpFragment(com.quran.labs.androidquran.ui.fragment.JumpFragment)

Aggregations

FragmentManager (android.support.v4.app.FragmentManager)2 JumpFragment (com.quran.labs.androidquran.ui.fragment.JumpFragment)2 Intent (android.content.Intent)1 SharedPreferences (android.content.SharedPreferences)1 HelpActivity (com.quran.labs.androidquran.HelpActivity)1