From f832c289cb240927d18d023e850a84288caa76cf Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 19 Dec 2022 15:53:59 +0100 Subject: [PATCH] updating commons with some initial ui changes --- app/build.gradle | 2 +- .../camera/activities/SettingsActivity.kt | 4 +++ .../camera/helpers/MediaActionSound.kt | 15 ++++++++--- app/src/main/res/layout/activity_settings.xml | 26 +++++++------------ app/src/main/res/menu/menu.xml | 4 +-- 5 files changed, 27 insertions(+), 24 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 23055561..3b7511bf 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -63,7 +63,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:9795366108' + implementation 'com.github.SimpleMobileTools:Simple-Commons:f38bfd22d5' implementation 'androidx.documentfile:documentfile:1.0.1' implementation "androidx.exifinterface:exifinterface:1.3.5" implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.5.1" diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/camera/activities/SettingsActivity.kt index cf67a91f..91385459 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/activities/SettingsActivity.kt @@ -21,10 +21,14 @@ import kotlin.system.exitProcess class SettingsActivity : SimpleActivity() { override fun onCreate(savedInstanceState: Bundle?) { + isMaterialActivity = true super.onCreate(savedInstanceState) setContentView(R.layout.activity_settings) setupOptionsMenu() refreshMenuItems() + + updateMaterialActivityViews(settings_coordinator, settings_holder) + setupMaterialScrollListener(settings_nested_scrollview, settings_toolbar) } override fun onResume() { diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/helpers/MediaActionSound.kt b/app/src/main/kotlin/com/simplemobiletools/camera/helpers/MediaActionSound.kt index 892eba42..50b6fc45 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/helpers/MediaActionSound.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/helpers/MediaActionSound.kt @@ -47,10 +47,15 @@ class MediaActionSound(private val context: Context) { var state: Int = STATE_NOT_LOADED ) - private var soundPool: SoundPool? = SoundPool.Builder().setMaxStreams(NUM_MEDIA_SOUND_STREAMS).setAudioAttributes( - AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_ASSISTANCE_SONIFICATION).setFlags(AudioAttributes.FLAG_AUDIBILITY_ENFORCED) - .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION).build() - ).build() + private var soundPool: SoundPool? = SoundPool.Builder().setMaxStreams(NUM_MEDIA_SOUND_STREAMS) + .setAudioAttributes( + AudioAttributes.Builder() + .setUsage(AudioAttributes.USAGE_ASSISTANCE_SONIFICATION) + .setFlags(AudioAttributes.FLAG_AUDIBILITY_ENFORCED) + .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION) + .build() + ).build() + private var mediaPlayer: MediaPlayer? = null private var playCompletionRunnable: Runnable? = null @@ -62,6 +67,7 @@ class MediaActionSound(private val context: Context) { if (sound.loadId != sampleId) { continue } + var soundToBePlayed: SoundState? = null synchronized(sound) { if (status != 0) { @@ -79,6 +85,7 @@ class MediaActionSound(private val context: Context) { else -> Log.e(TAG, "OnLoadCompleteListener() called in wrong state: ${sound.state} for sound: ${sound.mediaSound}") } } + if (soundToBePlayed != null) { playWithSoundPool(soundToBePlayed!!) } diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index a22fee4b..f87abd9d 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -6,30 +6,22 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - - - - - + android:layout_height="?attr/actionBarSize" + android:background="@color/color_primary" + app:menu="@menu/menu" + app:title="@string/settings" + app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" /> + android:scrollbars="none"> + app:showAsAction="ifRoom" />