#1590 Feed list comfortable and compact settings.

This commit is contained in:
Andrei 2022-04-24 17:01:44 -07:00
parent 11fb73c6c6
commit 5b6cccba1b
19 changed files with 110 additions and 91 deletions

View file

@ -46,7 +46,6 @@
android:shadowDy="1"
android:shadowRadius="1"
style="?feedRowNeutCountText"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
@ -58,13 +57,10 @@
android:gravity="center"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:paddingTop="1dp"
android:paddingBottom="2dp"
android:shadowColor="@color/positive_drop_shadow"
android:shadowDy="1"
android:shadowRadius="1"
android:textColor="@color/white"
android:textSize="14sp"
android:textStyle="bold" />
</LinearLayout>
@ -75,8 +71,6 @@
android:layout_centerVertical="true"
android:layout_toLeftOf="@id/row_foldersums"
android:layout_toRightOf="@id/row_everything_icon"
android:paddingBottom="9dp"
android:paddingTop="9dp"
android:text="@string/all_shared_stories_title"
android:textStyle="bold" />

View file

@ -21,8 +21,6 @@
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/row_everything_icon"
android:paddingBottom="9dp"
android:paddingTop="9dp"
android:text="@string/all_stories_title"
android:textStyle="bold" />

View file

@ -28,7 +28,7 @@
android:shadowDy="1"
android:shadowRadius="1"
style="?feedRowNeutCountText"
android:textSize="14sp"
android:textSize="13sp"
android:textStyle="bold" />
<TextView
@ -44,7 +44,7 @@
android:shadowDy="1"
android:shadowRadius="1"
android:textColor="@color/white"
android:textSize="14sp"
android:textSize="13sp"
android:textStyle="bold" />
<TextView
@ -60,7 +60,7 @@
android:shadowDy="1"
android:shadowRadius="1"
android:textColor="@color/white"
android:textSize="14sp"
android:textSize="13sp"
android:textStyle="bold" />
<ImageView
@ -107,8 +107,6 @@
android:layout_marginStart="45dp"
android:layout_marginRight="5dp"
android:ellipsize="end"
android:paddingTop="7dp"
android:paddingBottom="7dp"
android:singleLine="true"
android:textSize="14sp"
android:textStyle="bold" />

View file

@ -43,13 +43,10 @@
android:gravity="center"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:paddingTop="1dp"
android:paddingBottom="2dp"
android:shadowColor="@color/neutral_drop_shadow"
android:shadowDy="1"
android:shadowRadius="1"
style="?feedRowNeutCountText"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
@ -61,13 +58,10 @@
android:gravity="center"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:paddingTop="1dp"
android:paddingBottom="2dp"
android:shadowColor="@color/positive_drop_shadow"
android:shadowDy="1"
android:shadowRadius="1"
android:textColor="@color/white"
android:textSize="14sp"
android:textStyle="bold" />
</LinearLayout>
@ -78,8 +72,6 @@
android:layout_centerVertical="true"
android:layout_toRightOf="@id/row_folder_icon"
android:layout_toLeftOf="@+id/row_foldersums"
android:paddingBottom="9dp"
android:paddingTop="9dp"
android:textStyle="bold"
android:shadowDy="1"
android:shadowRadius="1"

View file

@ -21,8 +21,6 @@
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/row_everything_icon"
android:paddingBottom="9dp"
android:paddingTop="9dp"
android:text="@string/global_shared_stories_title"
android:textStyle="bold" />

View file

@ -21,8 +21,6 @@
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/row_everything_icon"
android:paddingBottom="9dp"
android:paddingTop="9dp"
android:text="@string/infrequent_title"
android:textStyle="bold" />

View file

@ -21,8 +21,6 @@
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/row_read_icon"
android:paddingBottom="9dp"
android:paddingTop="9dp"
android:text="@string/read_stories_title"
android:textStyle="bold" />

View file

@ -23,9 +23,7 @@
android:layout_toRightOf="@id/row_saved_search_icon"
android:ellipsize="end"
android:lines="1"
android:paddingTop="9dp"
android:paddingEnd="9dp"
android:paddingBottom="9dp"
android:textSize="14sp" />
</RelativeLayout>

