Use the new Preference:icon attribute and placeholder for showing icons on the left.
This commit is contained in:
Binary file not shown.
Before Width: | Height: | Size: 1012 B After Width: | Height: | Size: 320 B |
Binary file not shown.
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 311 B |
@@ -14,51 +14,8 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:paddingLeft="16dip"
|
|
||||||
android:paddingRight="?android:attr/scrollbarSize">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/providerIcon"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginRight="5dip"
|
|
||||||
android:layout_gravity="center" />
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginRight="6dip"
|
|
||||||
android:layout_marginTop="6dip"
|
|
||||||
android:layout_marginBottom="6dip"
|
|
||||||
android:layout_weight="1">
|
|
||||||
|
|
||||||
<TextView android:id="@+android:id/title"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
|
||||||
|
|
||||||
<TextView android:id="@+android:id/summary"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@android:id/title"
|
|
||||||
android:layout_alignLeft="@android:id/title"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
|
||||||
android:maxLines="2" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/syncStatusIcon"
|
android:id="@+id/syncStatusIcon"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dip"
|
|
||||||
android:layout_marginRight="7dip"
|
|
||||||
android:layout_gravity="center" />
|
android:layout_gravity="center" />
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
@@ -17,49 +17,14 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
android:gravity="center_vertical">
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:paddingLeft="16dip"
|
|
||||||
android:paddingRight="?android:attr/scrollbarSize">
|
|
||||||
|
|
||||||
<ImageView
|
<LinearLayout android:id="@+id/profileIcons"
|
||||||
android:id="@+id/btClass"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginRight="12dip"
|
android:layout_centerVertical="true"
|
||||||
android:layout_gravity="center_vertical" />
|
android:layout_alignParentRight="true"
|
||||||
|
/>
|
||||||
<RelativeLayout
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginRight="6dip"
|
|
||||||
android:layout_marginTop="6dip"
|
|
||||||
android:layout_marginBottom="6dip"
|
|
||||||
android:layout_weight="1">
|
|
||||||
|
|
||||||
<!-- Device name -->
|
|
||||||
<TextView android:id="@+android:id/title"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
|
||||||
|
|
||||||
<!-- Status summary -->
|
|
||||||
<TextView android:id="@+android:id/summary"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@android:id/title"
|
|
||||||
android:layout_alignLeft="@android:id/title"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
|
||||||
android:maxLines="2" />
|
|
||||||
|
|
||||||
<LinearLayout android:id="@+id/profileIcons"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
/>
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<!-- Divider -->
|
<!-- Divider -->
|
||||||
<ImageView
|
<ImageView
|
||||||
|
@@ -15,51 +15,9 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
android:gravity="center_vertical">
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:paddingLeft="16dip"
|
|
||||||
android:paddingRight="?android:attr/scrollbarSize">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/profileIcon"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginRight="12dip"
|
|
||||||
android:layout_gravity="center_vertical" />
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginRight="6dip"
|
|
||||||
android:layout_marginTop="6dip"
|
|
||||||
android:layout_marginBottom="6dip"
|
|
||||||
android:layout_weight="1">
|
|
||||||
|
|
||||||
<!-- Device name -->
|
|
||||||
<TextView android:id="@+android:id/title"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
|
||||||
|
|
||||||
<!-- Status summary -->
|
|
||||||
<TextView android:id="@+android:id/summary"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@android:id/title"
|
|
||||||
android:layout_alignLeft="@android:id/title"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
|
||||||
android:maxLines="2" />
|
|
||||||
|
|
||||||
<LinearLayout android:id="@+id/profileIcons"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
/>
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<!-- Divider -->
|
<!-- Divider -->
|
||||||
<ImageView
|
<ImageView
|
||||||
|
@@ -49,7 +49,7 @@ public class AccountPreference extends Preference {
|
|||||||
mAccount = account;
|
mAccount = account;
|
||||||
mAuthorities = authorities;
|
mAuthorities = authorities;
|
||||||
mProviderIcon = icon;
|
mProviderIcon = icon;
|
||||||
setLayoutResource(R.layout.account_preference);
|
setWidgetLayoutResource(R.layout.account_preference);
|
||||||
setTitle(mAccount.name);
|
setTitle(mAccount.name);
|
||||||
setSummary("");
|
setSummary("");
|
||||||
// Add account info to the intent for AccountSyncSettings
|
// Add account info to the intent for AccountSyncSettings
|
||||||
@@ -72,7 +72,7 @@ public class AccountPreference extends Preference {
|
|||||||
protected void onBindView(View view) {
|
protected void onBindView(View view) {
|
||||||
super.onBindView(view);
|
super.onBindView(view);
|
||||||
setSummary(getSyncStatusMessage(mStatus));
|
setSummary(getSyncStatusMessage(mStatus));
|
||||||
mProviderIconView = (ImageView) view.findViewById(R.id.providerIcon);
|
mProviderIconView = (ImageView) view.findViewById(android.R.id.icon);
|
||||||
mProviderIconView.setImageDrawable(mProviderIcon);
|
mProviderIconView.setImageDrawable(mProviderIcon);
|
||||||
mSyncStatusIcon = (ImageView) view.findViewById(R.id.syncStatusIcon);
|
mSyncStatusIcon = (ImageView) view.findViewById(R.id.syncStatusIcon);
|
||||||
mSyncStatusIcon.setImageResource(getSyncStatusIcon(mStatus));
|
mSyncStatusIcon.setImageResource(getSyncStatusIcon(mStatus));
|
||||||
|
@@ -64,7 +64,7 @@ public class BluetoothDevicePreference extends Preference implements
|
|||||||
mCachedDevice = cachedDevice;
|
mCachedDevice = cachedDevice;
|
||||||
mAccessibleProfile = accessibleProfile;
|
mAccessibleProfile = accessibleProfile;
|
||||||
|
|
||||||
setLayoutResource(R.layout.preference_bluetooth);
|
setWidgetLayoutResource(R.layout.preference_bluetooth);
|
||||||
|
|
||||||
cachedDevice.registerCallback(this);
|
cachedDevice.registerCallback(this);
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ public class BluetoothDevicePreference extends Preference implements
|
|||||||
|
|
||||||
super.onBindView(view);
|
super.onBindView(view);
|
||||||
|
|
||||||
ImageView btClass = (ImageView) view.findViewById(R.id.btClass);
|
ImageView btClass = (ImageView) view.findViewById(android.R.id.icon);
|
||||||
btClass.setImageResource(mCachedDevice.getBtClassDrawable());
|
btClass.setImageResource(mCachedDevice.getBtClassDrawable());
|
||||||
btClass.setAlpha(isEnabled() ? 255 : sDimAlpha);
|
btClass.setAlpha(isEnabled() ? 255 : sDimAlpha);
|
||||||
|
|
||||||
|
@@ -48,7 +48,7 @@ public class BluetoothProfilePreference extends Preference implements OnClickLis
|
|||||||
|
|
||||||
mProfile = profile;
|
mProfile = profile;
|
||||||
|
|
||||||
setLayoutResource(R.layout.preference_bluetooth_profile);
|
setWidgetLayoutResource(R.layout.preference_bluetooth_profile);
|
||||||
setExpanded(false);
|
setExpanded(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ public class BluetoothProfilePreference extends Preference implements OnClickLis
|
|||||||
protected void onBindView(View view) {
|
protected void onBindView(View view) {
|
||||||
super.onBindView(view);
|
super.onBindView(view);
|
||||||
|
|
||||||
ImageView btProfile = (ImageView) view.findViewById(R.id.profileIcon);
|
ImageView btProfile = (ImageView) view.findViewById(android.R.id.icon);
|
||||||
btProfile.setImageDrawable(mProfileDrawable);
|
btProfile.setImageDrawable(mProfileDrawable);
|
||||||
|
|
||||||
mProfileExpandView = (ImageView) view.findViewById(R.id.profileExpand);
|
mProfileExpandView = (ImageView) view.findViewById(R.id.profileExpand);
|
||||||
|
@@ -295,6 +295,7 @@ public class DeviceProfilesSettings extends SettingsPreferenceFragment
|
|||||||
CheckBoxPreference autoConnectPref = mAutoConnectPrefs.get(prof.toString());
|
CheckBoxPreference autoConnectPref = mAutoConnectPrefs.get(prof.toString());
|
||||||
if (autoConnectPref == null) {
|
if (autoConnectPref == null) {
|
||||||
autoConnectPref = new CheckBoxPreference(getActivity());
|
autoConnectPref = new CheckBoxPreference(getActivity());
|
||||||
|
autoConnectPref.setLayoutResource(com.android.internal.R.layout.preference_child);
|
||||||
autoConnectPref.setKey(prof.toString() + AUTO_CONNECT_KEY_SUFFIX);
|
autoConnectPref.setKey(prof.toString() + AUTO_CONNECT_KEY_SUFFIX);
|
||||||
autoConnectPref.setTitle(getCheckBoxTitle(prof));
|
autoConnectPref.setTitle(getCheckBoxTitle(prof));
|
||||||
autoConnectPref.setOrder(getProfilePreferenceIndex(prof) + 1);
|
autoConnectPref.setOrder(getProfilePreferenceIndex(prof) + 1);
|
||||||
|
@@ -64,7 +64,7 @@ public class PowerGaugePreference extends Preference {
|
|||||||
return mInfo;
|
return mInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setIcon(Drawable icon) {
|
void setPowerIcon(Drawable icon) {
|
||||||
mIcon = icon;
|
mIcon = icon;
|
||||||
notifyChanged();
|
notifyChanged();
|
||||||
}
|
}
|
||||||
|
@@ -734,7 +734,7 @@ public class PowerUsageSummary extends PreferenceFragment implements Runnable {
|
|||||||
(PowerGaugePreference) findPreference(
|
(PowerGaugePreference) findPreference(
|
||||||
Integer.toString(bs.uidObj.getUid()));
|
Integer.toString(bs.uidObj.getUid()));
|
||||||
if (pgp != null) {
|
if (pgp != null) {
|
||||||
pgp.setIcon(bs.icon);
|
pgp.setPowerIcon(bs.icon);
|
||||||
pgp.setPercent(bs.percent);
|
pgp.setPercent(bs.percent);
|
||||||
pgp.setTitle(bs.name);
|
pgp.setTitle(bs.name);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user