diff options
Diffstat (limited to 'java')
| -rw-r--r-- | java/res/layout/resolve_grid_item.xml | 4 | ||||
| -rw-r--r-- | java/src/com/android/intentresolver/ChooserListAdapter.java | 8 | ||||
| -rw-r--r-- | java/src/com/android/intentresolver/ResolverListAdapter.java | 19 |
3 files changed, 11 insertions, 20 deletions
diff --git a/java/res/layout/resolve_grid_item.xml b/java/res/layout/resolve_grid_item.xml index 4cf7d04b..fb2614a0 100644 --- a/java/res/layout/resolve_grid_item.xml +++ b/java/res/layout/resolve_grid_item.xml @@ -23,7 +23,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="100dp" - android:gravity="center" + android:gravity="top" android:paddingTop="@dimen/grid_padding_top" android:paddingBottom="12dp" android:paddingHorizontal="4dp" @@ -53,7 +53,7 @@ android:textColor="?androidprv:attr/materialColorOnSurface" android:textSize="12sp" android:gravity="top|center_horizontal" - android:lines="1" + android:maxLines="1" android:ellipsize="end" /> <!-- Activity name if set, gone for Direct Share targets --> diff --git a/java/src/com/android/intentresolver/ChooserListAdapter.java b/java/src/com/android/intentresolver/ChooserListAdapter.java index ceeed6f0..ebbf5515 100644 --- a/java/src/com/android/intentresolver/ChooserListAdapter.java +++ b/java/src/com/android/intentresolver/ChooserListAdapter.java @@ -276,7 +276,7 @@ public class ChooserListAdapter extends ResolverListAdapter { return; } - holder.bindLabel(info.getDisplayLabel(), info.getExtendedInfo(), alwaysShowSubLabel()); + holder.bindLabel(info.getDisplayLabel(), info.getExtendedInfo()); mAnimationTracker.animateLabel(holder.text, info); if (holder.text2.getVisibility() == View.VISIBLE) { mAnimationTracker.animateLabel(holder.text2, info); @@ -630,12 +630,6 @@ public class ChooserListAdapter extends ResolverListAdapter { notifyDataSetChanged(); } - protected boolean alwaysShowSubLabel() { - // Always show a subLabel for visual consistency across list items. Show an empty - // subLabel if the subLabel is the same as the label - return true; - } - /** * Rather than fully sorting the input list, this sorting task will put the top k elements * in the head of input list and fill the tail with other elements in undetermined order. diff --git a/java/src/com/android/intentresolver/ResolverListAdapter.java b/java/src/com/android/intentresolver/ResolverListAdapter.java index f090f3a2..fb7641b3 100644 --- a/java/src/com/android/intentresolver/ResolverListAdapter.java +++ b/java/src/com/android/intentresolver/ResolverListAdapter.java @@ -682,7 +682,7 @@ public class ResolverListAdapter extends BaseAdapter { final ViewHolder holder = (ViewHolder) view.getTag(); if (info == null) { holder.icon.setImageDrawable(loadIconPlaceholder()); - holder.bindLabel("", "", false); + holder.bindLabel("", ""); return; } @@ -691,10 +691,9 @@ public class ResolverListAdapter extends BaseAdapter { if (dri.hasDisplayLabel()) { holder.bindLabel( dri.getDisplayLabel(), - dri.getExtendedInfo(), - alwaysShowSubLabel()); + dri.getExtendedInfo()); } else { - holder.bindLabel("", "", false); + holder.bindLabel("", ""); loadLabel(dri); } holder.bindIcon(info); @@ -830,10 +829,6 @@ public class ResolverListAdapter extends BaseAdapter { mIsTabLoaded = true; } - protected boolean alwaysShowSubLabel() { - return false; - } - /** * Find the first element in a list of {@code ResolvedComponentInfo} objects whose * {@code ResolveInfo} specifies a {@code targetUserId} other than the current user. @@ -940,17 +935,19 @@ public class ResolverListAdapter extends BaseAdapter { icon = (ImageView) view.findViewById(com.android.internal.R.id.icon); } - public void bindLabel(CharSequence label, CharSequence subLabel, boolean showSubLabel) { + public void bindLabel(CharSequence label, CharSequence subLabel) { text.setText(label); if (TextUtils.equals(label, subLabel)) { subLabel = null; } - text2.setText(subLabel); - if (showSubLabel || subLabel != null) { + if (!TextUtils.isEmpty(subLabel)) { + text.setMaxLines(1); + text2.setText(subLabel); text2.setVisibility(View.VISIBLE); } else { + text.setMaxLines(2); text2.setVisibility(View.GONE); } |