Fix padding in user type selection dialog

Use preferred list item padding for the list items
and use the dialog context for creating the adapter.

Bug: 18509286
Change-Id: Ia5791a6283723a0ab458f24ec22b8890ab627657
This commit is contained in:
Amith Yamasani
2014-12-02 17:21:23 -08:00
parent c868f7035a
commit f3db021ba5
2 changed files with 18 additions and 16 deletions

View File

@@ -18,8 +18,8 @@
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:minHeight="?android:attr/listPreferredItemHeight"
android:paddingStart="16dip" android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="16dip" android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:paddingTop="8dip" android:paddingTop="8dip"
android:paddingBottom="8dip"> android:paddingBottom="8dip">
<TextView <TextView

View File

@@ -573,20 +573,22 @@ public class UserSettings extends SettingsPreferenceFragment
addProfileItem.put(KEY_SUMMARY, getString(R.string.user_add_profile_item_summary)); addProfileItem.put(KEY_SUMMARY, getString(R.string.user_add_profile_item_summary));
data.add(addUserItem); data.add(addUserItem);
data.add(addProfileItem); data.add(addProfileItem);
Dialog dlg = new AlertDialog.Builder(context) AlertDialog.Builder builder = new AlertDialog.Builder(context);
.setTitle(R.string.user_add_user_type_title) SimpleAdapter adapter = new SimpleAdapter(builder.getContext(),
.setAdapter(new SimpleAdapter(context, data, R.layout.two_line_list_item, data, R.layout.two_line_list_item,
new String[] {KEY_TITLE, KEY_SUMMARY}, new String[] {KEY_TITLE, KEY_SUMMARY},
new int[] {R.id.title, R.id.summary}), new int[] {R.id.title, R.id.summary});
new DialogInterface.OnClickListener() { builder.setTitle(R.string.user_add_user_type_title);
public void onClick(DialogInterface dialog, int which) { builder.setAdapter(adapter,
onAddUserClicked(which == 0 new DialogInterface.OnClickListener() {
? USER_TYPE_USER @Override
: USER_TYPE_RESTRICTED_PROFILE); public void onClick(DialogInterface dialog, int which) {
} onAddUserClicked(which == 0
}) ? USER_TYPE_USER
.create(); : USER_TYPE_RESTRICTED_PROFILE);
return dlg; }
});
return builder.create();
} }
case DIALOG_NEED_LOCKSCREEN: { case DIALOG_NEED_LOCKSCREEN: {
Dialog dlg = new AlertDialog.Builder(context) Dialog dlg = new AlertDialog.Builder(context)