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;
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;
public boolean onMenuItemClick(final MenuItem menuItem) {
final Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri
- .parse("http://code.google.com/p/quickdic-dictionary/issues/entry"));
+ .parse("http://github.com/rdoeffinger/Dictionary/issues"));
context.startActivity(intent);
return false;
}
}
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.getExternalStorageDirectory();
+ 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;
}
file.getName(), dictionaryInfo);
}
} else {
- Log.w(LOG, "dictDir is not a diretory: " + getDictDir().getPath());
+ Log.w(LOG, "dictDir is not a directory: " + getDictDir().getPath());
}
if (!toAddSorted.isEmpty()) {
Collections.sort(toAddSorted, uncompressedFilenameComparator);