diff --git a/src/main/java/com/nutomic/syncthingandroid/activities/StateDialogActivity.java b/src/main/java/com/nutomic/syncthingandroid/activities/StateDialogActivity.java
index f4f36211..a3388b0f 100644
--- a/src/main/java/com/nutomic/syncthingandroid/activities/StateDialogActivity.java
+++ b/src/main/java/com/nutomic/syncthingandroid/activities/StateDialogActivity.java
@@ -1,25 +1,27 @@
package com.nutomic.syncthingandroid.activities;
-import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.Intent;
+import android.databinding.DataBindingUtil;
import android.os.Bundle;
+import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat;
-import android.view.LayoutInflater;
import android.view.View;
-import android.widget.TextView;
import com.nutomic.syncthingandroid.R;
+import com.nutomic.syncthingandroid.databinding.DialogLoadingBinding;
import com.nutomic.syncthingandroid.service.SyncthingService;
import com.nutomic.syncthingandroid.util.Util;
+import java.util.concurrent.TimeUnit;
+
/**
* Handles loading/disabled dialogs.
*/
public abstract class StateDialogActivity extends SyncthingActivity {
- private static final String TAG = "StateDialogActivity";
+ private static final long SLOW_LOADING_TIME = TimeUnit.SECONDS.toMillis(30);
private AlertDialog mLoadingDialog;
private AlertDialog mDisabledDialog;
@@ -89,18 +91,29 @@ public abstract class StateDialogActivity extends SyncthingActivity {
if (isFinishing() || mLoadingDialog != null)
return;
- LayoutInflater inflater = getLayoutInflater();
- @SuppressLint("InflateParams")
- View dialogLayout = inflater.inflate(R.layout.dialog_loading, null);
- TextView loadingText = dialogLayout.findViewById(R.id.loading_text);
- loadingText.setText((getIntent().getBooleanExtra(EXTRA_FIRST_START, false))
+ DialogLoadingBinding binding = DataBindingUtil.inflate(
+ getLayoutInflater(), R.layout.dialog_loading, null, false);
+ boolean isFirstStart = getIntent().getBooleanExtra(EXTRA_FIRST_START, false);
+ binding.loadingText.setText((isFirstStart)
? R.string.web_gui_creating_key
: R.string.api_loading);
mLoadingDialog = new AlertDialog.Builder(this)
.setCancelable(false)
- .setView(dialogLayout)
+ .setView(binding.getRoot())
.show();
+
+ if (!isFirstStart) {
+ new Handler().postDelayed(() -> {
+ if (isFinishing() || mLoadingDialog == null)
+ return;
+
+ binding.loadingSlowMessage.setVisibility(View.VISIBLE);
+ binding.viewLogs.setOnClickListener(v -> {
+ startActivity(new Intent(this, LogActivity.class));
+ });
+ }, SLOW_LOADING_TIME);
+ }
}
private void dismissLoadingDialog() {
diff --git a/src/main/res/layout/dialog_loading.xml b/src/main/res/layout/dialog_loading.xml
index a6926d8c..7eb92ae8 100644
--- a/src/main/res/layout/dialog_loading.xml
+++ b/src/main/res/layout/dialog_loading.xml
@@ -1,19 +1,59 @@
-
+
-
+ android:padding="@dimen/abc_action_bar_content_inset_material"
+ android:theme="?alertDialogTheme"
+ android:orientation="vertical">
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index f4193473..55aa73cb 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -21,11 +21,6 @@ Please report any problems you encounter via Github.
-
- Waiting for GUI
-
-
- Generating secure keys. This may take a few minutes.
Add Folder
@@ -36,9 +31,6 @@ Please report any problems you encounter via Github.
Send Device ID to
-
- Loading…
-
Allow Anonymous Usage Reporting?
The encrypted usage report is sent daily. It is used to track common platforms, folder sizes and app versions. If the reported data set is changed you will be prompted with this dialog again.\n\nThe aggregated statistics are publicly available at https://data.syncthing.net.
@@ -62,6 +54,17 @@ Please report any problems you encounter via Github.
Turn off for Syncthing
Your device does not support disabling battery optimizations
+
+
+
+
+ Loading…
+
+
+ Generating secure keys. This may take a few minutes.
+
+ Syncthing is taking very long to load. Use the logs to check for any errors.
+
@@ -230,6 +233,9 @@ Please report any problems you encounter via Github.
Web GUI
+
+ Waiting for GUI
+