Use precompute executer

This commit is contained in:
M66B 2020-02-10 14:16:48 +01:00
parent 24816f6d6b
commit fa43ffa082
2 changed files with 8 additions and 2 deletions

View File

@ -244,6 +244,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private static final ExecutorService executor =
Helper.getBackgroundExecutor(2, "differ");
private static final ExecutorService precompute =
Helper.getBackgroundExecutor(1, "precompute");
private static final int LARGE_MESSAGE_SIZE = 250 * 1024;
@ -1816,7 +1818,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
return PrecomputedTextCompat.getTextFuture(
builder,
TextViewCompat.getTextMetricsParams(tvBody),
executor)
precompute)
.get();
} catch (Throwable ex) {
Log.w(ex);

View File

@ -159,6 +159,7 @@ import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Properties;
import java.util.concurrent.ExecutorService;
import java.util.regex.Pattern;
import javax.activation.DataHandler;
@ -251,6 +252,9 @@ public class FragmentCompose extends FragmentBase {
private long[] pgpKeyIds;
private long pgpSignKeyId;
private static final ExecutorService precompute =
Helper.getBackgroundExecutor(1, "precompute");
static final int REDUCED_IMAGE_SIZE = 1440; // pixels
static final int REDUCED_IMAGE_QUALITY = 90; // percent
@ -4102,7 +4106,7 @@ public class FragmentCompose extends FragmentBase {
precomputed = PrecomputedTextCompat.getTextFuture(
spannedRef,
TextViewCompat.getTextMetricsParams(tvReference),
null)
precompute)
.get();
} catch (Throwable ex) {
Log.w(ex);