TBR: reader/android: small fixes
1. add some delay before joining the Syncgroup.
2. hide the progress widget when joining the device set.
Change-Id: I573097abf0a9fa5e6ffb0da557ff438d980a7695
diff --git a/android/app/src/main/java/io/v/android/apps/reader/PdfViewerActivity.java b/android/app/src/main/java/io/v/android/apps/reader/PdfViewerActivity.java
index ac842b3..c4331e7 100644
--- a/android/app/src/main/java/io/v/android/apps/reader/PdfViewerActivity.java
+++ b/android/app/src/main/java/io/v/android/apps/reader/PdfViewerActivity.java
@@ -302,6 +302,8 @@
}
private void joinDeviceSet(DeviceSet ds) {
+ showProgressWidgets(false);
+
mPdfView.loadPdfFile("/file_id/" + ds.getFileId());
// Create a new device meta, and update the device set with it.
@@ -590,7 +592,6 @@
return;
}
- showProgressWidgets(false);
joinDeviceSet(ds);
}
diff --git a/android/app/src/main/java/io/v/android/apps/reader/db/SyncbaseDB.java b/android/app/src/main/java/io/v/android/apps/reader/db/SyncbaseDB.java
index aaff89a..5a97e0b 100644
--- a/android/app/src/main/java/io/v/android/apps/reader/db/SyncbaseDB.java
+++ b/android/app/src/main/java/io/v/android/apps/reader/db/SyncbaseDB.java
@@ -93,6 +93,8 @@
private static final String TABLE_DEVICES = "devices";
private static final String TABLE_DEVICE_SETS = "deviceSets";
+ private static final int SYNCGROUP_JOIN_DELAY = 5000;
+
private Permissions mPermissions;
private Context mContext;
private VContext mVContext;
@@ -297,7 +299,10 @@
return;
}
- joinSyncgroup();
+ // TODO(youngseokyoon): investigate why this is needed.
+ // Join the syncgroup a few seconds later to make sure that the syncgroup is ready.
+ Handler handler = new Handler();
+ handler.postDelayed(() -> joinSyncgroup(), SYNCGROUP_JOIN_DELAY);
}
/**