what-the-bank/sources/io/flutter/embedding/engine/systemchannels/SettingsChannel.java

81 lines
3.1 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package io.flutter.embedding.engine.systemchannels;
import io.flutter.Log;
import io.flutter.embedding.engine.dart.DartExecutor;
import io.flutter.plugin.common.BasicMessageChannel;
import io.flutter.plugin.common.JSONMessageCodec;
import java.util.HashMap;
import java.util.Map;
/* loaded from: classes.dex */
public class SettingsChannel {
private static final String ALWAYS_USE_24_HOUR_FORMAT = "alwaysUse24HourFormat";
private static final String BRIEFLY_SHOW_PASSWORD = "brieflyShowPassword";
public static final String CHANNEL_NAME = "flutter/settings";
private static final String NATIVE_SPELL_CHECK_SERVICE_DEFINED = "nativeSpellCheckServiceDefined";
private static final String PLATFORM_BRIGHTNESS = "platformBrightness";
private static final String TAG = "SettingsChannel";
private static final String TEXT_SCALE_FACTOR = "textScaleFactor";
public final BasicMessageChannel<Object> channel;
public SettingsChannel(DartExecutor dartExecutor) {
this.channel = new BasicMessageChannel<>(dartExecutor, CHANNEL_NAME, JSONMessageCodec.INSTANCE);
}
public MessageBuilder startMessage() {
return new MessageBuilder(this.channel);
}
/* loaded from: classes6.dex */
public static class MessageBuilder {
private final BasicMessageChannel<Object> channel;
private Map<String, Object> message = new HashMap();
MessageBuilder(BasicMessageChannel<Object> basicMessageChannel) {
this.channel = basicMessageChannel;
}
public MessageBuilder setTextScaleFactor(float f) {
this.message.put(SettingsChannel.TEXT_SCALE_FACTOR, Float.valueOf(f));
return this;
}
public MessageBuilder setNativeSpellCheckServiceDefined(boolean z) {
this.message.put(SettingsChannel.NATIVE_SPELL_CHECK_SERVICE_DEFINED, Boolean.valueOf(z));
return this;
}
public MessageBuilder setBrieflyShowPassword(boolean z) {
this.message.put(SettingsChannel.BRIEFLY_SHOW_PASSWORD, Boolean.valueOf(z));
return this;
}
public MessageBuilder setUse24HourFormat(boolean z) {
this.message.put(SettingsChannel.ALWAYS_USE_24_HOUR_FORMAT, Boolean.valueOf(z));
return this;
}
public MessageBuilder setPlatformBrightness(PlatformBrightness platformBrightness) {
this.message.put(SettingsChannel.PLATFORM_BRIGHTNESS, platformBrightness.name);
return this;
}
public void send() {
Log.v(SettingsChannel.TAG, "Sending message: \ntextScaleFactor: " + this.message.get(SettingsChannel.TEXT_SCALE_FACTOR) + "\nalwaysUse24HourFormat: " + this.message.get(SettingsChannel.ALWAYS_USE_24_HOUR_FORMAT) + "\nplatformBrightness: " + this.message.get(SettingsChannel.PLATFORM_BRIGHTNESS));
this.channel.send(this.message);
}
}
/* loaded from: classes6.dex */
public enum PlatformBrightness {
light("light"),
dark("dark");
public String name;
PlatformBrightness(String str) {
this.name = str;
}
}
}