[Android] Support import of passwords from CSV (#31056)
* [Android] Refactor PasswordSettings.java to use an XML layout file. The PasswordSettings.java file now integrates with a new XML file that contains the layout for the page. This modification was completed using Cursor but does not appear to have introduced any breaks. There should be no semantic changes caused by this commit and the Brave Password settings screen should continue to function exactly as it did prior to this commit. * [Android] Introduce new Import/Export items to password manager menu. The password manager dialog now features two items for export and import. Prior to this commit, Export was hidden away in a small drop-down menu accessible from the top-right of the screen. The import item is also present, but non-functional in this commit. * [Android] Implement importing passwords from CSV. We now support importing a CSV file containing the user's passwords. This commit builds upon its parent by implementing the necessary code to call Chromium's password manager which is responsible for executing the import. Additionally, the icons in the password manager screen have been changed to new ones taken from Google's Material UI icon set. Localisation strings have been introduced - some of which are copied from Google's base since, after discussion, this is the way we currently make strings usable for Android. If this changes in future, these could be de-duplicated. Translations into other languages are still necessary since only English is implemented. Closes brave/brave-browser#35729
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (c) 2025 The Brave Authors. All rights reserved.
|
||||
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 https://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orderingFromXml="false">
|
||||
|
||||
<!-- Save Passwords Switch -->
|
||||
<org.chromium.components.browser_ui.settings.ChromeSwitchPreference
|
||||
android:key="save_passwords_switch"
|
||||
android:order="0"
|
||||
android:title="@string/password_settings_save_passwords"
|
||||
android:summaryOn="@string/text_on"
|
||||
android:summaryOff="@string/text_off"
|
||||
android:persistent="false" />
|
||||
|
||||
<!-- Auto Sign-in Switch -->
|
||||
<org.chromium.components.browser_ui.settings.ChromeSwitchPreference
|
||||
android:key="autosignin_switch"
|
||||
android:order="1"
|
||||
android:title="@string/passwords_auto_signin_title"
|
||||
android:summary="@string/passwords_auto_signin_description"
|
||||
android:persistent="false" />
|
||||
|
||||
<!-- Import passwords -->
|
||||
<org.chromium.components.browser_ui.settings.ChromeBasePreference
|
||||
android:key="import_passwords"
|
||||
android:order="2"
|
||||
android:title="@string/password_settings_import_action_title"
|
||||
android:summary="@string/password_settings_import_action_description"
|
||||
android:icon="@drawable/file_download"
|
||||
android:persistent="false" />
|
||||
|
||||
<!-- Export passwords -->
|
||||
<org.chromium.components.browser_ui.settings.ChromeBasePreference
|
||||
android:key="export_passwords"
|
||||
android:order="3"
|
||||
android:title="@string/password_settings_export_action_title"
|
||||
android:summary="@string/password_settings_export_action_description"
|
||||
android:icon="@drawable/file_upload"
|
||||
android:persistent="false" />
|
||||
|
||||
<!-- Saved Passwords Category -->
|
||||
<PreferenceCategory
|
||||
android:key="saved_passwords"
|
||||
android:order="6"
|
||||
android:title="@string/password_list_title" />
|
||||
|
||||
<!-- No Passwords Message -->
|
||||
<org.chromium.components.browser_ui.settings.TextMessagePreference
|
||||
android:key="saved_passwords_no_text"
|
||||
android:order="7"
|
||||
android:summary="@string/saved_passwords_none_text" />
|
||||
|
||||
<!-- Exceptions Category -->
|
||||
<PreferenceCategory
|
||||
android:key="exceptions"
|
||||
android:order="8"
|
||||
android:title="@string/section_saved_passwords_exceptions" />
|
||||
|
||||
</PreferenceScreen>
|
||||
Reference in New Issue
Block a user