aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDocile-Alligator <chineseperson5@gmail.com>2020-06-12 08:41:49 +0000
committerGitHub <noreply@github.com>2020-06-12 08:41:49 +0000
commit6921d720d21eb2862d377cc0cd80f41e4150d6a9 (patch)
tree28313db0a46f8a5b1fecc069807f34dae6872e39 /app
parent4b3bbf8e7e753033f15d8b4bc9dafd05cf1235bc (diff)
parent3cd7cbd6d80debba40df4df5fcf2abfd13a0ee9d (diff)
downloadinfinity-for-reddit-6921d720d21eb2862d377cc0cd80f41e4150d6a9.tar
infinity-for-reddit-6921d720d21eb2862d377cc0cd80f41e4150d6a9.tar.gz
infinity-for-reddit-6921d720d21eb2862d377cc0cd80f41e4150d6a9.tar.bz2
infinity-for-reddit-6921d720d21eb2862d377cc0cd80f41e4150d6a9.tar.lz
infinity-for-reddit-6921d720d21eb2862d377cc0cd80f41e4150d6a9.tar.xz
infinity-for-reddit-6921d720d21eb2862d377cc0cd80f41e4150d6a9.tar.zst
infinity-for-reddit-6921d720d21eb2862d377cc0cd80f41e4150d6a9.zip
Merge pull request #119 from OHermesJunior/login-no-webview
Fail gracefully when there is no webview installed.
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LoginActivity.java11
-rw-r--r--app/src/main/res/values/strings.xml1
2 files changed, 11 insertions, 1 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LoginActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LoginActivity.java
index 7f03f302..f67893fd 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LoginActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LoginActivity.java
@@ -6,6 +6,8 @@ import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
+import android.util.Log;
+import android.view.InflateException;
import android.view.MenuItem;
import android.webkit.CookieManager;
import android.webkit.WebView;
@@ -70,7 +72,14 @@ public class LoginActivity extends BaseActivity {
((Infinity) getApplication()).getAppComponent().inject(this);
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_login);
+ try {
+ setContentView(R.layout.activity_login);
+ } catch (InflateException ie) {
+ Log.e("LoginActivity", "Failed to inflate LoginActivity: " + ie.getMessage());
+ Toast.makeText(LoginActivity.this, R.string.no_system_webview_error, Toast.LENGTH_SHORT).show();
+ finish();
+ return;
+ }
ButterKnife.bind(this);
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index a8d9f21f..86d705aa 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -67,6 +67,7 @@
<string name="something_went_wrong">Something went wrong. Try again later.</string>
<string name="access_denied">Access denied</string>
<string name="parse_user_info_error">Error occurred when parsing the user info</string>
+ <string name="no_system_webview_error">Error opening System\'s WebView</string>
<string name="error_loading_image_tap_to_retry">Error loading the image. Tap to retry.</string>
<string name="error_loading_gif_tap_to_retry">Error loading the gif. Tap to retry.</string>