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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/preferences/AboutChromePreferences.java

Issue 2830843004: Update to newer Android Lint and suppress new Lint errors (Closed)
Patch Set: rebase Created 3 years, 7 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 unified diff | Download patch
OLDNEW
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; 5 package org.chromium.chrome.browser.preferences;
6 6
7 import android.annotation.SuppressLint;
7 import android.content.Context; 8 import android.content.Context;
8 import android.content.pm.PackageInfo; 9 import android.content.pm.PackageInfo;
9 import android.content.pm.PackageManager.NameNotFoundException; 10 import android.content.pm.PackageManager.NameNotFoundException;
10 import android.os.Build; 11 import android.os.Build;
11 import android.os.Bundle; 12 import android.os.Bundle;
12 import android.preference.Preference; 13 import android.preference.Preference;
13 import android.preference.PreferenceFragment; 14 import android.preference.PreferenceFragment;
14 import android.text.format.DateUtils; 15 import android.text.format.DateUtils;
15 import android.view.ContextThemeWrapper; 16 import android.view.ContextThemeWrapper;
16 17
17 import org.chromium.chrome.R; 18 import org.chromium.chrome.R;
18 import org.chromium.chrome.browser.ChromeVersionInfo; 19 import org.chromium.chrome.browser.ChromeVersionInfo;
19 import org.chromium.chrome.browser.preferences.PrefServiceBridge.AboutVersionStr ings; 20 import org.chromium.chrome.browser.preferences.PrefServiceBridge.AboutVersionStr ings;
20 21
21 import java.util.Calendar; 22 import java.util.Calendar;
22 23
23 /** 24 /**
24 * Settings fragment that displays information about Chrome. 25 * Settings fragment that displays information about Chrome.
25 */ 26 */
26 public class AboutChromePreferences extends PreferenceFragment { 27 public class AboutChromePreferences extends PreferenceFragment {
27 28
28 private static final String PREF_APPLICATION_VERSION = "application_version" ; 29 private static final String PREF_APPLICATION_VERSION = "application_version" ;
29 private static final String PREF_OS_VERSION = "os_version"; 30 private static final String PREF_OS_VERSION = "os_version";
30 private static final String PREF_LEGAL_INFORMATION = "legal_information"; 31 private static final String PREF_LEGAL_INFORMATION = "legal_information";
31 32
33 @SuppressLint("ObsoleteSdkInt")
32 @Override 34 @Override
33 public void onCreate(Bundle savedInstanceState) { 35 public void onCreate(Bundle savedInstanceState) {
34 super.onCreate(savedInstanceState); 36 super.onCreate(savedInstanceState);
35 getActivity().setTitle(R.string.prefs_about_chrome); 37 getActivity().setTitle(R.string.prefs_about_chrome);
36 PreferenceUtils.addPreferencesFromResource(this, R.xml.about_chrome_pref erences); 38 PreferenceUtils.addPreferencesFromResource(this, R.xml.about_chrome_pref erences);
37 39
40 // TODO(crbug.com/635567): Fix this properly.
38 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { 41 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
39 ChromeBasePreference deprecationWarning = new ChromeBasePreference( 42 ChromeBasePreference deprecationWarning = new ChromeBasePreference(
40 new ContextThemeWrapper(getActivity(), 43 new ContextThemeWrapper(getActivity(),
41 R.style.DeprecationWarningPreferenceTheme)); 44 R.style.DeprecationWarningPreferenceTheme));
42 deprecationWarning.setOrder(-1); 45 deprecationWarning.setOrder(-1);
43 deprecationWarning.setTitle(R.string.deprecation_warning); 46 deprecationWarning.setTitle(R.string.deprecation_warning);
44 deprecationWarning.setIcon(R.drawable.exclamation_triangle); 47 deprecationWarning.setIcon(R.drawable.exclamation_triangle);
45 getPreferenceScreen().addPreference(deprecationWarning); 48 getPreferenceScreen().addPreference(deprecationWarning);
46 } 49 }
47 50
(...skipping 24 matching lines...) Expand all
72 context.getPackageName(), 0); 75 context.getPackageName(), 0);
73 } catch (NameNotFoundException e) { 76 } catch (NameNotFoundException e) {
74 return version; 77 return version;
75 } 78 }
76 CharSequence updateTimeString = DateUtils.getRelativeTimeSpanString( 79 CharSequence updateTimeString = DateUtils.getRelativeTimeSpanString(
77 info.lastUpdateTime, System.currentTimeMillis(), 0); 80 info.lastUpdateTime, System.currentTimeMillis(), 0);
78 return context.getString(R.string.version_with_update_time, version, 81 return context.getString(R.string.version_with_update_time, version,
79 updateTimeString); 82 updateTimeString);
80 } 83 }
81 } 84 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698