Merge pull request #3625 from nextcloud/timeoutCool

Show snackbar after 10s when cool is loading to slow
This commit is contained in:
Andy Scherzinger 2019-02-15 18:12:42 +01:00 committed by GitHub
commit 0fce9555fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 2 deletions

View file

@ -408,7 +408,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
new Handler().postDelayed(() -> DisplayUtils.createSnackbar(mLoginWebView,
R.string.fallback_weblogin_text,
Snackbar.LENGTH_INDEFINITE)
.setActionTextColor(getResources().getColor(R.color.primary_dark))
.setActionTextColor(getResources().getColor(R.color.white))
.setAction(R.string.fallback_weblogin_back, v -> {
mLoginWebView.setVisibility(View.INVISIBLE);
webViewLoginMethod = false;

View file

@ -30,6 +30,7 @@ import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.view.View;
import android.webkit.JavascriptInterface;
@ -42,6 +43,7 @@ import android.widget.TextView;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.google.android.material.snackbar.Snackbar;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.datamodel.OCFile;
@ -393,6 +395,15 @@ public class RichDocumentsWebView extends ExternalSiteWebView {
if (!url.isEmpty()) {
richDocumentsWebView.webview.loadUrl(url);
new Handler().postDelayed(() -> {
if (richDocumentsWebView.webview.getVisibility() != View.VISIBLE) {
DisplayUtils.createSnackbar(richDocumentsWebView.findViewById(android.R.id.content),
R.string.timeout_richDocuments, Snackbar.LENGTH_INDEFINITE)
.setActionTextColor(richDocumentsWebView.getResources().getColor(R.color.white))
.setAction(R.string.fallback_weblogin_back, v -> richDocumentsWebView.closeView()).show();
}
}, 10 * 1000);
} else {
Toast.makeText(richDocumentsWebView.getApplicationContext(),
R.string.richdocuments_failed_to_load_document, Toast.LENGTH_LONG).show();

View file

@ -857,6 +857,7 @@
<string name="delete_entries">Delete entries</string>
<string name="dismiss_notification_description">Dismiss notification</string>
<string name="action_empty_notifications">Clear all notifications</string>
<string name="timeout_richDocuments">Loading takes very long…</string>
<string name="clear_notifications_failed">Failed to clear notifications.</string>
<string name="remove_notification_failed">Failed to remove notification.</string>
<string name="notification_action_failed">Failed to execute action.</string>