code cleanup
This commit is contained in:
parent
ffa7de49dd
commit
4b5c9482c8
|
@ -55,15 +55,12 @@ public class Main extends Application {
|
||||||
private static String osVers = System.getProperty("os.version");
|
private static String osVers = System.getProperty("os.version");
|
||||||
private static String javaVers = System.getProperty("java.version");
|
private static String javaVers = System.getProperty("java.version");
|
||||||
private static String javaVend = System.getProperty("java.vendor");
|
private static String javaVend = System.getProperty("java.vendor");
|
||||||
|
private static String local = System.getProperty("user.language") + "_" + System.getProperty("user.country");
|
||||||
private String dirWin = userHome + "/Documents/HomeFlix"; // Windows: C:/Users/"User"/Documents/HomeFlix
|
private String dirWin = userHome + "/Documents/HomeFlix"; // Windows: C:/Users/"User"/Documents/HomeFlix
|
||||||
private String dirLinux = userHome + "/HomeFlix"; // Linux: /home/"User"/HomeFlix
|
private String dirLinux = userHome + "/HomeFlix"; // Linux: /home/"User"/HomeFlix
|
||||||
private File directory;
|
private File directory;
|
||||||
private File configFile;
|
private File configFile;
|
||||||
private File posterCache;
|
private File posterCache;
|
||||||
|
|
||||||
private String FONT_FAMILY = "System";
|
|
||||||
private String local = System.getProperty("user.language") + "_" + System.getProperty("user.country");
|
|
||||||
private double FONT_SIZE = 17;
|
|
||||||
private ResourceBundle bundle;
|
private ResourceBundle bundle;
|
||||||
private static Logger LOGGER;
|
private static Logger LOGGER;
|
||||||
|
|
||||||
|
@ -123,7 +120,7 @@ public class Main extends Application {
|
||||||
directory.mkdir();
|
directory.mkdir();
|
||||||
addFirstSource();
|
addFirstSource();
|
||||||
mainWindowController.setColor("ee3523");
|
mainWindowController.setColor("ee3523");
|
||||||
mainWindowController.setSize(FONT_SIZE);
|
mainWindowController.setFontSize(17.0);
|
||||||
mainWindowController.setAutoUpdate(false);
|
mainWindowController.setAutoUpdate(false);
|
||||||
mainWindowController.setLocal(local);
|
mainWindowController.setLocal(local);
|
||||||
mainWindowController.saveSettings();
|
mainWindowController.saveSettings();
|
||||||
|
@ -146,7 +143,7 @@ public class Main extends Application {
|
||||||
* sources.json, if the user ends the file-/directory-chooser the program will exit
|
* sources.json, if the user ends the file-/directory-chooser the program will exit
|
||||||
*/
|
*/
|
||||||
private void addFirstSource() {
|
private void addFirstSource() {
|
||||||
switch (System.getProperty("user.language") + "_" + System.getProperty("user.country")) {
|
switch (local) {
|
||||||
case "en_US":
|
case "en_US":
|
||||||
bundle = ResourceBundle.getBundle("locals.HomeFlix-Local", Locale.US); // us_english
|
bundle = ResourceBundle.getBundle("locals.HomeFlix-Local", Locale.US); // us_english
|
||||||
break;
|
break;
|
||||||
|
@ -229,14 +226,6 @@ public class Main extends Application {
|
||||||
return pane;
|
return pane;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFONT_FAMILY() {
|
|
||||||
return FONT_FAMILY;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFONT_FAMILY(String FONT_FAMILY) {
|
|
||||||
this.FONT_FAMILY = FONT_FAMILY;
|
|
||||||
}
|
|
||||||
|
|
||||||
public File getDirectory() {
|
public File getDirectory() {
|
||||||
return directory;
|
return directory;
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,7 +243,6 @@ public class MainWindowController {
|
||||||
private String versionName = "glowing vampire";
|
private String versionName = "glowing vampire";
|
||||||
private String dialogBtnStyle;
|
private String dialogBtnStyle;
|
||||||
private String color;
|
private String color;
|
||||||
private String ratingSortType;
|
|
||||||
private String local;
|
private String local;
|
||||||
private String omdbAPIKey;
|
private String omdbAPIKey;
|
||||||
|
|
||||||
|
@ -254,7 +253,7 @@ public class MainWindowController {
|
||||||
private String infoText;
|
private String infoText;
|
||||||
private String vlcNotInstalled;
|
private String vlcNotInstalled;
|
||||||
|
|
||||||
public double size;
|
private double fontSize;
|
||||||
private int last;
|
private int last;
|
||||||
private int indexTable;
|
private int indexTable;
|
||||||
private int indexList;
|
private int indexList;
|
||||||
|
@ -273,8 +272,8 @@ public class MainWindowController {
|
||||||
private ImageView skip_next_black = new ImageView(new Image("icons/ic_skip_next_black_18dp_1x.png"));
|
private ImageView skip_next_black = new ImageView(new Image("icons/ic_skip_next_black_18dp_1x.png"));
|
||||||
private ImageView play_arrow_white = new ImageView(new Image("icons/ic_play_arrow_white_18dp_1x.png"));
|
private ImageView play_arrow_white = new ImageView(new Image("icons/ic_play_arrow_white_18dp_1x.png"));
|
||||||
private ImageView play_arrow_black = new ImageView(new Image("icons/ic_play_arrow_black_18dp_1x.png"));
|
private ImageView play_arrow_black = new ImageView(new Image("icons/ic_play_arrow_black_18dp_1x.png"));
|
||||||
private MenuItem like = new MenuItem("like");
|
private MenuItem like = new MenuItem("like");
|
||||||
private MenuItem dislike = new MenuItem("dislike"); //TODO one option (like or dislike)
|
private MenuItem dislike = new MenuItem("dislike"); // TODO one option (like or dislike)
|
||||||
private ContextMenu menu = new ContextMenu(like, dislike);
|
private ContextMenu menu = new ContextMenu(like, dislike);
|
||||||
private Properties props = new Properties();
|
private Properties props = new Properties();
|
||||||
|
|
||||||
|
@ -418,7 +417,7 @@ public class MainWindowController {
|
||||||
fontsizeSlider.valueProperty().addListener(new ChangeListener<Number>() {
|
fontsizeSlider.valueProperty().addListener(new ChangeListener<Number>() {
|
||||||
@Override
|
@Override
|
||||||
public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) {
|
public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) {
|
||||||
setSize(fontsizeSlider.getValue());
|
setFontSize(fontsizeSlider.getValue());
|
||||||
if (!getCurrentTitle().isEmpty()) {
|
if (!getCurrentTitle().isEmpty()) {
|
||||||
dbController.readCache(getCurrentStreamUrl());
|
dbController.readCache(getCurrentStreamUrl());
|
||||||
}
|
}
|
||||||
|
@ -515,7 +514,7 @@ public class MainWindowController {
|
||||||
debugBtn.setVisible(false);
|
debugBtn.setVisible(false);
|
||||||
|
|
||||||
versionLbl.setText("Version: " + version + " (Build: " + buildNumber + ")");
|
versionLbl.setText("Version: " + version + " (Build: " + buildNumber + ")");
|
||||||
fontsizeSlider.setValue(getSize());
|
fontsizeSlider.setValue(getFontSize());
|
||||||
colorPicker.setValue(Color.valueOf(getColor()));
|
colorPicker.setValue(Color.valueOf(getColor()));
|
||||||
|
|
||||||
updateBtn.setFont(Font.font("System", 12));
|
updateBtn.setFont(Font.font("System", 12));
|
||||||
|
@ -921,7 +920,7 @@ public class MainWindowController {
|
||||||
props.setProperty("autoUpdate", String.valueOf(isAutoUpdate()));
|
props.setProperty("autoUpdate", String.valueOf(isAutoUpdate()));
|
||||||
props.setProperty("useBeta", String.valueOf(isUseBeta()));
|
props.setProperty("useBeta", String.valueOf(isUseBeta()));
|
||||||
props.setProperty("autoplay", String.valueOf(isAutoplay()));
|
props.setProperty("autoplay", String.valueOf(isAutoplay()));
|
||||||
props.setProperty("size", getSize().toString());
|
props.setProperty("size", getFontSize().toString());
|
||||||
props.setProperty("local", getLocal());
|
props.setProperty("local", getLocal());
|
||||||
props.setProperty("ratingSortType", columnFavorite.getSortType().toString());
|
props.setProperty("ratingSortType", columnFavorite.getSortType().toString());
|
||||||
|
|
||||||
|
@ -952,10 +951,10 @@ public class MainWindowController {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setSize(Double.parseDouble(props.getProperty("size")));
|
setFontSize(Double.parseDouble(props.getProperty("size")));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("cloud not load fontsize", e);
|
LOGGER.error("cloud not load fontsize", e);
|
||||||
setSize(17.0);
|
setFontSize(17.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -986,13 +985,6 @@ public class MainWindowController {
|
||||||
setLocal(System.getProperty("user.language") + "_" + System.getProperty("user.country"));
|
setLocal(System.getProperty("user.language") + "_" + System.getProperty("user.country"));
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
setRatingSortType(props.getProperty("ratingSortType"));
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOGGER.error("cloud not load autoUpdate", e);
|
|
||||||
setRatingSortType("");
|
|
||||||
}
|
|
||||||
|
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOGGER.error(errorSave, e);
|
LOGGER.error(errorSave, e);
|
||||||
|
@ -1065,12 +1057,12 @@ public class MainWindowController {
|
||||||
return currentTableFilm.getStreamUrl();
|
return currentTableFilm.getStreamUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSize(Double input) {
|
public void setFontSize(Double input) {
|
||||||
this.size = input;
|
this.fontSize = input;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Double getSize() {
|
public Double getFontSize() {
|
||||||
return size;
|
return fontSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getIndexTable() {
|
public int getIndexTable() {
|
||||||
|
@ -1125,14 +1117,6 @@ public class MainWindowController {
|
||||||
return sourcesList;
|
return sourcesList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRatingSortType() {
|
|
||||||
return ratingSortType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRatingSortType(String ratingSortType) {
|
|
||||||
this.ratingSortType = ratingSortType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResourceBundle getBundle() {
|
public ResourceBundle getBundle() {
|
||||||
return bundle;
|
return bundle;
|
||||||
}
|
}
|
||||||
|
|
|
@ -550,9 +550,8 @@ public class DBController {
|
||||||
ResultSet rs = stmt.executeQuery("SELECT * FROM cache WHERE streamUrl=\"" + streamUrl + "\";");
|
ResultSet rs = stmt.executeQuery("SELECT * FROM cache WHERE streamUrl=\"" + streamUrl + "\";");
|
||||||
ArrayList<Text> nameText = new ArrayList<Text>();
|
ArrayList<Text> nameText = new ArrayList<Text>();
|
||||||
ArrayList<Text> responseText = new ArrayList<Text>();
|
ArrayList<Text> responseText = new ArrayList<Text>();
|
||||||
String fontFamily = main.getFONT_FAMILY();
|
|
||||||
Image im;
|
Image im;
|
||||||
int fontSize = (int) Math.round(mainWindowController.size);
|
int fontSize = (int) Math.round(mainWindowController.getFontSize());
|
||||||
int j = 2;
|
int j = 2;
|
||||||
|
|
||||||
nameText.add(0, new Text(mainWindowController.getBundle().getString("title") + ": "));
|
nameText.add(0, new Text(mainWindowController.getBundle().getString("title") + ": "));
|
||||||
|
@ -583,8 +582,8 @@ public class DBController {
|
||||||
rs.close();
|
rs.close();
|
||||||
|
|
||||||
for (int i = 0; i < nameText.size(); i++) {
|
for (int i = 0; i < nameText.size(); i++) {
|
||||||
nameText.get(i).setFont(Font.font(fontFamily, FontWeight.BOLD, fontSize));
|
nameText.get(i).setFont(Font.font("System", FontWeight.BOLD, fontSize));
|
||||||
responseText.get(i).setFont(Font.font(fontFamily, fontSize));
|
responseText.get(i).setFont(Font.font("System", fontSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
mainWindowController.getTextFlow().getChildren().remove(0,
|
mainWindowController.getTextFlow().getChildren().remove(0,
|
||||||
|
|
Loading…
Reference in New Issue