aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java
diff options
context:
space:
mode:
authorBryson Steck <steck.bryson@gmail.com>2021-08-11 21:09:02 -0600
committerBryson Steck <steck.bryson@gmail.com>2021-08-11 21:09:14 -0600
commit5977cfeb9bfe5efcc3457d3fdf2d10f24e5ac395 (patch)
treec8e907249c1ea9930c3e5ea253b164c72c157ddb /app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java
parented69b7725f08f8657054ffe7bdf2df4de1dd9b4d (diff)
downloadwiimmfi-watcher-5977cfeb9bfe5efcc3457d3fdf2d10f24e5ac395.tar
wiimmfi-watcher-5977cfeb9bfe5efcc3457d3fdf2d10f24e5ac395.tar.gz
wiimmfi-watcher-5977cfeb9bfe5efcc3457d3fdf2d10f24e5ac395.tar.bz2
preparing settings fragment, added new "null" catch for updater"
Diffstat (limited to 'app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java')
-rw-r--r--app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java
index e98856b..878de62 100644
--- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java
+++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java
@@ -6,6 +6,7 @@ import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
+import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.room.Room;
@@ -59,6 +60,7 @@ public class MainActivity extends AppCompatActivity {
super.onStart();
final String[] newestRelease = {""};
final boolean[] outdated = {false};
+ final boolean[] failed = {false};
Thread thread = new Thread() {
public void run() {
Updater updater = new Updater();
@@ -68,6 +70,10 @@ public class MainActivity extends AppCompatActivity {
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 if (updater.hasFailed()) {
+ System.out.println("---------------------------------------------------------------");
+ System.out.println("\t\t An error has occurred while getting information from the update server.");
+ System.out.println("\t\t---------------------------------------------------------------");
} else {
System.out.println("---------------------------------------------------------------");
System.out.println("\t\t" + updater.getNewestRelease() + " is the latest release of Wiimmfi Watcher.");
@@ -75,6 +81,7 @@ public class MainActivity extends AppCompatActivity {
}
newestRelease[0] = updater.getNewestRelease();
outdated[0] = updater.isOutdated();
+ failed[0] = updater.hasFailed();
}
};
thread.start();
@@ -105,6 +112,9 @@ public class MainActivity extends AppCompatActivity {
}
})
.show();
+ } else if (failed[0] && !shownUpdate) {
+ shownUpdate = true;
+ Toast.makeText(this, "An error occurred while checking for updates for Wiimmfi Watcher.", Toast.LENGTH_LONG).show();
}
}