diff options
| author | Leon Scroggins <scroggo@google.com> | 2010-01-11 13:06:21 -0500 |
|---|---|---|
| committer | Leon Scroggins <scroggo@google.com> | 2010-01-11 13:06:21 -0500 |
| commit | fde9746ac3055848e110c35f19ec5893c621f766 (patch) | |
| tree | fd1e49ba64e33fbdf53d294ae3ab2898c9994e2f /src/com/android/browser/BrowserHistoryPage.java | |
| parent | 02065b07aea6b4392c344a4172c3ab56019225ed (diff) | |
| download | packages_apps_Browser-fde9746ac3055848e110c35f19ec5893c621f766.tar.gz packages_apps_Browser-fde9746ac3055848e110c35f19ec5893c621f766.tar.bz2 packages_apps_Browser-fde9746ac3055848e110c35f19ec5893c621f766.zip | |
Clear parent/child tab relationships when clearing history.
Fixes http://b/issue?id=2330279
Diffstat (limited to 'src/com/android/browser/BrowserHistoryPage.java')
| -rw-r--r-- | src/com/android/browser/BrowserHistoryPage.java | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/com/android/browser/BrowserHistoryPage.java b/src/com/android/browser/BrowserHistoryPage.java index 2eab1813c..831d63fdb 100644 --- a/src/com/android/browser/BrowserHistoryPage.java +++ b/src/com/android/browser/BrowserHistoryPage.java @@ -134,7 +134,12 @@ public class BrowserHistoryPage extends ExpandableListActivity { false); CombinedBookmarkHistoryActivity.getIconListenerSet() .addListener(mIconReceiver); - + Activity parent = getParent(); + if (null == parent + || !(parent instanceof CombinedBookmarkHistoryActivity)) { + throw new AssertionError("history page can only be viewed as a tab" + + "in CombinedBookmarkHistoryActivity"); + } // initialize the result to canceled, so that if the user just presses // back then it will have the correct result setResultToParent(RESULT_CANCELED, null); @@ -165,9 +170,11 @@ public class BrowserHistoryPage extends ExpandableListActivity { public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.clear_history_menu_id: - // FIXME: Need to clear the tab control in browserActivity - // as well Browser.clearHistory(getContentResolver()); + // BrowserHistoryPage is always a child of + // CombinedBookmarkHistoryActivity + ((CombinedBookmarkHistoryActivity) getParent()) + .removeParentChildRelationShips(); mAdapter.refreshData(); return true; @@ -275,13 +282,12 @@ public class BrowserHistoryPage extends ExpandableListActivity { return false; } - // This Activity is generally a sub-Activity of CombinedHistoryActivity. In - // that situation, we need to pass our result code up to our parent. - // However, if someone calls this Activity directly, then this has no - // parent, and it needs to set it on itself. + // This Activity is always a sub-Activity of + // CombinedBookmarkHistoryActivity. Therefore, we need to pass our + // result code up to our parent. private void setResultToParent(int resultCode, Intent data) { - Activity a = getParent() == null ? this : getParent(); - a.setResult(resultCode, data); + ((CombinedBookmarkHistoryActivity) getParent()).setResultFromChild( + resultCode, data); } private class ChangeObserver extends ContentObserver { |
