Rework to avoid using preferences object to retrieve options
This commit is contained in:
@@ -14,13 +14,13 @@ public class CombinedResourceBundle extends ResourceBundle {
|
||||
private final Map<String, String> resources;
|
||||
private final Locale locale;
|
||||
|
||||
public CombinedResourceBundle(final ResourceBundle... resourceBundles) {
|
||||
this(Arrays.asList(resourceBundles));
|
||||
public CombinedResourceBundle(final ResourceBundle... bundles) {
|
||||
this(Arrays.asList(bundles));
|
||||
}
|
||||
|
||||
public CombinedResourceBundle(final List<ResourceBundle> resourceBundles) {
|
||||
final var filteredBundles = resourceBundles.stream().filter(Objects::nonNull).toList();
|
||||
if (filteredBundles.size() != resourceBundles.size()) {
|
||||
public CombinedResourceBundle(final Collection<ResourceBundle> bundles) {
|
||||
final var filteredBundles = bundles.stream().filter(Objects::nonNull).toList();
|
||||
if (filteredBundles.size() != bundles.size()) {
|
||||
logger.warn("There was one or more null bundles in the inner bundles");
|
||||
}
|
||||
if (filteredBundles.isEmpty()) {
|
||||
|
||||
@@ -5,5 +5,6 @@ import java.util.spi.ResourceBundleProvider;
|
||||
/**
|
||||
* Provider for MainBundle
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface MainBundleProvider extends ResourceBundleProvider {
|
||||
}
|
||||
|
||||
@@ -5,5 +5,6 @@ import java.util.spi.ResourceBundleProvider;
|
||||
/**
|
||||
* Provider for ParametersBundle
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface ParametersBundleProvider extends ResourceBundleProvider {
|
||||
}
|
||||
|
||||
@@ -5,5 +5,6 @@ import java.util.spi.ResourceBundleProvider;
|
||||
/**
|
||||
* Provider for SetupBundle
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface SetupBundleProvider extends ResourceBundleProvider {
|
||||
}
|
||||
|
||||
@@ -5,5 +5,6 @@ import java.util.spi.ResourceBundleProvider;
|
||||
/**
|
||||
* Provider for SubtitlesBundle
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface SubtitlesBundleProvider extends ResourceBundleProvider {
|
||||
}
|
||||
|
||||
@@ -5,5 +5,6 @@ import java.util.spi.ResourceBundleProvider;
|
||||
/**
|
||||
* Provider for WorkBundle
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface WorkBundleProvider extends ResourceBundleProvider {
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ public final class GuiCoreModule {
|
||||
@Play
|
||||
static byte[] providesPlayImage() {
|
||||
try (final var in = GuiCoreModule.class.getResourceAsStream("/com/github/gtache/autosubtitle/gui/impl/play_64.png")) {
|
||||
if (in == null) {
|
||||
throw new UncheckedIOException(new IOException("Resource not found : /com/github/gtache/autosubtitle/gui/impl/play_64.png"));
|
||||
}
|
||||
return in.readAllBytes();
|
||||
} catch (final IOException e) {
|
||||
throw new UncheckedIOException(e);
|
||||
@@ -41,6 +44,9 @@ public final class GuiCoreModule {
|
||||
@Pause
|
||||
static byte[] providesPauseImage() {
|
||||
try (final var in = GuiCoreModule.class.getResourceAsStream("/com/github/gtache/autosubtitle/gui/impl/pause_64.png")) {
|
||||
if (in == null) {
|
||||
throw new UncheckedIOException(new IOException("Resource not found : /com/github/gtache/autosubtitle/gui/impl/pause_64.png"));
|
||||
}
|
||||
return in.readAllBytes();
|
||||
} catch (final IOException e) {
|
||||
throw new UncheckedIOException(e);
|
||||
|
||||
Reference in New Issue
Block a user