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.bignerdranch.android:recyclerview-multiselect:0.2'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile 'com.github.yukuku:ambilwarna:2.0.1'
}
buildscript {

View file

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

View file

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

View file

@ -8,7 +8,7 @@ open class SimpleActivity : BaseSimpleActivity() {
lateinit var config: Config
override fun onCreate(savedInstanceState: Bundle?) {
config = Config.newInstance(applicationContext)
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 java.util.*
class Config(val context: Context) : BaseConfig(context) {
class Config(context: Context) : BaseConfig(context) {
private val mPrefs: SharedPreferences
companion object {

View file

@ -12,7 +12,7 @@
android:orientation="vertical">
<RelativeLayout
android:id="@+id/settings_dark_theme_holder"
android:id="@+id/settings_customize_colors_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/settings_padding"
@ -20,22 +20,13 @@
android:padding="@dimen/activity_margin">
<TextView
android:id="@+id/settings_dark_theme_label"
android:id="@+id/settings_customize_colors_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingLeft="@dimen/settings_padding"
android:paddingStart="@dimen/settings_padding"
android:text="@string/dark_theme"/>
<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"/>
android:text="@string/customize_colors"/>
</RelativeLayout>