本文整理汇总了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.");
}
}
});
}