Search in sources :

Example 1 with Version

use of com.xiecc.seeWeather.modules.about.domain.Version in project SeeWeather by xcc3641.

the class VersionUtil method showUpdateDialog.

private static void showUpdateDialog(Version versionAPI, final Context context) {
    String title = "发现新版" + versionAPI.name + "版本号:" + versionAPI.versionShort;
    new AlertDialog.Builder(context).setTitle(title).setMessage(versionAPI.changelog).setPositiveButton("下载", (dialog, which) -> {
        Uri uri = Uri.parse(versionAPI.updateUrl);
        Intent intent = new Intent();
        intent.setAction(Intent.ACTION_VIEW);
        intent.setData(uri);
        context.startActivity(intent);
    }).setNegativeButton("跳过此版本", (dialog, which) -> SharedPreferenceUtil.getInstance().putString("version", versionAPI.versionShort)).show();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) Context(android.content.Context) AlertDialog(android.support.v7.app.AlertDialog) RetrofitSingleton(com.xiecc.seeWeather.component.RetrofitSingleton) PackageManager(android.content.pm.PackageManager) Uri(android.net.Uri) R(com.xiecc.seeWeather.R) Version(com.xiecc.seeWeather.modules.about.domain.Version) Intent(android.content.Intent) PackageInfo(android.content.pm.PackageInfo) Intent(android.content.Intent) Uri(android.net.Uri)

Aggregations

Context (android.content.Context)1 Intent (android.content.Intent)1 PackageInfo (android.content.pm.PackageInfo)1 PackageManager (android.content.pm.PackageManager)1 Uri (android.net.Uri)1 AlertDialog (android.support.v7.app.AlertDialog)1 R (com.xiecc.seeWeather.R)1 RetrofitSingleton (com.xiecc.seeWeather.component.RetrofitSingleton)1 Version (com.xiecc.seeWeather.modules.about.domain.Version)1