Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- Added support for custom fonts
- Option for maximum screen brightness in preview ([#234])

## [1.4.0] - 2025-10-29
### Changed
Expand Down Expand Up @@ -69,6 +70,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#97]: https://github.com/FossifyOrg/Camera/issues/97
[#157]: https://github.com/FossifyOrg/Camera/issues/157
[#177]: https://github.com/FossifyOrg/Camera/issues/177
[#234]: https://github.com/FossifyOrg/Camera/issues/234

[Unreleased]: https://github.com/FossifyOrg/Camera/compare/1.4.0...HEAD
[1.4.0]: https://github.com/FossifyOrg/Camera/compare/1.3.1...1.4.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
private var mIsHardwareShutterHandled = false
private var mLastHandledOrientation = 0
private var countDownTimer: CountDownTimer? = null
private var mOriginalBrightness: Float? = null

private val tabSelectedListener = object : TabSelectedListener {
override fun onTabSelected(tab: TabLayout.Tab) {
Expand Down Expand Up @@ -128,8 +129,8 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
}

window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
syncMaxBrightness()
ensureTransparentNavigationBar()

if (ViewCompat.getWindowInsetsController(window.decorView) == null) {
window.decorView.systemUiVisibility =
View.SYSTEM_UI_FLAG_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
Expand Down Expand Up @@ -1028,4 +1029,18 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
timerText.beGone()
shutter.setImageState(intArrayOf(-R.attr.state_timer_cancel), true)
}

private fun syncMaxBrightness() {
if (config.maxBrightness) {
mOriginalBrightness = mOriginalBrightness ?: window.attributes.screenBrightness
window.attributes = window.attributes.apply {
screenBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_FULL
}
} else {
mOriginalBrightness?.let {
window.attributes = window.attributes.apply { screenBrightness = it }
mOriginalBrightness = null
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class SettingsActivity : SimpleActivity() {
setupLanguage()
setupSound()
setupVolumeButtonsAsShutter()
setupMaxBrightness()
setupFlipPhotos()
setupSavePhotoMetadata()
setupSavePhotoVideoLocation()
Expand All @@ -53,7 +54,7 @@ class SettingsActivity : SimpleActivity() {
arrayListOf(
settingsColorCustomizationLabel,
settingsGeneralSettingsLabel,
settingsShutterLabel,
settingsCameraLabel,
settingsSavingLabel,
).forEach {
it.setTextColor(properPrimaryColor)
Expand Down Expand Up @@ -160,6 +161,14 @@ class SettingsActivity : SimpleActivity() {
}
}

private fun setupMaxBrightness() = binding.apply {
settingsMaxBrightness.isChecked = config.maxBrightness
settingsMaxBrightnessHolder.setOnClickListener {
settingsMaxBrightness.toggle()
config.maxBrightness = settingsMaxBrightness.isChecked
}
}

private fun setupFlipPhotos() = binding.apply {
settingsFlipPhotos.isChecked = config.flipPhotos
settingsFlipPhotosHolder.setOnClickListener {
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/kotlin/org/fossify/camera/helpers/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ class Config(context: Context) : BaseConfig(context) {
)]
set(captureMode) = prefs.edit().putInt(CAPTURE_MODE, captureMode.ordinal).apply()

var maxBrightness: Boolean
get() = prefs.getBoolean(MAX_BRIGHTNESS, false)
set(maxBrightness) = prefs.edit().putBoolean(MAX_BRIGHTNESS, maxBrightness).apply()

var timerMode: TimerMode
get() = TimerMode.values().getOrNull(prefs.getInt(TIMER_MODE, TimerMode.OFF.ordinal))
?: TimerMode.OFF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const val SAVE_PHOTO_VIDEO_LOCATION = "save_photo_video_location"
const val PHOTO_QUALITY = "photo_quality"
const val CAPTURE_MODE = "capture_mode"
const val TIMER_MODE = "timer_mode"
const val MAX_BRIGHTNESS = "max_brightness"

const val FLASH_OFF = 0
const val FLASH_ON = 1
Expand Down
23 changes: 19 additions & 4 deletions app/src/main/res/layout/activity_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,14 @@
layout="@layout/divider" />

<TextView
android:id="@+id/settings_shutter_label"
android:id="@+id/settings_camera_label"
style="@style/SettingsSectionLabelStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/shutter" />
android:text="@string/app_launcher_name" />

<LinearLayout
android:id="@+id/settings_shutter_holder"
android:id="@+id/settings_camera_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
Expand Down Expand Up @@ -167,10 +167,25 @@
android:text="@string/volume_buttons_as_shutter" />

</RelativeLayout>

<RelativeLayout
android:id="@+id/settings_max_brightness_holder"
style="@style/SettingsHolderCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<org.fossify.commons.views.MyMaterialSwitch
android:id="@+id/settings_max_brightness"
style="@style/SettingsSwitchStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/max_brightness" />

</RelativeLayout>
</LinearLayout>

<include
android:id="@+id/settings_shutter_divider"
android:id="@+id/settings_camera_divider"
layout="@layout/divider" />

<TextView
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<string name="save_photo_video_location">Save photo and video location</string>
<string name="photo_compression_quality">Photo compression quality</string>
<string name="shutter">Shutter</string>
<string name="max_brightness">Max screen brightness in preview</string>
<!--
Haven't found some strings? There's more at
https://github.com/FossifyOrg/Commons/tree/master/commons/src/main/res
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { setUrl("https://jitpack.io") }
maven { setUrl("https://www.jitpack.io") }
mavenLocal()
}
}
Expand Down
Loading