DO NOT MERGE. Preference activity changes to work on smaller tablet screens.

Breadcrumbs move to the action bar on certain configs.

Padding around fragments and to the left of preference items
adjusted for different display sizes.

Change-Id: Ie899f9742f4ebd7044f158b1c7db06df82ad2d75
This commit is contained in:
Amith Yamasani
2011-05-20 14:59:06 -07:00
parent 4a74eb6799
commit 1d2385d08a
22 changed files with 248 additions and 68 deletions

View File

@@ -519,6 +519,7 @@ public class Preference implements Comparable<Preference>, OnDependencyChangeLis
if (mIcon != null) {
imageView.setImageDrawable(mIcon);
}
imageView.setVisibility(mIcon != null ? View.VISIBLE : View.GONE);
}
if (mShouldDisableView) {
setEnabledStateOnViews(view, isEnabled());
@@ -618,6 +619,7 @@ public class Preference implements Comparable<Preference>, OnDependencyChangeLis
public void setIcon(Drawable icon) {
if ((icon == null && mIcon != null) || (icon != null && mIcon != icon)) {
mIcon = icon;
notifyChanged();
}
}

View File

@@ -18,9 +18,6 @@ package android.preference;
import com.android.internal.util.XmlUtils;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import android.app.ActionBar;
import android.app.Fragment;
import android.app.FragmentBreadCrumbs;
@@ -44,8 +41,8 @@ import android.util.TypedValue;
import android.util.Xml;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.AbsListView;
import android.widget.ArrayAdapter;
import android.widget.Button;
@@ -58,6 +55,9 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
/**
* This is the base class for an activity to show a hierarchy of preferences
* to the user. Prior to {@link android.os.Build.VERSION_CODES#HONEYCOMB}
@@ -641,17 +641,9 @@ public abstract class PreferenceActivity extends ListActivity implements
* enough.
*/
public boolean onIsMultiPane() {
Configuration config = getResources().getConfiguration();
if ((config.screenLayout&Configuration.SCREENLAYOUT_SIZE_MASK)
== Configuration.SCREENLAYOUT_SIZE_XLARGE) {
return true;
}
if ((config.screenLayout&Configuration.SCREENLAYOUT_SIZE_MASK)
== Configuration.SCREENLAYOUT_SIZE_LARGE
&& config.orientation == Configuration.ORIENTATION_LANDSCAPE) {
return true;
}
return false;
boolean preferMultiPane = getResources().getBoolean(
com.android.internal.R.bool.preferences_prefer_dual_pane);
return preferMultiPane;
}
/**
@@ -992,7 +984,7 @@ public abstract class PreferenceActivity extends ListActivity implements
if (mFragmentBreadCrumbs == null) {
View crumbs = findViewById(android.R.id.title);
// For screens with a different kind of title, don't create breadcrumbs.
if (!(crumbs instanceof FragmentBreadCrumbs)) return;
if (crumbs != null && !(crumbs instanceof FragmentBreadCrumbs)) return;
mFragmentBreadCrumbs = (FragmentBreadCrumbs) findViewById(android.R.id.title);
if (mFragmentBreadCrumbs == null) {
mFragmentBreadCrumbs = new FragmentBreadCrumbs(this);