Fixed bug that crashed dialogs
This commit is contained in:
parent
e042830e17
commit
2b59ea1906
@ -67,7 +67,7 @@ public class BookmarkActivity extends ThemableSettingsActivity implements OnClic
|
|||||||
onCreateDialog(DIALOG_LOAD_FILE);
|
onCreateDialog(DIALOG_LOAD_FILE);
|
||||||
break;
|
break;
|
||||||
case R.id.importFromBrowser:
|
case R.id.importFromBrowser:
|
||||||
mBookmarkManager.importBookmarksFromBrowser();
|
mBookmarkManager.importBookmarksFromBrowser(BookmarkActivity.this);
|
||||||
break;
|
break;
|
||||||
case R.id.exportBackup:
|
case R.id.exportBackup:
|
||||||
mBookmarkManager.exportBookmarks();
|
mBookmarkManager.exportBookmarks();
|
||||||
@ -152,7 +152,7 @@ public class BookmarkActivity extends ThemableSettingsActivity implements OnClic
|
|||||||
builder.setItems(mFileNameList, this);
|
builder.setItems(mFileNameList, this);
|
||||||
builder.show();
|
builder.show();
|
||||||
} else {
|
} else {
|
||||||
mBookmarkManager.importBookmarksFromFile(mFileList[which]);
|
mBookmarkManager.importBookmarksFromFile(mFileList[which], BookmarkActivity.this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,7 +320,7 @@ public class BookmarkManager {
|
|||||||
* This method imports all bookmarks that are included in the device's
|
* This method imports all bookmarks that are included in the device's
|
||||||
* permanent bookmark storage
|
* permanent bookmark storage
|
||||||
*/
|
*/
|
||||||
public synchronized void importBookmarksFromBrowser() {
|
public synchronized void importBookmarksFromBrowser(Context context) {
|
||||||
if (PreferenceManager.getInstance().getSystemBrowserPresent()) {
|
if (PreferenceManager.getInstance().getSystemBrowserPresent()) {
|
||||||
|
|
||||||
List<HistoryItem> bookmarkList = new ArrayList<HistoryItem>();
|
List<HistoryItem> bookmarkList = new ArrayList<HistoryItem>();
|
||||||
@ -350,7 +350,7 @@ public class BookmarkManager {
|
|||||||
Utils.showToast(mContext,
|
Utils.showToast(mContext,
|
||||||
number + " " + mContext.getResources().getString(R.string.message_import));
|
number + " " + mContext.getResources().getString(R.string.message_import));
|
||||||
} else {
|
} else {
|
||||||
Utils.createInformativeDialog(mContext,
|
Utils.createInformativeDialog(context,
|
||||||
mContext.getResources().getString(R.string.title_error), mContext
|
mContext.getResources().getString(R.string.title_error), mContext
|
||||||
.getResources().getString(R.string.dialog_import_error));
|
.getResources().getString(R.string.dialog_import_error));
|
||||||
}
|
}
|
||||||
@ -363,7 +363,7 @@ public class BookmarkManager {
|
|||||||
* @param dir
|
* @param dir
|
||||||
* @param file
|
* @param file
|
||||||
*/
|
*/
|
||||||
public synchronized void importBookmarksFromFile(File file) {
|
public synchronized void importBookmarksFromFile(File file, Context context) {
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -388,17 +388,17 @@ public class BookmarkManager {
|
|||||||
number + " " + mContext.getResources().getString(R.string.message_import));
|
number + " " + mContext.getResources().getString(R.string.message_import));
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Utils.createInformativeDialog(mContext,
|
Utils.createInformativeDialog(context,
|
||||||
mContext.getResources().getString(R.string.title_error), mContext
|
mContext.getResources().getString(R.string.title_error), mContext
|
||||||
.getResources().getString(R.string.import_bookmark_error));
|
.getResources().getString(R.string.import_bookmark_error));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Utils.createInformativeDialog(mContext,
|
Utils.createInformativeDialog(context,
|
||||||
mContext.getResources().getString(R.string.title_error), mContext
|
mContext.getResources().getString(R.string.title_error), mContext
|
||||||
.getResources().getString(R.string.import_bookmark_error));
|
.getResources().getString(R.string.import_bookmark_error));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Utils.createInformativeDialog(mContext,
|
Utils.createInformativeDialog(context,
|
||||||
mContext.getResources().getString(R.string.title_error), mContext
|
mContext.getResources().getString(R.string.title_error), mContext
|
||||||
.getResources().getString(R.string.import_bookmark_error));
|
.getResources().getString(R.string.import_bookmark_error));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user