Skip to content

Commit 0038b14

Browse files
committed
use the primary color instead of orange
1 parent 30b348c commit 0038b14

File tree

1 file changed

+10
-9
lines changed
  • app/src/main/kotlin/com/simplemobiletools/flashlight/activities

1 file changed

+10
-9
lines changed

app/src/main/kotlin/com/simplemobiletools/flashlight/activities/MainActivity.kt

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,16 @@ class MainActivity : SimpleActivity() {
2929

3030
private var mBus: Bus? = null
3131
private var mCameraImpl: MyCameraImpl? = null
32+
private var translucentWhite = 0
3233

3334
override fun onCreate(savedInstanceState: Bundle?) {
3435
super.onCreate(savedInstanceState)
3536
setContentView(R.layout.activity_main)
3637

3738
mBus = BusProvider.instance
38-
changeIconColor(R.color.translucent_white, bright_display_btn)
39-
changeIconColor(R.color.translucent_white, stroboscope_btn)
39+
translucentWhite = resources.getColor(R.color.translucent_white)
40+
changeIconColor(translucentWhite, bright_display_btn)
41+
changeIconColor(translucentWhite, stroboscope_btn)
4042

4143
bright_display_btn.setOnClickListener {
4244
startActivity(Intent(applicationContext, BrightDisplayActivity::class.java))
@@ -150,7 +152,7 @@ class MainActivity : SimpleActivity() {
150152
private fun cameraPermissionGranted() {
151153
if (mCameraImpl!!.toggleStroboscope()) {
152154
stroboscope_bar.beInvisibleIf(stroboscope_bar.visibility == View.VISIBLE)
153-
changeIconColor(if (stroboscope_bar.visibility == View.VISIBLE) R.color.color_primary else R.color.translucent_white, stroboscope_btn)
155+
changeIconColor(if (stroboscope_bar.visibility == View.VISIBLE) config.primaryColor else translucentWhite, stroboscope_btn)
154156
}
155157
}
156158

@@ -173,21 +175,20 @@ class MainActivity : SimpleActivity() {
173175
}
174176

175177
private fun enableFlashlight() {
176-
changeIconColor(R.color.color_primary, toggle_btn)
178+
changeIconColor(config.primaryColor, toggle_btn)
177179
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
178180

179-
changeIconColor(R.color.translucent_white, stroboscope_btn)
181+
changeIconColor(translucentWhite, stroboscope_btn)
180182
stroboscope_bar.beInvisible()
181183
}
182184

183185
private fun disableFlashlight() {
184-
changeIconColor(R.color.translucent_white, toggle_btn)
186+
changeIconColor(translucentWhite, toggle_btn)
185187
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
186188
}
187189

188-
private fun changeIconColor(colorId: Int, imageView: ImageView?) {
189-
val appColor = resources.getColor(colorId)
190-
imageView!!.background.mutate().setColorFilter(appColor, PorterDuff.Mode.SRC_IN)
190+
private fun changeIconColor(color: Int, imageView: ImageView?) {
191+
imageView!!.background.mutate().setColorFilter(color, PorterDuff.Mode.SRC_IN)
191192
}
192193

193194
@Subscribe

0 commit comments

Comments
 (0)