summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--src/com/android/browser/DownloadSettings.java2
-rw-r--r--src/com/android/browser/EdgeSwipeController.java17
2 files changed, 15 insertions, 4 deletions
diff --git a/src/com/android/browser/DownloadSettings.java b/src/com/android/browser/DownloadSettings.java
index 99be3568..0f91a0cb 100644
--- a/src/com/android/browser/DownloadSettings.java
+++ b/src/com/android/browser/DownloadSettings.java
@@ -205,7 +205,7 @@ public class DownloadSettings extends Activity {
public void onClick(View v) {
filenameBase = getFilenameBaseFromUserEnter();
// check the filename user enter is null or not
- if (filenameBase.length() <= 0) {
+ if (TextUtils.isEmpty(filenameBase) || TextUtils.isEmpty(downloadPath)) {
DownloadHandler.showFilenameEmptyDialog(DownloadSettings.this);
return;
}
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;