本文整理汇总了Java中com.github.javiersantos.appupdater.enums.Display类的典型用法代码示例。如果您正苦于以下问题:Java Display类的具体用法?Java Display怎么用?Java Display使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Display类属于com.github.javiersantos.appupdater.enums包,在下文中一共展示了Display类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.github.javiersantos.appupdater.enums.Display; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.settings);
Preference prefCheckForUpdates = findPreference("prefCheckForUpdates");
prefCheckForUpdates.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
new AppUpdater(SettingsActivity.this)
//.setUpdateFrom(UpdateFrom.GITHUB)
//.setGitHubUserAndRepo("javiersantos", "AppUpdater")
.setUpdateFrom(UpdateFrom.XML)
.setUpdateXML("https://raw.githubusercontent.com/javiersantos/AppUpdater/master/app/update-changelog.xml")
.setDisplay(Display.DIALOG)
.showAppUpdated(true)
.start();
return true;
}
});
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:SettingsActivity.java
示例2: AppUpdater
import com.github.javiersantos.appupdater.enums.Display; //导入依赖的package包/类
public AppUpdater(Context context) {
this.context = context;
this.libraryPreferences = new LibraryPreferences(context);
this.display = Display.DIALOG;
this.updateFrom = UpdateFrom.GOOGLE_PLAY;
this.duration = Duration.NORMAL;
this.showEvery = 1;
this.showAppUpdated = false;
this.iconResId = R.drawable.ic_stat_name;
// Dialog
this.titleUpdate = context.getResources().getString(R.string.appupdater_update_available);
this.titleNoUpdate = context.getResources().getString(R.string.appupdater_update_not_available);
this.btnUpdate = context.getResources().getString(R.string.appupdater_btn_update);
this.btnDismiss = context.getResources().getString(R.string.appupdater_btn_dismiss);
this.btnDisable = context.getResources().getString(R.string.appupdater_btn_disable);
this.isDialogCancelable = true;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:AppUpdater.java
示例3: getDescriptionUpdate
import com.github.javiersantos.appupdater.enums.Display; //导入依赖的package包/类
private String getDescriptionUpdate(Context context, Update update, Display display) {
if (descriptionUpdate == null || TextUtils.isEmpty(descriptionUpdate)) {
switch (display) {
case DIALOG:
if (update.getReleaseNotes() != null && !TextUtils.isEmpty(update.getReleaseNotes())) {
if (TextUtils.isEmpty(descriptionUpdate))
return update.getReleaseNotes();
else
return String.format(context.getResources().getString(R.string.appupdater_update_available_description_dialog_before_release_notes), update.getLatestVersion(), update.getReleaseNotes());
} else {
return String.format(context.getResources().getString(R.string.appupdater_update_available_description_dialog), update.getLatestVersion(), UtilsLibrary.getAppName(context));
}
case SNACKBAR:
return String.format(context.getResources().getString(R.string.appupdater_update_available_description_snackbar), update.getLatestVersion());
case NOTIFICATION:
return String.format(context.getResources().getString(R.string.appupdater_update_available_description_notification), update.getLatestVersion(), UtilsLibrary.getAppName(context));
}
}
return descriptionUpdate;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:AppUpdater.java
示例4: appCheckNotification
import com.github.javiersantos.appupdater.enums.Display; //导入依赖的package包/类
public static void appCheckNotification(Context context){
if (Prefs.getBoolean("show_update_notif", true, context)) {
new AppUpdater(context)
.setDisplay(Display.NOTIFICATION)
.setUpdateFrom(UpdateFrom.JSON)
.setIcon(R.drawable.logo)
.setUpdateJSON(context.getString(R.string.appupdater_json))
.start();
}
}
开发者ID:morogoku,项目名称:MTweaks-KernelAdiutorMOD,代码行数:11,代码来源:AppUpdaterTask.java
示例5: appCheckDialog
import com.github.javiersantos.appupdater.enums.Display; //导入依赖的package包/类
public static void appCheckDialog(Context context){
if (Prefs.getBoolean("show_update_notif", true, context)) {
new AppUpdater(context)
.setDisplay(Display.DIALOG)
.setUpdateFrom(UpdateFrom.JSON)
.setUpdateJSON(context.getString(R.string.appupdater_json))
.start();
}
}
开发者ID:morogoku,项目名称:MTweaks-KernelAdiutorMOD,代码行数:10,代码来源:AppUpdaterTask.java
示例6: appCheckDialogAllways
import com.github.javiersantos.appupdater.enums.Display; //导入依赖的package包/类
public static void appCheckDialogAllways(Context context){
new AppUpdater(context)
.setDisplay(Display.DIALOG)
.setUpdateFrom(UpdateFrom.JSON)
.setUpdateJSON(context.getString(R.string.appupdater_json))
.showAppUpdated(true)
.start();
}
开发者ID:morogoku,项目名称:MTweaks-KernelAdiutorMOD,代码行数:9,代码来源:AppUpdaterTask.java
示例7: onPostCreate
import com.github.javiersantos.appupdater.enums.Display; //导入依赖的package包/类
@Override
protected void onPostCreate(@Nullable Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
new AppUpdater(this.getApplicationContext())
.setUpdateFrom(UpdateFrom.GITHUB)
.setGitHubUserAndRepo("deletescape", "Control_Box_Android")
.setDisplay(Display.NOTIFICATION)
.showAppUpdated(false)
.start();
}
开发者ID:deletescape,项目名称:Control_Box_Android,代码行数:11,代码来源:ControlBox.java
示例8: updatesCheck
import com.github.javiersantos.appupdater.enums.Display; //导入依赖的package包/类
@DebugLog
public void updatesCheck(Context context) {
appUpdater = new AppUpdater(context)
.setUpdateFrom(UpdateFrom.GITHUB)
.setGitHubUserAndRepo("out386", "AndroidFileHost_Browser")
.showAppUpdated(false)
.setDisplay(Display.DIALOG);
appUpdater.start();
}
开发者ID:out386,项目名称:AndroidFileHost_Browser,代码行数:10,代码来源:MainActivity.java
示例9: checkForUpdates
import com.github.javiersantos.appupdater.enums.Display; //导入依赖的package包/类
private void checkForUpdates() {
// Remove this for store builds!
// UpdateManager.register(this, ImApp.HOCKEY_APP_ID);
//only check github for updates if there is no Google Play
if (!hasGooglePlay()) {
try {
String version = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
//if this is a full release, without -beta -rc etc, then check the appupdater!
if (version.indexOf("-") == -1) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
long timeNow = new Date().getTime();
long timeSinceLastCheck = prefs.getLong("updatetime", -1);
//only check for updates once per day
if (timeSinceLastCheck == -1 || (timeNow - timeSinceLastCheck) > 86400) {
AppUpdater appUpdater = new AppUpdater(this);
appUpdater.setDisplay(Display.DIALOG);
appUpdater.setUpdateFrom(UpdateFrom.XML);
appUpdater.setUpdateXML(ImApp.URL_UPDATER);
// appUpdater.showAppUpdated(true);
appUpdater.start();
prefs.edit().putLong("updatetime", timeNow).commit();
}
}
} catch (Exception e) {
Log.d("AppUpdater", "error checking app updates", e);
}
}
}
开发者ID:zom,项目名称:Zom-Android,代码行数:37,代码来源:MainActivity.java
示例10: setDisplay
import com.github.javiersantos.appupdater.enums.Display; //导入依赖的package包/类
@Override
public AppUpdater setDisplay(Display display) {
this.display = display;
return this;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:AppUpdater.java
示例11: start
import com.github.javiersantos.appupdater.enums.Display; //导入依赖的package包/类
@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,代码行数:67,代码来源:AppUpdater.java
示例12: start
import com.github.javiersantos.appupdater.enums.Display; //导入依赖的package包/类
@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,代码行数:69,代码来源:AppUpdater.java
示例13: setDisplay
import com.github.javiersantos.appupdater.enums.Display; //导入依赖的package包/类
/**
* Set the type of message used to notify the user when a new update has been found. Default: DIALOG.
*
* @param display how the update will be shown
* @return this
* @see com.github.javiersantos.appupdater.enums.Display
*/
AppUpdater setDisplay(Display display);
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:IAppUpdater.java
注:本文中的com.github.javiersantos.appupdater.enums.Display类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论