mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
Fix crash with moveToLastSeen()
This commit is contained in:
parent
8ca11756be
commit
5a1ef31b49
@ -301,9 +301,12 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
@Override
|
||||
public void onSuccess(Boolean result) {
|
||||
if (result != null && result) {
|
||||
Log.i(TAG, "Finished loading draft");
|
||||
Util.runOnMain(() -> {
|
||||
if (fragment != null && fragment.isResumed()) {
|
||||
fragment.moveToLastSeen();
|
||||
} else {
|
||||
Log.w(TAG, "Wanted to move to the last seen position, but the fragment was in an invalid state");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -191,10 +191,18 @@ public class ConversationFragment extends Fragment
|
||||
}
|
||||
|
||||
public void moveToLastSeen() {
|
||||
if (lastSeen > 0) {
|
||||
int position = getListAdapter().findLastSeenPosition(lastSeen);
|
||||
scrollToLastSeenPosition(position);
|
||||
if (lastSeen <= 0) {
|
||||
Log.i(TAG, "No need to move to last seen.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (list == null || getListAdapter() == null) {
|
||||
Log.w(TAG, "Tried to move to last seen position, but we hadn't initialized the view yet.");
|
||||
return;
|
||||
}
|
||||
|
||||
int position = getListAdapter().findLastSeenPosition(lastSeen);
|
||||
scrollToLastSeenPosition(position);
|
||||
}
|
||||
|
||||
private void initializeResources() {
|
||||
|
Loading…
Reference in New Issue
Block a user