forked from upstream-mirrors/quik
Better constructor for MessageListFragment
This commit is contained in:
@@ -158,7 +158,7 @@ public class MainActivity extends QKActivity implements LiveView, SlidingMenu.Sl
|
||||
case TYPE_CONVERSATION:
|
||||
Bundle args = new Bundle();
|
||||
args.putLong(MessageListFragment.ARG_THREAD_ID, mThreadId);
|
||||
mContent = MessageListFragment.getInstance(args);
|
||||
mContent = MessageListFragment.getInstance(mThreadId, 0, null, false);
|
||||
break;
|
||||
case TYPE_SETTINGS:
|
||||
mContent = SettingsFragment.newInstance(R.xml.settings_simple);
|
||||
@@ -535,15 +535,7 @@ public class MainActivity extends QKActivity implements LiveView, SlidingMenu.Sl
|
||||
}
|
||||
|
||||
public void setConversation(long threadId, long rowId, String pattern, boolean animate) {
|
||||
|
||||
// Build the arguments for this conversation
|
||||
Bundle args = new Bundle();
|
||||
args.putLong(MessageListFragment.ARG_THREAD_ID, threadId);
|
||||
args.putLong(MessageListFragment.ARG_ROW_ID, rowId);
|
||||
args.putString(MessageListFragment.ARG_HIGHLIGHT, pattern);
|
||||
args.putBoolean(MessageListFragment.ARG_SHOW_IMMEDIATE, !animate);
|
||||
|
||||
MessageListFragment fragment = MessageListFragment.getInstance(args);
|
||||
MessageListFragment fragment = MessageListFragment.getInstance(threadId, rowId, pattern, !animate);
|
||||
|
||||
// Save the thread ID here and switch the content
|
||||
mThreadId = threadId;
|
||||
|
||||
@@ -190,15 +190,24 @@ public class MessageListFragment extends QKContentFragment implements ActivityLa
|
||||
private String mHighlight;
|
||||
private boolean mShowImmediate;
|
||||
|
||||
public static MessageListFragment getInstance(Bundle args) {
|
||||
MessageListFragment fragment = new MessageListFragment();
|
||||
public static MessageListFragment getInstance(long threadId, long rowId, String highlight, boolean showImmediate) {
|
||||
|
||||
// Update the fragment with the new arguments.
|
||||
Bundle args = new Bundle();
|
||||
args.putLong(ARG_THREAD_ID, threadId);
|
||||
args.putLong(ARG_ROW_ID, rowId);
|
||||
args.putString(ARG_HIGHLIGHT, highlight);
|
||||
args.putBoolean(ARG_SHOW_IMMEDIATE, showImmediate);
|
||||
|
||||
MessageListFragment fragment = new MessageListFragment();
|
||||
fragment.updateArguments(args);
|
||||
|
||||
return fragment;
|
||||
}
|
||||
|
||||
public MessageListFragment() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -323,7 +332,7 @@ public class MessageListFragment extends QKContentFragment implements ActivityLa
|
||||
/**
|
||||
* To be called when the user opens a conversation. Initializes the Conversation objects, sets
|
||||
* up the draft, and marks the conversation as read.
|
||||
* <p/>
|
||||
* <p>
|
||||
* Note: This will have no effect if the context has not been initialized yet.
|
||||
*/
|
||||
private void onOpenConversation() {
|
||||
@@ -672,7 +681,7 @@ public class MessageListFragment extends QKContentFragment implements ActivityLa
|
||||
/**
|
||||
* Should only be called for failed messages. Deletes the message, placing the text from the
|
||||
* message back in the edit box to be updated and then sent.
|
||||
* <p/>
|
||||
* <p>
|
||||
* Assumes that cursor points to the correct MessageItem.
|
||||
*
|
||||
* @param msgItem
|
||||
|
||||
Reference in New Issue
Block a user