restore super-dense layout when the user has selected 0 lines of message preview

This commit is contained in:
Jesse Vincent 2013-07-20 14:53:39 -04:00
parent 8de3387528
commit f5eb2708b4
2 changed files with 46 additions and 14 deletions

View File

@ -44,27 +44,46 @@
android:src="@drawable/ic_contact_picture"
style="?android:attr/quickContactBadgeStyleWindowLarge"
android:background="@android:color/transparent" />
<TextView
android:id="@+id/subject"
<LinearLayout
android:id="@+id/subject_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginBottom="1dip"
android:layout_marginLeft="1dip"
android:layout_toLeftOf="@+id/date"
android:layout_toRightOf="@id/contact_badge"
android:ellipsize="marquee"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary" />
android:layout_toLeftOf="@+id/date"
android:layout_alignParentTop="true"
>
<TextView
android:id="@+id/sender_compact"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="0.3"
android:ellipsize="end"
android:singleLine="true"
android:layout_marginBottom="1dip"
android:layout_marginLeft="1dip"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
android:layout_alignParentTop="true"/>
<TextView
android:id="@+id/subject"
android:layout_width="0dp"
android:layout_weight="0.7"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginBottom="1dip"
android:layout_marginLeft="1dip"
android:ellipsize="marquee"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
/>
</LinearLayout>
<TextView
android:id="@+id/preview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/contact_badge"
android:layout_below="@+id/subject"
android:layout_below="@+id/subject_wrapper"
android:layout_toLeftOf="@+id/thread_count"
android:layout_marginLeft="1dip"
android:layout_marginBottom="3dip"

View File

@ -155,6 +155,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
THREAD_COUNT_COLUMN);
public static MessageListFragment newInstance(LocalSearch search, boolean isThreadDisplay, boolean threadedList) {
MessageListFragment fragment = new MessageListFragment();
Bundle args = new Bundle();
@ -454,6 +455,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
private boolean mInitialized = false;
private ContactPictureLoader mContactsPictureLoader;
private float mScreenDensity;
private LocalBroadcastManager mLocalBroadcastManager;
private BroadcastReceiver mCacheBroadcastReceiver;
@ -778,6 +780,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
Context appContext = getActivity().getApplicationContext();
mScreenDensity = appContext.getResources().getDisplayMetrics().density;
mPreferences = Preferences.getPreferences(appContext);
mController = MessagingController.getInstance(getActivity().getApplication());
@ -1806,7 +1809,17 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
MessageViewHolder holder = new MessageViewHolder();
holder.date = (TextView) view.findViewById(R.id.date);
holder.chip = view.findViewById(R.id.chip);
holder.preview = (TextView) view.findViewById(R.id.preview);
if (mPreviewLines == 0) {
view.findViewById(R.id.preview).setVisibility(View.GONE);
holder.preview = (TextView) view.findViewById(R.id.sender_compact);
ViewGroup.LayoutParams params = holder.chip.getLayoutParams();
params.height=(int) (16.0f * mScreenDensity);
params.width=(int) (16.0f * mScreenDensity);
} else {
view.findViewById(R.id.sender_compact).setVisibility(View.GONE);
holder.preview = (TextView) view.findViewById(R.id.preview);
}
QuickContactBadge contactBadge =
(QuickContactBadge) view.findViewById(R.id.contact_badge);