Showing with 2,043 additions and 1,569 deletions.
  1. +0 −24 .idea/kotlinScripting.xml
  2. +8 −8 app/build.gradle.kts
  3. +9 −6 app/src/main/AndroidManifest.xml
  4. +2 −0 app/src/main/java/app/grapheneos/camera/App.kt
  5. +1 −1 app/src/main/java/app/grapheneos/camera/BlurBitmap.kt
  6. +43 −27 app/src/main/java/app/grapheneos/camera/CamConfig.kt
  7. +2 −1 app/src/main/java/app/grapheneos/camera/CapturedItems.kt
  8. +23 −9 app/src/main/java/app/grapheneos/camera/capturer/ImageCapturer.kt
  9. +11 −1 app/src/main/java/app/grapheneos/camera/capturer/ImageSaver.kt
  10. +20 −0 app/src/main/java/app/grapheneos/camera/capturer/VideoCapturer.kt
  11. +43 −39 app/src/main/java/app/grapheneos/camera/notifier/SensorOrientationChangeNotifier.kt
  12. +27 −0 app/src/main/java/app/grapheneos/camera/ui/DialogUtil.kt
  13. +108 −38 app/src/main/java/app/grapheneos/camera/ui/SettingsDialog.kt
  14. +4 −4 app/src/main/java/app/grapheneos/camera/ui/ZoomableImageView.kt
  15. +79 −19 app/src/main/java/app/grapheneos/camera/ui/activities/InAppGallery.kt
  16. +76 −50 app/src/main/java/app/grapheneos/camera/ui/activities/MainActivity.kt
  17. +26 −7 app/src/main/java/app/grapheneos/camera/ui/activities/MoreSettings.kt
  18. +64 −3 app/src/main/java/app/grapheneos/camera/ui/activities/VideoPlayer.kt
  19. +3 −10 app/src/main/java/app/grapheneos/camera/util/BitmapUtils.kt
  20. +1 −1 app/src/main/res/drawable/aspect_ratio.xml
  21. +10 −0 app/src/main/res/drawable/back.xml
  22. +10 −0 app/src/main/res/drawable/back_white.xml
  23. +1 −1 app/src/main/res/drawable/camera_shutter_normal.xml
  24. +1 −1 app/src/main/res/drawable/camera_shutter_pressed.xml
  25. +0 −2 app/src/main/res/drawable/delete.xml
  26. +1 −1 app/src/main/res/drawable/dropdown.xml
  27. +1 −1 app/src/main/res/drawable/exposure_neg.xml
  28. +1 −1 app/src/main/res/drawable/exposure_plus.xml
  29. +1 −1 app/src/main/res/drawable/flash_auto.xml
  30. +1 −1 app/src/main/res/drawable/flash_auto_circle.xml
  31. +1 −1 app/src/main/res/drawable/flash_off.xml
  32. +1 −1 app/src/main/res/drawable/flash_off_circle.xml
  33. +2 −2 app/src/main/res/drawable/flash_on.xml
  34. +1 −1 app/src/main/res/drawable/flash_on_circle.xml
  35. +1 −2 app/src/main/res/drawable/folder.xml
  36. +1 −0 app/src/main/res/drawable/grid_3x3.xml
  37. +1 −1 app/src/main/res/drawable/grid_3x3_circle.xml
  38. +1 −2 app/src/main/res/drawable/grid_4x4.xml
  39. +1 −1 app/src/main/res/drawable/grid_4x4_circle.xml
  40. +1 −0 app/src/main/res/drawable/grid_goldenratio.xml
  41. +1 −1 app/src/main/res/drawable/grid_goldenratio_circle.xml
  42. +1 −1 app/src/main/res/drawable/grid_off.xml
  43. +1 −1 app/src/main/res/drawable/grid_off_circle.xml
  44. +1 −2 app/src/main/res/drawable/image_quality.xml
  45. +1 −2 app/src/main/res/drawable/info_adaptable.xml
  46. +2 −2 app/src/main/res/drawable/location.xml
  47. +1 −1 app/src/main/res/drawable/location_off.xml
  48. +1 −1 app/src/main/res/drawable/location_on.xml
  49. +9 −5 app/src/main/res/drawable/mic_off.xml
  50. +10 −0 app/src/main/res/drawable/mic_on.xml
  51. +1 −8 app/src/main/res/drawable/mode_indicator.xml
  52. +9 −0 app/src/main/res/drawable/more.xml
  53. +1 −1 app/src/main/res/drawable/option_circle.xml
  54. +1 −1 app/src/main/res/drawable/qr_result_background.xml
  55. +1 −2 app/src/main/res/drawable/refresh.xml
  56. +0 −2 app/src/main/res/drawable/retake.xml
  57. +1 −2 app/src/main/res/drawable/selfie_preview.xml
  58. +3 −7 app/src/main/res/drawable/settings_bg.xml
  59. +1 −1 app/src/main/res/drawable/settings_normal.xml
  60. +1 −1 app/src/main/res/drawable/settings_pressed.xml
  61. +4 −0 app/src/main/res/drawable/shade.xml
  62. +1 −1 app/src/main/res/drawable/share.xml
  63. +1 −1 app/src/main/res/drawable/{share_grey.xml → share_white.xml}
  64. +1 −2 app/src/main/res/drawable/storage.xml
  65. +2 −3 app/src/main/res/drawable/straighten.xml
  66. +2 −2 app/src/main/res/drawable/torch.xml
  67. +2 −4 app/src/main/res/drawable/torch_off.xml
  68. +5 −5 app/src/main/res/drawable/torch_off_button.xml
  69. +10 −0 app/src/main/res/drawable/torch_off_white.xml
  70. +2 −3 app/src/main/res/drawable/torch_on.xml
  71. +4 −4 app/src/main/res/drawable/torch_on_button.xml
  72. +10 −0 app/src/main/res/drawable/torch_on_white.xml
  73. +1 −2 app/src/main/res/drawable/volume_up.xml
  74. +1 −1 app/src/main/res/drawable/white_option_circle.xml
  75. +1 −2 app/src/main/res/drawable/zsl.xml
  76. +48 −8 app/src/main/res/layout/activity_main.xml
  77. +13 −1 app/src/main/res/layout/gallery.xml
  78. +584 −585 app/src/main/res/layout/more_settings.xml
  79. +4 −4 app/src/main/res/layout/scan_result_dialog.xml
  80. +71 −34 app/src/main/res/layout/settings.xml
  81. +8 −3 app/src/main/res/layout/video_player.xml
  82. +1 −1 app/src/main/res/menu/gallery.xml
  83. +0 −4 app/src/main/res/values-night/colors.xml
  84. +0 −7 app/src/main/res/values-night/themes.xml
  85. +3 −7 app/src/main/res/values/colors.xml
  86. +9 −1 app/src/main/res/values/dimens.xml
  87. +6 −1 app/src/main/res/values/strings.xml
  88. +27 −11 app/src/main/res/values/themes.xml
  89. +3 −5 build.gradle.kts
  90. +582 −556 gradle/verification-metadata.xml
  91. BIN gradle/wrapper/gradle-wrapper.jar
  92. +2 −2 gradle/wrapper/gradle-wrapper.properties
