mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 18:15:22 +00:00
Add "%s selected" subtitle to Conversation List batch mode.
This commit is contained in:
parent
ea0fa58265
commit
a54d20f3ef
@ -1,32 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:text="@string/conversation_fragment_cab__batch_selection_mode"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textAppearance="?android:attr/textAppearanceMediumInverse"
|
||||
android:textColor="?textColorPrimary"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/selected_conv_count"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textColor="#ccffffff"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:paddingRight="10dip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
@ -467,6 +467,7 @@
|
||||
|
||||
<!-- conversation_fragment_cab -->
|
||||
<string name="conversation_fragment_cab__batch_selection_mode">Batch selection mode</string>
|
||||
<string name="conversation_fragment_cab__batch_selection_amount">%s selected</string>
|
||||
|
||||
<!-- country_selection_fragment -->
|
||||
<string name="country_selection_fragment__loading_countries">Loading countries...</string>
|
||||
|
@ -25,7 +25,6 @@ import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.LoaderManager;
|
||||
import android.support.v4.content.Loader;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -33,14 +32,6 @@ import android.widget.AdapterView;
|
||||
import android.widget.CursorAdapter;
|
||||
import android.widget.ListView;
|
||||
|
||||
import org.whispersystems.textsecure.crypto.MasterSecret;
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.thoughtcrime.securesms.database.loaders.ConversationListLoader;
|
||||
import org.thoughtcrime.securesms.notifications.MessageNotifier;
|
||||
import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
import org.thoughtcrime.securesms.util.Dialogs;
|
||||
import org.whispersystems.textsecure.util.Util;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockListFragment;
|
||||
import com.actionbarsherlock.view.ActionMode;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
@ -48,6 +39,14 @@ import com.actionbarsherlock.view.MenuInflater;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
import com.actionbarsherlock.widget.SearchView;
|
||||
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.thoughtcrime.securesms.database.loaders.ConversationListLoader;
|
||||
import org.thoughtcrime.securesms.notifications.MessageNotifier;
|
||||
import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
import org.thoughtcrime.securesms.util.Dialogs;
|
||||
import org.whispersystems.textsecure.crypto.MasterSecret;
|
||||
import org.whispersystems.textsecure.util.Util;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
@ -60,7 +59,6 @@ public class ConversationListFragment extends SherlockListFragment
|
||||
private ActionMode actionMode;
|
||||
|
||||
private String queryFilter = "";
|
||||
private boolean batchMode = false;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
|
||||
@ -102,8 +100,7 @@ public class ConversationListFragment extends SherlockListFragment
|
||||
public void onListItemClick(ListView l, View v, int position, long id) {
|
||||
if (v instanceof ConversationListItem) {
|
||||
ConversationListItem headerView = (ConversationListItem) v;
|
||||
Log.w("ConversationListFragment", "Batch mode: " + batchMode);
|
||||
if (!batchMode) {
|
||||
if (actionMode == null) {
|
||||
handleCreateConversation(headerView.getThreadId(), headerView.getRecipients(),
|
||||
headerView.getDistributionType());
|
||||
} else {
|
||||
@ -112,6 +109,9 @@ public class ConversationListFragment extends SherlockListFragment
|
||||
|
||||
if (adapter.getBatchSelections().size() == 0) {
|
||||
actionMode.finish();
|
||||
} else {
|
||||
actionMode.setSubtitle(getString(R.string.conversation_fragment_cab__batch_selection_amount,
|
||||
adapter.getBatchSelections().size()));
|
||||
}
|
||||
|
||||
adapter.notifyDataSetChanged();
|
||||
@ -160,7 +160,6 @@ public class ConversationListFragment extends SherlockListFragment
|
||||
public boolean onItemLongClick(AdapterView<?> arg0, View v, int position, long id) {
|
||||
ConversationListAdapter adapter = (ConversationListAdapter)getListAdapter();
|
||||
actionMode = getSherlockActivity().startActionMode(ConversationListFragment.this);
|
||||
batchMode = true;
|
||||
|
||||
adapter.initializeBatchMode(true);
|
||||
adapter.toggleThreadInBatchSet(((ConversationListItem) v).getThreadId());
|
||||
@ -215,7 +214,6 @@ public class ConversationListFragment extends SherlockListFragment
|
||||
if (actionMode != null) {
|
||||
actionMode.finish();
|
||||
actionMode = null;
|
||||
batchMode = false;
|
||||
}
|
||||
}
|
||||
}.execute();
|
||||
@ -263,10 +261,8 @@ public class ConversationListFragment extends SherlockListFragment
|
||||
MenuInflater inflater = getSherlockActivity().getSupportMenuInflater();
|
||||
inflater.inflate(R.menu.conversation_list_batch, menu);
|
||||
|
||||
LayoutInflater layoutInflater = getSherlockActivity().getLayoutInflater();
|
||||
View actionModeView = layoutInflater.inflate(R.layout.conversation_fragment_cab, null);
|
||||
|
||||
mode.setCustomView(actionModeView);
|
||||
mode.setTitle(R.string.conversation_fragment_cab__batch_selection_mode);
|
||||
mode.setSubtitle(null);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -290,7 +286,6 @@ public class ConversationListFragment extends SherlockListFragment
|
||||
public void onDestroyActionMode(ActionMode mode) {
|
||||
((ConversationListAdapter)getListAdapter()).initializeBatchMode(false);
|
||||
actionMode = null;
|
||||
batchMode = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user