diff --git a/res/layout/contact_selection_list_fragment.xml b/res/layout/contact_selection_list_fragment.xml
index 6ed8f5716..0ed121989 100644
--- a/res/layout/contact_selection_list_fragment.xml
+++ b/res/layout/contact_selection_list_fragment.xml
@@ -4,11 +4,6 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical">
-
-
-
-
+ android:padding="16dp"
+ android:lineSpacingMultiplier="1.3"
+ android:visibility="gone"
+ android:textSize="20sp"
+ tools:text="No contacts." />
Your profile info
Profile image
Blocked contacts
+ If you block contacts, they will be shown here.
Remove profile image?
Password and account
Your profile image and name will be shown alongside your messages when communicating with other users. Already sent information can not be deleted or removed.
diff --git a/src/org/thoughtcrime/securesms/BlockedAndShareContactsActivity.java b/src/org/thoughtcrime/securesms/BlockedAndShareContactsActivity.java
index d5769a609..c1b9b3ae2 100644
--- a/src/org/thoughtcrime/securesms/BlockedAndShareContactsActivity.java
+++ b/src/org/thoughtcrime/securesms/BlockedAndShareContactsActivity.java
@@ -6,7 +6,6 @@ import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.loader.app.LoaderManager;
import androidx.loader.content.Loader;
-import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.appcompat.app.AlertDialog;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@@ -14,6 +13,7 @@ import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.TextView;
import com.b44t.messenger.DcContext;
import com.b44t.messenger.DcEvent;
@@ -77,8 +77,7 @@ public class BlockedAndShareContactsActivity extends PassphraseRequiredActionBar
private RecyclerView recyclerView;
-
- private SwipeRefreshLayout swipeRefreshLayout;
+ private TextView emptyStateView;
private boolean showOnlyBlocked;
@@ -86,8 +85,9 @@ public class BlockedAndShareContactsActivity extends PassphraseRequiredActionBar
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
View view = inflater.inflate(R.layout.contact_selection_list_fragment, container, false);
recyclerView = ViewUtil.findById(view, R.id.recycler_view);
- swipeRefreshLayout = ViewUtil.findById(view, R.id.swipe_refresh);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
+ emptyStateView = ViewUtil.findById(view, android.R.id.empty);
+ emptyStateView.setText(R.string.blocked_empty_hint);
return view;
}
@@ -111,8 +111,6 @@ public class BlockedAndShareContactsActivity extends PassphraseRequiredActionBar
false,
false);
recyclerView.setAdapter(adapter);
- swipeRefreshLayout.setRefreshing(false);
- swipeRefreshLayout.setEnabled(false);
}
@Override
@@ -122,7 +120,13 @@ public class BlockedAndShareContactsActivity extends PassphraseRequiredActionBar
@Override
public void onLoadFinished(Loader loader, DcContactsLoader.Ret data) {
- getContactSelectionListAdapter().changeData(data);
+ ContactSelectionListAdapter adapter = getContactSelectionListAdapter();
+ if (adapter != null) {
+ adapter.changeData(data);
+ if (emptyStateView != null) {
+ emptyStateView.setVisibility(adapter.getItemCount() > 0 ? View.GONE : View.VISIBLE);
+ }
+ }
}
@Override
diff --git a/src/org/thoughtcrime/securesms/ContactSelectionActivity.java b/src/org/thoughtcrime/securesms/ContactSelectionActivity.java
index 869047aca..62e6cb825 100644
--- a/src/org/thoughtcrime/securesms/ContactSelectionActivity.java
+++ b/src/org/thoughtcrime/securesms/ContactSelectionActivity.java
@@ -16,10 +16,7 @@
*/
package org.thoughtcrime.securesms;
-import android.content.Context;
-import android.os.AsyncTask;
import android.os.Bundle;
-import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.thoughtcrime.securesms.components.ContactFilterToolbar;
import org.thoughtcrime.securesms.util.DynamicLanguage;
@@ -27,8 +24,6 @@ import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme;
import org.thoughtcrime.securesms.util.DynamicTheme;
import org.thoughtcrime.securesms.util.ViewUtil;
-import java.lang.ref.WeakReference;
-
/**
* Base activity container for selecting a list of contacts.
*
@@ -36,8 +31,7 @@ import java.lang.ref.WeakReference;
*
*/
public abstract class ContactSelectionActivity extends PassphraseRequiredActionBarActivity
- implements SwipeRefreshLayout.OnRefreshListener,
- ContactSelectionListFragment.OnContactSelectedListener
+ implements ContactSelectionListFragment.OnContactSelectedListener
{
private static final String TAG = ContactSelectionActivity.class.getSimpleName();
@@ -88,46 +82,15 @@ public abstract class ContactSelectionActivity extends PassphraseRequiredActionB
private void initializeResources() {
contactsFragment = (ContactSelectionListFragment) getSupportFragmentManager().findFragmentById(R.id.contact_selection_list_fragment);
contactsFragment.setOnContactSelectedListener(this);
- contactsFragment.setOnRefreshListener(this);
}
private void initializeSearch() {
toolbar.setOnFilterChangedListener(filter -> contactsFragment.setQueryFilter(filter));
}
- @Override
- public void onRefresh() {
- new RefreshDirectoryTask(this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, getApplicationContext());
- }
-
@Override
public void onContactSelected(int specialId, String number) {}
@Override
public void onContactDeselected(int specialId, String number) {}
-
- private static class RefreshDirectoryTask extends AsyncTask {
-
- private final WeakReference activity;
-
- private RefreshDirectoryTask(ContactSelectionActivity activity) {
- this.activity = new WeakReference<>(activity);
- }
-
- @Override
- protected Void doInBackground(Context... params) {
-
- return null;
- }
-
- @Override
- protected void onPostExecute(Void result) {
- ContactSelectionActivity activity = this.activity.get();
-
- if (activity != null && !activity.isFinishing()) {
- activity.toolbar.clear();
- activity.contactsFragment.resetQueryFilter();
- }
- }
- }
}
diff --git a/src/org/thoughtcrime/securesms/ContactSelectionListFragment.java b/src/org/thoughtcrime/securesms/ContactSelectionListFragment.java
index 8878c1c6c..d4a7058f6 100644
--- a/src/org/thoughtcrime/securesms/ContactSelectionListFragment.java
+++ b/src/org/thoughtcrime/securesms/ContactSelectionListFragment.java
@@ -30,7 +30,6 @@ import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.loader.app.LoaderManager;
import androidx.loader.content.Loader;
-import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.view.ActionMode;
@@ -87,18 +86,14 @@ public class ContactSelectionListFragment extends Fragment
private static final String TAG = ContactSelectionListFragment.class.getSimpleName();
public static final String MULTI_SELECT = "multi_select";
- public static final String REFRESHABLE = "refreshable";
- public static final String RECENTS = "recents";
public static final String SELECT_VERIFIED_EXTRA = "select_verified";
public static final String FROM_SHARE_ACTIVITY_EXTRA = "from_share_activity";
public static final String PRESELECTED_CONTACTS = "preselected_contacts";
private ApplicationDcContext dcContext;
- private TextView emptyText;
private Set selectedContacts;
private OnContactSelectedListener onContactSelectedListener;
- private SwipeRefreshLayout swipeRefresh;
private String cursorFilter;
private RecyclerView recyclerView;
private StickyHeaderDecoration listDecoration;
@@ -136,9 +131,7 @@ public class ContactSelectionListFragment extends Fragment
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.contact_selection_list_fragment, container, false);
- emptyText = ViewUtil.findById(view, android.R.id.empty);
recyclerView = ViewUtil.findById(view, R.id.recycler_view);
- swipeRefresh = ViewUtil.findById(view, R.id.swipe_refresh);
fastScroller = ViewUtil.findById(view, R.id.fast_scroller);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
actionModeCallback = new ActionMode.Callback() {
@@ -188,10 +181,6 @@ public class ContactSelectionListFragment extends Fragment
}
};
- // There shouldn't be the need to pull to refresh the contacts
- // swipeRefresh.setEnabled(getActivity().getIntent().getBooleanExtra(REFRESHABLE, true) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN);
- swipeRefresh.setEnabled(false);
-
return view;
}
@@ -309,11 +298,6 @@ public class ContactSelectionListFragment extends Fragment
public void resetQueryFilter() {
setQueryFilter(null);
- swipeRefresh.setRefreshing(false);
- }
-
- public void setRefreshing(boolean refreshing) {
- swipeRefresh.setRefreshing(refreshing);
}
public void reset() {
@@ -337,7 +321,6 @@ public class ContactSelectionListFragment extends Fragment
@Override
public void onLoadFinished(Loader loader, DcContactsLoader.Ret data) {
((ContactSelectionListAdapter) recyclerView.getAdapter()).changeData(data);
- emptyText.setText(R.string.contacts_empty_hint);
boolean useFastScroller = (recyclerView.getAdapter().getItemCount() > 20);
recyclerView.setVerticalScrollBarEnabled(!useFastScroller);
if (useFastScroller) {
@@ -451,10 +434,6 @@ public class ContactSelectionListFragment extends Fragment
this.onContactSelectedListener = onContactSelectedListener;
}
- public void setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener onRefreshListener) {
- this.swipeRefresh.setOnRefreshListener(onRefreshListener);
- }
-
public interface OnContactSelectedListener {
void onContactSelected(int specialId, String number);
void onContactDeselected(int specialId, String number);