added back toast for missing files in dev-mode

This commit is contained in:
Philipp Schaefer 2014-01-21 12:02:34 +01:00
parent d5da36a180
commit 65b3a4b0e0
2 changed files with 13 additions and 1 deletions

View File

@ -88,12 +88,21 @@ public class IITC_FileManager {
mAssetManager = mIitc.getAssets(); mAssetManager = mIitc.getAssets();
} }
private InputStream getAssetFile(String filename) throws IOException { private InputStream getAssetFile(final String filename) throws IOException {
if (mPrefs.getBoolean("pref_dev_checkbox", false)) { if (mPrefs.getBoolean("pref_dev_checkbox", false)) {
File file = new File(mIitcPath + "dev/" + filename); File file = new File(mIitcPath + "dev/" + filename);
try { try {
return new FileInputStream(file); return new FileInputStream(file);
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
mIitc.runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(mIitc, "File " + mIitcPath +
"dev/" + filename + " not found. " +
"Disable developer mode or add iitc files to the dev folder.",
Toast.LENGTH_SHORT).show();
}
});
Log.w(e); Log.w(e);
} }
} }

View File

@ -66,6 +66,9 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
// on tablets, select a default fragment BEFORE calling super onCreate
// otherwise the application will crash, because the first header (the
// category) does not have a fragment assigned
if (onIsMultiPane()) { if (onIsMultiPane()) {
getIntent() getIntent()
.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, PluginsFragment.class.getName()); .putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, PluginsFragment.class.getName());