24 changes: 0 additions & 24 deletions .idea/kotlinScripting.xml

This file was deleted.

16 changes: 8 additions & 8 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ if (useKeystoreProperties) {
plugins {
id("com.android.application")
kotlin("android")
kotlin("kapt")
}

java {
Expand All @@ -28,6 +27,7 @@ android {
storePassword = keystoreProperties["storePassword"] as String
keyAlias = keystoreProperties["keyAlias"] as String
keyPassword = keystoreProperties["keyPassword"] as String
enableV4Signing = true
}

create("play") {
Expand All @@ -39,17 +39,17 @@ android {
}
}

compileSdk = 34
compileSdk = 35
buildToolsVersion = "35.0.0"
ndkVersion = "26.3.11579264"
ndkVersion = "27.2.12479018"

namespace = "app.grapheneos.camera"

defaultConfig {
applicationId = "app.grapheneos.camera"
minSdk = 29
targetSdk = 34
versionCode = 74
targetSdk = 35
versionCode = 75
versionName = versionCode.toString()
resourceConfigurations.add("en")
}
Expand Down Expand Up @@ -93,10 +93,10 @@ android {
dependencies {
implementation("androidx.appcompat:appcompat:1.7.0")
implementation("com.google.android.material:material:1.12.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("androidx.core:core:1.13.1")
implementation("androidx.constraintlayout:constraintlayout:2.2.0")
implementation("androidx.core:core:1.15.0")

val cameraVersion = "1.4.0-beta02"
val cameraVersion = "1.5.0-alpha04"
implementation("androidx.camera:camera-core:$cameraVersion")
implementation("androidx.camera:camera-camera2:$cameraVersion")
implementation("androidx.camera:camera-lifecycle:$cameraVersion")
Expand Down
15 changes: 9 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.App"
android:enableOnBackInvokedCallback="true"
tools:ignore="UnusedAttribute">

<!-- The main activity of the app (supports all modes) -->
Expand All @@ -38,7 +39,8 @@
android:configChanges="orientation|keyboardHidden|screenSize"
android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
android:screenOrientation="nosensor"
android:exported="true">
android:exported="true"
android:theme="@style/Theme.Camera">

<intent-filter>
<action android:name="android.intent.action.MAIN"/>
Expand Down Expand Up @@ -71,7 +73,8 @@
android:screenOrientation="nosensor"
android:showWhenLocked="true"
android:excludeFromRecents="true"
android:exported="true">
android:exported="true"
android:theme="@style/Theme.Camera">

<intent-filter>
<action android:name="android.media.action.STILL_IMAGE_CAMERA_SECURE"/>
Expand Down Expand Up @@ -159,28 +162,28 @@

<activity
android:name=".ui.activities.VideoPlayer"
android:theme="@style/OverlayActionBar"
android:theme="@style/Theme.Viewer"
android:taskAffinity=".ui.activities.VideoPlayer"
android:excludeFromRecents="true"
android:exported="false"/>

<activity
android:name=".ui.activities.InAppGallery"
android:theme="@style/OverlayActionBar"
android:theme="@style/Theme.Viewer"
android:taskAffinity=".ui.activities.InAppGallery"
android:excludeFromRecents="true"
android:exported="false"/>

<activity
android:name=".ui.activities.MoreSettings"
android:theme="@style/OverlayActionBar"
android:theme="@style/Theme.App"
android:taskAffinity=".ui.activities.InAppGallery"
android:excludeFromRecents="true"
android:exported="false"/>

<activity
android:name=".ui.activities.MoreSettingsSecure"
android:theme="@style/OverlayActionBar"
android:theme="@style/Theme.App"
android:taskAffinity=".ui.activities.InAppGallery"
android:excludeFromRecents="true"
android:showWhenLocked="true"
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/app/grapheneos/camera/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import android.view.WindowManager
import androidx.annotation.RequiresPermission
import androidx.appcompat.app.AppCompatActivity
import app.grapheneos.camera.ui.activities.MainActivity
import com.google.android.material.color.DynamicColors

class App : Application() {
private var activity: MainActivity? = null
Expand Down Expand Up @@ -91,6 +92,7 @@ class App : Application() {
override fun onCreate() {
super.onCreate()
registerActivityLifecycleCallbacks(activityLifeCycleHelper)
DynamicColors.applyToActivitiesIfAvailable(this)
}

@RequiresPermission(allOf = [Manifest.permission.ACCESS_COARSE_LOCATION])
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/app/grapheneos/camera/BlurBitmap.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ object BlurBitmap {
val width = (sentBitmap.width * 0.1f).roundToInt()
val height = (sentBitmap.height * 0.1f).roundToInt()
sentBitmap = Bitmap.createScaledBitmap(sentBitmap, width, height, false)
val bitmap = sentBitmap.copy(sentBitmap.config, true)
val bitmap = sentBitmap.copy(sentBitmap.config!!, true)
val w = bitmap.width
val h = bitmap.height
val pix = IntArray(w * h)
Expand Down
70 changes: 43 additions & 27 deletions app/src/main/java/app/grapheneos/camera/CamConfig.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package app.grapheneos.camera

import android.annotation.SuppressLint
import android.app.AlertDialog
import android.content.Context
import android.content.SharedPreferences
import android.net.Uri
Expand All @@ -16,6 +15,7 @@ import android.view.animation.Animation
import android.view.animation.LinearInterpolator
import android.widget.Button
import androidx.annotation.StringRes
import androidx.appcompat.app.AlertDialog
import androidx.camera.core.AspectRatio
import androidx.camera.core.Camera
import androidx.camera.core.CameraInfo
Expand Down Expand Up @@ -47,7 +47,9 @@ import app.grapheneos.camera.ui.activities.SecureActivity
import app.grapheneos.camera.ui.activities.SecureMainActivity
import app.grapheneos.camera.ui.activities.VideoCaptureActivity
import app.grapheneos.camera.ui.activities.VideoOnlyActivity
import app.grapheneos.camera.ui.showIgnoringShortEdgeMode
import app.grapheneos.camera.util.edit
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.zxing.BarcodeFormat
import java.util.concurrent.ExecutionException
import java.util.concurrent.Executors
Expand Down Expand Up @@ -951,7 +953,6 @@ class CamConfig(private val mActivity: MainActivity) {
startCamera(true)
}

@SuppressLint("RestrictedApi")
private fun getCurrentCameraInfo() : CameraInfo {
return cameraProvider!!.getCameraInfo(cameraSelector)
}
Expand Down Expand Up @@ -1049,6 +1050,9 @@ class CamConfig(private val mActivity: MainActivity) {
fun startCamera(forced: Boolean = false) {
if ((!forced && camera != null) || cameraProvider == null) return

// Cancel any pending capture requests
mActivity.imageCapturer.cancelPendingCaptureRequest()

mActivity.exposureBar.hidePanel()
modePref = mActivity.getSharedPreferences(currentMode.name, Context.MODE_PRIVATE)

Expand Down Expand Up @@ -1450,7 +1454,7 @@ class CamConfig(private val mActivity: MainActivity) {
}

fun showMoreOptionsForQR() {
val builder = AlertDialog.Builder(mActivity)
val builder = MaterialAlertDialogBuilder(mActivity)
builder.setTitle(mActivity.resources.getString(R.string.more_options))

val optionNames = arrayListOf<String>()
Expand Down Expand Up @@ -1481,6 +1485,25 @@ class CamConfig(private val mActivity: MainActivity) {
// Add OK and Cancel buttons
builder.setPositiveButton(getString(R.string.ok)) { _, _ ->

val allCommonFormatsDisabled = commonFormats.none {
allowedFormats.contains(it)
}

// If all formats displayed outside the dialog are disabled (main QR scanner
// UI)
if (allCommonFormatsDisabled) {
val noOptionWasChecked = optionValues.none { it }

// If no option is selected within the check box too (implying no barcode format
// is selected at all) - don't make apply the selction made by the user
if (noOptionWasChecked) {
mActivity.showMessage(
getString(R.string.no_barcode_selected)
)
return@setPositiveButton
}
}

commonPref.edit {
for (index in 0 until optionNames.size) {

Expand All @@ -1492,20 +1515,13 @@ class CamConfig(private val mActivity: MainActivity) {
val format = BarcodeFormat.valueOf(optionName)

if (optionValue) {
allowedFormats.add(format)

putBoolean(formatSRep, true)
} else if (format in allowedFormats) {
if (allowedFormats.size == 1) {
mActivity.showMessage(
getString(R.string.no_barcode_selected)
)
} else {
allowedFormats.remove(format)

putBoolean(formatSRep, false)
}
if (format !in allowedFormats)
allowedFormats.add(format)
} else {
allowedFormats.remove(format)
}

putBoolean(formatSRep, optionValue)
}
}

Expand All @@ -1518,28 +1534,28 @@ class CamConfig(private val mActivity: MainActivity) {
val dialog = builder.create()

dialog.setOnShowListener {
val button: Button = (dialog as AlertDialog).getButton(AlertDialog.BUTTON_NEUTRAL)
val button: Button = dialog.getButton(AlertDialog.BUTTON_NEUTRAL)
button.setOnClickListener {

}
}

dialog.show()
dialog.showIgnoringShortEdgeMode()
}

fun onStorageLocationNotFound() {
// Reverting back to DEFAULT_MEDIA_STORE_CAPTURE_PATH
storageLocation = SettingValues.Default.STORAGE_LOCATION

val builder = AlertDialog.Builder(mActivity)
builder.setTitle(R.string.folder_not_found)
builder.setMessage(R.string.reverting_to_default_folder)
builder.setPositiveButton(R.string.ok, null)
builder.setNeutralButton(R.string.more_settings) { _, _ ->
MoreSettings.start(mActivity)
}
val alertDialog: AlertDialog = builder.create()
val builder = MaterialAlertDialogBuilder(mActivity)
.setTitle(R.string.folder_not_found)
.setMessage(R.string.reverting_to_default_folder)
.setPositiveButton(R.string.ok, null)
.setNeutralButton(R.string.more_settings) { _, _ ->
MoreSettings.start(mActivity)
}
val alertDialog = builder.create()
alertDialog.setCancelable(false)
alertDialog.show()
alertDialog.showIgnoringShortEdgeMode()
}
}
3 changes: 2 additions & 1 deletion app/src/main/java/app/grapheneos/camera/CapturedItems.kt
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ object CapturedItems {
list.add(0, treeUri)

while (list.size > MAX_NUMBER_OF_TRACKED_PREVIOUS_SAF_TREES) {
list.removeLast()
// list.removeLast() requires API level 35 now due to Java adding it
list.removeAt(list.lastIndex)
}

prefs.edit {
Expand Down
Loading