Skip to content

Commit 0589383

Browse files
committed
Removed some unnecessary casts
1 parent d6b20b8 commit 0589383

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

library/src/main/java/com/wdullaer/materialdatetimepicker/date/DatePickerDialog.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
302302
null pointer exceptions on the configuration methods
303303
If the user did not supply a custom limiter we need to ensure both mDefaultLimiter
304304
and mDateRangeLimiter are the same reference, so that the config methods actually
305-
ffect the behaviour of the picker (in the unlikely event the user reconfigures
305+
affect the behaviour of the picker (in the unlikely event the user reconfigures
306306
the picker when it is shown)
307307
*/
308308
if (mDateRangeLimiter instanceof DefaultDateRangeLimiter) {
@@ -319,12 +319,12 @@ ffect the behaviour of the picker (in the unlikely event the user reconfigures
319319
// All options have been set at this point: round the initial selection if necessary
320320
mCalendar = mDateRangeLimiter.setToNearestDate(mCalendar);
321321

322-
mDatePickerHeaderView = (TextView) view.findViewById(R.id.mdtp_date_picker_header);
323-
mMonthAndDayView = (LinearLayout) view.findViewById(R.id.mdtp_date_picker_month_and_day);
322+
mDatePickerHeaderView = view.findViewById(R.id.mdtp_date_picker_header);
323+
mMonthAndDayView = view.findViewById(R.id.mdtp_date_picker_month_and_day);
324324
mMonthAndDayView.setOnClickListener(this);
325-
mSelectedMonthTextView = (TextView) view.findViewById(R.id.mdtp_date_picker_month);
326-
mSelectedDayTextView = (TextView) view.findViewById(R.id.mdtp_date_picker_day);
327-
mYearView = (TextView) view.findViewById(R.id.mdtp_date_picker_year);
325+
mSelectedMonthTextView = view.findViewById(R.id.mdtp_date_picker_month);
326+
mSelectedDayTextView = view.findViewById(R.id.mdtp_date_picker_day);
327+
mYearView = view.findViewById(R.id.mdtp_date_picker_year);
328328
mYearView.setOnClickListener(this);
329329

330330
final Activity activity = getActivity();
@@ -345,7 +345,7 @@ ffect the behaviour of the picker (in the unlikely event the user reconfigures
345345
int bgColorResource = mThemeDark ? R.color.mdtp_date_picker_view_animator_dark_theme : R.color.mdtp_date_picker_view_animator;
346346
view.setBackgroundColor(ContextCompat.getColor(activity, bgColorResource));
347347

348-
mAnimator = (AccessibleDateAnimator) view.findViewById(R.id.mdtp_animator);
348+
mAnimator = view.findViewById(R.id.mdtp_animator);
349349
mAnimator.addView(mDayPickerView);
350350
mAnimator.addView(mYearPickerView);
351351
mAnimator.setDateMillis(mCalendar.getTimeInMillis());
@@ -358,7 +358,7 @@ ffect the behaviour of the picker (in the unlikely event the user reconfigures
358358
animation2.setDuration(ANIMATION_DURATION);
359359
mAnimator.setOutAnimation(animation2);
360360

361-
Button okButton = (Button) view.findViewById(R.id.mdtp_ok);
361+
Button okButton = view.findViewById(R.id.mdtp_ok);
362362
okButton.setOnClickListener(new OnClickListener() {
363363

364364
@Override
@@ -372,7 +372,7 @@ public void onClick(View v) {
372372
if (mOkString != null) okButton.setText(mOkString);
373373
else okButton.setText(mOkResid);
374374

375-
Button cancelButton = (Button) view.findViewById(R.id.mdtp_cancel);
375+
Button cancelButton = view.findViewById(R.id.mdtp_cancel);
376376
cancelButton.setOnClickListener(new OnClickListener() {
377377
@Override
378378
public void onClick(View v) {

library/src/main/java/com/wdullaer/materialdatetimepicker/time/TimePickerDialog.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ public void onCreate(Bundle savedInstanceState) {
609609
null pointer exceptions on the configuration methods
610610
If the user did not supply a custom limiter we need to ensure both mDefaultLimiter
611611
and mLimiter are the same reference, so that the config methods actually
612-
ffect the behaviour of the picker (in the unlikely event the user reconfigures
612+
affect the behaviour of the picker (in the unlikely event the user reconfigures
613613
the picker when it is shown)
614614
*/
615615
mDefaultLimiter = mLimiter instanceof DefaultTimepointLimiter
@@ -648,18 +648,18 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
648648
mSelectedColor = ContextCompat.getColor(context, R.color.mdtp_white);
649649
mUnselectedColor = ContextCompat.getColor(context, R.color.mdtp_accent_color_focused);
650650

651-
mHourView = (TextView) view.findViewById(R.id.mdtp_hours);
651+
mHourView = view.findViewById(R.id.mdtp_hours);
652652
mHourView.setOnKeyListener(keyboardListener);
653-
mHourSpaceView = (TextView) view.findViewById(R.id.mdtp_hour_space);
654-
mMinuteSpaceView = (TextView) view.findViewById(R.id.mdtp_minutes_space);
655-
mMinuteView = (TextView) view.findViewById(R.id.mdtp_minutes);
653+
mHourSpaceView = view.findViewById(R.id.mdtp_hour_space);
654+
mMinuteSpaceView = view.findViewById(R.id.mdtp_minutes_space);
655+
mMinuteView = view.findViewById(R.id.mdtp_minutes);
656656
mMinuteView.setOnKeyListener(keyboardListener);
657-
mSecondSpaceView = (TextView) view.findViewById(R.id.mdtp_seconds_space);
658-
mSecondView = (TextView) view.findViewById(R.id.mdtp_seconds);
657+
mSecondSpaceView = view.findViewById(R.id.mdtp_seconds_space);
658+
mSecondView = view.findViewById(R.id.mdtp_seconds);
659659
mSecondView.setOnKeyListener(keyboardListener);
660-
mAmTextView = (TextView) view.findViewById(R.id.mdtp_am_label);
660+
mAmTextView = view.findViewById(R.id.mdtp_am_label);
661661
mAmTextView.setOnKeyListener(keyboardListener);
662-
mPmTextView = (TextView) view.findViewById(R.id.mdtp_pm_label);
662+
mPmTextView = view.findViewById(R.id.mdtp_pm_label);
663663
mPmTextView.setOnKeyListener(keyboardListener);
664664
mAmPmLayout = view.findViewById(R.id.mdtp_ampm_layout);
665665
String[] amPmTexts = new DateFormatSymbols().getAmPmStrings();
@@ -674,7 +674,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
674674

675675
mInitialTime = roundToNearest(mInitialTime);
676676

677-
mTimePicker = (RadialPickerLayout) view.findViewById(R.id.mdtp_time_picker);
677+
mTimePicker = view.findViewById(R.id.mdtp_time_picker);
678678
mTimePicker.setOnValueSelectedListener(this);
679679
mTimePicker.setOnKeyListener(keyboardListener);
680680
mTimePicker.initialize(getActivity(), this, mInitialTime, mIs24HourMode);
@@ -709,7 +709,7 @@ public void onClick(View view) {
709709
}
710710
});
711711

712-
mOkButton = (Button) view.findViewById(R.id.mdtp_ok);
712+
mOkButton = view.findViewById(R.id.mdtp_ok);
713713
mOkButton.setOnClickListener(new OnClickListener() {
714714
@Override
715715
public void onClick(View v) {
@@ -727,7 +727,7 @@ public void onClick(View v) {
727727
if(mOkString != null) mOkButton.setText(mOkString);
728728
else mOkButton.setText(mOkResid);
729729

730-
mCancelButton = (Button) view.findViewById(R.id.mdtp_cancel);
730+
mCancelButton = view.findViewById(R.id.mdtp_cancel);
731731
mCancelButton.setOnClickListener(new OnClickListener() {
732732
@Override
733733
public void onClick(View v) {
@@ -814,7 +814,7 @@ public void onClick(View v) {
814814
);
815815
paramsSeparator.addRule(RelativeLayout.CENTER_HORIZONTAL);
816816
paramsSeparator.addRule(RelativeLayout.ABOVE, R.id.mdtp_center_view);
817-
TextView separatorView = (TextView) view.findViewById(R.id.mdtp_separator);
817+
TextView separatorView = view.findViewById(R.id.mdtp_separator);
818818
separatorView.setLayoutParams(paramsSeparator);
819819
} else if (!mEnableSeconds) {
820820
// Hour + Minutes + Am/Pm indicator
@@ -824,7 +824,7 @@ public void onClick(View v) {
824824
);
825825
paramsSeparator.addRule(RelativeLayout.CENTER_HORIZONTAL);
826826
paramsSeparator.addRule(RelativeLayout.ABOVE, R.id.mdtp_center_view);
827-
TextView separatorView = (TextView) view.findViewById(R.id.mdtp_separator);
827+
TextView separatorView = view.findViewById(R.id.mdtp_separator);
828828
separatorView.setLayoutParams(paramsSeparator);
829829
// Put the am/pm indicator below the separator
830830
RelativeLayout.LayoutParams paramsAmPm = new RelativeLayout.LayoutParams(
@@ -841,7 +841,7 @@ public void onClick(View v) {
841841
);
842842
paramsSeparator.addRule(RelativeLayout.CENTER_HORIZONTAL);
843843
paramsSeparator.addRule(RelativeLayout.ABOVE, R.id.mdtp_seconds_space);
844-
TextView separatorView = (TextView) view.findViewById(R.id.mdtp_separator);
844+
TextView separatorView = view.findViewById(R.id.mdtp_separator);
845845
separatorView.setLayoutParams(paramsSeparator);
846846
// Center the seconds
847847
RelativeLayout.LayoutParams paramsSeconds = new RelativeLayout.LayoutParams(
@@ -863,7 +863,7 @@ public void onClick(View v) {
863863
);
864864
paramsSeparator.addRule(RelativeLayout.CENTER_HORIZONTAL);
865865
paramsSeparator.addRule(RelativeLayout.ABOVE, R.id.mdtp_seconds_space);
866-
TextView separatorView = (TextView) view.findViewById(R.id.mdtp_separator);
866+
TextView separatorView = view.findViewById(R.id.mdtp_separator);
867867
separatorView.setLayoutParams(paramsSeparator);
868868
// Put the Am/Pm indicator below the seconds
869869
RelativeLayout.LayoutParams paramsAmPm = new RelativeLayout.LayoutParams(
@@ -880,7 +880,7 @@ else if (mIs24HourMode && !mEnableSeconds && mEnableMinutes) {
880880
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT
881881
);
882882
paramsSeparator.addRule(RelativeLayout.CENTER_IN_PARENT);
883-
TextView separatorView = (TextView) view.findViewById(R.id.mdtp_separator);
883+
TextView separatorView = view.findViewById(R.id.mdtp_separator);
884884
separatorView.setLayoutParams(paramsSeparator);
885885
} else if (!mEnableMinutes && !mEnableSeconds) {
886886
// center the hour
@@ -945,7 +945,7 @@ else if (mIs24HourMode && !mEnableSeconds && mEnableMinutes) {
945945
}
946946

947947
// Set the title (if any)
948-
TextView timePickerHeader = (TextView) view.findViewById(R.id.mdtp_time_picker_header);
948+
TextView timePickerHeader = view.findViewById(R.id.mdtp_time_picker_header);
949949
if (!mTitle.isEmpty()) {
950950
timePickerHeader.setVisibility(TextView.VISIBLE);
951951
timePickerHeader.setText(mTitle.toUpperCase(Locale.getDefault()));

0 commit comments

Comments
 (0)