Merge "Fix some oddities in ResolverActivity" into jb-dev

This commit is contained in:
Adam Powell
2012-05-08 11:27:27 -07:00
committed by Android (Google) Code Review
3 changed files with 32 additions and 10 deletions

View File

@@ -209,6 +209,20 @@ public class ResolverActivity extends AlertActivity implements AdapterView.OnIte
}
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
if (mAlwaysUseOption) {
final int checkedPos = mGrid.getCheckedItemPosition();
final boolean enabled = checkedPos != GridView.INVALID_POSITION;
mAlwaysButton.setEnabled(enabled);
mOnceButton.setEnabled(enabled);
if (enabled) {
mGrid.setSelection(checkedPos);
}
}
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (mAlwaysUseOption) {
@@ -216,6 +230,9 @@ public class ResolverActivity extends AlertActivity implements AdapterView.OnIte
final boolean enabled = checkedPos != GridView.INVALID_POSITION;
mAlwaysButton.setEnabled(enabled);
mOnceButton.setEnabled(enabled);
if (enabled) {
mGrid.smoothScrollToPosition(checkedPos);
}
} else {
startSelected(position, false);
}

View File

@@ -23,15 +23,20 @@
android:divider="?android:attr/dividerHorizontal"
android:showDividers="middle"
android:dividerPadding="0dip">
<GridView
android:layout_gravity="center"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/resolver_grid"
android:numColumns="4"
android:columnWidth="128dp"
android:padding="16dp"
android:clipToPadding="false" />
<FrameLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<GridView
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="@+id/resolver_grid"
android:numColumns="4"
android:columnWidth="128dp"
android:padding="16dp"
android:clipToPadding="false"
android:scrollbarStyle="outsideOverlay" />
</FrameLayout>
<LinearLayout
android:id="@+id/button_bar"
android:visibility="gone"

View File

@@ -3562,7 +3562,7 @@
<!-- Title for a button to choose the currently selected activity
as the default in the activity resolver. [CHAR LIMIT=25] -->
<string name="activity_resolver_use_always">Use Always</string>
<string name="activity_resolver_use_always">Always</string>
<!-- Title for a button to choose the currently selected activity
from the activity resolver to use just this once. [CHAR LIMIT=25] -->