add the customization activity

This commit is contained in:
tibbi 2016-12-15 22:49:23 +01:00
parent 0e4af9ad12
commit a803948657
6 changed files with 22 additions and 22 deletions

View file

@ -47,6 +47,8 @@ dependencies {
compile 'com.simplemobiletools:commons:1.0.4@aar' compile 'com.simplemobiletools:commons:1.0.4@aar'
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile 'com.github.yukuku:ambilwarna:2.0.1'
} }
buildscript { buildscript {

View file

@ -80,6 +80,11 @@
android:label="@string/settings" android:label="@string/settings"
android:parentActivityName=".activities.MainActivity"/> android:parentActivityName=".activities.MainActivity"/>
<activity
android:name="com.simplemobiletools.commons.activities.CustomizationActivity"
android:label="@string/customize_colors"
android:parentActivityName=".activities.SettingsActivity"/>
<activity <activity
android:name=".activities.PhotoVideoActivity"/> android:name=".activities.PhotoVideoActivity"/>

View file

@ -1,9 +1,11 @@
package com.simplemobiletools.gallery.activities package com.simplemobiletools.gallery.activities
import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.support.v4.app.TaskStackBuilder import android.support.v4.app.TaskStackBuilder
import android.view.View import android.view.View
import android.widget.AdapterView import android.widget.AdapterView
import com.simplemobiletools.commons.activities.CustomizationActivity
import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.R
import kotlinx.android.synthetic.main.activity_settings.* import kotlinx.android.synthetic.main.activity_settings.*
@ -12,20 +14,20 @@ class SettingsActivity : SimpleActivity() {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_settings) setContentView(R.layout.activity_settings)
setupDarkTheme() setupCustomizeColors()
setupSameSorting() setupSameSorting()
setupShowHiddenFolders() setupShowHiddenFolders()
setupAutoplayVideos() setupAutoplayVideos()
setupShowMedia() setupShowMedia()
} }
private fun setupDarkTheme() { override fun onResume() {
settings_dark_theme.isChecked = config.isDarkTheme super.onResume()
settings_dark_theme_holder.setOnClickListener { updateTextColors(settings_holder)
settings_dark_theme.toggle()
config.isDarkTheme = settings_dark_theme.isChecked
restartActivity()
} }
private fun setupCustomizeColors() {
settings_customize_colors_holder.setOnClickListener { startActivity(Intent(this, CustomizationActivity::class.java)) }
} }
private fun setupSameSorting() { private fun setupSameSorting() {

View file

@ -8,7 +8,7 @@ open class SimpleActivity : BaseSimpleActivity() {
lateinit var config: Config lateinit var config: Config
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
config = Config.newInstance(applicationContext)
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
config = Config.newInstance(applicationContext)
} }
} }

View file

@ -6,7 +6,7 @@ import com.simplemobiletools.commons.helpers.BaseConfig
import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.R
import java.util.* import java.util.*
class Config(val context: Context) : BaseConfig(context) { class Config(context: Context) : BaseConfig(context) {
private val mPrefs: SharedPreferences private val mPrefs: SharedPreferences
companion object { companion object {

View file

@ -12,7 +12,7 @@
android:orientation="vertical"> android:orientation="vertical">
<RelativeLayout <RelativeLayout
android:id="@+id/settings_dark_theme_holder" android:id="@+id/settings_customize_colors_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/settings_padding" android:layout_marginTop="@dimen/settings_padding"
@ -20,22 +20,13 @@
android:padding="@dimen/activity_margin"> android:padding="@dimen/activity_margin">
<TextView <TextView
android:id="@+id/settings_dark_theme_label" android:id="@+id/settings_customize_colors_label"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:paddingLeft="@dimen/settings_padding" android:paddingLeft="@dimen/settings_padding"
android:paddingStart="@dimen/settings_padding" android:paddingStart="@dimen/settings_padding"
android:text="@string/dark_theme"/> android:text="@string/customize_colors"/>
<android.support.v7.widget.SwitchCompat
android:id="@+id/settings_dark_theme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:background="@null"
android:clickable="false"/>
</RelativeLayout> </RelativeLayout>