@ -34,15 +34,18 @@ public final class TimeSettingsDialog extends DialogFragment implements AdapterV
private boolean customDateTimeFormatEnabled ;
private boolean customDateTimeFormatEnabled ;
private String customDateTimeFormat ;
private String customDateTimeFormat ;
private String dateTimeSelection ;
private String dateTimeSelection ;
private final boolean swapDateTimeEnabled ;
private final OnConfirmListener onConfirmListener ;
private final OnConfirmListener onConfirmListener ;
public TimeSettingsDialog ( final boolean customDateTimeFormatEnabled ,
public TimeSettingsDialog ( final boolean customDateTimeFormatEnabled ,
final String customDateTimeFormat ,
final String customDateTimeFormat ,
final String dateTimeSelection ,
final String dateTimeSelection ,
final boolean swapDateTimeEnabled ,
final OnConfirmListener onConfirmListener ) {
final OnConfirmListener onConfirmListener ) {
this . customDateTimeFormatEnabled = customDateTimeFormatEnabled ;
this . customDateTimeFormatEnabled = customDateTimeFormatEnabled ;
this . customDateTimeFormat = customDateTimeFormat ;
this . customDateTimeFormat = customDateTimeFormat ;
this . dateTimeSelection = dateTimeSelection ;
this . dateTimeSelection = dateTimeSelection ;
this . swapDateTimeEnabled = swapDateTimeEnabled ;
this . onConfirmListener = onConfirmListener ;
this . onConfirmListener = onConfirmListener ;
final Calendar instance = GregorianCalendar . getInstance ( ) ;
final Calendar instance = GregorianCalendar . getInstance ( ) ;
instance . set ( 2020 , 5 , 22 , 8 , 17 , 13 ) ;
instance . set ( 2020 , 5 , 22 , 8 , 17 , 13 ) ;
@ -55,6 +58,7 @@ public final class TimeSettingsDialog extends DialogFragment implements AdapterV
timeSettingsBinding . cbCustomFormat . setOnCheckedChangeListener ( this ) ;
timeSettingsBinding . cbCustomFormat . setOnCheckedChangeListener ( this ) ;
timeSettingsBinding . cbCustomFormat . setChecked ( customDateTimeFormatEnabled ) ;
timeSettingsBinding . cbCustomFormat . setChecked ( customDateTimeFormatEnabled ) ;
timeSettingsBinding . cbSwapTimeDate . setChecked ( swapDateTimeEnabled ) ;
timeSettingsBinding . etCustomFormat . setText ( customDateTimeFormat ) ;
timeSettingsBinding . etCustomFormat . setText ( customDateTimeFormat ) ;
final String [ ] dateTimeFormat = dateTimeSelection . split ( ";" ) ; / / output = time ; separator ; date
final String [ ] dateTimeFormat = dateTimeSelection . split ( ";" ) ; / / output = time ; separator ; date
@ -146,13 +150,15 @@ public final class TimeSettingsDialog extends DialogFragment implements AdapterV
if ( v = = timeSettingsBinding . btnConfirm ) {
if ( v = = timeSettingsBinding . btnConfirm ) {
final Editable etCustomFormatText = timeSettingsBinding . etCustomFormat . getText ( ) ;
final Editable etCustomFormatText = timeSettingsBinding . etCustomFormat . getText ( ) ;
if ( onConfirmListener ! = null ) {
if ( onConfirmListener ! = null ) {
onConfirmListener . onConfirm ( timeSettingsBinding . cbCustomFormat . isChecked ( ) ,
onConfirmListener . onConfirm (
timeSettingsBinding . cbCustomFormat . isChecked ( ) ,
etCustomFormatText = = null ? null : etCustomFormatText . toString ( ) ,
etCustomFormatText = = null ? null : etCustomFormatText . toString ( ) ,
timeSettingsBinding . spTimeFormat . getSelectedItemPosition ( ) ,
timeSettingsBinding . spTimeFormat . getSelectedItemPosition ( ) ,
timeSettingsBinding . spSeparator . getSelectedItemPosition ( ) ,
timeSettingsBinding . spSeparator . getSelectedItemPosition ( ) ,
timeSettingsBinding . spDateFormat . getSelectedItemPosition ( ) ,
timeSettingsBinding . spDateFormat . getSelectedItemPosition ( ) ,
selectedFormat ,
selectedFormat ,
currentFormat ) ;
currentFormat ,
timeSettingsBinding . cbSwapTimeDate . isChecked ( ) ) ;
}
}
dismiss ( ) ;
dismiss ( ) ;
} else if ( v = = timeSettingsBinding . btnInfo ) {
} else if ( v = = timeSettingsBinding . btnInfo ) {
@ -167,7 +173,10 @@ public final class TimeSettingsDialog extends DialogFragment implements AdapterV
String formatSelection ,
String formatSelection ,
int spTimeFormatSelectedItemPosition ,
int spTimeFormatSelectedItemPosition ,
int spSeparatorSelectedItemPosition ,
int spSeparatorSelectedItemPosition ,
int spDateFormatSelectedItemPosition , final String selectedFormat , final SimpleDateFormat currentFormat ) ;
int spDateFormatSelectedItemPosition ,
final String selectedFormat ,
final SimpleDateFormat currentFormat ,
final boolean swapDateTime ) ;
}
}
@Override
@Override