diff --git a/app/src/main/java/com/polar/mirror/LowLightController.java b/app/src/main/java/com/polar/mirror/LowLightController.java index 42b13ce..7771ed9 100644 --- a/app/src/main/java/com/polar/mirror/LowLightController.java +++ b/app/src/main/java/com/polar/mirror/LowLightController.java @@ -2,25 +2,34 @@ import android.app.Activity; import android.content.Context; +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.ColorFilter; +import android.graphics.LightingColorFilter; +import android.graphics.Paint; import android.util.Log; import android.view.WindowManager; import androidx.camera.core.Preview; +import com.google.android.material.floatingactionbutton.FloatingActionButton; + /** * Implements logic of controlling low-light mode */ public class LowLightController { - private final Preview mCameraPreview; private final Activity mActivity; private float lastBrightness = 1; public boolean isLowLightModeEnabled = false; + private FloatingActionButton mLowLightModeButton; private static final String TAG = "LowLightController"; + private static final int WHITENING_VALUE = 128; - LowLightController(Activity activity, Preview cameraPreview){ - mCameraPreview = cameraPreview; + LowLightController(Activity activity, FloatingActionButton lowLightModeButton){ mActivity = activity; + mLowLightModeButton = lowLightModeButton; } private void enableLowLightMode(){ diff --git a/app/src/main/java/com/polar/mirror/MainActivity.java b/app/src/main/java/com/polar/mirror/MainActivity.java index 367ed23..2bd161d 100644 --- a/app/src/main/java/com/polar/mirror/MainActivity.java +++ b/app/src/main/java/com/polar/mirror/MainActivity.java @@ -57,7 +57,7 @@ protected void onCreate(Bundle savedInstanceState) { //Start camera try { startCamera(); - mLowLightController = new LowLightController(this, mPreview); + mLowLightController = new LowLightController(this); } catch (ExecutionException | InterruptedException e) { final String toastText = getString(R.string.can_not_start_camera); Toast.makeText(this, toastText, Toast.LENGTH_LONG).show(); diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index a0792d4..4dfe11b 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -7,4 +7,5 @@ Kliknij gdziekolwiek, aby wyświetlić menu akcji Brak dostępu do kamery Dostęp do kamery nie został przyznany. Użyj aplikacji Ustawienia, aby pryznać dostęp + Tryb ciemonści \ No newline at end of file diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 5f35490..d852169 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -6,4 +6,5 @@ Натиснить будь-де, аби знов показити меню дій Не вдалося отримати доступ до камери Доступ до камери не надано. Скористуйтесь застосунком Налаштування, аби надати доступ вручну + Режим пітьми \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2e4d4ef..b2db2fa 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -6,5 +6,5 @@ Tap anywhere to show actions again Can not access camera Camera permissions was not granted. Use Settings app to grant it. - Low-light mode + Dark mode \ No newline at end of file