mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-17 05:09:53 +01:00
Keep the activity's reply ID up to date.
This commit is contained in:
@@ -191,7 +191,7 @@ public abstract class ThreadListActivity<G extends NamedGroup, A extends ThreadI
|
|||||||
list.showData();
|
list.showData();
|
||||||
} else {
|
} else {
|
||||||
initList(items);
|
initList(items);
|
||||||
updateTextInput(replyId);
|
updateTextInput();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG.info("Concurrent update, reloading");
|
LOG.info("Concurrent update, reloading");
|
||||||
@@ -253,9 +253,8 @@ public abstract class ThreadListActivity<G extends NamedGroup, A extends ThreadI
|
|||||||
@Override
|
@Override
|
||||||
protected void onSaveInstanceState(Bundle outState) {
|
protected void onSaveInstanceState(Bundle outState) {
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
ThreadItem replyItem = adapter.getHighlightedItem();
|
if (replyId != null) {
|
||||||
if (replyItem != null) {
|
outState.putByteArray(KEY_REPLY_ID, replyId.getBytes());
|
||||||
outState.putByteArray(KEY_REPLY_ID, replyItem.getId().getBytes());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,7 +272,9 @@ public abstract class ThreadListActivity<G extends NamedGroup, A extends ThreadI
|
|||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if (adapter.getHighlightedItem() != null) {
|
if (adapter.getHighlightedItem() != null) {
|
||||||
updateTextInput(null);
|
textInput.setText("");
|
||||||
|
replyId = null;
|
||||||
|
updateTextInput();
|
||||||
} else {
|
} else {
|
||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
}
|
}
|
||||||
@@ -289,7 +290,8 @@ public abstract class ThreadListActivity<G extends NamedGroup, A extends ThreadI
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReplyClick(final I item) {
|
public void onReplyClick(final I item) {
|
||||||
updateTextInput(item.getId());
|
replyId = item.getId();
|
||||||
|
updateTextInput();
|
||||||
if (textInput.isKeyboardOpen()) {
|
if (textInput.isKeyboardOpen()) {
|
||||||
scrollToItemAtTop(item);
|
scrollToItemAtTop(item);
|
||||||
} else {
|
} else {
|
||||||
@@ -339,15 +341,15 @@ public abstract class ThreadListActivity<G extends NamedGroup, A extends ThreadI
|
|||||||
snackbar.show();
|
snackbar.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTextInput(@Nullable MessageId replyItemId) {
|
private void updateTextInput() {
|
||||||
if (replyItemId != null) {
|
if (replyId != null) {
|
||||||
textInput.setHint(R.string.forum_message_reply_hint);
|
textInput.setHint(R.string.forum_message_reply_hint);
|
||||||
textInput.requestFocus();
|
textInput.requestFocus();
|
||||||
textInput.showSoftKeyboard();
|
textInput.showSoftKeyboard();
|
||||||
} else {
|
} else {
|
||||||
textInput.setHint(R.string.forum_new_message_hint);
|
textInput.setHint(R.string.forum_new_message_hint);
|
||||||
}
|
}
|
||||||
adapter.setHighlightedItem(replyItemId);
|
adapter.setHighlightedItem(replyId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -374,7 +376,8 @@ public abstract class ThreadListActivity<G extends NamedGroup, A extends ThreadI
|
|||||||
getController().createAndStoreMessage(text, replyItem, handler);
|
getController().createAndStoreMessage(text, replyItem, handler);
|
||||||
textInput.hideSoftKeyboard();
|
textInput.hideSoftKeyboard();
|
||||||
textInput.setText("");
|
textInput.setText("");
|
||||||
updateTextInput(null);
|
replyId = null;
|
||||||
|
updateTextInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract int getMaxBodyLength();
|
protected abstract int getMaxBodyLength();
|
||||||
|
|||||||
Reference in New Issue
Block a user