another round of UI refresh
moved buttons in the url bar
fixed selected tab visuals (activated)
Change-Id: Ib69f9ca68b3d8cc8dfe6856f7248f21267127ae8
diff --git a/src/com/android/browser/TitleBarXLarge.java b/src/com/android/browser/TitleBarXLarge.java
index da39307..b652e15 100644
--- a/src/com/android/browser/TitleBarXLarge.java
+++ b/src/com/android/browser/TitleBarXLarge.java
@@ -57,6 +57,7 @@
private View mGoButton;
private ImageView mStopButton;
private View mAllButton;
+ private View mClearButton;
private PageProgressView mProgressView;
private UrlInputView mUrlFocused;
private TextView mUrlUnfocused;
@@ -88,6 +89,7 @@
mSearchButton = findViewById(R.id.search);
mLockIcon = (ImageView) findViewById(R.id.lock);
mGoButton = findViewById(R.id.go);
+ mClearButton = findViewById(R.id.clear);
mProgressView = (PageProgressView) findViewById(R.id.progress);
mFocusContainer = findViewById(R.id.urlbar_focused);
mUnfocusContainer = findViewById(R.id.urlbar_unfocused);
@@ -99,14 +101,15 @@
mStopButton.setOnClickListener(this);
mSearchButton.setOnClickListener(this);
mGoButton.setOnClickListener(this);
+ mClearButton.setOnClickListener(this);
mUrlFocused.setUrlInputListener(this);
mUrlUnfocused.setOnFocusChangeListener(this);
mUrlFocused.setContainer(mFocusContainer);
}
-
+
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
- swapUrlContainer(true);
+ setUrlMode(true);
mUrlFocused.selectAll();
mUrlFocused.requestFocus();
mUrlFocused.setDropDownWidth(mUnfocusContainer.getWidth());
@@ -132,6 +135,8 @@
if (!TextUtils.isEmpty(mUrlFocused.getText())) {
onAction(mUrlFocused.getText().toString());
}
+ } else if (mClearButton == v) {
+ mUrlFocused.setText("");
}
}
@@ -152,7 +157,7 @@
i.setAction(Intent.ACTION_SEARCH);
i.putExtra(SearchManager.QUERY, text);
mBrowserActivity.onNewIntent(i);
- swapUrlContainer(false);
+ setUrlMode(false);
setDisplayTitle(text);
}
@@ -160,8 +165,8 @@
public void onDismiss() {
mBrowserActivity.getTabControl().getCurrentTopWebView().requestFocus();
mBrowserActivity.hideFakeTitleBar();
+ setUrlMode(false);
setDisplayTitle(mBrowserActivity.getTabControl().getCurrentWebView().getUrl());
- swapUrlContainer(false);
}
@Override
@@ -172,6 +177,17 @@
}
}
+ private void setUrlMode(boolean focused) {
+ swapUrlContainer(focused);
+ if (focused) {
+ mSearchButton.setVisibility(View.GONE);
+ mGoButton.setVisibility(View.VISIBLE);
+ } else {
+ mSearchButton.setVisibility(View.VISIBLE);
+ mGoButton.setVisibility(View.GONE);
+ }
+ }
+
private void swapUrlContainer(boolean focus) {
mUnfocusContainer.setVisibility(focus ? View.GONE : View.VISIBLE);
mFocusContainer.setVisibility(focus ? View.VISIBLE : View.GONE);
@@ -203,6 +219,7 @@
@Override
void setProgress(int newProgress) {
if (newProgress >= PROGRESS_MAX) {
+ mProgressView.setProgress(PageProgressView.MAX_PROGRESS);
mProgressView.setVisibility(View.GONE);
mInLoad = false;
mStopButton.setImageDrawable(mReloadDrawable);
@@ -212,7 +229,8 @@
mInLoad = true;
mStopButton.setImageDrawable(mStopDrawable);
}
- mProgressView.setProgress(newProgress*10000/PROGRESS_MAX);
+ mProgressView.setProgress(newProgress * PageProgressView.MAX_PROGRESS
+ / PROGRESS_MAX);
}
}