summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/browser/BrowserBookmarksPage.java1
-rw-r--r--src/com/android/browser/Controller.java10
-rw-r--r--src/com/android/browser/NavigationBarTablet.java6
-rw-r--r--src/com/android/browser/UrlInputView.java25
-rw-r--r--src/com/android/browser/UrlUtils.java8
-rw-r--r--src/com/android/browser/view/BookmarkExpandableView.java2
6 files changed, 38 insertions, 14 deletions
diff --git a/src/com/android/browser/BrowserBookmarksPage.java b/src/com/android/browser/BrowserBookmarksPage.java
index bf96597..e2447e8 100644
--- a/src/com/android/browser/BrowserBookmarksPage.java
+++ b/src/com/android/browser/BrowserBookmarksPage.java
@@ -393,6 +393,7 @@ public class BrowserBookmarksPage extends Fragment implements View.OnCreateConte
public void onDestroyView() {
super.onDestroyView();
mGrid.setBreadcrumbController(null);
+ mGrid.clearAccounts();
LoaderManager lm = getLoaderManager();
lm.destroyLoader(LOADER_ACCOUNTS);
for (int id : mBookmarkAdapters.keySet()) {
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index 67c42dd..b7cdcd4 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -1535,7 +1535,10 @@ public class Controller
break;
case R.id.add_bookmark_menu_id:
- mActivity.startActivity(createBookmarkCurrentPageIntent(false));
+ Intent bookmarkIntent = createBookmarkCurrentPageIntent(false);
+ if (bookmarkIntent != null) {
+ mActivity.startActivity(bookmarkIntent);
+ }
break;
case R.id.stop_reload_menu_id:
@@ -1856,9 +1859,12 @@ public class Controller
*/
@Override
public Intent createBookmarkCurrentPageIntent(boolean editExisting) {
+ WebView w = getCurrentTopWebView();
+ if (w == null) {
+ return null;
+ }
Intent i = new Intent(mActivity,
AddBookmarkPage.class);
- WebView w = getCurrentTopWebView();
i.putExtra(BrowserContract.Bookmarks.URL, w.getUrl());
i.putExtra(BrowserContract.Bookmarks.TITLE, w.getTitle());
String touchIconUrl = w.getTouchIconUrl();
diff --git a/src/com/android/browser/NavigationBarTablet.java b/src/com/android/browser/NavigationBarTablet.java
index 8c08dcf..661ed71 100644
--- a/src/com/android/browser/NavigationBarTablet.java
+++ b/src/com/android/browser/NavigationBarTablet.java
@@ -20,6 +20,7 @@ import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.Context;
+import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap;
@@ -161,7 +162,10 @@ public class NavigationBarTablet extends NavigationBarBase {
} else if (mForwardButton == v) {
mUiController.getCurrentTab().goForward();
} else if (mStar == v) {
- getContext().startActivity(mUiController.createBookmarkCurrentPageIntent(true));
+ Intent intent = mUiController.createBookmarkCurrentPageIntent(true);
+ if (intent != null) {
+ getContext().startActivity(intent);
+ }
} else if (mAllButton == v) {
mUiController.bookmarksOrHistoryPicker(false);
} else if (mSearchButton == v) {
diff --git a/src/com/android/browser/UrlInputView.java b/src/com/android/browser/UrlInputView.java
index fbdf400..96ab864 100644
--- a/src/com/android/browser/UrlInputView.java
+++ b/src/com/android/browser/UrlInputView.java
@@ -18,8 +18,10 @@ package com.android.browser;
import android.content.Context;
import android.content.res.Configuration;
+import android.content.res.TypedArray;
import android.database.DataSetObserver;
import android.graphics.Rect;
+import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Patterns;
@@ -41,6 +43,7 @@ import com.android.browser.autocomplete.SuggestiveAutoCompleteTextView;
import com.android.browser.search.SearchEngine;
import com.android.browser.search.SearchEngineInfo;
import com.android.browser.search.SearchEngines;
+import com.android.internal.R;
import java.util.List;
@@ -77,20 +80,27 @@ public class UrlInputView extends SuggestiveAutoCompleteTextView
private int mState;
private StateListener mStateListener;
+ private Rect mPopupPadding;
public UrlInputView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
+ TypedArray a = context.obtainStyledAttributes(
+ attrs, com.android.internal.R.styleable.PopupWindow,
+ R.attr.autoCompleteTextViewStyle, 0);
+
+ Drawable popupbg = a.getDrawable(R.styleable.PopupWindow_popupBackground);
+ a.recycle();
+ mPopupPadding = new Rect();
+ popupbg.getPadding(mPopupPadding);
init(context);
}
public UrlInputView(Context context, AttributeSet attrs) {
- super(context, attrs);
- init(context);
+ this(context, attrs, R.attr.autoCompleteTextViewStyle);
}
public UrlInputView(Context context) {
- super(context);
- init(context);
+ this(context, null);
}
private void init(Context ctx) {
@@ -233,11 +243,14 @@ public class UrlInputView extends SuggestiveAutoCompleteTextView
private void setupDropDown() {
int width = mContainer != null ? mContainer.getWidth() : getWidth();
+ width += mPopupPadding.left + mPopupPadding.right;
if (width != getDropDownWidth()) {
setDropDownWidth(width);
}
- if (getLeft() != -getDropDownHorizontalOffset()) {
- setDropDownHorizontalOffset(-getLeft());
+ int left = getLeft();
+ left += mPopupPadding.left;
+ if (left != -getDropDownHorizontalOffset()) {
+ setDropDownHorizontalOffset(-left);
}
}
diff --git a/src/com/android/browser/UrlUtils.java b/src/com/android/browser/UrlUtils.java
index 681b242..e24000c 100644
--- a/src/com/android/browser/UrlUtils.java
+++ b/src/com/android/browser/UrlUtils.java
@@ -40,22 +40,22 @@ public class UrlUtils {
private final static String QUICKSEARCH_G = "http://www.google.com/m?q=%s";
private final static String QUERY_PLACE_HOLDER = "%s";
- // Regular expression to strip http://, optionally www., and optionally
+ // Regular expression to strip http:// and optionally
// the trailing slash
private static final Pattern STRIP_URL_PATTERN =
- Pattern.compile("^http://(?:www\\.)?(.*?)/?$");
+ Pattern.compile("^http://(.*?)/?$");
private UrlUtils() { /* cannot be instantiated */ }
/**
- * Strips the provided url of preceding "http://", "www.", and any trailing "/". Does not
+ * Strips the provided url of preceding "http://" and any trailing "/". Does not
* strip "https://". If the provided string cannot be stripped, the original string
* is returned.
*
* TODO: Put this in TextUtils to be used by other packages doing something similar.
*
* @param url a url to strip, like "http://www.google.com/"
- * @return a stripped url like "google.com", or the original string if it could
+ * @return a stripped url like "www.google.com", or the original string if it could
* not be stripped
*/
public static String stripUrl(String url) {
diff --git a/src/com/android/browser/view/BookmarkExpandableView.java b/src/com/android/browser/view/BookmarkExpandableView.java
index edc497b..44a123a 100644
--- a/src/com/android/browser/view/BookmarkExpandableView.java
+++ b/src/com/android/browser/view/BookmarkExpandableView.java
@@ -345,7 +345,7 @@ public class BookmarkExpandableView extends ExpandableListView
@Override
public void onInvalidated() {
- notifyDataSetChanged();
+ notifyDataSetInvalidated();
}
};