aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2020-07-02 03:13:10 +0000
committerAlex Ning <chineseperson5@gmail.com>2020-07-02 03:13:10 +0000
commit1958ad77e3c7c4c523caef15f90b0b32da1d0cb2 (patch)
tree898b5f459bdb570e2455c78bbecaf4b918721201 /app/src/main/java/ml
parent2fbc4d02c863bad0426eece6fb7bcc02dc8ac193 (diff)
downloadinfinity-for-reddit-1958ad77e3c7c4c523caef15f90b0b32da1d0cb2.tar
infinity-for-reddit-1958ad77e3c7c4c523caef15f90b0b32da1d0cb2.tar.gz
infinity-for-reddit-1958ad77e3c7c4c523caef15f90b0b32da1d0cb2.tar.bz2
infinity-for-reddit-1958ad77e3c7c4c523caef15f90b0b32da1d0cb2.tar.lz
infinity-for-reddit-1958ad77e3c7c4c523caef15f90b0b32da1d0cb2.tar.xz
infinity-for-reddit-1958ad77e3c7c4c523caef15f90b0b32da1d0cb2.tar.zst
infinity-for-reddit-1958ad77e3c7c4c523caef15f90b0b32da1d0cb2.zip
Maintain RecyclerView position when showing and hiding the keyboard in ViewPrivateMessagesActivity.
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPrivateMessagesActivity.java19
1 files changed, 10 insertions, 9 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPrivateMessagesActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPrivateMessagesActivity.java
index aecc78ab..c42ab803 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPrivateMessagesActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPrivateMessagesActivity.java
@@ -93,8 +93,8 @@ public class ViewPrivateMessagesActivity extends BaseActivity implements Activit
private String mAccessToken;
private String mAccountName;
private String mUserAvatar;
- private ArrayList<ProvideUserAvatarCallback> provideUserAvatarCallbacks;
- private LoadUserDataAsyncTask loadUserDataAsyncTask;
+ private ArrayList<ProvideUserAvatarCallback> mProvideUserAvatarCallbacks;
+ private LoadUserDataAsyncTask mLoadUserDataAsyncTask;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -127,7 +127,7 @@ public class ViewPrivateMessagesActivity extends BaseActivity implements Activit
setSupportActionBar(mToolbar);
setToolbarGoToTop(mToolbar);
- provideUserAvatarCallbacks = new ArrayList<>();
+ mProvideUserAvatarCallbacks = new ArrayList<>();
if (savedInstanceState != null) {
mNullAccessToken = savedInstanceState.getBoolean(NULL_ACCESS_TOKEN_STATE);
@@ -160,6 +160,7 @@ public class ViewPrivateMessagesActivity extends BaseActivity implements Activit
private void bindView() {
mAdapter = new PrivateMessagesDetailRecyclerViewAdapter(this, privateMessage, mAccountName, mCustomThemeWrapper);
mLinearLayoutManager = new LinearLayoutManager(this);
+ mLinearLayoutManager.setStackFromEnd(true);
mRecyclerView.setLayoutManager(mLinearLayoutManager);
mRecyclerView.setAdapter(mAdapter);
goToBottom();
@@ -229,16 +230,16 @@ public class ViewPrivateMessagesActivity extends BaseActivity implements Activit
public void fetchUserAvatar(String username, ProvideUserAvatarCallback provideUserAvatarCallback) {
if (mUserAvatar == null) {
- provideUserAvatarCallbacks.add(provideUserAvatarCallback);
- if (loadUserDataAsyncTask == null) {
- loadUserDataAsyncTask = new LoadUserDataAsyncTask(mRedditDataRoomDatabase.userDao(), username, mRetrofit, iconImageUrl -> {
+ mProvideUserAvatarCallbacks.add(provideUserAvatarCallback);
+ if (mLoadUserDataAsyncTask == null) {
+ mLoadUserDataAsyncTask = new LoadUserDataAsyncTask(mRedditDataRoomDatabase.userDao(), username, mRetrofit, iconImageUrl -> {
mUserAvatar = iconImageUrl;
- for (ProvideUserAvatarCallback provideUserAvatarCallbackInArrayList : provideUserAvatarCallbacks) {
+ for (ProvideUserAvatarCallback provideUserAvatarCallbackInArrayList : mProvideUserAvatarCallbacks) {
provideUserAvatarCallbackInArrayList.fetchAvatarSuccess(iconImageUrl);
}
- provideUserAvatarCallbacks.clear();
+ mProvideUserAvatarCallbacks.clear();
});
- loadUserDataAsyncTask.execute();
+ mLoadUserDataAsyncTask.execute();
}
} else {
provideUserAvatarCallback.fetchAvatarSuccess(mUserAvatar);