Refactor SmsListPreference into AppListPreference.

This generalizes the pattern of needing to offer a selection among a
list of candidate applications.

Also move some reusable logic around querying PackageManager for icons
into AppListPreference, and remove some unnecessary update logic: the
preference will update itself when onPreferenceChange returns true,
and we can set the summary to '%s' to automatically use the entry as
the summary without having to reset it each time.

Change-Id: I007b9ed58359302f93b367a4b86354e93613bf3e
This commit is contained in:
Jeff Davidson
2014-03-25 12:21:30 -07:00
parent 210bb8694a
commit b9558d91df
4 changed files with 64 additions and 58 deletions

View File

@@ -21,13 +21,13 @@
android:layout_height="?android:attr/listPreferredItemHeight"
android:padding="6dip">
<ImageView
android:id="@+id/sms_image"
android:id="@+id/app_image"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="6dip"
/>
<CheckedTextView
android:id="@+id/sms_text"
android:id="@+id/app_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"