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);
}
}
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();
}
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();
}
}
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);
}
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;
}
Aggregations