add some temp images for flashlight off and on
@ -59,13 +59,13 @@ public class MainActivity extends AppCompatActivity {
|
||||
private void enableFlashlight() {
|
||||
params.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH);
|
||||
camera.setParameters(params);
|
||||
toggleBtn.getDrawable().setColorFilter(Color.GREEN, PorterDuff.Mode.SRC_ATOP);
|
||||
toggleBtn.setBackground(getResources().getDrawable(R.mipmap.flashlight_big_on));
|
||||
}
|
||||
|
||||
private void disableFlashlight() {
|
||||
params.setFlashMode(Camera.Parameters.FLASH_MODE_OFF);
|
||||
camera.setParameters(params);
|
||||
toggleBtn.getDrawable().setColorFilter(Color.RED, PorterDuff.Mode.SRC_ATOP);
|
||||
toggleBtn.setBackground(getResources().getDrawable(R.mipmap.flashlight_big_off));
|
||||
}
|
||||
|
||||
private void releaseCamera() {
|
||||
|
@ -13,6 +13,5 @@
|
||||
<ImageView
|
||||
android:id="@+id/toggle_btn"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@mipmap/ic_launcher"/>
|
||||
android:layout_height="match_parent"/>
|
||||
</RelativeLayout>
|
||||
|
BIN
app/src/main/res/mipmap-hdpi/flashlight_big_off.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/mipmap-hdpi/flashlight_big_on.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/mipmap-mdpi/flashlight_big_off.png
Normal file
After Width: | Height: | Size: 836 B |
BIN
app/src/main/res/mipmap-mdpi/flashlight_big_on.png
Normal file
After Width: | Height: | Size: 821 B |
BIN
app/src/main/res/mipmap-xhdpi/flashlight_big_off.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
app/src/main/res/mipmap-xhdpi/flashlight_big_on.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/flashlight_big_off.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/flashlight_big_on.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/flashlight_big_off.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/flashlight_big_on.png
Normal file
After Width: | Height: | Size: 3.3 KiB |