FlashControl: Show toast when QS and app data not in sync
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
<!-- Tests, Infos -->
|
||||
<string name="flash_current_intesity">Current brightness intesity: %d</string>
|
||||
<string name="flash_current_on">Flash is currently %s</string>
|
||||
<string name="use_app_flash">Use app\'s switch to control flashlight on/off while testing</string>
|
||||
|
||||
<!-- On Off -->
|
||||
<string name="on">On</string>
|
||||
|
||||
@@ -22,6 +22,7 @@ import android.os.Bundle
|
||||
import android.os.ServiceManager
|
||||
import android.provider.Settings
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import android.widget.Switch
|
||||
|
||||
import androidx.preference.Preference
|
||||
@@ -83,6 +84,7 @@ class FlashFragment : PreferenceFragmentCompat(), OnMainSwitchChangeListener {
|
||||
mService.enableFlash(isChecked)
|
||||
} catch (e : IllegalStateException) {
|
||||
Log.e(TAG, "enableFlash() failed", e)
|
||||
Toast.makeText(requireContext(), R.string.use_app_flash, Toast.LENGTH_SHORT).show()
|
||||
return
|
||||
}
|
||||
mCurrentOn.title = String.format(requireContext().getString(R.string.flash_current_on), requireContext().getString(if (isChecked) R.string.on else R.string.off))
|
||||
|
||||
Reference in New Issue
Block a user