From 3cd7cbd6d80debba40df4df5fcf2abfd13a0ee9d Mon Sep 17 00:00:00 2001 From: Hermes Junior Date: Tue, 9 Jun 2020 13:41:03 +0200 Subject: Fail gracefully when there is no webview installed. --- .../infinityforreddit/Activity/LoginActivity.java | 11 ++++++++++- app/src/main/res/values/strings.xml | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'app/src') 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 bdd8df76..2acbbc79 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -67,6 +67,7 @@ Something went wrong. Try again later. Access denied Error occurred when parsing the user info + Error opening System\'s WebView Error loading the image. Tap to retry. Error loading the gif. Tap to retry. -- cgit v1.2.3