View file

@ -21,8 +21,6 @@
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/row_folder_icon"
android:paddingTop="9dp"
android:paddingBottom="9dp"
android:text="@string/saved_searches_title"
android:textStyle="bold" />

View file

@ -31,8 +31,6 @@
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/row_saved_icon"
android:paddingBottom="9dp"
android:paddingTop="9dp"
android:text="@string/saved_stories_title"
android:textStyle="bold" />
@ -47,13 +45,10 @@
android:gravity="center"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:paddingTop="1dp"
android:paddingBottom="2dp"
android:shadowColor="@color/saved_drop_shadow"
android:shadowDy="1"
android:shadowRadius="1"
android:textColor="@color/white"
android:textSize="14sp"
android:textStyle="bold" />
<View

View file

@ -8,8 +8,8 @@
<ImageView
android:id="@+id/row_tag_icon"
android:src="@drawable/tag"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_width="19dp"
android:layout_height="19dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="12dp"
@ -27,13 +27,11 @@
android:gravity="center"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:paddingTop="1dp"
android:paddingBottom="2dp"
android:shadowColor="@color/saved_drop_shadow"
android:shadowDy="1"
android:shadowRadius="1"
android:textColor="@color/white"
android:textSize="14sp"
android:textSize="13sp"
android:textStyle="bold" />
<TextView
@ -44,8 +42,6 @@
android:textStyle="bold"
android:layout_toLeftOf="@id/row_saved_tag_sum"
android:layout_toRightOf="@id/row_tag_icon"
android:paddingBottom="7dp"
android:paddingTop="7dp"
android:textSize="14sp" />
</RelativeLayout>

View file

@ -25,7 +25,7 @@
android:shadowDy="1"
android:shadowRadius="1"
style="?feedRowNeutCountText"
android:textSize="14sp"
android:textSize="13sp"
android:textStyle="bold" />
<TextView
@ -39,20 +39,20 @@
android:shadowDy="1"
android:shadowRadius="1"
android:textColor="@color/white"
android:textSize="14sp"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:textSize="13sp"
android:textStyle="bold" />
</LinearLayout>
<ImageView
android:id="@+id/row_socialfeed_icon"
android:layout_width="27dp"
android:layout_height="27dp"
android:layout_width="19dp"
android:layout_height="19dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:contentDescription="@string/description_row_folder_icon" />
<TextView
@ -63,8 +63,6 @@
android:textStyle="bold"
android:layout_toLeftOf="@id/row_foldersums"
android:layout_toRightOf="@id/row_socialfeed_icon"
android:paddingBottom="7dp"
android:paddingTop="7dp"
android:textSize="14sp" />
</RelativeLayout>

View file

@ -362,6 +362,7 @@
<string name="settings_cat_feed_list">Feed list</string>
<string name="setting_feed_list_style">Feed list style…</string>
<string name="setting_feed_list_order">Feed list order…</string>
<string name="settings_enable_row_global_shared">Show Global Shared Stories</string>
<string name="settings_enable_row_global_shared_sum">Show the Global Shared Stories folder</string>
@ -383,6 +384,17 @@
</string-array>
<string name="default_story_order_value">NEWEST</string>
<string name="comfortable">Comfortable</string>
<string name="compact">Compact</string>
<string-array name="default_feed_list_style_entries">
<item>@string/comfortable</item>
<item>@string/compact</item>
</string-array>
<string-array name="default_feed_list_style_values">
<item>COMFORTABLE</item>
<item>COMPACT</item>
</string-array>
<string name="default_feed_list_style_value">COMFORTABLE</string>
<string name="alphabetical">Alphabetical</string>
<string name="most_used_at_top">Most used at top</string>
<string-array name="default_feed_list_order_entries">

View file

@ -54,6 +54,13 @@
android:entries="@array/default_feed_list_order_entries"
android:entryValues="@array/default_feed_list_order_values"
android:defaultValue="@string/default_feed_list_order_value" />
<ListPreference
android:key="pref_feed_list_style"
android:title="@string/setting_feed_list_style"
android:dialogTitle="@string/setting_feed_list_style"
android:entries="@array/default_feed_list_style_entries"
android:entryValues="@array/default_feed_list_style_values"
android:defaultValue="@string/default_feed_list_style_value" />
<CheckBoxPreference
android:defaultValue="true"
android:key="enable_row_global_shared"

