From 90728454f6c1d64ec80bef0a40cd52f51dd836fe Mon Sep 17 00:00:00 2001 From: MHShetty Date: Fri, 30 May 2025 03:28:56 +0530 Subject: [PATCH 1/8] Fix snackbar not being visible when keyboard is present (in more settings screen/page) --- app/src/main/AndroidManifest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 36985190..14c2c184 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -185,6 +185,7 @@ android:theme="@style/Theme.App" android:taskAffinity=".ui.activities.InAppGallery" android:excludeFromRecents="true" + android:windowSoftInputMode="adjustResize" android:exported="false"/> Date: Fri, 30 May 2025 23:29:43 +0530 Subject: [PATCH 2/8] Add string resources (for video bitrate setting UI) --- app/src/main/res/values/strings.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9aa6ae1e..fb09ecbe 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -193,4 +193,11 @@ The video\'s audio recording has been muted The video\'s audio recording has been unmuted + + Video bitrate was set to auto mode + Video Bitrate + Adjust the video bitrate of a video recording to a specified bitrate. The specified value will be taken as a hint and may not be the exact video rate at all times while recording. + Reset video bitrate + Video bitrate can only be between %1$d %2$s and %3$d %4$s + Unit From 0f327a80e509378b609f86d21cb4d115596f6fb3 Mon Sep 17 00:00:00 2001 From: MHShetty Date: Fri, 30 May 2025 23:30:06 +0530 Subject: [PATCH 3/8] Add icon for video bitrate setting --- app/src/main/res/drawable/video_bitrate.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 app/src/main/res/drawable/video_bitrate.xml diff --git a/app/src/main/res/drawable/video_bitrate.xml b/app/src/main/res/drawable/video_bitrate.xml new file mode 100644 index 00000000..16655a46 --- /dev/null +++ b/app/src/main/res/drawable/video_bitrate.xml @@ -0,0 +1,13 @@ + + + + + From 7ddd82a054fd22e415eb760a2d922fe7da3e6af8 Mon Sep 17 00:00:00 2001 From: MHShetty Date: Sat, 31 May 2025 03:12:48 +0530 Subject: [PATCH 4/8] Update logic of existing input number filter classes * Add a class CustomNumFilter that ensures only number is present on the field the filter is applied to * Use the custom CustomNumFilter for NumInputFilter (old) or now NumLimFilter (new) class * Shift the two input filter classes to a separate package (app.grapheneos.camera.inputfilter) --- .../app/grapheneos/camera/NumInputFilter.kt | 42 ------------------- .../camera/inputfilter/CustomNumFilter.kt | 36 ++++++++++++++++ .../camera/inputfilter/NumLimitFilter.kt | 19 +++++++++ 3 files changed, 55 insertions(+), 42 deletions(-) delete mode 100644 app/src/main/java/app/grapheneos/camera/NumInputFilter.kt create mode 100644 app/src/main/java/app/grapheneos/camera/inputfilter/CustomNumFilter.kt create mode 100644 app/src/main/java/app/grapheneos/camera/inputfilter/NumLimitFilter.kt diff --git a/app/src/main/java/app/grapheneos/camera/NumInputFilter.kt b/app/src/main/java/app/grapheneos/camera/NumInputFilter.kt deleted file mode 100644 index 793f9bb6..00000000 --- a/app/src/main/java/app/grapheneos/camera/NumInputFilter.kt +++ /dev/null @@ -1,42 +0,0 @@ -package app.grapheneos.camera - -import android.text.InputFilter -import android.text.Spanned -import app.grapheneos.camera.ui.activities.MoreSettings - -class NumInputFilter(private val settings: MoreSettings) : InputFilter { - - override fun filter( - source: CharSequence, - start: Int, - end: Int, - dest: Spanned, - dstart: Int, - dend: Int - ): CharSequence? { - try { - val input = (dest.subSequence(0, dstart).toString() + source + dest.subSequence( - dend, - dest.length - )).toInt() - if (isInRange(input)) { - return null - } else { - settings.showMessage(settings.getString( - R.string.photo_quality_number_limit, min, max)) - } - } catch (e: NumberFormatException) { - e.printStackTrace() - } - return "" - } - - private fun isInRange(value: Int): Boolean { - return value in min..max - } - - companion object { - const val min = 1 - const val max = 100 - } -} diff --git a/app/src/main/java/app/grapheneos/camera/inputfilter/CustomNumFilter.kt b/app/src/main/java/app/grapheneos/camera/inputfilter/CustomNumFilter.kt new file mode 100644 index 00000000..a8105c6c --- /dev/null +++ b/app/src/main/java/app/grapheneos/camera/inputfilter/CustomNumFilter.kt @@ -0,0 +1,36 @@ +package app.grapheneos.camera.inputfilter + +import android.text.InputFilter +import android.text.Spanned + +open class CustomNumFilter( + val shouldAcceptNumber : (Float) -> Boolean, +) : InputFilter { + + override fun filter( + source: CharSequence, + start: Int, + end: Int, + dest: Spanned, + dstart: Int, + dend: Int + ): CharSequence? { + val transformedString = source.subSequence(start, end).replace(Regex("[^0-9]"), "") + + try { + val input = (dest.subSequence(0, dstart).toString() + source + dest.subSequence( + dend, + dest.length + )).toFloat() + if (this.shouldAcceptNumber(input)) { + return transformedString + } else { + return "" + } + } catch (e: NumberFormatException) { + e.printStackTrace() + return transformedString + } + return transformedString + } +} \ No newline at end of file diff --git a/app/src/main/java/app/grapheneos/camera/inputfilter/NumLimitFilter.kt b/app/src/main/java/app/grapheneos/camera/inputfilter/NumLimitFilter.kt new file mode 100644 index 00000000..2d6b3ded --- /dev/null +++ b/app/src/main/java/app/grapheneos/camera/inputfilter/NumLimitFilter.kt @@ -0,0 +1,19 @@ +package app.grapheneos.camera.inputfilter + +// Ensures that the field is within the min/max limits for a number type input field +class NumLimitFilter( + val min: Float, + val max: Float, + val onOutOfRange: () -> Unit, +) : CustomNumFilter( + shouldAcceptNumber = { num -> + if (num in min..max) { + true + } else { + onOutOfRange() + false + } + } +) { + constructor(min: Int, max: Int, onOutOfRange: () -> Unit) : this(min.toFloat(), max.toFloat(), onOutOfRange) +} \ No newline at end of file From 17a33050def1b2dfbb308d75f2ad5c8d2b511bda Mon Sep 17 00:00:00 2001 From: MHShetty Date: Sat, 31 May 2025 03:14:48 +0530 Subject: [PATCH 5/8] Add UI for video bitrate setting --- app/src/main/res/layout/more_settings.xml | 109 ++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/app/src/main/res/layout/more_settings.xml b/app/src/main/res/layout/more_settings.xml index c3b8117f..a07ec8a5 100644 --- a/app/src/main/res/layout/more_settings.xml +++ b/app/src/main/res/layout/more_settings.xml @@ -515,6 +515,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + +