Skip to content

Commit

Permalink
update message in default notifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
yjfnypeu committed Feb 9, 2018
1 parent 9d4c989 commit 910e1a6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 27 deletions.
3 changes: 1 addition & 2 deletions updatepluginlib/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application android:allowBackup="true" android:label="@string/app_name"
android:supportsRtl="true">
<application>
<provider
android:name=".util.UpdateInstallProvider"
android:authorities="update.plugin.${applicationId}.UpdateInstallProvider"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import android.app.Dialog;
import android.content.DialogInterface;

import org.lzh.framework.updatepluginlib.R;
import org.lzh.framework.updatepluginlib.base.InstallNotifier;
import org.lzh.framework.updatepluginlib.util.SafeDialogHandle;

Expand All @@ -35,13 +34,12 @@ public class DefaultInstallNotifier extends InstallNotifier {

@Override
public Dialog create(Activity activity) {
String updateContent = activity.getText(R.string.update_version_name)
+ ": " + update.getVersionName() + "\n\n\n"
+ update.getUpdateContent();
String updateContent = String.format("版本号:%s\n\n%s",
update.getVersionName(), update.getUpdateContent());
AlertDialog.Builder builder = new AlertDialog.Builder(activity)
.setTitle(R.string.install_title)
.setTitle("安装包已就绪,是否安装?")
.setMessage(updateContent)
.setPositiveButton(R.string.install_immediate, new DialogInterface.OnClickListener() {
.setPositiveButton("立即安装", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (update.isForced()) {
Expand All @@ -54,7 +52,7 @@ public void onClick(DialogInterface dialog, int which) {
});

if (!update.isForced() && update.isIgnore()) {
builder.setNeutralButton(R.string.update_ignore, new DialogInterface.OnClickListener() {
builder.setNeutralButton("忽略此版本", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
sendCheckIgnore();
Expand All @@ -64,7 +62,7 @@ public void onClick(DialogInterface dialog, int which) {
}

if (!update.isForced()) {
builder.setNegativeButton(R.string.update_cancel, new DialogInterface.OnClickListener() {
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
sendUserCancel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import android.app.Dialog;
import android.content.DialogInterface;

import org.lzh.framework.updatepluginlib.R;
import org.lzh.framework.updatepluginlib.base.CheckNotifier;
import org.lzh.framework.updatepluginlib.util.SafeDialogHandle;

Expand All @@ -33,21 +32,20 @@
public class DefaultUpdateNotifier extends CheckNotifier {
@Override
public Dialog create(Activity activity) {
String updateContent = activity.getText(R.string.update_version_name)
+ ": " + update.getVersionName() + "\n\n\n"
String updateContent = "版本号: " + update.getVersionName() + "\n\n\n"
+ update.getUpdateContent();
AlertDialog.Builder builder = new AlertDialog.Builder(activity)
.setMessage(updateContent)
.setTitle(R.string.update_title)
.setPositiveButton(R.string.update_immediate, new DialogInterface.OnClickListener() {
.setTitle("你有新版本需要更新")
.setPositiveButton("立即更新", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
sendDownloadRequest();
SafeDialogHandle.safeDismissDialog((Dialog) dialog);
}
});
if (update.isIgnore() && !update.isForced()) {
builder.setNeutralButton(R.string.update_ignore, new DialogInterface.OnClickListener() {
builder.setNeutralButton("忽略此版本", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
sendUserIgnore();
Expand All @@ -57,7 +55,7 @@ public void onClick(DialogInterface dialog, int which) {
}

if (!update.isForced()) {
builder.setNegativeButton(R.string.update_cancel, new DialogInterface.OnClickListener() {
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
sendUserCancel();
Expand Down
10 changes: 0 additions & 10 deletions updatepluginlib/src/main/res/values/strings.xml

This file was deleted.

0 comments on commit 910e1a6

Please sign in to comment.