parent
a07b6d8c0f
commit
c81cfab84e
|
@ -45,4 +45,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
### Changed
|
||||
- #1429 - Updated site permissions ui for MVP
|
||||
- #1599 - Fixed a crash creating a bookmark for a custom tab
|
||||
- #1414 - Fixed site permissions settings getting reset in Android 6.
|
||||
### Removed
|
||||
|
|
|
@ -6,10 +6,13 @@ package org.mozilla.fenix.settings
|
|||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import android.widget.RadioButton
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.text.HtmlCompat
|
||||
import mozilla.components.feature.sitepermissions.SitePermissions
|
||||
import mozilla.components.feature.sitepermissions.SitePermissionsRules
|
||||
import org.mozilla.fenix.DefaultThemeManager
|
||||
import org.mozilla.fenix.R
|
||||
|
||||
internal fun SitePermissionsRules.Action.toString(context: Context): String {
|
||||
|
@ -95,6 +98,19 @@ fun PhoneFeature.getPreferenceKey(context: Context): String {
|
|||
}
|
||||
}
|
||||
|
||||
/* In devices with Android 6, when we use android:button="@null" android:drawableStart doesn't work via xml
|
||||
* as a result we have to apply it programmatically. More info about this issue https://github.com/mozilla-mobile/fenix/issues/1414
|
||||
*/
|
||||
fun RadioButton.setStartCheckedIndicator() {
|
||||
val attr =
|
||||
DefaultThemeManager.resolveAttribute(android.R.attr.listChoiceIndicatorSingle, context)
|
||||
val buttonDrawable = ContextCompat.getDrawable(context, attr)
|
||||
buttonDrawable.apply {
|
||||
this?.setBounds(0, 0, this.intrinsicWidth, this.intrinsicHeight)
|
||||
}
|
||||
this.setCompoundDrawables(buttonDrawable, null, null, null)
|
||||
}
|
||||
|
||||
fun initBlockedByAndroidView(phoneFeature: PhoneFeature, blockedByAndroidView: View) {
|
||||
val context = blockedByAndroidView.context
|
||||
if (!phoneFeature.isAndroidPermissionGranted(context)) {
|
||||
|
|
|
@ -99,6 +99,7 @@ class SitePermissionsManageExceptionsPhoneFeatureFragment : Fragment(), Coroutin
|
|||
private fun RadioButton.restoreState(status: SitePermissions.Status) {
|
||||
if (phoneFeature.getStatus(sitePermissions) == status) {
|
||||
this.isChecked = true
|
||||
this.setStartCheckedIndicator()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -94,6 +94,7 @@ class SitePermissionsManagePhoneFeatureFragment : Fragment() {
|
|||
private fun RadioButton.restoreState(action: SitePermissionsRules.Action) {
|
||||
if (phoneFeature.action == action) {
|
||||
this.isChecked = true
|
||||
this.setStartCheckedIndicator()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue