Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
subhra74 committed Mar 18, 2020
1 parent d10caae commit f964caa
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 15 deletions.
6 changes: 6 additions & 0 deletions app/src/main/java/xdman/XDMApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ public class XDMApp implements DownloadListener, DownloadWindowListener,

public static final String APP_VERSION = "7.2.10";
public static final String XDM_WINDOW_TITLE = "XDM 2020";
public static final String APP_UPDAT_URL = "https://api.github.com/repos/subhra74/xdm/releases/latest";
public static final String APP_UPDATE_CHK_URL = "https://subhra74.github.io/xdm/update-checker.html?v=";
public static final String APP_WIKI_URL = "https://github.com/subhra74/xdm/wiki";
public static final String APP_HOME_URL = "https://github.com/subhra74/xdm";
public static final String APP_TWITTER_URL = "https://twitter.com/XDM_subhra74";
public static final String APP_FACEBOOK_URL = "https://www.facebook.com/XDM.subhra74/";

private ArrayList<ListChangeListener> listChangeListeners;
private Map<String, DownloadEntry> downloads;
Expand Down
13 changes: 6 additions & 7 deletions app/src/main/java/xdman/ui/components/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -325,13 +325,12 @@ public void actionPerformed(ActionEvent e) {
XDMApp.getInstance().saveDownloadList(file);
}
} else if ("MENU_CONTENTS".equals(name)) {
XDMUtils.browseURL("https://github.com/subhra74/xdm/wiki");
XDMUtils.browseURL(XDMApp.APP_WIKI_URL);
} else if ("MENU_HOME_PAGE".equals(name)) {
XDMUtils.browseURL("https://github.com/subhra74/xdm");
XDMUtils.browseURL(XDMApp.APP_HOME_URL);
} else if ("MENU_UPDATE".equals(name)) {
XDMUtils.browseURL(
"https://subhra74.github.io/xdm/update-checker.html?v="
+ XDMApp.APP_VERSION);
XDMApp.APP_UPDATE_CHK_URL + XDMApp.APP_VERSION);
} else if ("MENU_LANG".equals(name)) {
showLanguageDlg();
} else if ("MENU_BATCH_DOWNLOAD".equals(name)) {
Expand Down Expand Up @@ -918,9 +917,9 @@ private void initWindow() {
showTwitterIcon = true;
showFBIcon = true;
showGitHubIcon = true;
fbUrl = "https://www.facebook.com/XDM.subhra74/";
twitterUrl = "https://twitter.com/XDM_subhra74";
gitHubUrl = "https://github.com/subhra74/xdm";
fbUrl = XDMApp.APP_FACEBOOK_URL;
twitterUrl = XDMApp.APP_TWITTER_URL;
gitHubUrl = XDMApp.APP_HOME_URL;

JLabel lblTitle = new JLabel(XDMApp.XDM_WINDOW_TITLE);
lblTitle.setBorder(new EmptyBorder(scale(20), scale(20), scale(20), 0));
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/xdman/ui/components/TrayHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public void itemStateChanged(ItemEvent e) {
popup.add(restoreItem);
popup.add(throttleItem);
popup.add(exitItem);
trayIcon.setToolTip("XDM 2018");
trayIcon.setToolTip(XDMApp.XDM_WINDOW_TITLE);
trayIcon.setPopupMenu(popup);

trayIcon.addMouseListener(new MouseAdapter() {
Expand Down
9 changes: 6 additions & 3 deletions app/src/main/java/xdman/ui/components/UpdateNotifyPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import xdman.util.UpdateChecker;
import xdman.util.XDMUtils;
import static xdman.util.XDMUtils.getScaledInt;

public class UpdateNotifyPanel extends JPanel {
/**
*
Expand All @@ -28,7 +29,8 @@ public class UpdateNotifyPanel extends JPanel {

public UpdateNotifyPanel() {
super(new BorderLayout());
setBorder(new EmptyBorder(getScaledInt(10), getScaledInt(15), getScaledInt(10), getScaledInt(15)));
setBorder(new EmptyBorder(getScaledInt(10), getScaledInt(15),
getScaledInt(10), getScaledInt(15)));
JPanel p2 = new JPanel(new BorderLayout());
p2.setOpaque(false);
lbl = new JLabel();
Expand All @@ -47,7 +49,8 @@ public UpdateNotifyPanel() {
@Override
public void actionPerformed(ActionEvent e) {
if (mode == UpdateChecker.APP_UPDATE_AVAILABLE) {
XDMUtils.browseURL("http://xdman.sourceforge.net/update/update.php?ver=" + XDMApp.APP_VERSION);
XDMUtils.browseURL(
XDMApp.APP_UPDATE_CHK_URL + XDMApp.APP_VERSION);
} else {
FFmpegDownloader fd = new FFmpegDownloader();
fd.start();
Expand All @@ -60,7 +63,7 @@ public void actionPerformed(ActionEvent e) {

public void setDetails(int mode) {
if (mode == UpdateChecker.COMP_NOT_INSTALLED) {
setBackground(new Color(216,1,0));
setBackground(new Color(216, 1, 0));
} else {
setBackground(ColorResource.getDarkestBgColor());
}
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/java/xdman/util/UpdateChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
import xdman.network.http.XDMHttpClient;

public class UpdateChecker {
private static final String APP_UPDAT_URL = "https://api.github.com/repos/subhra74/xdm/releases/latest",
COMPONENTS_UPDATE_URL = "http://xdman.sourceforge.net/components/update_check.php";

public static final int APP_UPDATE_AVAILABLE = 10,
COMP_UPDATE_AVAILABLE = 20, COMP_NOT_INSTALLED = 30,
NO_UPDATE_AVAILABLE = 40;
Expand Down Expand Up @@ -89,7 +88,8 @@ public boolean accept(File dir, String name) {
private static boolean isUpdateAvailable(String version) {
JavaHttpClient client = null;
try {
client = new JavaHttpClient(APP_UPDAT_URL + "?ver=" + version);
client = new JavaHttpClient(
XDMApp.APP_UPDAT_URL + "?ver=" + version);
client.setFollowRedirect(true);
client.connect();
int resp = client.getStatusCode();
Expand Down Expand Up @@ -118,7 +118,7 @@ private static boolean isUpdateAvailable(String version) {

private static boolean isNewerVersion(StringBuilder text, String v2) {
try {
//System.out.println(text);
// System.out.println(text);
Matcher matcher = PATTERN_TAG.matcher(text);
if (matcher.find()) {
String v1 = matcher.group(1);
Expand Down

0 comments on commit f964caa

Please sign in to comment.