Merge "Better screen size adaptation for ResolverActivity" into jb-dev

This commit is contained in:
Adam Powell
2012-05-06 20:59:11 -07:00
committed by Android (Google) Code Review
6 changed files with 39 additions and 7 deletions

View File

@@ -70,8 +70,7 @@ public class ResolverActivity extends AlertActivity implements AdapterView.OnIte
private Button mOnceButton;
private int mIconDpi;
private int mIconSize;
private static final int MAX_COLUMNS = 4;
private int mMaxColumns;
private boolean mRegistered;
private final PackageMonitor mPackageMonitor = new PackageMonitor() {
@@ -105,6 +104,7 @@ public class ResolverActivity extends AlertActivity implements AdapterView.OnIte
super.onCreate(savedInstanceState);
mPm = getPackageManager();
mAlwaysUseOption = alwaysUseOption;
mMaxColumns = getResources().getInteger(R.integer.config_maxResolverActivityColumns);
intent.setComponent(null);
AlertController.AlertParams ap = mAlertParams;
@@ -154,7 +154,7 @@ public class ResolverActivity extends AlertActivity implements AdapterView.OnIte
void resizeGrid() {
final int itemCount = mAdapter.getCount();
mGrid.setNumColumns(Math.min(itemCount, MAX_COLUMNS));
mGrid.setNumColumns(Math.min(itemCount, mMaxColumns));
}
Drawable getIcon(Resources res, int resId) {

View File

@@ -33,8 +33,8 @@
android:gravity="center"
android:minLines="2"
android:maxLines="2"
android:paddingLeft="8dip"
android:paddingRight="8dip" />
android:paddingLeft="4dip"
android:paddingRight="4dip" />
<!-- Activity icon when presenting dialog
Size will be filled in by ResolverActivity -->
@@ -51,7 +51,7 @@
android:gravity="center"
android:minLines="2"
android:maxLines="2"
android:paddingLeft="8dip"
android:paddingRight="8dip" />
android:paddingLeft="4dip"
android:paddingRight="4dip" />
</LinearLayout>

View File

@@ -35,5 +35,10 @@
<!-- If true, the screen can be rotated via the accelerometer in all 4
rotations as the default behavior. -->
<bool name="config_allowAllRotations">true</bool>
<!-- Maximum number of grid columns permitted in the ResolverActivity
used for picking activities to handle an intent. -->
<integer name="config_maxResolverActivityColumns">3</integer>
</resources>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2012 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>
<!-- Maximum number of grid columns permitted in the ResolverActivity
used for picking activities to handle an intent. -->
<integer name="config_maxResolverActivityColumns">4</integer>
</resources>

View File

@@ -846,6 +846,10 @@
movement threshold where scrolling should begin. -->
<dimen name="config_viewConfigurationTouchSlop">8dp</dimen>
<!-- Maximum number of grid columns permitted in the ResolverActivity
used for picking activities to handle an intent. -->
<integer name="config_maxResolverActivityColumns">2</integer>
<!-- Array of OEM specific USB mode override config.
OEM can override a certain USB mode depending on ro.bootmode.
Specify an array of below items to set override rule.

View File

@@ -1512,6 +1512,7 @@
<java-symbol type="id" name="resolver_grid" />
<java-symbol type="id" name="button_once" />
<java-symbol type="id" name="button_always" />
<java-symbol type="integer" name="config_maxResolverActivityColumns" />
<!-- From SystemUI -->
<java-symbol type="anim" name="push_down_in" />