Skip to content

Commit 6111ca2

Browse files
committed
小修小补
1 parent ba61ce0 commit 6111ca2

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

app/src/main/java/io/github/javiewer/activity/MainActivity.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -213,22 +213,7 @@ private void setFragment(Fragment fragment, CharSequence title) {
213213
return;
214214
}
215215

216-
/*
217216
FragmentTransaction transaction = fragmentManager.beginTransaction();
218-
219-
if (old != null) {
220-
transaction.hide(old);
221-
}
222-
223-
if (!fragment.isAdded()) {
224-
transaction.add(R.id.content, fragment);
225-
} else {
226-
transaction.show(fragment);
227-
}*/
228-
FragmentTransaction transaction = fragmentManager.beginTransaction();
229-
/*for (Fragment f : fragmentManager.getFragments()) {
230-
transaction.hide(f);
231-
}*/
232217
if (old != null) {
233218
transaction.hide(old);
234219
}

app/src/main/java/io/github/javiewer/activity/StartActivity.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,20 +85,36 @@ public void handleProperties(Properties properties) {
8585
message += "\n\n更新日志:\n\n" + properties.getChangelog() + "\n";
8686
}
8787

88-
AlertDialog dialog = new AlertDialog.Builder(this)
88+
final boolean[] update = {false};
89+
final AlertDialog dialog = new AlertDialog.Builder(this)
8990
.setTitle("发现更新")
9091
.setMessage(message)
9192
.setNegativeButton("忽略更新", null)
9293
.setPositiveButton("更新", new DialogInterface.OnClickListener() {
9394
@Override
9495
public void onClick(DialogInterface dialog, int which) {
95-
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/SplashCodes/JAViewer/releases")));
96+
update[0] = true;
9697
}
9798
})
9899
.create();
99100
dialog.show();
101+
102+
dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
103+
@Override
104+
public void onDismiss(DialogInterface dialogInterface) {
105+
start();
106+
if (update[0]) {
107+
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/SplashCodes/JAViewer/releases")));
108+
}
109+
}
110+
});
111+
} else {
112+
start();
100113
}
101114

115+
}
116+
117+
public void start() {
102118
startActivity(new Intent(StartActivity.this, MainActivity.class));
103119
finish();
104120
}

0 commit comments

Comments
 (0)