View file

@ -17,7 +17,6 @@ import android.database.Cursor;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.ExpandableListView;
@ -26,6 +25,9 @@ import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.progressindicator.CircularProgressIndicator;
import com.newsblur.R;
import com.newsblur.domain.Feed;
@ -35,8 +37,8 @@ import com.newsblur.domain.StarredCount;
import com.newsblur.domain.SocialFeed;
import com.newsblur.util.AppConstants;
import com.newsblur.util.FeedListOrder;
import com.newsblur.util.FeedListStyle;
import com.newsblur.util.FeedSet;
import com.newsblur.util.FeedUtils;
import com.newsblur.util.ImageLoader;
import com.newsblur.util.PrefsUtils;
import com.newsblur.util.StateFilter;
@ -67,7 +69,7 @@ public class FolderListAdapter extends BaseExpandableListAdapter {
private final static float defaultTextSize_childName = 14;
private final static float defaultTextSize_groupName = 13;
private final static float defaultTextSize_count = 14;
private final static float defaultTextSize_count = 13;
private final static float NONZERO_UNREADS_ALPHA = 0.87f;
private final static float ZERO_UNREADS_ALPHA = 0.70f;
@ -120,20 +122,21 @@ public class FolderListAdapter extends BaseExpandableListAdapter {
public int lastFeedCount = 0;
/** Flat names of folders explicity closed by the user. */
private Set<String> closedFolders = new HashSet<String>();
private final Set<String> closedFolders = new HashSet<String>();
private Context context;
private LayoutInflater inflater;
private final Context context;
private final LayoutInflater inflater;
private StateFilter currentState;
private final ImageLoader iconLoader;
private final BlurDatabaseHelper dbHelper;
// since we want to implement a custom expando that does group collapse/expand, we need
// a way to call back to those functions on the listview from the onclick listener of
// views we crate for the list.
public WeakReference<ExpandableListView> listBackref;
private float textSize;
private FeedListStyle feedListStyle;
// in order to implement the laggy disappearance of marked-read feeds, preserve the ID of
// the last feed or folder viewed and force the DB to include it in the selection
@ -150,6 +153,7 @@ public class FolderListAdapter extends BaseExpandableListAdapter {
this.dbHelper = dbHelper;
textSize = PrefsUtils.getListTextSize(context);
feedListStyle = PrefsUtils.getFeedListStyle(context);
}
@Override
@ -166,7 +170,7 @@ public class FolderListAdapter extends BaseExpandableListAdapter {
v.findViewById(R.id.row_foldersumneu).setVisibility(View.GONE);
} else {
v.findViewById(R.id.row_foldersumneu).setVisibility(View.VISIBLE);
((TextView) v.findViewById(R.id.row_foldersumneu)).setText(Integer.toString(totalSocialNeutCount));
((TextView) v.findViewById(R.id.row_foldersumneu)).setText(Integer.toString(totalSocialNeutCount));
}
if (totalSocialPosiCount == 0) {
v.findViewById(R.id.row_foldersumpos).setVisibility(View.GONE);
@ -188,7 +192,7 @@ public class FolderListAdapter extends BaseExpandableListAdapter {
v = inflater.inflate(R.layout.row_saved_searches, null, false);
} else if (isRowSavedStories(groupPosition)) {
if (v == null) v = inflater.inflate(R.layout.row_saved_stories, null, false);
TextView savedSum = ((TextView) v.findViewById(R.id.row_foldersum));
TextView savedSum = v.findViewById(R.id.row_foldersum);
if (savedStoriesTotalCount > 0) {
savedSum.setVisibility(View.VISIBLE);
savedSum.setText(Integer.toString(savedStoriesTotalCount));
@ -198,35 +202,33 @@ public class FolderListAdapter extends BaseExpandableListAdapter {
} else {
if (v == null) v = inflater.inflate(R.layout.row_folder, parent, false);
String folderName = activeFolderNames.get(groupPosition);
TextView folderTitle = ((TextView) v.findViewById(R.id.row_foldername));
TextView folderTitle = v.findViewById(R.id.row_foldername);
folderTitle.setText(folderName);
folderTitle.setTextSize(textSize * defaultTextSize_count);
bindCountViews(v, folderNeutCounts.get(groupPosition), folderPosCounts.get(groupPosition), false);
v.findViewById(R.id.row_foldersums).setVisibility(isExpanded ? View.INVISIBLE : View.VISIBLE);
ImageView folderIconView = ((ImageView) v.findViewById(R.id.row_folder_icon));
ImageView folderIconView = v.findViewById(R.id.row_folder_icon);
if ( folderIconView != null ) {
folderIconView.setImageResource(isExpanded ? R.drawable.g_icn_folder : R.drawable.g_icn_folder_rss);
}
}
TextView groupNameView = ((TextView) v.findViewById(R.id.row_foldername));
@NonNull TextView groupNameView = v.findViewById(R.id.row_foldername);
groupNameView.setTextSize(textSize * defaultTextSize_groupName);
TextView sumNeutView = ((TextView) v.findViewById(R.id.row_foldersumneu));
int titleVerticalPadding = feedListStyle.getGroupTitleVerticalPadding(context);
groupNameView.setPadding(0, titleVerticalPadding, 0, titleVerticalPadding);
@Nullable TextView sumNeutView = v.findViewById(R.id.row_foldersumneu);
if (sumNeutView != null ) sumNeutView.setTextSize(textSize * defaultTextSize_count);
TextView sumPosiView = ((TextView) v.findViewById(R.id.row_foldersumpos));
@Nullable TextView sumPosiView = v.findViewById(R.id.row_foldersumpos);
if (sumPosiView != null ) sumPosiView.setTextSize(textSize * defaultTextSize_count);
TextView sumSavedView = ((TextView) v.findViewById(R.id.row_foldersum));
@Nullable TextView sumSavedView = v.findViewById(R.id.row_foldersum);
if (sumSavedView != null ) sumSavedView.setTextSize(textSize * defaultTextSize_count);
// if a group has a sub-view called row_folder_indicator, it will act as an expando
ImageView folderIndicatorView = ((ImageView) v.findViewById(R.id.row_folder_indicator));
@Nullable ImageView folderIndicatorView = v.findViewById(R.id.row_folder_indicator);
if ( folderIndicatorView != null ) {
folderIndicatorView.setImageResource(isExpanded ? R.drawable.indicator_expanded : R.drawable.indicator_collapsed);
folderIndicatorView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
toggleGroup(v, groupPosition, isExpanded);
}
});
folderIndicatorView.setOnClickListener(v1 -> toggleGroup(v1, groupPosition, isExpanded));
}
return v;
@ -251,22 +253,24 @@ public class FolderListAdapter extends BaseExpandableListAdapter {
@Override
public synchronized View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
View v = convertView;
int titleVerticalPadding = feedListStyle.getChildTitleVerticalPadding(context);
if (isRowAllSharedStories(groupPosition)) {
if (v == null) v = inflater.inflate(R.layout.row_socialfeed, parent, false);
SocialFeed f = socialFeedsActive.get(childPosition);
TextView nameView = ((TextView) v.findViewById(R.id.row_socialfeed_name));
TextView nameView = v.findViewById(R.id.row_socialfeed_name);
nameView.setText(f.feedTitle);
nameView.setTextSize(textSize * defaultTextSize_childName);
ImageView iconView = (ImageView) v.findViewById(R.id.row_socialfeed_icon);
nameView.setPadding(nameView.getPaddingLeft(), titleVerticalPadding, nameView.getPaddingRight(), titleVerticalPadding);
ImageView iconView = v.findViewById(R.id.row_socialfeed_icon);
iconLoader.displayImage(f.photoUrl, iconView);
TextView neutCounter = ((TextView) v.findViewById(R.id.row_socialsumneu));
TextView neutCounter = v.findViewById(R.id.row_socialsumneu);
if (f.neutralCount > 0 && currentState != StateFilter.BEST) {
neutCounter.setVisibility(View.VISIBLE);
neutCounter.setText(Integer.toString(checkNegativeUnreads(f.neutralCount)));
} else {
neutCounter.setVisibility(View.GONE);
}
TextView posCounter = ((TextView) v.findViewById(R.id.row_socialsumpos));
TextView posCounter = v.findViewById(R.id.row_socialsumpos);
if (f.positiveCount > 0) {
posCounter.setVisibility(View.VISIBLE);
posCounter.setText(Integer.toString(checkNegativeUnreads(f.positiveCount)));
@ -285,11 +289,12 @@ public class FolderListAdapter extends BaseExpandableListAdapter {
} else if (isRowSavedStories(groupPosition)) {
if (v == null) v = inflater.inflate(R.layout.row_saved_tag, parent, false);
StarredCount sc = starredCountsByTag.get(childPosition);
TextView nameView =((TextView) v.findViewById(R.id.row_tag_name));
TextView nameView = v.findViewById(R.id.row_tag_name);
nameView.setText(sc.tag);
nameView.setTextSize(textSize * defaultTextSize_childName);
nameView.setAlpha(NONZERO_UNREADS_ALPHA);
TextView savedCounter =((TextView) v.findViewById(R.id.row_saved_tag_sum));
nameView.setPadding(nameView.getPaddingLeft(), titleVerticalPadding, nameView.getPaddingRight(), titleVerticalPadding);
TextView savedCounter = v.findViewById(R.id.row_saved_tag_sum);
savedCounter.setText(Integer.toString(checkNegativeUnreads(sc.count)));
savedCounter.setTextSize(textSize * defaultTextSize_count);
} else if (isRowSavedSearches(groupPosition)) {
@ -297,6 +302,7 @@ public class FolderListAdapter extends BaseExpandableListAdapter {
SavedSearch ss = savedSearches.get(childPosition);
TextView nameView = v.findViewById(R.id.row_saved_search_title);
nameView.setText(UIUtils.fromHtml(ss.feedTitle));
nameView.setPadding(nameView.getPaddingLeft(), titleVerticalPadding, nameView.getPaddingRight(), titleVerticalPadding);
ImageView iconView = v.findViewById(R.id.row_saved_search_icon);
iconLoader.preCheck(ss.faviconUrl, iconView);
iconLoader.displayImage(ss.faviconUrl, iconView);
@ -308,17 +314,18 @@ public class FolderListAdapter extends BaseExpandableListAdapter {
RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) containerTitle.getLayoutParams();
lp.setMarginStart(rowMarginStart);
containerTitle.setLayoutParams(lp);
TextView nameView =((TextView) v.findViewById(R.id.row_feedname));
TextView nameView = v.findViewById(R.id.row_feedname);
nameView.setText(f.title);
nameView.setTextSize(textSize * defaultTextSize_childName);
ImageView iconView = (ImageView) v.findViewById(R.id.row_feedfavicon);
nameView.setPadding(nameView.getPaddingLeft(), titleVerticalPadding, nameView.getPaddingRight(), titleVerticalPadding);
ImageView iconView = v.findViewById(R.id.row_feedfavicon);
iconLoader.preCheck(f.faviconUrl, iconView);
iconLoader.displayImage(f.faviconUrl, iconView);
TextView neutCounter = ((TextView) v.findViewById(R.id.row_feedneutral));
TextView posCounter = ((TextView) v.findViewById(R.id.row_feedpositive));
TextView savedCounter = ((TextView) v.findViewById(R.id.row_feedsaved));
ImageView muteIcon = ((ImageView) v.findViewById(R.id.row_feedmuteicon));
CircularProgressIndicator fetchingIcon = ((CircularProgressIndicator) v.findViewById(R.id.row_feedfetching));
TextView neutCounter = v.findViewById(R.id.row_feedneutral);
TextView posCounter = v.findViewById(R.id.row_feedpositive);
TextView savedCounter = v.findViewById(R.id.row_feedsaved);
ImageView muteIcon = v.findViewById(R.id.row_feedmuteicon);
CircularProgressIndicator fetchingIcon = v.findViewById(R.id.row_feedfetching);
if (!f.active) {
muteIcon.setVisibility(View.VISIBLE);
neutCounter.setVisibility(View.GONE);
@ -444,7 +451,7 @@ public class FolderListAdapter extends BaseExpandableListAdapter {
public synchronized long getGroupId(int groupPosition) {
return activeFolderNames.get(groupPosition).hashCode();
}
@Override
public synchronized int getChildrenCount(int groupPosition) {
if (isRowAllSharedStories(groupPosition)) {
@ -554,7 +561,7 @@ public class FolderListAdapter extends BaseExpandableListAdapter {
}
}
}
recountChildren();
notifyDataSetChanged();
}
@ -630,7 +637,7 @@ public class FolderListAdapter extends BaseExpandableListAdapter {
Collections.sort(savedSearches, SavedSearch.SavedSearchComparatorByTitle);
notifyDataSetChanged();
}
private void recountFeeds() {
if ((folders == null) || (feeds == null)) return;
// re-init our local vars
@ -928,7 +935,7 @@ public class FolderListAdapter extends BaseExpandableListAdapter {
default:
if ((neutCount > 0) || showNeutZero) {
v.findViewById(R.id.row_foldersumneu).setVisibility(View.VISIBLE);
} else {
} else {
v.findViewById(R.id.row_foldersumneu).setVisibility(View.GONE);
}
if (posCount == 0) {
@ -971,4 +978,8 @@ public class FolderListAdapter extends BaseExpandableListAdapter {
this.textSize = textSize;
}
public void setFeedListStyle(FeedListStyle feedListStyle) {
this.feedListStyle = feedListStyle;
}
}

View file

@ -52,6 +52,7 @@ import com.newsblur.domain.Folder;
import com.newsblur.domain.SavedSearch;
import com.newsblur.domain.SocialFeed;
import com.newsblur.util.AppConstants;
import com.newsblur.util.FeedListStyle;
import com.newsblur.util.FeedSet;
import com.newsblur.util.FeedUtils;
import com.newsblur.util.ImageLoader;
@ -114,8 +115,10 @@ public class FolderListFragment extends NbFragment implements OnCreateContextMen
public void onResume() {
super.onResume();
if (adapter != null) {
float textSize = PrefsUtils.getListTextSize(getActivity());
float textSize = PrefsUtils.getListTextSize(requireContext());
adapter.setTextSize(textSize);
FeedListStyle feedListStyle = PrefsUtils.getFeedListStyle(requireContext());
adapter.setFeedListStyle(feedListStyle);
adapter.notifyDataSetChanged();
}
}

View file

@ -0,0 +1,19 @@
package com.newsblur.util
import android.content.Context
enum class FeedListStyle {
COMFORTABLE, // default
COMPACT,
;
fun getGroupTitleVerticalPadding(context: Context): Int = when (this) {
COMFORTABLE -> UIUtils.dp2px(context, 9)
COMPACT -> UIUtils.dp2px(context, 4)
}
fun getChildTitleVerticalPadding(context: Context): Int = when (this) {
COMFORTABLE -> UIUtils.dp2px(context, 7)
COMPACT -> UIUtils.dp2px(context, 3)
}
}

View file

@ -64,6 +64,7 @@ public class PrefConstants {
public static final String STORIES_SHOW_PREVIEWS_STYLE = "pref_show_content_preview_style";
public static final String STORIES_THUMBNAIL_STYLE = "pref_thumbnail_style";
public static final String STORY_MARK_READ_BEHAVIOR = "pref_story_mark_read_behavior";
public static final String FEED_LIST_STYLE = "pref_feed_list_style";
public static final String ENABLE_OFFLINE = "enable_offline";
public static final String ENABLE_IMAGE_PREFETCH = "enable_image_prefetch";

View file

@ -1052,6 +1052,11 @@ public class PrefsUtils {
editor.commit();
}
public static FeedListStyle getFeedListStyle(Context context) {
SharedPreferences preferences = context.getSharedPreferences(PrefConstants.PREFERENCES, 0);
return FeedListStyle.valueOf(preferences.getString(PrefConstants.FEED_LIST_STYLE, FeedListStyle.COMFORTABLE.name()));
}
/**
* Check for logged in user.
* @return whether a cookie is stored on disk