From 86b8d983ed26ee86c2c345939a3bc1ed13f034e4 Mon Sep 17 00:00:00 2001 From: Chippppp <78024852+Chipppppppppp@users.noreply.github.com> Date: Tue, 20 Feb 2024 02:53:47 +0900 Subject: [PATCH] Restart only if the options change --- .../java/io/github/chipppppppppp/lime/Main.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/github/chipppppppppp/lime/Main.java b/app/src/main/java/io/github/chipppppppppp/lime/Main.java index aec4d522..4b34d70a 100644 --- a/app/src/main/java/io/github/chipppppppppp/lime/Main.java +++ b/app/src/main/java/io/github/chipppppppppp/lime/Main.java @@ -168,9 +168,16 @@ else if (name == "open_in_browser") { builder.setPositiveButton(context.getString(R.string.positive), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - Toast.makeText(context.getApplicationContext(), context.getString(R.string.restarting), Toast.LENGTH_SHORT).show(); - Process.killProcess(Process.myPid()); - context.startActivity(new Intent().setClassName(PACKAGE, "jp.naver.line.android.activity.SplashActivity")); + boolean optionChanged = false; + for (LimeOptions.Option option : limeOptions.options) { + if (option.checked != prefs.getBoolean(option.name, option.checked)) optionChanged = true; + } + + if (optionChanged) { + Toast.makeText(context.getApplicationContext(), context.getString(R.string.restarting), Toast.LENGTH_SHORT).show(); + Process.killProcess(Process.myPid()); + context.startActivity(new Intent().setClassName(PACKAGE, "jp.naver.line.android.activity.SplashActivity")); + } } });