mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-25 09:08:37 +00:00
Fix flickering emoji and periodic emoji vanishings
Fixes #3231 Closes #3233 // FREEBIE
This commit is contained in:
committed by
Moxie Marlinspike
parent
1251629997
commit
a3007c5906
@@ -21,10 +21,10 @@ import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Typeface;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Build.VERSION;
|
||||
import android.os.Build.VERSION_CODES;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.provider.Telephony;
|
||||
import android.support.annotation.Nullable;
|
||||
@@ -60,10 +60,11 @@ import ws.com.google.android.mms.pdu.CharacterSets;
|
||||
import ws.com.google.android.mms.pdu.EncodedStringValue;
|
||||
|
||||
public class Util {
|
||||
public static Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
public static String join(Collection<String> list, String delimiter) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
int i=0;
|
||||
int i = 0;
|
||||
|
||||
for (String item : list) {
|
||||
result.append(item);
|
||||
@@ -301,12 +302,21 @@ public class Util {
|
||||
return (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) || OutgoingLegacyMmsConnection.isConnectionPossible(context);
|
||||
}
|
||||
|
||||
public static boolean isMainThread() {
|
||||
return Looper.myLooper() == Looper.getMainLooper();
|
||||
}
|
||||
|
||||
public static void assertMainThread() {
|
||||
if (Looper.myLooper() != Looper.getMainLooper()) {
|
||||
if (!isMainThread()) {
|
||||
throw new AssertionError("Main-thread assertion failed.");
|
||||
}
|
||||
}
|
||||
|
||||
public static void runOnMain(Runnable runnable) {
|
||||
if (isMainThread()) runnable.run();
|
||||
else handler.post(runnable);
|
||||
}
|
||||
|
||||
public static boolean equals(@Nullable Object a, @Nullable Object b) {
|
||||
return a == b || (a != null && a.equals(b));
|
||||
}
|
||||
@@ -314,5 +324,4 @@ public class Util {
|
||||
public static int hashCode(@Nullable Object... objects) {
|
||||
return Arrays.hashCode(objects);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user