mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-05-02 22:53:09 +01:00
move routing logic to all activities
Fixes #2239 Closes #27923 // FREEBIE
This commit is contained in:
committed by
Moxie Marlinspike
parent
141ee6565d
commit
0ff99258ac
@@ -61,13 +61,18 @@ public class ConversationListFragment extends ListFragment
|
||||
implements LoaderManager.LoaderCallbacks<Cursor>, ActionMode.Callback
|
||||
{
|
||||
|
||||
private ConversationSelectedListener listener;
|
||||
private MasterSecret masterSecret;
|
||||
private ActionMode actionMode;
|
||||
private ReminderView reminderView;
|
||||
private FloatingActionButton fab;
|
||||
private String queryFilter = "";
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
masterSecret = getArguments().getParcelable("master_secret");
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
|
||||
final View view = inflater.inflate(R.layout.conversation_list_fragment, container, false);
|
||||
@@ -76,12 +81,6 @@ public class ConversationListFragment extends ListFragment
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
getListView().setAdapter(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle bundle) {
|
||||
super.onActivityCreated(bundle);
|
||||
@@ -92,9 +91,7 @@ public class ConversationListFragment extends ListFragment
|
||||
fab.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(getActivity(), NewConversationActivity.class);
|
||||
intent.putExtra(NewConversationActivity.MASTER_SECRET_EXTRA, masterSecret);
|
||||
startActivity(intent);
|
||||
startActivity(new Intent(getActivity(), NewConversationActivity.class));
|
||||
}
|
||||
});
|
||||
initializeListAdapter();
|
||||
@@ -111,12 +108,6 @@ public class ConversationListFragment extends ListFragment
|
||||
((ConversationListAdapter)getListAdapter()).notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
this.listener = (ConversationSelectedListener)activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onListItemClick(ListView l, View v, int position, long id) {
|
||||
if (v instanceof ConversationListItem) {
|
||||
@@ -140,13 +131,6 @@ public class ConversationListFragment extends ListFragment
|
||||
}
|
||||
}
|
||||
|
||||
public void setMasterSecret(MasterSecret masterSecret) {
|
||||
if (this.masterSecret != masterSecret) {
|
||||
this.masterSecret = masterSecret;
|
||||
initializeListAdapter();
|
||||
}
|
||||
}
|
||||
|
||||
public void setQueryFilter(String query) {
|
||||
this.queryFilter = query;
|
||||
getLoaderManager().restartLoader(0, null, this);
|
||||
@@ -250,7 +234,7 @@ public class ConversationListFragment extends ListFragment
|
||||
}
|
||||
|
||||
private void handleCreateConversation(long threadId, Recipients recipients, int distributionType) {
|
||||
listener.onCreateConversation(threadId, recipients, distributionType);
|
||||
((ConversationSelectedListener)getActivity()).onCreateConversation(threadId, recipients, distributionType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user