summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/EdgeSwipeController.java
diff options
context:
space:
mode:
authorSagar Dhawan <sdhawan@codeaurora.org>2015-07-31 15:36:07 -0700
committerjrizzoli <joey@cyanogenmoditalia.it>2015-08-28 13:15:46 +0200
commit97ed6c909889287e0f2c0b81dc880dea69489deb (patch)
tree8a31bb2f45e55747a94dcfd9e15183fb151ee564 /src/com/android/browser/EdgeSwipeController.java
parent5a5d01f2c7dda08bcd65bffdfbfe99f65e5e57f9 (diff)
downloadandroid_packages_apps_Gello-97ed6c909889287e0f2c0b81dc880dea69489deb.tar.gz
android_packages_apps_Gello-97ed6c909889287e0f2c0b81dc880dea69489deb.tar.bz2
android_packages_apps_Gello-97ed6c909889287e0f2c0b81dc880dea69489deb.zip
Fix Edge Navigation incorrect page index detection
Swiping from the left edge on a new tab before the page loads, could some times leave edge navigation in a bad state. This was because there was no history for that tab. Also added minor fix for download paths and file names Change-Id: I94c94363275ceeb59b9d7756e728b535e3eaa32a
Diffstat (limited to 'src/com/android/browser/EdgeSwipeController.java')
-rw-r--r--src/com/android/browser/EdgeSwipeController.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/com/android/browser/EdgeSwipeController.java b/src/com/android/browser/EdgeSwipeController.java
index c82daa77..5d6edd52 100644
--- a/src/com/android/browser/EdgeSwipeController.java
+++ b/src/com/android/browser/EdgeSwipeController.java
@@ -39,6 +39,7 @@ import android.support.v4.widget.ViewDragHelper;
import android.view.View;
import org.codeaurora.swe.WebHistoryItem;
+import org.codeaurora.swe.WebView;
import org.codeaurora.swe.util.Activator;
import org.codeaurora.swe.util.Observable;
@@ -257,13 +258,21 @@ public class EdgeSwipeController extends ViewDragHelper.Callback {
}.start();
}
+ private int lastCommittedHistoryIndex() {
+ WebView wv = mActiveTab.getWebView();
+ if (wv == null || wv.getLastCommittedHistoryIndex() == -1)
+ return 0; // WebView is null or No History has been committed for this tab
+ else
+ return wv.getLastCommittedHistoryIndex();
+ }
+
private void monitorProgressAtHistoryUpdate(final int pageIndex) {
if (mCommitTimer != null) {
mCommitTimer.cancel();
}
if (mTitleBar.getProgressView().getProgressPercent() >= mMinProgress
- && mActiveTab.getWebView().getLastCommittedHistoryIndex() == pageIndex) {
+ && lastCommittedHistoryIndex() == pageIndex) {
swipeSessionCleanup();
return;
}
@@ -465,7 +474,9 @@ public class EdgeSwipeController extends ViewDragHelper.Callback {
public void onEdgeTouched (int edgeFlags, int pointerId) {
synchronized (this) {
- if (mActiveTab.isPrivateBrowsingEnabled() || mActiveTab.isKeyboardShowing()) {
+ if (mActiveTab.getWebView() == null ||
+ mActiveTab.isPrivateBrowsingEnabled() ||
+ mActiveTab.isKeyboardShowing()) {
mDragHelper.abort();
return;
}
@@ -478,7 +489,7 @@ public class EdgeSwipeController extends ViewDragHelper.Callback {
mView.init();
if (mCurrIndex == EDGE_SWIPE_INVALID_INDEX) {
- mCurrIndex = mActiveTab.getWebView().getLastCommittedHistoryIndex();
+ mCurrIndex = lastCommittedHistoryIndex();
}
mMaxIndex = mActiveTab.getWebView().copyBackForwardList().getSize() - 1;