diff --git a/app/src/main/java/com/example/noreel/MainActivity.kt b/app/src/main/java/com/example/noreel/MainActivity.kt index 3d145c3..eaf56bc 100644 --- a/app/src/main/java/com/example/noreel/MainActivity.kt +++ b/app/src/main/java/com/example/noreel/MainActivity.kt @@ -43,6 +43,7 @@ import kotlin.concurrent.thread open class MainActivity : ComponentActivity(), SharedPreferences.OnSharedPreferenceChangeListener { private var filePathCallback: ValueCallback>? = null + private var settingsChanged: Boolean = false private lateinit var webView: WebView @@ -94,6 +95,15 @@ open class MainActivity : ComponentActivity(), SharedPreferences.OnSharedPrefere } } + override fun onResume() { + super.onResume() + if (settingsChanged) { + settingsChanged = false + updateBrowser(webView) + Log.d("Settings", "Reload browser") + } + } + @RequiresApi(Build.VERSION_CODES.O) @SuppressLint("SetJavaScriptEnabled") override fun onCreate(savedInstanceState: Bundle?) { @@ -118,6 +128,7 @@ open class MainActivity : ComponentActivity(), SharedPreferences.OnSharedPrefere val preferences_button = findViewById