Fixed bug that crashed dialogs

This commit is contained in:
Anthony Restaino 2015-04-28 18:57:10 -04:00
parent e042830e17
commit 2b59ea1906
2 changed files with 8 additions and 8 deletions

View File

@ -67,7 +67,7 @@ public class BookmarkActivity extends ThemableSettingsActivity implements OnClic
onCreateDialog(DIALOG_LOAD_FILE);
break;
case R.id.importFromBrowser:
mBookmarkManager.importBookmarksFromBrowser();
mBookmarkManager.importBookmarksFromBrowser(BookmarkActivity.this);
break;
case R.id.exportBackup:
mBookmarkManager.exportBookmarks();
@ -152,7 +152,7 @@ public class BookmarkActivity extends ThemableSettingsActivity implements OnClic
builder.setItems(mFileNameList, this);
builder.show();
} else {
mBookmarkManager.importBookmarksFromFile(mFileList[which]);
mBookmarkManager.importBookmarksFromFile(mFileList[which], BookmarkActivity.this);
}
}

View File

@ -320,7 +320,7 @@ public class BookmarkManager {
* This method imports all bookmarks that are included in the device's
* permanent bookmark storage
*/
public synchronized void importBookmarksFromBrowser() {
public synchronized void importBookmarksFromBrowser(Context context) {
if (PreferenceManager.getInstance().getSystemBrowserPresent()) {
List<HistoryItem> bookmarkList = new ArrayList<HistoryItem>();
@ -350,7 +350,7 @@ public class BookmarkManager {
Utils.showToast(mContext,
number + " " + mContext.getResources().getString(R.string.message_import));
} else {
Utils.createInformativeDialog(mContext,
Utils.createInformativeDialog(context,
mContext.getResources().getString(R.string.title_error), mContext
.getResources().getString(R.string.dialog_import_error));
}
@ -363,7 +363,7 @@ public class BookmarkManager {
* @param dir
* @param file
*/
public synchronized void importBookmarksFromFile(File file) {
public synchronized void importBookmarksFromFile(File file, Context context) {
if (file == null) {
return;
}
@ -388,17 +388,17 @@ public class BookmarkManager {
number + " " + mContext.getResources().getString(R.string.message_import));
} catch (FileNotFoundException e) {
e.printStackTrace();
Utils.createInformativeDialog(mContext,
Utils.createInformativeDialog(context,
mContext.getResources().getString(R.string.title_error), mContext
.getResources().getString(R.string.import_bookmark_error));
} catch (IOException e) {
e.printStackTrace();
Utils.createInformativeDialog(mContext,
Utils.createInformativeDialog(context,
mContext.getResources().getString(R.string.title_error), mContext
.getResources().getString(R.string.import_bookmark_error));
} catch (JSONException e) {
e.printStackTrace();
Utils.createInformativeDialog(mContext,
Utils.createInformativeDialog(context,
mContext.getResources().getString(R.string.title_error), mContext
.getResources().getString(R.string.import_bookmark_error));
}