Add support for changing font size

This commit is contained in:
Moez Bhatti
2018-04-05 23:23:54 -04:00
parent 740be7030b
commit 933911b3d6
29 changed files with 312 additions and 91 deletions
+6
View File
@@ -32,6 +32,11 @@ class Preferences @Inject constructor(private val rxPrefs: RxSharedPreferences)
const val NIGHT_MODE_OFF = 0
const val NIGHT_MODE_ON = 1
const val NIGHT_MODE_AUTO = 2
const val TEXT_SIZE_SMALL = 0
const val TEXT_SIZE_NORMAL = 1
const val TEXT_SIZE_LARGE = 2
const val TEXT_SIZE_LARGER = 3
}
val defaultSms = rxPrefs.getBoolean("defaultSms", false)
@@ -42,6 +47,7 @@ class Preferences @Inject constructor(private val rxPrefs: RxSharedPreferences)
val black = rxPrefs.getBoolean("black", false)
val autoEmoji = rxPrefs.getBoolean("autoEmoji", true)
val delivery = rxPrefs.getBoolean("delivery", false)
val textSize = rxPrefs.getInteger("textSize", TEXT_SIZE_NORMAL)
val qkreply = rxPrefs.getBoolean("qkreply", Build.VERSION.SDK_INT < Build.VERSION_CODES.N)
val unicode = rxPrefs.getBoolean("unicode", false)
val mms = rxPrefs.getBoolean("mms", true)
@@ -27,8 +27,16 @@ import com.uber.autodispose.android.scope
import com.uber.autodispose.kotlin.autoDisposable
import common.util.Colors
import common.util.FontProvider
import common.widget.QkTextView.Companion.SIZE_PRIMARY
import common.widget.QkTextView.Companion.SIZE_SECONDARY
import common.widget.QkTextView.Companion.SIZE_TERTIARY
import common.widget.QkTextView.Companion.SIZE_TOOLBAR
import injection.appComponent
import io.reactivex.Observable
import io.reactivex.rxkotlin.Observables
import io.reactivex.subjects.BehaviorSubject
import io.reactivex.subjects.Subject
import util.Preferences
import javax.inject.Inject
/**
@@ -39,38 +47,76 @@ import javax.inject.Inject
*/
class QkEditText @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : EditText(context, attrs) {
companion object {
const val COLOR_PRIMARY = 0
const val COLOR_SECONDARY = 1
const val COLOR_TERTIARY = 2
const val COLOR_PRIMARY_ON_THEME = 3
const val COLOR_SECONDARY_ON_THEME = 4
const val COLOR_TERTIARY_ON_THEME = 5
const val SIZE_PRIMARY = 0
const val SIZE_SECONDARY = 1
const val SIZE_TERTIARY = 2
const val SIZE_TOOLBAR = 3
}
@Inject lateinit var colors: Colors
@Inject lateinit var fontProvider: FontProvider
@Inject lateinit var prefs: Preferences
private var textColorObservable: Observable<Int>? = null
private var textColorHintObservable: Observable<Int>? = null
init {
appComponent.inject(this)
fontProvider.getLato { setTypeface(it, typeface?.style ?: Typeface.NORMAL) }
private var textSizeAttrSubject: Subject<Int> = BehaviorSubject.create()
context.obtainStyledAttributes(attrs, R.styleable.QkEditText)?.run {
textColorObservable = when (getInt(R.styleable.QkEditText_textColor, -1)) {
0 -> colors.textPrimary
1 -> colors.textSecondary
2 -> colors.textTertiary
3 -> colors.textPrimaryOnTheme
4 -> colors.textSecondaryOnTheme
5 -> colors.textTertiaryOnTheme
else -> null
init {
if (!isInEditMode) {
appComponent.inject(this)
fontProvider.getLato { setTypeface(it, typeface?.style ?: Typeface.NORMAL) }
context.obtainStyledAttributes(attrs, R.styleable.QkEditText)?.run {
val colorAttr = getInt(R.styleable.QkEditText_textColor, -1)
val colorHintAttr = getInt(R.styleable.QkEditText_textColorHint, -1)
val textSizeAttr = getInt(R.styleable.QkEditText_textSize, -1)
textColorObservable = when (colorAttr) {
COLOR_PRIMARY -> colors.textPrimary
COLOR_SECONDARY -> colors.textSecondary
COLOR_TERTIARY -> colors.textTertiary
COLOR_PRIMARY_ON_THEME -> colors.textPrimaryOnTheme
COLOR_SECONDARY_ON_THEME -> colors.textSecondaryOnTheme
COLOR_TERTIARY_ON_THEME -> colors.textTertiaryOnTheme
else -> null
}
textColorHintObservable = when (colorHintAttr) {
COLOR_PRIMARY -> colors.textPrimary
COLOR_SECONDARY -> colors.textSecondary
COLOR_TERTIARY -> colors.textTertiary
else -> null
}
setTextSize(textSizeAttr)
recycle()
}
textColorHintObservable = when (getInt(R.styleable.QkEditText_textColorHint, -1)) {
0 -> colors.textPrimary
1 -> colors.textSecondary
2 -> colors.textTertiary
else -> null
}
recycle()
}
}
/**
* @see SIZE_PRIMARY
* @see SIZE_SECONDARY
* @see SIZE_TERTIARY
* @see SIZE_TOOLBAR
*/
fun setTextSize(size: Int) {
textSizeAttrSubject.onNext(size)
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
if (isInEditMode) return
textColorObservable
?.autoDisposable(scope())
@@ -79,6 +125,45 @@ class QkEditText @JvmOverloads constructor(context: Context, attrs: AttributeSet
textColorHintObservable
?.autoDisposable(scope())
?.subscribe { color -> setHintTextColor(color) }
Observables
.combineLatest(prefs.textSize.asObservable(), textSizeAttrSubject, { textSizePref, textSizeAttr ->
when (textSizeAttr) {
SIZE_PRIMARY -> textSize = when (textSizePref) {
Preferences.TEXT_SIZE_SMALL -> 14f
Preferences.TEXT_SIZE_NORMAL -> 16f
Preferences.TEXT_SIZE_LARGE -> 18f
Preferences.TEXT_SIZE_LARGER -> 20f
else -> 16f
}
SIZE_SECONDARY -> textSize = when (textSizePref) {
Preferences.TEXT_SIZE_SMALL -> 12f
Preferences.TEXT_SIZE_NORMAL -> 14f
Preferences.TEXT_SIZE_LARGE -> 16f
Preferences.TEXT_SIZE_LARGER -> 18f
else -> 14f
}
SIZE_TERTIARY -> textSize = when (textSizePref) {
Preferences.TEXT_SIZE_SMALL -> 10f
Preferences.TEXT_SIZE_NORMAL -> 12f
Preferences.TEXT_SIZE_LARGE -> 14f
Preferences.TEXT_SIZE_LARGER -> 16f
else -> 12f
}
SIZE_TOOLBAR -> textSize = when (textSizePref) {
Preferences.TEXT_SIZE_SMALL -> 18f
Preferences.TEXT_SIZE_NORMAL -> 20f
Preferences.TEXT_SIZE_LARGE -> 22f
Preferences.TEXT_SIZE_LARGER -> 26f
else -> 20f
}
}
})
.autoDisposable(scope())
.subscribe()
}
}
@@ -23,12 +23,18 @@ import android.graphics.Typeface
import android.support.text.emoji.widget.EmojiAppCompatTextView
import android.util.AttributeSet
import com.moez.QKSMS.R
import com.uber.autodispose.android.scope
import com.uber.autodispose.kotlin.autoDisposable
import common.util.Colors
import common.util.FontProvider
import common.util.extensions.getColorCompat
import injection.appComponent
import io.reactivex.Observable
import io.reactivex.disposables.Disposable
import io.reactivex.rxkotlin.Observables
import io.reactivex.subjects.BehaviorSubject
import io.reactivex.subjects.Subject
import util.Preferences
import javax.inject.Inject
open class QkTextView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null)
@@ -41,10 +47,16 @@ open class QkTextView @JvmOverloads constructor(context: Context, attrs: Attribu
const val COLOR_PRIMARY_ON_THEME = 3
const val COLOR_SECONDARY_ON_THEME = 4
const val COLOR_TERTIARY_ON_THEME = 5
const val SIZE_PRIMARY = 0
const val SIZE_SECONDARY = 1
const val SIZE_TERTIARY = 2
const val SIZE_TOOLBAR = 3
}
@Inject lateinit var colors: Colors
@Inject lateinit var fontProvider: FontProvider
@Inject lateinit var prefs: Preferences
var textColorObservable: Observable<Int>? = null
set(value) {
@@ -58,6 +70,8 @@ open class QkTextView @JvmOverloads constructor(context: Context, attrs: Attribu
field = value
}
private var textSizeAttrSubject: Subject<Int> = BehaviorSubject.create()
init {
if (!isInEditMode) {
appComponent.inject(this)
@@ -66,6 +80,8 @@ open class QkTextView @JvmOverloads constructor(context: Context, attrs: Attribu
context.obtainStyledAttributes(attrs, R.styleable.QkTextView)?.run {
val colorAttr = getInt(R.styleable.QkTextView_textColor, -1)
val textSizeAttr = getInt(R.styleable.QkTextView_textSize, -1)
if (isInEditMode) {
setTextColor(context.getColorCompat(when (colorAttr) {
COLOR_PRIMARY -> R.color.textPrimary
@@ -76,6 +92,14 @@ open class QkTextView @JvmOverloads constructor(context: Context, attrs: Attribu
COLOR_TERTIARY_ON_THEME -> R.color.textTertiaryDark
else -> R.color.textPrimary
}))
textSize = when (textSizeAttr) {
SIZE_PRIMARY -> 16f
SIZE_SECONDARY -> 14f
SIZE_TERTIARY -> 12f
SIZE_TOOLBAR -> 20f
else -> textSize
}
} else {
textColorObservable = when (colorAttr) {
COLOR_PRIMARY -> colors.textPrimary
@@ -86,12 +110,24 @@ open class QkTextView @JvmOverloads constructor(context: Context, attrs: Attribu
COLOR_TERTIARY_ON_THEME -> colors.textTertiaryOnTheme
else -> null
}
setTextSize(textSizeAttr)
}
recycle()
}
}
/**
* @see SIZE_PRIMARY
* @see SIZE_SECONDARY
* @see SIZE_TERTIARY
* @see SIZE_TOOLBAR
*/
fun setTextSize(size: Int) {
textSizeAttrSubject.onNext(size)
}
private fun updateSubscription() {
if (isAttachedToWindow) {
textColorDisposable = textColorObservable?.subscribe { color ->
@@ -103,7 +139,48 @@ open class QkTextView @JvmOverloads constructor(context: Context, attrs: Attribu
override fun onAttachedToWindow() {
super.onAttachedToWindow()
if (isInEditMode) return
updateSubscription()
Observables
.combineLatest(prefs.textSize.asObservable(), textSizeAttrSubject, { textSizePref, textSizeAttr ->
when (textSizeAttr) {
SIZE_PRIMARY -> textSize = when (textSizePref) {
Preferences.TEXT_SIZE_SMALL -> 14f
Preferences.TEXT_SIZE_NORMAL -> 16f
Preferences.TEXT_SIZE_LARGE -> 18f
Preferences.TEXT_SIZE_LARGER -> 20f
else -> 16f
}
SIZE_SECONDARY -> textSize = when (textSizePref) {
Preferences.TEXT_SIZE_SMALL -> 12f
Preferences.TEXT_SIZE_NORMAL -> 14f
Preferences.TEXT_SIZE_LARGE -> 16f
Preferences.TEXT_SIZE_LARGER -> 18f
else -> 14f
}
SIZE_TERTIARY -> textSize = when (textSizePref) {
Preferences.TEXT_SIZE_SMALL -> 10f
Preferences.TEXT_SIZE_NORMAL -> 12f
Preferences.TEXT_SIZE_LARGE -> 14f
Preferences.TEXT_SIZE_LARGER -> 16f
else -> 12f
}
SIZE_TOOLBAR -> textSize = when (textSizePref) {
Preferences.TEXT_SIZE_SMALL -> 18f
Preferences.TEXT_SIZE_NORMAL -> 20f
Preferences.TEXT_SIZE_LARGE -> 22f
Preferences.TEXT_SIZE_LARGER -> 26f
else -> 20f
}
}
})
.autoDisposable(scope())
.subscribe()
}
override fun onDetachedFromWindow() {
@@ -45,6 +45,7 @@ import common.util.extensions.dpToPx
import common.util.extensions.setBackgroundTint
import common.util.extensions.setTint
import common.util.extensions.setVisible
import common.widget.QkEditText
import feature.conversations.ConversationItemTouchCallback
import feature.conversations.ConversationsAdapter
import injection.appComponent
@@ -178,7 +179,7 @@ class MainActivity : QkThemedActivity<MainViewModel>(), MainView {
override fun render(state: MainState) {
toolbarSearch.isEnabled = state.page is Inbox
toolbarSearch.textSize = if (state.page is Inbox) 16f else 20f
toolbarSearch.setTextSize(if (state.page is Inbox) QkEditText.SIZE_PRIMARY else QkEditText.SIZE_TOOLBAR)
toolbar.menu.findItem(R.id.clear)?.run {
isVisible = state.page is Inbox && state.page.showClearButton
@@ -45,6 +45,7 @@ import javax.inject.Inject
class SettingsActivity : QkThemedActivity<SettingsViewModel>(), SettingsView {
@Inject lateinit var nightModeAdapter: MenuItemAdapter
@Inject lateinit var textSizeAdapter: MenuItemAdapter
@Inject lateinit var mmsSizeAdapter: MenuItemAdapter
override val viewModelClass = SettingsViewModel::class
@@ -53,6 +54,7 @@ class SettingsActivity : QkThemedActivity<SettingsViewModel>(), SettingsView {
override val viewQksmsPlusIntent: Subject<Unit> = PublishSubject.create()
override val startTimeSelectedIntent: Subject<Pair<Int, Int>> = PublishSubject.create()
override val endTimeSelectedIntent: Subject<Pair<Int, Int>> = PublishSubject.create()
override val textSizeSelectedIntent by lazy { textSizeAdapter.menuItemClicks }
override val mmsSizeSelectedIntent: Subject<Int> by lazy { mmsSizeAdapter.menuItemClicks }
// TODO remove this
@@ -65,6 +67,7 @@ class SettingsActivity : QkThemedActivity<SettingsViewModel>(), SettingsView {
}
private var nightModeDialog: AlertDialog? = null
private var textSizeDialog: AlertDialog? = null
private var mmsSizeDialog: AlertDialog? = null
override fun onCreate(savedInstanceState: Bundle?) {
@@ -76,6 +79,7 @@ class SettingsActivity : QkThemedActivity<SettingsViewModel>(), SettingsView {
viewModel.bindView(this)
nightModeAdapter.setData(R.array.night_modes)
textSizeAdapter.setData(R.array.text_sizes)
mmsSizeAdapter.setData(R.array.mms_sizes, R.array.mms_sizes_ids)
colors.background
@@ -114,6 +118,9 @@ class SettingsActivity : QkThemedActivity<SettingsViewModel>(), SettingsView {
autoEmoji.checkbox.isChecked = state.autoEmojiEnabled
delivery.checkbox.isChecked = state.deliveryEnabled
qkreply.checkbox.isChecked = state.qkReplyEnabled
textSize.summary = state.textSizeSummary
unicode.checkbox.isChecked = state.stripUnicodeEnabled
mms.checkbox.isChecked = state.mmsEnabled
@@ -157,6 +164,22 @@ class SettingsActivity : QkThemedActivity<SettingsViewModel>(), SettingsView {
}, hour, minute, false).show()
}
override fun showTextSizePicker() {
val recyclerView = RecyclerView(this)
recyclerView.layoutManager = LinearLayoutManager(this)
recyclerView.adapter = textSizeAdapter
recyclerView.setPadding(0, 8.dpToPx(this), 0, 8.dpToPx(this))
textSizeDialog = AlertDialog.Builder(this)
.setTitle(R.string.settings_text_size_title)
.setView(recyclerView)
.create().apply { show() }
}
override fun dismissTextSizePicker() {
textSizeDialog?.dismiss()
textSizeDialog = null
}
override fun showMmsSizePicker() {
val recyclerView = RecyclerView(this)
recyclerView.layoutManager = LinearLayoutManager(this)
@@ -34,6 +34,7 @@ data class SettingsState(
val notificationsEnabled: Boolean = true,
val deliveryEnabled: Boolean = false,
val qkReplyEnabled: Boolean = Build.VERSION.SDK_INT < Build.VERSION_CODES.N,
val textSizeSummary: String = "",
val splitSmsEnabled: Boolean = false,
val stripUnicodeEnabled: Boolean = false,
val mmsEnabled: Boolean = true,
@@ -18,11 +18,10 @@
*/
package feature.settings
import io.reactivex.Observable
import io.reactivex.subjects.Subject
import common.base.QkView
import common.widget.PreferenceView
import feature.settings.SettingsState
import io.reactivex.Observable
import io.reactivex.subjects.Subject
interface SettingsView : QkView<SettingsState> {
@@ -31,6 +30,7 @@ interface SettingsView : QkView<SettingsState> {
val viewQksmsPlusIntent: Subject<Unit>
val startTimeSelectedIntent: Subject<Pair<Int, Int>>
val endTimeSelectedIntent: Subject<Pair<Int, Int>>
val textSizeSelectedIntent: Subject<Int>
val mmsSizeSelectedIntent: Observable<Int>
fun showNightModeDialog()
@@ -38,6 +38,8 @@ interface SettingsView : QkView<SettingsState> {
fun showQksmsPlusSnackbar()
fun showStartTimePicker(hour: Int, minute: Int)
fun showEndTimePicker(hour: Int, minute: Int)
fun showTextSizePicker()
fun dismissTextSizePicker()
fun showMmsSizePicker()
fun dismissMmsSizePicker()
}
@@ -82,6 +82,10 @@ class SettingsViewModel : QkViewModel<SettingsView, SettingsState>(SettingsState
disposables += prefs.qkreply.asObservable()
.subscribe { enabled -> newState { it.copy(qkReplyEnabled = enabled) } }
val textSizeLabels = context.resources.getStringArray(R.array.text_sizes)
disposables += prefs.textSize.asObservable()
.subscribe { textSize -> newState { it.copy(textSizeSummary = textSizeLabels[textSize]) } }
disposables += prefs.unicode.asObservable()
.subscribe { enabled -> newState { it.copy(stripUnicodeEnabled = enabled) } }
@@ -136,6 +140,8 @@ class SettingsViewModel : QkViewModel<SettingsView, SettingsState>(SettingsState
R.id.qkreply -> prefs.qkreply.set(!prefs.qkreply.get())
R.id.textSize -> view.showTextSizePicker()
R.id.unicode -> prefs.unicode.set(!prefs.unicode.get())
R.id.mms -> prefs.mms.set(!prefs.mms.get())
@@ -179,6 +185,11 @@ class SettingsViewModel : QkViewModel<SettingsView, SettingsState>(SettingsState
.autoDisposable(view.scope())
.subscribe { prefs.nightEnd.set(it) }
view.textSizeSelectedIntent
.doOnNext { view.dismissTextSizePicker() }
.autoDisposable(view.scope())
.subscribe { prefs.textSize.set(it) }
view.mmsSizeSelectedIntent
.doOnNext { view.dismissMmsSizePicker() }
.autoDisposable(view.scope())
@@ -61,8 +61,13 @@ class MigratePreferences @Inject constructor(
prefs.delivery.set(rxPrefs.getBoolean("pref_key_delivery", prefs.delivery.get()).get())
}
.doOnNext {
// Quickreply
prefs.qkreply.set(rxPrefs.getBoolean("pref_key_quickreply_enabled", prefs.qkreply.get()).get())
}
.doOnNext {
// Font size
prefs.textSize.set(rxPrefs.getString("pref_key_font_size", "${prefs.textSize.get()}").get().toInt())
}
.doOnNext {
// Unicode
prefs.unicode.set(rxPrefs.getBoolean("pref_key_strip_unicode", prefs.unicode.get()).get())
@@ -19,7 +19,6 @@
-->
<merge android:id="@+id/avatar"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -25,6 +25,6 @@
android:imeOptions="flagNoExtractUi"
android:inputType="textFilter|textNoSuggestions"
android:privateImeOptions="nm"
android:textSize="16sp"
app:textColor="primary"
app:textColorHint="tertiary" />
app:textColorHint="tertiary"
app:textSize="primary" />
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?><!--
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
~
~ This file is part of QKSMS.
@@ -38,15 +39,7 @@
<common.widget.QkTextView
android:id="@+id/toolbarTitle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@null"
android:gravity="start|center_vertical"
android:maxLines="1"
android:singleLine="true"
android:textSize="20sp"
app:textColor="primary"
tools:text="Conversations" />
style="@style/ToolbarText" />
<android.support.v7.widget.RecyclerView
android:id="@+id/chips"
@@ -183,12 +176,12 @@
android:layout_height="0dp"
android:layout_marginBottom="4dp"
android:gravity="center"
android:textSize="12sp"
app:layout_constraintBottom_toTopOf="@id/send"
app:layout_constraintEnd_toEndOf="@id/send"
app:layout_constraintHeight_default="wrap"
app:layout_constraintStart_toStartOf="@id/send"
app:textColor="secondary"
app:textSize="tertiary"
tools:text="108 / 2" />
<ImageView
@@ -44,9 +44,9 @@
android:layout_gravity="center_vertical"
android:layout_marginLeft="8dp"
android:layout_marginRight="12dp"
android:textSize="14sp"
android:textStyle="bold"
app:textColor="primary"
app:textSize="secondary"
tools:text="Moez Bhatti" />
</LinearLayout>
@@ -63,18 +63,17 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:textSize="14sp"
app:textColor="secondary"
app:textSize="secondary"
tools:text="(123) 456-7890"
tools:textColor="@color/textSecondary" />
<common.widget.QkTextView
android:id="@+id/type"
style="@style/TextSecondary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:textSize="14sp"
app:textColor="tertiary"
tools:text="Mobile"
tools:textColor="@color/textTertiary" />
@@ -31,19 +31,18 @@
android:layout_marginStart="72dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:textSize="14sp"
app:textColor="secondary"
app:textSize="secondary"
tools:text="(123) 456-7890"
tools:textColor="@color/textSecondary" />
<common.widget.QkTextView
android:id="@+id/type"
style="@style/TextSecondary"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginEnd="16dp"
android:gravity="center_vertical"
android:textSize="14sp"
app:textColor="tertiary"
tools:text="Mobile"
tools:textColor="@color/textTertiary" />
@@ -38,26 +38,24 @@
<common.widget.QkTextView
android:id="@+id/name"
style="@style/TextPrimary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:textSize="16sp"
app:layout_constraintBottom_toTopOf="@id/address"
app:layout_constraintStart_toEndOf="@id/avatar"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
app:textColor="primary"
tools:text="Moez Bhatti" />
<common.widget.QkTextView
android:id="@+id/address"
style="@style/TextSecondary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@id/name"
app:layout_constraintTop_toBottomOf="@id/name"
app:textColor="tertiary"
tools:text="(123) 456-7890" />
<ImageView
@@ -19,6 +19,7 @@
-->
<FrameLayout android:id="@+id/root"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -42,11 +43,11 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@null"
android:gravity="left|center_vertical"
android:gravity="start|center_vertical"
android:maxLines="1"
android:singleLine="true"
android:textColor="@color/textPrimaryDark"
android:textSize="20sp"
app:textSize="toolbar"
tools:text="Conversations" />
</android.support.v7.widget.Toolbar>
@@ -71,6 +71,7 @@
<common.widget.QkTextView
android:id="@+id/syncingLabel"
style="@style/TextSecondary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="32dp"
@@ -80,8 +81,7 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/syncingProgress"
app:textColor="tertiary" />
app:layout_constraintTop_toBottomOf="@id/syncingProgress" />
<FrameLayout
android:id="@+id/synced"
@@ -120,8 +120,8 @@
android:layout_gravity="start"
android:layout_marginStart="72dp"
android:layout_marginTop="4dp"
android:textSize="12sp"
app:textColor="secondary"
app:textSize="tertiary"
tools:text="Sending..." />
</LinearLayout>
@@ -114,8 +114,8 @@
android:layout_gravity="end"
android:layout_marginEnd="24dp"
android:layout_marginTop="4dp"
android:textSize="12sp"
app:textColor="secondary"
app:textSize="tertiary"
tools:text="Sending..." />
</LinearLayout>
@@ -74,11 +74,11 @@
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:gravity="center"
android:textSize="12sp"
app:layout_constraintBottom_toTopOf="@id/send"
app:layout_constraintEnd_toEndOf="@id/send"
app:layout_constraintStart_toStartOf="@id/send"
app:textColor="secondary"
app:textSize="tertiary"
tools:text="108 / 2" />
<ImageView
@@ -63,9 +63,9 @@
android:layout_marginLeft="32dp"
android:layout_marginRight="32dp"
android:text="@string/qksms_plus_description_title"
android:textSize="16sp"
android:textStyle="bold"
app:textColor="primary" />
app:textColor="primary"
app:textSize="primary" />
<common.widget.QkTextView
android:id="@+id/description"
@@ -74,8 +74,8 @@
android:layout_marginLeft="32dp"
android:layout_marginRight="32dp"
android:text="@string/qksms_plus_description_summary"
android:textSize="14sp"
app:textColor="secondary" />
app:textColor="secondary"
app:textSize="secondary" />
<android.support.constraint.ConstraintLayout
android:id="@+id/thanks"
@@ -100,21 +100,21 @@
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:text="@string/qksms_plus_thanks_title"
android:textSize="14sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/thanksIcon"
app:textColor="primary" />
app:textColor="primary"
app:textSize="secondary" />
<common.widget.QkTextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/qksms_plus_thanks_summary"
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="@id/thanksTitle"
app:layout_constraintStart_toStartOf="@id/thanksTitle"
app:layout_constraintTop_toBottomOf="@id/thanksTitle"
app:textColor="secondary" />
app:textColor="secondary"
app:textSize="secondary" />
</android.support.constraint.ConstraintLayout>
@@ -175,9 +175,9 @@
android:layout_marginRight="16dp"
android:layout_marginTop="24dp"
android:text="@string/qksms_plus_coming_soon"
android:textSize="16sp"
android:textStyle="bold"
app:textColor="primary" />
app:textColor="primary"
app:textSize="primary" />
<common.widget.PreferenceView
android:layout_width="match_parent"
@@ -156,6 +156,12 @@
app:title="@string/settings_qkreply_title"
app:widget="@layout/settings_switch_widget" />
<common.widget.PreferenceView
android:id="@+id/textSize"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:title="@string/settings_text_size_title" />
<common.widget.PreferenceView
android:id="@+id/unicode"
android:layout_width="match_parent"
@@ -34,17 +34,16 @@
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/setup_title"
android:textSize="20sp"
app:textColor="primary" />
app:textColor="primary"
app:textSize="toolbar" />
<common.widget.QkTextView
style="@style/TextSecondary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:gravity="center"
android:text="@string/setup_summary"
android:textSize="14sp"
app:textColor="tertiary" />
android:text="@string/setup_summary" />
<Space
android:layout_width="match_parent"
@@ -57,6 +56,7 @@
<common.widget.QkTextView
android:id="@+id/skip"
style="@style/TextSecondary"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
@@ -64,9 +64,7 @@
android:gravity="center"
android:text="@string/setup_skip"
android:textAllCaps="true"
android:textSize="14sp"
android:textStyle="bold"
app:textColor="tertiary" />
android:textStyle="bold" />
<common.widget.QkTextView
android:id="@+id/next"
@@ -77,9 +75,9 @@
android:gravity="center"
android:text="@string/setup_next"
android:textAllCaps="true"
android:textSize="14sp"
android:textStyle="bold"
app:textColor="primary" />
app:textColor="primary"
app:textSize="secondary" />
</LinearLayout>
@@ -19,6 +19,7 @@
-->
<common.widget.QkTextView android:id="@+id/label"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/ripple"
@@ -27,5 +28,5 @@
android:paddingEnd="12dp"
android:paddingStart="12dp"
android:textAllCaps="true"
android:textSize="14sp"
android:textStyle="bold" />
android:textStyle="bold"
app:textSize="secondary" />
@@ -17,6 +17,7 @@
<common.widget.QkTextView
android:id="@+id/hexLabel"
style="@style/TextSecondary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
@@ -24,12 +25,10 @@
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:text="@string/theme_hex"
android:textSize="14sp"
android:textStyle="bold"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/picker"
app:textColor="tertiary" />
app:layout_constraintTop_toBottomOf="@id/picker" />
<common.widget.Separator
android:id="@+id/hexSeparator"
@@ -47,12 +46,12 @@
android:layout_marginStart="16dp"
android:gravity="center"
android:text="#"
android:textSize="14sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/hexLabel"
app:layout_constraintStart_toEndOf="@id/hexSeparator"
app:layout_constraintTop_toTopOf="@id/hexLabel"
app:textColor="primary"
app:textSize="secondary"
tools:ignore="HardcodedText" />
<common.widget.QkEditText
@@ -63,12 +62,12 @@
android:gravity="center"
android:paddingEnd="16dp"
android:textAllCaps="true"
android:textSize="14sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/hexLabel"
app:layout_constraintStart_toEndOf="@id/hexSign"
app:layout_constraintTop_toTopOf="@id/hexLabel"
app:textColor="primary"
app:textSize="secondary"
tools:text="1B8AE8" />
<android.support.constraint.Group
@@ -28,12 +28,21 @@
<enum name="tertiaryOnTheme" value="5" />
</attr>
<attr name="textSize" format="enum">
<enum name="primary" value="0" />
<enum name="secondary" value="1" />
<enum name="tertiary" value="2" />
<enum name="toolbar" value="3" />
</attr>
<declare-styleable name="QkTextView">
<attr name="textColor" />
<attr name="textSize" />
</declare-styleable>
<declare-styleable name="QkEditText">
<attr name="textColor" />
<attr name="textSize" />
<attr name="textColorHint" format="enum">
<enum name="primary" value="0" />
<enum name="secondary" value="1" />
@@ -97,6 +97,7 @@
<string name="settings_delivery_summary">Confirm that messages were sent successfully</string>
<string name="settings_qkreply_title">QK Reply</string>
<string name="settings_qkreply_summary">Popup for new messages</string>
<string name="settings_text_size_title">Font size</string>
<string name="settings_unicode_title">Strip accents</string>
<string name="settings_unicode_summary">Remove accents from characters in outgoing SMS messages</string>
<string name="settings_mms_title">MMS enabled</string>
@@ -182,6 +183,13 @@
<item>Automatic</item>
</string-array>
<string-array name="text_sizes">
<item>Small</item>
<item>Normal</item>
<item>Large</item>
<item>Larger</item>
</string-array>
<string-array name="mms_sizes">
<item>100KB</item>
<item>200KB</item>
+9 -9
View File
@@ -19,18 +19,18 @@
<resources>
<style name="TextPrimary">
<item name="android:textSize">16sp</item>
<item name="textColor">primary</item>
<item name="textSize">primary</item>
</style>
<style name="TextSecondary">
<item name="android:textSize">14sp</item>
<item name="textColor">tertiary</item>
<item name="textSize">secondary</item>
</style>
<style name="TextTertiary">
<item name="android:textSize">12sp</item>
<item name="textColor">tertiary</item>
<item name="textSize">tertiary</item>
</style>
<style name="TextTab">
@@ -41,8 +41,8 @@
<item name="android:paddingEnd">12sp</item>
<item name="android:paddingStart">12sp</item>
<item name="android:textAllCaps">true</item>
<item name="android:textSize">14sp</item>
<item name="android:textStyle">bold</item>
<item name="textSize">secondary</item>
</style>
<style name="TextButton">
@@ -52,8 +52,8 @@
<item name="android:paddingLeft">16dp</item>
<item name="android:paddingRight">16dp</item>
<item name="android:gravity">center</item>
<item name="android:textSize">14sp</item>
<item name="android:textStyle">bold</item>
<item name="textSize">secondary</item>
</style>
<style name="Toolbar">
@@ -73,8 +73,8 @@
<item name="android:gravity">start|center_vertical</item>
<item name="android:maxLines">1</item>
<item name="android:singleLine">true</item>
<item name="android:textSize">20sp</item>
<item name="textColor">primary</item>
<item name="textSize">toolbar</item>
</style>
<style name="PreferenceCategory">
@@ -84,13 +84,13 @@
<item name="android:layout_marginEnd">24dp</item>
<item name="android:layout_marginStart">24dp</item>
<item name="android:layout_marginTop">16dp</item>
<item name="android:textSize">14sp</item>
<item name="android:textStyle">bold</item>
<item name="textColor">secondary</item>
<item name="textSize">secondary</item>
</style>
<style name="CollapsingToolbarCollapsedText">
<item name="android:textSize">20sp</item>
<item name="textSize">toolbar</item>
</style>
<style name="CollapsingToolbarExpandedText">
@@ -111,9 +111,9 @@
<item name="android:layout_width">0dp</item>
<item name="android:layout_weight">1</item>
<item name="android:lines">1</item>
<item name="android:textSize">14sp</item>
<item name="android:textStyle">bold</item>
<item name="textColor">primary</item>
<item name="textSize">secondary</item>
</style>
<style name="DrawerIcon">