From a80394865723a4fd9649f9c7971e2e3b1361a3a3 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 15 Dec 2016 22:49:23 +0100 Subject: [PATCH] add the customization activity --- app/build.gradle | 2 ++ app/src/main/AndroidManifest.xml | 5 +++++ .../gallery/activities/SettingsActivity.kt | 18 ++++++++++-------- .../gallery/activities/SimpleActivity.kt | 2 +- .../gallery/helpers/Config.kt | 2 +- app/src/main/res/layout/activity_settings.xml | 15 +++------------ 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 5d870934d..46640c43b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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 { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 310824c95..3347a4350 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -80,6 +80,11 @@ android:label="@string/settings" android:parentActivityName=".activities.MainActivity"/> + + diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt index 3c1d012d3..36ab1209d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt @@ -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() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SimpleActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SimpleActivity.kt index c281a17fe..9165dec3c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SimpleActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SimpleActivity.kt @@ -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) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt index bb0eecdad..ae198ca09 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -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 { diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index c3a452360..c4cfd573a 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -12,7 +12,7 @@ android:orientation="vertical"> - - + android:text="@string/customize_colors"/>