use a translucent white as the default icon

This commit is contained in:
tibbi 2016-06-26 16:44:07 +02:00
parent 49815169a2
commit 42bcfa9361
2 changed files with 8 additions and 4 deletions

View File

@ -104,17 +104,20 @@ public class MainActivity extends AppCompatActivity {
}
public void enableFlashlight() {
final int appColor = getResources().getColor(R.color.colorPrimary);
mToggleBtn.setImageResource(R.mipmap.flashlight_big);
mToggleBtn.getDrawable().mutate().setColorFilter(appColor, PorterDuff.Mode.SRC_IN);
changeIconColor(R.color.colorPrimary);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
public void disableFlashlight() {
mToggleBtn.setImageResource(R.mipmap.flashlight_big);
changeIconColor(R.color.translucent_white);
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
public void cameraUnavailable(Events.CameraUnavailable event) {
Utils.showToast(this, R.string.camera_error);

View File

@ -3,4 +3,5 @@
<color name="colorPrimary">#fff68630</color>
<color name="colorPrimaryDark">#ffe27725</color>
<color name="colorAccent">@color/colorPrimary</color>
<color name="translucent_white">#aaffffff</color>
</resources>