2
0
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/225 - Adds delete browsing data fragment

This commit is contained in:
Jeff Boek 2019-05-23 15:10:00 -07:00
parent df015ab86a
commit f0e5e9a3b7
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()

View File

@ -1,14 +1,12 @@
<?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/. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<!-- photonRed60-->
<path
android:pathData="M12.531,17.5009C12.2549,17.5009 12.031,17.2771 12.031,17.0009L12,9.0009C12,8.7248 12.2239,8.5009 12.5,8.5009C12.7761,8.5009 13,8.7248 13,9.0009L13.031,17.0009C13.031,17.2771 12.8071,17.5009 12.531,17.5009ZM15,17.5009C14.7239,17.5009 14.5,17.2771 14.5,17.0009L14.5,9.0009C14.5,8.7248 14.7239,8.5009 15,8.5009C15.2761,8.5009 15.5,8.7248 15.5,9.0009L15.5,17.0009C15.5,17.2771 15.2761,17.5009 15,17.5009ZM10,17.5009C9.7239,17.5009 9.5,17.2771 9.5,17.0009L9.5,9.0009C9.5,8.7248 9.7239,8.5009 10,8.5009C10.2761,8.5009 10.5,8.7248 10.5,9.0009L10.5,17.0009C10.5,17.2771 10.2761,17.5009 10,17.5009ZM19,4.0009L15.316,4.0009C14.8986,2.8028 13.7688,2 12.5,2C11.2312,2 10.1014,2.8028 9.684,4.0009L6,4.0009C5.4477,4.0009 5,4.4487 5,5.0009C5,5.5532 5.4477,6.0009 6,6.0009L6,19.0009C6,20.6578 7.3431,22.0009 9,22.0009L16,22.0009C17.6569,22.0009 19,20.6578 19,19.0009L19,6.0009C19.5523,6.0009 20,5.5532 20,5.0009C20,4.4487 19.5523,4.0009 19,4.0009ZM12.5,3.0009C13.2113,3.0031 13.8676,3.3842 14.222,4.0009L10.778,4.0009C11.1324,3.3842 11.7887,3.0031 12.5,3.0009L12.5,3.0009ZM17,19.0009C17,19.5532 16.5523,20.0009 16,20.0009L9,20.0009C8.4477,20.0009 8,19.5532 8,19.0009L8,6.0009L17,6.0009L17,19.0009Z"
android:fillColor="?destructive" />
android:strokeWidth="1"
android:fillColor="#20123A"
android:fillType="evenOdd"
android:strokeColor="#00000000"/>
</vector>

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"