rich workspaces

- show button to create folder info
- bug fixes

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2020-01-09 12:57:07 +01:00
parent de269b2603
commit 0e5a772e63
No known key found for this signature in database
GPG Key ID: 0E00D4D47D0C5AF7
9 changed files with 114 additions and 17 deletions

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?><!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="24px" height="24px" viewBox="0 0 24 24"
enable-background="new 0 0 24 24" xml:space="preserve">
<g id="Bounding_Box">
<rect fill="none" width="24" height="24" />
</g>
<g id="Flat">
<g id="ui_x5F_spec_x5F_header_copy_2">
</g>
<g>
<path d="M17,19.22H5V7h7V5H5C3.9,5,3,5.9,3,7v12c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2v-7h-2V19.22z" />
<path d="M19,2h-2v3h-3c0.01,0.01,0,2,0,2h3v2.99c0.01,0.01,2,0,2,0V7h3V5h-3V2z" />
<rect x="7" y="9" width="8" height="2" />
<polygon points="7,12 7,14 15,14 15,12 12,12 " />
<rect x="7" y="15" width="8" height="2" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 845 B

View File

@ -68,7 +68,7 @@ public abstract class EditorWebView extends ExternalSiteWebView {
private static final String TAG = EditorWebView.class.getSimpleName();
protected void loadUrl(String url) {
webview.loadUrl(url);
onUrlLoaded(url);
}
protected void hideLoading() {

View File

@ -251,7 +251,7 @@ public class RichDocumentsEditorWebView extends EditorWebView {
}
@Override
protected void loadUrl(String url) {
public void loadUrl(String url) {
if (TextUtils.isEmpty(url)) {
new RichDocumentsLoadUrlTask(this, getUser().get(), getFile()).execute();
} else {

View File

@ -63,8 +63,6 @@ class TextEditorWebView : EditorWebView() {
override fun loadUrl(url: String?) {
if (url.isNullOrEmpty()) {
TextEditorLoadUrlTask(this, user.get(), file).execute()
} else {
super.loadUrl(url)
}
}

View File

@ -45,6 +45,7 @@ import android.widget.AbsListView;
import android.widget.PopupMenu;
import com.google.android.material.snackbar.Snackbar;
import com.nextcloud.android.lib.richWorkspace.RichWorkspaceDirectEditingRemoteOperation;
import com.nextcloud.client.account.User;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.device.DeviceInfo;
@ -746,20 +747,20 @@ public class OCFileListFragment extends ExtendedListFragment implements
if (menu.findItem(R.id.action_sort) == null) {
menuItemOrig = mOriginalMenuItems.get(1);
menu.add(menuItemOrig.getGroupId(), menuItemOrig.getItemId(), menuItemOrig.getOrder(),
menuItemOrig.getTitle());
menuItemOrig.getTitle());
}
} else if (menuItemAddRemoveValue == MenuItemAddRemove.ADD_GRID_AND_SORT) {
if (menu.findItem(R.id.action_switch_view) == null) {
menuItemOrig = mOriginalMenuItems.get(0);
menu.add(menuItemOrig.getGroupId(), menuItemOrig.getItemId(), menuItemOrig.getOrder(),
menuItemOrig.getTitle());
menuItemOrig.getTitle());
}
if (menu.findItem(R.id.action_sort) == null) {
menuItemOrig = mOriginalMenuItems.get(1);
menu.add(menuItemOrig.getGroupId(), menuItemOrig.getItemId(), menuItemOrig.getOrder(),
menuItemOrig.getTitle());
menuItemOrig.getTitle());
}
} else if (menuItemAddRemoveValue == MenuItemAddRemove.REMOVE_SEARCH) {
menu.removeItem(R.id.action_search);
@ -767,19 +768,19 @@ public class OCFileListFragment extends ExtendedListFragment implements
if (menu.findItem(R.id.action_switch_view) == null) {
menuItemOrig = mOriginalMenuItems.get(0);
menu.add(menuItemOrig.getGroupId(), menuItemOrig.getItemId(), menuItemOrig.getOrder(),
menuItemOrig.getTitle());
menuItemOrig.getTitle());
}
if (menu.findItem(R.id.action_sort) == null) {
menuItemOrig = mOriginalMenuItems.get(1);
menu.add(menuItemOrig.getGroupId(), menuItemOrig.getItemId(), menuItemOrig.getOrder(),
menuItemOrig.getTitle());
menuItemOrig.getTitle());
}
if (menu.findItem(R.id.action_search) == null) {
menuItemOrig = mOriginalMenuItems.get(2);
menu.add(menuItemOrig.getGroupId(), menuItemOrig.getItemId(), menuItemOrig.getOrder(),
menuItemOrig.getTitle());
menuItemOrig.getTitle());
}
} else if (menuItemAddRemoveValue == MenuItemAddRemove.REMOVE_SORT) {
menu.removeItem(R.id.action_sort);
@ -789,6 +790,31 @@ public class OCFileListFragment extends ExtendedListFragment implements
menu.removeItem(R.id.action_switch_view);
menu.removeItem(R.id.action_search);
}
// create rich workspace
menu.findItem(R.id.action_create_rich_workspace).setVisible(TextUtils.isEmpty(mFile.getRichWorkspace()));
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (R.id.action_create_rich_workspace == item.getItemId()) {
new Thread(() -> {
RemoteOperationResult result = new RichWorkspaceDirectEditingRemoteOperation(mFile.getRemotePath())
.execute(accountManager.getUser().toPlatformAccount(), requireContext());
if (result.isSuccess()) {
String url = (String) result.getSingleData();
mContainerActivity.getFileOperationsHelper().openRichWorkspaceWithTextEditor(mFile,
url,
requireContext());
} else {
DisplayUtils.showSnackMessage(getView(), "Error");
}
}).start();
return true;
}
return super.onOptionsItemSelected(item);
}
/**

View File

@ -0,0 +1,44 @@
<!--
~
~ Nextcloud Android client application
~
~ @author Tobias Kaminsky
~ Copyright (C) 2020 Tobias Kaminsky
~ Copyright (C) 2020 Nextcloud GmbH
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU Affero General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU Affero General Public License for more details.
~
~ You should have received a copy of the GNU Affero General Public License
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<vector android:autoMirrored="true"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24"
android:width="24dp"
xmlns:android="http://schemas.android.com/apk/res/android">
<path
android:fillColor="#FF000000"
android:pathData="M17,19.22H5V7h7V5H5C3.9,5 3,5.9 3,7v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2v-7h-2V19.22z" />
<path
android:fillColor="#FF000000"
android:pathData="M19,2h-2v3h-3c0.01,0.01 0,2 0,2h3v2.99c0.01,0.01 2,0 2,0V7h3V5h-3V2z" />
<path
android:fillColor="#FF000000"
android:pathData="M7,9h8v2h-8z" />
<path
android:fillColor="#FF000000"
android:pathData="M7,12l0,2l8,0l0,-2l-3,0z" />
<path
android:fillColor="#FF000000"
android:pathData="M7,15h8v2h-8z" />
</vector>

View File

@ -16,19 +16,18 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
android:layout_height="match_parent">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="match_parent">
<TextView
android:id="@+id/text_preview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:padding="@dimen/standard_padding"
android:textIsSelectable="true"
android:visibility="gone"/>
@ -57,7 +56,7 @@
android:layout_marginBottom="@dimen/standard_margin"
android:layout_marginEnd="@dimen/standard_margin"
android:layout_marginRight="@dimen/standard_margin"
android:contentDescription="@string/fab_label"
android:contentDescription="@string/edit_rich_workspace"
android:visibility="gone" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</ScrollView>
</RelativeLayout>

View File

@ -62,6 +62,15 @@
android:title="@string/select_all"
android:contentDescription="@string/select_all"/>
<item
android:id="@+id/action_create_rich_workspace"
android:icon="@drawable/ic_post_add"
android:orderInCategory="2"
app:showAsAction="never"
android:visible="false"
android:title="@string/create_rich_workspace"
android:contentDescription="@string/creates_rich_workspace" />
<!-- <item android:id="@+id/search"
android:title="@string/actionbar_search"
android:icon="@drawable/ic_action_search"></item> -->

View File

@ -908,4 +908,7 @@
<string name="share_internal_link">Share internal link</string>
<string name="action_edit">Edit</string>
<string name="failed_to_start_editor">Failed to start editor</string>
<string name="create_rich_workspace">Add folder info</string>
<string name="creates_rich_workspace">creates folder info</string>
<string name="edit_rich_workspace">edit folder info</string>
</resources>