removed blank line, unused instance variable, import and Logger

refactored DateTimeFormatter into an instance variable
This commit is contained in:
Jan-Peter Klein 2024-04-24 15:03:49 +02:00
parent 9ae2f4e0f6
commit ff3306cc17
No known key found for this signature in database
GPG Key ID: 90EDA3A7C822FD0E
4 changed files with 2 additions and 12 deletions

View File

@ -168,7 +168,6 @@ public class Settings {
}
});
}
}
SettingsJson serialized() {

View File

@ -19,11 +19,7 @@ import javafx.concurrent.Worker;
import javafx.concurrent.WorkerStateEvent;
import javafx.util.Duration;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Comparator;
import java.util.Date;
import java.util.ResourceBundle;
@FxApplicationScoped
public class UpdateChecker {
@ -37,7 +33,6 @@ public class UpdateChecker {
private final ScheduledService<String> updateCheckerService;
private final ObjectProperty<UpdateCheckState> state = new SimpleObjectProperty<>(UpdateCheckState.NOT_CHECKED);
private final ObjectProperty<Instant> lastSuccessfulUpdateCheck = new SimpleObjectProperty<>();
private final StringProperty timeDifferenceMessage = new SimpleStringProperty();
private final Comparator<String> versionComparator = new SemVerComparator();
private final BooleanBinding updateAvailable;

View File

@ -49,6 +49,7 @@ public class UpdatesPreferencesController implements FxController {
private final BooleanBinding updateAvailable;
private final BooleanProperty upToDateLabelVisible = new SimpleBooleanProperty(false);
private final ObjectProperty<UpdateChecker.UpdateCheckState> updateCheckState;
private final DateTimeFormatter formatter;
/* FXML */
public CheckBox checkForUpdatesCheckbox;
@ -69,6 +70,7 @@ public class UpdatesPreferencesController implements FxController {
this.currentVersion = updateChecker.getCurrentVersion();
this.updateAvailable = updateChecker.updateAvailableProperty();
this.updateCheckState = updateChecker.updateCheckStateProperty();
this.formatter = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM).withLocale(Locale.getDefault());
}
public void initialize() {
@ -130,7 +132,6 @@ public class UpdatesPreferencesController implements FxController {
public String getLastSuccessfulUpdateCheck() {
Instant lastCheck = lastSuccessfulUpdateCheck.getValue();
if (lastCheck != null && !lastCheck.equals(Settings.DEFAULT_LAST_SUCCESSFUL_UPDATE_CHECK)) {
DateTimeFormatter formatter = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM).withLocale(Locale.getDefault());
return formatter.format(LocalDateTime.ofInstant(lastCheck, ZoneId.systemDefault()));
} else {
return "-";

View File

@ -5,21 +5,16 @@ import dagger.Subcomponent;
import org.cryptomator.common.settings.Settings;
import org.cryptomator.ui.common.FxmlFile;
import org.cryptomator.ui.common.FxmlScene;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.time.Duration;
import java.time.Instant;
import java.util.Date;
@UpdateReminderScoped
@Subcomponent(modules = {UpdateReminderModule.class})
public interface UpdateReminderComponent {
Logger LOG = LoggerFactory.getLogger(UpdateReminderComponent.class);
@UpdateReminderWindow
Stage window();