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


Java AppUpdaterError.XML_URL_MALFORMED属性代码示例

本文整理汇总了Java中com.github.javiersantos.appupdater.enums.AppUpdaterError.XML_URL_MALFORMED属性的典型用法代码示例。如果您正苦于以下问题:Java AppUpdaterError.XML_URL_MALFORMED属性的具体用法?Java AppUpdaterError.XML_URL_MALFORMED怎么用?Java AppUpdaterError.XML_URL_MALFORMED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.github.javiersantos.appupdater.enums.AppUpdaterError的用法示例。


在下文中一共展示了AppUpdaterError.XML_URL_MALFORMED属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: start

@Override
public void start() {
    latestAppVersion = new UtilsAsync.LatestAppVersion(context, false, updateFrom, gitHub, xmlOrJsonUrl, new LibraryListener() {
        @Override
        public void onSuccess(Update update) {
            if (context instanceof Activity && ((Activity) context).isFinishing()) {
                return;
            }

            Update installedUpdate = new Update(UtilsLibrary.getAppInstalledVersion(context), UtilsLibrary.getAppInstalledVersionCode(context));
            if (UtilsLibrary.isUpdateAvailable(installedUpdate, update)) {
                Integer successfulChecks = libraryPreferences.getSuccessfulChecks();
                if (UtilsLibrary.isAbleToShow(successfulChecks, showEvery)) {
                    switch (display) {
                        case DIALOG:
                            final DialogInterface.OnClickListener updateClickListener = btnUpdateClickListener == null ? new UpdateClickListener(context, updateFrom, update.getUrlToDownload()) : btnUpdateClickListener;
                            final DialogInterface.OnClickListener disableClickListener = btnDisableClickListener == null ? new DisableClickListener(context) : btnDisableClickListener;

                            alertDialog = UtilsDisplay.showUpdateAvailableDialog(context, titleUpdate, getDescriptionUpdate(context, update, Display.DIALOG), btnDismiss, btnUpdate, btnDisable, updateClickListener, btnDismissClickListener, disableClickListener);
                            alertDialog.setCancelable(isDialogCancelable);
                            alertDialog.show();
                            break;
                        case SNACKBAR:
                            snackbar = UtilsDisplay.showUpdateAvailableSnackbar(context, getDescriptionUpdate(context, update, Display.SNACKBAR), UtilsLibrary.getDurationEnumToBoolean(duration), updateFrom, update.getUrlToDownload());
                            snackbar.show();
                            break;
                        case NOTIFICATION:
                            UtilsDisplay.showUpdateAvailableNotification(context, titleUpdate, getDescriptionUpdate(context, update, Display.NOTIFICATION), updateFrom, update.getUrlToDownload(), iconResId);
                            break;
                    }
                }
                libraryPreferences.setSuccessfulChecks(successfulChecks + 1);
            } else if (showAppUpdated) {
                switch (display) {
                    case DIALOG:
                        alertDialog = UtilsDisplay.showUpdateNotAvailableDialog(context, titleNoUpdate, getDescriptionNoUpdate(context));
                        alertDialog.setCancelable(isDialogCancelable);
                        alertDialog.show();
                        break;
                    case SNACKBAR:
                        snackbar = UtilsDisplay.showUpdateNotAvailableSnackbar(context, getDescriptionNoUpdate(context), UtilsLibrary.getDurationEnumToBoolean(duration));
                        snackbar.show();
                        break;
                    case NOTIFICATION:
                        UtilsDisplay.showUpdateNotAvailableNotification(context, titleNoUpdate, getDescriptionNoUpdate(context), iconResId);
                        break;
                }
            }
        }

        @Override
        public void onFailed(AppUpdaterError error) {
            if (error == AppUpdaterError.UPDATE_VARIES_BY_DEVICE) {
                Log.e("AppUpdater", "UpdateFrom.GOOGLE_PLAY isn't valid: update varies by device.");
            } else if (error == AppUpdaterError.GITHUB_USER_REPO_INVALID) {
                throw new IllegalArgumentException("GitHub user or repo is empty!");
            } else if (error == AppUpdaterError.XML_URL_MALFORMED) {
                throw new IllegalArgumentException("XML file is not valid!");
            } else if (error == AppUpdaterError.JSON_URL_MALFORMED) {
                throw new IllegalArgumentException("JSON file is not valid!");
            }
        }
    });

    latestAppVersion.execute();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:66,代码来源:AppUpdater.java

示例2: start

@Override
public void start() {
    latestAppVersion = new UtilsAsync.LatestAppVersion(context, false, updateFrom, gitHub, xmlOrJsonUrl, new LibraryListener() {
        @Override
        public void onSuccess(Update update) {
            if (context instanceof Activity && ((Activity) context).isFinishing()) {
                return;
            }

            Update installedUpdate = new Update(UtilsLibrary.getAppInstalledVersion(context), UtilsLibrary.getAppInstalledVersionCode(context));
            if (UtilsLibrary.isUpdateAvailable(installedUpdate, update)) {
                Integer successfulChecks = libraryPreferences.getSuccessfulChecks();
                if (UtilsLibrary.isAbleToShow(successfulChecks, showEvery)) {
                    switch (display) {
                        case DIALOG:
                            final DialogInterface.OnClickListener updateClickListener = btnUpdateClickListener == null ? new UpdateClickListener(context, updateFrom, update.getUrlToDownload()) : btnUpdateClickListener;
                            final DialogInterface.OnClickListener disableClickListener = btnDisableClickListener == null ? new DisableClickListener(context) : btnDisableClickListener;

                            titleUpdate = String.format(context.getResources().getString(R.string.appupdater_update_title), UtilsLibrary.getAppName(context), update.getLatestVersion());
                            
                            alertDialog = UtilsDisplay.showUpdateAvailableDialog(context, titleUpdate, getDescriptionUpdate(context, update, Display.DIALOG), btnDismiss, btnUpdate, btnDisable, updateClickListener, btnDismissClickListener, disableClickListener);
                            alertDialog.setCancelable(isDialogCancelable);
                            alertDialog.show();
                            break;
                        case SNACKBAR:
                            snackbar = UtilsDisplay.showUpdateAvailableSnackbar(context, getDescriptionUpdate(context, update, Display.SNACKBAR), UtilsLibrary.getDurationEnumToBoolean(duration), updateFrom, update.getUrlToDownload());
                            snackbar.show();
                            break;
                        case NOTIFICATION:
                            UtilsDisplay.showUpdateAvailableNotification(context, titleUpdate, getDescriptionUpdate(context, update, Display.NOTIFICATION), updateFrom, update.getUrlToDownload(), iconResId);
                            break;
                    }
                }
                libraryPreferences.setSuccessfulChecks(successfulChecks + 1);
            } else if (showAppUpdated) {
                switch (display) {
                    case DIALOG:
                        alertDialog = UtilsDisplay.showUpdateNotAvailableDialog(context, titleNoUpdate, getDescriptionNoUpdate(context));
                        alertDialog.setCancelable(isDialogCancelable);
                        alertDialog.show();
                        break;
                    case SNACKBAR:
                        snackbar = UtilsDisplay.showUpdateNotAvailableSnackbar(context, getDescriptionNoUpdate(context), UtilsLibrary.getDurationEnumToBoolean(duration));
                        snackbar.show();
                        break;
                    case NOTIFICATION:
                        UtilsDisplay.showUpdateNotAvailableNotification(context, titleNoUpdate, getDescriptionNoUpdate(context), iconResId);
                        break;
                }
            }
        }

        @Override
        public void onFailed(AppUpdaterError error) {
            if (error == AppUpdaterError.UPDATE_VARIES_BY_DEVICE) {
                Log.e("AppUpdater", "UpdateFrom.GOOGLE_PLAY isn't valid: update varies by device.");
            } else if (error == AppUpdaterError.GITHUB_USER_REPO_INVALID) {
                throw new IllegalArgumentException("GitHub user or repo is empty!");
            } else if (error == AppUpdaterError.XML_URL_MALFORMED) {
                throw new IllegalArgumentException("XML file is not valid!");
            } else if (error == AppUpdaterError.JSON_URL_MALFORMED) {
                throw new IllegalArgumentException("JSON file is not valid!");
            }
        }
    });

    latestAppVersion.execute();
}
 
开发者ID:morogoku,项目名称:MTweaks-KernelAdiutorMOD,代码行数:68,代码来源:AppUpdater.java


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