For #8202: Remove settings if add-on disabled
- Also fixes the crash described in #8202.
This commit is contained in:
parent
8a92e15667
commit
142104dc86
|
@ -9,9 +9,11 @@ import android.view.LayoutInflater
|
|||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Switch
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.navigation.Navigation
|
||||
import androidx.navigation.findNavController
|
||||
import kotlinx.android.synthetic.main.activity_addons.view.*
|
||||
import kotlinx.android.synthetic.main.fragment_installed_add_on_details.view.*
|
||||
import mozilla.components.feature.addons.Addon
|
||||
import mozilla.components.feature.addons.ui.translate
|
||||
|
@ -64,6 +66,7 @@ class InstalledAddonDetailsFragment : Fragment() {
|
|||
runIfFragmentIsAttached {
|
||||
switch.isClickable = true
|
||||
switch.setText(R.string.mozac_feature_addons_settings_on)
|
||||
view.settings.isVisible = true
|
||||
this.addon = it
|
||||
showSnackBar(
|
||||
view,
|
||||
|
@ -94,6 +97,7 @@ class InstalledAddonDetailsFragment : Fragment() {
|
|||
runIfFragmentIsAttached {
|
||||
switch.isClickable = true
|
||||
switch.setText(R.string.mozac_feature_addons_settings_off)
|
||||
view.settings.isVisible = false
|
||||
this.addon = it
|
||||
showSnackBar(
|
||||
view,
|
||||
|
@ -123,7 +127,7 @@ class InstalledAddonDetailsFragment : Fragment() {
|
|||
|
||||
private fun bindSettings(view: View) {
|
||||
view.settings.apply {
|
||||
isEnabled = addon.installedState?.optionsPageUrl != null
|
||||
isVisible = !addon.installedState?.optionsPageUrl.isNullOrEmpty()
|
||||
setOnClickListener {
|
||||
val directions =
|
||||
InstalledAddonDetailsFragmentDirections.actionInstalledAddonFragmentToAddonInternalSettingsFragment(
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -79,4 +79,4 @@
|
|||
android:text="@string/mozac_feature_addons_remove"
|
||||
android:textColor="@color/photonRed50" />
|
||||
</RelativeLayout>
|
||||
</ScrollView>
|
||||
</FrameLayout>
|
||||
|
|
Loading…
Reference in New Issue
Block a user