diff --git a/app/src/androidTest/java/com/nmc/android/ui/FileSharingIT.kt b/app/src/androidTest/java/com/nmc/android/ui/FileSharingIT.kt index f99082077f00..cae2c77087d4 100644 --- a/app/src/androidTest/java/com/nmc/android/ui/FileSharingIT.kt +++ b/app/src/androidTest/java/com/nmc/android/ui/FileSharingIT.kt @@ -8,6 +8,7 @@ import androidx.test.espresso.contrib.RecyclerViewActions import androidx.test.espresso.contrib.RecyclerViewActions.actionOnItemAtPosition import androidx.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed import androidx.test.espresso.matcher.ViewMatchers.isDisplayed +import androidx.test.espresso.matcher.ViewMatchers.isEnabled import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.ext.junit.rules.ActivityScenarioRule @@ -21,7 +22,6 @@ import com.owncloud.android.datamodel.OCFile import com.owncloud.android.lib.resources.shares.OCShare import com.owncloud.android.lib.resources.shares.ShareType import com.owncloud.android.ui.fragment.FileDetailFragment -import com.owncloud.android.ui.fragment.FileDetailSharingFragment import com.owncloud.android.ui.fragment.util.SharingMenuHelper import org.hamcrest.Matchers.not import org.junit.After @@ -70,15 +70,6 @@ class FileSharingIT : AbstractIT() { shortSleep() } - private fun getFragment(): FileDetailSharingFragment? { - var fragment: FileDetailSharingFragment? = null - activityScenarioRule.scenario.onActivity { - fragment = - it.supportFragmentManager.findFragmentByTag("SHARING_DETAILS_FRAGMENT") as FileDetailSharingFragment - } - return fragment - } - @Test fun validateUiOfFileDetailFragment() { show(file) @@ -91,25 +82,41 @@ class FileSharingIT : AbstractIT() { onView(withId(R.id.last_modification_timestamp)).check(matches(isCompletelyDisplayed())) } - @Test - fun validateUiForEmptyShares() { - show(file) + private fun validateCommonUI() { + onView(withId(R.id.sharing_heading_title)).check(matches(isCompletelyDisplayed())) + onView(withId(R.id.sharing_heading_title)).check(matches(withText("Send link by mail"))) - onView(withId(R.id.shared_with_you_container)).check(matches(not(isCompletelyDisplayed()))) - onView(withId(R.id.tv_sharing_details_message)).check(matches(isCompletelyDisplayed())) - onView(withId(R.id.tv_sharing_details_message)).check(matches(withText("You can create links or send shares by mail. If you invite MagentaCLOUD users, you have more opportunities for collaboration."))) onView(withId(R.id.searchView)).check(matches(isCompletelyDisplayed())) + onView(withId(R.id.searchView)).check(matches(isEnabled())) onView(withId(R.id.pick_contact_email_btn)).check(matches(isCompletelyDisplayed())) - onView(withId(R.id.label_personal_share)).check(matches(isCompletelyDisplayed())) - onView(withId(R.id.label_personal_share)).check(matches(withText("Personal share by mail"))) + onView(withId(R.id.pick_contact_email_btn)).check(matches(isEnabled())) + + onView(withId(R.id.or_section_layout)).check(matches(isCompletelyDisplayed())) + + onView(withId(R.id.link_share_section_heading)).check(matches(isCompletelyDisplayed())) + onView(withId(R.id.link_share_section_heading)).check(matches(withText("Copy link"))) onView(withId(R.id.share_create_new_link)).check(matches(isCompletelyDisplayed())) - onView(withId(R.id.share_create_new_link)).check(matches(withText("Create Link"))) + onView(withId(R.id.share_create_new_link)).check(matches(withText("Create new link"))) + + onView(withId(R.id.shared_with_divider)).check(matches(isCompletelyDisplayed())) + + onView(withId(R.id.tv_your_shares)).check(matches(isCompletelyDisplayed())) + onView(withId(R.id.tv_your_shares)).check(matches(withText("Shared with"))) + } + + @Test + fun validateUiForEmptyShares() { + show(file) + + validateCommonUI() + + onView(withId(R.id.linkSharesList)).check(matches(not(isDisplayed()))) - onView(withId(R.id.tv_your_shares)).check(matches(not(isDisplayed()))) onView(withId(R.id.sharesList)).check(matches(not(isDisplayed()))) + onView(withId(R.id.tv_empty_shares)).check(matches(isCompletelyDisplayed())) - onView(withId(R.id.tv_empty_shares)).check(matches(withText("No shares created yet."))) + onView(withId(R.id.tv_empty_shares)).check(matches(withText("You have not yet shared your file/folder. Share to give others access."))) } @Test @@ -152,19 +159,9 @@ class FileSharingIT : AbstractIT() { } show(file) - onView(withId(R.id.shared_with_you_container)).check(matches(not(isCompletelyDisplayed()))) - onView(withId(R.id.tv_sharing_details_message)).check(matches(isCompletelyDisplayed())) - onView(withId(R.id.tv_sharing_details_message)).check(matches(withText("You can create links or send shares by mail. If you invite MagentaCLOUD users, you have more opportunities for collaboration."))) - onView(withId(R.id.searchView)).check(matches(isCompletelyDisplayed())) - onView(withId(R.id.pick_contact_email_btn)).check(matches(isCompletelyDisplayed())) - onView(withId(R.id.label_personal_share)).check(matches(isCompletelyDisplayed())) - onView(withId(R.id.label_personal_share)).check(matches(withText("Personal share by mail"))) + validateCommonUI() - onView(withId(R.id.share_create_new_link)).check(matches(isCompletelyDisplayed())) - onView(withId(R.id.share_create_new_link)).check(matches(withText("Create Link"))) - - onView(withId(R.id.tv_your_shares)).check(matches(isCompletelyDisplayed())) - onView(withId(R.id.tv_your_shares)).check(matches(withText("Your Shares"))) + onView(withId(R.id.linkSharesList)).check(matches(isCompletelyDisplayed())) onView(withId(R.id.sharesList)).check(matches(isCompletelyDisplayed())) onView(withId(R.id.tv_empty_shares)).check(matches(not(isDisplayed()))) } @@ -179,17 +176,22 @@ class FileSharingIT : AbstractIT() { } show(file) - onView(withId(R.id.shared_with_you_container)).check(matches(isCompletelyDisplayed())) - onView(withId(R.id.tv_sharing_details_message)).check(matches(isCompletelyDisplayed())) - onView(withId(R.id.tv_sharing_details_message)).check(matches(withText("Resharing is not allowed."))) - onView(withId(R.id.shared_with_you_username)).check(matches(withText("Shared with you by John Doe"))) - onView(withId(R.id.shared_with_you_note)).check(matches(withText("Shared for testing purpose."))) - onView(withId(R.id.shared_with_you_avatar)).check(matches(isCompletelyDisplayed())) + onView(withId(R.id.tv_resharing_info)).check(matches(isCompletelyDisplayed())) + onView(withId(R.id.tv_resharing_info)).check(matches(withText("This file / folder was shared with you by John Doe"))) + + onView(withId(R.id.tv_resharing_status)).check(matches(isCompletelyDisplayed())) + onView(withId(R.id.tv_resharing_status)).check(matches(withText("Resharing is not allowed."))) - onView(withId(R.id.searchView)).check(matches(not(isDisplayed()))) - onView(withId(R.id.pick_contact_email_btn)).check(matches(not(isDisplayed()))) - onView(withId(R.id.label_personal_share)).check(matches(not(isDisplayed()))) + onView(withId(R.id.searchView)).check(matches(isCompletelyDisplayed())) + onView(withId(R.id.searchView)).check(matches(not(isEnabled()))) + onView(withId(R.id.pick_contact_email_btn)).check(matches(isCompletelyDisplayed())) + onView(withId(R.id.pick_contact_email_btn)).check(matches(not(isEnabled()))) + + onView(withId(R.id.or_section_layout)).check(matches(not(isDisplayed()))) + onView(withId(R.id.link_share_section_heading)).check(matches(not(isDisplayed()))) + onView(withId(R.id.linkSharesList)).check(matches(not(isDisplayed()))) onView(withId(R.id.share_create_new_link)).check(matches(not(isDisplayed()))) + onView(withId(R.id.shared_with_divider)).check(matches(not(isDisplayed()))) onView(withId(R.id.tv_your_shares)).check(matches(not(isDisplayed()))) onView(withId(R.id.sharesList)).check(matches(not(isDisplayed()))) onView(withId(R.id.tv_empty_shares)).check(matches(not(isDisplayed()))) @@ -203,21 +205,18 @@ class FileSharingIT : AbstractIT() { } show(file) - onView(withId(R.id.shared_with_you_container)).check(matches(isCompletelyDisplayed())) - onView(withId(R.id.tv_sharing_details_message)).check(matches(isCompletelyDisplayed())) - onView(withId(R.id.tv_sharing_details_message)).check(matches(withText("Resharing is allowed. You can create links or send shares by mail. If you invite MagentaCLOUD users, you have more opportunities for collaboration."))) - onView(withId(R.id.shared_with_you_username)).check(matches(withText("Shared with you by John Doe"))) - onView(withId(R.id.shared_with_you_avatar)).check(matches(isCompletelyDisplayed())) - onView(withId(R.id.shared_with_you_note_container)).check(matches(not(isDisplayed()))) + validateCommonUI() - onView(withId(R.id.searchView)).check(matches(isCompletelyDisplayed())) - onView(withId(R.id.pick_contact_email_btn)).check(matches(isCompletelyDisplayed())) - onView(withId(R.id.label_personal_share)).check(matches(isCompletelyDisplayed())) - onView(withId(R.id.share_create_new_link)).check(matches(isCompletelyDisplayed())) - onView(withId(R.id.tv_your_shares)).check(matches(not(isDisplayed()))) + onView(withId(R.id.tv_resharing_info)).check(matches(isCompletelyDisplayed())) + onView(withId(R.id.tv_resharing_info)).check(matches(withText("This file / folder was shared with you by John Doe"))) + + onView(withId(R.id.tv_resharing_status)).check(matches(isCompletelyDisplayed())) + onView(withId(R.id.tv_resharing_status)).check(matches(withText("Resharing is allowed."))) + + onView(withId(R.id.linkSharesList)).check(matches(not(isDisplayed()))) onView(withId(R.id.sharesList)).check(matches(not(isDisplayed()))) onView(withId(R.id.tv_empty_shares)).check(matches(isCompletelyDisplayed())) - onView(withId(R.id.tv_empty_shares)).check(matches(withText("No shares created yet."))) + onView(withId(R.id.tv_empty_shares)).check(matches(withText("You have not yet shared your file/folder. Share to give others access."))) } @Test diff --git a/app/src/main/java/com/nmc/android/utils/SearchViewThemeUtils.kt b/app/src/main/java/com/nmc/android/utils/SearchViewThemeUtils.kt index dc2267f10164..4bd092e97633 100644 --- a/app/src/main/java/com/nmc/android/utils/SearchViewThemeUtils.kt +++ b/app/src/main/java/com/nmc/android/utils/SearchViewThemeUtils.kt @@ -2,13 +2,14 @@ package com.nmc.android.utils import android.content.Context import android.widget.ImageView +import androidx.appcompat.widget.AppCompatAutoCompleteTextView import androidx.appcompat.widget.SearchView import com.owncloud.android.R object SearchViewThemeUtils { fun themeSearchView(context: Context, searchView: SearchView) { val fontColor = context.resources.getColor(R.color.fontAppbar, null) - val editText: SearchView.SearchAutoComplete = searchView.findViewById(R.id.search_src_text) + val editText: AppCompatAutoCompleteTextView = searchView.findViewById(R.id.search_src_text) editText.textSize = 16F editText.setTextColor(fontColor) editText.highlightColor = context.resources.getColor(R.color.et_highlight_color, null) diff --git a/app/src/main/java/com/owncloud/android/providers/UsersAndGroupsSearchProvider.java b/app/src/main/java/com/owncloud/android/providers/UsersAndGroupsSearchProvider.java index ce05d4363a30..a8ad045a4cd5 100644 --- a/app/src/main/java/com/owncloud/android/providers/UsersAndGroupsSearchProvider.java +++ b/app/src/main/java/com/owncloud/android/providers/UsersAndGroupsSearchProvider.java @@ -81,7 +81,7 @@ public class UsersAndGroupsSearchProvider extends ContentProvider { BaseColumns._ID, SearchManager.SUGGEST_COLUMN_TEXT_1, SearchManager.SUGGEST_COLUMN_TEXT_2, - SearchManager.SUGGEST_COLUMN_ICON_1, + // SearchManager.SUGGEST_COLUMN_ICON_1, SearchManager.SUGGEST_COLUMN_INTENT_DATA }; @@ -350,14 +350,14 @@ private Cursor searchForUsersOrGroups(Uri uri) { .add(count++) // BaseColumns._ID .add(subline) // SearchManager.SUGGEST_COLUMN_TEXT_1 .add(displayName) // SearchManager.SUGGEST_COLUMN_TEXT_2 - .add(icon) // SearchManager.SUGGEST_COLUMN_ICON_1 + //.add(icon) // SearchManager.SUGGEST_COLUMN_ICON_1 .add(dataUri); } else { response.newRow() .add(count++) // BaseColumns._ID .add(displayName) // SearchManager.SUGGEST_COLUMN_TEXT_1 .add(subline) // SearchManager.SUGGEST_COLUMN_TEXT_2 - .add(icon) // SearchManager.SUGGEST_COLUMN_ICON_1 + //.add(icon) // SearchManager.SUGGEST_COLUMN_ICON_1 .add(dataUri); } } diff --git a/app/src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java index 02aa7a322702..0e56749caa79 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java @@ -65,7 +65,6 @@ public abstract class ToolbarActivity extends BaseActivity implements Injectable private TextView mInfoBoxMessage; protected AppCompatSpinner mToolbarSpinner; private boolean isHomeSearchToolbarShow = false; - private ImageView mToolbarBackIcon; @Inject public ThemeColorUtils themeColorUtils; @Inject public ThemeUtils themeUtils; @@ -84,7 +83,6 @@ private void setupToolbar(boolean isHomeSearchToolbarShow, boolean showSortListB mHomeSearchToolbar = findViewById(R.id.home_toolbar); mMenuButton = findViewById(R.id.menu_button); mSearchText = findViewById(R.id.search_text); - mToolbarBackIcon = findViewById(R.id.toolbar_back_icon); mSwitchAccountButton = findViewById(R.id.switch_account_button); mNotificationButton = findViewById(R.id.notification_button); @@ -107,8 +105,6 @@ private void setupToolbar(boolean isHomeSearchToolbarShow, boolean showSortListB viewThemeUtils.material.colorToolbarOverflowIcon(mToolbar); viewThemeUtils.platform.themeStatusBar(this); viewThemeUtils.material.colorMaterialTextButton(mSwitchAccountButton); - - mToolbarBackIcon.setOnClickListener(v -> onBackPressed()); } public void setupToolbarShowOnlyMenuButtonAndTitle(String title, View.OnClickListener toggleDrawer) { @@ -272,20 +268,10 @@ public boolean sortListGroupVisibility(){ public void setPreviewImageBitmap(Bitmap bitmap) { if (mPreviewImage != null) { mPreviewImage.setImageBitmap(bitmap); - resetPreviewImageConfiguration(); setPreviewImageVisibility(true); } } - /** - * reset preview image configuration if required the scale type and padding are changing in sharing screen so to - * reset it call this method - */ - private void resetPreviewImageConfiguration() { - mPreviewImage.setScaleType(ImageView.ScaleType.CENTER_CROP); - mPreviewImage.setPadding(0, 0, 0, 0); - } - /** * Change the drawable for the toolbar's preview image. * @@ -294,35 +280,10 @@ private void resetPreviewImageConfiguration() { public void setPreviewImageDrawable(Drawable drawable) { if (mPreviewImage != null) { mPreviewImage.setImageDrawable(drawable); - resetPreviewImageConfiguration(); setPreviewImageVisibility(true); } } - /** - * method to show/hide the toolbar custom back icon currently this is only showing for sharing details screen for - * thumbnail images - * - * @param show - */ - public void showToolbarBackImage(boolean show) { - if (mToolbarBackIcon == null) { - return; - } - ActionBar actionBar = getSupportActionBar(); - if (show) { - mToolbarBackIcon.setVisibility(View.VISIBLE); - if (actionBar != null) { - actionBar.setDisplayHomeAsUpEnabled(false); - } - } else { - mToolbarBackIcon.setVisibility(View.GONE); - if (actionBar != null) { - actionBar.setDisplayHomeAsUpEnabled(true); - } - } - } - /** * get the toolbar's preview image view. */ @@ -334,15 +295,6 @@ public FrameLayout getPreviewImageContainer() { return mPreviewImageContainer; } - /** - * method will expand the toolbar using app bar if its hidden due to scrolling - */ - public void expandToolbar() { - if (mAppBar != null) { - mAppBar.setExpanded(true, true); - } - } - public void updateToolbarSubtitle(@NonNull String subtitle) { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { diff --git a/app/src/main/java/com/owncloud/android/ui/adapter/LinkShareViewHolder.java b/app/src/main/java/com/owncloud/android/ui/adapter/LinkShareViewHolder.java index c3c841e2c678..900b174524a9 100644 --- a/app/src/main/java/com/owncloud/android/ui/adapter/LinkShareViewHolder.java +++ b/app/src/main/java/com/owncloud/android/ui/adapter/LinkShareViewHolder.java @@ -15,7 +15,6 @@ package com.owncloud.android.ui.adapter; import android.content.Context; -import android.content.res.ColorStateList; import android.text.TextUtils; import android.view.View; @@ -29,7 +28,6 @@ import androidx.annotation.NonNull; import androidx.core.content.res.ResourcesCompat; -import androidx.core.widget.TextViewCompat; import androidx.recyclerview.widget.RecyclerView; class LinkShareViewHolder extends RecyclerView.ViewHolder { @@ -59,7 +57,9 @@ public void bind(OCShare publicShare, ShareeListAdapterListener listener) { binding.icon.setImageDrawable(ResourcesCompat.getDrawable(context.getResources(), R.drawable.ic_external_share, null)); + binding.overflowMenu.setVisibility(View.VISIBLE); binding.copyLink.setVisibility(View.GONE); + binding.detailText.setVisibility(View.GONE); } else { if (!TextUtils.isEmpty(publicShare.getLabel())) { String text = String.format(context.getString(R.string.share_link_with_label), publicShare.getLabel()); @@ -72,41 +72,56 @@ public void bind(OCShare publicShare, ShareeListAdapterListener listener) { } } + binding.overflowMenu.setVisibility(View.GONE); + binding.copyLink.setVisibility(View.VISIBLE); + binding.detailText.setVisibility(View.VISIBLE); + } String permissionName = SharingMenuHelper.getPermissionName(context, publicShare); setPermissionName(publicShare, permissionName, listener); + showHideCalendarIcon(publicShare.getExpirationDate()); + showHidePasswordIcon(publicShare.isPasswordProtected()); binding.overflowMenu.setOnClickListener(v -> listener.showSharingMenuActionSheet(publicShare)); + binding.detailText.setOnClickListener(v -> listener.showSharingMenuActionSheet(publicShare)); + binding.copyLink.setOnClickListener(v -> listener.copyLink(publicShare)); } private void setPermissionName(OCShare publicShare, String permissionName, ShareeListAdapterListener listener) { - ColorStateList colorStateList = new ColorStateList( - new int[][]{ - new int[]{-android.R.attr.state_enabled}, - new int[]{android.R.attr.state_enabled}, - }, - new int[]{ - ResourcesCompat.getColor(context.getResources(), R.color.share_disabled_txt_color, - null), - ResourcesCompat.getColor(context.getResources(), R.color.primary, - null) - } - ); - TextViewCompat.setCompoundDrawableTintList(binding.permissionName, colorStateList); - binding.permissionName.setTextColor(colorStateList); - if (!TextUtils.isEmpty(permissionName) && !SharingMenuHelper.isSecureFileDrop(publicShare)) { - if (permissionName.equalsIgnoreCase(context.getResources().getString(R.string.share_permission_read_only)) && !isTextFile) { - binding.permissionName.setEnabled(false); - } else { - binding.permissionName.setEnabled(true); - binding.shareByLinkContainer.setOnClickListener(v -> listener.showPermissionsDialog(publicShare)); - } - binding.permissionName.setText(permissionName); - binding.permissionName.setVisibility(View.VISIBLE); + binding.shareByLinkContainer.setOnClickListener(v -> listener.showPermissionsDialog(publicShare)); + binding.quickPermissionLayout.permissionName.setText(permissionName); + + setPermissionTypeIcon(permissionName); + + binding.quickPermissionLayout.permissionLayout.setVisibility(View.VISIBLE); + } else { + binding.quickPermissionLayout.permissionLayout.setVisibility(View.GONE); + } + } + + private void showHideCalendarIcon(long expirationDate) { + binding.quickPermissionLayout.calendarPermissionIcon.setVisibility(expirationDate > 0 ? View.VISIBLE : View.GONE); + } + + private void showHidePasswordIcon(boolean isPasswordProtected) { + binding.quickPermissionLayout.passwordPermissionIcon.setVisibility(isPasswordProtected ? View.VISIBLE : View.GONE); + } + + private void setPermissionTypeIcon(String permissionName) { + if (permissionName.equalsIgnoreCase(context.getResources().getString(R.string.share_quick_permission_can_edit))) { + binding.quickPermissionLayout.permissionTypeIcon.setImageResource(R.drawable.ic_sharing_edit); + binding.quickPermissionLayout.permissionTypeIcon.setVisibility(View.VISIBLE); + } else if (permissionName.equalsIgnoreCase(context.getResources().getString(R.string.share_quick_permission_can_view))) { + binding.quickPermissionLayout.permissionTypeIcon.setImageResource(R.drawable.ic_sharing_read_only); + binding.quickPermissionLayout.permissionTypeIcon.setVisibility(View.VISIBLE); + } else if (permissionName.equalsIgnoreCase(context.getResources().getString(R.string.share_permission_secure_file_drop)) + || permissionName.equalsIgnoreCase(context.getResources().getString(R.string.share_quick_permission_can_upload))) { + binding.quickPermissionLayout.permissionTypeIcon.setImageResource(R.drawable.ic_sharing_file_drop); + binding.quickPermissionLayout.permissionTypeIcon.setVisibility(View.VISIBLE); } else { - binding.permissionName.setVisibility(View.GONE); + binding.quickPermissionLayout.permissionTypeIcon.setVisibility(View.GONE); } } } diff --git a/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListDelegate.kt b/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListDelegate.kt index 9a1054973d23..8230da2b2957 100644 --- a/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListDelegate.kt +++ b/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListDelegate.kt @@ -387,7 +387,7 @@ class OCFileListDelegate( context.resources, R.color.shared_with_me_color, null ) - val shareWithMeIcon = AppCompatResources.getDrawable(context, R.drawable.ic_shared_with_me) + val shareWithMeIcon = AppCompatResources.getDrawable(context, R.drawable.ic_shared_with_me)?.mutate() val shareWithMeTintedIcon = viewThemeUtils.platform.colorDrawable(shareWithMeIcon!!, sharedWithMeColor) sharedIconView.setImageDrawable(shareWithMeTintedIcon) @@ -398,7 +398,7 @@ class OCFileListDelegate( } file.isSharedWithSharee -> { val shareIcon = viewThemeUtils.platform.colorDrawable( - AppCompatResources.getDrawable(context, R.drawable.ic_shared)!!, + AppCompatResources.getDrawable(context, R.drawable.ic_share)?.mutate()!!, context.resources.getColor(R.color.primary, null) ) sharedIconView.setImageDrawable(shareIcon) @@ -409,7 +409,7 @@ class OCFileListDelegate( } file.isSharedViaLink -> { val shareIcon = viewThemeUtils.platform.colorDrawable( - AppCompatResources.getDrawable(context, R.drawable.ic_shared)!!, + AppCompatResources.getDrawable(context, R.drawable.ic_share)?.mutate()!!, context.resources.getColor(R.color.primary, null) ) sharedIconView.setImageDrawable(shareIcon) @@ -426,7 +426,7 @@ class OCFileListDelegate( context.resources, R.color.list_icon_color, null ) - val unShareIcon = AppCompatResources.getDrawable(context, R.drawable.ic_unshared) + val unShareIcon = AppCompatResources.getDrawable(context, R.drawable.ic_share)?.mutate() val unShareTintedIcon = viewThemeUtils.platform.colorDrawable(unShareIcon!!, unShareIconColor) sharedIconView.setImageDrawable(unShareTintedIcon) sharedIconView.contentDescription = context.getString(R.string.shared_icon_share) diff --git a/app/src/main/java/com/owncloud/android/ui/adapter/ShareViewHolder.java b/app/src/main/java/com/owncloud/android/ui/adapter/ShareViewHolder.java index dd31e4745c3b..3b960c4898ea 100644 --- a/app/src/main/java/com/owncloud/android/ui/adapter/ShareViewHolder.java +++ b/app/src/main/java/com/owncloud/android/ui/adapter/ShareViewHolder.java @@ -91,20 +91,22 @@ public void bind(OCShare share, context);*/ // Not required for NMC as per NMC-3097 - // binding.icon.setOnClickListener(v -> listener.showProfileBottomSheet(user, share.getShareWith())); + // binding.icon.setOnClickListener(v -> listener.showProfileBottomSheet(user, share.getShareWith())); default: //setImage(binding.icon, name, R.drawable.ic_user); break; } binding.name.setText(name); - binding.icon.setImageResource(R.drawable.ic_internal_share); + // binding.icon.setImageResource(R.drawable.ic_internal_share); if (share.getShareWith().equalsIgnoreCase(userId) || share.getUserId().equalsIgnoreCase(userId)) { binding.overflowMenu.setVisibility(View.VISIBLE); String permissionName = SharingMenuHelper.getPermissionName(context, share); setPermissionName(permissionName); + showHideCalendarIcon(share.getExpirationDate()); + showHidePasswordIcon(share.isPasswordProtected()); // bind listener to edit privileges binding.overflowMenu.setOnClickListener(v -> listener.showSharingMenuActionSheet(share)); @@ -116,13 +118,40 @@ public void bind(OCShare share, private void setPermissionName(String permissionName) { if (!TextUtils.isEmpty(permissionName)) { - binding.permissionName.setText(permissionName); - binding.permissionName.setVisibility(View.VISIBLE); + binding.quickPermissionLayout.permissionName.setText(permissionName); + + setPermissionTypeIcon(permissionName); + + binding.quickPermissionLayout.permissionLayout.setVisibility(View.VISIBLE); + } else { + binding.quickPermissionLayout.permissionLayout.setVisibility(View.GONE); + } + } + + private void setPermissionTypeIcon(String permissionName) { + if (permissionName.equalsIgnoreCase(context.getResources().getString(R.string.share_quick_permission_can_edit))) { + binding.quickPermissionLayout.permissionTypeIcon.setImageResource(R.drawable.ic_sharing_edit); + binding.quickPermissionLayout.permissionTypeIcon.setVisibility(View.VISIBLE); + } else if (permissionName.equalsIgnoreCase(context.getResources().getString(R.string.share_quick_permission_can_view))) { + binding.quickPermissionLayout.permissionTypeIcon.setImageResource(R.drawable.ic_sharing_read_only); + binding.quickPermissionLayout.permissionTypeIcon.setVisibility(View.VISIBLE); + } else if (permissionName.equalsIgnoreCase(context.getResources().getString(R.string.share_permission_secure_file_drop)) + || permissionName.equalsIgnoreCase(context.getResources().getString(R.string.share_quick_permission_can_upload))) { + binding.quickPermissionLayout.permissionTypeIcon.setImageResource(R.drawable.ic_sharing_file_drop); + binding.quickPermissionLayout.permissionTypeIcon.setVisibility(View.VISIBLE); } else { - binding.permissionName.setVisibility(View.GONE); + binding.quickPermissionLayout.permissionTypeIcon.setVisibility(View.GONE); } } + private void showHideCalendarIcon(long expirationDate) { + binding.quickPermissionLayout.calendarPermissionIcon.setVisibility(expirationDate > 0 ? View.VISIBLE : View.GONE); + } + + private void showHidePasswordIcon(boolean isPasswordProtected) { + binding.quickPermissionLayout.passwordPermissionIcon.setVisibility(isPasswordProtected ? View.VISIBLE : View.GONE); + } + private void setImage(ImageView avatar, String name, @DrawableRes int fallback) { try { avatar.setImageDrawable(TextDrawable.createNamedAvatar(name, avatarRadiusDimension)); diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java index ae1353d61704..99dad73d5d0a 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java @@ -13,14 +13,12 @@ import android.content.res.ColorStateList; import android.graphics.Bitmap; import android.graphics.PorterDuff; -import android.graphics.drawable.Drawable; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; -import android.widget.ImageView; import android.widget.ProgressBar; import com.google.android.material.chip.Chip; @@ -34,8 +32,8 @@ import com.nextcloud.client.network.ClientFactory; import com.nextcloud.client.network.ConnectivityService; import com.nextcloud.client.preferences.AppPreferences; -import com.nextcloud.utils.EditorUtils; import com.nextcloud.ui.fileactions.FileActionsBottomSheet; +import com.nextcloud.utils.EditorUtils; import com.nextcloud.utils.MenuUtils; import com.nextcloud.utils.extensions.BundleExtensionsKt; import com.nextcloud.utils.extensions.FileExtensionsKt; @@ -79,7 +77,6 @@ import androidx.annotation.IdRes; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.core.content.ContextCompat; import androidx.core.content.res.ResourcesCompat; import androidx.fragment.app.FragmentManager; @@ -100,10 +97,6 @@ public class FileDetailFragment extends FileFragment implements OnClickListener, private User user; private OCFile parentFolder; private boolean previewLoaded; - /** - * variable to check if custom back icon on toolbar has to be shown - */ - private boolean isCustomBackIcon; private FileDetailsFragmentBinding binding; private ProgressListener progressListener; @@ -235,11 +228,6 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, return null; } - FloatingActionButton fabMain = requireActivity().findViewById(R.id.fab_main); - if (fabMain != null) { - fabMain.hide(); - } - if (getFile().getTags().isEmpty()) { binding.tagsGroup.setVisibility(View.GONE); } else { @@ -334,18 +322,10 @@ public void onResume() { if (previewLoaded) { toolbarActivity.setPreviewImageVisibility(true); } - showHideCustomBackButton(); } } - //show custom back button for image previews - private void showHideCustomBackButton() { - if (toolbarActivity != null) { - toolbarActivity.showToolbarBackImage(isCustomBackIcon); - } - } - @Override public void onPause() { super.onPause(); @@ -357,7 +337,6 @@ public void onStop() { if (toolbarActivity != null) { toolbarActivity.hidePreviewImage(); - toolbarActivity.showToolbarBackImage(false); } EventBus.getDefault().unregister(this); @@ -495,7 +474,11 @@ public void updateFileDetails(boolean transferring, boolean refresh) { OCFile file = getFile(); // set file details - binding.filename.setText(file.getFileName()); + if (MimeTypeUtil.isImage(file)) { + binding.filename.setText(file.getFileName()); + } else { + binding.filename.setVisibility(View.GONE); + } binding.size.setText(DisplayUtils.bytesToHumanReadable(file.getFileLength())); boolean showDetailedTimestamp = preferences.isShowDetailedTimestampEnabled(); @@ -589,123 +572,56 @@ private boolean readyToShow() { private void setFilePreview(OCFile file) { Bitmap resizedImage; - if (toolbarActivity != null) { - if (file.isFolder()) { - boolean isAutoUploadFolder = SyncedFolderProvider.isAutoUploadFolder(syncedFolderProvider, file, user); - - Integer overlayIconId = file.getFileOverlayIconId(isAutoUploadFolder); - // NMC Customization: No overlay icon will be used. Directly using folder icons - toolbarActivity.setPreviewImageDrawable(ContextCompat.getDrawable(requireContext(), overlayIconId)); - - int leftRightPadding = requireContext().getResources().getDimensionPixelSize(R.dimen.standard_padding); - updatePreviewImageUI(leftRightPadding); + if (toolbarActivity != null && MimeTypeUtil.isImage(file)) { + String tagId = ThumbnailsCacheManager.PREFIX_RESIZED_IMAGE + getFile().getRemoteId(); + resizedImage = ThumbnailsCacheManager.getBitmapFromDiskCache(tagId); + if (resizedImage != null && !file.isUpdateThumbnailNeeded()) { + toolbarActivity.setPreviewImageBitmap(resizedImage); previewLoaded = true; - isCustomBackIcon = false; } else { - if (file.getRemoteId() != null && file.isPreviewAvailable()) { - String tagId = ThumbnailsCacheManager.PREFIX_RESIZED_IMAGE + getFile().getRemoteId(); - resizedImage = ThumbnailsCacheManager.getBitmapFromDiskCache(tagId); - - if (resizedImage != null && !file.isUpdateThumbnailNeeded()) { - toolbarActivity.setPreviewImageBitmap(resizedImage); - toolbarActivity.showToolbarBackImage(true); - previewLoaded = true; - isCustomBackIcon = true; - } else { - // show thumbnail while loading resized image - Bitmap thumbnail = ThumbnailsCacheManager.getBitmapFromDiskCache( - ThumbnailsCacheManager.PREFIX_THUMBNAIL + getFile().getRemoteId()); - - if (thumbnail != null) { - toolbarActivity.setPreviewImageBitmap(thumbnail); - toolbarActivity.showToolbarBackImage(true); - previewLoaded = true; - isCustomBackIcon = true; - } else { - Drawable drawable = MimeTypeUtil.getFileTypeIcon(file.getMimeType(), - file.getFileName(), - requireContext(), - viewThemeUtils); - if (drawable == null) { - thumbnail = ThumbnailsCacheManager.mDefaultImg; - toolbarActivity.setPreviewImageBitmap(thumbnail); - } else { - toolbarActivity.setPreviewImageDrawable(drawable); - previewLoaded = true; - isCustomBackIcon = false; - } - updatePreviewImageUIForFiles(); - } - - if (MimeTypeUtil.isImage(file)) { - // generate new resized image - if (ThumbnailsCacheManager.cancelPotentialThumbnailWork(getFile(), toolbarActivity.getPreviewImageView()) && - containerActivity.getStorageManager() != null) { - final ThumbnailsCacheManager.ResizedImageGenerationTask task = - new ThumbnailsCacheManager.ResizedImageGenerationTask(this, - toolbarActivity.getPreviewImageView(), - toolbarActivity.getPreviewImageContainer(), - containerActivity.getStorageManager(), - connectivityService, - containerActivity.getStorageManager().getUser(), - getResources().getColor(R.color.background_color_inverse, - requireContext().getTheme()) - ); - - if (resizedImage == null) { - resizedImage = thumbnail; - } - - final ThumbnailsCacheManager.AsyncResizedImageDrawable asyncDrawable = - new ThumbnailsCacheManager.AsyncResizedImageDrawable( - MainApp.getAppContext().getResources(), - resizedImage, - task - ); - - toolbarActivity.setPreviewImageDrawable(asyncDrawable); - toolbarActivity.showToolbarBackImage(true); - previewLoaded = true; - isCustomBackIcon = true; - task.execute(getFile()); - } - } - } + // show thumbnail while loading resized image + Bitmap thumbnail = ThumbnailsCacheManager.getBitmapFromDiskCache( + ThumbnailsCacheManager.PREFIX_THUMBNAIL + getFile().getRemoteId()); + + if (thumbnail != null) { + toolbarActivity.setPreviewImageBitmap(thumbnail); } else { - toolbarActivity.setPreviewImageDrawable(MimeTypeUtil.getFileTypeIcon(file.getMimeType(), - file.getFileName(), - requireContext(), - viewThemeUtils)); - updatePreviewImageUIForFiles(); + thumbnail = ThumbnailsCacheManager.mDefaultImg; + } + + // generate new resized image + if (ThumbnailsCacheManager.cancelPotentialThumbnailWork(getFile(), toolbarActivity.getPreviewImageView()) && + containerActivity.getStorageManager() != null) { + final ThumbnailsCacheManager.ResizedImageGenerationTask task = + new ThumbnailsCacheManager.ResizedImageGenerationTask(this, + toolbarActivity.getPreviewImageView(), + toolbarActivity.getPreviewImageContainer(), + containerActivity.getStorageManager(), + connectivityService, + containerActivity.getStorageManager().getUser(), + getResources().getColor(R.color.background_color_inverse, + requireContext().getTheme()) + ); + + if (resizedImage == null) { + resizedImage = thumbnail; + } + + final ThumbnailsCacheManager.AsyncResizedImageDrawable asyncDrawable = + new ThumbnailsCacheManager.AsyncResizedImageDrawable( + MainApp.getAppContext().getResources(), + resizedImage, + task + ); + + toolbarActivity.setPreviewImageDrawable(asyncDrawable); previewLoaded = true; - isCustomBackIcon = false; + task.execute(getFile()); } } } else { previewLoaded = false; - isCustomBackIcon = false; - } - showHideCustomBackButton(); - } - - /** - * update preview image for files we are taking different paddings for files and folders - */ - private void updatePreviewImageUIForFiles() { - int leftRightPadding = requireContext().getResources().getDimensionPixelSize(R.dimen.standard_half_padding); - updatePreviewImageUI(leftRightPadding); - } - - /** - * change scale type and padding for folders and files without thumbnails - */ - private void updatePreviewImageUI(int leftRightPadding) { - if (toolbarActivity != null && toolbarActivity.getPreviewImageView() != null) { - toolbarActivity.getPreviewImageView().setScaleType(ImageView.ScaleType.FIT_START); - int topPadding = requireContext().getResources().getDimensionPixelSize(R.dimen.activity_row_layout_height); - int bottomPadding = requireContext().getResources().getDimensionPixelSize(R.dimen.standard_padding); - toolbarActivity.getPreviewImageView().setPadding(leftRightPadding, topPadding, leftRightPadding, bottomPadding); } } @@ -861,11 +777,12 @@ public void onMessageEvent(FavoriteEvent event) { /** * hide the view for landscape mode to have more space for the user to type in search view * {@link FileDetailSharingFragment#scrollToSearchViewPosition(boolean)} + * * @param event */ @Subscribe(threadMode = ThreadMode.MAIN) public void onMessageEvent(ShareSearchViewFocusEvent event) { - binding.shareDetailFileContainer.setVisibility(event.getHasFocus() ? View.GONE : View.VISIBLE); + binding.shareDetailFileContainer.setVisibility(event.getHasFocus() ? View.GONE : View.VISIBLE); } /** diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java index ac0b3f0cea4a..923d3bb5c8e7 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java @@ -23,11 +23,13 @@ import android.content.Intent; import android.content.res.Configuration; import android.database.Cursor; +import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract; import android.text.TextUtils; +import android.text.style.StyleSpan; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -37,10 +39,9 @@ import com.nextcloud.client.account.UserAccountManager; import com.nextcloud.client.di.Injectable; import com.nextcloud.client.network.ClientFactory; +import com.nextcloud.utils.EditorUtils; import com.nextcloud.utils.extensions.BundleExtensionsKt; import com.nextcloud.utils.extensions.FileExtensionsKt; -import com.nextcloud.utils.mdm.MDMConfig; -import com.nextcloud.utils.EditorUtils; import com.nmc.android.utils.SearchViewThemeUtils; import com.owncloud.android.R; import com.owncloud.android.databinding.FileDetailsSharingFragmentBinding; @@ -174,6 +175,16 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, String userId = accountManager.getUserData(user.toPlatformAccount(), com.owncloud.android.lib.common.accounts.AccountUtils.Constants.KEY_USER_ID); + binding.linkSharesList.setAdapter(new ShareeListAdapter(fileActivity, + new ArrayList<>(), + this, + userId, + user, + viewThemeUtils, + file.isEncrypted())); + + binding.linkSharesList.setLayoutManager(new LinearLayoutManager(requireContext())); + binding.sharesList.setAdapter(new ShareeListAdapter(fileActivity, new ArrayList<>(), this, @@ -247,7 +258,6 @@ private void setUpSearchView() { binding.searchView.setQueryHint(getResources().getString(R.string.share_search)); binding.searchView.setVisibility(View.VISIBLE); - binding.labelPersonalShare.setVisibility(View.VISIBLE); binding.pickContactEmailBtn.setVisibility(View.VISIBLE); binding.searchView.setOnQueryTextFocusChangeListener((view, hasFocus) -> { @@ -296,15 +306,6 @@ private void scrollToSearchViewPosition(boolean isDeviceRotated) { //send the event to show the share top view EventBus.getDefault().post(new ShareSearchViewFocusEvent(false)); } - - checkShareViaUser(); - } - - private void checkShareViaUser() { - if (!MDMConfig.INSTANCE.shareViaUser(requireContext())) { - binding.searchView.setVisibility(View.GONE); - binding.pickContactEmailBtn.setVisibility(View.GONE); - } } private void hideAppBar() { @@ -317,6 +318,16 @@ private void hideAppBar() { } } + private void disableSearchView(View view) { + view.setEnabled(false); + + if (view instanceof ViewGroup viewGroup) { + for (int i = 0; i < viewGroup.getChildCount(); i++) { + disableSearchView(viewGroup.getChildAt(i)); + } + } + } + /** * will be called from FileActivity when user is sharing from PreviewImageFragment * @@ -354,14 +365,16 @@ public void editExistingShare(OCShare share, int screenTypePermission, boolean i } private void setShareWithYou() { + setUpSearchView(); if (accountManager.userOwnsFile(file, user)) { - binding.sharedWithYouContainer.setVisibility(View.GONE); - binding.shareCreateNewLink.setVisibility(View.VISIBLE); - binding.tvSharingDetailsMessage.setText(getResources().getString(R.string.sharing_description)); - setUpSearchView(); + binding.tvResharingInfo.setVisibility(View.GONE); + binding.tvResharingStatus.setVisibility(View.GONE); } else { - binding.sharedWithYouUsername.setText( - String.format(getString(R.string.shared_with_you_by), file.getOwnerDisplayName())); + binding.tvResharingInfo.setText( + DisplayUtils.createTextWithSpan( + String.format(getString(R.string.resharing_user_info), file.getOwnerDisplayName()), + file.getOwnerDisplayName(), + new StyleSpan(Typeface.BOLD))); /* DisplayUtils.setAvatar(user, file.getOwnerId(), this, @@ -372,26 +385,25 @@ private void setShareWithYou() { getContext()); binding.sharedWithYouAvatar.setVisibility(View.VISIBLE);*/ - String note = file.getNote(); - - //NMC Customization --> Share with me note container is not required - if (!TextUtils.isEmpty(note)) { - binding.sharedWithYouNote.setText(file.getNote()); - binding.sharedWithYouNoteContainer.setVisibility(View.GONE); - } else { - binding.sharedWithYouNoteContainer.setVisibility(View.GONE); - } - if (file.canReshare()) { - binding.tvSharingDetailsMessage.setText(getResources().getString(R.string.reshare_allowed) + " " + getResources().getString(R.string.sharing_description)); - setUpSearchView(); + binding.tvResharingStatus.setText(getResources().getString(R.string.reshare_allowed)); } else { - binding.searchView.setVisibility(View.GONE); - binding.labelPersonalShare.setVisibility(View.GONE); - binding.pickContactEmailBtn.setVisibility(View.GONE); + binding.orSectionLayout.setVisibility(View.GONE); + binding.linkShareSectionHeading.setVisibility(View.GONE); + binding.linkSharesList.setVisibility(View.GONE); binding.shareCreateNewLink.setVisibility(View.GONE); - binding.tvSharingDetailsMessage.setText(getResources().getString(R.string.reshare_not_allowed)); + + binding.sharedWithDivider.setVisibility(View.GONE); + binding.tvYourShares.setVisibility(View.GONE); + binding.sharesList.setVisibility(View.GONE); + binding.tvEmptyShares.setVisibility(View.GONE); + + binding.tvResharingStatus.setText(getResources().getString(R.string.reshare_not_allowed)); + + disableSearchView(binding.searchContainer); } + binding.tvResharingStatus.setVisibility(View.VISIBLE); + binding.tvResharingInfo.setVisibility(View.VISIBLE); } } @@ -447,6 +459,8 @@ public void copyLink(OCShare share) { } else { ClipboardUtil.copyToClipboard(requireActivity(), share.getShareLink()); } + // NMC: send link after copying it to clipboard + sendLink(share); } } @@ -580,10 +594,24 @@ public void refreshSharesFromDB() { adapter.addShares(shares); + showHideEmailShareView(shares == null || shares.isEmpty()); + if (FileDetailSharingFragmentHelper.isPublicShareDisabled(capabilities) || !file.canReshare()) { return; } + ShareeListAdapter linkAdapter = (ShareeListAdapter) binding.linkSharesList.getAdapter(); + + if (linkAdapter == null) { + DisplayUtils.showSnackMessage(getView(), getString(R.string.could_not_retrieve_shares)); + return; + } + linkAdapter.getShares().clear(); + + //update flag in adapter + linkAdapter.setTextFile(SharingMenuHelper.canEditFile(requireActivity(), user, + capabilities, file, editorUtils)); + // Get public share List publicShares = fileDataStorageManager.getSharesByPathAndType(file.getRemotePath(), ShareType.PUBLIC_LINK, @@ -599,14 +627,22 @@ public void refreshSharesFromDB() { adapter.removeNewPublicShare(); }*/ - adapter.addShares(publicShares); + linkAdapter.addShares(publicShares); + + showHideLinkShareView(publicShares == null || publicShares.isEmpty()); + } - showHideView((shares == null || shares.isEmpty()) && (publicShares == null || publicShares.isEmpty())); + private void showHideLinkShareView(boolean isEmptyList) { + binding.linkSharesList.setVisibility(isEmptyList ? View.GONE : View.VISIBLE); } - private void showHideView(boolean isEmptyList) { + private void showHideEmailShareView(boolean isEmptyList) { binding.sharesList.setVisibility(isEmptyList ? View.GONE : View.VISIBLE); - binding.tvYourShares.setVisibility(isEmptyList ? View.GONE : View.VISIBLE); + // additional check to hide the empty shares if file cannot be shared + if (!file.canReshare()) { + binding.tvEmptyShares.setVisibility(View.GONE); + return; + } binding.tvEmptyShares.setVisibility(isEmptyList ? View.VISIBLE : View.GONE); } @@ -681,7 +717,8 @@ public void onSaveInstanceState(@NonNull Bundle outState) { @Override public void avatarGenerated(Drawable avatarDrawable, Object callContext) { - binding.sharedWithYouAvatar.setImageDrawable(avatarDrawable); + // NMC: not required + // binding.sharedWithYouAvatar.setImageDrawable(avatarDrawable); } @Override @@ -719,7 +756,7 @@ public void sendNewEmail(OCShare share) { @Override public void unShare(OCShare share) { unshareWith(share); - ShareeListAdapter adapter = (ShareeListAdapter) binding.sharesList.getAdapter(); + ShareeListAdapter adapter = (ShareeListAdapter) binding.linkSharesList.getAdapter(); if (adapter == null) { DisplayUtils.showSnackMessage(getView(), getString(R.string.failed_update_ui)); return; diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailsSharingProcessFragment.kt b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailsSharingProcessFragment.kt index e0035a34b84d..ffee342a5cc5 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailsSharingProcessFragment.kt +++ b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailsSharingProcessFragment.kt @@ -243,12 +243,6 @@ class FileDetailsSharingProcessFragment : } themeView() } - private fun scrollTopShowToolbar() { - //show the toolbar if it is hidden due to scrolling - if (requireActivity() is ToolbarActivity) { - (requireActivity() as ToolbarActivity).expandToolbar() - } - } private fun themeView() { CheckableThemeUtils.tintSwitch(binding.shareProcessSetPasswordSwitch) @@ -273,7 +267,6 @@ class FileDetailsSharingProcessFragment : } private fun showShareProcessFirst() { - scrollTopShowToolbar() binding.shareProcessGroupOne.visibility = View.VISIBLE binding.shareProcessGroupTwo.visibility = View.GONE binding.tvSetPasswordEmailWarning.visibility = View.GONE @@ -502,7 +495,6 @@ class FileDetailsSharingProcessFragment : * update views for screen type Note */ private fun showShareProcessSecond() { - scrollTopShowToolbar() binding.shareProcessGroupOne.visibility = View.GONE binding.shareProcessGroupTwo.visibility = View.VISIBLE if (share != null) { diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/util/SharingMenuHelper.java b/app/src/main/java/com/owncloud/android/ui/fragment/util/SharingMenuHelper.java index 9c6981033420..53620908ee00 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/util/SharingMenuHelper.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/util/SharingMenuHelper.java @@ -137,13 +137,13 @@ public static boolean isSecureFileDrop(OCShare share) { public static String getPermissionName(Context context, OCShare share) { if (isUploadAndEditingAllowed(share)) { - return context.getResources().getString(R.string.share_permission_can_edit); + return context.getResources().getString(R.string.share_quick_permission_can_edit); } else if (isReadOnly(share)) { - return context.getResources().getString(R.string.share_permission_read_only); + return context.getResources().getString(R.string.share_quick_permission_can_view); } else if (SharingMenuHelper.isSecureFileDrop(share)) { return context.getResources().getString(R.string.share_permission_secure_file_drop); } else if (isFileDrop(share)) { - return context.getResources().getString(R.string.share_permission_file_drop); + return context.getResources().getString(R.string.share_quick_permission_can_upload); } return null; } diff --git a/app/src/main/res/color/share_contact_icon_color.xml b/app/src/main/res/color/share_contact_icon_color.xml new file mode 100644 index 000000000000..bc179324d20c --- /dev/null +++ b/app/src/main/res/color/share_contact_icon_color.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_sharing_edit.xml b/app/src/main/res/drawable/ic_sharing_edit.xml new file mode 100644 index 000000000000..b4e40bc75bea --- /dev/null +++ b/app/src/main/res/drawable/ic_sharing_edit.xml @@ -0,0 +1,21 @@ + + + + + + + diff --git a/app/src/main/res/drawable/ic_sharing_file_drop.xml b/app/src/main/res/drawable/ic_sharing_file_drop.xml new file mode 100644 index 000000000000..0dea8a079dad --- /dev/null +++ b/app/src/main/res/drawable/ic_sharing_file_drop.xml @@ -0,0 +1,21 @@ + + + + + + + diff --git a/app/src/main/res/drawable/ic_sharing_quick_permission_arrow.xml b/app/src/main/res/drawable/ic_sharing_quick_permission_arrow.xml new file mode 100644 index 000000000000..44e00e17aabd --- /dev/null +++ b/app/src/main/res/drawable/ic_sharing_quick_permission_arrow.xml @@ -0,0 +1,21 @@ + + + + + + + diff --git a/app/src/main/res/drawable/ic_sharing_read_only.xml b/app/src/main/res/drawable/ic_sharing_read_only.xml new file mode 100644 index 000000000000..cfef11314c6d --- /dev/null +++ b/app/src/main/res/drawable/ic_sharing_read_only.xml @@ -0,0 +1,21 @@ + + + + + + + diff --git a/app/src/main/res/drawable/share_search_background.xml b/app/src/main/res/drawable/share_search_background.xml index 2d8cc41165bb..bd0eb50d4e67 100644 --- a/app/src/main/res/drawable/share_search_background.xml +++ b/app/src/main/res/drawable/share_search_background.xml @@ -7,6 +7,13 @@ + + + + + + + diff --git a/app/src/main/res/drawable/toolbar_back_arrow_bg.xml b/app/src/main/res/drawable/toolbar_back_arrow_bg.xml deleted file mode 100644 index 42c6b7aabba2..000000000000 --- a/app/src/main/res/drawable/toolbar_back_arrow_bg.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - diff --git a/app/src/main/res/layout/file_details_fragment.xml b/app/src/main/res/layout/file_details_fragment.xml index 03cb1988aad0..b40714571ae5 100644 --- a/app/src/main/res/layout/file_details_fragment.xml +++ b/app/src/main/res/layout/file_details_fragment.xml @@ -50,8 +50,8 @@ + android:background="@color/divider_color" /> - - + android:layout_height="wrap_content" + android:layout_marginTop="@dimen/standard_quarter_margin" + android:orientation="vertical"> + android:layout_width="match_parent" + android:layout_height="@dimen/sharee_list_item_size" + android:orientation="horizontal"> - + android:layout_marginStart="@dimen/standard_margin" + android:layout_marginTop="7dp" + android:layout_marginEnd="@dimen/standard_margin" + android:contentDescription="@string/share" + android:src="@drawable/shared_via_link" + android:visibility="gone" + app:tint="@color/text_color" /> - - + android:layout_gravity="center_vertical" + android:layout_marginStart="@dimen/standard_margin" + android:layout_weight="1" + android:orientation="vertical"> - + - + + + + + + + + + + + + diff --git a/app/src/main/res/layout/file_details_share_share_item.xml b/app/src/main/res/layout/file_details_share_share_item.xml index aa3bd0df373b..19ef6f2802c9 100644 --- a/app/src/main/res/layout/file_details_share_share_item.xml +++ b/app/src/main/res/layout/file_details_share_share_item.xml @@ -11,67 +11,73 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" - android:layout_height="@dimen/sharee_list_item_size" - android:orientation="horizontal" - android:weightSum="1" - android:layout_marginTop="@dimen/standard_margin" + android:layout_height="wrap_content" + android:layout_marginTop="@dimen/standard_quarter_margin" + android:orientation="vertical" tools:ignore="UseCompoundDrawables"> - - + android:layout_width="match_parent" + android:layout_height="@dimen/sharee_list_item_size" + android:orientation="horizontal" + android:weightSum="1"> - + android:layout_marginStart="@dimen/standard_margin" + android:layout_marginLeft="@dimen/standard_margin" + android:layout_marginTop="@dimen/alternate_half_margin" + android:layout_marginEnd="@dimen/standard_margin" + android:layout_marginRight="@dimen/standard_margin" + android:contentDescription="@string/user_icon" + android:src="@drawable/ic_internal_share" + android:visibility="gone" + app:tint="@color/text_color" /> - + android:layout_gravity="center_vertical" + android:layout_marginStart="@dimen/standard_margin" + android:layout_weight="1" + android:orientation="vertical"> + + + + + + + - + diff --git a/app/src/main/res/layout/file_details_sharing_fragment.xml b/app/src/main/res/layout/file_details_sharing_fragment.xml index 7bf5e7f01156..83f146d45e62 100644 --- a/app/src/main/res/layout/file_details_sharing_fragment.xml +++ b/app/src/main/res/layout/file_details_sharing_fragment.xml @@ -21,90 +21,48 @@ android:orientation="vertical"> - - - - - - - - - - - - - - - - - + android:paddingRight="@dimen/standard_padding" + android:text="@string/resharing_user_info" + android:textColor="@color/share_info_txt_color" + android:textSize="@dimen/txt_size_14sp" + android:visibility="gone" + tools:visibility="visible" /> + android:textSize="@dimen/txt_size_14sp" + android:visibility="gone" + tools:visibility="visible" /> @@ -126,58 +84,97 @@ android:layout_marginEnd="@dimen/standard_margin" android:background="@drawable/share_search_background" app:srcCompat="@drawable/ic_contact_book" - app:tint="@color/share_btn_txt_color" /> + app:tint="@color/share_contact_icon_color" /> + + + + + + + + + + + android:text="@string/copy_link" + android:textColor="@color/text_color" + android:textSize="@dimen/txt_size_17sp" + android:textStyle="bold" /> + + + android:typeface="normal" /> + + + android:textSize="@dimen/txt_size_17sp" + android:textStyle="bold" /> @@ -185,13 +182,12 @@ android:id="@+id/tv_empty_shares" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_gravity="center" android:layout_marginStart="@dimen/standard_margin" - android:layout_marginTop="@dimen/standard_double_margin" + android:layout_marginTop="@dimen/standard_quarter_margin" android:layout_marginEnd="@dimen/standard_margin" android:text="@string/empty_shares" - android:textColor="@color/secondary_text_color" - android:textSize="@dimen/txt_size_16sp" + android:textColor="@color/share_info_txt_color" + android:textSize="@dimen/txt_size_14sp" android:visibility="gone" /> + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/toolbar_standard.xml b/app/src/main/res/layout/toolbar_standard.xml index 20952317449b..376909c641f6 100644 --- a/app/src/main/res/layout/toolbar_standard.xml +++ b/app/src/main/res/layout/toolbar_standard.xml @@ -103,15 +103,6 @@ android:theme="@style/Theme.ToolbarTheme" tools:visibility="gone"> - - Ihre Nachricht persönliche Freigabe per E-Mail - Link erstellen + Neuen Link erstellen Ihre Freigaben Linkbezeichnung Ihre Linkbezeichnung Bei der Sammelbox ist nur das Hochladen erlaubt. Nur Sie sehen Dateien und Ordner die hochgeladen worden sind. Password Protection Expiration Date - Noch keine Freigaben erstellt. + Sie haben ihre Datei / ihren Ordner noch nicht geteilt. Teilen Sie um anderen Zugriff zu geben. Download Limit Das Feld für das Download-Limit darf nicht leer sein. Downlimit eingeben @@ -35,4 +35,14 @@ Nachrichtentext eintragen, wird es unverschlüsselt im Klartext übertragen. Empfangen Geteilt + Link per E-Mail versenden + Weiterteilen wurde nicht erlaubt. + Weiterteilen ist erlaubt. + Dieser Datei / dieser Ordner wurde mit ihnen geteilt von %s + oder + Geteilt mit + Details + Jeder kann nur anzeigen + Jeder kann bearbeiten + Jeder kann nur hochladen \ No newline at end of file diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 0ec679db17ed..d5bd6867e6bc 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -753,8 +753,6 @@ Kontolöschung anfordern Löschung anfordern Beim Diensteanbieter die dauerhafte Löschung des Kontos anfordern - Weiterteilen ist nicht erlaubt. - Weiterteilen ist erlaubt. Resharing/Wiederteilen ist nicht erlaubt. Kein verkleinertes Bild verfügbar. Vollbild herunterladen? Datei wiederherstellen diff --git a/app/src/main/res/values/nmc_sharing_strings.xml b/app/src/main/res/values/nmc_sharing_strings.xml index 113b4929af50..2504ff53fe8a 100644 --- a/app/src/main/res/values/nmc_sharing_strings.xml +++ b/app/src/main/res/values/nmc_sharing_strings.xml @@ -15,14 +15,14 @@ You can create links or send shares by mail. If you invite MagentaCLOUD users, you have more opportunities for collaboration. Your Message Personal share by mail - Create Link + Create new link Your Shares Link Label Your custom link label With File drop, only uploading is allowed. Only you can see files and folders that have been uploaded. Password Protection Expiration Date - No shares created yet. + You have not yet shared your file/folder. Share to give others access. Download Limit Download limit cannot be empty. Enter download limit @@ -34,4 +34,14 @@ transmitted unencrypted in plaintext. Received Shared + Send link by mail + Resharing is not allowed. + Resharing is allowed. + This file / folder was shared with you by %s + or + Shared with + Detail + Everyone can only view + Everyone can edit + Everyone can just upload \ No newline at end of file diff --git a/app/src/main/res/values/nmc_sharing_styles.xml b/app/src/main/res/values/nmc_sharing_styles.xml index e6b970e412c0..a9d2e8f20905 100644 --- a/app/src/main/res/values/nmc_sharing_styles.xml +++ b/app/src/main/res/values/nmc_sharing_styles.xml @@ -3,10 +3,12 @@ \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 52bf8bfbcb09..0ba59498784d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -989,8 +989,6 @@ Downloads Avatar from shared user Shared with you by %1$s - Resharing is not allowed. - Resharing is allowed. Retrieving file… Associated account not found! Logged in as %1$s