mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-25 13:07:20 +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
|
@Override
|
||||||
public void onSuccess(Boolean result) {
|
public void onSuccess(Boolean result) {
|
||||||
if (result != null && result) {
|
if (result != null && result) {
|
||||||
|
Log.i(TAG, "Finished loading draft");
|
||||||
Util.runOnMain(() -> {
|
Util.runOnMain(() -> {
|
||||||
if (fragment != null && fragment.isResumed()) {
|
if (fragment != null && fragment.isResumed()) {
|
||||||
fragment.moveToLastSeen();
|
fragment.moveToLastSeen();
|
||||||
|
} else {
|
||||||
|
Log.w(TAG, "Wanted to move to the last seen position, but the fragment was in an invalid state");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -191,11 +191,19 @@ public class ConversationFragment extends Fragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void moveToLastSeen() {
|
public void moveToLastSeen() {
|
||||||
if (lastSeen > 0) {
|
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);
|
int position = getListAdapter().findLastSeenPosition(lastSeen);
|
||||||
scrollToLastSeenPosition(position);
|
scrollToLastSeenPosition(position);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void initializeResources() {
|
private void initializeResources() {
|
||||||
this.recipient = Recipient.from(getActivity(), getActivity().getIntent().getParcelableExtra(ConversationActivity.ADDRESS_EXTRA), true);
|
this.recipient = Recipient.from(getActivity(), getActivity().getIntent().getParcelableExtra(ConversationActivity.ADDRESS_EXTRA), true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user