use of com.quran.labs.androidquran.util.QuranSettings in project quran_android by quran.
the class InlineTranslationView method initResources.
private void initResources() {
QuranSettings settings = QuranSettings.getInstance(context);
fontSize = settings.getTranslationTextSize();
textStyle = R.style.TranslationText;
}
use of com.quran.labs.androidquran.util.QuranSettings in project quran_android by quran.
the class TranslationManagerActivity method removeItem.
private void removeItem(final TranslationRowData translationRowData) {
if (adapter == null) {
return;
}
final TranslationItem selectedItem = (TranslationItem) translationRowData;
String msg = String.format(getString(R.string.remove_dlg_msg), selectedItem.name());
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.remove_dlg_title).setMessage(msg).setPositiveButton(R.string.remove_button, (dialog, id) -> {
quranFileUtils.removeTranslation(TranslationManagerActivity.this, selectedItem.translation.getFileName());
TranslationItem updatedItem = selectedItem.withTranslationRemoved();
updateTranslationItem(updatedItem);
// remove from active translations
QuranSettings settings = QuranSettings.getInstance(this);
Set<String> activeTranslations = settings.getActiveTranslations();
activeTranslations.remove(selectedItem.translation.getFileName());
settings.setActiveTranslations(activeTranslations);
generateListItems();
}).setNegativeButton(R.string.cancel, (dialog, i) -> dialog.dismiss());
builder.show();
}
use of com.quran.labs.androidquran.util.QuranSettings in project quran_android by quran.
the class TranslationManagerActivity method handleDownloadSuccess.
@Override
public void handleDownloadSuccess() {
if (downloadingItem != null) {
if (downloadingItem.exists()) {
try {
File f = new File(databaseDirectory, downloadingItem.translation.getFileName() + UPGRADING_EXTENSION);
if (f.exists()) {
f.delete();
}
} catch (Exception e) {
Timber.d(e, "error removing old database file");
}
}
TranslationItem updated = downloadingItem.withTranslationVersion(downloadingItem.translation.getCurrentVersion());
updateTranslationItem(updated);
// update active translations and add this item to it
QuranSettings settings = QuranSettings.getInstance(this);
Set<String> activeTranslations = settings.getActiveTranslations();
activeTranslations.add(downloadingItem.translation.getFileName());
settings.setActiveTranslations(activeTranslations);
}
downloadingItem = null;
generateListItems();
}
use of com.quran.labs.androidquran.util.QuranSettings 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();
}
use of com.quran.labs.androidquran.util.QuranSettings 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();
}
Aggregations