From 672721d2c336a2ac9b5e0af17abe21153ddd92f1 Mon Sep 17 00:00:00 2001 From: fouad Date: Wed, 3 Aug 2011 12:55:22 +0200 Subject: [PATCH 01/35] -- fixing array out of bounds exception on audio jump to ayah checkbox selection --- src/com/quran/labs/androidquran/QuranViewActivity.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/com/quran/labs/androidquran/QuranViewActivity.java b/src/com/quran/labs/androidquran/QuranViewActivity.java index b6848176a6..65eaa16e04 100644 --- a/src/com/quran/labs/androidquran/QuranViewActivity.java +++ b/src/com/quran/labs/androidquran/QuranViewActivity.java @@ -329,7 +329,8 @@ public void onItemSelected(AdapterView adapter, View view, int endAyah = suraIndex == pageBounds[2]? pageBounds[3] : QuranInfo.SURA_NUM_AYAHS[suraIndex - 1]; initAyatSpinner(ayatSpinner, startAyah, endAyah); if (suraIndex == pageBounds[0]) { - ayatSpinner.setSelection(pageBounds[1] - 1); + int selection = checkbox.isChecked()? 0 : pageBounds[1] - 1; + ayatSpinner.setSelection(selection); } } From 3252b2d80ec835d5a27f785fce8a8d653f14bd15 Mon Sep 17 00:00:00 2001 From: Hussein Maher Date: Wed, 3 Aug 2011 13:50:59 +0200 Subject: [PATCH 02/35] 1.5.2 --- AndroidManifest.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index a4cf4b485b..8234092590 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,7 +1,7 @@ - + package="com.quran.labs.androidquran" android:versionCode="9" android:versionName="1.5.2"> + From 08cef63843f50bb5dd0484acfd7c73e0318f9d77 Mon Sep 17 00:00:00 2001 From: Hussein Maher Date: Wed, 3 Aug 2011 14:02:30 +0200 Subject: [PATCH 03/35] fix null pointer exception --- .../labs/androidquran/common/QuranPageFeeder.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/com/quran/labs/androidquran/common/QuranPageFeeder.java b/src/com/quran/labs/androidquran/common/QuranPageFeeder.java index 6e55bd1c9d..e5221faf3a 100644 --- a/src/com/quran/labs/androidquran/common/QuranPageFeeder.java +++ b/src/com/quran/labs/androidquran/common/QuranPageFeeder.java @@ -116,12 +116,14 @@ public void highlightAyah(int sura, int ayah){ public void unHighlightAyah(){ View v = mQuranPage.getCurrentPage(); - HighlightingImageView iv = - (HighlightingImageView)v.findViewById(R.id.page_image); - if (iv != null){ - HighlightingImageView hi = (HighlightingImageView)iv; - hi.unhighlight(); - mQuranPage.invalidate(); + if (v != null) { + HighlightingImageView iv = + (HighlightingImageView)v.findViewById(R.id.page_image); + if (iv != null){ + HighlightingImageView hi = (HighlightingImageView)iv; + hi.unhighlight(); + mQuranPage.invalidate(); + } } } From e19f6c0fa43c24f7d4831d690c0fe75c2a9264e1 Mon Sep 17 00:00:00 2001 From: Hussein Maher Date: Sat, 6 Aug 2011 18:00:17 +0200 Subject: [PATCH 04/35] Missing Sheikh in arabic From 8d0f78d889a9d78ba5258d608ce67259640b7a8d Mon Sep 17 00:00:00 2001 From: Wael Nafee Date: Sun, 14 Aug 2011 17:56:55 +0200 Subject: [PATCH 05/35] fixed aya highlighting bug in landscape and portrait modes for all screen resolutions hopefully inshaAllah --- .../androidquran/util/QuranScreenInfo.java | 6 +++++ .../widgets/HighlightingImageView.java | 27 ++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/com/quran/labs/androidquran/util/QuranScreenInfo.java b/src/com/quran/labs/androidquran/util/QuranScreenInfo.java index 1086bbbfbc..da998c8cc7 100644 --- a/src/com/quran/labs/androidquran/util/QuranScreenInfo.java +++ b/src/com/quran/labs/androidquran/util/QuranScreenInfo.java @@ -48,4 +48,10 @@ public boolean isLandscapeOrientation() { public void setOrientation(int orientation) { this.orientation = orientation; } + + public float getRatio() { + if (height > width) + return (float)(1.0*height/width); + return (float)(1.0*width/height); + } } diff --git a/src/com/quran/labs/androidquran/widgets/HighlightingImageView.java b/src/com/quran/labs/androidquran/widgets/HighlightingImageView.java index 89dbb92801..fcaffe09dc 100644 --- a/src/com/quran/labs/androidquran/widgets/HighlightingImageView.java +++ b/src/com/quran/labs/androidquran/widgets/HighlightingImageView.java @@ -19,6 +19,7 @@ import com.quran.labs.androidquran.R; import com.quran.labs.androidquran.common.AyahBounds; import com.quran.labs.androidquran.data.AyahInfoDatabaseHandler; +import com.quran.labs.androidquran.util.QuranScreenInfo; public class HighlightingImageView extends ImageView { private List currentlyHighlighting = null; @@ -120,14 +121,38 @@ protected void onDraw(Canvas canvas) { Drawable page = this.getDrawable(); if (page != null){ + /* float widthFactor = (float)((1.0 * getWidth()) / (1.0 * page.getIntrinsicWidth())); float heightFactor = (float)((1.0 * getHeight()) / (1.0 * page.getIntrinsicHeight())); - + */ + + float screenRatio = QuranScreenInfo.getInstance().getRatio(); + float pageRatio = (float) (1.0* page.getIntrinsicHeight()/page.getIntrinsicWidth()); + + float scaledPageHeight; + float scaledPageWidth; + + // depending on whether or not you will have a top or bottom offset + if (screenRatio < pageRatio){ + scaledPageHeight = getHeight(); + scaledPageWidth = (float) (1.0*getHeight()/page.getIntrinsicHeight()*page.getIntrinsicWidth()); + } else { + scaledPageWidth = getWidth(); + scaledPageHeight = (float)(1.0*getWidth()/page.getIntrinsicWidth()*page.getIntrinsicHeight()); + } + + float widthFactor = scaledPageWidth / page.getIntrinsicWidth(); + float heightFactor = scaledPageHeight / page.getIntrinsicHeight(); + + float offsetX = (getWidth() - scaledPageWidth)/2; + float offsetY = (getHeight() - scaledPageHeight)/2; + RectF scaled = new RectF(b.getMinX() * widthFactor, b.getMinY() * heightFactor, b.getMaxX() * widthFactor, b.getMaxY() * heightFactor); + scaled.offset(offsetX, offsetY); canvas.drawBitmap(bm, null, scaled, null); } } From a32dd0684033760926142e8e8a8a9e50b894f05b Mon Sep 17 00:00:00 2001 From: Wael Nafee Date: Sun, 14 Aug 2011 18:17:16 +0200 Subject: [PATCH 06/35] some refactoring to move all scale calculations outside the loop for efficiency purposes --- .../widgets/HighlightingImageView.java | 57 ++++++++----------- 1 file changed, 25 insertions(+), 32 deletions(-) diff --git a/src/com/quran/labs/androidquran/widgets/HighlightingImageView.java b/src/com/quran/labs/androidquran/widgets/HighlightingImageView.java index fcaffe09dc..c66efa0f0b 100644 --- a/src/com/quran/labs/androidquran/widgets/HighlightingImageView.java +++ b/src/com/quran/labs/androidquran/widgets/HighlightingImageView.java @@ -115,40 +115,33 @@ private void doHighlightAyah(AyahBounds first, protected void onDraw(Canvas canvas) { super.onDraw(canvas); if (this.currentlyHighlighting != null){ - for (AyahBounds b : currentlyHighlighting){ + Drawable page = this.getDrawable(); + if (page != null){ Bitmap bm = BitmapFactory.decodeResource( - getResources(), R.drawable.highlight); + getResources(), R.drawable.highlight); - Drawable page = this.getDrawable(); - if (page != null){ - /* - float widthFactor = (float)((1.0 * getWidth()) / - (1.0 * page.getIntrinsicWidth())); - float heightFactor = (float)((1.0 * getHeight()) / - (1.0 * page.getIntrinsicHeight())); - */ - - float screenRatio = QuranScreenInfo.getInstance().getRatio(); - float pageRatio = (float) (1.0* page.getIntrinsicHeight()/page.getIntrinsicWidth()); - - float scaledPageHeight; - float scaledPageWidth; - - // depending on whether or not you will have a top or bottom offset - if (screenRatio < pageRatio){ - scaledPageHeight = getHeight(); - scaledPageWidth = (float) (1.0*getHeight()/page.getIntrinsicHeight()*page.getIntrinsicWidth()); - } else { - scaledPageWidth = getWidth(); - scaledPageHeight = (float)(1.0*getWidth()/page.getIntrinsicWidth()*page.getIntrinsicHeight()); - } - - float widthFactor = scaledPageWidth / page.getIntrinsicWidth(); - float heightFactor = scaledPageHeight / page.getIntrinsicHeight(); - - float offsetX = (getWidth() - scaledPageWidth)/2; - float offsetY = (getHeight() - scaledPageHeight)/2; - + float screenRatio = QuranScreenInfo.getInstance().getRatio(); + float pageRatio = (float) (1.0* page.getIntrinsicHeight()/page.getIntrinsicWidth()); + + float scaledPageHeight; + float scaledPageWidth; + + // depending on whether or not you will have a top or bottom offset + if (screenRatio < pageRatio){ + scaledPageHeight = getHeight(); + scaledPageWidth = (float) (1.0*getHeight()/page.getIntrinsicHeight()*page.getIntrinsicWidth()); + } else { + scaledPageWidth = getWidth(); + scaledPageHeight = (float)(1.0*getWidth()/page.getIntrinsicWidth()*page.getIntrinsicHeight()); + } + + float widthFactor = scaledPageWidth / page.getIntrinsicWidth(); + float heightFactor = scaledPageHeight / page.getIntrinsicHeight(); + + float offsetX = (getWidth() - scaledPageWidth)/2; + float offsetY = (getHeight() - scaledPageHeight)/2; + + for (AyahBounds b : currentlyHighlighting){ RectF scaled = new RectF(b.getMinX() * widthFactor, b.getMinY() * heightFactor, b.getMaxX() * widthFactor, b.getMaxY() * heightFactor); From f1dcd4cfacc75d503e27b839c1e3843cce79b821 Mon Sep 17 00:00:00 2001 From: Ahmed Farra Date: Sun, 14 Aug 2011 23:17:24 +0800 Subject: [PATCH 07/35] Fixed Issue #57 - Arabic reshaping not applied to bookmarks page Added Arabic reshaping to jump to ayah dialog (surah spinner) --- src/com/quran/labs/androidquran/BookmarksActivity.java | 5 +++-- src/com/quran/labs/androidquran/QuranViewActivity.java | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/com/quran/labs/androidquran/BookmarksActivity.java b/src/com/quran/labs/androidquran/BookmarksActivity.java index ac8574d9a8..e9d8ac4754 100644 --- a/src/com/quran/labs/androidquran/BookmarksActivity.java +++ b/src/com/quran/labs/androidquran/BookmarksActivity.java @@ -19,6 +19,7 @@ import com.quran.labs.androidquran.common.BaseQuranActivity; import com.quran.labs.androidquran.data.QuranInfo; +import com.quran.labs.androidquran.util.ArabicStyle; import com.quran.labs.androidquran.util.BookmarksManager; public class BookmarksActivity extends BaseQuranActivity { @@ -39,8 +40,8 @@ private void showBookmarks() { ArrayList bookmarks = BookmarksManager.getInstance().getBookmarks(); for (int i = 0; i < bookmarks.size(); i++) { int page = bookmarks.get(i); - String title = QuranInfo.getSuraNameString(page); - String info = QuranInfo.getSuraDetailsForBookmark(page); + String title = ArabicStyle.reshape(QuranInfo.getSuraNameString(page)); + String info = ArabicStyle.reshape(QuranInfo.getSuraDetailsForBookmark(page)); Map map = new HashMap(); map.put("suraname", title); map.put("info", info); diff --git a/src/com/quran/labs/androidquran/QuranViewActivity.java b/src/com/quran/labs/androidquran/QuranViewActivity.java index 65eaa16e04..76512cdd12 100644 --- a/src/com/quran/labs/androidquran/QuranViewActivity.java +++ b/src/com/quran/labs/androidquran/QuranViewActivity.java @@ -33,6 +33,7 @@ import com.quran.labs.androidquran.data.QuranInfo; import com.quran.labs.androidquran.service.AudioServiceBinder; import com.quran.labs.androidquran.service.QuranAudioService; +import com.quran.labs.androidquran.util.ArabicStyle; import com.quran.labs.androidquran.util.QuranAudioLibrary; import com.quran.labs.androidquran.util.QuranSettings; import com.quran.labs.androidquran.util.QuranUtils; @@ -387,7 +388,7 @@ private void initSurasSpinner(final Spinner spinner, int startSura, int endSura) ArrayList> data = new ArrayList>(); for (int i = startSura; i <= endSura; i++) { HashMap hash = new HashMap(); - hash.put("suraName", QuranInfo.getSuraName(i-1)); + hash.put("suraName", ArabicStyle.reshape(QuranInfo.getSuraName(i-1))); hash.put("suraId", ""+i); data.add(hash); } From 6bacef573756f1a1ecd417ee63aa7e46349f47df Mon Sep 17 00:00:00 2001 From: Ahmed Farra Date: Sun, 14 Aug 2011 23:30:20 +0800 Subject: [PATCH 08/35] Fix: titleText/seekbar not updating when jumping to page/ayah --- .../quran/labs/androidquran/common/PageViewQuranActivity.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/com/quran/labs/androidquran/common/PageViewQuranActivity.java b/src/com/quran/labs/androidquran/common/PageViewQuranActivity.java index 71e5bcee9d..c7d751a933 100644 --- a/src/com/quran/labs/androidquran/common/PageViewQuranActivity.java +++ b/src/com/quran/labs/androidquran/common/PageViewQuranActivity.java @@ -147,6 +147,7 @@ protected void onStart() { @Override public void jumpTo(int page) { quranPageFeeder.jumpToPage(page); + updatePageInfo(); } protected void goToNextPage() { From 7110705d3635433a4f0c6585066d8ce6bf572410 Mon Sep 17 00:00:00 2001 From: Ahmed Farra Date: Mon, 15 Aug 2011 00:02:56 +0800 Subject: [PATCH 09/35] Added Arabic (+reshaping) to toasts from Issue #33 --- .../labs/androidquran/common/QuranPageFeeder.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/com/quran/labs/androidquran/common/QuranPageFeeder.java b/src/com/quran/labs/androidquran/common/QuranPageFeeder.java index 427dba1f1d..1ef2d5d2ef 100644 --- a/src/com/quran/labs/androidquran/common/QuranPageFeeder.java +++ b/src/com/quran/labs/androidquran/common/QuranPageFeeder.java @@ -17,6 +17,7 @@ import com.quran.labs.androidquran.R; import com.quran.labs.androidquran.data.ApplicationConstants; import com.quran.labs.androidquran.data.QuranInfo; +import com.quran.labs.androidquran.util.ArabicStyle; import com.quran.labs.androidquran.util.QuranSettings; import com.quran.labs.androidquran.util.QuranUtils; import com.quran.labs.androidquran.widgets.HighlightingImageView; @@ -166,19 +167,20 @@ public void displayMarkerPopup() { int hizb = (rub3 / 4) + 1; StringBuilder sb = new StringBuilder(); + boolean arabic = QuranSettings.getInstance().isArabicNames(); if (rub3 % 8 == 0) { - sb.append("Juz' ").append((hizb/2) + 1); + sb.append(arabic ? "الجزء" : "Juz'").append(' ').append((hizb/2) + 1); } else { - sb.append("Hizb ").append(hizb); int remainder = rub3 % 4; if (remainder == 1) - sb.insert(0, "¼ "); + sb.append(arabic ? "ربع" : "¼").append(' '); else if (remainder == 2) - sb.insert(0, "½ "); + sb.append(arabic ? "نصف" : "½").append(' '); else if (remainder == 3) - sb.insert(0, "¾ "); + sb.append(arabic ? "ثلاثة أرباع" : "¾").append(' '); + sb.append(arabic ? "الحزب" : "Hizb").append(' ').append(hizb); } - Toast.makeText(mContext, sb.toString(), Toast.LENGTH_SHORT).show(); + Toast.makeText(mContext, ArabicStyle.reshape(sb.toString()), Toast.LENGTH_SHORT).show(); lastPopupTime = System.currentTimeMillis(); } From a0fef29ae4792f30c3e3355288a88992d0aef7e6 Mon Sep 17 00:00:00 2001 From: Ahmed Farra Date: Mon, 15 Aug 2011 03:47:41 +0800 Subject: [PATCH 10/35] +one more Arabic reshaping (play dialog) --- src/com/quran/labs/androidquran/QuranViewActivity.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/com/quran/labs/androidquran/QuranViewActivity.java b/src/com/quran/labs/androidquran/QuranViewActivity.java index 76512cdd12..01aa6dd33c 100644 --- a/src/com/quran/labs/androidquran/QuranViewActivity.java +++ b/src/com/quran/labs/androidquran/QuranViewActivity.java @@ -296,8 +296,9 @@ private void initDownloadRadioButtons(View parent, AyahItem ayahItem){ RadioButton radioJuz = (RadioButton) parent.findViewById(R.id.radioDownloadJuza); RadioButton radioPage = (RadioButton) parent.findViewById(R.id.radioDownloadPage); - radioSura.setText(QuranInfo.getSuraName(ayahItem.getSoura() - 1)); - radioJuz.setText(QuranInfo.getJuzTitle() + " " + QuranInfo.getJuzFromPage(QuranInfo.getPageFromSuraAyah(ayahItem.getSoura(), ayahItem.getAyah()))); + radioSura.setText(ArabicStyle.reshape(QuranInfo.getSuraName(ayahItem.getSoura() - 1))); + radioJuz.setText(ArabicStyle.reshape(QuranInfo.getJuzTitle() + " " + QuranInfo.getJuzFromPage( + QuranInfo.getPageFromSuraAyah(ayahItem.getSoura(), ayahItem.getAyah())))); radioPage.setText("Page"); } From 253f784ec2b1f56773eaf12dd25abcfea51f5cf5 Mon Sep 17 00:00:00 2001 From: Mahmoud Hossam Date: Sun, 21 Aug 2011 04:48:54 +0200 Subject: [PATCH 11/35] Cleaned up AboutUsActivity a bit. --- res/layout/about_us.xml | 2 +- .../labs/androidquran/AboutUsActivity.java | 41 ++++++------------- 2 files changed, 14 insertions(+), 29 deletions(-) diff --git a/res/layout/about_us.xml b/res/layout/about_us.xml index 229c69ec10..c5ea226818 100644 --- a/res/layout/about_us.xml +++ b/res/layout/about_us.xml @@ -18,7 +18,7 @@