tweak compact layout

This commit is contained in:
Andrew Dolgov 2014-11-13 21:58:30 +03:00
parent 89823f32f1
commit 57942e84e3
5 changed files with 26 additions and 17 deletions

View File

@ -965,7 +965,16 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
holder.dateView.setTextSize(TypedValue.COMPLEX_UNIT_SP, headlineSmallFontSize); holder.dateView.setTextSize(TypedValue.COMPLEX_UNIT_SP, headlineSmallFontSize);
Date d = new Date((long)article.updated * 1000); Date d = new Date((long)article.updated * 1000);
DateFormat df = new SimpleDateFormat("MMM dd, HH:mm"); Date now = new Date();
DateFormat df;
if (now.getYear() == d.getYear() && now.getMonth() == d.getMonth() && now.getDay() == d.getDay()) {
df = new SimpleDateFormat("HH:mm");
} else {
df = new SimpleDateFormat("MMM dd");
}
df.setTimeZone(TimeZone.getDefault()); df.setTimeZone(TimeZone.getDefault());
holder.dateView.setText(df.format(d)); holder.dateView.setText(df.format(d));
} }

View File

@ -39,7 +39,7 @@
<TextView <TextView
android:id="@+id/excerpt" android:id="@+id/excerpt"
android:singleLine="true" android:maxLines="2"
android:ellipsize="end" android:ellipsize="end"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -86,7 +86,7 @@
android:singleLine="true" android:singleLine="true"
android:ellipsize="none" android:ellipsize="none"
android:layout_weight="1" android:layout_weight="1"
android:text="Jan 01, 12:00, 1970" android:text="Jan 01"
android:textColor="?headlineSecondaryTextColor" android:textColor="?headlineSecondaryTextColor"
android:textSize="12sp" android:textSize="12sp"
/> />
@ -94,9 +94,9 @@
<ImageView <ImageView
android:id="@+id/marked" android:id="@+id/marked"
android:layout_width="16dp" android:layout_width="24dp"
android:layout_gravity="bottom|right" android:layout_gravity="bottom|right"
android:layout_height="16dp" android:layout_height="24dp"
android:layout_weight="0" android:layout_weight="0"
android:clickable="true" android:clickable="true"
android:src="@drawable/ic_star_empty" /> android:src="@drawable/ic_star_empty" />

View File

@ -39,7 +39,7 @@
<TextView <TextView
android:id="@+id/excerpt" android:id="@+id/excerpt"
android:singleLine="true" android:maxLines="2"
android:ellipsize="end" android:ellipsize="end"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -86,7 +86,7 @@
android:singleLine="true" android:singleLine="true"
android:ellipsize="none" android:ellipsize="none"
android:layout_weight="1" android:layout_weight="1"
android:text="Jan 01, 12:00, 1970" android:text="Jan 01"
android:textColor="?headlineSelectedSecondaryTextColor" android:textColor="?headlineSelectedSecondaryTextColor"
android:textSize="12sp" android:textSize="12sp"
/> />
@ -94,9 +94,9 @@
<ImageView <ImageView
android:id="@+id/marked" android:id="@+id/marked"
android:layout_width="16dp" android:layout_width="24dp"
android:layout_gravity="bottom|right" android:layout_gravity="bottom|right"
android:layout_height="16dp" android:layout_height="24dp"
android:layout_weight="0" android:layout_weight="0"
android:clickable="true" android:clickable="true"
android:src="@drawable/ic_star_empty" /> android:src="@drawable/ic_star_empty" />

View File

@ -40,7 +40,7 @@
<TextView <TextView
android:id="@+id/excerpt" android:id="@+id/excerpt"
android:singleLine="true" android:maxLines="2"
android:ellipsize="end" android:ellipsize="end"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -87,7 +87,7 @@
android:singleLine="true" android:singleLine="true"
android:ellipsize="none" android:ellipsize="none"
android:layout_weight="1" android:layout_weight="1"
android:text="Jan 01, 12:00, 1970" android:text="Jan 01"
android:textColor="?headlineSelectedSecondaryTextColor" android:textColor="?headlineSelectedSecondaryTextColor"
android:textSize="12sp" android:textSize="12sp"
/> />
@ -95,9 +95,9 @@
<ImageView <ImageView
android:id="@+id/marked" android:id="@+id/marked"
android:layout_width="16dp" android:layout_width="24dp"
android:layout_gravity="bottom|right" android:layout_gravity="bottom|right"
android:layout_height="16dp" android:layout_height="24dp"
android:layout_weight="0" android:layout_weight="0"
android:clickable="true" android:clickable="true"
android:src="@drawable/ic_star_empty" /> android:src="@drawable/ic_star_empty" />

View File

@ -40,7 +40,7 @@
<TextView <TextView
android:id="@+id/excerpt" android:id="@+id/excerpt"
android:singleLine="true" android:maxLines="2"
android:ellipsize="end" android:ellipsize="end"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -87,7 +87,7 @@
android:singleLine="true" android:singleLine="true"
android:ellipsize="none" android:ellipsize="none"
android:layout_weight="1" android:layout_weight="1"
android:text="Jan 01, 12:00, 1970" android:text="Jan 01"
android:textColor="?headlineSecondaryTextColor" android:textColor="?headlineSecondaryTextColor"
android:textSize="12sp" android:textSize="12sp"
/> />
@ -95,9 +95,9 @@
<ImageView <ImageView
android:id="@+id/marked" android:id="@+id/marked"
android:layout_width="16dp" android:layout_width="24dp"
android:layout_gravity="bottom|right" android:layout_gravity="bottom|right"
android:layout_height="16dp" android:layout_height="24dp"
android:layout_weight="0" android:layout_weight="0"
android:clickable="true" android:clickable="true"
android:src="@drawable/ic_star_empty" /> android:src="@drawable/ic_star_empty" />