Merge pull request #9448 from nextcloud/fix/share-open-in

Sharing: better way to send files from file details view
This commit is contained in:
Álvaro Brey 2021-12-15 13:48:42 +01:00 committed by GitHub
commit 508c193dfa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 13 additions and 66 deletions

View file

@ -252,7 +252,6 @@ class FileDetailSharingFragmentIT : AbstractIT() {
waitForIdleSync()
// check if items are visible
onView(ViewMatchers.withId(R.id.menu_share_open_in)).check(matches(not(isDisplayed())))
onView(ViewMatchers.withId(R.id.menu_share_advanced_permissions)).check(matches(isDisplayed()))
onView(ViewMatchers.withId(R.id.menu_share_send_new_email)).check(matches(isDisplayed()))
onView(ViewMatchers.withId(R.id.menu_share_send_link)).check(matches(isDisplayed()))
@ -379,7 +378,6 @@ class FileDetailSharingFragmentIT : AbstractIT() {
waitForIdleSync()
// check if items are visible
onView(ViewMatchers.withId(R.id.menu_share_open_in)).check(matches(isDisplayed()))
onView(ViewMatchers.withId(R.id.menu_share_advanced_permissions)).check(matches(isDisplayed()))
onView(ViewMatchers.withId(R.id.menu_share_send_new_email)).check(matches(isDisplayed()))
onView(ViewMatchers.withId(R.id.menu_share_send_link)).check(matches(isDisplayed()))
@ -495,7 +493,6 @@ class FileDetailSharingFragmentIT : AbstractIT() {
waitForIdleSync()
// check if items are visible
onView(ViewMatchers.withId(R.id.menu_share_open_in)).check(matches(isDisplayed()))
onView(ViewMatchers.withId(R.id.menu_share_advanced_permissions)).check(matches(isDisplayed()))
onView(ViewMatchers.withId(R.id.menu_share_send_new_email)).check(matches(isDisplayed()))
onView(ViewMatchers.withId(R.id.menu_share_send_link)).check(matches(not(isDisplayed())))
@ -621,7 +618,6 @@ class FileDetailSharingFragmentIT : AbstractIT() {
waitForIdleSync()
// check if items are visible
onView(ViewMatchers.withId(R.id.menu_share_open_in)).check(matches(not(isDisplayed())))
onView(ViewMatchers.withId(R.id.menu_share_advanced_permissions)).check(matches(isDisplayed()))
onView(ViewMatchers.withId(R.id.menu_share_send_new_email)).check(matches(isDisplayed()))
onView(ViewMatchers.withId(R.id.menu_share_send_link)).check(matches(not(isDisplayed())))

View file

@ -193,7 +193,7 @@ public class FileMenuFilter {
filterCancelSync(toShow, toHide, synchronizing);
filterSync(toShow, toHide, synchronizing);
filterShareFile(toShow, toHide, capability);
filterSendFiles(toShow, toHide);
filterSendFiles(toShow, toHide, inSingleFileFragment);
filterDetails(toShow, toHide);
filterFavorite(toShow, toHide, synchronizing);
filterUnfavorite(toShow, toHide, synchronizing);
@ -213,12 +213,18 @@ public class FileMenuFilter {
}
}
private void filterSendFiles(List<Integer> toShow, List<Integer> toHide) {
if (containsEncryptedFile() || isSingleSelection() || overflowMenu || !anyFileDown() ||
SEND_OFF.equalsIgnoreCase(context.getString(R.string.send_files_to_other_apps))) {
toHide.add(R.id.action_send_file);
} else {
private void filterSendFiles(List<Integer> toShow, List<Integer> toHide, boolean inSingleFileFragment) {
boolean show = true;
if (containsEncryptedFile() || overflowMenu || SEND_OFF.equalsIgnoreCase(context.getString(R.string.send_files_to_other_apps))) {
show = false;
}
if (!inSingleFileFragment && (isSingleSelection() || !anyFileDown())) {
show = false;
}
if (show) {
toShow.add(R.id.action_send_file);
} else {
toHide.add(R.id.action_send_file);
}
}

View file

@ -462,11 +462,6 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda
return file;
}
@Override
public void openIn(OCShare share) {
fileOperationsHelper.sendShareFile(file);
}
@Override
public void advancedPermissions(OCShare share) {
modifyExistingShare(share, FileDetailsSharingProcessFragment.SCREEN_TYPE_PERMISSION);

View file

@ -69,12 +69,6 @@ public class FileDetailSharingMenuBottomSheetDialog extends BottomSheetDialog {
}
private void updateUI() {
if (ocShare.isFolder()) {
binding.menuShareOpenIn.setVisibility(View.GONE);
} else {
binding.menuShareOpenIn.setVisibility(View.VISIBLE);
}
if (ocShare.getShareType() == ShareType.PUBLIC_LINK) {
binding.menuShareAddAnotherLink.setVisibility(View.VISIBLE);
binding.menuShareSendLink.setVisibility(View.VISIBLE);
@ -85,11 +79,6 @@ public class FileDetailSharingMenuBottomSheetDialog extends BottomSheetDialog {
}
private void setupClickListener() {
binding.menuShareOpenIn.setOnClickListener(v -> {
actions.openIn(ocShare);
dismiss();
});
binding.menuShareAdvancedPermissions.setOnClickListener(v -> {
actions.advancedPermissions(ocShare);
dismiss();

View file

@ -29,10 +29,6 @@ import com.owncloud.android.lib.resources.shares.ShareType;
* Actions interface to be implemented by any class that makes use of {@link FileDetailSharingMenuBottomSheetDialog}.
*/
public interface FileDetailsSharingMenuBottomSheetActions {
/**
* open sharing options only applicable for files
*/
void openIn(OCShare share);
/**
* open advanced permission for selected share

View file

@ -25,41 +25,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/bg_default"
android:paddingTop="@dimen/standard_padding">
<LinearLayout
android:id="@+id/menu_share_open_in"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/minimum_size_for_touchable_area"
android:background="?android:attr/selectableItemBackground"
android:orientation="horizontal"
android:paddingLeft="@dimen/standard_padding"
android:paddingTop="@dimen/standard_half_padding"
android:paddingRight="@dimen/standard_padding"
android:paddingBottom="@dimen/standard_half_padding"
tools:ignore="UseCompoundDrawables">
<ImageView
android:id="@+id/menu_icon_open_in"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:contentDescription="@null"
android:src="@drawable/ic_content_copy"
app:tint="@color/primary" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/standard_margin"
android:text="@string/share_open_in"
android:textColor="@color/text_color"
android:textSize="@dimen/bottom_sheet_text_size" />
</LinearLayout>
android:background="@color/bg_default">
<LinearLayout
android:id="@+id/menu_share_advanced_permissions"

View file

@ -974,7 +974,6 @@
<string name="no_share_permission_selected">Please select at least one permission to share.</string>
<string name="share_copy_link">Share &amp; Copy Link</string>
<string name="set_note">Set Note</string>
<string name="share_open_in">Open in…</string>
<string name="share_send_new_email">Send new email</string>
<string name="link_name">Link Name</string>
<string name="delete_link">Delete Link</string>