diff --git a/README.md b/README.md
new file mode 100644
index 0000000..b2a81c7
--- /dev/null
+++ b/README.md
@@ -0,0 +1 @@
+# FlashDim
\ No newline at end of file
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..bd33508
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,65 @@
+plugins {
+ id 'com.android.application'
+ id 'kotlin-android'
+}
+
+android {
+// signingConfigs {
+// Properties properties = new Properties()
+// properties.load(project.rootProject.file('local.properties').newDataInputStream())
+//
+// signingConf1 {
+// storeFile file(properties.getProperty("signing.file"))
+// storePassword properties.getProperty("signing.password")
+// keyAlias properties.getProperty("signing.key1.alias")
+// keyPassword properties.getProperty("signing.key1.password")
+// }
+// signingConf2 {
+// storeFile file(properties.getProperty("signing.file"))
+// storePassword properties.getProperty("signing.password")
+// keyAlias properties.getProperty("signing.key2.alias")
+// keyPassword properties.getProperty("signing.key2.password")
+// }
+// }
+
+ compileSdk 33
+
+ defaultConfig {
+ applicationId "com.cyb3rko.flashdim"
+ minSdk 33
+ targetSdk 33
+ versionCode 1
+ versionName "1.0.0"
+ }
+ buildTypes {
+ debug {
+ versionNameSuffix "-debug"
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ releaseGP {
+ versionNameSuffix "-googleplay"
+ minifyEnabled true
+ shrinkResources true
+// signingConfig signingConfigs.signingConf1
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ releaseFD {
+ versionNameSuffix "-fdroid"
+ minifyEnabled true
+ shrinkResources true
+// signingConfig signingConfigs.signingConf2
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+ buildFeatures {
+ viewBinding true
+ }
+}
+
+dependencies {
+ implementation 'androidx.appcompat:appcompat:1.5.1'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
+ implementation 'androidx.core:core-ktx:1.9.0'
+ implementation 'com.google.android.material:material:1.8.0-alpha01'
+}
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..f1b4245
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..a5aa952
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/ic_launcher-playstore.png b/app/src/main/ic_launcher-playstore.png
new file mode 100644
index 0000000..10ab6a3
Binary files /dev/null and b/app/src/main/ic_launcher-playstore.png differ
diff --git a/app/src/main/java/com/cyb3rko/flashdim/App.kt b/app/src/main/java/com/cyb3rko/flashdim/App.kt
new file mode 100644
index 0000000..1c01b20
--- /dev/null
+++ b/app/src/main/java/com/cyb3rko/flashdim/App.kt
@@ -0,0 +1,11 @@
+package com.cyb3rko.flashdim
+
+import android.app.Application
+import com.google.android.material.color.DynamicColors
+
+class App : Application() {
+ override fun onCreate() {
+ DynamicColors.applyToActivitiesIfAvailable(this)
+ super.onCreate()
+ }
+}
diff --git a/app/src/main/java/com/cyb3rko/flashdim/MainActivity.kt b/app/src/main/java/com/cyb3rko/flashdim/MainActivity.kt
new file mode 100644
index 0000000..a44ccb9
--- /dev/null
+++ b/app/src/main/java/com/cyb3rko/flashdim/MainActivity.kt
@@ -0,0 +1,302 @@
+package com.cyb3rko.flashdim
+
+import android.annotation.SuppressLint
+import android.content.ClipData
+import android.content.ClipboardManager
+import android.content.Context
+import android.content.Intent
+import android.content.pm.PackageManager
+import android.hardware.camera2.CameraCharacteristics
+import android.hardware.camera2.CameraManager
+import android.net.Uri
+import android.os.Bundle
+import android.os.Handler
+import android.os.Looper
+import android.view.Menu
+import android.view.MenuItem
+import android.view.View
+import android.widget.Toast
+import androidx.appcompat.app.AppCompatActivity
+import com.cyb3rko.flashdim.databinding.ActivityMainBinding
+import com.cyb3rko.flashdim.seekbar.SeekBarChangeListener
+import com.google.android.material.dialog.MaterialAlertDialogBuilder
+import kotlin.math.roundToInt
+import kotlin.system.exitProcess
+
+class MainActivity : AppCompatActivity() {
+
+ private lateinit var binding: ActivityMainBinding
+
+ private val cameraId by lazy { cameraManager.cameraIdList[0] }
+ private val cameraManager by lazy { getSystemService(Context.CAMERA_SERVICE) as CameraManager }
+ private var currentLevel = -1
+ private var maxLevel = -1
+
+ private var sosActivated = false
+ private val sosHandler by lazy { Handler(Looper.getMainLooper()) }
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+
+ if (!doesDeviceHaveFlash()) {
+ setContentView(View(this))
+ MaterialAlertDialogBuilder(this)
+ .setCancelable(false)
+ .setTitle("Device not supported")
+ .setMessage("This device does not have a flash light.")
+ .setPositiveButton("Close") { _, _ ->
+ exitProcess(0)
+ }
+ .show()
+ return
+ }
+
+ binding = ActivityMainBinding.inflate(layoutInflater)
+ val view = binding.root
+ setContentView(view)
+
+ setSupportActionBar(binding.topAppBar)
+
+ val cameraInfo = cameraManager.getCameraCharacteristics(cameraId)
+ maxLevel = cameraInfo[CameraCharacteristics.FLASH_INFO_STRENGTH_MAXIMUM_LEVEL] ?: -1
+
+ if (maxLevel > 1) {
+ cameraManager.setTorchMode(cameraId, false)
+ binding.seekBar.apply {
+ maxProgress = maxLevel.toFloat()
+ onProgressChanged = object : SeekBarChangeListener {
+ override fun onProgressChanged(progress: Float) {
+ val progressInt = progress.roundToInt()
+ if (progressInt > 0) {
+ if (progressInt <= maxLevel) {
+ cameraManager.sendLightLevel(progressInt)
+ updateLightLevelView(progressInt)
+ currentLevel = progressInt
+ } else {
+ cameraManager.sendLightLevel(maxLevel)
+ updateLightLevelView(maxLevel)
+ currentLevel = progressInt
+ }
+ } else if (progressInt == 0) {
+ cameraManager.setTorchMode(cameraId, false)
+ updateLightLevelView(0)
+ currentLevel = 0
+ }
+ }
+ }
+ }
+ updateLightLevelView(0)
+ } else {
+ switchToSimpleMode()
+ }
+ }
+
+ override fun onPostCreate(savedInstanceState: Bundle?) {
+ super.onPostCreate(savedInstanceState)
+ if (!doesDeviceHaveFlash()) return
+ binding.apply {
+ sosButton.setOnClickListener {
+ sosButton.disable()
+ sosActivated = true
+ cameraManager.setTorchMode(cameraId, false)
+ seekBar.setProgress(0)
+ updateLightLevelView(0, " (SOS)")
+ maxButton.hide()
+ halfButton.hide()
+ minButton.hide()
+ seekBar.disable()
+ handleSosCall()
+ }
+ maxButton.setOnClickListener {
+ if (isDimAllowed()) {
+ updateLightLevelView(maxLevel)
+ cameraManager.sendLightLevel(maxLevel)
+ currentLevel = maxLevel
+ seekBar.setProgress(maxLevel)
+ } else {
+ cameraManager.setTorchMode(cameraId, true)
+ }
+ }
+ halfButton.setOnClickListener {
+ updateLightLevelView(maxLevel / 2)
+ cameraManager.sendLightLevel(maxLevel / 2)
+ currentLevel = maxLevel / 2
+ seekBar.setProgress(maxLevel / 2)
+ }
+ minButton.setOnClickListener {
+ updateLightLevelView(1)
+ cameraManager.sendLightLevel(1)
+ currentLevel = 1
+ seekBar.setProgress(1)
+ }
+ offButton.setOnClickListener {
+ val dimAllowed = isDimAllowed()
+ if (sosActivated) {
+ sosHandler.removeCallbacksAndMessages(null)
+ sosActivated = false
+ binding.apply {
+ maxButton.show()
+ sosButton.enable()
+ if (dimAllowed) {
+ halfButton.show()
+ minButton.show()
+ seekBar.enable()
+ }
+ }
+ }
+ if (dimAllowed) {
+ updateLightLevelView(0)
+ currentLevel = 0
+ seekBar.setProgress(0)
+ }
+ cameraManager.setTorchMode(cameraId, false)
+ }
+ }
+ }
+
+ @SuppressLint("SetTextI18n")
+ private fun switchToSimpleMode() {
+ binding.apply {
+ buttonContainer.setPadding(0, 24, 64, 24)
+ maxButton.text = "On"
+ halfButton.hide()
+ minButton.hide()
+ seekBar.hide()
+ levelIndicatorDesc.makeInvisible()
+ levelIndicator.makeInvisible()
+ errorView.text = "This evice only supports 1 light level.\nDim feature deactivated."
+ errorView.show()
+ quickActionsView.hide()
+ }
+ }
+
+ @SuppressLint("SetTextI18n")
+ private fun updateLightLevelView(level: Int, note: String = "") {
+ binding.levelIndicator.text = "$level / $maxLevel$note"
+ }
+
+ private fun CameraManager.sendLightLevel(level: Int) {
+ if (currentLevel != level) {
+ turnOnTorchWithStrengthLevel(cameraId, level)
+ }
+ }
+
+ private fun isDimAllowed() = binding.maxButton.text == "Maximum"
+
+ private fun handleSosCall() {
+ if (!sosActivated) return
+ val t = 250L
+ val runnableOn = Runnable {
+ cameraManager.setTorchMode(cameraId, true)
+ updateLightLevelView(maxLevel, " (SOS)")
+ binding.seekBar.setProgress(maxLevel)
+ }
+ val runnableOff = Runnable {
+ cameraManager.setTorchMode(cameraId, false)
+ updateLightLevelView(0, " (SOS)")
+ binding.seekBar.setProgress(0)
+ }
+ val runnableFinishRound = Runnable {
+ handleSosCall()
+ }
+
+ handleSosS(runnableOn, runnableOff, t, 4 * t)
+ handleSosO(runnableOn, runnableOff, t, 12 * t)
+ handleSosS(runnableOn, runnableOff, t, 26 * t)
+ finishSosRound(runnableFinishRound, 34 * t)
+ }
+
+ private fun handleSosS(on: Runnable, off: Runnable, t: Long, offset: Long) {
+ sosHandler.postDelayed(on, 3 * t + offset)
+ sosHandler.postDelayed(off, 4 * t + offset)
+ sosHandler.postDelayed(on, 5 * t + offset)
+ sosHandler.postDelayed(off, 6 * t + offset)
+ sosHandler.postDelayed(on, 7 * t + offset)
+ sosHandler.postDelayed(off, 8 * t + offset)
+ }
+
+ private fun handleSosO(on: Runnable, off: Runnable, t: Long, offset: Long) {
+ sosHandler.postDelayed(on, 3 * t + offset)
+ sosHandler.postDelayed(off, 6 * t + offset)
+ sosHandler.postDelayed(on, 7 * t + offset)
+ sosHandler.postDelayed(off, 10 * t + offset)
+ sosHandler.postDelayed(on, 11 * t + offset)
+ sosHandler.postDelayed(off, 14 * t + offset)
+ }
+
+ private fun finishSosRound(r: Runnable, offset: Long) {
+ sosHandler.postDelayed(r, offset)
+ }
+
+ private fun doesDeviceHaveFlash(): Boolean {
+ return packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH)
+ }
+
+
+
+ override fun onCreateOptionsMenu(menu: Menu): Boolean {
+ menuInflater.inflate(R.menu.menu, menu)
+ return true
+ }
+
+ override fun onOptionsItemSelected(item: MenuItem): Boolean {
+ when (item.itemId) {
+ R.id.icon_credits_action -> {
+ MaterialAlertDialogBuilder(this)
+ .setTitle("Icon Credits")
+ .setMessage("Flashlight icon created by Freepik - Flaticon\n\n" +
+ "Knob icon created by Debi Alpa Nugraha - Flaticon")
+ .setPositiveButton("Open Flaticon") { _, _ ->
+ openURL("https://flaticon.com")
+ }
+ .show()
+ return true
+ }
+ R.id.github_action -> {
+ openURL("https://github.com/cyb3rko/flashdim")
+ return true
+ }
+ }
+ return super.onOptionsItemSelected(item)
+ }
+
+ private fun View.disable() {
+ this.isEnabled = false
+ }
+
+ private fun View.enable() {
+ this.isEnabled = true
+ }
+
+ private fun View.hide() {
+ this.visibility = View.GONE
+ }
+
+ private fun View.makeInvisible() {
+ this.visibility = View.INVISIBLE
+ }
+
+ private fun View.show() {
+ this.visibility = View.VISIBLE
+ }
+
+ private fun openURL(url: String) {
+ try {
+ val intent = Intent(
+ Intent.ACTION_VIEW,
+ Uri.parse(url)
+ )
+ startActivity(intent)
+ } catch (e: Exception) {
+ e.printStackTrace()
+ val clip = ClipData.newPlainText("Flaticon", url)
+ (getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager)
+ .setPrimaryClip(clip)
+ Toast.makeText(
+ this,
+ "Opening URL failed, copied URL instead",
+ Toast.LENGTH_SHORT
+ ).show()
+ }
+ }
+}
diff --git a/app/src/main/java/com/cyb3rko/flashdim/seekbar/LightLevelSeekBar.kt b/app/src/main/java/com/cyb3rko/flashdim/seekbar/LightLevelSeekBar.kt
new file mode 100644
index 0000000..c7f46a7
--- /dev/null
+++ b/app/src/main/java/com/cyb3rko/flashdim/seekbar/LightLevelSeekBar.kt
@@ -0,0 +1,150 @@
+package com.cyb3rko.flashdim.seekbar
+
+import android.content.Context
+import android.graphics.*
+import android.util.AttributeSet
+import android.util.TypedValue
+import android.view.MotionEvent
+import android.view.View
+import com.cyb3rko.flashdim.R
+import kotlin.math.roundToInt
+
+open class LightLevelSeekBar @JvmOverloads constructor(
+ context: Context,
+ attrs: AttributeSet? = null,
+ defStyleAttr: Int = 0
+) : View(context, attrs, defStyleAttr) {
+
+ private var mCanvasWidth = 0
+ private var mCanvasHeight = 0
+ private val mWavePaint = Paint(Paint.ANTI_ALIAS_FLAG)
+ private val mWaveRect = RectF()
+ private lateinit var progressBitmap: Bitmap
+
+ var onProgressChanged: SeekBarChangeListener? = null
+
+ var maxProgress: Float = 1F
+ set(value) {
+ field = value
+ progress = value
+ invalidate()
+ }
+
+ private var progress: Float = 0F
+ set(value) {
+ field = value
+ invalidate()
+ }
+
+ private var levelBackgroundColor: Int = Color.LTGRAY
+
+ private var levelProgressColor: Int = Color.WHITE
+
+ private var levelGap: Float = calculateDp(2)
+
+ private var levelCornerRadius: Float = calculateDp(4)
+
+ init {
+ val typedArray = context.obtainStyledAttributes(attrs, R.styleable.LightLevelSeekBar)
+ levelBackgroundColor = typedArray.getColor(
+ R.styleable.LightLevelSeekBar_level_background_color, levelBackgroundColor
+ )
+ levelCornerRadius = typedArray.getDimension(
+ R.styleable.LightLevelSeekBar_level_corner_radius, levelCornerRadius
+ )
+ levelGap = typedArray.getDimension(R.styleable.LightLevelSeekBar_level_gap, levelGap)
+ levelProgressColor = typedArray.getColor(
+ R.styleable.LightLevelSeekBar_level_progress_color, levelProgressColor
+ )
+ typedArray.recycle()
+ }
+
+ override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
+ super.onSizeChanged(w, h, oldw, oldh)
+ mCanvasWidth = w
+ mCanvasHeight = h
+ progressBitmap =
+ Bitmap.createBitmap(getAvailableWidth(), getAvailableHeight(), Bitmap.Config.ARGB_8888)
+ }
+
+ override fun onDraw(canvas: Canvas) {
+ super.onDraw(canvas)
+ canvas.clipRect(
+ paddingLeft,
+ paddingTop,
+ mCanvasWidth - paddingRight,
+ mCanvasHeight - paddingBottom
+ )
+ val availableWidth = getAvailableWidth()
+ val availableHeight = getAvailableHeight()
+ val totalWaveHeight = availableHeight / maxProgress
+ val waveHeight = totalWaveHeight - levelGap
+
+ var previousWaveBottom = paddingTop.toFloat()
+
+ val progressYPosition: Float = availableHeight * progress / maxProgress
+
+ for (i in 0 until maxProgress.roundToInt()) {
+ mWaveRect.set(
+ paddingLeft.toFloat(),
+ previousWaveBottom,
+ availableWidth.toFloat() + paddingRight.toFloat(),
+ previousWaveBottom + waveHeight
+ )
+ if (mWaveRect.centerY() <= progressYPosition) {
+ mWavePaint.color = levelBackgroundColor
+ } else {
+ mWavePaint.color = levelProgressColor
+ }
+ canvas.drawRoundRect(mWaveRect, levelCornerRadius, levelCornerRadius, mWavePaint)
+ previousWaveBottom = mWaveRect.bottom + levelGap
+ }
+ }
+
+ private fun updateProgress(event: MotionEvent) {
+ progress = getRawProgress(event)
+ onProgressChanged?.onProgressChanged(maxProgress - progress)
+ }
+
+ private fun getRawProgress(event: MotionEvent) = maxProgress * event.y / getAvailableHeight()
+
+ internal fun setProgress(progress: Int) {
+ this.progress = maxProgress - progress
+ }
+
+ private fun getAvailableWidth(): Int {
+ var width = mCanvasWidth - paddingLeft - paddingRight
+ if (width <= 0) width = 1
+ return width
+ }
+
+ private fun getAvailableHeight(): Int {
+ var height = mCanvasHeight - paddingTop - paddingBottom
+ if (height <= 0) height = 1
+ return height
+ }
+
+ override fun onTouchEvent(event: MotionEvent?): Boolean {
+ if (!isEnabled)
+ return false
+
+ event?.let {
+ updateProgress(it)
+ performClick()
+ }
+ return true
+ }
+
+ override fun performClick(): Boolean {
+ super.performClick()
+ return true
+ }
+
+ private fun calculateDp(dp: Int): Float {
+ return TypedValue.applyDimension(
+ TypedValue.COMPLEX_UNIT_DIP,
+ dp.toFloat(),
+ resources.displayMetrics
+ )
+ }
+}
diff --git a/app/src/main/java/com/cyb3rko/flashdim/seekbar/SeekBarChangeListener.kt b/app/src/main/java/com/cyb3rko/flashdim/seekbar/SeekBarChangeListener.kt
new file mode 100644
index 0000000..b72f8c2
--- /dev/null
+++ b/app/src/main/java/com/cyb3rko/flashdim/seekbar/SeekBarChangeListener.kt
@@ -0,0 +1,5 @@
+package com.cyb3rko.flashdim.seekbar
+
+interface SeekBarChangeListener {
+ fun onProgressChanged(progress: Float)
+}
diff --git a/app/src/main/res/drawable/ic_github.xml b/app/src/main/res/drawable/ic_github.xml
new file mode 100644
index 0000000..74eb8dd
--- /dev/null
+++ b/app/src/main/res/drawable/ic_github.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..51b6eab
--- /dev/null
+++ b/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,171 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/menu/menu.xml b/app/src/main/res/menu/menu.xml
new file mode 100644
index 0000000..0bfb637
--- /dev/null
+++ b/app/src/main/res/menu/menu.xml
@@ -0,0 +1,20 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 0000000..036d09b
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
new file mode 100644
index 0000000..036d09b
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..caf4673
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..b264293
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 0000000..8c5e11b
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..596c99b
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..5cbb73e
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 0000000..8821f7a
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..23864b5
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..72711a6
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..21b6dfd
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..7a260ae
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..5f14ca8
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..ea788a6
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..429a051
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..e59a32b
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..409ff94
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml
new file mode 100644
index 0000000..ede77b9
--- /dev/null
+++ b/app/src/main/res/values/attrs.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/ic_launcher_background.xml b/app/src/main/res/values/ic_launcher_background.xml
new file mode 100644
index 0000000..beab31f
--- /dev/null
+++ b/app/src/main/res/values/ic_launcher_background.xml
@@ -0,0 +1,4 @@
+
+
+ #000000
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..bfe4d80
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+
+ FlashDim
+
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..cf73f75
--- /dev/null
+++ b/app/src/main/res/values/styles.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..28861b5
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,8 @@
+plugins {
+ id 'com.android.application' version '7.3.1' apply false
+ id 'org.jetbrains.kotlin.android' version '1.7.10' apply false
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..3c7a8bd
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,23 @@
+# Project-wide Gradle settings.
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
+# AndroidX package structure to make it clearer which packages are bundled with the
+# Android operating system, and which are packaged with your app"s APK
+# https://developer.android.com/topic/libraries/support-library/androidx-rn
+android.useAndroidX=true
+# Kotlin code style for this project: "official" or "obsolete":
+kotlin.code.style=official
+# Enables namespacing of each library's R class so that its R class includes only the
+# resources declared in the library itself and none from the library's dependencies,
+# thereby reducing the size of the R class for that library
+android.nonTransitiveRClass=true
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..f6b961f
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..311bd9e
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Fri Apr 15 19:03:18 IRDT 2022
+distributionBase=GRADLE_USER_HOME
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
+distributionPath=wrapper/dists
+zipStorePath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
diff --git a/gradlew b/gradlew
new file mode 100644
index 0000000..cccdd3d
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..f955316
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..7aabc90
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1,15 @@
+pluginManagement {
+ repositories {
+ gradlePluginPortal()
+ google()
+ }
+}
+dependencyResolutionManagement {
+ repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+ repositories {
+ google()
+ mavenCentral()
+ }
+}
+rootProject.name = "FlashDim"
+include ':app'