Merge pull request #119 from OHermesJunior/login-no-webview

Fail gracefully when there is no webview installed.
This commit is contained in:
Docile-Alligator 2020-06-12 16:41:49 +08:00 committed by GitHub
commit 6921d720d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -6,6 +6,8 @@ import android.content.SharedPreferences;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.InflateException;
import android.view.MenuItem; import android.view.MenuItem;
import android.webkit.CookieManager; import android.webkit.CookieManager;
import android.webkit.WebView; import android.webkit.WebView;
@ -70,7 +72,14 @@ public class LoginActivity extends BaseActivity {
((Infinity) getApplication()).getAppComponent().inject(this); ((Infinity) getApplication()).getAppComponent().inject(this);
super.onCreate(savedInstanceState); 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); ButterKnife.bind(this);

View File

@ -67,6 +67,7 @@
<string name="something_went_wrong">Something went wrong. Try again later.</string> <string name="something_went_wrong">Something went wrong. Try again later.</string>
<string name="access_denied">Access denied</string> <string name="access_denied">Access denied</string>
<string name="parse_user_info_error">Error occurred when parsing the user info</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_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> <string name="error_loading_gif_tap_to_retry">Error loading the gif. Tap to retry.</string>