@@ -28,7 +28,6 @@ class MainActivity : SimpleActivity() {
2828
2929 private var mBus: Bus ? = null
3030 private var mCameraImpl: MyCameraImpl ? = null
31- private var translucentWhite = 0
3231 private var mStoredUseEnglish = false
3332
3433 override fun onCreate (savedInstanceState : Bundle ? ) {
@@ -37,9 +36,7 @@ class MainActivity : SimpleActivity() {
3736 appLaunched()
3837
3938 mBus = BusProvider .instance
40- translucentWhite = resources.getColor(R .color.translucent_white)
41- changeIconColor(translucentWhite, bright_display_btn)
42- changeIconColor(translucentWhite, stroboscope_btn)
39+ changeIconColor(config.backgroundColor.getContrastColor(), stroboscope_btn)
4340
4441 bright_display_btn.setOnClickListener {
4542 startActivity(Intent (applicationContext, BrightDisplayActivity ::class .java))
@@ -63,13 +60,18 @@ class MainActivity : SimpleActivity() {
6360 mCameraImpl!! .handleCameraSetup()
6461 checkState(MyCameraImpl .isFlashlightOn)
6562
63+ changeIconColor(config.backgroundColor.getContrastColor(), bright_display_btn)
6664 bright_display_btn.beVisibleIf(config.brightDisplay)
6765 stroboscope_btn.beVisibleIf(config.stroboscope)
6866 if (! config.stroboscope) {
6967 mCameraImpl!! .stopStroboscope()
7068 stroboscope_bar.beInvisible()
7169 }
70+
7271 updateTextColors(main_holder)
72+ if (stroboscope_bar.isInvisible()) {
73+ changeIconColor(config.backgroundColor.getContrastColor(), stroboscope_btn)
74+ }
7375 }
7476
7577 override fun onStart () {
@@ -169,8 +171,8 @@ class MainActivity : SimpleActivity() {
169171
170172 private fun cameraPermissionGranted () {
171173 if (mCameraImpl!! .toggleStroboscope()) {
172- stroboscope_bar.beInvisibleIf(stroboscope_bar.visibility == View . VISIBLE )
173- changeIconColor(if (stroboscope_bar.visibility == View . VISIBLE ) config.primaryColor else translucentWhite , stroboscope_btn)
174+ stroboscope_bar.beInvisibleIf(stroboscope_bar.isVisible() )
175+ changeIconColor(if (stroboscope_bar.isVisible()) config.primaryColor else config.backgroundColor.getContrastColor() , stroboscope_btn)
174176 }
175177 }
176178
@@ -196,12 +198,12 @@ class MainActivity : SimpleActivity() {
196198 changeIconColor(config.primaryColor, toggle_btn)
197199 window.addFlags(WindowManager .LayoutParams .FLAG_KEEP_SCREEN_ON )
198200
199- changeIconColor(translucentWhite , stroboscope_btn)
201+ changeIconColor(config.backgroundColor.getContrastColor() , stroboscope_btn)
200202 stroboscope_bar.beInvisible()
201203 }
202204
203205 private fun disableFlashlight () {
204- changeIconColor(translucentWhite , toggle_btn)
206+ changeIconColor(config.backgroundColor.getContrastColor() , toggle_btn)
205207 window.clearFlags(WindowManager .LayoutParams .FLAG_KEEP_SCREEN_ON )
206208 }
207209
0 commit comments