mirror of
https://github.com/readrops/Readrops.git
synced 2025-02-09 08:28:39 +01:00
Add preference for marking items read on scroll
This commit is contained in:
parent
1bfed8306d
commit
11f87d14a5
@ -444,6 +444,23 @@ public class MainActivity extends AppCompatActivity implements SwipeRefreshLayou
|
|||||||
} else {
|
} else {
|
||||||
binding.addFeedFab.show();
|
binding.addFeedFab.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int firstVisibleItemPosition = layoutManager.findFirstVisibleItemPosition();
|
||||||
|
if (firstVisibleItemPosition - 2 >= 0) {
|
||||||
|
Item item = adapter.getItemWithFeed(firstVisibleItemPosition - 2).getItem();
|
||||||
|
|
||||||
|
// Might be better to have a global variable updated when going back from settings
|
||||||
|
if (!item.isRead() && SharedPreferencesManager.readBoolean(SharedPreferencesManager
|
||||||
|
.SharedPrefKey.MARK_ITEMS_READ_ON_SCROLL)) {
|
||||||
|
item.setRead(!item.isRead());
|
||||||
|
|
||||||
|
viewModel.setItemReadState(item)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.doOnError(throwable -> Utils.showSnackbar(binding.mainRoot, throwable.getMessage()))
|
||||||
|
.subscribe();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,8 @@ public final class SharedPreferencesManager {
|
|||||||
OPEN_ITEMS_IN("open_items_in", "0"),
|
OPEN_ITEMS_IN("open_items_in", "0"),
|
||||||
DARK_THEME("dark_theme", "false"),
|
DARK_THEME("dark_theme", "false"),
|
||||||
AUTO_SYNCHRO("auto_synchro", "0"),
|
AUTO_SYNCHRO("auto_synchro", "0"),
|
||||||
HIDE_SHOW_FEEDS("show_hide_feeds", "true");
|
HIDE_SHOW_FEEDS("show_hide_feeds", "true"),
|
||||||
|
MARK_ITEMS_READ_ON_SCROLL("mark_items_read", false);
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private String key;
|
private String key;
|
||||||
|
@ -141,5 +141,6 @@
|
|||||||
<string name="hide">Cacher</string>
|
<string name="hide">Cacher</string>
|
||||||
<string name="show">Afficher</string>
|
<string name="show">Afficher</string>
|
||||||
<string name="show_hide_feeds">Afficher ou cacher les flux sans nouveaux items</string>
|
<string name="show_hide_feeds">Afficher ou cacher les flux sans nouveaux items</string>
|
||||||
|
<string name="mark_items_read">Marquer les items comme lus pendant le défilement</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
@ -147,4 +147,5 @@
|
|||||||
<string name="hide">Hide</string>
|
<string name="hide">Hide</string>
|
||||||
<string name="show">Show</string>
|
<string name="show">Show</string>
|
||||||
<string name="show_hide_feeds">Show or hide feeds without new items</string>
|
<string name="show_hide_feeds">Show or hide feeds without new items</string>
|
||||||
|
<string name="mark_items_read">Mark items read on scroll</string>
|
||||||
</resources>
|
</resources>
|
@ -43,6 +43,11 @@
|
|||||||
android:key="show_hide_feeds"
|
android:key="show_hide_feeds"
|
||||||
android:title="@string/show_hide_feeds" />
|
android:title="@string/show_hide_feeds" />
|
||||||
|
|
||||||
|
<SwitchPreferenceCompat
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="mark_items_read"
|
||||||
|
android:title="@string/mark_items_read" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user