Skip to content

Commit 42bcfa9

Browse files
committed
use a translucent white as the default icon
1 parent 4981516 commit 42bcfa9

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

app/src/main/java/com/simplemobiletools/flashlight/activities/MainActivity.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,20 @@ public void stateChangedEvent(Events.StateChanged event) {
104104
}
105105

106106
public void enableFlashlight() {
107-
final int appColor = getResources().getColor(R.color.colorPrimary);
108-
mToggleBtn.setImageResource(R.mipmap.flashlight_big);
109-
mToggleBtn.getDrawable().mutate().setColorFilter(appColor, PorterDuff.Mode.SRC_IN);
107+
changeIconColor(R.color.colorPrimary);
110108
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
111109
}
112110

113111
public void disableFlashlight() {
114-
mToggleBtn.setImageResource(R.mipmap.flashlight_big);
112+
changeIconColor(R.color.translucent_white);
115113
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
116114
}
117115

116+
private void changeIconColor(int colorId) {
117+
final int appColor = getResources().getColor(colorId);
118+
mToggleBtn.getDrawable().mutate().setColorFilter(appColor, PorterDuff.Mode.SRC_IN);
119+
}
120+
118121
@Subscribe
119122
public void cameraUnavailable(Events.CameraUnavailable event) {
120123
Utils.showToast(this, R.string.camera_error);

app/src/main/res/values/colors.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
<color name="colorPrimary">#fff68630</color>
44
<color name="colorPrimaryDark">#ffe27725</color>
55
<color name="colorAccent">@color/colorPrimary</color>
6+
<color name="translucent_white">#aaffffff</color>
67
</resources>

0 commit comments

Comments
 (0)