-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resume scroll position #429
base: master
Are you sure you want to change the base?
Resume scroll position #429
Conversation
…k3125/conference-app-2017 into feature/opne-app-with-session-date
@@ -68,4 +68,8 @@ public Context getContext() { | |||
return context; | |||
} | |||
|
|||
@Override | |||
public Iterator<T> iterator() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Android Lint] reported by reviewdog 🐶
error: cannot find symbol
@@ -116,6 +121,9 @@ public void onResume() { | |||
@Override | |||
public void onStop() { | |||
super.onStop(); | |||
int position = binding.recyclerView.getFirstVisiblePosition(); | |||
Log.d(TAG, "onStop: " + position); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Android Lint] reported by reviewdog 🐶
Error: Using 'Log' instead of 'Timber' [LogNotTimber]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙇
@@ -116,6 +121,8 @@ public void onResume() { | |||
@Override | |||
public void onStop() { | |||
super.onStop(); | |||
int position = binding.recyclerView.getFirstVisiblePosition(); | |||
sharedPreferences.edit().putInt("last_position", position).apply(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this app uses kvs-schema
.
So you can use auto generated method to access shared preferences.
Can you follow the steps below?
1. Add key to DefaultPrefsSchema
@Table(name = "io.github.droidkaigi.confsched_preferences")
public interface DefaultPrefsSchema {
...
@Key(name = "last_sessions_view_position")
int lastSessionsViewPosition;
}
2. Use generated method.
DefaultPrefs prefs = DefaultPrefs.get(context);
int lastPosition = prefs.getLastSessionsViewPosition();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK! Thank you 😀
Issue
Overview (Required)
Links
Screenshot