From 8ecb977629189f0bad5c223a7815ec4f323470d2 Mon Sep 17 00:00:00 2001 From: Bryson Steck Date: Wed, 9 Jun 2021 22:43:55 -0600 Subject: added new update checker, need to implement into ui --- .../me/brysonsteck/wiimmfiwatcher/MainActivity.java | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java') diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java index ee68742..3a42749 100644 --- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java +++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java @@ -16,7 +16,6 @@ import me.brysonsteck.wiimmfiwatcher.fragments.WatchCodeFragment; public class MainActivity extends AppCompatActivity { AppDatabase database; - @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -49,6 +48,26 @@ public class MainActivity extends AppCompatActivity { }); } + + @Override + protected void onStart() { + super.onStart(); + new Thread(() -> { + Updater updater = new Updater(); + updater.compareRelease(BuildConfig.VERSION_NAME); + if (updater.isOutdated()) { + System.out.println("---------------------------------------------------------------"); + System.out.println("\tA newer version of Wiimmfi Watcher is available! (" + updater.getNewestRelease() + ")"); + System.out.println("\tView the release notes and the source code here: " + updater.getGithubRelease()); + System.out.println("\t---------------------------------------------------------------"); + } else { + System.out.println("---------------------------------------------------------------"); + System.out.println("\t\t" + updater.getNewestRelease() + " is the latest release of Wiimmfi Watcher."); + System.out.println("\t\t---------------------------------------------------------------"); + } + }).start(); + } + @Override protected void onStop() { super.onStop(); -- cgit v1.2.3