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

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/DateTimePickerDialog.java

Issue 11360207: Add Java resources to content and chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove obsolete findbugs warnings Created 8 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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.content.browser; 5 package org.chromium.content.browser;
6 6
7 import android.app.AlertDialog; 7 import android.app.AlertDialog;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.DialogInterface; 9 import android.content.DialogInterface;
10 import android.content.DialogInterface.OnClickListener; 10 import android.content.DialogInterface.OnClickListener;
11 import android.os.Build; 11 import android.os.Build;
12 import android.os.Bundle; 12 import android.os.Bundle;
13 import android.view.LayoutInflater; 13 import android.view.LayoutInflater;
14 import android.view.View; 14 import android.view.View;
15 import android.widget.DatePicker; 15 import android.widget.DatePicker;
16 import android.widget.TimePicker; 16 import android.widget.TimePicker;
17 import android.widget.DatePicker.OnDateChangedListener; 17 import android.widget.DatePicker.OnDateChangedListener;
18 import android.widget.TimePicker.OnTimeChangedListener; 18 import android.widget.TimePicker.OnTimeChangedListener;
19 19
20 import org.chromium.content.app.AppResource; 20 import org.chromium.content.R;
21 21
22 class DateTimePickerDialog extends AlertDialog implements OnClickListener, 22 class DateTimePickerDialog extends AlertDialog implements OnClickListener,
23 OnDateChangedListener, OnTimeChangedListener { 23 OnDateChangedListener, OnTimeChangedListener {
24 24
25 private static final String YEAR = "year"; 25 private static final String YEAR = "year";
26 private static final String MONTH = "month"; 26 private static final String MONTH = "month";
27 private static final String DAY = "day"; 27 private static final String DAY = "day";
28 private static final String HOUR = "hour"; 28 private static final String HOUR = "hour";
29 private static final String MINUTE = "minute"; 29 private static final String MINUTE = "minute";
30 private static final String IS_24_HOUR = "is24hour"; 30 private static final String IS_24_HOUR = "is24hour";
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 int theme, 81 int theme,
82 OnDateTimeSetListener callBack, 82 OnDateTimeSetListener callBack,
83 int year, 83 int year,
84 int monthOfYear, 84 int monthOfYear,
85 int dayOfMonth, 85 int dayOfMonth,
86 int hourOfDay, int minute, boolean is24HourView) { 86 int hourOfDay, int minute, boolean is24HourView) {
87 super(context, theme); 87 super(context, theme);
88 88
89 mCallBack = callBack; 89 mCallBack = callBack;
90 90
91 assert AppResource.STRING_DATE_PICKER_DIALOG_SET != 0;
92 assert AppResource.STRING_DATE_TIME_PICKER_DIALOG_TITLE != 0;
93 assert AppResource.LAYOUT_DATE_TIME_PICKER_DIALOG != 0;
94 assert AppResource.ID_DATE_PICKER != 0;
95 assert AppResource.ID_TIME_PICKER != 0;
96
97 setButton(BUTTON_POSITIVE, context.getText( 91 setButton(BUTTON_POSITIVE, context.getText(
98 AppResource.STRING_DATE_PICKER_DIALOG_SET), this); 92 R.string.date_picker_dialog_set), this);
99 setButton(BUTTON_NEGATIVE, context.getText(android.R.string.cancel), 93 setButton(BUTTON_NEGATIVE, context.getText(android.R.string.cancel),
100 (OnClickListener) null); 94 (OnClickListener) null);
101 setIcon(0); 95 setIcon(0);
102 setTitle(context.getText(AppResource.STRING_DATE_TIME_PICKER_DIALOG_TITL E)); 96 setTitle(context.getText(R.string.date_time_picker_dialog_title));
103 97
104 LayoutInflater inflater = 98 LayoutInflater inflater =
105 (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATE R_SERVICE); 99 (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATE R_SERVICE);
106 View view = inflater.inflate(AppResource.LAYOUT_DATE_TIME_PICKER_DIALOG, null); 100 View view = inflater.inflate(R.layout.date_time_picker_dialog, null);
107 setView(view); 101 setView(view);
108 mDatePicker = (DatePicker) view.findViewById(AppResource.ID_DATE_PICKER) ; 102 mDatePicker = (DatePicker) view.findViewById(R.id.date_picker);
109 mDatePicker.init(year, monthOfYear, dayOfMonth, this); 103 mDatePicker.init(year, monthOfYear, dayOfMonth, this);
110 104
111 mTimePicker = (TimePicker) view.findViewById(AppResource.ID_TIME_PICKER) ; 105 mTimePicker = (TimePicker) view.findViewById(R.id.time_picker);
112 mTimePicker.setIs24HourView(is24HourView); 106 mTimePicker.setIs24HourView(is24HourView);
113 mTimePicker.setCurrentHour(hourOfDay); 107 mTimePicker.setCurrentHour(hourOfDay);
114 mTimePicker.setCurrentMinute(minute); 108 mTimePicker.setCurrentMinute(minute);
115 mTimePicker.setOnTimeChangedListener(this); 109 mTimePicker.setOnTimeChangedListener(this);
116 } 110 }
117 111
118 @Override 112 @Override
119 public void onClick(DialogInterface dialog, int which) { 113 public void onClick(DialogInterface dialog, int which) {
120 tryNotifyDateTimeSet(); 114 tryNotifyDateTimeSet();
121 } 115 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 int month = savedInstanceState.getInt(MONTH); 193 int month = savedInstanceState.getInt(MONTH);
200 int day = savedInstanceState.getInt(DAY); 194 int day = savedInstanceState.getInt(DAY);
201 mDatePicker.init(year, month, day, this); 195 mDatePicker.init(year, month, day, this);
202 int hour = savedInstanceState.getInt(HOUR); 196 int hour = savedInstanceState.getInt(HOUR);
203 int minute = savedInstanceState.getInt(MINUTE); 197 int minute = savedInstanceState.getInt(MINUTE);
204 mTimePicker.setIs24HourView(savedInstanceState.getBoolean(IS_24_HOUR)); 198 mTimePicker.setIs24HourView(savedInstanceState.getBoolean(IS_24_HOUR));
205 mTimePicker.setCurrentHour(hour); 199 mTimePicker.setCurrentHour(hour);
206 mTimePicker.setCurrentMinute(minute); 200 mTimePicker.setCurrentMinute(minute);
207 } 201 }
208 } 202 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698