Fix suggestion edit button
Bug 3052626
Bug 3052664
added vertical divider
refresh dropdown when sugegstion is selected
Change-Id: I3f2e72bbd9a93ccc3a7968e646493945c0052d2b
diff --git a/res/layout/suggestion_item.xml b/res/layout/suggestion_item.xml
index fec5ae3..37e1f2a 100644
--- a/res/layout/suggestion_item.xml
+++ b/res/layout/suggestion_item.xml
@@ -55,6 +55,13 @@
android:layout_below="@android:id/text1"
android:layout_alignLeft="@android:id/text1" />
</RelativeLayout>
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:id="@+id/divider"
+ android:scaleType="center"
+ android:src="@drawable/divider_vert"
+ />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
diff --git a/src/com/android/browser/SuggestionsAdapter.java b/src/com/android/browser/SuggestionsAdapter.java
index 7cfd78e..30e46fe 100644
--- a/src/com/android/browser/SuggestionsAdapter.java
+++ b/src/com/android/browser/SuggestionsAdapter.java
@@ -209,6 +209,7 @@
ImageView ic1 = (ImageView) view.findViewById(R.id.icon1);
View spacer = view.findViewById(R.id.spacer);
View ic2 = view.findViewById(R.id.icon2);
+ View div = view.findViewById(R.id.divider);
tv1.setText(item.title);
tv2.setText(item.url);
int id = -1;
@@ -234,6 +235,7 @@
}
ic2.setVisibility(((TYPE_SUGGEST == item.type) || (TYPE_SEARCH == item.type))
? View.VISIBLE : View.GONE);
+ div.setVisibility(ic2.getVisibility());
spacer.setVisibility(((TYPE_SUGGEST == item.type) || (TYPE_SEARCH == item.type))
? View.GONE : View.INVISIBLE);
view.setOnClickListener(this);
diff --git a/src/com/android/browser/TitleBarXLarge.java b/src/com/android/browser/TitleBarXLarge.java
index 57098a9..93a6fb5 100644
--- a/src/com/android/browser/TitleBarXLarge.java
+++ b/src/com/android/browser/TitleBarXLarge.java
@@ -171,7 +171,7 @@
@Override
public void onEdit(String text) {
- setDisplayTitle(text);
+ setDisplayTitle(text, true);
if (text != null) {
mUrlFocused.setSelection(text.length());
}
@@ -240,4 +240,9 @@
mUrlUnfocused.setText(title);
}
+ void setDisplayTitle(String title, boolean filter) {
+ mUrlFocused.setText(title, filter);
+ mUrlUnfocused.setText(title);
+ }
+
}