Skip to content

Commit 1705b2a

Browse files
adampAndroid (Google) Code Review
authored andcommitted
Merge "Fix some oddities in ResolverActivity" into jb-dev
2 parents 92d7f9f + 9bee466 commit 1705b2a

File tree

3 files changed

+32
-10
lines changed

3 files changed

+32
-10
lines changed

core/java/com/android/internal/app/ResolverActivity.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,30 @@ protected void onStop() {
209209
}
210210
}
211211

212+
@Override
213+
protected void onRestoreInstanceState(Bundle savedInstanceState) {
214+
super.onRestoreInstanceState(savedInstanceState);
215+
if (mAlwaysUseOption) {
216+
final int checkedPos = mGrid.getCheckedItemPosition();
217+
final boolean enabled = checkedPos != GridView.INVALID_POSITION;
218+
mAlwaysButton.setEnabled(enabled);
219+
mOnceButton.setEnabled(enabled);
220+
if (enabled) {
221+
mGrid.setSelection(checkedPos);
222+
}
223+
}
224+
}
225+
212226
@Override
213227
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
214228
if (mAlwaysUseOption) {
215229
final int checkedPos = mGrid.getCheckedItemPosition();
216230
final boolean enabled = checkedPos != GridView.INVALID_POSITION;
217231
mAlwaysButton.setEnabled(enabled);
218232
mOnceButton.setEnabled(enabled);
233+
if (enabled) {
234+
mGrid.smoothScrollToPosition(checkedPos);
235+
}
219236
} else {
220237
startSelected(position, false);
221238
}

core/res/res/layout/resolver_grid.xml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,20 @@
2323
android:divider="?android:attr/dividerHorizontal"
2424
android:showDividers="middle"
2525
android:dividerPadding="0dip">
26-
<GridView
27-
android:layout_gravity="center"
28-
android:layout_height="wrap_content"
29-
android:layout_width="wrap_content"
30-
android:id="@+id/resolver_grid"
31-
android:numColumns="4"
32-
android:columnWidth="128dp"
33-
android:padding="16dp"
34-
android:clipToPadding="false" />
26+
<FrameLayout android:layout_width="match_parent"
27+
android:layout_height="wrap_content"
28+
android:layout_weight="1">
29+
<GridView
30+
android:layout_gravity="center"
31+
android:layout_width="wrap_content"
32+
android:layout_height="match_parent"
33+
android:id="@+id/resolver_grid"
34+
android:numColumns="4"
35+
android:columnWidth="128dp"
36+
android:padding="16dp"
37+
android:clipToPadding="false"
38+
android:scrollbarStyle="outsideOverlay" />
39+
</FrameLayout>
3540
<LinearLayout
3641
android:id="@+id/button_bar"
3742
android:visibility="gone"

core/res/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3562,7 +3562,7 @@
35623562

35633563
<!-- Title for a button to choose the currently selected activity
35643564
as the default in the activity resolver. [CHAR LIMIT=25] -->
3565-
<string name="activity_resolver_use_always">Use Always</string>
3565+
<string name="activity_resolver_use_always">Always</string>
35663566

35673567
<!-- Title for a button to choose the currently selected activity
35683568
from the activity resolver to use just this once. [CHAR LIMIT=25] -->

0 commit comments

Comments
 (0)