diff --git a/app/src/main/java/education/mahmoud/quranyapp/feature/listening_activity/ListenFragment.java b/app/src/main/java/education/mahmoud/quranyapp/feature/listening_activity/ListenFragment.java index a5d9919..39cecdb 100644 --- a/app/src/main/java/education/mahmoud/quranyapp/feature/listening_activity/ListenFragment.java +++ b/app/src/main/java/education/mahmoud/quranyapp/feature/listening_activity/ListenFragment.java @@ -384,7 +384,7 @@ public void onViewClicked() { // actual end is updated with one as query return result excluded one item ayahsToListen = repository.getAyahSInRange(actualStart+1, actualEnd+1); Log.d(TAG, "onViewClicked: start log after first select "+ ayahsToListen.size()); - logAyahs(); + logAyahs(); // traverse ayahs to check if it downloaded or not for (AyahItem ayahItem : ayahsToListen) { if (ayahItem.getAudioPath() == null) { diff --git a/app/src/main/java/education/mahmoud/quranyapp/feature/services/LoadDataQuranTafseer.java b/app/src/main/java/education/mahmoud/quranyapp/feature/services/LoadDataQuranTafseer.java index 5bef1e9..a220b8d 100644 --- a/app/src/main/java/education/mahmoud/quranyapp/feature/services/LoadDataQuranTafseer.java +++ b/app/src/main/java/education/mahmoud/quranyapp/feature/services/LoadDataQuranTafseer.java @@ -13,6 +13,7 @@ import education.mahmoud.quranyapp.data_layer.local.room.SuraItem; import education.mahmoud.quranyapp.data_layer.model.full_quran.Ayah; import education.mahmoud.quranyapp.data_layer.model.full_quran.Surah; +import education.mahmoud.quranyapp.data_layer.model.tafseer.CompleteTafseer; import education.mahmoud.quranyapp.model.Quran; import education.mahmoud.quranyapp.model.Sura; @@ -41,9 +42,11 @@ private void loadQuranTafseer() { Log.d(TAG, "loadQuranTafseer: before"); Store(surahs); Log.d(TAG, "loadQuranTafseer: after"); + updateAyahsWithTafseer(); stopSelf(); } + // private void Store(List surahs) { SuraItem suraItem; AyahItem ayahItem; @@ -87,4 +90,27 @@ private void Store(List surahs) { } } } + // + + private void updateAyahsWithTafseer() { + AyahItem ayahItem = null; + CompleteTafseer completeTafseer = Util.getCompleteTafseer(this); + if (completeTafseer != null) { + List surahs = completeTafseer.getData().getSurahs(); + for (education.mahmoud.quranyapp.data_layer.model.tafseer.Surah surah1 : surahs) { + for (education.mahmoud.quranyapp.data_layer.model.tafseer.Ayah ayah : surah1.getAyahs()) { + ayahItem = repository.getAyahByIndex(ayah.getNumber()); + ayahItem.setTafseer(ayah.getText()); + try { + repository.updateAyahItem(ayahItem); + } catch (Exception e) { + e.printStackTrace(); + } + } + + Log.d(TAG, "updateAyahsWithTafseer: "); + } + } + + } } diff --git a/app/src/main/java/education/mahmoud/quranyapp/feature/splash/Splash.java b/app/src/main/java/education/mahmoud/quranyapp/feature/splash/Splash.java index 0a73bba..bae019a 100644 --- a/app/src/main/java/education/mahmoud/quranyapp/feature/splash/Splash.java +++ b/app/src/main/java/education/mahmoud/quranyapp/feature/splash/Splash.java @@ -40,7 +40,7 @@ private void startServices() { private void askPermissionForApp() { askForPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE, - Manifest.permission.RECORD_AUDIO}, getSlides().size()); + Manifest.permission.RECORD_AUDIO}, 5); } private void initSlides() { @@ -75,7 +75,7 @@ private void initSlides() { sliderPage = new SliderPage(); sliderPage.setTitle("Quran Test as text"); sliderPage.setDescription("HollyQuranApp"); - sliderPage.setImageDrawable(R.mipmap.ic_launcher); + sliderPage.setImageDrawable(R.mipmap.jump); sliderPage.setBgColor(R.color.bg_green); addSlide(AppIntro2Fragment.newInstance(sliderPage)); diff --git a/app/src/main/res/mipmap-hdpi/jump.png b/app/src/main/res/mipmap-hdpi/jump.png new file mode 100644 index 0000000..17621f2 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/jump.png differ diff --git a/app/src/main/res/mipmap-hdpi/list.png b/app/src/main/res/mipmap-hdpi/list.png new file mode 100644 index 0000000..b77a612 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/list.png differ diff --git a/app/src/main/res/mipmap-hdpi/tafseer.png b/app/src/main/res/mipmap-hdpi/tafseer.png new file mode 100644 index 0000000..968355c Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/tafseer.png differ diff --git a/app/src/main/res/mipmap-ldpi/jump.png b/app/src/main/res/mipmap-ldpi/jump.png new file mode 100644 index 0000000..43d0b73 Binary files /dev/null and b/app/src/main/res/mipmap-ldpi/jump.png differ diff --git a/app/src/main/res/mipmap-ldpi/list.png b/app/src/main/res/mipmap-ldpi/list.png new file mode 100644 index 0000000..6d3f27c Binary files /dev/null and b/app/src/main/res/mipmap-ldpi/list.png differ diff --git a/app/src/main/res/mipmap-ldpi/tafseer.png b/app/src/main/res/mipmap-ldpi/tafseer.png new file mode 100644 index 0000000..9a62486 Binary files /dev/null and b/app/src/main/res/mipmap-ldpi/tafseer.png differ diff --git a/app/src/main/res/mipmap-mdpi/jump.png b/app/src/main/res/mipmap-mdpi/jump.png new file mode 100644 index 0000000..977e5c1 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/jump.png differ diff --git a/app/src/main/res/mipmap-mdpi/list.png b/app/src/main/res/mipmap-mdpi/list.png new file mode 100644 index 0000000..13472f0 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/list.png differ diff --git a/app/src/main/res/mipmap-mdpi/tafseer.png b/app/src/main/res/mipmap-mdpi/tafseer.png new file mode 100644 index 0000000..6534b98 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/tafseer.png differ