From 29840f66c79363753f18d6bae93601298e108dc0 Mon Sep 17 00:00:00 2001 From: Anderson Mesquita Date: Fri, 18 Sep 2020 10:55:47 -0400 Subject: [PATCH] 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. --- .../awais/instagrabber/dialogs/TimeSettingsDialog.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/awais/instagrabber/dialogs/TimeSettingsDialog.java b/app/src/main/java/awais/instagrabber/dialogs/TimeSettingsDialog.java index 9a371db2..cf3bf5ee 100755 --- a/app/src/main/java/awais/instagrabber/dialogs/TimeSettingsDialog.java +++ b/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());