當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。