mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-19 09:25:34 +00:00
[fenix] For https://github.com/mozilla-mobile/fenix/issues/2395 - Navigates to turn on sync on button press
This commit is contained in:
parent
eca427d9f9
commit
d9812a5ce0
@ -5,15 +5,22 @@
|
||||
package org.mozilla.fenix.home.sessioncontrol.viewholders.onboarding
|
||||
|
||||
import android.view.View
|
||||
import androidx.navigation.Navigation
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import kotlinx.android.synthetic.main.onboarding_firefox_account.view.*
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.home.HomeFragmentDirections
|
||||
|
||||
class OnboardingFirefoxAccountViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
|
||||
init {
|
||||
val appName = view.context.getString(R.string.app_name)
|
||||
view.header_text.text = view.context.getString(R.string.onboarding_firefox_account_header, appName)
|
||||
|
||||
view.turn_on_sync_button.setOnClickListener {
|
||||
val directions = HomeFragmentDirections.actionHomeFragmentToTurnOnSyncFragment()
|
||||
Navigation.findNavController(view).navigate(directions)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
@ -14,8 +14,6 @@ import androidx.recyclerview.widget.RecyclerView
|
||||
import kotlinx.android.synthetic.main.onboarding_private_browsing.view.*
|
||||
import org.mozilla.fenix.R
|
||||
|
||||
|
||||
|
||||
class OnboardingPrivateBrowsingViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
|
||||
init {
|
||||
|
@ -11,7 +11,6 @@ import androidx.recyclerview.widget.RecyclerView
|
||||
import kotlinx.android.synthetic.main.onboarding_section_header.view.*
|
||||
import kotlinx.android.synthetic.main.onboarding_theme_picker.view.*
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.ext.asActivity
|
||||
import org.mozilla.fenix.ext.components
|
||||
import org.mozilla.fenix.utils.Settings
|
||||
|
||||
|
@ -34,7 +34,6 @@ class OnboardingTrackingProtectionViewHolder(val view: View) : RecyclerView.View
|
||||
switch.setOnCheckedChangeListener { _, isChecked ->
|
||||
updateTrackingProtectionSetting(isChecked)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun updateTrackingProtectionSetting(enabled: Boolean) {
|
||||
@ -42,12 +41,9 @@ class OnboardingTrackingProtectionViewHolder(val view: View) : RecyclerView.View
|
||||
with(view.context.components.core) {
|
||||
val policy = createTrackingProtectionPolicy(enabled)
|
||||
engine.settings.trackingProtectionPolicy = policy
|
||||
with(sessionManager) {
|
||||
sessions.forEach {
|
||||
if (enabled)
|
||||
getEngineSession(it)?.enableTrackingProtection(policy) else
|
||||
getEngineSession(it)?.disableTrackingProtection()
|
||||
}
|
||||
sessionManager.sessions.forEach {
|
||||
if (enabled) sessionManager.getEngineSession(it)?.enableTrackingProtection(policy)
|
||||
else sessionManager.getEngineSession(it)?.disableTrackingProtection()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,6 @@ object SupportUtils {
|
||||
setPackage(context.packageName)
|
||||
}
|
||||
|
||||
|
||||
private fun getEncodedTopicUTF8(topic: String): String {
|
||||
try {
|
||||
return URLEncoder.encode(topic, "UTF-8")
|
||||
|
@ -20,7 +20,7 @@
|
||||
android:textAppearance="@style/Header16TextStyle"
|
||||
android:textColor="@color/onboarding_card_primary_text_dark"/>
|
||||
<FrameLayout
|
||||
android:id="@+id/read_button"
|
||||
android:id="@+id/turn_on_sync_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
|
@ -20,6 +20,9 @@
|
||||
android:name="org.mozilla.fenix.home.HomeFragment"
|
||||
android:label="fragment_home"
|
||||
tools:layout="@layout/fragment_home">
|
||||
<action
|
||||
android:id="@+id/action_homeFragment_to_turnOnSyncFragment"
|
||||
app:destination="@+id/turnOnSyncFragment" />
|
||||
<action
|
||||
android:id="@+id/action_homeFragment_to_searchFragment"
|
||||
app:destination="@id/searchFragment" />
|
||||
|
Loading…
Reference in New Issue
Block a user