mirror of
https://github.com/nextcloud/android.git
synced 2024-11-21 20:55:31 +03:00
Reload rich document edition on reload event from webview (triggered on session expiration)
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
parent
28d3891f65
commit
34f168280e
1 changed files with 23 additions and 0 deletions
|
@ -31,6 +31,7 @@ import com.owncloud.android.databinding.RichdocumentsWebviewBinding;
|
|||
import com.owncloud.android.datamodel.OCFile;
|
||||
import com.owncloud.android.datamodel.SyncedFolderProvider;
|
||||
import com.owncloud.android.datamodel.ThumbnailsCacheManager;
|
||||
import com.owncloud.android.ui.asynctasks.TextEditorLoadUrlTask;
|
||||
import com.owncloud.android.utils.DisplayUtils;
|
||||
import com.owncloud.android.utils.MimeTypeUtil;
|
||||
import com.owncloud.android.utils.WebViewUtil;
|
||||
|
@ -99,6 +100,23 @@ public abstract class EditorWebView extends ExternalSiteWebView {
|
|||
finish();
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
if (getWebView().getVisibility() != View.VISIBLE) {
|
||||
return;
|
||||
}
|
||||
|
||||
Optional<User> user = getUser();
|
||||
if (!user.isPresent()) {
|
||||
return;
|
||||
}
|
||||
|
||||
OCFile file = getFile();
|
||||
if (file != null) {
|
||||
TextEditorLoadUrlTask task = new TextEditorLoadUrlTask(this, user.get(), file, editorUtils);
|
||||
task.execute();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void bindView() {
|
||||
binding = RichdocumentsWebviewBinding.inflate(getLayoutInflater());
|
||||
|
@ -281,6 +299,11 @@ public abstract class EditorWebView extends ExternalSiteWebView {
|
|||
public void loaded() {
|
||||
runOnUiThread(EditorWebView.this::hideLoading);
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void reload() {
|
||||
EditorWebView.this.reload();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue