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-15 15:20:21 -0600
committerBryson Steck <steck.bryson@gmail.com>2021-08-15 15:20:21 -0600
commitb5b615d63b926e6ce8042ac82a0ce46ab38dad6d (patch)
treea4490b9e97b9950bb43f8d1bbb9af6fc2fade636 /app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java
parent39c888b7089cd5eb24c43b64ec6d0d365e946f9d (diff)
downloadwiimmfi-watcher-b5b615d63b926e6ce8042ac82a0ce46ab38dad6d.tar
wiimmfi-watcher-b5b615d63b926e6ce8042ac82a0ce46ab38dad6d.tar.gz
wiimmfi-watcher-b5b615d63b926e6ce8042ac82a0ce46ab38dad6d.tar.bz2
made class to handle changing photo, implemented updater fix
Diffstat (limited to 'app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java')
-rw-r--r--app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java
index 1657e38..4e6fe30 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;
@@ -90,6 +91,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();
@@ -99,6 +101,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.");
@@ -106,6 +112,7 @@ public class MainActivity extends AppCompatActivity {
}
newestRelease[0] = updater.getNewestRelease();
outdated[0] = updater.isOutdated();
+ failed[0] = updater.hasFailed();
}
};
thread.start();
@@ -136,8 +143,10 @@ 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. Please try again later.", Toast.LENGTH_LONG).show();
}
-
}
@Override