summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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();