Browse Source

Switch isSwapTime conditional

This doesn't change behavior, but makes the variable `isSwapTime` match
the value of the checkbox state (`cbSwapTimeDate.isChecked()`). Now,
both of them will be either `true` or `false` together, instead of
having opposite values.
renovate/org.robolectric-robolectric-4.x
Anderson Mesquita 4 years ago
parent
commit
29840f66c7
  1. 9
      app/src/main/java/awais/instagrabber/dialogs/TimeSettingsDialog.java

9
app/src/main/java/awais/instagrabber/dialogs/TimeSettingsDialog.java

@ -86,11 +86,12 @@ public final class TimeSettingsDialog extends DialogFragment implements AdapterV
final String timeStr = String.valueOf(timeSettingsBinding.spTimeFormat.getSelectedItem());
final String dateStr = String.valueOf(timeSettingsBinding.spDateFormat.getSelectedItem());
final boolean isSwapTime = !timeSettingsBinding.cbSwapTimeDate.isChecked();
final boolean isSwapTime = timeSettingsBinding.cbSwapTimeDate.isChecked();
final boolean isBlankSeparator = timeSettingsBinding.spSeparator.getSelectedItemPosition() <= 0;
selectedFormat = (isSwapTime ? timeStr : dateStr)
+ (TextUtils.isEmpty(sepStr) || timeSettingsBinding.spSeparator.getSelectedItemPosition() == 0 ? " " : " '" + sepStr + "' ")
+ (isSwapTime ? dateStr : timeStr);
selectedFormat = (isSwapTime ? dateStr : timeStr)
+ (isBlankSeparator ? " " : " '" + sepStr + "' ")
+ (isSwapTime ? timeStr : dateStr);
timeSettingsBinding.btnConfirm.setEnabled(true);
currentFormat = new SimpleDateFormat(selectedFormat, LocaleUtils.getCurrentLocale());

Loading…
Cancel
Save