mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-03 23:15:31 +00:00
[fenix] For https://github.com/mozilla-mobile/fenix/issues/6123: Expose WebExtensions in private browsing control
This commit is contained in:
parent
eb26d39bf0
commit
c4dda61fe8
@ -81,6 +81,7 @@ class InstalledAddonDetailsFragment : Fragment() {
|
|||||||
bindSettings(view)
|
bindSettings(view)
|
||||||
bindDetails(view)
|
bindDetails(view)
|
||||||
bindPermissions(view)
|
bindPermissions(view)
|
||||||
|
bindAllowInPrivateBrowsingSwitch(view)
|
||||||
bindRemoveButton(view)
|
bindRemoveButton(view)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,6 +212,32 @@ class InstalledAddonDetailsFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun bindAllowInPrivateBrowsingSwitch(view: View) {
|
||||||
|
val switch = view.allow_in_private_browsing_switch
|
||||||
|
switch.isChecked = addon.isAllowedInPrivateBrowsing()
|
||||||
|
switch.setOnCheckedChangeListener { v, isChecked ->
|
||||||
|
val addonManager = v.context.components.addonManager
|
||||||
|
switch.isClickable = false
|
||||||
|
view.remove_add_on.isEnabled = false
|
||||||
|
addonManager.setAddonAllowedInPrivateBrowsing(
|
||||||
|
addon,
|
||||||
|
isChecked,
|
||||||
|
onSuccess = {
|
||||||
|
runIfFragmentIsAttached {
|
||||||
|
this.addon = it
|
||||||
|
switch.isClickable = true
|
||||||
|
view.remove_add_on.isEnabled = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onError = {
|
||||||
|
runIfFragmentIsAttached {
|
||||||
|
switch.isClickable = true
|
||||||
|
view.remove_add_on.isEnabled = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
private fun bindRemoveButton(view: View) {
|
private fun bindRemoveButton(view: View) {
|
||||||
view.remove_add_on.setOnClickListener {
|
view.remove_add_on.setOnClickListener {
|
||||||
setAllInteractiveViewsClickable(view, false)
|
setAllInteractiveViewsClickable(view, false)
|
||||||
|
@ -32,11 +32,29 @@
|
|||||||
android:textColor="?primaryText"
|
android:textColor="?primaryText"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
<Switch
|
||||||
|
android:id="@+id/allow_in_private_browsing_switch"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical|end"
|
||||||
|
android:layout_below="@+id/enable_switch"
|
||||||
|
android:background="?android:attr/selectableItemBackground"
|
||||||
|
android:checked="false"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
|
android:text="@string/mozac_feature_addons_settings_run_in_private_browsing"
|
||||||
|
android:padding="16dp"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textColor="?primaryText"
|
||||||
|
android:drawablePadding="32dp"
|
||||||
|
android:drawableStart="@drawable/ic_private_browsing"
|
||||||
|
app:drawableTint="?primaryText" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/settings"
|
android:id="@+id/settings"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/enable_switch"
|
android:layout_below="@+id/allow_in_private_browsing_switch"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:drawablePadding="32dp"
|
android:drawablePadding="32dp"
|
||||||
android:padding="16dp"
|
android:padding="16dp"
|
||||||
@ -76,8 +94,8 @@
|
|||||||
<Button
|
<Button
|
||||||
android:id="@+id/remove_add_on"
|
android:id="@+id/remove_add_on"
|
||||||
style="@style/DestructiveButton"
|
style="@style/DestructiveButton"
|
||||||
android:layout_below="@+id/permissions"
|
|
||||||
android:layout_marginHorizontal="16dp"
|
android:layout_marginHorizontal="16dp"
|
||||||
|
android:layout_below="@+id/permissions"
|
||||||
android:text="@string/mozac_feature_addons_remove" />
|
android:text="@string/mozac_feature_addons_remove" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
Loading…
Reference in New Issue
Block a user