Search in sources :

Example 6 with PagerActivity

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

the class AyahPlaybackFragment method refreshView.

@Override
protected void refreshView() {
    final Context context = getActivity();
    if (context instanceof PagerActivity && start != null && end != null) {
        final AudioRequest lastRequest = ((PagerActivity) context).getLastAudioRequest();
        final SuraAyah start;
        final SuraAyah ending;
        if (lastRequest != null) {
            start = lastRequest.getRangeStart();
            ending = lastRequest.getRangeEnd();
            verseRepeatCount = lastRequest.getRepeatInfo().getRepeatCount();
            rangeRepeatCount = lastRequest.getRangeRepeatCount();
            shouldEnforce = lastRequest.shouldEnforceBounds();
            decidedStart = start;
            decidedEnd = ending;
            applyButton.setText(R.string.play_apply);
        } else {
            start = this.start;
            if (this.start.equals(end)) {
                final int startPage = quranInfo.getPageFromSuraAyah(start.sura, start.ayah);
                final int[] pageBounds = quranInfo.getPageBounds(startPage);
                ending = new SuraAyah(pageBounds[2], pageBounds[3]);
                shouldEnforce = false;
            } else {
                ending = end;
                shouldEnforce = true;
            }
            rangeRepeatCount = 0;
            verseRepeatCount = 0;
            decidedStart = null;
            decidedEnd = null;
            applyButton.setText(R.string.play_apply_and_play);
        }
        final int maxAyat = quranInfo.getNumAyahs(start.sura);
        if (maxAyat == -1) {
            return;
        }
        updateAyahSpinner(startAyahSpinner, startAyahAdapter, maxAyat, start.ayah);
        final int endAyat = (ending.sura == start.sura) ? maxAyat : quranInfo.getNumAyahs(ending.sura);
        updateAyahSpinner(endingAyahSpinner, endingAyahAdapter, endAyat, ending.ayah);
        startSuraSpinner.setSelection(start.sura - 1);
        endingSuraSpinner.setSelection(ending.sura - 1);
        repeatRangeSpinner.setSelection(repeatToPosition(rangeRepeatCount));
        repeatVerseSpinner.setSelection(repeatToPosition(verseRepeatCount));
        restrictToRange.setChecked(shouldEnforce);
    }
}
Also used : Context(android.content.Context) AudioRequest(com.quran.labs.androidquran.service.util.AudioRequest) SuraAyah(com.quran.labs.androidquran.data.SuraAyah) PagerActivity(com.quran.labs.androidquran.ui.PagerActivity)

Example 7 with PagerActivity

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

the class TabletFragment method onTranslationAction.

@Override
public void onTranslationAction(QuranAyahInfo ayah, String[] translationNames, int actionId) {
    Activity activity = getActivity();
    if (activity instanceof PagerActivity) {
        translationPresenter.get().onTranslationAction((PagerActivity) activity, ayah, translationNames, actionId);
    }
    int page = quranInfo.getPageFromSuraAyah(ayah.sura, ayah.ayah);
    TranslationView translationView = page == pageNumber ? leftTranslation : rightTranslation;
    translationView.unhighlightAyat();
}
Also used : PagerActivity(com.quran.labs.androidquran.ui.PagerActivity) Activity(android.app.Activity) TranslationView(com.quran.labs.androidquran.ui.translation.TranslationView) PagerActivity(com.quran.labs.androidquran.ui.PagerActivity)

Example 8 with PagerActivity

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

the class AyahTrackerPresenter method checkCoordinateData.

private void checkCoordinateData(Activity activity) {
    if (activity instanceof PagerActivity && (!quranFileUtils.haveAyaPositionFile(activity) || !quranFileUtils.hasArabicSearchDatabase(activity))) {
        PagerActivity pagerActivity = (PagerActivity) activity;
        pagerActivity.showGetRequiredFilesDialog();
    }
}
Also used : PagerActivity(com.quran.labs.androidquran.ui.PagerActivity)

Example 9 with PagerActivity

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

the class QuranPageFragment method onAttach.

@Override
public void onAttach(Context context) {
    super.onAttach(context);
    pageNumber = getArguments().getInt(PAGE_NUMBER_EXTRA);
    ((PagerActivity) getActivity()).getPagerActivityComponent().quranPageComponentBuilder().withQuranPageModule(new QuranPageModule(pageNumber)).build().inject(this);
}
Also used : QuranPageModule(com.quran.labs.androidquran.module.fragment.QuranPageModule) PagerActivity(com.quran.labs.androidquran.ui.PagerActivity)

Example 10 with PagerActivity

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

the class TranslationFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Context context = getActivity();
    mainView = new QuranTranslationPageLayout(context);
    mainView.setPageController(null, pageNumber);
    translationView = mainView.getTranslationView();
    translationView.setTranslationClickedListener(v -> {
        final Activity activity = getActivity();
        if (activity instanceof PagerActivity) {
            ((PagerActivity) getActivity()).toggleActionBar();
        }
    });
    translationView.setOnTranslationActionListener(this);
    return mainView;
}
Also used : Context(android.content.Context) QuranTranslationPageLayout(com.quran.labs.androidquran.widgets.QuranTranslationPageLayout) PagerActivity(com.quran.labs.androidquran.ui.PagerActivity) Activity(android.app.Activity) PagerActivity(com.quran.labs.androidquran.ui.PagerActivity)

Aggregations

PagerActivity (com.quran.labs.androidquran.ui.PagerActivity)12 Activity (android.app.Activity)5 Context (android.content.Context)5 QuranPageModule (com.quran.labs.androidquran.module.fragment.QuranPageModule)4 Bundle (android.os.Bundle)2 NonNull (android.support.annotation.NonNull)2 LayoutInflater (android.view.LayoutInflater)2 View (android.view.View)2 ViewGroup (android.view.ViewGroup)2 QuranAyahInfo (com.quran.labs.androidquran.common.QuranAyahInfo)2 QuranInfo (com.quran.labs.androidquran.data.QuranInfo)2 SuraAyah (com.quran.labs.androidquran.data.SuraAyah)2 QuranSettings (com.quran.labs.androidquran.util.QuranSettings)2 List (java.util.List)2 Inject (javax.inject.Inject)2 Bitmap (android.graphics.Bitmap)1 RectF (android.graphics.RectF)1 BitmapDrawable (android.graphics.drawable.BitmapDrawable)1 Nullable (android.support.annotation.Nullable)1 StringRes (android.support.annotation.StringRes)1