mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
#1694 Story view tweaks
This commit is contained in:
parent
a8626b430f
commit
5e1d640bd1
10 changed files with 35 additions and 62 deletions
|
@ -1,6 +1,6 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="150dp"
|
||||
android:height="150dp"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="150"
|
||||
android:viewportHeight="150">
|
||||
<path
|
||||
|
|
|
@ -77,9 +77,8 @@
|
|||
|
||||
<ImageButton
|
||||
android:id="@+id/main_search_feeds_button"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:padding="2dp"
|
||||
android:layout_width="28dp"
|
||||
android:layout_height="28dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_margin="8dp"
|
||||
android:layout_toStartOf="@+id/main_profile_button"
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
style="?storyFeedTitleText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="6dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_toLeftOf="@id/story_item_thumbnail_right"
|
||||
android:layout_toRightOf="@id/story_item_feedicon"
|
||||
android:ellipsize="end"
|
||||
|
@ -123,10 +123,12 @@
|
|||
android:paddingRight="4dp"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:lineSpacingExtra="1dp"
|
||||
style="?storySnippetText" />
|
||||
|
||||
<!--dynamic spacing-->
|
||||
<TextView
|
||||
style="?storySnippetText"
|
||||
android:id="@+id/story_item_date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -136,6 +138,7 @@
|
|||
|
||||
<!--dynamic spacing-->
|
||||
<TextView
|
||||
style="?storySnippetText"
|
||||
android:id="@+id/story_item_author"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -167,12 +170,12 @@
|
|||
<View
|
||||
android:layout_height="0.5dp"
|
||||
android:layout_width="match_parent"
|
||||
style="?rowBorderTop"
|
||||
style="?rowBorder"
|
||||
android:layout_alignParentTop="true" />
|
||||
<View
|
||||
android:layout_height="0.5dp"
|
||||
android:layout_width="match_parent"
|
||||
style="?rowBorderBottom"
|
||||
style="?rowBorder"
|
||||
android:layout_alignParentBottom="true" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -22,8 +22,7 @@
|
|||
<attr name="shareBarBackground" format="string" />
|
||||
<attr name="shareBarText" format="string" />
|
||||
<attr name="commentsHeader" format="string" />
|
||||
<attr name="rowBorderTop" format="string" />
|
||||
<attr name="rowBorderBottom" format="string" />
|
||||
<attr name="rowBorder" format="string" />
|
||||
<attr name="profileCount" format="string" />
|
||||
<attr name="profileActivityList" format="string" />
|
||||
<attr name="storyCommentDivider" format="string" />
|
||||
|
|
|
@ -50,12 +50,9 @@
|
|||
<color name="black_folder_background">@color/gray07</color>
|
||||
<color name="folder_background_selected">#CDD0C7</color>
|
||||
<color name="dark_folder_background_selected">#4C4C4C</color>
|
||||
<color name="row_border_top">@color/white</color>
|
||||
<color name="row_border_bottom">@color/gray80</color>
|
||||
<color name="dark_row_border_top">@color/gray20</color>
|
||||
<color name="dark_row_border_bottom">@color/gray13</color>
|
||||
<color name="black_row_border_top">@color/gray10</color>
|
||||
<color name="black_row_border_bottom">@color/gray07</color>
|
||||
<color name="row_border">@color/gray90</color>
|
||||
<color name="dark_row_border">@color/gray13</color>
|
||||
<color name="black_row_border">@color/gray10</color>
|
||||
<color name="feed_background_selected_end">#FFFFD2</color>
|
||||
<color name="feed_background_selected_start">#E3D0AE</color>
|
||||
<color name="dark_feed_background_selected_end">#4C4C4C</color>
|
||||
|
|
|
@ -270,24 +270,14 @@
|
|||
<item name="android:textColor">@color/dark_text</item>
|
||||
</style>
|
||||
|
||||
<style name="rowBorderTop">
|
||||
<item name="android:background">@color/row_border_top</item>
|
||||
<style name="rowBorder">
|
||||
<item name="android:background">@color/row_border</item>
|
||||
</style>
|
||||
<style name="rowBorderTop.dark">
|
||||
<item name="android:background">@color/dark_row_border_top</item>
|
||||
<style name="rowBorder.dark">
|
||||
<item name="android:background">@color/dark_row_border</item>
|
||||
</style>
|
||||
<style name="rowBorderTop.black">
|
||||
<item name="android:background">@color/black_row_border_top</item>
|
||||
</style>
|
||||
|
||||
<style name="rowBorderBottom">
|
||||
<item name="android:background">@color/row_border_bottom</item>
|
||||
</style>
|
||||
<style name="rowBorderBottom.dark">
|
||||
<item name="android:background">@color/dark_row_border_bottom</item>
|
||||
</style>
|
||||
<style name="rowBorderBottom.black">
|
||||
<item name="android:background">@color/black_row_border_bottom</item>
|
||||
<style name="rowBorder.black">
|
||||
<item name="android:background">@color/black_row_border</item>
|
||||
</style>
|
||||
|
||||
<style name="profileCount">
|
||||
|
|
|
@ -32,8 +32,7 @@
|
|||
<item name="shareBarBackground">@style/shareBarBackground</item>
|
||||
<item name="shareBarText">@style/shareBarText</item>
|
||||
<item name="commentsHeader">@style/commentsHeader</item>
|
||||
<item name="rowBorderTop">@style/rowBorderTop</item>
|
||||
<item name="rowBorderBottom">@style/rowBorderBottom</item>
|
||||
<item name="rowBorder">@style/rowBorder</item>
|
||||
<item name="profileCount">@style/profileCount</item>
|
||||
<item name="profileActivityList">@style/profileActivityList</item>
|
||||
<item name="storyCommentDivider">@style/storyCommentDivider</item>
|
||||
|
@ -86,8 +85,7 @@
|
|||
<item name="shareBarBackground">@style/shareBarBackground.dark</item>
|
||||
<item name="shareBarText">@style/shareBarText.dark</item>
|
||||
<item name="commentsHeader">@style/commentsHeader.dark</item>
|
||||
<item name="rowBorderTop">@style/rowBorderTop.dark</item>
|
||||
<item name="rowBorderBottom">@style/rowBorderBottom.dark</item>
|
||||
<item name="rowBorder">@style/rowBorder.dark</item>
|
||||
<item name="profileCount">@style/profileCount.dark</item>
|
||||
<item name="profileActivityList">@style/profileActivityList.dark</item>
|
||||
<item name="storyCommentDivider">@style/storyCommentDivider.dark</item>
|
||||
|
@ -141,8 +139,7 @@
|
|||
<item name="shareBarBackground">@style/shareBarBackground.black</item>
|
||||
<item name="shareBarText">@style/shareBarText.dark</item>
|
||||
<item name="commentsHeader">@style/commentsHeader.black</item>
|
||||
<item name="rowBorderTop">@style/rowBorderTop.black</item>
|
||||
<item name="rowBorderBottom">@style/rowBorderBottom.black</item>
|
||||
<item name="rowBorder">@style/rowBorder.black</item>
|
||||
<item name="profileCount">@style/profileCount.black</item>
|
||||
<item name="profileActivityList">@style/profileActivityList.black</item>
|
||||
<item name="storyCommentDivider">@style/storyCommentDivider.black</item>
|
||||
|
|
|
@ -59,8 +59,8 @@ public class StoryViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
|
|||
|
||||
private final static float defaultTextSize_story_item_feedtitle = 13f;
|
||||
private final static float defaultTextSize_story_item_title = 14f;
|
||||
private final static float defaultTextSize_story_item_date_or_author = 11f;
|
||||
private final static float defaultTextSize_story_item_snip = 12f;
|
||||
private final static float defaultTextSize_story_item_date_or_author = 12f;
|
||||
private final static float defaultTextSize_story_item_snip = 13f;
|
||||
|
||||
private final static float READ_STORY_ALPHA = 0.35f;
|
||||
private final static int READ_STORY_ALPHA_B255 = (int) (255f * READ_STORY_ALPHA);
|
||||
|
@ -748,7 +748,7 @@ public class StoryViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
|
|||
params.width = sizeDp;
|
||||
}
|
||||
if (params != null && (thumbnailStyle == ThumbnailStyle.RIGHT_SMALL || thumbnailStyle == ThumbnailStyle.LEFT_SMALL)) {
|
||||
int verticalMargin = singleFeed ? UIUtils.dp2px(context, 10) : UIUtils.dp2px(context, 5);
|
||||
int verticalMargin = singleFeed ? verticalContainerMargin + UIUtils.dp2px(context, 2) : verticalContainerMargin;
|
||||
params.setMargins(UIUtils.dp2px(context, 8), verticalMargin, 0, verticalMargin);
|
||||
params.addRule(RelativeLayout.ALIGN_BOTTOM, vh.storySnippet.getId());
|
||||
} else if (params != null) {
|
||||
|
|
|
@ -16,17 +16,17 @@ enum class SpacingStyle {
|
|||
}
|
||||
|
||||
fun getStoryTitleVerticalPadding(context: Context): Int = when (this) {
|
||||
COMFORTABLE -> UIUtils.dp2px(context, 11)
|
||||
COMFORTABLE -> UIUtils.dp2px(context, 8)
|
||||
COMPACT -> UIUtils.dp2px(context, 2)
|
||||
}
|
||||
|
||||
fun getStoryContentVerticalPadding(context: Context): Int = when (this) {
|
||||
COMFORTABLE -> UIUtils.dp2px(context, 11)
|
||||
COMFORTABLE -> UIUtils.dp2px(context, 8)
|
||||
COMPACT -> UIUtils.dp2px(context, 2)
|
||||
}
|
||||
|
||||
fun getStoryContainerMargin(context: Context): Int = when (this) {
|
||||
COMFORTABLE -> UIUtils.dp2px(context, 10)
|
||||
COMFORTABLE -> UIUtils.dp2px(context, 11)
|
||||
COMPACT -> UIUtils.dp2px(context, 2)
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@ import android.content.Context;
|
|||
import android.text.format.DateFormat;
|
||||
import android.text.format.DateUtils;
|
||||
|
||||
import java.text.DateFormatSymbols;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
@ -40,7 +41,11 @@ public class StoryUtils {
|
|||
private static final ThreadLocal<SimpleDateFormat> twelveHourFormat = new ThreadLocal<SimpleDateFormat>() {
|
||||
@Override
|
||||
protected SimpleDateFormat initialValue() {
|
||||
return new SimpleDateFormat("h:mma");
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("h:mma");
|
||||
DateFormatSymbols dfs = new DateFormatSymbols();
|
||||
dfs.setAmPmStrings(new String[] { "am", "pm" });
|
||||
sdf.setDateFormatSymbols(dfs);
|
||||
return sdf;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -99,23 +104,6 @@ public class StoryUtils {
|
|||
}
|
||||
}
|
||||
|
||||
public static CharSequence formatRelativeTime(Context context, long timestamp) {
|
||||
Date date = new Date(timestamp);
|
||||
Date sixDaysAgo = new Date(System.currentTimeMillis()
|
||||
- (DateUtils.DAY_IN_MILLIS * 6));
|
||||
if (DateUtils.isToday(timestamp)) {
|
||||
// "3 hours ago"
|
||||
return DateUtils.getRelativeTimeSpanString(timestamp,
|
||||
System.currentTimeMillis(),
|
||||
DateUtils.MINUTE_IN_MILLIS);
|
||||
} else if (date.after(sixDaysAgo)){
|
||||
// "Wednesday"
|
||||
return DateFormat.format("EEEE", timestamp);
|
||||
} else {
|
||||
return DateFormat.getDateFormat(context).format(date);
|
||||
}
|
||||
}
|
||||
|
||||
private static Date midnightToday() {
|
||||
Calendar midnight = Calendar.getInstance();
|
||||
midnight.set(Calendar.HOUR_OF_DAY, 0);
|
||||
|
|
Loading…
Add table
Reference in a new issue