replace the media selection spinner in settings with text
This commit is contained in:
parent
b064a76e97
commit
762662a976
2 changed files with 18 additions and 14 deletions
|
@ -1,11 +1,11 @@
|
||||||
package com.simplemobiletools.gallery.activities
|
package com.simplemobiletools.gallery.activities
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
|
||||||
import android.widget.AdapterView
|
|
||||||
import com.simplemobiletools.commons.extensions.updateTextColors
|
import com.simplemobiletools.commons.extensions.updateTextColors
|
||||||
import com.simplemobiletools.gallery.R
|
import com.simplemobiletools.gallery.R
|
||||||
import com.simplemobiletools.gallery.extensions.config
|
import com.simplemobiletools.gallery.extensions.config
|
||||||
|
import com.simplemobiletools.gallery.helpers.IMAGES
|
||||||
|
import com.simplemobiletools.gallery.helpers.IMAGES_AND_VIDEOS
|
||||||
import kotlinx.android.synthetic.main.activity_settings.*
|
import kotlinx.android.synthetic.main.activity_settings.*
|
||||||
|
|
||||||
class SettingsActivity : SimpleActivity() {
|
class SettingsActivity : SimpleActivity() {
|
||||||
|
@ -65,14 +65,15 @@ class SettingsActivity : SimpleActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupShowMedia() {
|
private fun setupShowMedia() {
|
||||||
settings_show_media.setSelection(config.showMedia)
|
settings_show_media.text = getShowMediaText(config.showMedia)
|
||||||
settings_show_media.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
settings_show_media_holder.setOnClickListener {
|
||||||
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
|
|
||||||
config.showMedia = settings_show_media.selectedItemPosition
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onNothingSelected(parent: AdapterView<*>?) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun getShowMediaText(id: Int) = getString(when (id) {
|
||||||
|
IMAGES_AND_VIDEOS -> R.string.images_and_videos
|
||||||
|
IMAGES -> R.string.images
|
||||||
|
else -> R.string.videos
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,10 +115,10 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="@dimen/medium_margin"
|
android:layout_marginTop="@dimen/medium_margin"
|
||||||
android:paddingBottom="@dimen/activity_margin"
|
android:paddingBottom="@dimen/bigger_margin"
|
||||||
android:paddingLeft="@dimen/activity_margin"
|
android:paddingLeft="@dimen/activity_margin"
|
||||||
android:paddingRight="@dimen/medium_margin"
|
android:paddingRight="@dimen/activity_margin"
|
||||||
android:paddingTop="@dimen/activity_margin">
|
android:paddingTop="@dimen/bigger_margin">
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyTextView
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
android:id="@+id/settings_show_media_label"
|
android:id="@+id/settings_show_media_label"
|
||||||
|
@ -131,13 +131,16 @@
|
||||||
android:paddingRight="@dimen/medium_margin"
|
android:paddingRight="@dimen/medium_margin"
|
||||||
android:text="@string/show_media"/>
|
android:text="@string/show_media"/>
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyAppCompatSpinner
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
android:id="@+id/settings_show_media"
|
android:id="@+id/settings_show_media"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:entries="@array/show_media_items"/>
|
android:layout_marginEnd="@dimen/small_margin"
|
||||||
|
android:layout_marginRight="@dimen/small_margin"
|
||||||
|
android:background="@null"
|
||||||
|
android:clickable="false"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
Loading…
Reference in a new issue