1
0
Fork 0

For #225 - Adds delete browsing data fragment

master
Jeff Boek 2019-05-23 15:10:00 -07:00
parent 01c9317be0
commit 182bbdf359
8 changed files with 77 additions and 6 deletions

View File

@ -0,0 +1,28 @@
/* 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.settings
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import org.mozilla.fenix.R
class DeleteBrowsingDataFragment : Fragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_delete_browsing_data, container, false)
}
override fun onResume() {
super.onResume()
(activity as AppCompatActivity).apply {
title = getString(R.string.preferences_delete_browsing_data)
supportActionBar?.show()
}
}
}

View File

@ -33,6 +33,7 @@ import org.mozilla.fenix.R.string.pref_key_accessibility
import org.mozilla.fenix.R.string.pref_key_account
import org.mozilla.fenix.R.string.pref_key_account_category
import org.mozilla.fenix.R.string.pref_key_data_choices
import org.mozilla.fenix.R.string.pref_key_delete_browsing_data
import org.mozilla.fenix.R.string.pref_key_help
import org.mozilla.fenix.R.string.pref_key_language
import org.mozilla.fenix.R.string.pref_key_leakcanary
@ -161,6 +162,9 @@ class SettingsFragment : PreferenceFragmentCompat(), CoroutineScope, AccountObse
resources.getString(pref_key_account) -> {
navigateToAccountSettings()
}
resources.getString(pref_key_delete_browsing_data) -> {
navigateToDeleteBrowsingData()
}
resources.getString(pref_key_theme) -> {
navigateToThemeSettings()
}
@ -293,6 +297,11 @@ class SettingsFragment : PreferenceFragmentCompat(), CoroutineScope, AccountObse
Navigation.findNavController(view!!).navigate(directions)
}
private fun navigateToDeleteBrowsingData() {
val directions = SettingsFragmentDirections.actionSettingsFragmentToDeleteBrowsingDataFragment()
Navigation.findNavController(view!!).navigate(directions)
}
override fun onAuthenticated(account: OAuthAccount) {
updateAuthState(account)
updateSignInVisibility()

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

View File

@ -283,6 +283,9 @@
<action
android:id="@+id/action_settingsFragment_to_trackingProtectionFragment"
app:destination="@id/trackingProtectionFragment" />
<action
android:id="@+id/action_settingsFragment_to_deleteBrowsingDataFragment"
app:destination="@id/deleteBrowsingDataFragment" />
</fragment>
<fragment
android:id="@+id/dataChoicesFragment"
@ -378,6 +381,11 @@
android:id="@+id/action_trackingProtectionFragment_to_exceptionsFragment"
app:destination="@id/exceptionsFragment" />
</fragment>
<fragment
android:id="@+id/deleteBrowsingDataFragment"
android:name="org.mozilla.fenix.settings.DeleteBrowsingDataFragment"
android:label="DeleteBrowsingDataFragment">
</fragment>
<fragment
android:id="@+id/exceptionsFragment"
android:name="org.mozilla.fenix.exceptions.ExceptionsFragment"

View File

@ -13,6 +13,7 @@
<string name="pref_key_accessibility_font_scale" translatable="false">pref_key_accessibility_font_scale</string>
<string name="pref_key_language" translatable="false">pref_key_language</string>
<string name="pref_key_data_choices" translatable="false">pref_key_data_choices</string>
<string name="pref_key_delete_browsing_data" translatable="false">pref_key_delete_browsing_data</string>
<string name="pref_key_help" translatable="false">pref_key_help</string>
<string name="pref_key_rate" translatable="false">pref_key_rate</string>
<string name="pref_key_feedback" translatable="false">pref_key_feedback</string>

View File

@ -557,8 +557,12 @@
<string name="preference_accessibility_text_size_summary">Make text on websites larger or smaller</string>
<!-- Title for Accessiblity Text Size Scaling Preference -->
<string name="preference_accessibility_font_size_title">Font Size</string>
<!-- Title for Accessiblity Text Automatic Size Scaling Preference -->
<string name="preference_accessibility_auto_size">Automatic Font Sizing</string>
<!-- Summary for Accessiblity Text Automatic Size Scaling Preference -->
<string name="preference_accessibility_auto_size_summary">Font size will match your Android settings. Disable to manage font size here.</string>
<!-- Title for the Delete browsing data preference -->
<string name="preferences_delete_browsing_data">Delete browsing data</string>
</resources>

View File

@ -59,6 +59,10 @@
android:icon="@drawable/ic_permission"
android:key="@string/pref_key_site_permissions"
android:title="@string/preferences_site_permissions" />
<androidx.preference.Preference
android:icon="@drawable/ic_delete"
android:key="@string/pref_key_delete_browsing_data"
android:title="@string/preferences_delete_browsing_data" />
<androidx.preference.Preference
android:icon="@drawable/ic_data_collection"
android:key="@string/pref_key_data_choices"