updating commons with some initial ui changes

This commit is contained in:
tibbi 2022-12-19 15:53:59 +01:00
parent 8d1db2655e
commit f832c289cb
5 changed files with 27 additions and 24 deletions

View File

@ -63,7 +63,7 @@ android {
} }
dependencies { dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:9795366108' implementation 'com.github.SimpleMobileTools:Simple-Commons:f38bfd22d5'
implementation 'androidx.documentfile:documentfile:1.0.1' implementation 'androidx.documentfile:documentfile:1.0.1'
implementation "androidx.exifinterface:exifinterface:1.3.5" implementation "androidx.exifinterface:exifinterface:1.3.5"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.5.1" implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.5.1"

View File

@ -21,10 +21,14 @@ import kotlin.system.exitProcess
class SettingsActivity : SimpleActivity() { class SettingsActivity : SimpleActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
isMaterialActivity = true
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_settings) setContentView(R.layout.activity_settings)
setupOptionsMenu() setupOptionsMenu()
refreshMenuItems() refreshMenuItems()
updateMaterialActivityViews(settings_coordinator, settings_holder)
setupMaterialScrollListener(settings_nested_scrollview, settings_toolbar)
} }
override fun onResume() { override fun onResume() {

View File

@ -47,10 +47,15 @@ class MediaActionSound(private val context: Context) {
var state: Int = STATE_NOT_LOADED var state: Int = STATE_NOT_LOADED
) )
private var soundPool: SoundPool? = SoundPool.Builder().setMaxStreams(NUM_MEDIA_SOUND_STREAMS).setAudioAttributes( private var soundPool: SoundPool? = SoundPool.Builder().setMaxStreams(NUM_MEDIA_SOUND_STREAMS)
AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_ASSISTANCE_SONIFICATION).setFlags(AudioAttributes.FLAG_AUDIBILITY_ENFORCED) .setAudioAttributes(
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION).build() AudioAttributes.Builder()
.setUsage(AudioAttributes.USAGE_ASSISTANCE_SONIFICATION)
.setFlags(AudioAttributes.FLAG_AUDIBILITY_ENFORCED)
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
.build()
).build() ).build()
private var mediaPlayer: MediaPlayer? = null private var mediaPlayer: MediaPlayer? = null
private var playCompletionRunnable: Runnable? = null private var playCompletionRunnable: Runnable? = null
@ -62,6 +67,7 @@ class MediaActionSound(private val context: Context) {
if (sound.loadId != sampleId) { if (sound.loadId != sampleId) {
continue continue
} }
var soundToBePlayed: SoundState? = null var soundToBePlayed: SoundState? = null
synchronized(sound) { synchronized(sound) {
if (status != 0) { 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}") else -> Log.e(TAG, "OnLoadCompleteListener() called in wrong state: ${sound.state} for sound: ${sound.mediaSound}")
} }
} }
if (soundToBePlayed != null) { if (soundToBePlayed != null) {
playWithSoundPool(soundToBePlayed!!) playWithSoundPool(soundToBePlayed!!)
} }

View File

@ -6,30 +6,22 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/settings_app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar <com.google.android.material.appbar.MaterialToolbar
android:id="@+id/settings_toolbar" android:id="@+id/settings_toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="@color/color_primary" android:background="@color/color_primary"
app:layout_scrollFlags="scroll|enterAlways"
app:menu="@menu/menu" app:menu="@menu/menu"
app:title="@string/settings" app:title="@string/settings"
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" /> app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView <androidx.core.widget.NestedScrollView
android:id="@+id/settings_nested_scrollview" android:id="@+id/settings_nested_scrollview"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginTop="?attr/actionBarSize"
android:fillViewport="true" android:fillViewport="true"
android:scrollbars="none" android:scrollbars="none">
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout <LinearLayout
android:id="@+id/settings_holder" android:id="@+id/settings_holder"

View File

@ -5,9 +5,9 @@
tools:ignore="AppCompatResource"> tools:ignore="AppCompatResource">
<item <item
android:id="@+id/more_apps_from_us" android:id="@+id/more_apps_from_us"
android:showAsAction="never" android:icon="@drawable/ic_google_play_vector"
android:title="@string/more_apps_from_us" android:title="@string/more_apps_from_us"
app:showAsAction="never" /> app:showAsAction="ifRoom" />
<item <item
android:id="@+id/about" android:id="@+id/about"
android:icon="@drawable/ic_info_vector" android:icon="@drawable/ic_info_vector"