Skip to content

Commit

Permalink
Add hacks to help debug download issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
rdoeffinger committed Nov 17, 2015
1 parent 643d5c8 commit 15ee92c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hughes.android.dictionary"
android:installLocation="auto"
android:versionCode="37"
android:versionName="5.1.0" >
android:versionCode="38"
android:versionName="5.1.1" >

<uses-sdk
android:minSdkVersion="10"
Expand Down
17 changes: 17 additions & 0 deletions src/com/hughes/android/dictionary/DictionaryApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.preference.PreferenceManager;
import android.support.v4.view.MenuItemCompat;
Expand All @@ -32,6 +33,7 @@
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView.ScaleType;
import android.widget.Toast;

import com.hughes.android.dictionary.DictionaryInfo.IndexInfo;
import com.hughes.android.dictionary.engine.Dictionary;
Expand Down Expand Up @@ -400,6 +402,21 @@ public synchronized File getDictDir() {
}
dictDir = new File(dir);
dictDir.mkdirs();
if (!dictDir.isDirectory() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
getApplicationContext().getExternalFilesDirs(null);
}
if (!dictDir.isDirectory() || !dictDir.canWrite()) {
String dirs = " " + Environment.getExternalStoragePublicDirectory(null);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
File[] files = getApplicationContext().getExternalFilesDirs(null);
for (File f : files) {
dirs += " " + f.getAbsolutePath();
}
} else {
dirs += " " + getApplicationContext().getExternalFilesDir(null).getAbsolutePath();
}
Toast.makeText(getApplicationContext(), "Chosen directory not writeable, try one of" + dirs, Toast.LENGTH_LONG).show();
}
return dictDir;
}

Expand Down

0 comments on commit 15ee92c

Please sign in to comment.