当前位置: 首页>>代码示例>>Java>>正文


Java VersionListener类代码示例

本文整理汇总了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.");
            }
        }
    });
}
 
开发者ID:partouf,项目名称:Chatty-Twitch-Client,代码行数:34,代码来源:TwitchClient.java

示例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.");
            }
        }
    });
}
 
开发者ID:pokemane,项目名称:TwitchChatClient,代码行数:31,代码来源:TwitchClient.java

示例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.");
            }
        }
    });
}
 
开发者ID:chatty,项目名称:chatty,代码行数:44,代码来源:TwitchClient.java


注:本文中的chatty.Version.VersionListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。