Skip to content

Commit

Permalink
fix an audio and search bug. added sheikh qatami. added some logging.…
Browse files Browse the repository at this point in the history
… bumped the version number.
  • Loading branch information
ahmedre committed Oct 7, 2013
1 parent e607f86 commit 9491bea
Show file tree
Hide file tree
Showing 23 changed files with 647 additions and 161 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ App localization
* German by [Armin Supuk](http://github.com/ArminSupuk).
* Chinese by Bo Li
* Uyghur by Abduqadir Abliz [Sahran](http://github.com/Sahran)
* Indonesian by [Saiful Khaliq](http://twitter.com/saifious)


Terms of use
Expand Down Expand Up @@ -91,6 +92,11 @@ Changelog
- improve highlighting of search results
- fix issues with app being in a confused language state
- Russian translation updates
- added Turkish and Indonesian translations
- added sheikh Nasser al Qatami
- fix an issue where search results weren't highlighting in some cases
- fix an issue where next sura wasn't playing in some cases
- improve the jump to dialog
- switch build to gradle

**version 2.4.5** (released 7/9/2013)
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.quran.labs.androidquran" android:versionCode="245"
android:versionName="2.4.5"
package="com.quran.labs.androidquran" android:versionCode="246"
android:versionName="2.4.6"
android:installLocation="auto">

<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="14" />
Expand Down
77 changes: 18 additions & 59 deletions app/src/main/java/com/quran/labs/androidquran/HelpActivity.java
Original file line number Diff line number Diff line change
@@ -1,73 +1,32 @@
package com.quran.labs.androidquran;

import android.content.Intent;
import android.content.pm.PackageInfo;
import android.os.Bundle;
import android.text.Html;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.view.MenuItem;

public class HelpActivity extends SherlockActivity implements OnClickListener {
protected Button mEmailButton;
protected TextView mHelpText;
public class HelpActivity extends SherlockActivity {
public void onCreate(Bundle savedInstanceState) {
setTheme(R.style.Theme_Sherlock);
super.onCreate(savedInstanceState);

public void onCreate(Bundle savedInstanceState) {
setTheme(R.style.Theme_Sherlock);
super.onCreate(savedInstanceState);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);

getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setContentView(R.layout.help);

setContentView(R.layout.help);
mEmailButton = (Button)findViewById(R.id.btnEmailUs);
mEmailButton.setOnClickListener(this);
TextView helpText = (TextView) findViewById(R.id.txtHelp);
helpText.setText(Html.fromHtml(getString(R.string.help)));
}

mHelpText = (TextView)findViewById(R.id.txtHelp);
mHelpText.setText(Html.fromHtml(getString(R.string.help)));
}

@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.btnEmailUs:
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("plain/text");
String body = "\n\n";
try {
PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
body = pInfo.packageName + " Version: " + pInfo.versionName;
} catch (Exception e) {}

try {
body += "\nPhone: " + android.os.Build.MANUFACTURER + " " + android.os.Build.MODEL;
body += "\nAndroid Version: " + android.os.Build.VERSION.CODENAME + " "
+ android.os.Build.VERSION.RELEASE;
} catch (Exception e) {}

emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, body);
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
getString(R.string.email_subject));
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
new String[] { getString(R.string.email_to) });
startActivity(Intent.createChooser(emailIntent,
getString(R.string.send_email)));
break;
default:
break;
}
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home){
finish();
return true;
}
return false;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
finish();
return true;
}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Environment;
Expand All @@ -14,12 +13,14 @@
import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;

import com.actionbarsherlock.app.SherlockPreferenceActivity;
import com.quran.labs.androidquran.data.Constants;
import com.quran.labs.androidquran.util.*;
import com.quran.labs.androidquran.util.QuranFileUtils;
import com.quran.labs.androidquran.util.QuranScreenInfo;
import com.quran.labs.androidquran.util.QuranSettings;
import com.quran.labs.androidquran.util.StorageUtils;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.List;

