mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05: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 -->
|
<!-- conversation_fragment_cab -->
|
||||||
<string name="conversation_fragment_cab__batch_selection_mode">Batch selection mode</string>
|
<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 -->
|
<!-- country_selection_fragment -->
|
||||||
<string name="country_selection_fragment__loading_countries">Loading countries...</string>
|
<string name="country_selection_fragment__loading_countries">Loading countries...</string>
|
||||||
|
@ -25,7 +25,6 @@ import android.os.AsyncTask;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.LoaderManager;
|
import android.support.v4.app.LoaderManager;
|
||||||
import android.support.v4.content.Loader;
|
import android.support.v4.content.Loader;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@ -33,14 +32,6 @@ import android.widget.AdapterView;
|
|||||||
import android.widget.CursorAdapter;
|
import android.widget.CursorAdapter;
|
||||||
import android.widget.ListView;
|
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.app.SherlockListFragment;
|
||||||
import com.actionbarsherlock.view.ActionMode;
|
import com.actionbarsherlock.view.ActionMode;
|
||||||
import com.actionbarsherlock.view.Menu;
|
import com.actionbarsherlock.view.Menu;
|
||||||
@ -48,6 +39,14 @@ import com.actionbarsherlock.view.MenuInflater;
|
|||||||
import com.actionbarsherlock.view.MenuItem;
|
import com.actionbarsherlock.view.MenuItem;
|
||||||
import com.actionbarsherlock.widget.SearchView;
|
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;
|
import java.util.Set;
|
||||||
|
|
||||||
|
|
||||||
@ -56,11 +55,10 @@ public class ConversationListFragment extends SherlockListFragment
|
|||||||
{
|
{
|
||||||
|
|
||||||
private ConversationSelectedListener listener;
|
private ConversationSelectedListener listener;
|
||||||
private MasterSecret masterSecret;
|
private MasterSecret masterSecret;
|
||||||
private ActionMode actionMode;
|
private ActionMode actionMode;
|
||||||
|
|
||||||
private String queryFilter = "";
|
private String queryFilter = "";
|
||||||
private boolean batchMode = false;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
|
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) {
|
public void onListItemClick(ListView l, View v, int position, long id) {
|
||||||
if (v instanceof ConversationListItem) {
|
if (v instanceof ConversationListItem) {
|
||||||
ConversationListItem headerView = (ConversationListItem) v;
|
ConversationListItem headerView = (ConversationListItem) v;
|
||||||
Log.w("ConversationListFragment", "Batch mode: " + batchMode);
|
if (actionMode == null) {
|
||||||
if (!batchMode) {
|
|
||||||
handleCreateConversation(headerView.getThreadId(), headerView.getRecipients(),
|
handleCreateConversation(headerView.getThreadId(), headerView.getRecipients(),
|
||||||
headerView.getDistributionType());
|
headerView.getDistributionType());
|
||||||
} else {
|
} else {
|
||||||
@ -112,6 +109,9 @@ public class ConversationListFragment extends SherlockListFragment
|
|||||||
|
|
||||||
if (adapter.getBatchSelections().size() == 0) {
|
if (adapter.getBatchSelections().size() == 0) {
|
||||||
actionMode.finish();
|
actionMode.finish();
|
||||||
|
} else {
|
||||||
|
actionMode.setSubtitle(getString(R.string.conversation_fragment_cab__batch_selection_amount,
|
||||||
|
adapter.getBatchSelections().size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
@ -160,7 +160,6 @@ public class ConversationListFragment extends SherlockListFragment
|
|||||||
public boolean onItemLongClick(AdapterView<?> arg0, View v, int position, long id) {
|
public boolean onItemLongClick(AdapterView<?> arg0, View v, int position, long id) {
|
||||||
ConversationListAdapter adapter = (ConversationListAdapter)getListAdapter();
|
ConversationListAdapter adapter = (ConversationListAdapter)getListAdapter();
|
||||||
actionMode = getSherlockActivity().startActionMode(ConversationListFragment.this);
|
actionMode = getSherlockActivity().startActionMode(ConversationListFragment.this);
|
||||||
batchMode = true;
|
|
||||||
|
|
||||||
adapter.initializeBatchMode(true);
|
adapter.initializeBatchMode(true);
|
||||||
adapter.toggleThreadInBatchSet(((ConversationListItem) v).getThreadId());
|
adapter.toggleThreadInBatchSet(((ConversationListItem) v).getThreadId());
|
||||||
@ -215,7 +214,6 @@ public class ConversationListFragment extends SherlockListFragment
|
|||||||
if (actionMode != null) {
|
if (actionMode != null) {
|
||||||
actionMode.finish();
|
actionMode.finish();
|
||||||
actionMode = null;
|
actionMode = null;
|
||||||
batchMode = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.execute();
|
}.execute();
|
||||||
@ -263,10 +261,8 @@ public class ConversationListFragment extends SherlockListFragment
|
|||||||
MenuInflater inflater = getSherlockActivity().getSupportMenuInflater();
|
MenuInflater inflater = getSherlockActivity().getSupportMenuInflater();
|
||||||
inflater.inflate(R.menu.conversation_list_batch, menu);
|
inflater.inflate(R.menu.conversation_list_batch, menu);
|
||||||
|
|
||||||
LayoutInflater layoutInflater = getSherlockActivity().getLayoutInflater();
|
mode.setTitle(R.string.conversation_fragment_cab__batch_selection_mode);
|
||||||
View actionModeView = layoutInflater.inflate(R.layout.conversation_fragment_cab, null);
|
mode.setSubtitle(null);
|
||||||
|
|
||||||
mode.setCustomView(actionModeView);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -290,7 +286,6 @@ public class ConversationListFragment extends SherlockListFragment
|
|||||||
public void onDestroyActionMode(ActionMode mode) {
|
public void onDestroyActionMode(ActionMode mode) {
|
||||||
((ConversationListAdapter)getListAdapter()).initializeBatchMode(false);
|
((ConversationListAdapter)getListAdapter()).initializeBatchMode(false);
|
||||||
actionMode = null;
|
actionMode = null;
|
||||||
batchMode = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user