mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-23 04:33:54 -04:00
#1031 Delete webview history when user clears Histry in HistoryActivity
This commit is contained in:
parent
3a449b149f
commit
4fd58b5aeb
@ -36,6 +36,7 @@ public class HistoryActivity extends BaseActivity implements HistoryContract.Vie
|
||||
private final List<HistoryListItem> fullHistory = new ArrayList<>();
|
||||
private final List<HistoryListItem> deleteList = new ArrayList<>();
|
||||
private static final String LIST_STATE_KEY = "recycler_list_state";
|
||||
public static final String USER_CLEARED_HISTORY = "user_cleared_history";
|
||||
|
||||
@BindView(R.id.toolbar)
|
||||
Toolbar toolbar;
|
||||
@ -192,6 +193,7 @@ public class HistoryActivity extends BaseActivity implements HistoryContract.Vie
|
||||
fullHistory.clear();
|
||||
historyList.clear();
|
||||
historyAdapter.notifyDataSetChanged();
|
||||
setResult(RESULT_OK, new Intent().putExtra(USER_CLEARED_HISTORY, true));
|
||||
Toast.makeText(this, R.string.all_history_cleared_toast, Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
}
|
||||
|
@ -1654,6 +1654,13 @@ public class MainActivity extends BaseActivity implements WebViewCallback,
|
||||
case REQUEST_FILE_SELECT:
|
||||
case REQUEST_HISTORY_ITEM_CHOSEN:
|
||||
if (resultCode == RESULT_OK) {
|
||||
if (data.getBooleanExtra(HistoryActivity.USER_CLEARED_HISTORY, false)) {
|
||||
for (KiwixWebView kiwixWebView : webViewList) {
|
||||
kiwixWebView.clearHistory();
|
||||
}
|
||||
webViewList.clear();
|
||||
newTab(HOME_URL);
|
||||
} else {
|
||||
String title = data.getStringExtra(EXTRA_CHOSE_X_TITLE);
|
||||
String url = data.getStringExtra(EXTRA_CHOSE_X_URL);
|
||||
if (data.getData() != null) {
|
||||
@ -1687,6 +1694,7 @@ public class MainActivity extends BaseActivity implements WebViewCallback,
|
||||
getCurrentWebView().loadUrl(ZimContentProvider.getPageUrlFromTitle(title));
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
default:
|
||||
|
Loading…
x
Reference in New Issue
Block a user