Search in sources :

Example 1 with QuranActivity

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

the class JuzListFragment method onResume.

@Override
public void onResume() {
    final Activity activity = getActivity();
    if (activity instanceof QuranActivity) {
        disposable = ((QuranActivity) activity).getLatestPageObservable().first(Constants.NO_PAGE).observeOn(AndroidSchedulers.mainThread()).subscribeWith(new DisposableSingleObserver<Integer>() {

            @Override
            public void onSuccess(Integer recentPage) {
                if (recentPage != Constants.NO_PAGE) {
                    int juz = quranInfo.getJuzFromPage(recentPage);
                    int position = (juz - 1) * 9;
                    mRecyclerView.scrollToPosition(position);
                }
            }

            @Override
            public void onError(Throwable e) {
            }
        });
    }
    QuranSettings settings = QuranSettings.getInstance(activity);
    if (settings.isArabicNames()) {
        updateScrollBarPositionHoneycomb();
    }
    super.onResume();
}
Also used : DisposableSingleObserver(io.reactivex.observers.DisposableSingleObserver) QuranActivity(com.quran.labs.androidquran.ui.QuranActivity) QuranActivity(com.quran.labs.androidquran.ui.QuranActivity) Activity(android.app.Activity) QuranSettings(com.quran.labs.androidquran.util.QuranSettings)

Example 2 with QuranActivity

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

the class SuraListFragment method onResume.

@Override
public void onResume() {
    final Activity activity = getActivity();
    if (activity instanceof QuranActivity) {
        QuranSettings settings = QuranSettings.getInstance(activity);
        disposable = ((QuranActivity) activity).getLatestPageObservable().first(Constants.NO_PAGE).observeOn(AndroidSchedulers.mainThread()).subscribeWith(new DisposableSingleObserver<Integer>() {

            @Override
            public void onSuccess(Integer recentPage) {
                if (recentPage != Constants.NO_PAGE) {
                    int sura = quranInfo.safelyGetSuraOnPage(recentPage);
                    int juz = quranInfo.getJuzFromPage(recentPage);
                    int position = sura + juz - 1;
                    mRecyclerView.scrollToPosition(position);
                }
            }

            @Override
            public void onError(Throwable e) {
            }
        });
        if (settings.isArabicNames()) {
            updateScrollBarPositionHoneycomb();
        }
    }
    super.onResume();
}
Also used : DisposableSingleObserver(io.reactivex.observers.DisposableSingleObserver) QuranActivity(com.quran.labs.androidquran.ui.QuranActivity) QuranActivity(com.quran.labs.androidquran.ui.QuranActivity) Activity(android.app.Activity) QuranSettings(com.quran.labs.androidquran.util.QuranSettings)

Aggregations

Activity (android.app.Activity)2 QuranActivity (com.quran.labs.androidquran.ui.QuranActivity)2 QuranSettings (com.quran.labs.androidquran.util.QuranSettings)2 DisposableSingleObserver (io.reactivex.observers.DisposableSingleObserver)2