Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions drawable_resources/post_add.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion scripts/analysis/lint-results.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
DO NOT TOUCH; GENERATED BY DRONE
<span class="mdl-layout-title">Lint Report: 74 warnings</span>
<span class="mdl-layout-title">Lint Report: 76 warnings</span>
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ private void downloadFile(Uri url) {
}

@Override
protected void loadUrl(String url) {
public void loadUrl(String url) {
if (TextUtils.isEmpty(url)) {
new RichDocumentsLoadUrlTask(this, getUser().get(), getFile()).execute();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
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;
Expand Down Expand Up @@ -746,40 +747,40 @@ public void onPrepareOptionsMenu(@NonNull Menu menu) {
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);
} else if (menuItemAddRemoveValue == MenuItemAddRemove.ADD_GRID_AND_SORT_WITH_SEARCH) {
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);
Expand All @@ -789,6 +790,33 @@ public void onPrepareOptionsMenu(@NonNull Menu menu) {
menu.removeItem(R.id.action_switch_view);
menu.removeItem(R.id.action_search);
}

// create rich workspace
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
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(), R.string.failed_to_start_editor);
}
}).start();
return true;
}

return super.onOptionsItemSelected(item);
}

/**
Expand Down
44 changes: 44 additions & 0 deletions src/main/res/drawable/ic_post_add.xml
Original file line number Diff line number Diff line change
@@ -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>
78 changes: 42 additions & 36 deletions src/main/res/layout/text_file_preview.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,48 +16,54 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.

-->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<androidx.coordinatorlayout.widget.CoordinatorLayout
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="match_parent">

<TextView
android:id="@+id/text_preview"
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/standard_padding"
android:textIsSelectable="true"
android:visibility="gone"/>
android:layout_height="wrap_content">

<RelativeLayout
android:id="@+id/multi_view"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/text_preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/standard_padding"
android:textIsSelectable="true"
android:visibility="gone" />

<ScrollView
<RelativeLayout
android:id="@+id/multi_view"
android:layout_width="match_parent"
android:layout_height="match_parent">

<include layout="@layout/empty_list"/>

</ScrollView>
</RelativeLayout>

<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/text_preview_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="@dimen/standard_margin"
android:layout_marginEnd="@dimen/standard_margin"
android:layout_marginRight="@dimen/standard_margin"
android:contentDescription="@string/fab_label"
android:visibility="gone" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</ScrollView>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">

<include layout="@layout/empty_list" />

</ScrollView>
</RelativeLayout>

</androidx.coordinatorlayout.widget.CoordinatorLayout>
</ScrollView>

<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/text_preview_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_gravity="end|bottom"
android:layout_marginEnd="@dimen/standard_margin"
android:layout_marginRight="@dimen/standard_margin"
android:layout_marginBottom="@dimen/standard_margin"
android:contentDescription="@string/edit_rich_workspace"
android:visibility="gone" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>
9 changes: 9 additions & 0 deletions src/main/res/menu/activity_file_display.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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> -->
Expand Down
3 changes: 3 additions & 0 deletions src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>