From 001650929f9c918fbfc68c10cc5ae6c5806630a0 Mon Sep 17 00:00:00 2001 From: ahmedre Date: Sat, 15 Jun 2013 11:56:23 -0700 Subject: [PATCH] prepare for 2.4 release, integrate hockeyapp, fix click issue on translation text, copy text on long click for pre-3.0 devices. --- README.md | 5 ++-- app/AndroidManifest.xml | 10 ++++--- app/pom.xml | 5 ++++ .../labs/androidquran/QuranDataActivity.java | 8 +++++ .../labs/androidquran/data/Constants.java | 2 ++ .../quran/labs/androidquran/util/ApiKeys.java | 1 + .../androidquran/util/QuranCrashListener.java | 23 ++++++++++++++ .../androidquran/widgets/TranslationView.java | 30 +++++++++++++++++++ 8 files changed, 78 insertions(+), 6 deletions(-) create mode 100644 app/src/main/java/com/quran/labs/androidquran/util/QuranCrashListener.java diff --git a/README.md b/README.md index 87cd660bd5..aaa0ad985e 100644 --- a/README.md +++ b/README.md @@ -75,15 +75,16 @@ Open Source Projects Used Changelog --------- -**development** +**version 2.4.0** (released 6/15/2013) - update to german translation (thanks br Armin Supuk) - kurdish translation (thanks br Gharib Karim) - improvements to search - multiple sdcard support -- tablet support (experimental) +- tablet support for reading view - change color of text in translation view and night mode - uyghur translation (thanks br Abduqadir Abliz) +- crash reporting to help us fix issues **version 2.3.1** (released 4/2/2013) diff --git a/app/AndroidManifest.xml b/app/AndroidManifest.xml index cdeaf7a539..50068a8b0c 100644 --- a/app/AndroidManifest.xml +++ b/app/AndroidManifest.xml @@ -1,7 +1,7 @@ @@ -76,6 +76,8 @@ - - + + + + diff --git a/app/pom.xml b/app/pom.xml index c6d86854ee..ed29305f28 100644 --- a/app/pom.xml +++ b/app/pom.xml @@ -29,6 +29,11 @@ ${abs.version} apklib + + net.hockeyapp.android + HockeySDK + 2.2.1 + diff --git a/app/src/main/java/com/quran/labs/androidquran/QuranDataActivity.java b/app/src/main/java/com/quran/labs/androidquran/QuranDataActivity.java index b2fa23d84b..43c5131f07 100644 --- a/app/src/main/java/com/quran/labs/androidquran/QuranDataActivity.java +++ b/app/src/main/java/com/quran/labs/androidquran/QuranDataActivity.java @@ -19,8 +19,11 @@ import com.quran.labs.androidquran.service.util.DefaultDownloadReceiver; import com.quran.labs.androidquran.service.util.ServiceIntentHelper; import com.quran.labs.androidquran.ui.QuranActivity; +import com.quran.labs.androidquran.util.ApiKeys; +import com.quran.labs.androidquran.util.QuranCrashListener; import com.quran.labs.androidquran.util.QuranFileUtils; import com.quran.labs.androidquran.util.QuranScreenInfo; +import net.hockeyapp.android.CrashManager; import java.util.Date; @@ -63,6 +66,11 @@ public void onCreate(Bundle savedInstanceState) { @Override protected void onResume(){ super.onResume(); + if (Constants.CRASH_REPORTING_ENABLED){ + CrashManager.register(this, ApiKeys.HOCKEY_APP_KEY, + QuranCrashListener.getInstance()); + } + mIsPaused = false; mDownloadReceiver = new DefaultDownloadReceiver(this, QuranDownloadService.DOWNLOAD_TYPE_PAGES); diff --git a/app/src/main/java/com/quran/labs/androidquran/data/Constants.java b/app/src/main/java/com/quran/labs/androidquran/data/Constants.java index 6235956aa7..0ea699126c 100644 --- a/app/src/main/java/com/quran/labs/androidquran/data/Constants.java +++ b/app/src/main/java/com/quran/labs/androidquran/data/Constants.java @@ -1,6 +1,8 @@ package com.quran.labs.androidquran.data; public class Constants { + public static final boolean CRASH_REPORTING_ENABLED = false; + // Numerics public static final int DEFAULT_NIGHT_MODE_TEXT_BRIGHTNESS = 98; public static final int DEFAULT_TEXT_SIZE = 15; diff --git a/app/src/main/java/com/quran/labs/androidquran/util/ApiKeys.java b/app/src/main/java/com/quran/labs/androidquran/util/ApiKeys.java index 6fc737c8f3..a47618e21a 100644 --- a/app/src/main/java/com/quran/labs/androidquran/util/ApiKeys.java +++ b/app/src/main/java/com/quran/labs/androidquran/util/ApiKeys.java @@ -2,4 +2,5 @@ public class ApiKeys { public static final String QURAN_APP_KEY = ""; + public static final String HOCKEY_APP_KEY = ""; } diff --git a/app/src/main/java/com/quran/labs/androidquran/util/QuranCrashListener.java b/app/src/main/java/com/quran/labs/androidquran/util/QuranCrashListener.java new file mode 100644 index 0000000000..ab2f59d533 --- /dev/null +++ b/app/src/main/java/com/quran/labs/androidquran/util/QuranCrashListener.java @@ -0,0 +1,23 @@ +package com.quran.labs.androidquran.util; + +import net.hockeyapp.android.CrashManagerListener; + +/** + * Created by ahmedre on 6/15/13. + */ +public class QuranCrashListener extends CrashManagerListener { + private static QuranCrashListener sInstance; + + public static QuranCrashListener getInstance(){ + if (sInstance == null){ + sInstance = new QuranCrashListener(); + } + return sInstance; + } + + @Override + public Boolean onCrashesFound() { + // automatically send crashes + return true; + } +} diff --git a/app/src/main/java/com/quran/labs/androidquran/widgets/TranslationView.java b/app/src/main/java/com/quran/labs/androidquran/widgets/TranslationView.java index de7a73a287..9de7ec942b 100644 --- a/app/src/main/java/com/quran/labs/androidquran/widgets/TranslationView.java +++ b/app/src/main/java/com/quran/labs/androidquran/widgets/TranslationView.java @@ -1,5 +1,7 @@ package com.quran.labs.androidquran.widgets; +import android.app.Service; +import android.text.ClipboardManager; import android.content.Context; import android.content.res.Resources; import android.graphics.Color; @@ -15,6 +17,7 @@ import android.widget.LinearLayout; import android.widget.ScrollView; import android.widget.TextView; +import android.widget.Toast; import com.quran.labs.androidquran.R; import com.quran.labs.androidquran.common.QuranAyah; import com.quran.labs.androidquran.data.QuranInfo; @@ -163,6 +166,29 @@ public void highlightAyah(int ayahId){ else { mLastHighlightedAyah = -1; } } + private OnClickListener mOnAyahClickListener = new OnClickListener() { + @Override + public void onClick(View v) { + if (mTranslationClickedListener != null){ + mTranslationClickedListener.onTranslationClicked(); + } + } + }; + + private OnLongClickListener mOnCopyAyahListener = new OnLongClickListener(){ + @Override + public boolean onLongClick(View v) { + if (v instanceof TextView){ + ClipboardManager mgr = (ClipboardManager)mContext. + getSystemService(Service.CLIPBOARD_SERVICE); + mgr.setText(((TextView)v).getText()); + Toast.makeText(mContext, R.string.ayah_copied_popup, + Toast.LENGTH_SHORT).show(); + } + return true; + } + }; + private void addTextForAyah(QuranAyah ayah){ LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( LayoutParams.MATCH_PARENT, @@ -181,6 +207,7 @@ private void addTextForAyah(QuranAyah ayah){ TextView ayahView = new TextView(mContext); ayahView.setId( QuranInfo.getAyahId(ayah.getSura(), ayah.getAyah())); + ayahView.setOnClickListener(mOnAyahClickListener); ayahView.setTextAppearance(mContext, mTextStyle); if (mIsNightMode){ ayahView.setTextColor(mNightModeTextColor); } @@ -242,6 +269,9 @@ private void addTextForAyah(QuranAyah ayah){ if (Build.VERSION.SDK_INT >= 11){ ayahView.setTextIsSelectable(true); } + else { + ayahView.setOnLongClickListener(mOnCopyAyahListener); + } mLinearLayout.addView(ayahView, params); }