diff options
author | Allan Wang <me@allanwang.ca> | 2017-08-19 21:12:02 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-08-19 21:12:02 -0700 |
commit | 8c178bd82d75ef237c97863fae555ca0346e7352 (patch) | |
tree | 0d532c6ed127110d1bf66d4522f008419c900b44 /app/src/main/kotlin/com/pitchedapps/frost/utils | |
parent | 1240e2663413b56c5b97c8ff40cb5c1bdc2df23b (diff) | |
download | frost-8c178bd82d75ef237c97863fae555ca0346e7352.tar.gz frost-8c178bd82d75ef237c97863fae555ca0346e7352.tar.bz2 frost-8c178bd82d75ef237c97863fae555ca0346e7352.zip |
Refactor enums and optimize imports
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/utils')
3 files changed, 3 insertions, 117 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt index 56c33b4b..3ad90652 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt @@ -6,8 +6,10 @@ import ca.allanwang.kau.kpref.KPref import ca.allanwang.kau.kpref.StringSet import ca.allanwang.kau.kpref.kpref import ca.allanwang.kau.utils.isColorVisibleOn +import com.pitchedapps.frost.enums.FACEBOOK_BLUE import com.pitchedapps.frost.enums.MainActivityLayout -import com.pitchedapps.frost.facebook.FeedSort +import com.pitchedapps.frost.enums.Theme +import com.pitchedapps.frost.enums.FeedSort import com.pitchedapps.frost.injectors.InjectorContract /** diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Support.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Support.kt deleted file mode 100644 index 72df902c..00000000 --- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Support.kt +++ /dev/null @@ -1,25 +0,0 @@ -package com.pitchedapps.frost.utils - -import android.content.Context -import android.support.annotation.StringRes -import ca.allanwang.kau.email.sendEmail -import ca.allanwang.kau.utils.string -import com.pitchedapps.frost.R - -/** - * Created by Allan Wang on 2017-06-29. - */ -enum class Support(@StringRes val title: Int) { - FEEDBACK(R.string.feedback), - BUG(R.string.bug_report), - THEME(R.string.theme_issue), - FEATURE(R.string.feature_request); - - fun sendEmail(context: Context) { - with(context) { - this.sendEmail(string(R.string.dev_email), "${string(R.string.frost_prefix)} ${string(title)}") { - addItem("Random Frost ID", Prefs.frostId) - } - } - } -}
\ No newline at end of file diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Theme.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Theme.kt deleted file mode 100644 index 5cbb051d..00000000 --- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Theme.kt +++ /dev/null @@ -1,91 +0,0 @@ -package com.pitchedapps.frost.utils - -import android.graphics.Color -import android.support.annotation.StringRes -import com.pitchedapps.frost.R -import com.pitchedapps.frost.injectors.CssAssets -import com.pitchedapps.frost.injectors.InjectorContract -import com.pitchedapps.frost.injectors.JsActions - -/** - * Created by Allan Wang on 2017-06-14. - */ -const val FACEBOOK_BLUE = 0xff3b5998.toInt() -const val BLUE_LIGHT = 0xff5d86dd.toInt() - -enum class Theme(@StringRes val textRes: Int, - val injector: InjectorContract, - private val textColorGetter: () -> Int, - private val accentColorGetter: () -> Int, - private val backgroundColorGetter: () -> Int, - private val headerColorGetter: () -> Int, - private val iconColorGetter: () -> Int) { - - DEFAULT(R.string.kau_default, - JsActions.EMPTY, - { 0xde000000.toInt() }, - { FACEBOOK_BLUE }, - { 0xfffafafa.toInt() }, - { FACEBOOK_BLUE }, - { Color.WHITE }), - - LIGHT(R.string.kau_light, - CssAssets.MATERIAL_LIGHT, - { 0xde000000.toInt() }, - { FACEBOOK_BLUE }, - { 0xfffafafa.toInt() }, - { FACEBOOK_BLUE }, - { Color.WHITE }), - - DARK(R.string.kau_dark, - CssAssets.MATERIAL_DARK, - { Color.WHITE }, - { BLUE_LIGHT }, - { 0xff303030.toInt() }, - { 0xff2e4b86.toInt() }, - { Color.WHITE }), - - AMOLED(R.string.kau_amoled, - CssAssets.MATERIAL_AMOLED, - { Color.WHITE }, - { BLUE_LIGHT }, - { Color.BLACK }, - { Color.BLACK }, - { Color.WHITE }), - - GLASS(R.string.kau_glass, - CssAssets.MATERIAL_GLASS, - { Color.WHITE }, - { BLUE_LIGHT }, - { 0x80000000.toInt() }, - { 0xb3000000.toInt() }, - { Color.WHITE }), - - CUSTOM(R.string.kau_custom, - CssAssets.CUSTOM, - { Prefs.customTextColor }, - { Prefs.customAccentColor }, - { Prefs.customBackgroundColor }, - { Prefs.customHeaderColor }, - { Prefs.customIconColor }); - - val textColor: Int - get() = textColorGetter() - - val accentColor: Int - get() = accentColorGetter() - - val bgColor: Int - get() = backgroundColorGetter() - - val headerColor: Int - get() = headerColorGetter() - - val iconColor: Int - get() = iconColorGetter() - - companion object { - val values = values() //save one instance - operator fun invoke(index: Int) = values[index] - } -}
\ No newline at end of file |