本文整理匯總了Java中chatty.Version.VersionListener類的典型用法代碼示例。如果您正苦於以下問題:Java VersionListener類的具體用法?Java VersionListener怎麽用?Java VersionListener使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
VersionListener類屬於chatty.Version包,在下文中一共展示了VersionListener類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: checkNewVersion
import chatty.Version.VersionListener; //導入依賴的package包/類
/**
* Checks for a new version if the last check was long enough ago.
*/
private void checkNewVersion() {
//g.setUpdateAvailable();
if (!settings.getBoolean("checkNewVersion")) {
return;
}
long ago = System.currentTimeMillis() - settings.getLong("versionLastChecked");
if (ago/1000 < CHECK_VERSION_INTERVAL) {
return;
}
settings.setLong("versionLastChecked", System.currentTimeMillis());
g.printSystem("Checking for new version..");
new Version(new VersionListener() {
@Override
public void versionChecked(String version, String info, boolean isNewVersion) {
if (isNewVersion) {
String infoText = "";
if (!info.isEmpty()) {
infoText = "[" + info + "] ";
}
g.printSystem("New version available: "+version+" "+infoText
+"(Go to <Help-Website> to download)");
g.setUpdateAvailable(version);
} else {
g.printSystem("You already have the newest version.");
}
}
});
}
示例2: checkNewVersion
import chatty.Version.VersionListener; //導入依賴的package包/類
/**
* Checks for a new version if the last check was long enough ago.
*/
private void checkNewVersion() {
if (!settings.getBoolean("checkNewVersion")) {
return;
}
long ago = System.currentTimeMillis() - settings.getLong("versionLastChecked");
if (ago/1000 < CHECK_VERSION_INTERVAL) {
return;
}
settings.setLong("versionLastChecked", System.currentTimeMillis());
g.printSystem("Checking for new version..");
new Version(new VersionListener() {
@Override
public void versionChecked(String version, String info, boolean isNewVersion) {
if (isNewVersion) {
String infoText = "";
if (!info.isEmpty()) {
infoText = "[" + info + "] ";
}
g.printSystem("New version available: "+version+" "+infoText
+"(Go to <Help-Website> to download)");
} else {
g.printSystem("You already have the newest version.");
}
}
});
}
示例3: checkNewVersion
import chatty.Version.VersionListener; //導入依賴的package包/類
/**
* Checks for a new version if the last check was long enough ago.
*/
private void checkNewVersion() {
if (!settings.getBoolean("checkNewVersion")) {
return;
}
/**
* Check if enough time has passed since the last check.
*/
long ago = System.currentTimeMillis() - settings.getLong("versionLastChecked");
if (ago/1000 < CHECK_VERSION_INTERVAL) {
/**
* If not checking, check if update was detected last time.
*/
String updateAvailable = settings.getString("updateAvailable");
if (!updateAvailable.isEmpty()) {
g.setUpdateAvailable(updateAvailable);
}
return;
}
settings.setLong("versionLastChecked", System.currentTimeMillis());
g.printSystem("Checking for new version..");
new Version(new VersionListener() {
@Override
public void versionChecked(String version, String info, boolean isNewVersion) {
if (isNewVersion) {
String infoText = "";
if (!info.isEmpty()) {
infoText = "[" + info + "] ";
}
g.printSystem("New version available: "+version+" "+infoText
+"(Go to <Help-Website> to download)");
g.setUpdateAvailable(version);
settings.setString("updateAvailable", version);
} else {
g.printSystem("You already have the newest version.");
}
}
});
}