mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Add enum to support mark as read preference. Add check for preference when marking folder as read.
This commit is contained in:
parent
7fe488cee6
commit
dd6c5f8055
4 changed files with 37 additions and 4 deletions
|
@ -4,7 +4,6 @@ import android.os.Bundle;
|
|||
import android.app.FragmentTransaction;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.util.Log;
|
||||
|
||||
import com.newsblur.R;
|
||||
import com.newsblur.fragment.FolderItemListFragment;
|
||||
|
@ -13,9 +12,9 @@ import com.newsblur.fragment.MarkAllReadDialogFragment.MarkAllReadDialogListener
|
|||
import com.newsblur.util.DefaultFeedView;
|
||||
import com.newsblur.util.FeedSet;
|
||||
import com.newsblur.util.FeedUtils;
|
||||
import com.newsblur.util.MarkAsReadConfirmation;
|
||||
import com.newsblur.util.PrefsUtils;
|
||||
import com.newsblur.util.ReadFilter;
|
||||
import com.newsblur.util.StoryOrder;
|
||||
import com.newsblur.util.UIUtils;
|
||||
|
||||
public class FolderItemsList extends ItemsList implements MarkAllReadDialogListener {
|
||||
|
@ -56,8 +55,13 @@ public class FolderItemsList extends ItemsList implements MarkAllReadDialogListe
|
|||
|
||||
@Override
|
||||
public void markItemListAsRead() {
|
||||
MarkAllReadDialogFragment dialog = MarkAllReadDialogFragment.newInstance(folderName);
|
||||
dialog.show(fragmentManager, "dialog");
|
||||
MarkAsReadConfirmation confirmation = PrefsUtils.getMarkAsReadConfirmation(this);
|
||||
if (confirmation.foldersRequireConfirmation()) {
|
||||
MarkAllReadDialogFragment dialog = MarkAllReadDialogFragment.newInstance(folderName);
|
||||
dialog.show(fragmentManager, "dialog");
|
||||
} else {
|
||||
onMarkAllRead();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package com.newsblur.util;
|
||||
|
||||
/**
|
||||
* Enum to represent mark as read confirmation preference.
|
||||
* @author mark
|
||||
*/
|
||||
public enum MarkAsReadConfirmation {
|
||||
|
||||
FEED_AND_FOLDER("feed_and_folder"),
|
||||
FOLDER_ONLY("folder_only"),
|
||||
NONE("none");
|
||||
|
||||
private String parameterValue;
|
||||
|
||||
MarkAsReadConfirmation(String parameterValue) {
|
||||
this.parameterValue = parameterValue;
|
||||
}
|
||||
|
||||
public boolean foldersRequireConfirmation() {
|
||||
return this != NONE;
|
||||
}
|
||||
}
|
|
@ -67,4 +67,5 @@ public class PrefConstants {
|
|||
public static final String LAST_CLEANUP_TIME = "last_cleanup_time";
|
||||
|
||||
public static final String VOLUME_KEY_NAVIGATION = "volume_key_navigation";
|
||||
public static final String MARK_AS_READ_CONFIRMATION = "mark_as_read_confirmation";
|
||||
}
|
||||
|
|
|
@ -567,4 +567,10 @@ public class PrefsUtils {
|
|||
SharedPreferences prefs = context.getSharedPreferences(PrefConstants.PREFERENCES, 0);
|
||||
return VolumeKeyNavigation.valueOf(prefs.getString(PrefConstants.VOLUME_KEY_NAVIGATION, VolumeKeyNavigation.OFF.toString()));
|
||||
}
|
||||
|
||||
public static MarkAsReadConfirmation getMarkAsReadConfirmation(Context context) {
|
||||
SharedPreferences prefs = context.getSharedPreferences(PrefConstants.PREFERENCES, 0);
|
||||
// TODO default to FOLDER_ONLY
|
||||
return MarkAsReadConfirmation.valueOf(prefs.getString(PrefConstants.MARK_AS_READ_CONFIRMATION, MarkAsReadConfirmation.NONE.toString()));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue