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:
|
case TYPE_CONVERSATION:
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putLong(MessageListFragment.ARG_THREAD_ID, mThreadId);
|
args.putLong(MessageListFragment.ARG_THREAD_ID, mThreadId);
|
||||||
mContent = MessageListFragment.getInstance(args);
|
mContent = MessageListFragment.getInstance(mThreadId, 0, null, false);
|
||||||
break;
|
break;
|
||||||
case TYPE_SETTINGS:
|
case TYPE_SETTINGS:
|
||||||
mContent = SettingsFragment.newInstance(R.xml.settings_simple);
|
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) {
|
public void setConversation(long threadId, long rowId, String pattern, boolean animate) {
|
||||||
|
MessageListFragment fragment = MessageListFragment.getInstance(threadId, rowId, pattern, !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);
|
|
||||||
|
|
||||||
// Save the thread ID here and switch the content
|
// Save the thread ID here and switch the content
|
||||||
mThreadId = threadId;
|
mThreadId = threadId;
|
||||||
|
|||||||
@@ -190,15 +190,24 @@ public class MessageListFragment extends QKContentFragment implements ActivityLa
|
|||||||
private String mHighlight;
|
private String mHighlight;
|
||||||
private boolean mShowImmediate;
|
private boolean mShowImmediate;
|
||||||
|
|
||||||
public static MessageListFragment getInstance(Bundle args) {
|
public static MessageListFragment getInstance(long threadId, long rowId, String highlight, boolean showImmediate) {
|
||||||
MessageListFragment fragment = new MessageListFragment();
|
|
||||||
|
|
||||||
// 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);
|
fragment.updateArguments(args);
|
||||||
|
|
||||||
return fragment;
|
return fragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MessageListFragment() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(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
|
* To be called when the user opens a conversation. Initializes the Conversation objects, sets
|
||||||
* up the draft, and marks the conversation as read.
|
* 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.
|
* Note: This will have no effect if the context has not been initialized yet.
|
||||||
*/
|
*/
|
||||||
private void onOpenConversation() {
|
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
|
* 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.
|
* message back in the edit box to be updated and then sent.
|
||||||
* <p/>
|
* <p>
|
||||||
* Assumes that cursor points to the correct MessageItem.
|
* Assumes that cursor points to the correct MessageItem.
|
||||||
*
|
*
|
||||||
* @param msgItem
|
* @param msgItem
|
||||||
|
|||||||
Reference in New Issue
Block a user