OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.preferences.password; | 5 package org.chromium.chrome.browser.preferences.password; |
6 | 6 |
7 import android.content.Intent; | 7 import android.content.Intent; |
8 import android.net.Uri; | 8 import android.net.Uri; |
9 import android.os.Bundle; | 9 import android.os.Bundle; |
10 import android.preference.Preference; | 10 import android.preference.Preference; |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 getPreferenceScreen().addPreference(mSavePasswordsSwitch); | 265 getPreferenceScreen().addPreference(mSavePasswordsSwitch); |
266 | 266 |
267 // Note: setting the switch state before the preference is added to the
screen results in | 267 // Note: setting the switch state before the preference is added to the
screen results in |
268 // some odd behavior where the switch state doesn't always match the int
ernal enabled state | 268 // some odd behavior where the switch state doesn't always match the int
ernal enabled state |
269 // (e.g. the switch will say "On" when save passwords is really turned o
ff), so | 269 // (e.g. the switch will say "On" when save passwords is really turned o
ff), so |
270 // .setChecked() should be called after .addPreference() | 270 // .setChecked() should be called after .addPreference() |
271 mSavePasswordsSwitch.setChecked(isEnabled); | 271 mSavePasswordsSwitch.setChecked(isEnabled); |
272 } | 272 } |
273 | 273 |
274 private void displayManageAccountLink() { | 274 private void displayManageAccountLink() { |
275 if (PasswordUIView.shouldDisplayManageAccountLink() | 275 boolean shouldDisplayLink = PasswordUIView.shouldDisplayManageAccountLin
k(); |
| 276 if (shouldDisplayLink |
276 && getPreferenceScreen().findPreference(PREF_MANAGE_ACCOUNT_LINK
) == null) { | 277 && getPreferenceScreen().findPreference(PREF_MANAGE_ACCOUNT_LINK
) == null) { |
277 if (mLinkPref == null) { | 278 if (mLinkPref == null) { |
278 ForegroundColorSpan colorSpan = new ForegroundColorSpan( | 279 ForegroundColorSpan colorSpan = new ForegroundColorSpan( |
279 getResources().getColor(R.color.pref_accent_color)); | 280 getResources().getColor(R.color.pref_accent_color)); |
280 SpannableString title = SpanApplier.applySpans( | 281 SpannableString title = SpanApplier.applySpans( |
281 getString(R.string.manage_passwords_text), | 282 getString(R.string.manage_passwords_text), |
282 new SpanApplier.SpanInfo("<link>", "</link>", colorSpan)
); | 283 new SpanApplier.SpanInfo("<link>", "</link>", colorSpan)
); |
283 mLinkPref = new ChromeBasePreference(getActivity()); | 284 mLinkPref = new ChromeBasePreference(getActivity()); |
284 mLinkPref.setKey(PREF_MANAGE_ACCOUNT_LINK); | 285 mLinkPref.setKey(PREF_MANAGE_ACCOUNT_LINK); |
285 mLinkPref.setTitle(title); | 286 mLinkPref.setTitle(title); |
286 mLinkPref.setOnPreferenceClickListener(this); | 287 mLinkPref.setOnPreferenceClickListener(this); |
287 mLinkPref.setOrder(ORDER_MANAGE_ACCOUNT_LINK); | 288 mLinkPref.setOrder(ORDER_MANAGE_ACCOUNT_LINK); |
288 } | 289 } |
289 getPreferenceScreen().addPreference(mLinkPref); | 290 getPreferenceScreen().addPreference(mLinkPref); |
290 } else { | |
291 // Draw a divider only if the preference after mSavePasswordsSwitch
is not selectable, | |
292 // in which case the ListView itself doesn't draw a divider. | |
293 mSavePasswordsSwitch.setDrawDivider(true); | |
294 } | 291 } |
| 292 // Draw a divider only if the preference after mSavePasswordsSwitch is n
ot selectable, |
| 293 // in which case the ListView itself doesn't draw a divider. |
| 294 mSavePasswordsSwitch.setDrawDivider(!shouldDisplayLink); |
295 } | 295 } |
296 } | 296 } |
OLD | NEW |