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

58 lines
2.1 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()
2020-02-04 10:39:01 +01:00
private var isCustomProtection: Boolean = false
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
isCustomProtection = requireContext().settings().useCustomTrackingProtection
}
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) {
getString(R.string.preference_enhanced_tracking_protection_strict) -> {
category_fingerprinters.isVisible = true
category_tracking_content.isVisible = true
}
getString(R.string.preference_enhanced_tracking_protection_custom) -> {
category_fingerprinters.isVisible =
requireContext().settings().blockFingerprintersInCustomTrackingProtection
category_cryptominers.isVisible =
requireContext().settings().blockCryptominersInCustomTrackingProtection
category_cookies.isVisible =
requireContext().settings().blockCookiesInCustomTrackingProtection
}
getString(R.string.preference_enhanced_tracking_protection_standard) -> return
else -> return
}
2019-09-10 22:29:21 +02:00
}
override fun onResume() {
super.onResume()
2020-02-04 10:39:01 +01:00
showToolbar(args.protectionMode)
}
2019-09-10 22:29:21 +02:00
}