From 62e03e7ce4894ddcc072d52c65102743ca986ef2 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Wed, 10 Oct 2018 15:53:02 +0200 Subject: [PATCH] tweak contact deletion, closes #83 --- res/values/strings.xml | 2 +- .../securesms/ContactSelectionListFragment.java | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 3f539664c..65aad25d8 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -751,7 +751,7 @@ Error retrieving contacts, check your network connection Error deleting contacts, some contacts couldn\'t get deleted. Please delete existing conversations before. Delete contacts? - This will permanently delete the selected contacts. Only contacts without ongoing conversations will be deleted. If the contact permission is granted, local phone contacts will be automatically added again on reopening. + This will permanently delete the selected contacts.\n\nContacts with ongoing chats and contacts from the system\'s address book cannot be deleted permanently. No blocked contacts diff --git a/src/org/thoughtcrime/securesms/ContactSelectionListFragment.java b/src/org/thoughtcrime/securesms/ContactSelectionListFragment.java index beef4a047..33cfe57fa 100644 --- a/src/org/thoughtcrime/securesms/ContactSelectionListFragment.java +++ b/src/org/thoughtcrime/securesms/ContactSelectionListFragment.java @@ -19,6 +19,8 @@ package org.thoughtcrime.securesms; import android.Manifest; import android.annotation.SuppressLint; +import android.content.res.TypedArray; +import android.graphics.Color; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; @@ -27,10 +29,11 @@ import android.support.v4.app.Fragment; import android.support.v4.app.LoaderManager; import android.support.v4.content.Loader; import android.support.v4.widget.SwipeRefreshLayout; +import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; +import android.support.v7.view.ActionMode; import android.util.SparseIntArray; -import android.view.ActionMode; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; @@ -162,9 +165,11 @@ public class ContactSelectionListFragment extends Fragment public void onDestroyActionMode(ActionMode actionMode) { ContactSelectionListFragment.this.actionMode = null; getContactSelectionListAdapter().resetActionModeSelection(); - ContactSelectionActivity activity = (ContactSelectionActivity) getActivity(); - if (activity != null) { - activity.getToolbar().setBackgroundColor(getResources().getColor(R.color.textsecure_primary)); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + TypedArray color = getActivity().getTheme().obtainStyledAttributes(new int[] {android.R.attr.statusBarColor}); + getActivity().getWindow().setStatusBarColor(color.getColor(0, Color.BLACK)); + color.recycle(); } } }; @@ -362,7 +367,7 @@ public class ContactSelectionListFragment extends Fragment @Override public void onItemLongClick(ContactSelectionListItem view) { if (actionMode == null) { - actionMode = Objects.requireNonNull(getActivity()).startActionMode(actionModeCallback); + actionMode = ((AppCompatActivity)getActivity()).startSupportActionMode(actionModeCallback); } else { finishActionModeIfSelectionIsEmpty(); }