Fixed texts being incorrect if injected from context
This commit is contained in:
parent
d3dffe8165
commit
6977dc082f
@ -8,6 +8,7 @@ import android.os.Build
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
|
import com.topjohnwu.magisk.core.ResourceMgr
|
||||||
import com.topjohnwu.magisk.utils.RxBus
|
import com.topjohnwu.magisk.utils.RxBus
|
||||||
import org.koin.core.qualifier.named
|
import org.koin.core.qualifier.named
|
||||||
import org.koin.dsl.module
|
import org.koin.dsl.module
|
||||||
@ -17,7 +18,7 @@ val Protected = named("protected")
|
|||||||
|
|
||||||
val applicationModule = module {
|
val applicationModule = module {
|
||||||
single { RxBus() }
|
single { RxBus() }
|
||||||
factory { get<Context>().resources }
|
factory { ResourceMgr.resource }
|
||||||
factory { get<Context>().packageManager }
|
factory { get<Context>().packageManager }
|
||||||
factory(Protected) { createDEContext(get()) }
|
factory(Protected) { createDEContext(get()) }
|
||||||
single(SUTimeout) { get<Context>(Protected).getSharedPreferences("su_timeout", 0) }
|
single(SUTimeout) { get<Context>(Protected).getSharedPreferences("su_timeout", 0) }
|
||||||
|
@ -4,6 +4,7 @@ import android.content.res.Resources
|
|||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.databinding.BindingAdapter
|
import androidx.databinding.BindingAdapter
|
||||||
import androidx.databinding.InverseBindingAdapter
|
import androidx.databinding.InverseBindingAdapter
|
||||||
|
import com.topjohnwu.magisk.extensions.get
|
||||||
|
|
||||||
sealed class TransitiveText {
|
sealed class TransitiveText {
|
||||||
|
|
||||||
@ -47,7 +48,7 @@ fun CharSequence.asTransitive() = TransitiveText.String(this)
|
|||||||
|
|
||||||
@BindingAdapter("android:text")
|
@BindingAdapter("android:text")
|
||||||
fun TextView.setText(text: TransitiveText) {
|
fun TextView.setText(text: TransitiveText) {
|
||||||
this.text = text.getText(resources)
|
this.text = text.getText(get())
|
||||||
}
|
}
|
||||||
|
|
||||||
@InverseBindingAdapter(attribute = "android:text", event = "android:textAttrChanged")
|
@InverseBindingAdapter(attribute = "android:text", event = "android:textAttrChanged")
|
||||||
|
Loading…
Reference in New Issue
Block a user