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 91c8cf7fdfb1..f99082077f00 100644
--- a/app/src/androidTest/java/com/nmc/android/ui/FileSharingIT.kt
+++ b/app/src/androidTest/java/com/nmc/android/ui/FileSharingIT.kt
@@ -99,11 +99,12 @@ class FileSharingIT : AbstractIT() {
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")))
onView(withId(R.id.share_create_new_link)).check(matches(isCompletelyDisplayed()))
- onView(withId(R.id.share_create_new_link)).check(matches(withText("Add link")))
+ onView(withId(R.id.share_create_new_link)).check(matches(withText("Create Link")))
onView(withId(R.id.tv_your_shares)).check(matches(not(isDisplayed())))
onView(withId(R.id.sharesList)).check(matches(not(isDisplayed())))
@@ -155,11 +156,12 @@ class FileSharingIT : AbstractIT() {
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")))
onView(withId(R.id.share_create_new_link)).check(matches(isCompletelyDisplayed()))
- onView(withId(R.id.share_create_new_link)).check(matches(withText("Add link")))
+ 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")))
@@ -185,6 +187,7 @@ class FileSharingIT : AbstractIT() {
onView(withId(R.id.shared_with_you_avatar)).check(matches(isCompletelyDisplayed()))
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.share_create_new_link)).check(matches(not(isDisplayed())))
onView(withId(R.id.tv_your_shares)).check(matches(not(isDisplayed())))
@@ -208,6 +211,7 @@ class FileSharingIT : AbstractIT() {
onView(withId(R.id.shared_with_you_note_container)).check(matches(not(isDisplayed())))
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())))
diff --git a/app/src/main/java/com/nmc/android/utils/CheckableThemeUtils.kt b/app/src/main/java/com/nmc/android/utils/CheckableThemeUtils.kt
index 7c86042db7cb..a3b8a1149948 100644
--- a/app/src/main/java/com/nmc/android/utils/CheckableThemeUtils.kt
+++ b/app/src/main/java/com/nmc/android/utils/CheckableThemeUtils.kt
@@ -3,19 +3,33 @@ package com.nmc.android.utils
import android.content.res.ColorStateList
import androidx.appcompat.widget.AppCompatCheckBox
import androidx.appcompat.widget.SwitchCompat
-import androidx.core.graphics.drawable.DrawableCompat
-import androidx.core.widget.CompoundButtonCompat
-import com.owncloud.android.MainApp
+import androidx.core.content.res.ResourcesCompat
import com.owncloud.android.R
object CheckableThemeUtils {
@JvmStatic
fun tintCheckbox(vararg checkBoxes: AppCompatCheckBox) {
for (checkBox in checkBoxes) {
- val checkEnabled = MainApp.getAppContext().resources.getColor(R.color.checkbox_checked_enabled)
- val checkDisabled = MainApp.getAppContext().resources.getColor(R.color.checkbox_checked_disabled)
- val uncheckEnabled = MainApp.getAppContext().resources.getColor(R.color.checkbox_unchecked_enabled)
- val uncheckDisabled = MainApp.getAppContext().resources.getColor(R.color.checkbox_unchecked_disabled)
+ val checkEnabled = ResourcesCompat.getColor(
+ checkBox.context.resources,
+ R.color.checkbox_checked_enabled,
+ checkBox.context.theme
+ )
+ val checkDisabled = ResourcesCompat.getColor(
+ checkBox.context.resources,
+ R.color.checkbox_checked_disabled,
+ checkBox.context.theme
+ )
+ val uncheckEnabled = ResourcesCompat.getColor(
+ checkBox.context.resources,
+ R.color.checkbox_unchecked_enabled,
+ checkBox.context.theme
+ )
+ val uncheckDisabled = ResourcesCompat.getColor(
+ checkBox.context.resources,
+ R.color.checkbox_unchecked_disabled,
+ checkBox.context.theme
+ )
val states = arrayOf(
intArrayOf(android.R.attr.state_enabled, android.R.attr.state_checked),
@@ -29,8 +43,7 @@ object CheckableThemeUtils {
uncheckEnabled,
uncheckDisabled
)
- val checkColorStateList = ColorStateList(states, colors)
- CompoundButtonCompat.setButtonTintList(checkBox, checkColorStateList)
+ checkBox.buttonTintList = ColorStateList(states, colors)
}
}
@@ -40,47 +53,65 @@ object CheckableThemeUtils {
if (colorText) {
switchView.setTextColor(color)
}
- val thumbColorCheckedEnabled = MainApp.getAppContext().resources.getColor(R.color.switch_thumb_checked_enabled)
- val thumbColorUncheckedEnabled =
- MainApp.getAppContext().resources.getColor(R.color.switch_thumb_unchecked_enabled)
- val thumbColorCheckedDisabled =
- MainApp.getAppContext().resources.getColor(R.color.switch_thumb_checked_disabled)
- val thumbColorUncheckedDisabled =
- MainApp.getAppContext().resources.getColor(R.color.switch_thumb_unchecked_disabled)
val states = arrayOf(
intArrayOf(android.R.attr.state_enabled, android.R.attr.state_checked),
- intArrayOf(-android.R.attr.state_enabled, android.R.attr.state_checked),
intArrayOf(android.R.attr.state_enabled, -android.R.attr.state_checked),
- intArrayOf(-android.R.attr.state_enabled, -android.R.attr.state_checked)
+ intArrayOf(-android.R.attr.state_enabled)
)
+
+ val thumbColorCheckedEnabled = ResourcesCompat.getColor(
+ switchView.context.resources,
+ R.color.switch_thumb_checked_enabled,
+ switchView.context.theme
+ )
+ val thumbColorUncheckedEnabled =
+ ResourcesCompat.getColor(
+ switchView.context.resources,
+ R.color.switch_thumb_unchecked_enabled,
+ switchView.context.theme
+ )
+ val thumbColorDisabled =
+ ResourcesCompat.getColor(
+ switchView.context.resources,
+ R.color.switch_thumb_disabled,
+ switchView.context.theme
+ )
+
val thumbColors = intArrayOf(
thumbColorCheckedEnabled,
- thumbColorCheckedDisabled,
thumbColorUncheckedEnabled,
- thumbColorUncheckedDisabled
+ thumbColorDisabled
)
val thumbColorStateList = ColorStateList(states, thumbColors)
- val trackColorCheckedEnabled = MainApp.getAppContext().resources.getColor(R.color.switch_track_checked_enabled)
+
+ val trackColorCheckedEnabled = ResourcesCompat.getColor(
+ switchView.context.resources,
+ R.color.switch_track_checked_enabled,
+ switchView.context.theme
+ )
val trackColorUncheckedEnabled =
- MainApp.getAppContext().resources.getColor(R.color.switch_track_unchecked_enabled)
- val trackColorCheckedDisabled =
- MainApp.getAppContext().resources.getColor(R.color.switch_track_checked_disabled)
- val trackColorUncheckedDisabled =
- MainApp.getAppContext().resources.getColor(R.color.switch_track_unchecked_disabled)
+ ResourcesCompat.getColor(
+ switchView.context.resources,
+ R.color.switch_track_unchecked_enabled,
+ switchView.context.theme
+ )
+ val trackColorDisabled =
+ ResourcesCompat.getColor(
+ switchView.context.resources,
+ R.color.switch_track_disabled,
+ switchView.context.theme
+ )
val trackColors = intArrayOf(
trackColorCheckedEnabled,
- trackColorCheckedDisabled,
trackColorUncheckedEnabled,
- trackColorUncheckedDisabled
+ trackColorDisabled
)
- val trackColorStateList = ColorStateList(states, trackColors)
- // setting the thumb color
- DrawableCompat.setTintList(switchView.thumbDrawable, thumbColorStateList)
+ val trackColorStateList = ColorStateList(states, trackColors)
- // setting the track color
- DrawableCompat.setTintList(switchView.trackDrawable, trackColorStateList)
+ switchView.thumbTintList = thumbColorStateList
+ switchView.trackTintList = trackColorStateList
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/owncloud/android/ui/activity/FileActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/FileActivity.java
index 2042d38e38d3..e384a579b693 100644
--- a/app/src/main/java/com/owncloud/android/ui/activity/FileActivity.java
+++ b/app/src/main/java/com/owncloud/android/ui/activity/FileActivity.java
@@ -945,7 +945,7 @@ protected void doShareWith(String shareeName, ShareType shareType) {
//if user sharing from Preview Image Fragment
fragment = getSupportFragmentManager().findFragmentByTag(ShareActivity.TAG_SHARE_FRAGMENT);
if (fragment != null) {
- ((FileDetailSharingFragment) fragment).initiateSharingProcess(shareeName, shareType);
+ ((FileDetailSharingFragment) fragment).initiateSharingProcess(shareeName, shareType, usersAndGroupsSearchConfig.getSearchOnlyUsers());
}
}
}
diff --git a/app/src/main/java/com/owncloud/android/ui/dialog/SendShareDialog.kt b/app/src/main/java/com/owncloud/android/ui/dialog/SendShareDialog.kt
index c6f57dd75aeb..749cea654633 100644
--- a/app/src/main/java/com/owncloud/android/ui/dialog/SendShareDialog.kt
+++ b/app/src/main/java/com/owncloud/android/ui/dialog/SendShareDialog.kt
@@ -12,7 +12,6 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.google.android.material.snackbar.Snackbar
-import com.nextcloud.android.common.ui.theme.utils.ColorRole
import com.nextcloud.client.di.Injectable
import com.nextcloud.client.utils.IntentUtil.createSendIntent
import com.nextcloud.utils.extensions.getParcelableArgument
@@ -85,7 +84,6 @@ class SendShareDialog : BottomSheetDialogFragment(R.layout.send_share_fragment),
binding.btnShare.setOnClickListener { shareFile(file) }
binding.btnLink.setOnClickListener { shareByLink() }
- applyTintColor()
setupBottomSheetBehaviour()
checkButtonVisibilities()
setupSendButtonRecyclerView()
@@ -109,12 +107,6 @@ class SendShareDialog : BottomSheetDialogFragment(R.layout.send_share_fragment),
bottomSheetDialog.behavior.skipCollapsed = true
}
- private fun applyTintColor() {
- viewThemeUtils?.material?.colorMaterialButtonPrimaryFilled(binding.btnLink)
- viewThemeUtils?.material?.colorMaterialButtonPrimaryFilled(binding.btnShare)
- viewThemeUtils?.platform?.colorViewBackground(binding.bottomSheet, ColorRole.SURFACE)
- }
-
@Suppress("MagicNumber")
private fun checkButtonVisibilities() {
if (hideNcSharingOptions) {
@@ -138,6 +130,9 @@ class SendShareDialog : BottomSheetDialogFragment(R.layout.send_share_fragment),
}
private fun shareByLink() {
+ // NMC Customization
+ isPeopleShareClicked = false
+
val fileOperationsHelper = (requireActivity() as FileActivity).fileOperationsHelper
if (file?.isSharedViaLink == true) {
@@ -221,6 +216,9 @@ class SendShareDialog : BottomSheetDialogFragment(R.layout.send_share_fragment),
}
private fun shareFile(file: OCFile?) {
+ // NMC Customization
+ isPeopleShareClicked = true
+
dismiss()
if (activity is FileDisplayActivity) {
@@ -247,6 +245,11 @@ class SendShareDialog : BottomSheetDialogFragment(R.layout.send_share_fragment),
const val PACKAGE_NAME = "PACKAGE_NAME"
const val ACTIVITY_NAME = "ACTIVITY_NAME"
+ // TODO: 06/21/23 remove this condition after Comments section included
+ // flag to avoid crash during creating new link share for a file for which link share already exist
+ @JvmField
+ var isPeopleShareClicked = false
+
@JvmStatic
fun newInstance(file: OCFile?, hideNcSharingOptions: Boolean, capability: OCCapability): SendShareDialog {
val dialogFragment = SendShareDialog()
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 82c775300cae..fec435eab0a0 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
@@ -30,6 +30,7 @@
import android.content.Context;
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;
@@ -95,6 +96,7 @@
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;
@@ -547,11 +549,17 @@ private void setFileModificationTimestamp(OCFile file, boolean showDetailedTimes
private void setFavoriteIconStatus(boolean isFavorite) {
if (isFavorite) {
- binding.favorite.setImageDrawable(ResourcesCompat.getDrawable(getResources(), R.drawable.ic_star, null));
+ binding.favorite.setImageDrawable(ResourcesCompat.getDrawable(getResources(), R.drawable.favorite, null));
} else {
binding.favorite.setImageDrawable(ResourcesCompat.getDrawable(getResources(),
- R.drawable.ic_star_outline,
- null));
+ R.drawable.ic_star_outline,
+ null));
+
+ //NMC Customization
+ binding.favorite.getDrawable().mutate().setColorFilter(requireContext()
+ .getResources()
+ .getColor(R.color.list_item_lastmod_and_filesize_text, null),
+ PorterDuff.Mode.SRC_IN);
}
}
@@ -574,13 +582,12 @@ private void setFilePreview(OCFile file) {
if (toolbarActivity != null) {
if (file.isFolder()) {
- toolbarActivity.setPreviewImageDrawable(MimeTypeUtil
- .getFolderTypeIcon(file.isSharedWithMe() || file.isSharedWithSharee(),
- file.isSharedViaLink(), file.isEncrypted(),
- file.isGroupFolder(),
- syncedFolderProvider.findByRemotePathAndAccount(file.getRemotePath(), user),
- file.getMountType(), requireContext(),
- viewThemeUtils));
+ 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);
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 0d1cc0a5fe15..cbd35f626133 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
@@ -28,12 +28,16 @@
import android.Manifest;
import android.accounts.AccountManager;
import android.annotation.SuppressLint;
+import android.app.Activity;
import android.app.SearchManager;
import android.content.Context;
+import android.content.Intent;
import android.content.res.Configuration;
+import android.database.Cursor;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
+import android.provider.ContactsContract;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
@@ -188,6 +192,8 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
binding.sharesList.setLayoutManager(new LinearLayoutManager(requireContext()));
+ binding.pickContactEmailBtn.setOnClickListener(v -> checkContactPermission());
+
binding.shareCreateNewLink.setOnClickListener(v -> createPublicShareLink());
//remove focus from search view on click of root view
@@ -250,6 +256,7 @@ 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) -> {
isSearchViewFocused = hasFocus;
@@ -315,11 +322,12 @@ private void hideAppBar() {
* @param shareeName
* @param shareType
*/
- public void initiateSharingProcess(String shareeName, ShareType shareType) {
+ public void initiateSharingProcess(String shareeName, ShareType shareType, boolean secureShare) {
requireActivity().getSupportFragmentManager().beginTransaction().replace(R.id.share_fragment_container,
FileDetailsSharingProcessFragment.newInstance(file,
shareeName,
shareType,
+ secureShare,
SharingMenuHelper.canEditFile(requireActivity(), user, capabilities, file, editorUtils)),
FileDetailsSharingProcessFragment.TAG)
.addToBackStack(null)
@@ -365,9 +373,10 @@ private void setShareWithYou() {
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.VISIBLE);
+ binding.sharedWithYouNoteContainer.setVisibility(View.GONE);
} else {
binding.sharedWithYouNoteContainer.setVisibility(View.GONE);
}
@@ -378,6 +387,7 @@ private void setShareWithYou() {
} else {
binding.searchView.setVisibility(View.GONE);
binding.labelPersonalShare.setVisibility(View.GONE);
+ binding.pickContactEmailBtn.setVisibility(View.GONE);
binding.shareCreateNewLink.setVisibility(View.GONE);
binding.tvSharingDetailsMessage.setText(getResources().getString(R.string.reshare_not_allowed));
}
@@ -572,6 +582,7 @@ public void refreshSharesFromDB() {
ShareType.PUBLIC_LINK,
"");
+ // NMC Customization: Not required for NMC
/*if (publicShares.isEmpty() && containsNoNewPublicShare(adapter.getShares()) &&
(!file.isEncrypted() || capabilities.getEndToEndEncryption().isTrue())) {
final OCShare ocShare = new OCShare();
@@ -581,14 +592,6 @@ public void refreshSharesFromDB() {
adapter.removeNewPublicShare();
}*/
- if (publicShares.isEmpty() && containsNoNewPublicShare(adapter.getShares())) {
- final OCShare ocShare = new OCShare();
- ocShare.setShareType(ShareType.NEW_PUBLIC_LINK);
- publicShares.add(ocShare);
- } else {
- adapter.removeNewPublicShare();
- }
-
adapter.addShares(publicShares);
showHideView((shares == null || shares.isEmpty()) && (publicShares == null || publicShares.isEmpty()));
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 d274b03fd06d..273ac18408e1 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
@@ -24,14 +24,19 @@ package com.owncloud.android.ui.fragment
import android.content.Context
import android.content.res.Configuration
import android.os.Bundle
+import android.os.Handler
+import android.os.Looper
import android.text.TextUtils
import android.view.LayoutInflater
+import android.view.MotionEvent
import android.view.View
import android.view.ViewGroup
+import android.widget.RadioGroup
import androidx.fragment.app.Fragment
import com.nextcloud.client.di.Injectable
import com.nextcloud.utils.extensions.getParcelableArgument
import com.nextcloud.utils.extensions.getSerializableArgument
+import com.nmc.android.utils.CheckableThemeUtils
import com.owncloud.android.R
import com.owncloud.android.databinding.FileDetailsSharingProcessFragmentBinding
import com.owncloud.android.datamodel.OCFile
@@ -39,11 +44,13 @@ import com.owncloud.android.lib.resources.shares.OCShare
import com.owncloud.android.lib.resources.shares.SharePermissionsBuilder
import com.owncloud.android.lib.resources.shares.ShareType
import com.owncloud.android.ui.activity.FileActivity
+import com.owncloud.android.ui.activity.ToolbarActivity
import com.owncloud.android.ui.dialog.ExpirationDatePickerDialogFragment
import com.owncloud.android.ui.fragment.util.SharingMenuHelper
import com.owncloud.android.ui.helpers.FileOperationsHelper
import com.owncloud.android.utils.ClipboardUtil
import com.owncloud.android.utils.DisplayUtils
+import com.owncloud.android.utils.KeyboardUtils
import com.owncloud.android.utils.theme.ViewThemeUtils
import java.text.SimpleDateFormat
import java.util.Date
@@ -61,7 +68,8 @@ import javax.inject.Inject
class FileDetailsSharingProcessFragment :
Fragment(),
Injectable,
- ExpirationDatePickerDialogFragment.OnExpiryDateListener {
+ ExpirationDatePickerDialogFragment.OnExpiryDateListener,
+ RadioGroup.OnCheckedChangeListener {
companion object {
const val TAG = "FileDetailsSharingProcessFragment"
@@ -73,6 +81,7 @@ class FileDetailsSharingProcessFragment :
private const val ARG_RESHARE_SHOWN = "arg_reshare_shown"
private const val ARG_EXP_DATE_SHOWN = "arg_exp_date_shown"
private const val ARG_SECURE_SHARE = "secure_share"
+ private const val ARG_IS_TEXT_FILE = "is_text_file"
// types of screens to be displayed
const val SCREEN_TYPE_PERMISSION = 1 // permissions screen
@@ -86,13 +95,15 @@ class FileDetailsSharingProcessFragment :
file: OCFile,
shareeName: String,
shareType: ShareType,
- secureShare: Boolean
+ secureShare: Boolean,
+ isTextFile: Boolean
): FileDetailsSharingProcessFragment {
val args = Bundle()
args.putParcelable(ARG_OCFILE, file)
args.putSerializable(ARG_SHARE_TYPE, shareType)
args.putString(ARG_SHAREE_NAME, shareeName)
args.putBoolean(ARG_SECURE_SHARE, secureShare)
+ args.putBoolean(ARG_IS_TEXT_FILE, isTextFile)
val fragment = FileDetailsSharingProcessFragment()
fragment.arguments = args
return fragment
@@ -102,13 +113,20 @@ class FileDetailsSharingProcessFragment :
* fragment instance to be called while modifying existing share information
*/
@JvmStatic
- fun newInstance(share: OCShare, screenType: Int, isReshareShown: Boolean, isExpirationDateShown: Boolean):
+ fun newInstance(
+ share: OCShare,
+ screenType: Int,
+ isReshareShown: Boolean,
+ isExpirationDateShown: Boolean,
+ isTextFile: Boolean
+ ):
FileDetailsSharingProcessFragment {
val args = Bundle()
args.putParcelable(ARG_OCSHARE, share)
args.putInt(ARG_SCREEN_TYPE, screenType)
args.putBoolean(ARG_RESHARE_SHOWN, isReshareShown)
args.putBoolean(ARG_EXP_DATE_SHOWN, isExpirationDateShown)
+ args.putBoolean(ARG_IS_TEXT_FILE, isTextFile)
val fragment = FileDetailsSharingProcessFragment()
fragment.arguments = args
return fragment
@@ -117,6 +135,8 @@ class FileDetailsSharingProcessFragment :
@Inject
lateinit var viewThemeUtils: ViewThemeUtils
+ @Inject
+ lateinit var keyboardUtils: KeyboardUtils
private lateinit var onEditShareListener: FileDetailSharingFragment.OnEditShareListener
@@ -130,14 +150,23 @@ class FileDetailsSharingProcessFragment :
private var shareProcessStep = SCREEN_TYPE_PERMISSION // default screen type
private var permission = OCShare.NO_PERMISSION // no permission
private var chosenExpDateInMills: Long = -1 // for no expiry date
+ private var isTextFile: Boolean = false
private var share: OCShare? = null
private var isReShareShown: Boolean = true // show or hide reShare option
private var isExpDateShown: Boolean = true // show or hide expiry date option
private var isSecureShare: Boolean = false
+ private var isDownloadCountFetched: Boolean = false
private var expirationDatePickerFragment: ExpirationDatePickerDialogFragment? = null
+ private var isHideDownloadCheckedReadOnly: Boolean = false
+ private var isHideDownloadCheckedUploadEdit: Boolean = false
+
+ private var isFileDropSelected: Boolean = false
+ private var isReadOnlySelected: Boolean = false
+ private var isUploadEditingSelected: Boolean = false
+
override fun onAttach(context: Context) {
super.onAttach(context)
try {
@@ -165,6 +194,7 @@ class FileDetailsSharingProcessFragment :
isReShareShown = it.getBoolean(ARG_RESHARE_SHOWN, true)
isExpDateShown = it.getBoolean(ARG_EXP_DATE_SHOWN, true)
isSecureShare = it.getBoolean(ARG_SECURE_SHARE, false)
+ isTextFile = it.getBoolean(ARG_IS_TEXT_FILE, false)
}
fileActivity = activity as FileActivity?
@@ -172,6 +202,27 @@ class FileDetailsSharingProcessFragment :
requireNotNull(fileActivity) { "FileActivity may not be null" }
}
+ // Updating Hide Download enable/disable on selection of FileDrop
+ override fun onCheckedChanged(group: RadioGroup?, checkId: Int) {
+ if (binding.shareProcessPermissionFileDrop.id == checkId) {
+ isFileDropSelected = true
+ binding.shareProcessHideDownloadCheckbox.isChecked = true
+ binding.shareProcessHideDownloadCheckbox.isEnabled = false
+ } else {
+ isFileDropSelected = false
+ binding.shareProcessHideDownloadCheckbox.isEnabled = true
+ if (binding.shareProcessPermissionReadOnly.id == checkId) {
+ isReadOnlySelected = true
+ isUploadEditingSelected = false
+ binding.shareProcessHideDownloadCheckbox.isChecked = isHideDownloadCheckedReadOnly
+ } else if (binding.shareProcessPermissionUploadEditing.id == checkId) {
+ isReadOnlySelected = false
+ isUploadEditingSelected = true
+ binding.shareProcessHideDownloadCheckbox.isChecked = isHideDownloadCheckedUploadEdit
+ }
+ }
+ }
+
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
binding = FileDetailsSharingProcessFragmentBinding.inflate(inflater, container, false)
fileOperationsHelper = fileActivity?.fileOperationsHelper
@@ -181,36 +232,43 @@ class FileDetailsSharingProcessFragment :
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
if (shareProcessStep == SCREEN_TYPE_PERMISSION) {
+ binding.shareProcessPermissionReadOnly.isChecked = true
showShareProcessFirst()
} else {
showShareProcessSecond()
}
+ //Set default value to 0 for download count
+ if (!isDownloadCountFetched) {
+ binding.shareProcessRemainingDownloadCountTv.text =
+ String.format(resources.getString(R.string.download_text), "0")
+ }
+ binding.shareProcessPermissionRadioGroup.setOnCheckedChangeListener(this)
implementClickEvents()
-
+ binding.shareProcessHideDownloadCheckbox.setOnCheckedChangeListener { _, isChecked ->
+ if (!isFileDropSelected) {
+ if (isReadOnlySelected) {
+ isHideDownloadCheckedReadOnly = isChecked
+ } else if (isUploadEditingSelected) {
+ isHideDownloadCheckedUploadEdit = isChecked
+ }
+ }
+ }
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() {
- viewThemeUtils.platform.colorTextView(binding.shareProcessEditShareLink)
- viewThemeUtils.platform.colorTextView(binding.shareProcessAdvancePermissionTitle)
-
- viewThemeUtils.platform.themeRadioButton(binding.shareProcessPermissionReadOnly)
- viewThemeUtils.platform.themeRadioButton(binding.shareProcessPermissionUploadEditing)
- viewThemeUtils.platform.themeRadioButton(binding.shareProcessPermissionFileDrop)
-
- viewThemeUtils.platform.themeCheckbox(binding.shareProcessAllowResharingCheckbox)
-
- viewThemeUtils.androidx.colorSwitchCompat(binding.shareProcessSetPasswordSwitch)
- viewThemeUtils.androidx.colorSwitchCompat(binding.shareProcessSetExpDateSwitch)
- viewThemeUtils.androidx.colorSwitchCompat(binding.shareProcessHideDownloadCheckbox)
- viewThemeUtils.androidx.colorSwitchCompat(binding.shareProcessChangeNameSwitch)
-
- viewThemeUtils.material.colorTextInputLayout(binding.shareProcessEnterPasswordContainer)
- viewThemeUtils.material.colorTextInputLayout(binding.shareProcessChangeNameContainer)
- viewThemeUtils.material.colorTextInputLayout(binding.noteContainer)
-
- viewThemeUtils.material.colorMaterialButtonPrimaryFilled(binding.shareProcessBtnNext)
- viewThemeUtils.material.colorMaterialButtonPrimaryOutlined(binding.shareProcessBtnCancel)
+ CheckableThemeUtils.tintSwitch(binding.shareProcessSetPasswordSwitch)
+ CheckableThemeUtils.tintSwitch(binding.shareProcessAllowResharingCheckbox)
+ CheckableThemeUtils.tintSwitch(binding.shareProcessSetExpDateSwitch)
+ CheckableThemeUtils.tintSwitch(binding.shareProcessHideDownloadCheckbox)
+ CheckableThemeUtils.tintSwitch(binding.shareProcessChangeNameSwitch)
+ CheckableThemeUtils.tintSwitch(binding.shareProcessDownloadLimitSwitch)
}
override fun onConfigurationChanged(newConfig: Configuration) {
@@ -227,9 +285,10 @@ class FileDetailsSharingProcessFragment :
}
private fun showShareProcessFirst() {
+ scrollTopShowToolbar()
binding.shareProcessGroupOne.visibility = View.VISIBLE
- binding.shareProcessEditShareLink.visibility = View.VISIBLE
binding.shareProcessGroupTwo.visibility = View.GONE
+ binding.tvSetPasswordEmailWarning.visibility = View.GONE
if (share != null) {
setupModificationUI()
@@ -244,13 +303,17 @@ class FileDetailsSharingProcessFragment :
// show or hide expiry date
if (isExpDateShown && !isSecureShare) {
binding.shareProcessSetExpDateSwitch.visibility = View.VISIBLE
+ binding.dividerSharingExpDate.visibility = View.VISIBLE
} else {
binding.shareProcessSetExpDateSwitch.visibility = View.GONE
+ binding.dividerSharingExpDate.visibility = View.GONE
}
shareProcessStep = SCREEN_TYPE_PERMISSION
}
private fun setupModificationUI() {
+ binding.shareProcessBtnNext.text = requireContext().resources.getString(R.string.common_confirm)
+
if (share?.isFolder == true) updateViewForFolder() else updateViewForFile()
// read only / allow upload and editing / file drop
@@ -263,19 +326,6 @@ class FileDetailsSharingProcessFragment :
}
shareType = share?.shareType ?: ShareType.NO_SHARED
-
- // show different text for link share and other shares
- // because we have link to share in Public Link
- val resources = requireContext().resources
-
- binding.shareProcessBtnNext.text = resources.getString(
- if (shareType == ShareType.PUBLIC_LINK) {
- R.string.share_copy_link
- } else {
- R.string.common_confirm
- }
- )
-
updateViewForShareType()
binding.shareProcessSetPasswordSwitch.isChecked = share?.isPasswordProtected == true
showPasswordInput(binding.shareProcessSetPasswordSwitch.isChecked)
@@ -314,24 +364,44 @@ class FileDetailsSharingProcessFragment :
}
private fun updateViewForExternalShare() {
- binding.shareProcessChangeNameSwitch.visibility = View.GONE
- binding.shareProcessChangeNameContainer.visibility = View.GONE
+ hideLinkLabelViews()
updateViewForExternalAndLinkShare()
+ updateFileEditingRadioButton()
}
private fun updateViewForLinkShare() {
updateViewForExternalAndLinkShare()
binding.shareProcessChangeNameSwitch.visibility = View.VISIBLE
+ binding.dividerSharingChangeName.visibility = View.VISIBLE
if (share != null) {
- binding.shareProcessChangeName.setText(share?.label)
+ binding.shareProcessChangeNameEt.setText(share?.label)
binding.shareProcessChangeNameSwitch.isChecked = !TextUtils.isEmpty(share?.label)
}
showChangeNameInput(binding.shareProcessChangeNameSwitch.isChecked)
+
+ //download limit will only be available for files
+ if (share?.isFolder == false || file?.isFolder == false) {
+ binding.shareProcessDownloadLimitSwitch.visibility = View.VISIBLE
+ binding.dividerSharingDownloadLimit.visibility = View.VISIBLE
+
+ //fetch the download limit for link share
+ fetchDownloadLimitForShareLink()
+ } else {
+ binding.shareProcessDownloadLimitSwitch.visibility = View.GONE
+ binding.dividerSharingDownloadLimit.visibility = View.GONE
+ }
+
+ //the input for download limit will be hidden initially
+ //and can be visible back or no depending on the api result
+ //from the download limit api
+ binding.shareProcessDownloadLimitEt.visibility = View.GONE
+ binding.shareProcessRemainingDownloadCountTv.visibility = View.GONE
+
+ updateFileEditingRadioButton()
}
private fun updateViewForInternalShare() {
- binding.shareProcessChangeNameSwitch.visibility = View.GONE
- binding.shareProcessChangeNameContainer.visibility = View.GONE
+ hideLinkLabelViews()
binding.shareProcessHideDownloadCheckbox.visibility = View.GONE
if (isSecureShare) {
binding.shareProcessAllowResharingCheckbox.visibility = View.GONE
@@ -345,6 +415,35 @@ class FileDetailsSharingProcessFragment :
binding.shareProcessAllowResharingCheckbox.visibility = View.GONE
}
binding.shareProcessAllowResharingCheckbox.isChecked = SharingMenuHelper.canReshare(share)
+ if (share?.isFolder == true) {
+ hideFileDropView()
+ }
+ } else if (file?.isFolder == true) {
+ hideFileDropView()
+ }
+ }
+
+ private fun hideFileDropView() {
+ //no file drop for internal share due to 403 bad request api issue
+ binding.shareProcessPermissionFileDrop.visibility = View.GONE
+ binding.shareFileDropInfo.visibility = View.GONE
+ }
+
+ private fun hideLinkLabelViews() {
+ binding.shareProcessChangeNameSwitch.visibility = View.GONE
+ binding.shareProcessChangeNameEt.visibility = View.GONE
+ binding.dividerSharingChangeName.visibility = View.GONE
+
+ binding.shareProcessDownloadLimitSwitch.visibility = View.GONE
+ binding.shareProcessDownloadLimitEt.visibility = View.GONE
+ binding.shareProcessRemainingDownloadCountTv.visibility = View.GONE
+ binding.dividerSharingDownloadLimit.visibility = View.GONE
+ }
+
+ private fun updateFileEditingRadioButton() {
+ if (!isTextFile) {
+ binding.shareProcessPermissionUploadEditing.isEnabled = false
+ binding.shareProcessPermissionUploadEditing.setTextColor(resources.getColor(R.color.share_disabled_txt_color))
}
}
@@ -352,15 +451,22 @@ class FileDetailsSharingProcessFragment :
* update views where share type external or link share
*/
private fun updateViewForExternalAndLinkShare() {
- binding.shareProcessHideDownloadCheckbox.visibility = View.VISIBLE
+ binding.shareProcessHideDownloadCheckbox.isEnabled = true
+ binding.dividerSharingHideDownload.visibility = View.VISIBLE
binding.shareProcessAllowResharingCheckbox.visibility = View.GONE
+ binding.shareProcessAllowResharingInfo.visibility = View.GONE
+ binding.dividerSharingAllowResharing.visibility = View.GONE
binding.shareProcessSetPasswordSwitch.visibility = View.VISIBLE
+ binding.dividerSharingEnterPassword.visibility = View.VISIBLE
if (share != null) {
if (SharingMenuHelper.isFileDrop(share)) {
- binding.shareProcessHideDownloadCheckbox.visibility = View.GONE
+ binding.shareProcessHideDownloadCheckbox.isChecked = true
+ binding.shareProcessHideDownloadCheckbox.isEnabled = false
+ binding.dividerSharingHideDownload.visibility = View.GONE
} else {
- binding.shareProcessHideDownloadCheckbox.visibility = View.VISIBLE
+ binding.shareProcessHideDownloadCheckbox.isEnabled = true
+ binding.dividerSharingHideDownload.visibility = View.VISIBLE
binding.shareProcessHideDownloadCheckbox.isChecked = share?.isHideFileDownload == true
}
}
@@ -388,14 +494,17 @@ class FileDetailsSharingProcessFragment :
binding.shareProcessPermissionUploadEditing.text =
requireContext().resources.getString(R.string.link_share_editing)
binding.shareProcessPermissionFileDrop.visibility = View.GONE
+ binding.shareFileDropInfo.visibility = View.GONE
}
private fun updateViewForFolder() {
binding.shareProcessPermissionUploadEditing.text =
requireContext().resources.getString(R.string.link_share_allow_upload_and_editing)
binding.shareProcessPermissionFileDrop.visibility = View.VISIBLE
+ binding.shareFileDropInfo.visibility = View.VISIBLE
if (isSecureShare) {
binding.shareProcessPermissionFileDrop.visibility = View.GONE
+ binding.shareFileDropInfo.visibility = View.GONE
binding.shareProcessAllowResharingCheckbox.visibility = View.GONE
binding.shareProcessSetExpDateSwitch.visibility = View.GONE
}
@@ -405,15 +514,25 @@ class FileDetailsSharingProcessFragment :
* update views for screen type Note
*/
private fun showShareProcessSecond() {
+ scrollTopShowToolbar()
binding.shareProcessGroupOne.visibility = View.GONE
- binding.shareProcessEditShareLink.visibility = View.GONE
binding.shareProcessGroupTwo.visibility = View.VISIBLE
if (share != null) {
- binding.shareProcessBtnNext.text = requireContext().resources.getString(R.string.set_note)
+ binding.shareProcessBtnNext.text = requireContext().resources.getString(R.string.send_email)
binding.noteText.setText(share?.note)
+
+ //show the warning label if password protection is enabled
+ /* binding.tvSetPasswordEmailWarning.visibility =
+ if (share?.isPasswordProtected == true) View.VISIBLEF
+ else View.GONE*/
} else {
binding.shareProcessBtnNext.text = requireContext().resources.getString(R.string.send_share)
binding.noteText.setText("")
+
+ //show the warning label if password protection is enabled
+ /* binding.tvSetPasswordEmailWarning.visibility =
+ if (binding.shareProcessSetPasswordSwitch.isChecked) View.VISIBLE
+ else View.GONE*/
}
shareProcessStep = SCREEN_TYPE_NOTE
}
@@ -441,6 +560,17 @@ class FileDetailsSharingProcessFragment :
binding.shareProcessSelectExpDate.setOnClickListener {
showExpirationDateDialog()
}
+ binding.shareProcessDownloadLimitSwitch.setOnCheckedChangeListener { _, isChecked ->
+ showDownloadLimitInput(isChecked)
+ }
+ binding.noteText.setOnTouchListener { view, event ->
+ view.parent.requestDisallowInterceptTouchEvent(true)
+ if ((event.action and MotionEvent.ACTION_MASK) == MotionEvent.ACTION_UP) {
+ view.parent.requestDisallowInterceptTouchEvent(false)
+ }
+ return@setOnTouchListener false
+ }
+
}
private fun showExpirationDateDialog(chosenDateInMillis: Long = chosenExpDateInMills) {
@@ -456,13 +586,30 @@ class FileDetailsSharingProcessFragment :
}
private fun showChangeNameInput(isChecked: Boolean) {
- binding.shareProcessChangeNameContainer.visibility = if (isChecked) View.VISIBLE else View.GONE
+ binding.shareProcessChangeNameEt.visibility = if (isChecked) View.VISIBLE else View.GONE
+ if (!isChecked) {
+ binding.shareProcessChangeNameEt.setText("")
+ //hide keyboard when user unchecks
+ hideKeyboard()
+ }
+ }
+
+ private fun showDownloadLimitInput(isChecked: Boolean) {
+ binding.shareProcessDownloadLimitEt.visibility = if (isChecked) View.VISIBLE else View.GONE
+ binding.shareProcessRemainingDownloadCountTv.visibility = if (isChecked) View.VISIBLE else View.GONE
if (!isChecked) {
- binding.shareProcessChangeName.setText("")
+ binding.shareProcessDownloadLimitEt.setText("")
+ if (!isDownloadCountFetched) {
+ binding.shareProcessRemainingDownloadCountTv.text = String.format(resources.getString(R.string.download_text), "0")
+ }
+ //hide keyboard when user unchecks
+ hideKeyboard()
}
}
private fun onCancelClick() {
+ // hide keyboard when user clicks cancel button
+ hideKeyboard()
// if modifying the existing share then on back press remove the current fragment
if (share != null) {
removeCurrentFragment()
@@ -482,6 +629,13 @@ class FileDetailsSharingProcessFragment :
binding.shareProcessSelectExpDate.visibility = if (isChecked) View.VISIBLE else View.GONE
binding.shareProcessExpDateDivider.visibility = if (isChecked) View.VISIBLE else View.GONE
+ //update margin of divider when switch is enabled/disabled
+ val margin = if (isChecked) requireContext().resources.getDimensionPixelOffset(R.dimen.standard_half_margin)
+ else 0
+ val param = binding.dividerSharingExpDate.layoutParams as ViewGroup.MarginLayoutParams
+ param.setMargins(0, margin, 0, 0)
+ binding.dividerSharingExpDate.layoutParams = param
+
// reset the expiration date if switch is unchecked
if (!isChecked) {
chosenExpDateInMills = -1
@@ -490,17 +644,28 @@ class FileDetailsSharingProcessFragment :
}
private fun showPasswordInput(isChecked: Boolean) {
- binding.shareProcessEnterPasswordContainer.visibility = if (isChecked) View.VISIBLE else View.GONE
+ binding.shareProcessEnterPassword.visibility = if (isChecked) View.VISIBLE else View.GONE
// reset the password if switch is unchecked
if (!isChecked) {
binding.shareProcessEnterPassword.setText("")
+ // hide keyboard when user unchecks
+ hideKeyboard()
}
}
+ private fun hideKeyboard() {
+ if (this::binding.isInitialized) {
+ keyboardUtils.hideKeyboardFrom(requireContext(), binding.root)
+ }
+ }
+
+ /**
+ * remove the fragment and pop it from backstack because we are adding it to backstack
+ */
private fun removeCurrentFragment() {
- onEditShareListener.onShareProcessClosed()
- fileActivity?.supportFragmentManager?.beginTransaction()?.remove(this)?.commit()
+ requireActivity().supportFragmentManager.beginTransaction().remove(this).commit()
+ requireActivity().supportFragmentManager.popBackStack()
}
private fun getReSharePermission(): Int {
@@ -514,6 +679,7 @@ class FileDetailsSharingProcessFragment :
*/
@Suppress("ReturnCount")
private fun validateShareProcessFirst() {
+ hideKeyboard()
permission = getSelectedPermission()
if (permission == OCShare.NO_PERMISSION) {
DisplayUtils.showSnackMessage(binding.root, R.string.no_share_permission_selected)
@@ -535,12 +701,23 @@ class FileDetailsSharingProcessFragment :
}
if (binding.shareProcessChangeNameSwitch.isChecked &&
- binding.shareProcessChangeName.text?.trim().isNullOrEmpty()
+ binding.shareProcessChangeNameEt.text?.trim().isNullOrEmpty()
) {
DisplayUtils.showSnackMessage(binding.root, R.string.label_empty)
return
}
+ if (binding.shareProcessDownloadLimitSwitch.isChecked) {
+ val downloadLimit = binding.shareProcessDownloadLimitEt.text?.trim()
+ if (downloadLimit.isNullOrEmpty()) {
+ DisplayUtils.showSnackMessage(binding.root, R.string.download_limit_empty)
+ return
+ } else if (downloadLimit.toString().toLong() <= 0) {
+ DisplayUtils.showSnackMessage(binding.root, R.string.download_limit_zero)
+ return
+ }
+ }
+
// if modifying existing share information then execute the process
if (share != null) {
updateShare()
@@ -558,8 +735,8 @@ class FileDetailsSharingProcessFragment :
binding.shareProcessAllowResharingCheckbox.isChecked -> getReSharePermission()
binding.shareProcessPermissionReadOnly.isChecked -> OCShare.READ_PERMISSION_FLAG
binding.shareProcessPermissionUploadEditing.isChecked -> when {
- file?.isFolder == true || share?.isFolder == true -> OCShare.MAXIMUM_PERMISSIONS_FOR_FOLDER
- else -> OCShare.MAXIMUM_PERMISSIONS_FOR_FILE
+ file?.isFolder == true || share?.isFolder == true -> SharingMenuHelper.CAN_EDIT_PERMISSIONS_FOR_FOLDER
+ else -> SharingMenuHelper.CAN_EDIT_PERMISSIONS_FOR_FILE
}
binding.shareProcessPermissionFileDrop.isChecked -> OCShare.CREATE_PERMISSION_FLAG
@@ -573,7 +750,8 @@ class FileDetailsSharingProcessFragment :
binding.shareProcessHideDownloadCheckbox.isChecked,
binding.shareProcessEnterPassword.text.toString().trim(),
chosenExpDateInMills,
- binding.shareProcessChangeName.text.toString().trim()
+ binding.shareProcessChangeNameEt.text.toString().trim(),
+ binding.shareProcessDownloadLimitEt.text.toString().trim()
)
// copy the share link if available
if (!TextUtils.isEmpty(share?.shareLink)) {
@@ -585,10 +763,14 @@ class FileDetailsSharingProcessFragment :
* method to validate step 2 (note screen) information
*/
private fun validateShareProcessSecond() {
- val noteText = binding.noteText.text.toString().trim()
+ hideKeyboard()
// if modifying existing share then directly update the note and send email
- if (share != null && share?.note != noteText) {
- fileOperationsHelper?.updateNoteToShare(share, noteText)
+ if (share != null) {
+ if (TextUtils.isEmpty(binding.noteText.text.toString().trim())) {
+ DisplayUtils.showSnackMessage(binding.root, R.string.share_link_empty_note_message)
+ return
+ }
+ fileOperationsHelper?.updateNoteToShare(share, binding.noteText.text.toString().trim())
} else {
// else create new share
fileOperationsHelper?.shareFileWithSharee(
@@ -600,14 +782,27 @@ class FileDetailsSharingProcessFragment :
.shareProcessHideDownloadCheckbox.isChecked,
binding.shareProcessEnterPassword.text.toString().trim(),
chosenExpDateInMills,
- noteText,
- binding.shareProcessChangeName.text.toString().trim(),
+ binding.noteText.text.toString().trim(),
+ binding.shareProcessChangeNameEt.text.toString().trim(),
true
)
}
removeCurrentFragment()
}
+ /**
+ * fetch the download limit for the link share
+ * the response will be received in FileActivity --> onRemoteOperationFinish() method
+ */
+ private fun fetchDownloadLimitForShareLink() {
+ //need to call this method in handler else to show progress dialog it will throw exception
+ Handler(Looper.getMainLooper()).post {
+ share?.let {
+ fileOperationsHelper?.getShareDownloadLimit(it.token)
+ }
+ }
+ }
+
/**
* method will be called from DrawerActivity on back press to handle screen backstack
*/
@@ -628,4 +823,15 @@ class FileDetailsSharingProcessFragment :
override fun onDateUnSet() {
binding.shareProcessSetExpDateSwitch.isChecked = false
}
+
+ /**
+ * will be called when download limit is fetched
+ */
+ fun onLinkShareDownloadLimitFetched(downloadLimit: Long, downloadCount: Long) {
+ binding.shareProcessDownloadLimitSwitch.isChecked = downloadLimit > 0
+ showDownloadLimitInput(binding.shareProcessDownloadLimitSwitch.isChecked)
+ binding.shareProcessDownloadLimitEt.setText(if (downloadLimit > 0) downloadLimit.toString() else "")
+ binding.shareProcessRemainingDownloadCountTv.text = String.format(resources.getString(R.string.download_text), downloadCount.toString())
+ isDownloadCountFetched = true
+ }
}
diff --git a/app/src/main/res/drawable/ic_contact_book.xml b/app/src/main/res/drawable/ic_contact_book.xml
index 6dff9b171724..f4e34a5fa52f 100644
--- a/app/src/main/res/drawable/ic_contact_book.xml
+++ b/app/src/main/res/drawable/ic_contact_book.xml
@@ -1,26 +1,12 @@
-
-
+
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 68a0fbb61956..f07ed7cdf78c 100644
--- a/app/src/main/res/layout/file_details_sharing_fragment.xml
+++ b/app/src/main/res/layout/file_details_sharing_fragment.xml
@@ -22,8 +22,8 @@
+ app:srcCompat="@drawable/ic_shared_with_me"
+ app:tint="@color/shared_with_me_color" />
-
+ android:gravity="center_vertical"
+ android:orientation="horizontal">
+
+
+
+
+
+
@@ -157,18 +174,18 @@
app:iconTint="@color/share_btn_txt_color" />
+ android:textStyle="bold"
+ android:visibility="gone"
+ tools:visibility="visible" />
+ android:textSize="@dimen/txt_size_16sp"
+ android:visibility="gone" />
+ android:layout_height="80dp" />
diff --git a/app/src/main/res/layout/file_details_sharing_process_fragment.xml b/app/src/main/res/layout/file_details_sharing_process_fragment.xml
index 156b268a077a..ed2792a2475f 100644
--- a/app/src/main/res/layout/file_details_sharing_process_fragment.xml
+++ b/app/src/main/res/layout/file_details_sharing_process_fragment.xml
@@ -24,6 +24,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:background="@color/bg_default"
android:focusable="true"
android:focusableInTouchMode="true"
android:minHeight="400dp">
@@ -31,8 +32,9 @@
@@ -43,116 +45,252 @@
android:minHeight="400dp">
+
+
+
+
+ app:layout_constraintTop_toBottomOf="@+id/divider_sharing_permissions">
+ android:background="?android:selectableItemBackground"
+ android:button="@null"
+ android:drawableEnd="?android:attr/listChoiceIndicatorSingle"
+ android:text="@string/link_share_read_only"
+ android:textColor="@color/share_txt_color"
+ android:textSize="@dimen/txt_size_15sp" />
+ android:background="?android:selectableItemBackground"
+ android:button="@null"
+ android:drawableEnd="?android:attr/listChoiceIndicatorSingle"
+ android:text="@string/link_share_allow_upload_and_editing"
+ android:textColor="@color/share_txt_color"
+ android:textSize="@dimen/txt_size_15sp" />
+ android:background="?android:selectableItemBackground"
+ android:button="@null"
+ android:drawableEnd="?android:attr/listChoiceIndicatorSingle"
+ android:text="@string/link_share_file_drop"
+ android:textColor="@color/share_txt_color"
+ android:textSize="@dimen/txt_size_15sp" />
+
+
+ app:layout_constraintTop_toBottomOf="@+id/share_file_drop_info" />
-
+
+
+
+
+
+
+
+
+
+
+ app:layout_constraintTop_toBottomOf="@+id/divider_sharing_allow_resharing" />
-
-
-
-
-
+ tools:visibility="visible" />
-
+
+ app:layout_constraintTop_toBottomOf="@+id/divider_sharing_enter_password" />
+
+
+
+
+
+
+ app:layout_constraintTop_toBottomOf="@+id/divider_sharing_change_name" />
-
+
-
-
+ app:layout_constraintTop_toBottomOf="@+id/share_process_download_limit_switch"
+ tools:visibility="visible" />
-
+
-
+
+ share_process_change_name_et, divider_sharing_adv_permissions,
+ divider_sharing_permissions, divider_sharing_allow_resharing,
+ divider_sharing_change_name, divider_sharing_enter_password,
+ divider_sharing_exp_date,divider_sharing_hide_download,
+ share_file_drop_info, share_process_allow_resharing_info,
+ share_process_download_limit_switch, divider_sharing_download_limit,
+ share_process_download_limit_et,share_process_remaining_download_count_tv" />
+ app:layout_constraintTop_toBottomOf="@+id/tv_sharing_title" />
-
+ app:layout_constraintTop_toBottomOf="@+id/share_process_message_title" />
-
-
+
+ app:constraint_referenced_ids="share_process_message_title, note_text" />
+
+
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toEndOf="@+id/share_process_btn_cancel"/>
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index 6270cd0861d6..135982c8ea25 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -95,7 +95,6 @@
Schauen Sie später noch einmal vorbei oder laden Sie neu.
Checkbox
Wähle einen lokalen Ordner…
- Ort wählen
Wähle einen entfernten Ordner …
Bitte eine Vorlage auswählen und einen Dateinamen eingeben.
Wählen Sie, welche Datei behalten werden soll!
@@ -111,21 +110,20 @@
Abbrechen
Synchronisierung abbrechen
Konto auswählen
- Übernehmen
+ Bestätigen
Kopieren
Löschen
Fehler
Nicht genügend Speicher
Unbekannter Fehler
Lade…
- Weiter
+ Nächste
Nein
OK
Ausstehend
Löschen
Umbenennen
Speichern
- Auswählen
Senden
Teilen
Überspringen
@@ -195,7 +193,6 @@
Zu sichernde Daten
Zugangsdaten falsch
Benutzerkonto löschen
- Konto %s und alle lokalen Dateien löschen?\n\nLöschung kann nicht rückgängig gemacht werden.
Einträgen entfernen
Link löschen
Auswahl aufheben
@@ -527,7 +524,6 @@
Nur ein Konto zulässig
Keine App verfügbar um PDFs anzuzeigen
Keine App zum Senden der ausgewählten Dateien verfügbar
- Senden
Notiz konnte nicht versandt werden
Notiz-Symbol
Ausführen der Aktion fehlgeschlagen.
@@ -700,7 +696,6 @@
Bitte eine Vorlage auswählen
Vorlage auswählen
Senden
- Notiz an Empfänger senden
Icon für den Senden-Button
Setze als
Notiz setzen
diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml
index 88a29668c4cd..e926fdcc432f 100644
--- a/app/src/main/res/values-night/colors.xml
+++ b/app/src/main/res/values-night/colors.xml
@@ -89,10 +89,8 @@
@color/grey_80
- @color/grey_70
- @color/grey_60
- @color/grey_70
- @color/grey_60
+ @color/grey_70
+ @color/grey_60
@color/grey_70
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 951b6765b8a4..b05b582157a7 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -137,12 +137,10 @@
@color/primary
#F399C7
- @color/grey_0
- @color/grey_0
#FFFFFF
@color/grey_30
- @color/grey_0
- @color/grey_0
+ @color/grey_10
+ @color/grey_0
@color/primary
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
index cc9e25255a10..3a987ca9bef3 100644
--- a/app/src/main/res/values/dimens.xml
+++ b/app/src/main/res/values/dimens.xml
@@ -28,4 +28,5 @@
145dp
1dp
13sp
+ 44dp
\ 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 45c683c15d88..256f5e3f13c4 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1007,7 +1007,7 @@
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
- Add link
+ Create Link
Your Shares
Link Label
Your custom link label