mirror of
https://github.com/SimpleMobileTools/Simple-Flashlight.git
synced 2025-02-19 21:30:41 +01:00
use a translucent white as the default icon
This commit is contained in:
parent
49815169a2
commit
42bcfa9361
@ -104,17 +104,20 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void enableFlashlight() {
|
public void enableFlashlight() {
|
||||||
final int appColor = getResources().getColor(R.color.colorPrimary);
|
changeIconColor(R.color.colorPrimary);
|
||||||
mToggleBtn.setImageResource(R.mipmap.flashlight_big);
|
|
||||||
mToggleBtn.getDrawable().mutate().setColorFilter(appColor, PorterDuff.Mode.SRC_IN);
|
|
||||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disableFlashlight() {
|
public void disableFlashlight() {
|
||||||
mToggleBtn.setImageResource(R.mipmap.flashlight_big);
|
changeIconColor(R.color.translucent_white);
|
||||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void changeIconColor(int colorId) {
|
||||||
|
final int appColor = getResources().getColor(colorId);
|
||||||
|
mToggleBtn.getDrawable().mutate().setColorFilter(appColor, PorterDuff.Mode.SRC_IN);
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void cameraUnavailable(Events.CameraUnavailable event) {
|
public void cameraUnavailable(Events.CameraUnavailable event) {
|
||||||
Utils.showToast(this, R.string.camera_error);
|
Utils.showToast(this, R.string.camera_error);
|
||||||
|
@ -3,4 +3,5 @@
|
|||||||
<color name="colorPrimary">#fff68630</color>
|
<color name="colorPrimary">#fff68630</color>
|
||||||
<color name="colorPrimaryDark">#ffe27725</color>
|
<color name="colorPrimaryDark">#ffe27725</color>
|
||||||
<color name="colorAccent">@color/colorPrimary</color>
|
<color name="colorAccent">@color/colorPrimary</color>
|
||||||
|
<color name="translucent_white">#aaffffff</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user