add feature to delete addons cache file

change default search engine to DuckDuckGo
pull/700/head
akliuxingyuan 8 months ago
parent bd3f4ca813
commit d2b5721181

@ -3,6 +3,12 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/addons_delete_cache"
android:icon="@drawable/ic_delete"
android:title="@string/addons_delete_cache"
android:contentDescription="@string/addons_delete_cache"
app:showAsAction="ifRoom|collapseActionView" />
<item
android:id="@+id/search"
android:icon="@drawable/ic_search"

@ -3,6 +3,12 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/addons_delete_cache"
android:icon="@drawable/ic_delete"
android:title="@string/addons_delete_cache"
android:contentDescription="@string/addons_delete_cache"
app:showAsAction="ifRoom|collapseActionView" />
<item
android:id="@+id/search"
android:icon="@drawable/ic_search"

@ -3,6 +3,12 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/addons_delete_cache"
android:icon="@drawable/ic_delete"
android:title="@string/addons_delete_cache"
android:contentDescription="@string/addons_delete_cache"
app:showAsAction="ifRoom|collapseActionView" />
<item
android:id="@+id/search"
android:icon="@drawable/ic_search"

@ -16,6 +16,7 @@ import android.view.View
import android.view.inputmethod.EditorInfo
import android.view.accessibility.AccessibilityEvent
import androidx.annotation.VisibleForTesting
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.widget.SearchView
import androidx.core.view.MenuHost
import androidx.core.view.MenuProvider
@ -142,13 +143,37 @@ class AddonsManagementFragment : Fragment(R.layout.fragment_add_ons_management)
override fun onMenuItemSelected(menuItem: MenuItem): Boolean {
// Handle the menu selection
return true
return when (menuItem.itemId) {
R.id.addons_delete_cache -> {
showAlertDialog()
true
}
R.id.search -> {
true
}
else -> {true}
}
}
},
viewLifecycleOwner, Lifecycle.State.RESUMED,
)
}
private fun showAlertDialog() {
val builder: AlertDialog.Builder = AlertDialog.Builder(requireContext())
builder
.setMessage(R.string.confirm_addons_delete_cache)
.setPositiveButton(R.string.confirm_addons_delete_cache_yes) { _, _ ->
requireComponents.clearAddonCache()
}
.setNegativeButton(R.string.confirm_addons_delete_cache_no) { _, _ ->
// User cancelled the dialog.
}
val dialog: AlertDialog = builder.create()
dialog.show()
}
private fun searchAddons(addonSearchText: String): Boolean {
if (adapter == null) {
return false

@ -2433,4 +2433,14 @@
<string name="preferences_relinquish_memory_title">挂起标签页以避免因内存不足而进程被杀死</string>
<!-- Description for relinquish memory preference in customization settings -->
<string name="preferences_relinquish_memory_description">开启后,当系统内存不足时,标签页会被挂起,同时页面状态会丢失</string>
<string name="preferences_dns_over_https">基于 HTTPS 的 DNS</string>
<string name="preferences_dns_over_https_on">启用</string>
<string name="preferences_dns_over_https_off">关闭</string>
<string name="preferences_dns_over_https_title">基于 HTTPS 的 DNS</string>
<string name="preferences_dns_over_https_summary">基于 DNS 的 HTTPS 会加密发送您对域名的请求,从而建立安全 DNS使他人更难得知您要访问的网站</string>
<string name="preferences_dns_over_https_custom_server">自定义</string>
<string name="addons_delete_cache">删除附加组件元数据缓存文件</string>
<string name="confirm_addons_delete_cache">您确定要删除附加组件元数据缓存文件吗?</string>
<string name="confirm_addons_delete_cache_yes">确定</string>
<string name="confirm_addons_delete_cache_no">取消</string>
</resources>

@ -2407,4 +2407,14 @@
<string name="preferences_relinquish_memory_title">掛起標籤頁以避免因記憶體不足而程序被殺死</string>
<!-- Description for relinquish memory preference in customization settings -->
<string name="preferences_relinquish_memory_description">開啟後,當系統記憶體不足時,標籤頁會被掛起,同時頁面狀態會丟失</string>
<string name="preferences_dns_over_https">DNS over HTTPS</string>
<string name="preferences_dns_over_https_on">開啟</string>
<string name="preferences_dns_over_https_off">關閉</string>
<string name="preferences_dns_over_https_title">DNS over HTTPS</string>
<string name="preferences_dns_over_https_summary">DNS over HTTPS 會將您的網域名稱查詢請求加密後傳送,使其他人更難得知您要開啟的網站,讓 DNS 查詢變得安全。</string>
<string name="preferences_dns_over_https_custom_server">自定義</string>
<string name="addons_delete_cache">刪除附加元件元數據緩存檔案</string>
<string name="confirm_addons_delete_cache">您確定要刪除附加元件元數據緩存檔案嗎?</string>
<string name="confirm_addons_delete_cache_yes">確定</string>
<string name="confirm_addons_delete_cache_no">取消</string>
</resources>

@ -2111,4 +2111,14 @@
<string name="preferences_relinquish_memory_title">Suspend tabs to avoid being killed for memory</string>
<!-- Description for relinquish memory preference in customization settings -->
<string name="preferences_relinquish_memory_description">If enabled, tabs will be suspended and page state lost when the system is low on memory</string>
<string name="preferences_dns_over_https">DNS over HTTPS</string>
<string name="preferences_dns_over_https_on">On</string>
<string name="preferences_dns_over_https_off">Off</string>
<string name="preferences_dns_over_https_title">DNS over HTTPS mode</string>
<string name="preferences_dns_over_https_summary">Domain Name System (DNS) over HTTPS sends your request for a domain name through an encrypted connection, creating a secure DNS and making it harder for others to see which website youre about to access.</string>
<string name="preferences_dns_over_https_custom_server">Custom</string>
<string name="addons_delete_cache">Delete addons metadata cache file</string>
<string name="confirm_addons_delete_cache">Are you sure to delete addons metadata cache file?</string>
<string name="confirm_addons_delete_cache_yes">OK</string>
<string name="confirm_addons_delete_cache_no">Cancel</string>
</resources>

@ -1,6 +1,6 @@
{
"default": {
"searchDefault": "Google",
"searchDefault": "DuckDuckGo",
"searchOrder": ["Google", "Bing"],
"visibleDefaultEngines": [
"google-b-m", "bing", "amazondotcom", "ddg", "wikipedia", "startpage"

Loading…
Cancel
Save