scroll to the new message in conversation

// FREEBIE
This commit is contained in:
Jake McGinty 2014-03-26 15:11:56 -07:00
parent 33000582ed
commit 216446c55b
2 changed files with 14 additions and 4 deletions

View File

@ -1060,17 +1060,16 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
this.recipients = recipients;
this.threadId = threadId;
ConversationFragment fragment = (ConversationFragment) getSupportFragmentManager()
.findFragmentById(R.id.fragment_content);
if (refreshFragment) {
ConversationFragment fragment
= (ConversationFragment)this.getSupportFragmentManager()
.findFragmentById(R.id.fragment_content);
fragment.reload(recipients, threadId);
this.recipientsPanel.setVisibility(View.GONE);
initializeTitleBar();
initializeSecurity();
}
fragment.scrollToBottom();
}
private void sendMessage(boolean forcePlaintext) {

View File

@ -17,6 +17,7 @@ import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CursorAdapter;
import android.widget.ListView;
import com.actionbarsherlock.app.SherlockListFragment;
@ -104,6 +105,16 @@ public class ConversationFragment extends SherlockListFragment
initializeListAdapter();
}
public void scrollToBottom() {
final ListView list = getListView();
list.post(new Runnable() {
@Override
public void run() {
list.setSelection(getListAdapter().getCount() - 1);
}
});
}
private void handleCopyMessage(MessageRecord message) {
String body = message.getDisplayBody().toString();
if (body == null) return;