Expand All @@ -30,7 +31,7 @@ public class QuranPreferenceActivity extends SherlockPreferenceActivity

private ListPreference mListStorageOptions;
private MoveFilesAsyncTask mMoveFilesTask;
private ReadLogsTask mReadLogsTask;
//private ReadLogsTask mReadLogsTask;
private List<StorageUtils.Storage> mStorageList;
private LoadStorageOptionsTask mLoadStorageOptionsTask;
private int mAppSize;
Expand Down Expand Up @@ -266,6 +267,7 @@ protected void onPostExecute(Void aVoid) {
}
}

/*
private class ReadLogsTask extends AsyncTask<Void, Void, String> {
@Override
Expand Down Expand Up @@ -325,4 +327,5 @@ protected void onPostExecute(String logs) {
getString(R.string.send_email)));
}
}
*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,11 @@ private void handleIntent(Intent intent) {
}
}

if (total == 0){
sura--;
total = QuranInfo.getNumAyahs(sura);
}

jumpToResult(sura, total);
finish();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;

import com.crashlytics.android.Crashlytics;
import com.quran.labs.androidquran.R;
import com.quran.labs.androidquran.util.QuranFileUtils;

Expand Down Expand Up @@ -37,6 +38,7 @@ public DatabaseHandler(Context context, String databaseName)
String base = QuranFileUtils.getQuranDatabaseDirectory(context);
if (base == null) return;
String path = base + File.separator + databaseName;
Crashlytics.log("opening database file: " + path);
mDatabase = SQLiteDatabase.openDatabase(path, null,
SQLiteDatabase.NO_LOCALIZED_COLLATORS);
mSchemaVersion = getSchemaVersion();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;

import com.crashlytics.android.Crashlytics;

public class SuraTimingDatabaseHandler {
private SQLiteDatabase mDatabase = null;
public static class TimingsTable {
Expand All @@ -14,6 +16,7 @@ public static class TimingsTable {
}

public SuraTimingDatabaseHandler(String path) throws SQLException {
Crashlytics.log("opening gapless data file, " + path);
mDatabase = SQLiteDatabase.openDatabase(path, null,
SQLiteDatabase.NO_LOCALIZED_COLLATORS);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public QuranAyah setCurrentAyah(int sura, int ayah){
else {
mCurrentSura = sura;
mCurrentAyah = ayah;
mAyahsInThisSura = QuranInfo.SURA_NUM_AYAHS[mCurrentSura-1];
mRepeatInfo.setCurrentVerse(mCurrentSura, mCurrentAyah);
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.AdapterView;
Expand Down Expand Up @@ -120,7 +121,12 @@ public void onNothingSelected(AdapterView<?> arg0) {
public void onClick(DialogInterface dialog, int which) {
try {
dialog.dismiss();
int page = Integer.parseInt(input.getText().toString());
String text = input.getText().toString();
if (TextUtils.isEmpty(text)){
text = input.getHint().toString();
}

int page = Integer.parseInt(text);
if (page >= Constants.PAGES_FIRST && page
<= Constants.PAGES_LAST) {
Activity activity = getActivity();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import android.support.v4.util.LruCache;
import android.util.Log;
import android.widget.ImageView;

import com.crashlytics.android.Crashlytics;
import com.quran.labs.androidquran.ui.fragment.ImageCacheFragment;
import com.quran.labs.androidquran.util.AsyncTask;
import com.quran.labs.androidquran.util.QuranScreenInfo;
Expand Down Expand Up @@ -112,23 +114,35 @@ public QuranPageWorkerTask(String widthParam, ImageView imageView) {
@Override
protected BitmapDrawable doInBackground(Integer... params) {
data = params[0];
Bitmap bitmap = QuranDisplayHelper.getQuranPage(
Bitmap bitmap = null;
OutOfMemoryError oom = null;

try {
bitmap = QuranDisplayHelper.getQuranPage(
mContext, mWidthParam, data);
} catch (OutOfMemoryError me){
Crashlytics.log(Log.WARN, TAG,
"out of memory exception loading page " +
data + ", " + mWidthParam);
oom = me;
}

if (bitmap == null){
Log.w(TAG, "null bitmap. items in cache: " + mMemoryCache.size() +
" vs " + mMemoryCache.maxSize());
Crashlytics.log(Log.WARN, TAG, "items in cache: " +
mMemoryCache.size() + " vs " + mMemoryCache.maxSize());
if (QuranScreenInfo.getInstance().isTablet(mContext)){
Log.w(TAG, "tablet got bitmap null, trying alternate width...");
Crashlytics.log(Log.WARN, TAG,
"tablet got bitmap null, trying alternate width...");
String param = QuranScreenInfo.getInstance().getWidthParam();
if (param.equals(mWidthParam)){
param = QuranScreenInfo.getInstance().getTabletWidthParam();
}
bitmap = QuranDisplayHelper.getQuranPage(mContext, param, data);
if (bitmap == null){
Log.w(TAG, "bitmap still null, giving up...");
Crashlytics.log(Log.WARN, TAG, "bitmap still null, giving up...");
}
}
Log.w(TAG, "got bitmap back as null...");
Crashlytics.log(Log.WARN, TAG, "got bitmap back as null...");
}

BitmapDrawable drawable = null;
Expand All @@ -141,6 +155,9 @@ protected BitmapDrawable doInBackground(Integer... params) {
}

addBitmapToCache(data + mWidthParam, drawable);
} else if (oom != null){
// throw the exception since we couldn't handle it
throw oom;
}

return drawable;
Expand Down
60 changes: 30 additions & 30 deletions app/src/main/res/layout/help.xml
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<TextView android:id="@+id/txtHelpTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#FFFFFF"
android:singleLine="true"
android:text="@string/help_title"
android:textStyle="bold"
android:padding="10dip"
android:layout_alignParentTop="true" />
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dip">

<ScrollView android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtHelpTitle"
android:layout_above="@+id/btnEmailUs">
<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#FFFFFF"
<TextView android:id="@+id/txtHelpTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#FFFFFF"
android:singleLine="true"
android:text="@string/help_title"
android:textStyle="bold"
android:paddingBottom="8dp" />

<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#FFFFFF"
android:id="@+id/txtHelp"
android:textSize="16dip"
android:padding="10dip"
android:textSize="16sp"
android:paddingBottom="8dp"
android:lineSpacingExtra="4dip" />
</ScrollView>

<Button android:id="@id/btnEmailUs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/email_quran_android"
android:layout_alignParentBottom="true" />
</RelativeLayout>
<TextView android:id="@+id/email_us"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autoLink="email"
android:text="@string/email_us" />
</LinearLayout>
</ScrollView>
10 changes: 4 additions & 6 deletions app/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
<string name="cancel">الغاء</string>
<string name="developedBy">لا تنسونا من صالح دعاءكم</string>
<string name="copyRights">حقوق الطبع محفوظة لجميع المسلمين</string>
<string name="email_subject">ردود الفعل</string>
<string name="send_email">ارسل رسالة..</string>

<string name="help_title">الاسئلة المتداولة</string>
<string name="help">
Expand Down Expand Up @@ -181,10 +179,10 @@
<string name="search_data">بيانات البحث</string>
<string name="need_translation">لم يتم تحميل أي تفسير أو ترجمة</string>
<string name="get_translations">حمّل التفسير أو الترجمة</string>
<!-- about us -->
<string name="email_quran_android">راسلنا</string>

<!-- help -->
<string name="email_us">اذا لم تجد اجابه سؤالكم بالاعلى فيمكنكم مراسلتنا على هذا البريد [email protected] للدعم. ونحيط بكم علما انه تصلنا كثير من الاسئله ، ولهذا قد لا نرد على جميع الرسائل.‎</string>

<!-- sura metainfo -->
<string name="makki">مكية</string>
<string name="madani">مدنية</string>
Expand Down
Loading

0 comments on commit 9491bea

Please sign in to comment.