mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-16 19:18:52 +01:00
Use FlexLayoutManager for themes
This commit is contained in:
@@ -3,13 +3,15 @@ package com.moez.QKSMS.presentation.settings
|
||||
import android.app.AlertDialog
|
||||
import android.app.ProgressDialog
|
||||
import android.os.Bundle
|
||||
import android.support.v7.widget.LinearLayoutManager
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import com.google.android.flexbox.FlexboxLayoutManager
|
||||
import com.jakewharton.rxbinding2.view.clicks
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.common.di.appComponent
|
||||
import com.moez.QKSMS.common.util.extensions.dpToPx
|
||||
import com.moez.QKSMS.presentation.common.base.QkActivity
|
||||
import com.moez.QKSMS.presentation.common.widget.PreferenceView
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import io.reactivex.subjects.PublishSubject
|
||||
import io.reactivex.subjects.Subject
|
||||
@@ -20,10 +22,10 @@ class SettingsActivity : QkActivity<SettingsViewModel>(), SettingsView {
|
||||
|
||||
override val viewModelClass = SettingsViewModel::class
|
||||
override val preferenceClickIntent: Subject<PreferenceView> = PublishSubject.create()
|
||||
override val themeSelectedIntent by lazy { themeAdapter.colorSelected }
|
||||
override val themeSelectedIntent: Observable<Int> by lazy { themeAdapter.colorSelected }
|
||||
|
||||
// TODO remove this
|
||||
private val progressDialog by lazy {
|
||||
// TODO remove this
|
||||
ProgressDialog(this).apply {
|
||||
isIndeterminate = true
|
||||
setCancelable(false)
|
||||
@@ -41,14 +43,21 @@ class SettingsActivity : QkActivity<SettingsViewModel>(), SettingsView {
|
||||
|
||||
private val themeRecyclerView by lazy {
|
||||
RecyclerView(this).apply {
|
||||
layoutManager = LinearLayoutManager(this@SettingsActivity, LinearLayoutManager.HORIZONTAL, false)
|
||||
val padding = 8.dpToPx(context)
|
||||
setPadding(padding, padding, padding, padding)
|
||||
adapter = themeAdapter
|
||||
clipToPadding = false
|
||||
clipChildren = false
|
||||
layoutManager = FlexboxLayoutManager(this@SettingsActivity)
|
||||
}
|
||||
}
|
||||
|
||||
private val themeAdapter by lazy {
|
||||
ThemeAdapter(this@SettingsActivity).apply {
|
||||
data = listOf(0xFF008389, 0xFF04CBC9, 0xFF00D99B, 0xFF00A3F3, 0xFFF8BBD0).map { it.toInt() }
|
||||
data = listOf(
|
||||
-0x1f0d0f, -0x4d2025, -0x7f343c, -0xb24954,
|
||||
-0xd95966, -0xff6978, -0xff7685, -0xff8695,
|
||||
-0xff96a4, -0xffb2c0)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user