mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-26 09:08:43 +00:00
Move classes into library
This commit is contained in:
@@ -53,8 +53,8 @@ import org.thoughtcrime.securesms.mms.SlideDeck;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.service.SendReceiveService;
|
||||
import org.thoughtcrime.securesms.util.Emoji;
|
||||
import org.thoughtcrime.securesms.util.FutureTaskListener;
|
||||
import org.thoughtcrime.securesms.util.ListenableFutureTask;
|
||||
import org.whispersystems.textsecure.util.FutureTaskListener;
|
||||
import org.whispersystems.textsecure.util.ListenableFutureTask;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
|
||||
@@ -28,8 +28,8 @@ import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuInflater;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
import com.google.zxing.integration.android.IntentIntegrator;
|
||||
import com.google.zxing.integration.android.IntentResult;
|
||||
import org.whispersystems.textsecure.zxing.integration.IntentIntegrator;
|
||||
import org.whispersystems.textsecure.zxing.integration.IntentResult;
|
||||
|
||||
/**
|
||||
* Activity for initiating/receiving key QR code scans.
|
||||
|
||||
@@ -43,7 +43,7 @@ import org.thoughtcrime.securesms.recipients.RecipientFactory;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientFormattingException;
|
||||
import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
import org.thoughtcrime.securesms.util.LRUCache;
|
||||
import org.thoughtcrime.securesms.util.ListenableFutureTask;
|
||||
import org.whispersystems.textsecure.util.ListenableFutureTask;
|
||||
import org.thoughtcrime.securesms.util.Trimmer;
|
||||
import org.whispersystems.textsecure.util.Util;
|
||||
|
||||
|
||||
@@ -21,11 +21,10 @@ import android.text.SpannableString;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.database.MmsDatabase;
|
||||
import org.thoughtcrime.securesms.mms.Slide;
|
||||
import org.thoughtcrime.securesms.mms.SlideDeck;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
import org.thoughtcrime.securesms.util.ListenableFutureTask;
|
||||
import org.whispersystems.textsecure.util.ListenableFutureTask;
|
||||
|
||||
/**
|
||||
* Represents the message record model for MMS messages that contain
|
||||
|
||||
@@ -25,8 +25,8 @@ import android.util.Log;
|
||||
|
||||
import org.thoughtcrime.securesms.database.CanonicalAddressDatabase;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientProvider.RecipientDetails;
|
||||
import org.thoughtcrime.securesms.util.FutureTaskListener;
|
||||
import org.thoughtcrime.securesms.util.ListenableFutureTask;
|
||||
import org.whispersystems.textsecure.util.FutureTaskListener;
|
||||
import org.whispersystems.textsecure.util.ListenableFutureTask;
|
||||
import org.whispersystems.textsecure.storage.CanonicalRecipientAddress;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
@@ -28,7 +28,7 @@ import android.util.Log;
|
||||
|
||||
import org.thoughtcrime.securesms.contacts.ContactPhotoFactory;
|
||||
import org.thoughtcrime.securesms.util.LRUCache;
|
||||
import org.thoughtcrime.securesms.util.ListenableFutureTask;
|
||||
import org.whispersystems.textsecure.util.ListenableFutureTask;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
package org.thoughtcrime.securesms.util;
|
||||
|
||||
public interface FutureTaskListener<V> {
|
||||
public void onSuccess(V result);
|
||||
public void onFailure(Throwable error);
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package org.thoughtcrime.securesms.util;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.FutureTask;
|
||||
|
||||
public class ListenableFutureTask<V> extends FutureTask<V> {
|
||||
|
||||
// private WeakReference<FutureTaskListener<V>> listener;
|
||||
private FutureTaskListener<V> listener;
|
||||
|
||||
public ListenableFutureTask(Callable<V> callable, FutureTaskListener<V> listener) {
|
||||
super(callable);
|
||||
this.listener = listener;
|
||||
// if (listener == null) {
|
||||
// this.listener = null;
|
||||
// } else {
|
||||
// this.listener = new WeakReference<FutureTaskListener<V>>(listener);
|
||||
// }
|
||||
}
|
||||
|
||||
public synchronized void setListener(FutureTaskListener<V> listener) {
|
||||
// if (listener != null) this.listener = new WeakReference<FutureTaskListener<V>>(listener);
|
||||
// else this.listener = null;
|
||||
this.listener = listener;
|
||||
|
||||
if (this.isDone()) {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected synchronized void done() {
|
||||
callback();
|
||||
}
|
||||
|
||||
private void callback() {
|
||||
if (this.listener != null) {
|
||||
FutureTaskListener<V> nestedListener = this.listener;
|
||||
// FutureTaskListener<V> nestedListener = this.listener.get();
|
||||
if (nestedListener != null) {
|
||||
try {
|
||||
nestedListener.onSuccess(get());
|
||||
} catch (ExecutionException ee) {
|
||||
nestedListener.onFailure(ee);
|
||||
} catch (InterruptedException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user