1
0
Fork 0
fenix/app/src/main/java/org/mozilla/fenix/trackingprotection/TrackingProtectionBlockingF...

51 lines
1.8 KiB
Kotlin
Raw Normal View History

2019-09-10 22:29:21 +02:00
/* 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/. */
package org.mozilla.fenix.trackingprotection
import android.os.Bundle
import android.view.View
2019-10-06 19:57:41 +02:00
import androidx.core.view.isVisible
2019-09-10 22:29:21 +02:00
import androidx.fragment.app.Fragment
2019-10-06 19:57:41 +02:00
import androidx.navigation.fragment.navArgs
2019-09-10 22:29:21 +02:00
import kotlinx.android.synthetic.main.fragment_tracking_protection_blocking.*
import org.mozilla.fenix.R
2020-02-04 10:39:01 +01:00
import org.mozilla.fenix.ext.settings
2019-11-25 21:36:47 +01:00
import org.mozilla.fenix.ext.showToolbar
2019-09-10 22:29:21 +02:00
class TrackingProtectionBlockingFragment :
Fragment(R.layout.fragment_tracking_protection_blocking) {
2019-09-10 22:29:21 +02:00
2019-10-06 19:57:41 +02:00
private val args: TrackingProtectionBlockingFragmentArgs by navArgs()
private val settings by lazy { requireContext().settings() }
2019-09-10 22:29:21 +02:00
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
2020-02-04 10:39:01 +01:00
when (args.protectionMode) {
TrackingProtectionMode.STANDARD -> {
category_tracking_content.isVisible = false
2020-02-04 10:39:01 +01:00
}
TrackingProtectionMode.STRICT -> {}
TrackingProtectionMode.CUSTOM -> {
2020-02-04 10:39:01 +01:00
category_fingerprinters.isVisible =
settings.blockFingerprintersInCustomTrackingProtection
2020-02-04 10:39:01 +01:00
category_cryptominers.isVisible =
settings.blockCryptominersInCustomTrackingProtection
2020-02-04 10:39:01 +01:00
category_cookies.isVisible =
settings.blockCookiesInCustomTrackingProtection
category_tracking_content.isVisible =
settings.blockTrackingContentInCustomTrackingProtection
2020-02-04 10:39:01 +01:00
}
}
2019-09-10 22:29:21 +02:00
}
override fun onResume() {
super.onResume()
showToolbar(getString(args.protectionMode.titleRes))
}
2019-09-10 22:29:21 +02:00
}