正在查看: xDrip+ v04633772025.07.16 应用的 Preferences.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: xDrip+ v04633772025.07.16 应用的 Preferences.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.eveningoutpost.dexdrip.utils;
import android.R;
import android.app.Activity;
import android.app.AlertDialog;
import android.appwidget.AppWidgetManager;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.EditTextPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceCategory;
import android.preference.PreferenceFragment;
import android.preference.PreferenceGroup;
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;
import android.preference.RingtonePreference;
import android.text.TextUtils;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;
import androidx.core.app.ActivityCompat;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.bytehamster.lib.preferencesearch.SearchConfiguration;
import com.bytehamster.lib.preferencesearch.SearchPreferenceResult;
import com.bytehamster.lib.preferencesearch.SearchPreferenceResultListener;
import com.eveningoutpost.dexdrip.BasePreferenceActivity;
import com.eveningoutpost.dexdrip.EditAlertActivity;
import com.eveningoutpost.dexdrip.GcmActivity;
import com.eveningoutpost.dexdrip.NFCReaderX;
import com.eveningoutpost.dexdrip.WidgetUpdateService;
import com.eveningoutpost.dexdrip.alert.Registry;
import com.eveningoutpost.dexdrip.cgm.nsfollow.NightscoutFollow;
import com.eveningoutpost.dexdrip.cgm.webfollow.Cpref;
import com.eveningoutpost.dexdrip.cloud.jamcm.Pusher;
import com.eveningoutpost.dexdrip.healthconnect.HealthConnectEntry;
import com.eveningoutpost.dexdrip.healthconnect.HealthGamut;
import com.eveningoutpost.dexdrip.insulin.inpen.InPenEntry;
import com.eveningoutpost.dexdrip.models.DesertSync;
import com.eveningoutpost.dexdrip.models.JoH;
import com.eveningoutpost.dexdrip.models.Profile;
import com.eveningoutpost.dexdrip.models.UserError;
import com.eveningoutpost.dexdrip.profileeditor.ProfileEditor;
import com.eveningoutpost.dexdrip.receiver.InfoContentProvider;
import com.eveningoutpost.dexdrip.services.ActivityRecognizedService;
import com.eveningoutpost.dexdrip.services.G5BaseService;
import com.eveningoutpost.dexdrip.services.PlusSyncService;
import com.eveningoutpost.dexdrip.services.UiBasedCollector;
import com.eveningoutpost.dexdrip.services.broadcastservice.BroadcastService;
import com.eveningoutpost.dexdrip.tidepool.AuthFlowOut;
import com.eveningoutpost.dexdrip.tidepool.TidepoolUploader;
import com.eveningoutpost.dexdrip.ui.LockScreenWallPaper;
import com.eveningoutpost.dexdrip.ui.dialog.GenericConfirmDialog;
import com.eveningoutpost.dexdrip.utilitymodels.BgGraphBuilder;
import com.eveningoutpost.dexdrip.utilitymodels.CollectionServiceStarter;
import com.eveningoutpost.dexdrip.utilitymodels.Inevitable;
import com.eveningoutpost.dexdrip.utilitymodels.Pref;
import com.eveningoutpost.dexdrip.utilitymodels.SpeechUtil;
import com.eveningoutpost.dexdrip.utilitymodels.UpdateActivity;
import com.eveningoutpost.dexdrip.utilitymodels.WholeHouse;
import com.eveningoutpost.dexdrip.utilitymodels.pebble.PebbleWatchSync;
import com.eveningoutpost.dexdrip.utilitymodels.pebble.watchface.InstallPebbleClassicTrendWatchface;
import com.eveningoutpost.dexdrip.utilitymodels.pebble.watchface.InstallPebbleSnoozeControlApp;
import com.eveningoutpost.dexdrip.utilitymodels.pebble.watchface.InstallPebbleTrendClayWatchFace;
import com.eveningoutpost.dexdrip.utilitymodels.pebble.watchface.InstallPebbleTrendWatchFace;
import com.eveningoutpost.dexdrip.utilitymodels.pebble.watchface.InstallPebbleWatchFace;
import com.eveningoutpost.dexdrip.utils.Preferences;
import com.eveningoutpost.dexdrip.utils.framework.IncomingCallsReceiver;
import com.eveningoutpost.dexdrip.watch.lefun.LeFunEntry;
import com.eveningoutpost.dexdrip.watch.miband.MiBand;
import com.eveningoutpost.dexdrip.watch.miband.MiBandEntry;
import com.eveningoutpost.dexdrip.watch.miband.MiBandService;
import com.eveningoutpost.dexdrip.watch.thinjam.BlueJay;
import com.eveningoutpost.dexdrip.watch.thinjam.BlueJayEntry;
import com.eveningoutpost.dexdrip.wearintegration.WatchUpdaterService;
import com.eveningoutpost.dexdrip.webservices.XdripWebService;
import com.eveningoutpost.dexdrip.xDripWidget;
import com.eveningoutpost.dexdrip.xdrip;
import com.google.zxing.BinaryBitmap;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.NotFoundException;
import com.google.zxing.RGBLuminanceSource;
import com.google.zxing.Result;
import com.google.zxing.common.HybridBinarizer;
import com.google.zxing.integration.android.IntentIntegrator;
import com.google.zxing.integration.android.IntentResult;
import com.nightscout.core.barcode.NSBarcodeConfig;
import java.io.FileNotFoundException;
import java.lang.reflect.Method;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import net.tribe7.common.base.Joiner;
public class Preferences extends BasePreferenceActivity implements SearchPreferenceResultListener {
private static Preference force_english;
private static ListPreference locale_choice;
private static Preference nfc_expiry_days;
private static AllPrefsFragment pFragment;
private static Preference profile_carb_ratio_default;
private static Preference profile_insulin_sensitivity_default;
private static byte[] staticKey;
private static String static_units;
private static Preference units_pref;
private BroadcastReceiver mibandStatusReceiver;
private volatile AllPrefsFragment preferenceFragment;
private static Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
String obj2 = obj.toString();
if (preference instanceof ListPreference) {
ListPreference listPreference = (ListPreference) preference;
int findIndexOfValue = listPreference.findIndexOfValue(obj2);
preference.setSummary(findIndexOfValue >= 0 ? listPreference.getEntries()[findIndexOfValue] : null);
return true;
}
if (preference instanceof RingtonePreference) {
if (TextUtils.isEmpty(obj2)) {
preference.setSummary(2131756103);
return true;
}
Ringtone ringtone = RingtoneManager.getRingtone(preference.getContext(), Uri.parse(obj2));
if (ringtone == null) {
preference.setSummary((CharSequence) null);
return true;
}
preference.setSummary(ringtone.getTitle(preference.getContext()));
return true;
}
preference.setSummary(obj2);
return true;
}
};
private static Preference.OnPreferenceChangeListener sBindNumericPreferenceSummaryToValueListener = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
String obj2 = obj.toString();
if (!Preferences.isNumeric(obj2)) {
return false;
}
preference.setSummary(obj2);
return true;
}
};
private static Preference.OnPreferenceChangeListener sBindNumericUnitizedPreferenceSummaryToValueListener = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
String obj2 = obj.toString();
if (Preferences.isNumeric(obj2)) {
boolean equals = Pref.getString("units", "mgdl").equals("mgdl");
double d = JoH.tolerantParseDouble(obj2);
if (!equals) {
d *= 18.0182d;
}
if (d <= 400.0d && d >= 40.0d) {
StringBuilder sb = new StringBuilder();
sb.append(obj2);
sb.append(" ");
sb.append(equals ? "mg/dl" : "mmol/l");
preference.setSummary(sb.toString());
return true;
}
JoH.static_toast_long(xdrip.gs(2131756610, EditAlertActivity.unitsConvert2Disp(equals, 40.0d), EditAlertActivity.unitsConvert2Disp(equals, 400.0d)));
}
return false;
}
};
private static Preference.OnPreferenceChangeListener sBindPreferenceTitleAppendToValueListenerUpdateChannel = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
boolean contains = preference.getTitle().toString().contains("(");
preference.setTitle(preference.getTitle().toString().replaceAll(" \\([a-z0-9A-Z]+\\)$", "") + " (" + obj.toString() + ")");
if (!contains) {
return true;
}
preference.getEditor().putString(preference.getKey(), obj.toString()).apply();
UpdateActivity.last_check_time = -2L;
UpdateActivity.checkForAnUpdate(preference.getContext());
return true;
}
};
private static Preference.OnPreferenceChangeListener sBindPreferenceTitleAppendToIntegerValueListener = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
boolean contains = preference.getTitle().toString().contains("(");
preference.setTitle(preference.getTitle().toString().replaceAll(" \\([a-z0-9A-Z]+\\)$", "") + " (" + obj.toString() + ")");
if (!contains) {
return true;
}
preference.getEditor().putInt(preference.getKey(), ((Integer) obj).intValue()).apply();
return true;
}
};
private static Preference.OnPreferenceChangeListener sBindPreferenceTitleAppendToStringValueListener = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
boolean contains = preference.getTitle().toString().contains("(");
preference.setTitle(preference.getTitle().toString().replaceAll(" \\([a-z0-9A-Z.]+\\)$", "") + " (" + obj.toString() + ")");
if (!contains) {
return true;
}
preference.getEditor().putString(preference.getKey(), (String) obj).apply();
return true;
}
};
private static Preference.OnPreferenceChangeListener sBindPreferenceTitleAppendToMacValueListener = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
boolean contains = preference.getTitle().toString().contains("(");
String replaceAll = preference.getTitle().toString().replaceAll(" \\([a-z0-9A-Z.:]+\\)$", "");
if (!obj.toString().isEmpty()) {
replaceAll = replaceAll + " (" + obj.toString() + ")";
}
preference.setTitle(replaceAll);
if (!contains) {
return true;
}
preference.getEditor().putString(preference.getKey(), (String) obj).apply();
return true;
}
};
private volatile String scanFormat = null;
private volatile String scanContents = null;
private volatile byte[] scanRawBytes = null;
private final SharedPreferences.OnSharedPreferenceChangeListener uiPrefListener = UiBasedCollector.getListener(this);
private final SharedPreferences.OnSharedPreferenceChangeListener xDripCloudListener = new SharedPreferences.OnSharedPreferenceChangeListener() {
@Override
public final void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String str) {
Preferences.lambda$new$1(sharedPreferences, str);
}
};
public interface OnServiceTaskCompleted {
void onTaskCompleted(byte[] bArr);
}
public void refreshFragments() {
refreshFragments(null);
}
private void refreshFragments(String str) {
this.preferenceFragment = new AllPrefsFragment(str);
this.preferenceFragment.setParent(this);
pFragment = this.preferenceFragment;
getFragmentManager().beginTransaction().replace(R.id.content, this.preferenceFragment).commit();
}
public static List<String> getAllPreferenceKeys(PreferenceGroup preferenceGroup) {
List<Preference> allPreferences = getAllPreferences(preferenceGroup);
ArrayList arrayList = new ArrayList(allPreferences.size());
Iterator<Preference> it = allPreferences.iterator();
while (it.hasNext()) {
arrayList.add(it.next().getKey());
}
return arrayList;
}
public static List<Preference> getAllPreferences(PreferenceGroup preferenceGroup) {
int preferenceCount = preferenceGroup.getPreferenceCount();
ArrayList arrayList = new ArrayList(preferenceCount);
for (int i = 0; i < preferenceCount; i++) {
Preference preference = preferenceGroup.getPreference(i);
arrayList.add(preference);
if (preference instanceof PreferenceGroup) {
arrayList.addAll(getAllPreferences((PreferenceGroup) preference));
}
}
return arrayList;
}
@Override
public void onSearchResultClicked(SearchPreferenceResult searchPreferenceResult) {
try {
searchPreferenceResult.closeSearchPage(this);
searchPreferenceResult.highlight(this.preferenceFragment, -256);
} catch (RuntimeException e) {
UserError.Log.wtf("jamorham PREFS", "Got error trying to highlight search results: " + e);
JoH.static_toast_long("" + e);
}
}
public class ServiceCallback implements OnServiceTaskCompleted {
public ServiceCallback() {
}
@Override
public void onTaskCompleted(byte[] bArr) {
if (bArr.length > 0) {
if (Preferences.staticKey == null || Preferences.staticKey.length != 16) {
Preferences.this.toast("Error processing security key");
return;
}
byte[] decompressBytesToBytes = JoH.decompressBytesToBytes(CipherUtils.decryptBytes(bArr, Preferences.staticKey));
byte[] unused = Preferences.staticKey = null;
UserError.Log.d("jamorham PREFS", "Plain bytes size: " + decompressBytesToBytes.length);
if (decompressBytesToBytes.length <= 0) {
Preferences.this.toast("Error processing data - empty");
return;
} else {
SdcardImportExport.storePreferencesFromBytes(decompressBytesToBytes, Preferences.this.getApplicationContext());
return;
}
}
Preferences.this.toast("Error processing settings - no data - try again?");
}
}
public void toast(final String str) {
try {
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(Preferences.this.getApplicationContext(), str, 0).show();
}
});
Log.d("jamorham PREFS", "Toast msg: " + str);
} catch (Exception unused) {
Log.e("jamorham PREFS", "Couldn't display toast: " + str);
}
}
private void installxDripPlusPreferencesFromQRCode(final SharedPreferences sharedPreferences, String str) {
UserError.Log.d("jamorham PREFS", "installing preferences from QRcode");
try {
final Map<String, String> decodeString = QRcodeUtils.decodeString(str);
if (decodeString != null) {
if (decodeString.containsKey(getString(2131755125))) {
if (decodeString.containsKey(getString(2131757050)) && decodeString.containsKey(getString(2131757051))) {
staticKey = CipherUtils.hexToBytes(decodeString.get(getString(2131757050)));
new WebAppHelper(new ServiceCallback()).executeOnExecutor(xdrip.executor, getString(2131757053) + "/joh-getsw/" + decodeString.get(getString(2131757051)));
return;
}
UserError.Log.d("jamorham PREFS", "Incorrectly formatted wizard pref");
return;
}
GenericConfirmDialog.show(this, xdrip.gs(2131755152), getString(2131755677) + getMapKeysString(decodeString), new Runnable() {
@Override
public final void run() {
Preferences.this.lambda$installxDripPlusPreferencesFromQRCode$0(sharedPreferences, decodeString);
}
});
return;
}
Log.e("jamorham PREFS", "Got null prefsmap during decode");
} catch (Exception unused) {
UserError.Log.e("jamorham PREFS", "Got exception installing preferences");
}
}
public void lambda$installxDripPlusPreferencesFromQRCode$0(SharedPreferences sharedPreferences, Map map) {
SharedPreferences.Editor edit = sharedPreferences.edit();
int i = 0;
for (Map.Entry entry : map.entrySet()) {
String str = (String) entry.getKey();
String str2 = (String) entry.getValue();
if (str2.equals("true") || str2.equals("false")) {
edit.putBoolean(str, Boolean.parseBoolean(str2));
} else if (!str2.equals("null")) {
edit.putString(str, str2);
}
i++;
}
edit.apply();
refreshFragments();
UserError.ExtraLogTags.readPreference(Pref.getStringDefaultBlank("extra_tags_for_logging"));
Toast.makeText(getApplicationContext(), "Loaded " + Integer.toString(i) + " preferences from QR code", 1).show();
PlusSyncService.clearandRestartSyncService(getApplicationContext());
DesertSync.settingsChanged();
InfoContentProvider.ping("pref");
if (sharedPreferences.getString("dex_collection_method", "").equals("Follower")) {
PlusSyncService.clearandRestartSyncService(getApplicationContext());
GcmActivity.last_sync_request = 0L;
GcmActivity.requestBGsync();
}
}
public static String getMapKeysString(Map<String, ?> map) {
StringBuilder sb = new StringBuilder();
ArrayList arrayList = new ArrayList(map.keySet());
Collections.sort(arrayList);
Iterator it = arrayList.iterator();
while (it.hasNext()) {
sb.append((String) it.next());
sb.append("\n");
}
return sb.toString();
}
public static Boolean getBooleanPreferenceViaContextWithoutException(Context context, String str, Boolean bool) {
try {
return Boolean.valueOf(PreferenceManager.getDefaultSharedPreferences(context).getBoolean(str, bool.booleanValue()));
} catch (ClassCastException unused) {
return bool;
}
}
@Override
protected synchronized void onActivityResult(int i, int i2, Intent intent) {
this.scanFormat = null;
this.scanContents = null;
this.scanRawBytes = null;
if (i == 2002 && HealthConnectEntry.enabled() && Build.VERSION.SDK_INT >= 26 && JoH.ratelimit("health-connect-bump", 2)) {
HealthGamut.init(this);
}
if (i == 49375) {
if (intent != null && intent.getData() != null) {
Uri data = intent.getData();
try {
Bitmap decodeStream = BitmapFactory.decodeStream(getContentResolver().openInputStream(data));
if (decodeStream == null) {
UserError.Log.e("TAG", "uri is not a bitmap," + data.toString());
return;
}
int width = decodeStream.getWidth();
int height = decodeStream.getHeight();
int[] iArr = new int[width * height];
decodeStream.getPixels(iArr, 0, width, 0, 0, width, height);
decodeStream.recycle();
try {
Result decode = new MultiFormatReader().decode(new BinaryBitmap(new HybridBinarizer(new RGBLuminanceSource(width, height, iArr))));
this.scanFormat = decode.getBarcodeFormat().toString();
this.scanContents = decode.getText();
this.scanRawBytes = decode.getRawBytes();
} catch (NotFoundException e) {
UserError.Log.e("TAG", "decode exception", e);
}
} catch (FileNotFoundException e2) {
UserError.Log.e("TAG", "can not open file" + data.toString(), e2);
}
}
UserError.Log.e("TAG", "No file was selected");
return;
}
if (i == 49374) {
IntentResult parseActivityResult = IntentIntegrator.parseActivityResult(i, i2, intent);
this.scanFormat = parseActivityResult.getFormatName();
this.scanContents = parseActivityResult.getContents();
this.scanRawBytes = parseActivityResult.getRawBytes();
}
SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
if (this.scanContents == null) {
UserError.Log.d("jamorham PREFS", "No scan results ");
return;
}
if (this.scanFormat.equals("QR_CODE")) {
if (QRcodeUtils.hasDecoderMarker(this.scanContents)) {
installxDripPlusPreferencesFromQRCode(defaultSharedPreferences, this.scanContents);
return;
}
try {
if (BlueJay.processQRCode(this.scanRawBytes)) {
refreshFragments();
return;
}
} catch (Exception unused) {
}
NSBarcodeConfig nSBarcodeConfig = new NSBarcodeConfig(this.scanContents);
if (nSBarcodeConfig.hasMongoConfig()) {
if (nSBarcodeConfig.getMongoUri().isPresent()) {
SharedPreferences.Editor edit = defaultSharedPreferences.edit();
edit.putString("cloud_storage_mongodb_uri", (String) nSBarcodeConfig.getMongoUri().get());
edit.putString("cloud_storage_mongodb_collection", (String) nSBarcodeConfig.getMongoCollection().or("entries"));
edit.putString("cloud_storage_mongodb_device_status_collection", (String) nSBarcodeConfig.getMongoDeviceStatusCollection().or("devicestatus"));
edit.putBoolean("cloud_storage_mongodb_enable", true);
edit.apply();
}
if (nSBarcodeConfig.hasApiConfig()) {
SharedPreferences.Editor edit2 = defaultSharedPreferences.edit();
edit2.putBoolean("cloud_storage_api_enable", true);
edit2.putString("cloud_storage_api_base", Joiner.on(' ').join(nSBarcodeConfig.getApiUris()));
edit2.apply();
} else {
defaultSharedPreferences.edit().putBoolean("cloud_storage_api_enable", false).apply();
}
}
if (nSBarcodeConfig.hasApiConfig()) {
SharedPreferences.Editor edit3 = defaultSharedPreferences.edit();
edit3.putBoolean("cloud_storage_api_enable", true);
edit3.putString("cloud_storage_api_base", Joiner.on(' ').join(nSBarcodeConfig.getApiUris()));
edit3.apply();
} else {
defaultSharedPreferences.edit().putBoolean("cloud_storage_api_enable", false).apply();
}
if (nSBarcodeConfig.hasMqttConfig()) {
if (nSBarcodeConfig.getMqttUri().isPresent()) {
URI create = URI.create((String) nSBarcodeConfig.getMqttUri().or(""));
if (create.getUserInfo() != null) {
String[] split = create.getUserInfo().split(":");
if (split.length == 2) {
String str = create.getScheme() + "://" + create.getHost() + ":" + create.getPort();
if (split[0].length() > 0 && split[1].length() > 0) {
SharedPreferences.Editor edit4 = defaultSharedPreferences.edit();
edit4.putString("cloud_storage_mqtt_endpoint", str);
edit4.putString("cloud_storage_mqtt_user", split[0]);
edit4.putString("cloud_storage_mqtt_password", split[1]);
edit4.putBoolean("cloud_storage_mqtt_enable", true);
edit4.apply();
}
}
}
}
} else {
SharedPreferences.Editor edit5 = defaultSharedPreferences.edit();
edit5.putBoolean("cloud_storage_mqtt_enable", false);
edit5.apply();
}
} else if (this.scanFormat.equals("CODE_128")) {
UserError.Log.d("jamorham PREFS", "Setting serial number to: " + this.scanContents);
defaultSharedPreferences.edit().putString("share_key", this.scanContents).apply();
}
refreshFragments();
}
@Override
public void onCreate(Bundle bundle) {
try {
setTheme(2131820787);
} catch (Exception unused) {
UserError.Log.e("jamorham PREFS", "Failed to set theme");
}
super.onCreate(bundle);
refreshFragments(getIntent() != null ? getIntent().getAction() : null);
processExtraData();
try {
PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this.preferenceFragment.lockListener.prefListener);
} catch (Exception e) {
StringBuilder sb = new StringBuilder();
sb.append("Got exception registering lockListener: ");
sb.append(e);
sb.append(" ");
sb.append(this.preferenceFragment.lockListener == null);
UserError.Log.e("jamorham PREFS", sb.toString());
}
this.mibandStatusReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
int i = AnonymousClass12.$SwitchMap$com$eveningoutpost$dexdrip$watch$miband$MiBandService$MIBAND_INTEND_STATES[MiBandService.MIBAND_INTEND_STATES.valueOf(intent.getStringExtra("state")).ordinal()];
if (i == 1) {
Preferences.this.preferenceFragment.updateMiBandScreen();
} else {
if (i != 2) {
return;
}
Preferences.this.preferenceFragment.updateMibandPreferencesData();
}
}
};
UiBasedCollector.onEnableCheckPermission(this);
}
static class AnonymousClass12 {
static final int[] $SwitchMap$com$eveningoutpost$dexdrip$watch$miband$MiBandService$MIBAND_INTEND_STATES;
static {
int[] iArr = new int[MiBandService.MIBAND_INTEND_STATES.values().length];
$SwitchMap$com$eveningoutpost$dexdrip$watch$miband$MiBandService$MIBAND_INTEND_STATES = iArr;
try {
iArr[MiBandService.MIBAND_INTEND_STATES.UPDATE_PREF_SCREEN.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$com$eveningoutpost$dexdrip$watch$miband$MiBandService$MIBAND_INTEND_STATES[MiBandService.MIBAND_INTEND_STATES.UPDATE_PREF_DATA.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
}
}
@Override
public void onStop() {
super.onStop();
try {
PreferenceManager.getDefaultSharedPreferences(this).getBoolean("engineering_mode", false);
} catch (Exception unused) {
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
if (Build.VERSION.SDK_INT >= 26) {
getMenuInflater().inflate(2131558411, menu);
}
return super.onCreateOptionsMenu(menu);
}
public void showSearch(MenuItem menuItem) {
if (JoH.ratelimit("preference-search-button", 1)) {
this.preferenceFragment.showSearchFragment();
}
}
public static void lambda$new$1(SharedPreferences sharedPreferences, String str) {
if (str == null || !str.equals("use_xdrip_cloud_sync")) {
return;
}
Pusher.requestReconnect();
CollectionServiceStarter.restartCollectionServiceBackground();
}
@Override
protected void onResume() {
super.onResume();
PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(ActivityRecognizedService.prefListener);
if (DexCollectionType.hasBluetooth() && !WholeHouse.isRpi()) {
LocationHelper.requestLocationForBluetooth(this);
}
PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(LeFunEntry.prefListener);
PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(Cpref.prefListener);
PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(MiBandEntry.prefListener);
PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(BroadcastService.prefListener);
PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(BlueJayEntry.prefListener);
PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this.uiPrefListener);
PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(Registry.prefListener);
PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this.xDripCloudListener);
LocalBroadcastManager.getInstance(this).registerReceiver(this.mibandStatusReceiver, new IntentFilter("com.eveningoutpost.dexdrip.utils.PROGRESS"));
}
@Override
protected void onPause() {
PreferenceManager.getDefaultSharedPreferences(this).unregisterOnSharedPreferenceChangeListener(ActivityRecognizedService.prefListener);
PreferenceManager.getDefaultSharedPreferences(this).unregisterOnSharedPreferenceChangeListener(LeFunEntry.prefListener);
PreferenceManager.getDefaultSharedPreferences(this).unregisterOnSharedPreferenceChangeListener(Cpref.prefListener);
PreferenceManager.getDefaultSharedPreferences(this).unregisterOnSharedPreferenceChangeListener(MiBandEntry.prefListener);
PreferenceManager.getDefaultSharedPreferences(this).unregisterOnSharedPreferenceChangeListener(BroadcastService.prefListener);
PreferenceManager.getDefaultSharedPreferences(this).unregisterOnSharedPreferenceChangeListener(BlueJayEntry.prefListener);
PreferenceManager.getDefaultSharedPreferences(this).unregisterOnSharedPreferenceChangeListener(this.uiPrefListener);
PreferenceManager.getDefaultSharedPreferences(this).unregisterOnSharedPreferenceChangeListener(Registry.prefListener);
PreferenceManager.getDefaultSharedPreferences(this).unregisterOnSharedPreferenceChangeListener(this.xDripCloudListener);
LocalBroadcastManager.getInstance(this).unregisterReceiver(this.mibandStatusReceiver);
pFragment = null;
super.onPause();
}
@Override
protected void onDestroy() {
try {
PreferenceManager.getDefaultSharedPreferences(this).unregisterOnSharedPreferenceChangeListener(this.preferenceFragment.lockListener.prefListener);
} catch (Exception unused) {
}
super.onDestroy();
}
@Override
protected void onPostCreate(Bundle bundle) {
super.onPostCreate(bundle);
}
@Override
protected boolean isValidFragment(String str) {
return AllPrefsFragment.class.getName().equals(str);
}
@Override
public boolean onIsMultiPane() {
return isXLargeTablet(this);
}
private static boolean isXLargeTablet(Context context) {
return (context.getResources().getConfiguration().screenLayout & 15) >= 4;
}
@Override
public void onBuildHeaders(List<PreferenceActivity.Header> list) {
loadHeadersFromResource(2131951625, list);
}
@Override
public void onNewIntent(Intent intent) {
if (intent.getAction() != null) {
try {
refreshFragments(getIntent() != null ? getIntent().getAction() : null);
} catch (Exception unused) {
}
}
setIntent(intent);
if (processExtraData()) {
return;
}
super.onNewIntent(intent);
}
private boolean processExtraData() {
Bundle extras;
Intent intent = getIntent();
if (intent == null || (extras = intent.getExtras()) == null || extras.getString("refresh") == null) {
return false;
}
refreshProfileRatios();
return true;
}
public static void refreshProfileRatios() {
Preference preference = profile_carb_ratio_default;
preference.setTitle(format_carb_ratio(preference.getTitle().toString(), ProfileEditor.minMaxCarbs(ProfileEditor.loadData(false))));
Preference preference2 = profile_insulin_sensitivity_default;
preference2.setTitle(format_insulin_sensitivity(preference2.getTitle().toString(), ProfileEditor.minMaxSens(ProfileEditor.loadData(false))));
}
public static void restartPebble() {
xdrip.getAppContext().startService(new Intent(xdrip.getAppContext(), (Class<?>) PebbleWatchSync.class));
}
private static String format_carb_ratio(String str, String str2) {
return str.replaceAll(" \\(.*\\)$", "") + " (" + str2 + "g per Unit)";
}
public static String format_carb_absorption_rate(String str, String str2) {
return str.replaceAll(" \\(.*\\)$", "") + " (" + str2 + "g per hour)";
}
private static String format_insulin_sensitivity(String str, String str2) {
try {
return str.replaceAll(" \\(.*\\)$", "") + " (" + str2 + " " + static_units + " per U)";
} catch (Exception unused) {
return "ERROR - Invalid number";
}
}
public static void bindPreferenceSummaryToValue(Preference preference) {
try {
preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);
sBindPreferenceSummaryToValueListener.onPreferenceChange(preference, PreferenceManager.getDefaultSharedPreferences(preference.getContext()).getString(preference.getKey(), ""));
} catch (Exception e) {
UserError.Log.e("jamorham PREFS", "Got exception binding preference summary: " + e.toString());
}
}
public static void bindPreferenceTitleAppendToValueUpdateChannel(Preference preference) {
try {
preference.setOnPreferenceChangeListener(sBindPreferenceTitleAppendToValueListenerUpdateChannel);
sBindPreferenceTitleAppendToValueListenerUpdateChannel.onPreferenceChange(preference, PreferenceManager.getDefaultSharedPreferences(preference.getContext()).getString(preference.getKey(), ""));
} catch (Exception e) {
UserError.Log.e("jamorham PREFS", "Got exception binding preference title: " + e.toString());
}
}
public static void bindPreferenceTitleAppendToStringValue(Preference preference) {
try {
preference.setOnPreferenceChangeListener(sBindPreferenceTitleAppendToStringValueListener);
sBindPreferenceTitleAppendToStringValueListener.onPreferenceChange(preference, PreferenceManager.getDefaultSharedPreferences(preference.getContext()).getString(preference.getKey(), ""));
} catch (Exception e) {
UserError.Log.e("jamorham PREFS", "Got exception binding preference title: " + e.toString());
}
}
public static void bindPreferenceTitleAppendToMacValue(Preference preference) {
try {
preference.setOnPreferenceChangeListener(sBindPreferenceTitleAppendToMacValueListener);
sBindPreferenceTitleAppendToMacValueListener.onPreferenceChange(preference, PreferenceManager.getDefaultSharedPreferences(preference.getContext()).getString(preference.getKey(), ""));
} catch (Exception e) {
UserError.Log.e("jamorham PREFS", "Got exception binding preference title: " + e.toString());
}
}
public static void bindPreferenceTitleAppendToIntegerValueFromLogSlider(Preference preference, final NamedSliderProcessor namedSliderProcessor, final String str, final boolean z) {
Preference.OnPreferenceChangeListener onPreferenceChangeListener = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference2, Object obj) {
boolean contains = preference2.getTitle().toString().contains("(");
Integer num = (Integer) obj;
int interpolate = NamedSliderProcessor.this.interpolate(str, num.intValue());
StringBuilder sb = new StringBuilder();
sb.append(preference2.getTitle().toString().replaceAll(" \\([a-z0-9A-Z \\.]+\\)$", ""));
sb.append(" (");
sb.append(z ? BgGraphBuilder.unitized_string_static_no_interpretation_short(interpolate) : Integer.valueOf(interpolate));
sb.append(")");
preference2.setTitle(sb.toString());
if (!contains) {
return true;
}
preference2.getEditor().putInt(preference2.getKey(), num.intValue()).apply();
return true;
}
};
try {
preference.setOnPreferenceChangeListener(onPreferenceChangeListener);
onPreferenceChangeListener.onPreferenceChange(preference, Integer.valueOf(PreferenceManager.getDefaultSharedPreferences(preference.getContext()).getInt(preference.getKey(), 0)));
} catch (Exception e) {
UserError.Log.e("jamorham PREFS", "Got exception binding preference title: " + e.toString());
}
}
public static void bindPreferenceSummaryAppendToIntegerValueFromLogSlider(Preference preference, final NamedSliderProcessor namedSliderProcessor, final String str, final boolean z) {
Preference.OnPreferenceChangeListener onPreferenceChangeListener = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference2, Object obj) {
boolean contains = preference2.getSummary().toString().contains("(");
Integer num = (Integer) obj;
int interpolate = NamedSliderProcessor.this.interpolate(str, num.intValue());
StringBuilder sb = new StringBuilder();
sb.append(preference2.getSummary().toString().replaceAll(" \\([a-z0-9A-Z \\.]+\\)$", ""));
sb.append(" (");
sb.append(z ? BgGraphBuilder.unitized_string_static_no_interpretation_short(interpolate) : Integer.valueOf(interpolate));
sb.append(")");
preference2.setSummary(sb.toString());
if (!contains) {
return true;
}
preference2.getEditor().putInt(preference2.getKey(), num.intValue()).apply();
return true;
}
};
try {
preference.setOnPreferenceChangeListener(onPreferenceChangeListener);
onPreferenceChangeListener.onPreferenceChange(preference, Integer.valueOf(PreferenceManager.getDefaultSharedPreferences(preference.getContext()).getInt(preference.getKey(), 0)));
} catch (Exception e) {
UserError.Log.e("jamorham PREFS", "Got exception binding preference summary: " + e.toString());
}
}
public static void bindPreferenceSummaryToValueAndEnsureNumeric(Preference preference) {
preference.setOnPreferenceChangeListener(sBindNumericPreferenceSummaryToValueListener);
sBindPreferenceSummaryToValueListener.onPreferenceChange(preference, PreferenceManager.getDefaultSharedPreferences(preference.getContext()).getString(preference.getKey(), ""));
}
public static void bindPreferenceSummaryToUnitizedValueAndEnsureNumeric(Preference preference) {
preference.setOnPreferenceChangeListener(sBindNumericUnitizedPreferenceSummaryToValueListener);
sBindNumericUnitizedPreferenceSummaryToValueListener.onPreferenceChange(preference, PreferenceManager.getDefaultSharedPreferences(preference.getContext()).getString(preference.getKey(), ""));
}
public static void applyPrefSettingRange(String str, String str2, Double d, Double d2) {
StringBuilder sb;
StringBuilder sb2;
String string = Pref.getString(str, str2);
boolean equals = Pref.getString("units", "mgdl").equals("mgdl");
double d3 = JoH.tolerantParseDouble(string);
if (!equals) {
d3 *= 18.0182d;
}
if (d3 <= d2.doubleValue()) {
if (d3 < d.doubleValue()) {
if (equals) {
sb = new StringBuilder();
sb.append(d);
} else {
sb = new StringBuilder();
sb.append(JoH.qs(d.doubleValue() * 0.0554994394556615d, 1));
}
sb.append("");
Pref.setString(str, sb.toString());
UserError.Log.uel("jamorham PREFS", xdrip.gs(2131756139, str));
JoH.showNotification(str, xdrip.gs(2131756308), null, 2004, null, false, false, null, null, null, true);
return;
}
return;
}
if (!equals && string.equals(str2)) {
UserError.Log.d("jamorham PREFS", "Setting " + str + " to default converted to mmol/L");
Pref.setString(str, JoH.qs(JoH.tolerantParseDouble(str2) * 0.0554994394556615d, 1));
return;
}
if (equals) {
sb2 = new StringBuilder();
sb2.append(d2);
} else {
sb2 = new StringBuilder();
sb2.append(JoH.qs(d2.doubleValue() * 0.0554994394556615d, 1));
}
sb2.append("");
Pref.setString(str, sb2.toString());
UserError.Log.uel("jamorham PREFS", xdrip.gs(2131756138, str));
JoH.showNotification(str, xdrip.gs(2131756307), null, 2004, null, false, false, null, null, null, true);
}
public static class AllPrefsFragment extends PreferenceFragment {
private static int pebbleType = 1;
final String jumpTo;
public LockScreenWallPaper.PrefListener lockListener;
private Preference miband2_screen;
private Preference miband3_4_screen;
private Preference miband_authkey;
private Preference miband_graph_category;
private Preference miband_nightmode_category;
private Preference miband_nightmode_interval;
private Preference miband_send_readings_as_notification;
Preferences parent;
SharedPreferences prefs;
SearchConfiguration searchConfiguration;
private void removeLegacyPreferences() {
}
public AllPrefsFragment(String str) {
this.lockListener = new LockScreenWallPaper.PrefListener();
this.jumpTo = str;
}
public void setParent(Preferences preferences) {
this.parent = preferences;
}
public AllPrefsFragment() {
this(null);
}
public void setSummary(String str) {
setSummary_static(this, str);
}
private static void setSummary_static(AllPrefsFragment allPrefsFragment, String str) {
try {
String string = allPrefsFragment.prefs.getString(str, "");
allPrefsFragment.findPreference(str).setSummary(string);
((EditTextPreference) allPrefsFragment.findPreference(str)).setText(string);
} catch (Exception e) {
UserError.Log.e("jamorham PREFS", "Exception during setSummary: " + e.toString());
}
}
@Override
@android.annotation.SuppressLint({"ApplySharedPref"})
public void onCreate(android.os.Bundle r75) {
throw new UnsupportedOperationException("Method not decompiled: com.eveningoutpost.dexdrip.utils.Preferences.AllPrefsFragment.onCreate(android.os.Bundle):void");
}
public boolean lambda$onCreate$0(Preference preference, Object obj) {
this.prefs.edit().putString("g5-battery-warning-level", (String) obj).commit();
G5BaseService.resetTransmitterBatteryStatus();
SdcardImportExport.hardReset();
return true;
}
public boolean lambda$onCreate$1(Activity activity, Preference preference, Object obj) {
this.prefs.edit().putBoolean("lefun_option_call_notifications", ((Boolean) obj).booleanValue()).apply();
IncomingCallsReceiver.checkPermission(activity);
return true;
}
public boolean lambda$onCreate$2(Preference preference, Object obj) {
IncomingCallsReceiver.checkPermission(getActivity());
return true;
}
public boolean lambda$onCreate$3(Preference preference, Object obj) {
Boolean bool = (Boolean) obj;
if (!bool.booleanValue()) {
return true;
}
if (bool.booleanValue()) {
LocationHelper.requestLocationForBluetooth((Activity) preference.getContext());
}
checkReadPermission(getActivity());
return true;
}
public boolean lambda$onCreate$4(Preference preference) {
updateMiBandBG(preference.getContext());
return true;
}
public boolean lambda$onCreate$5(Activity activity, Preference preference, Object obj) {
this.prefs.edit().putBoolean("bluejay_option_call_notifications", ((Boolean) obj).booleanValue()).apply();
IncomingCallsReceiver.checkPermission(activity);
return true;
}
public static boolean lambda$onCreate$6(Preference preference) {
Inevitable.task("tidepool-upload", 200L, new Runnable() {
@Override
public final void run() {
AuthFlowOut.doTidePoolInitialLogin();
}
});
return false;
}
public static boolean lambda$onCreate$7(Preference preference, Object obj) {
TidepoolUploader.resetInstance();
return true;
}
public static boolean lambda$onCreate$8(Preference preference, Object obj) {
TidepoolUploader.resetInstance();
if (!obj.equals(Pref.getStringDefaultBlank("tidepool_username"))) {
Pref.setString("tidepool_username", (String) obj);
AuthFlowOut.doTidePoolInitialLogin(true);
}
return true;
}
public static boolean lambda$onCreate$9(Preference preference, Object obj) {
TidepoolUploader.resetInstance();
AuthFlowOut.doTidePoolInitialLogin(true);
return true;
}
public static boolean lambda$onCreate$10(Preference preference, Object obj) {
NightscoutFollow.resetInstance();
return true;
}
public static boolean lambda$onCreate$11(Preference preference, Object obj) {
if (((Boolean) obj).booleanValue()) {
LocationHelper.requestLocationForBluetooth((Activity) preference.getContext());
}
InPenEntry.startWithRefresh();
return true;
}
public static boolean lambda$onCreate$12(Preference preference, Object obj) {
WatchUpdaterService.startSelf();
return true;
}
public static boolean lambda$onCreate$13(Preference preference, Object obj) {
WatchUpdaterService.startSelf();
return true;
}
public static boolean lambda$onCreate$14(Preference preference, Object obj) {
preference.getEditor().putBoolean(preference.getKey(), ((Boolean) obj).booleanValue()).apply();
XdripWebService.immortality();
return true;
}
public static boolean lambda$onCreate$15(Preference preference, Object obj) {
preference.getEditor().putBoolean(preference.getKey(), ((Boolean) obj).booleanValue()).apply();
XdripWebService.settingsChanged();
return true;
}
public static boolean lambda$onCreate$16(Preference preference, Object obj) {
preference.getEditor().putBoolean(preference.getKey(), ((Boolean) obj).booleanValue()).apply();
DesertSync.settingsChanged();
return true;
}
public boolean lambda$onCreate$17(Preference preference, Object obj) {
findPreference("retrieve_blukon_history").setEnabled(!((Boolean) obj).booleanValue());
return true;
}
public boolean lambda$onCreate$18(Preference preference, Object obj) {
this.prefs.edit().putInt("blueReader_turn_off_value", ((Integer) obj).intValue()).commit();
preference.setTitle(getString(2131755223) + " (" + obj + ")");
return true;
}
public boolean lambda$onCreate$20(Preference preference, Object obj) {
if (!((Boolean) obj).booleanValue()) {
return true;
}
Inevitable.task("check-health-connect", 300L, new Runnable() {
@Override
public final void run() {
Preferences.AllPrefsFragment.this.lambda$onCreate$19();
}
});
return true;
}
public void lambda$onCreate$19() {
HealthGamut.init(getActivity());
}
public boolean lambda$onCreate$21(Preference preference) {
HealthGamut.init(getActivity()).openPermissionManager();
return true;
}
public static void lambda$onCreate$22(EditTextPreference editTextPreference) {
try {
editTextPreference.getEditText().setSelection(editTextPreference.getEditText().getText().length());
} catch (Exception e) {
UserError.Log.d("jamorham PREFS", "Could not set selection for transmitter id: " + e);
}
}
class AnonymousClass41 implements Preference.OnPreferenceChangeListener {
final PreferenceCategory val$alertsCategory;
final PreferenceScreen val$calibrationAlertsScreen;
final PreferenceCategory val$collectionCategory;
final boolean val$engineering_mode;
final Preference val$interpretRaw;
final PreferenceScreen val$nfcScreen;
final Preference val$nfcSettings;
final Preference val$nsFollowDownload;
final Preference val$nsFollowLag;
final Preference val$nsFollowUrl;
final PreferenceCategory val$otherCategory;
final Preference val$predictiveBG;
final Preference val$scanShare;
final Preference val$shareKey;
final EditTextPreference val$transmitterId;
final Preference val$wifiRecievers;
final Preference val$xSyncFollowChime;
AnonymousClass41(PreferenceCategory preferenceCategory, Preference preference, Preference preference2, PreferenceCategory preferenceCategory2, Preference preference3, Preference preference4, PreferenceCategory preferenceCategory3, PreferenceScreen preferenceScreen, Preference preference5, boolean z, PreferenceScreen preferenceScreen2, Preference preference6, EditTextPreference editTextPreference, Preference preference7, Preference preference8, Preference preference9, Preference preference10) {
this.val$collectionCategory = preferenceCategory;
this.val$shareKey = preference;
this.val$scanShare = preference2;
this.val$otherCategory = preferenceCategory2;
this.val$interpretRaw = preference3;
this.val$predictiveBG = preference4;
this.val$alertsCategory = preferenceCategory3;
this.val$calibrationAlertsScreen = preferenceScreen;
this.val$nfcSettings = preference5;
this.val$engineering_mode = z;
this.val$nfcScreen = preferenceScreen2;
this.val$wifiRecievers = preference6;
this.val$transmitterId = editTextPreference;
this.val$nsFollowUrl = preference7;
this.val$nsFollowDownload = preference8;
this.val$nsFollowLag = preference9;
this.val$xSyncFollowChime = preference10;
}
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
DexCollectionType type = DexCollectionType.getType((String) obj);
if (type != DexCollectionType.DexcomShare) {
this.val$collectionCategory.removePreference(this.val$shareKey);
this.val$collectionCategory.removePreference(this.val$scanShare);
this.val$otherCategory.removePreference(this.val$interpretRaw);
this.val$otherCategory.addPreference(this.val$predictiveBG);
this.val$alertsCategory.addPreference(this.val$calibrationAlertsScreen);
} else {
this.val$collectionCategory.addPreference(this.val$shareKey);
this.val$collectionCategory.addPreference(this.val$scanShare);
this.val$otherCategory.addPreference(this.val$interpretRaw);
this.val$otherCategory.removePreference(this.val$predictiveBG);
this.val$alertsCategory.removePreference(this.val$calibrationAlertsScreen);
AllPrefsFragment.this.prefs.edit().putBoolean("calibration_notifications", false).apply();
}
if (DexCollectionType.hasLibre(type)) {
this.val$collectionCategory.addPreference(this.val$nfcSettings);
NFCReaderX.handleHomeScreenScanPreference(xdrip.getAppContext(), AllPrefsFragment.this.prefs.getBoolean("nfc_scan_homescreen", false) && AllPrefsFragment.this.prefs.getBoolean("use_nfc_scan", false));
if (!this.val$engineering_mode) {
try {
this.val$nfcScreen.removePreference(AllPrefsFragment.this.findPreference("nfc_test_diagnostic"));
} catch (NullPointerException unused) {
}
}
} else {
this.val$collectionCategory.removePreference(this.val$nfcSettings);
NFCReaderX.handleHomeScreenScanPreference(xdrip.getAppContext(), false);
}
if (!DexCollectionType.hasWifi()) {
String string = AllPrefsFragment.this.prefs.getString("wifi_recievers_addresses", "");
if (string == null || string.trim().equals("")) {
this.val$collectionCategory.removePreference(this.val$wifiRecievers);
} else {
this.val$collectionCategory.addPreference(this.val$wifiRecievers);
}
} else {
this.val$collectionCategory.addPreference(this.val$wifiRecievers);
}
if (type != DexCollectionType.DexbridgeWixel && type != DexCollectionType.WifiDexBridgeWixel) {
this.val$collectionCategory.removePreference(this.val$transmitterId);
} else {
this.val$collectionCategory.addPreference(this.val$transmitterId);
}
if (type == DexCollectionType.DexcomG5) {
this.val$collectionCategory.addPreference(this.val$transmitterId);
}
if (type == DexCollectionType.NSFollow) {
this.val$collectionCategory.addPreference(this.val$nsFollowUrl);
this.val$collectionCategory.addPreference(this.val$nsFollowDownload);
this.val$collectionCategory.addPreference(this.val$nsFollowLag);
}
if (type == DexCollectionType.Follower) {
this.val$collectionCategory.addPreference(this.val$xSyncFollowChime);
}
String obj2 = obj.toString();
if (preference instanceof ListPreference) {
ListPreference listPreference = (ListPreference) preference;
int findIndexOfValue = listPreference.findIndexOfValue(obj2);
preference.setSummary(findIndexOfValue >= 0 ? listPreference.getEntries()[findIndexOfValue] : null);
} else if (preference instanceof RingtonePreference) {
if (TextUtils.isEmpty(obj2)) {
preference.setSummary(2131756103);
} else {
Ringtone ringtone = RingtoneManager.getRingtone(preference.getContext(), Uri.parse(obj2));
if (ringtone == null) {
preference.setSummary((CharSequence) null);
} else {
preference.setSummary(ringtone.getTitle(preference.getContext()));
}
}
} else {
preference.setSummary(obj2);
}
if (preference.getKey().equals("dex_collection_method") && obj.equals("Follower")) {
AllPrefsFragment.this.prefs.edit().putInt("bridge_battery", 0).apply();
AllPrefsFragment.this.prefs.edit().putInt("parakeet_battery", 0).apply();
if (AllPrefsFragment.this.prefs.getBoolean("plus_follow_master", false)) {
AllPrefsFragment.this.prefs.edit().putBoolean("plus_follow_master", false).apply();
JoH.static_toast(preference.getContext(), "Turning off xDrip+ Sync Master for Followers!", 1);
}
GcmActivity.requestBGsync();
}
CollectionServiceStarter.restartCollectionServiceBackground();
Inevitable.task("refresh-prefs", 100L, new Runnable() {
@Override
public void run() {
try {
JoH.runOnUiThread(new Runnable() {
@Override
public void run() {
Preferences preferences = AllPrefsFragment.this.parent;
if (preferences != null) {
preferences.refreshFragments();
}
}
});
} catch (Exception e) {
UserError.Log.e("jamorham PREFS", "Got exception refreshing fragments: " + e);
}
}
});
return true;
}
}
public static void checkReadPermission(Activity activity) {
if (xdrip.getAppContext().checkSelfPermission("android.permission.READ_EXTERNAL_STORAGE") != 0) {
ActivityCompat.requestPermissions(activity, new String[]{"android.permission.READ_EXTERNAL_STORAGE"}, 1023);
}
}
public void showSearchFragment() {
if (this.searchConfiguration == null) {
try {
SearchConfiguration searchConfiguration = new SearchConfiguration(getActivity());
this.searchConfiguration = searchConfiguration;
searchConfiguration.setBreadcrumbsEnabled(true);
this.searchConfiguration.getKeysList().addAll(Preferences.getAllPreferenceKeys(getPreferenceScreen()));
this.searchConfiguration.index(2131951624);
this.searchConfiguration.index(2131951627);
this.searchConfiguration.index(2131951622);
this.searchConfiguration.index(2131951623);
this.searchConfiguration.index(2131951621);
this.searchConfiguration.index(2131951637);
} catch (NullPointerException e) {
UserError.Log.e("jamorham PREFS", "Cannot find searchPreference item: " + e);
}
}
this.searchConfiguration.showSearchFragment();
}
public void updateMiBandScreen() {
MiBand.MiBandType mibandType = MiBand.getMibandType();
PreferenceScreen preferenceScreen = (PreferenceScreen) findPreference("miband_settings");
PreferenceScreen preferenceScreen2 = (PreferenceScreen) findPreference("miband_preferences");
try {
preferenceScreen.removePreference(this.miband2_screen);
preferenceScreen.removePreference(this.miband3_4_screen);
preferenceScreen.removePreference(this.miband_nightmode_category);
preferenceScreen2.removePreference(this.miband_graph_category);
preferenceScreen2.removePreference(this.miband_send_readings_as_notification);
preferenceScreen2.removePreference(this.miband_authkey);
if (mibandType == MiBand.MiBandType.MI_BAND4) {
preferenceScreen.addPreference(this.miband3_4_screen);
preferenceScreen.addPreference(this.miband_nightmode_category);
preferenceScreen2.addPreference(this.miband_graph_category);
preferenceScreen2.addPreference(this.miband_send_readings_as_notification);
preferenceScreen2.addPreference(this.miband_authkey);
} else if (mibandType == MiBand.MiBandType.MI_BAND2) {
preferenceScreen.addPreference(this.miband2_screen);
} else if (mibandType == MiBand.MiBandType.MI_BAND3 || mibandType == MiBand.MiBandType.MI_BAND3_1) {
preferenceScreen.addPreference(this.miband3_4_screen);
preferenceScreen.addPreference(this.miband_nightmode_category);
}
} catch (Exception e) {
UserError.Log.e("jamorham PREFS", "Cannot find preference item: " + e);
}
}
public void updateMibandPreferencesData() {
EditTextPreference editTextPreference = (EditTextPreference) findPreference("miband_data_mac");
if (editTextPreference != null) {
editTextPreference.setText(MiBand.getMac());
Preferences.sBindPreferenceTitleAppendToMacValueListener.onPreferenceChange(editTextPreference, PreferenceManager.getDefaultSharedPreferences(editTextPreference.getContext()).getString(editTextPreference.getKey(), ""));
}
EditTextPreference editTextPreference2 = (EditTextPreference) findPreference("miband_data_authkey");
if (editTextPreference2 != null) {
editTextPreference2.setText(MiBand.getAuthKey());
}
}
private void set_nfc_expiry_change_listeners() {
Preferences.nfc_expiry_days.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
preference.getEditor().putString("nfc_expiry_days", (String) obj).apply();
AllPrefsFragment.this.update_nfc_expiry_preferences(null);
return true;
}
});
findPreference("nfc_show_age").setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
AllPrefsFragment.this.update_nfc_expiry_preferences((Boolean) obj);
return true;
}
});
}
public void update_nfc_expiry_preferences(Boolean bool) {
try {
PreferenceScreen preferenceScreen = (PreferenceScreen) findPreference("xdrip_plus_nfc_settings");
String string = this.prefs.getString("nfc_expiry_days", "14.5");
CheckBoxPreference checkBoxPreference = (CheckBoxPreference) findPreference("nfc_show_age");
checkBoxPreference.setSummaryOff("Show the sensor expiry time based on " + string + " days");
if (bool == null) {
bool = Boolean.valueOf(checkBoxPreference.isChecked());
}
if (bool.booleanValue()) {
preferenceScreen.removePreference(Preferences.nfc_expiry_days);
} else {
Preferences.nfc_expiry_days.setOrder(3);
preferenceScreen.addPreference(Preferences.nfc_expiry_days);
}
} catch (NullPointerException unused) {
}
}
private void bindWidgetUpdater() {
findPreference("widget_range_lines").setOnPreferenceChangeListener(new WidgetListener());
findPreference("extra_status_line").setOnPreferenceChangeListener(new WidgetListener());
findPreference("widget_status_line").setOnPreferenceChangeListener(new WidgetListener());
findPreference("status_line_calibration_long").setOnPreferenceChangeListener(new WidgetListener());
findPreference("status_line_calibration_short").setOnPreferenceChangeListener(new WidgetListener());
findPreference("status_line_avg").setOnPreferenceChangeListener(new WidgetListener());
findPreference("status_line_a1c_dcct").setOnPreferenceChangeListener(new WidgetListener());
findPreference("status_line_a1c_ifcc").setOnPreferenceChangeListener(new WidgetListener());
findPreference("status_line_in").setOnPreferenceChangeListener(new WidgetListener());
findPreference("status_line_high").setOnPreferenceChangeListener(new WidgetListener());
findPreference("status_line_low").setOnPreferenceChangeListener(new WidgetListener());
findPreference("extra_status_line").setOnPreferenceChangeListener(new WidgetListener());
findPreference("status_line_capture_percentage").setOnPreferenceChangeListener(new WidgetListener());
findPreference("status_line_realtime_capture_percentage").setOnPreferenceChangeListener(new WidgetListener());
findPreference("extra_status_stats_24h").setOnPreferenceChangeListener(new WidgetListener());
}
public void update_force_english_title(String str) {
String str2;
try {
if (str.length() == 0) {
str2 = Preferences.locale_choice.getEntry().toString();
} else {
try {
str2 = Preferences.locale_choice.getEntries()[Preferences.locale_choice.findIndexOfValue(str)].toString();
} catch (Exception unused) {
str2 = "Unknown";
}
}
Preferences.force_english.setTitle("Force " + str2 + " Text");
} catch (NullPointerException e) {
UserError.Log.e("jamorham PREFS", "Nullpointer in update_force_english_title: " + e);
}
}
private void updateMiBandBG(Context context) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(xdrip.getAppContext().getResources().getString(2131755826));
builder.setPositiveButton(xdrip.getAppContext().getResources().getString(2131757071), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
MiBandEntry.forceShowLatestBG();
}
});
builder.setNegativeButton(xdrip.getAppContext().getResources().getString(2131755900), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
});
builder.create().show();
}
public void installPebbleWatchface(int i, Preference preference) {
Context context = preference.getContext();
if (i == 1) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle("Pebble Install");
if (i == 2) {
builder.setMessage("Install Standard Pebble Watchface?");
} else if (i == 3) {
builder.setMessage("Install Pebble Trend Watchface?");
} else if (i == 4) {
builder.setMessage("Install Pebble Classic Trend Watchface?");
} else if (i == 5) {
builder.setMessage("Install Pebble Clay Trend Watchface?");
}
builder.setPositiveButton(xdrip.gs(2131757071), new AnonymousClass46(i, context));
builder.setNegativeButton(xdrip.gs(2131755900), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i2) {
dialogInterface.dismiss();
}
});
builder.create().show();
}
class AnonymousClass46 implements DialogInterface.OnClickListener {
final Context val$context;
final int val$pebbleType;
AnonymousClass46(int i, Context context) {
this.val$pebbleType = i;
this.val$context = context;
}
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
int i2 = this.val$pebbleType;
if (i2 == 2) {
this.val$context.startActivity(new Intent(this.val$context, (Class<?>) InstallPebbleWatchFace.class));
} else if (i2 == 3) {
this.val$context.startActivity(new Intent(this.val$context, (Class<?>) InstallPebbleTrendWatchFace.class));
} else if (i2 == 4) {
this.val$context.startActivity(new Intent(this.val$context, (Class<?>) InstallPebbleClassicTrendWatchface.class));
} else if (i2 == 5) {
this.val$context.startActivity(new Intent(this.val$context, (Class<?>) InstallPebbleTrendClayWatchFace.class));
}
JoH.runOnUiThreadDelayed(new Runnable() {
@Override
public void run() {
AlertDialog.Builder builder = new AlertDialog.Builder(AnonymousClass46.this.val$context);
builder.setTitle("Snooze Control Install");
builder.setMessage("Install Pebble Snooze Button App?");
builder.setPositiveButton(xdrip.gs(2131757071), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface2, int i3) {
dialogInterface2.dismiss();
AnonymousClass46.this.val$context.startActivity(new Intent(AnonymousClass46.this.val$context, (Class<?>) InstallPebbleSnoozeControlApp.class));
}
});
builder.setNegativeButton(xdrip.gs(2131755900), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface2, int i3) {
dialogInterface2.dismiss();
}
});
builder.create().show();
}
}, 3000L);
}
}
public void enablePebble(int i, boolean z, Context context) {
UserError.Log.d("jamorham PREFS", "enablePebble called with: " + i + " " + z);
if (pebbleType == 1) {
if (z && i != 1) {
context.stopService(new Intent(context, (Class<?>) PebbleWatchSync.class));
context.startService(new Intent(context, (Class<?>) PebbleWatchSync.class));
UserError.Log.d("jamorham PREFS", "Starting pebble service type: " + i);
}
} else if (!z || i == 1) {
context.stopService(new Intent(context, (Class<?>) PebbleWatchSync.class));
UserError.Log.d("jamorham PREFS", "Stopping pebble service type: " + i);
}
if (!z) {
i = 1;
}
pebbleType = i;
PebbleWatchSync.setPebbleType(i);
}
private void setupBarcodeConfigScanner() {
findPreference("auto_configure").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
new AndroidBarcode(AllPrefsFragment.this.getActivity()).scan();
return true;
}
});
}
private void setupBarcodeShareScanner() {
findPreference("scan_share2_barcode").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
new AndroidBarcode(AllPrefsFragment.this.getActivity()).scan();
return true;
}
});
}
private void setupQrFromFile() {
findPreference("qr_code_from_file").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
new QrCodeFromFile(AllPrefsFragment.this.getActivity()).scanFile();
return true;
}
});
}
public void refresh_extra_items() {
try {
SharedPreferences sharedPreferences = this.prefs;
if (sharedPreferences == null) {
return;
}
sharedPreferences.getBoolean("plus_extra_features", false);
} catch (Exception e) {
UserError.Log.e("jamorham PREFS", "Got exception in refresh extra: " + e.toString());
}
}
public void jumpToScreen(String str) {
if (str == null) {
return;
}
UserError.Log.d("jamorham PREFS", "jump to screen: " + str);
final PreferenceScreen preferenceScreen = (PreferenceScreen) findPreference(str);
JoH.runOnUiThread(new Runnable() {
@Override
public void run() {
AllPrefsFragment.clickScreen(this, preferenceScreen);
}
});
}
public static void clickScreen(PreferenceFragment preferenceFragment, PreferenceScreen preferenceScreen) {
if (preferenceScreen == null) {
return;
}
if (preferenceFragment.getPreferenceScreen() != preferenceScreen) {
try {
Method declaredMethod = preferenceScreen.getClass().getDeclaredMethod("onClick", new Class[0]);
declaredMethod.setAccessible(true);
declaredMethod.invoke(preferenceScreen, new Object[0]);
return;
} catch (Exception e) {
Log.e("jamorham PREFS", "" + e);
return;
}
}
Log.d("jamorham PREFS", "Already on that screen");
}
class AnonymousClass52 implements Preference.OnPreferenceChangeListener {
AnonymousClass52() {
}
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
if (((Boolean) obj).booleanValue()) {
AllPrefsFragment.this.prefs.edit().putBoolean("bg_to_speech", true).commit();
AlertDialog.Builder builder = new AlertDialog.Builder(AllPrefsFragment.this.getActivity());
builder.setTitle(2131755699);
builder.setMessage(AllPrefsFragment.this.getString(2131755699) + "\n" + AllPrefsFragment.this.getString(2131755091));
builder.setCancelable(true);
builder.setPositiveButton(2131755953, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
Preferences.AllPrefsFragment.AnonymousClass52.this.lambda$onPreferenceChange$0(dialogInterface, i);
}
});
builder.setNegativeButton(2131755900, (DialogInterface.OnClickListener) null);
builder.create().show();
try {
BgToSpeech.testSpeech();
} catch (Exception e) {
UserError.Log.e("jamorham PREFS", "Got exception with TTS: " + e);
}
} else {
BgToSpeech.tearDownTTS();
}
return true;
}
public void lambda$onPreferenceChange$0(DialogInterface dialogInterface, int i) {
SpeechUtil.installTTSData(AllPrefsFragment.this.getActivity());
}
}
private void bindTTSListener() {
findPreference("bg_to_speech").setOnPreferenceChangeListener(new AnonymousClass52());
findPreference("speech_speed").setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public final boolean onPreferenceChange(Preference preference, Object obj) {
boolean lambda$bindTTSListener$23;
lambda$bindTTSListener$23 = Preferences.AllPrefsFragment.this.lambda$bindTTSListener$23(preference, obj);
return lambda$bindTTSListener$23;
}
});
findPreference("speech_pitch").setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public final boolean onPreferenceChange(Preference preference, Object obj) {
boolean lambda$bindTTSListener$24;
lambda$bindTTSListener$24 = Preferences.AllPrefsFragment.this.lambda$bindTTSListener$24(preference, obj);
return lambda$bindTTSListener$24;
}
});
}
public boolean lambda$bindTTSListener$23(Preference preference, Object obj) {
this.prefs.edit().putInt("speech_speed", ((Integer) obj).intValue()).commit();
try {
BgToSpeech.testSpeech();
return true;
} catch (Exception e) {
UserError.Log.e("jamorham PREFS", "Got exception with TTS: " + e);
return true;
}
}
public boolean lambda$bindTTSListener$24(Preference preference, Object obj) {
this.prefs.edit().putInt("speech_pitch", ((Integer) obj).intValue()).commit();
try {
BgToSpeech.testSpeech();
return true;
} catch (Exception e) {
UserError.Log.e("jamorham PREFS", "Got exception with TTS: " + e);
return true;
}
}
private static class WidgetListener implements Preference.OnPreferenceChangeListener {
private WidgetListener() {
}
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
Context context = preference.getContext();
if (AppWidgetManager.getInstance(context).getAppWidgetIds(new ComponentName(context, (Class<?>) xDripWidget.class)).length <= 0) {
return true;
}
context.startService(new Intent(context, (Class<?>) WidgetUpdateService.class));
return true;
}
}
}
public static void handleUnitsChange(Preference preference, Object obj, AllPrefsFragment allPrefsFragment) {
String str;
SharedPreferences defaultSharedPreferences;
Double d;
try {
if (preference != null) {
defaultSharedPreferences = preference.getSharedPreferences();
} else {
defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(xdrip.getAppContext());
}
Double valueOf = Double.valueOf(Double.parseDouble(defaultSharedPreferences.getString("highValue", "0")));
Double valueOf2 = Double.valueOf(Double.parseDouble(defaultSharedPreferences.getString("lowValue", "0")));
Double valueOf3 = Double.valueOf(Double.parseDouble(defaultSharedPreferences.getString("profile_insulin_sensitivity_default", "54")));
Double valueOf4 = Double.valueOf(Double.parseDouble(defaultSharedPreferences.getString("plus_target_range", "100")));
Double valueOf5 = Double.valueOf(Double.parseDouble(defaultSharedPreferences.getString("persistent_high_threshold", "0")));
Double valueOf6 = Double.valueOf(Double.parseDouble(defaultSharedPreferences.getString("forecast_low_threshold", "0")));
static_units = obj.toString();
try {
if (obj.toString().equals("mgdl")) {
if (valueOf.doubleValue() < 36.0d) {
ProfileEditor.convertData(18.0182d);
defaultSharedPreferences.edit().putString("highValue", Long.toString(Math.round(valueOf.doubleValue() * 18.0182d))).apply();
defaultSharedPreferences.edit().putString("profile_insulin_sensitivity_default", Long.toString(Math.round(valueOf3.doubleValue() * 18.0182d))).apply();
defaultSharedPreferences.edit().putString("plus_target_range", Long.toString(Math.round(valueOf4.doubleValue() * 18.0182d))).apply();
Profile.invalidateProfile();
}
if (valueOf5.doubleValue() < 36.0d) {
ProfileEditor.convertData(18.0182d);
defaultSharedPreferences.edit().putString("persistent_high_threshold", Long.toString(Math.round(valueOf5.doubleValue() * 18.0182d))).apply();
Profile.invalidateProfile();
}
if (valueOf6.doubleValue() < 36.0d) {
ProfileEditor.convertData(18.0182d);
defaultSharedPreferences.edit().putString("forecast_low_threshold", Long.toString(Math.round(valueOf6.doubleValue() * 18.0182d))).apply();
Profile.invalidateProfile();
}
if (valueOf2.doubleValue() < 36.0d) {
ProfileEditor.convertData(18.0182d);
defaultSharedPreferences.edit().putString("lowValue", Long.toString(Math.round(valueOf2.doubleValue() * 18.0182d))).apply();
defaultSharedPreferences.edit().putString("profile_insulin_sensitivity_default", Long.toString(Math.round(valueOf3.doubleValue() * 18.0182d))).apply();
defaultSharedPreferences.edit().putString("plus_target_range", Long.toString(Math.round(valueOf4.doubleValue() * 18.0182d))).apply();
Profile.invalidateProfile();
}
} else {
if (valueOf.doubleValue() > 35.0d) {
ProfileEditor.convertData(0.0554994394556615d);
d = valueOf2;
defaultSharedPreferences.edit().putString("highValue", JoH.qs(valueOf.doubleValue() * 0.0554994394556615d, 1)).apply();
defaultSharedPreferences.edit().putString("profile_insulin_sensitivity_default", JoH.qs(valueOf3.doubleValue() * 0.0554994394556615d, 2)).apply();
defaultSharedPreferences.edit().putString("plus_target_range", JoH.qs(valueOf4.doubleValue() * 0.0554994394556615d, 1)).apply();
Profile.invalidateProfile();
} else {
d = valueOf2;
}
if (valueOf5.doubleValue() > 35.0d) {
ProfileEditor.convertData(0.0554994394556615d);
defaultSharedPreferences.edit().putString("persistent_high_threshold", JoH.qs(valueOf5.doubleValue() * 0.0554994394556615d, 1)).apply();
Profile.invalidateProfile();
}
if (valueOf6.doubleValue() > 35.0d) {
ProfileEditor.convertData(0.0554994394556615d);
defaultSharedPreferences.edit().putString("forecast_low_threshold", JoH.qs(valueOf6.doubleValue() * 0.0554994394556615d, 1)).apply();
Profile.invalidateProfile();
}
if (d.doubleValue() > 35.0d) {
ProfileEditor.convertData(0.0554994394556615d);
defaultSharedPreferences.edit().putString("lowValue", JoH.qs(d.doubleValue() * 0.0554994394556615d, 1)).apply();
defaultSharedPreferences.edit().putString("profile_insulin_sensitivity_default", JoH.qs(valueOf3.doubleValue() * 0.0554994394556615d, 2)).apply();
defaultSharedPreferences.edit().putString("plus_target_range", JoH.qs(valueOf4.doubleValue() * 0.0554994394556615d, 1)).apply();
Profile.invalidateProfile();
}
}
if (preference != null) {
preference.setSummary(obj.toString());
}
if (allPrefsFragment != null) {
allPrefsFragment.setSummary("highValue");
allPrefsFragment.setSummary("lowValue");
allPrefsFragment.setSummary("persistent_high_threshold");
allPrefsFragment.setSummary("forecast_low_threshold");
}
if (profile_insulin_sensitivity_default != null) {
str = "jamorham PREFS";
try {
UserError.Log.d(str, "refreshing profile insulin sensitivity default display");
Preference preference2 = profile_insulin_sensitivity_default;
preference2.setTitle(format_insulin_sensitivity(preference2.getTitle().toString(), ProfileEditor.minMaxSens(ProfileEditor.loadData(false))));
} catch (Exception e) {
e = e;
UserError.Log.e(str, "Got excepting processing high/low value preferences: " + e.toString());
return;
}
} else {
str = "jamorham PREFS";
}
Profile.reloadPreferences(defaultSharedPreferences);
} catch (Exception e2) {
e = e2;
str = "jamorham PREFS";
}
} catch (Exception e3) {
e = e3;
str = "jamorham PREFS";
}
}
public static boolean isNumeric(String str) {
try {
Double.parseDouble(str);
return true;
} catch (NumberFormatException unused) {
return false;
}
}
}