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

View File

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