mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-09-23 02:02:40 +01:00
refactor and improve contact selection
* unify single and multi contact selection activities * follow android listview design recommendations more closely * add contact photos to selection * change indicator for push to be more obvious * cache circle-cropped bitmaps * dedupe numbers when contact has multiple of same phone number // FREEBIE
This commit is contained in:
@@ -2,7 +2,9 @@ package org.thoughtcrime.securesms.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.push.PushServiceSocketFactory;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.whispersystems.textsecure.directory.Directory;
|
||||
@@ -19,6 +21,37 @@ import java.util.Set;
|
||||
public class DirectoryHelper {
|
||||
private static final String TAG = DirectoryHelper.class.getSimpleName();
|
||||
|
||||
public static void refreshDirectoryWithProgressDialog(final Context context) {
|
||||
refreshDirectoryWithProgressDialog(context, null);
|
||||
}
|
||||
|
||||
public static void refreshDirectoryWithProgressDialog(final Context context, final DirectoryUpdateFinishedListener listener) {
|
||||
if (!TextSecurePreferences.isPushRegistered(context)) {
|
||||
Toast.makeText(context.getApplicationContext(),
|
||||
context.getString(R.string.SingleContactSelectionActivity_you_are_not_registered_with_the_push_service),
|
||||
Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
|
||||
new ProgressDialogAsyncTask<Void,Void,Void>(context,
|
||||
R.string.SingleContactSelectionActivity_updating_directory,
|
||||
R.string.SingleContactSelectionActivity_updating_push_directory)
|
||||
{
|
||||
@Override
|
||||
protected Void doInBackground(Void... voids) {
|
||||
DirectoryHelper.refreshDirectory(context.getApplicationContext());
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void aVoid) {
|
||||
super.onPostExecute(aVoid);
|
||||
if (listener != null) listener.onUpdateFinished();
|
||||
}
|
||||
}.execute();
|
||||
|
||||
}
|
||||
|
||||
public static void refreshDirectory(final Context context) {
|
||||
refreshDirectory(context, PushServiceSocketFactory.create(context));
|
||||
}
|
||||
@@ -63,4 +96,8 @@ public class DirectoryHelper {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static interface DirectoryUpdateFinishedListener {
|
||||
public void onUpdateFinished();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user