Skip to content

Commit c7ed6ee

Browse files
Alejandro Quiroz CarmonaAlejandro Quiroz Carmona
Alejandro Quiroz Carmona
authored and
Alejandro Quiroz Carmona
committed
Fixed settings not being loaded after system reboot
1 parent daaf949 commit c7ed6ee

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

app/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ android {
1111
minSdkVersion 24
1212
targetSdkVersion 29
1313
versionCode 106
14-
versionName '1.0.7-rs_adbserver_testbranch-tinydisplay_lab-test05'
14+
versionName '1.0.7-rs_adbserver_testbranch-tinydisplay_lab-test08'
1515

1616
}
1717

app/src/main/java/io/github/virresh/matvt/gui/GuiActivity.java

+9-5
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,10 @@ public void onStopTrackingTouch(SeekBar seekBar) {}
148148
PointerControl.isBordered = b;
149149
});
150150

151-
cb_hide_toasts.setOnCheckedChangeListener((compoundButton, b) ->{
152-
Helper.setHideToastAlerts(getApplicationContext(), b);
153-
MouseEmulationEngine.isHideToastsOptionEnabled = b;
154-
});
151+
cb_hide_toasts.setOnCheckedChangeListener(((compoundButton, value) -> {
152+
Helper.setHideToastsOptionEnabled(getApplicationContext(), value);
153+
MouseEmulationEngine.isHideToastsOptionEnabled = value;
154+
}));
155155

156156
cb_disable_bossKey.setOnCheckedChangeListener(((compoundButton, value) -> {
157157
Helper.setBossKeyDisabled(getApplicationContext(), value);
@@ -188,13 +188,17 @@ private void checkValues(IconStyleSpinnerAdapter adapter) {
188188
cb_mouse_bordered.setChecked(bordered);
189189

190190
boolean toastVisibility;
191+
191192
if(!Helper.hasDeviceTypeBeenIdentified(ctx)){
192193
toastVisibility = Helper.determineDeviceTypePolicy(ctx);
194+
Helper.setHideToastsOptionEnabled(ctx,toastVisibility);
193195
}else{
194-
toastVisibility = Helper.getHideToastAlerts(ctx);
196+
toastVisibility = Helper.isHideToastOptionEnabled(ctx);
195197
}
198+
196199
cb_hide_toasts.setChecked(toastVisibility);
197200

201+
198202
boolean bossKeyStatus = Helper.isBossKeyDisabled(ctx);
199203
cb_disable_bossKey.setChecked(bossKeyStatus);
200204

app/src/main/java/io/github/virresh/matvt/helper/Helper.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,14 @@ public static boolean getMouseBordered(Context ctx) {
151151
return sp.getBoolean(PREF_KEY_MOUSE_BORDERED, false);
152152
}
153153
@SuppressLint("ApplySharedPref")
154-
public static void setHideToastAlerts(Context ctx, Boolean val){
154+
public static void setHideToastsOptionEnabled(Context ctx, Boolean val){
155155
SharedPreferences sp = ctx.getSharedPreferences(PREFS_ID,Context.MODE_PRIVATE);
156156
SharedPreferences.Editor editor = sp.edit();
157157
editor.putBoolean(PREF_ALERTS_HIDE_TOASTS,val);
158158
editor.commit();
159159
}
160160

161-
public static boolean getHideToastAlerts(Context ctx){
161+
public static boolean isHideToastOptionEnabled(Context ctx){
162162
SharedPreferences sp = ctx.getSharedPreferences(PREFS_ID, Context.MODE_PRIVATE);
163163
return sp.getBoolean(PREF_ALERTS_HIDE_TOASTS, false);
164164
}

app/src/main/java/io/github/virresh/matvt/services/MouseEventService.java

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ protected void onServiceConnected() {
7171
bossKey = KeyEvent.KEYCODE_VOLUME_MUTE;
7272
PointerControl.isBordered = Helper.getMouseBordered(this);
7373
scrollSpeed = Helper.getScrollSpeed(this);
74+
MouseEmulationEngine.isHideToastsOptionEnabled = Helper.isHideToastOptionEnabled(this);
7475
MouseEmulationEngine.isBossKeyDisabled = Helper.isBossKeyDisabled(this);
7576
MouseEmulationEngine.isBossKeySetToToggle = Helper.isBossKeySetToToggle(this);
7677
if (Helper.isOverriding(this)) bossKey = Helper.getBossKeyValue(this);

0 commit comments

Comments
 (0)