summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorMichael Kolb <kolby@google.com>2011-08-01 09:56:26 -0700
committerMichael Kolb <kolby@google.com>2011-08-01 10:32:19 -0700
commitc1eeb12b6e4570520c3571aba9c04be91b4a20d5 (patch)
treed851a5fea7f68c9f151231446c3b5f0d449fc837 /src/com
parentbf4dc0a894c4bec72ffb840de769ee01ff579932 (diff)
downloadpackages_apps_Browser-c1eeb12b6e4570520c3571aba9c04be91b4a20d5.zip
packages_apps_Browser-c1eeb12b6e4570520c3571aba9c04be91b4a20d5.tar.gz
packages_apps_Browser-c1eeb12b6e4570520c3571aba9c04be91b4a20d5.tar.bz2
fix last tab close bug
Bug: 5098467 The controller did not update the tab list correctly and called activity finish instead. The adapter got updated and showed the last tab still Now the controller removes the last tab before calling finish, so the visible update to the tab list is correct. Change-Id: Idf29dff7d60181c63f6b3ebcbc8a1562f027b2c1
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/browser/Controller.java1
-rw-r--r--src/com/android/browser/NavTabGallery.java2
-rw-r--r--src/com/android/browser/view/Gallery.java44
3 files changed, 23 insertions, 24 deletions
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index fc4c35c..457c2e0 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -2301,6 +2301,7 @@ public class Controller
public void closeCurrentTab() {
if (mTabControl.getTabCount() == 1) {
mCrashRecoveryHandler.clearState();
+ mTabControl.removeTab(getCurrentTab());
mActivity.finish();
return;
}
diff --git a/src/com/android/browser/NavTabGallery.java b/src/com/android/browser/NavTabGallery.java
index 8247a5d..8aa2782 100644
--- a/src/com/android/browser/NavTabGallery.java
+++ b/src/com/android/browser/NavTabGallery.java
@@ -151,7 +151,7 @@ public class NavTabGallery extends Gallery {
setGapPosition(position, mHorizontal ? v.getWidth() : v.getHeight());
}
mRemoveListener.onRemovePosition(position);
- if (!needsGap && position > 0) {
+ if (!needsGap && (position > 0) && (mAdapter.getCount() > 0)) {
scrollToChild(position - 1);
}
mAnimator = null;
diff --git a/src/com/android/browser/view/Gallery.java b/src/com/android/browser/view/Gallery.java
index 59e710d..78d4bc6 100644
--- a/src/com/android/browser/view/Gallery.java
+++ b/src/com/android/browser/view/Gallery.java
@@ -254,29 +254,27 @@ public class Gallery extends ViewGroup implements
resetList();
mItemCount = mAdapter.getCount();
// checkFocus();
- int position = mItemCount > 0 ? 0 : INVALID_POSITION;
- if (mSelectedPosition >= 0) {
- position = Math.min(mItemCount - 1, mSelectedPosition);
- }
- setSelectedPositionInt(position);
- if (mItemCount == 0) {
- // Nothing selected
- checkSelectionChanged();
- }
- if (mGapPosition > INVALID_POSITION) {
- mGapAnimator = ObjectAnimator.ofInt(this, "gap", mGap, 0);
- mGapAnimator.setDuration(250);
- mGapAnimator.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator a) {
- mGapPosition = INVALID_POSITION;
- mGap = 0;
- mGapAnimator = null;
- }
- });
- mGapAnimator.start();
- } else {
- layout(0, false);
+ if (mItemCount > 0) {
+ int position = 0;
+ if (mSelectedPosition >= 0) {
+ position = Math.min(mItemCount - 1, mSelectedPosition);
+ }
+ setSelectedPositionInt(position);
+ if (mGapPosition > INVALID_POSITION) {
+ mGapAnimator = ObjectAnimator.ofInt(this, "gap", mGap, 0);
+ mGapAnimator.setDuration(250);
+ mGapAnimator.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator a) {
+ mGapPosition = INVALID_POSITION;
+ mGap = 0;
+ mGapAnimator = null;
+ }
+ });
+ mGapAnimator.start();
+ } else {
+ layout(0, false);
+ }
}
} else {
// checkFocus();