mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-12-22 23:36:18 +00:00
Fixed text color in logs not changing with theme
This commit is contained in:
@@ -6,7 +6,7 @@ import androidx.databinding.ViewDataBinding
|
|||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.topjohnwu.magisk.R
|
import com.topjohnwu.magisk.R
|
||||||
|
|
||||||
class ConsoleRvItem(val item: String) : LenientRvItem<ConsoleRvItem>() {
|
open class ConsoleRvItem(val item: String) : LenientRvItem<ConsoleRvItem>() {
|
||||||
override val layoutRes: Int = R.layout.item_console
|
override val layoutRes: Int = R.layout.item_console
|
||||||
|
|
||||||
override fun onBindingBound(binding: ViewDataBinding, recyclerView: RecyclerView) {
|
override fun onBindingBound(binding: ViewDataBinding, recyclerView: RecyclerView) {
|
||||||
@@ -23,4 +23,8 @@ class ConsoleRvItem(val item: String) : LenientRvItem<ConsoleRvItem>() {
|
|||||||
|
|
||||||
override fun contentSameAs(other: ConsoleRvItem) = itemSameAs(other)
|
override fun contentSameAs(other: ConsoleRvItem) = itemSameAs(other)
|
||||||
override fun itemSameAs(other: ConsoleRvItem) = item == other.item
|
override fun itemSameAs(other: ConsoleRvItem) = item == other.item
|
||||||
|
}
|
||||||
|
|
||||||
|
class ConsoleItem(item: String) : ConsoleRvItem(item) {
|
||||||
|
override val layoutRes = R.layout.item_console_md2
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@ import com.topjohnwu.magisk.data.repository.LogRepository
|
|||||||
import com.topjohnwu.magisk.databinding.ComparableRvItem
|
import com.topjohnwu.magisk.databinding.ComparableRvItem
|
||||||
import com.topjohnwu.magisk.extensions.subscribeK
|
import com.topjohnwu.magisk.extensions.subscribeK
|
||||||
import com.topjohnwu.magisk.model.binding.BindingAdapter
|
import com.topjohnwu.magisk.model.binding.BindingAdapter
|
||||||
import com.topjohnwu.magisk.model.entity.recycler.ConsoleRvItem
|
import com.topjohnwu.magisk.model.entity.recycler.ConsoleItem
|
||||||
import com.topjohnwu.magisk.model.entity.recycler.LogItem
|
import com.topjohnwu.magisk.model.entity.recycler.LogItem
|
||||||
import com.topjohnwu.magisk.model.events.SnackbarEvent
|
import com.topjohnwu.magisk.model.events.SnackbarEvent
|
||||||
import com.topjohnwu.magisk.redesign.compat.CompatViewModel
|
import com.topjohnwu.magisk.redesign.compat.CompatViewModel
|
||||||
@@ -58,8 +58,8 @@ class LogViewModel(
|
|||||||
.ignoreElement()
|
.ignoreElement()
|
||||||
|
|
||||||
val console = repo.fetchMagiskLogs()
|
val console = repo.fetchMagiskLogs()
|
||||||
|
.map { ConsoleItem(it) }
|
||||||
.toList()
|
.toList()
|
||||||
.map { it.map { ConsoleRvItem(it) } }
|
|
||||||
.observeOn(Schedulers.computation())
|
.observeOn(Schedulers.computation())
|
||||||
.map { it to itemsConsole.calculateDiff(it) }
|
.map { it to itemsConsole.calculateDiff(it) }
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
|||||||
27
app/src/main/res/layout/item_console_md2.xml
Normal file
27
app/src/main/res/layout/item_console_md2.xml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<variable
|
||||||
|
name="item"
|
||||||
|
type="com.topjohnwu.magisk.model.entity.recycler.ConsoleRvItem" />
|
||||||
|
|
||||||
|
<!--no actions are required-->
|
||||||
|
<variable
|
||||||
|
name="viewModel"
|
||||||
|
type="Object" />
|
||||||
|
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fontFamily="monospace"
|
||||||
|
android:text="@{item.item}"
|
||||||
|
android:textAppearance="?appearanceTextCaptionNormal"
|
||||||
|
android:textSize="10sp"
|
||||||
|
tools:text="@tools:sample/lorem/random" />
|
||||||
|
|
||||||
|
</layout>
|
||||||
Reference in New Issue
Block a user