diff options
author | Allan Wang <me@allanwang.ca> | 2017-07-08 03:03:55 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-08 03:03:55 -0400 |
commit | b10a745c7f0f46f4f014e1ba7fa71172d7442b83 (patch) | |
tree | ef2516b69fb04ec0f565c5bb569fd5d80b7bd262 /app/src/main/kotlin/com/pitchedapps/frost/views/KPrefTextSeekbar.kt | |
parent | 6adfc496374eb88919f70a240eb15a726d2c18e0 (diff) | |
download | frost-b10a745c7f0f46f4f014e1ba7fa71172d7442b83.tar.gz frost-b10a745c7f0f46f4f014e1ba7fa71172d7442b83.tar.bz2 frost-b10a745c7f0f46f4f014e1ba7fa71172d7442b83.zip |
Dev-1.1.7 (#39) - feature overload + context menuv1.2
* Address some crashlytics issues
* Add text scaling
* Kau fixes and cleanup
* WIP formatter
* Create in house url formatter
* Update context menu
* Update themes
* Test proguard without R
* Implement sharing and clean up context menu
* Disable viewpager swipe on long press
* Test keeping lib strings
* Update changelog and proguard
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/views/KPrefTextSeekbar.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/views/KPrefTextSeekbar.kt | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/KPrefTextSeekbar.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/KPrefTextSeekbar.kt new file mode 100644 index 00000000..1d8f308d --- /dev/null +++ b/app/src/main/kotlin/com/pitchedapps/frost/views/KPrefTextSeekbar.kt @@ -0,0 +1,47 @@ +package com.pitchedapps.frost.views + +import android.annotation.SuppressLint +import android.util.TypedValue +import ca.allanwang.kau.kpref.items.KPrefSeekbar +import com.pitchedapps.frost.R + +/** + * Created by Allan Wang on 2017-07-07. + */ +class KPrefTextSeekbar(builder: KPrefSeekbarContract) : KPrefSeekbar(builder) { + + var descOriginalSize = 1f + + init { + with(builder) { + min = 50 + max = 200 + descRes = R.string.web_text_scaling_desc + textViewConfigs = { + minEms = 2 + setOnLongClickListener { + pref = 100 + reloadSelf() + true + } + } + } + } + + @SuppressLint("MissingSuperCall") + override fun onPostBindView(viewHolder: ViewHolder, textColor: Int?, accentColor: Int?) { + descOriginalSize = viewHolder.desc?.textSize ?: 1f + viewHolder.desc?.layoutParams + builder.toText = { + viewHolder.desc?.setTextSize(TypedValue.COMPLEX_UNIT_PX, descOriginalSize * it.toFloat() / 100) + "$it%" + } + + super.onPostBindView(viewHolder, textColor, accentColor) + } + + override fun unbindView(holder: ViewHolder) { + holder.desc?.setTextSize(TypedValue.COMPLEX_UNIT_PX, descOriginalSize) + super.unbindView(holder) + } +}
\ No newline at end of file |