Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1179)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/preferences/password/SavePasswordsPreferences.java

Issue 2613133002: Updating "Save passwords" screen for MultiWindow (Closed)
Patch Set: Updating "SavePasswords" screen for MultiWindow Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/preferences/password/SavePasswordsPreferences.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/password/SavePasswordsPreferences.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/password/SavePasswordsPreferences.java
index efd937c7b7385f3a8da0fcbb5cae181adacfc44b..dd1d2c0a3817b294a6498591e9567b7507f8b12d 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/password/SavePasswordsPreferences.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/password/SavePasswordsPreferences.java
@@ -14,10 +14,6 @@ import android.preference.PreferenceFragment;
import android.preference.PreferenceScreen;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;
-import android.view.Gravity;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.TextView;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.VisibleForTesting;
@@ -32,6 +28,7 @@ import org.chromium.chrome.browser.preferences.ManagedPreferenceDelegate;
import org.chromium.chrome.browser.preferences.PrefServiceBridge;
import org.chromium.chrome.browser.preferences.Preferences;
import org.chromium.chrome.browser.preferences.PreferencesLauncher;
+import org.chromium.chrome.browser.preferences.TextMessagePreference;
import org.chromium.ui.text.SpanApplier;
/**
@@ -58,20 +55,22 @@ public class SavePasswordsPreferences extends PreferenceFragment
private static final String PREF_CATEGORY_SAVED_PASSWORDS = "saved_passwords";
private static final String PREF_CATEGORY_EXCEPTIONS = "exceptions";
private static final String PREF_MANAGE_ACCOUNT_LINK = "manage_account_link";
+ private static final String PREF_CATEGORY_SAVED_PASSWORDS_NO_TEXT = "saved_passwords_no_text";
private static final int ORDER_SWITCH = 0;
private static final int ORDER_AUTO_SIGNIN_CHECKBOX = 1;
private static final int ORDER_MANAGE_ACCOUNT_LINK = 2;
private static final int ORDER_SAVED_PASSWORDS = 3;
private static final int ORDER_EXCEPTIONS = 4;
+ private static final int ORDER_SAVED_PASSWORDS_NO_TEXT = 5;
private final PasswordUIView mPasswordManagerHandler = new PasswordUIView();
- private TextView mEmptyView;
private boolean mNoPasswords;
private boolean mNoPasswordExceptions;
private Preference mLinkPref;
private ChromeSwitchPreference mSavePasswordsSwitch;
private ChromeBaseCheckBoxPreference mAutoSignInSwitch;
+ private TextMessagePreference mEmptyView;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -79,26 +78,17 @@ public class SavePasswordsPreferences extends PreferenceFragment
getActivity().setTitle(R.string.prefs_saved_passwords);
setPreferenceScreen(getPreferenceManager().createPreferenceScreen(getActivity()));
mPasswordManagerHandler.addObserver(this);
-
- mEmptyView = new TextView(getActivity(), null);
- mEmptyView.setText(R.string.saved_passwords_none_text);
- mEmptyView.setGravity(Gravity.CENTER);
- mEmptyView.setVisibility(View.GONE);
- }
-
- @Override
- public void onActivityCreated(Bundle savedInstanceState) {
- super.onActivityCreated(savedInstanceState);
- ((ViewGroup) getActivity().findViewById(android.R.id.content)).addView(mEmptyView);
}
/**
* Empty screen message when no passwords or exceptions are stored.
*/
private void displayEmptyScreenMessage() {
- if (mEmptyView != null) {
- mEmptyView.setVisibility(View.VISIBLE);
- }
+ mEmptyView = new TextMessagePreference(getActivity(), null);
+ mEmptyView.setSummary(R.string.saved_passwords_none_text);
+ mEmptyView.setKey(PREF_CATEGORY_SAVED_PASSWORDS_NO_TEXT);
+ mEmptyView.setOrder(ORDER_SAVED_PASSWORDS_NO_TEXT);
+ getPreferenceScreen().addPreference(mEmptyView);
}
@Override
@@ -111,7 +101,6 @@ public class SavePasswordsPreferences extends PreferenceFragment
mNoPasswords = false;
mNoPasswordExceptions = false;
getPreferenceScreen().removeAll();
- mEmptyView.setVisibility(View.GONE);
createSavePasswordsSwitch();
createAutoSignInCheckbox();
mPasswordManagerHandler.updatePasswordLists();
@@ -124,13 +113,13 @@ public class SavePasswordsPreferences extends PreferenceFragment
profileCategory.removeAll();
getPreferenceScreen().removePreference(profileCategory);
}
-
- mEmptyView.setVisibility(View.GONE);
}
@Override
public void passwordListAvailable(int count) {
resetList(PREF_CATEGORY_SAVED_PASSWORDS);
+ resetList(PREF_CATEGORY_SAVED_PASSWORDS_NO_TEXT);
+
mNoPasswords = count == 0;
if (mNoPasswords) {
if (mNoPasswordExceptions) displayEmptyScreenMessage();
@@ -164,6 +153,8 @@ public class SavePasswordsPreferences extends PreferenceFragment
@Override
public void passwordExceptionListAvailable(int count) {
resetList(PREF_CATEGORY_EXCEPTIONS);
+ resetList(PREF_CATEGORY_SAVED_PASSWORDS_NO_TEXT);
+
mNoPasswordExceptions = count == 0;
if (mNoPasswordExceptions) {
if (mNoPasswords) displayEmptyScreenMessage();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698