Fixed texts being incorrect if injected from context

This commit is contained in:
Viktor De Pasquale 2020-02-01 16:21:53 +01:00 committed by John Wu
parent d3dffe8165
commit 6977dc082f
2 changed files with 4 additions and 2 deletions

View File

@ -8,6 +8,7 @@ import android.os.Build
import android.os.Bundle
import androidx.localbroadcastmanager.content.LocalBroadcastManager
import androidx.preference.PreferenceManager
import com.topjohnwu.magisk.core.ResourceMgr
import com.topjohnwu.magisk.utils.RxBus
import org.koin.core.qualifier.named
import org.koin.dsl.module
@ -17,7 +18,7 @@ val Protected = named("protected")
val applicationModule = module {
single { RxBus() }
factory { get<Context>().resources }
factory { ResourceMgr.resource }
factory { get<Context>().packageManager }
factory(Protected) { createDEContext(get()) }
single(SUTimeout) { get<Context>(Protected).getSharedPreferences("su_timeout", 0) }

View File

@ -4,6 +4,7 @@ import android.content.res.Resources
import android.widget.TextView
import androidx.databinding.BindingAdapter
import androidx.databinding.InverseBindingAdapter
import com.topjohnwu.magisk.extensions.get
sealed class TransitiveText {
@ -47,7 +48,7 @@ fun CharSequence.asTransitive() = TransitiveText.String(this)
@BindingAdapter("android:text")
fun TextView.setText(text: TransitiveText) {
this.text = text.getText(resources)
this.text = text.getText(get())
}
@InverseBindingAdapter(attribute = "android:text", event = "android:textAttrChanged")