mirror of
https://github.com/nextcloud/android.git
synced 2024-11-22 05:05:31 +03:00
internal link share still should be shown
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
db426aa3fc
commit
5fe0fdcbeb
3 changed files with 59 additions and 46 deletions
|
@ -730,10 +730,6 @@ public abstract class FileActivity extends DrawerActivity
|
|||
}
|
||||
|
||||
public static void showShareLinkDialog(FileActivity activity, ServerFileInterface file, String link) {
|
||||
if (!MDMConfig.INSTANCE.shareViaLink(activity)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Create dialog to allow the user choose an app to send the link
|
||||
Intent intentToShareLink = new Intent(Intent.ACTION_SEND);
|
||||
|
||||
|
|
|
@ -14,10 +14,12 @@ package com.owncloud.android.ui.adapter;
|
|||
import android.annotation.SuppressLint;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.nextcloud.client.account.User;
|
||||
import com.nextcloud.utils.mdm.MDMConfig;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.databinding.FileDetailsShareInternalShareLinkBinding;
|
||||
import com.owncloud.android.databinding.FileDetailsShareLinkShareItemBinding;
|
||||
|
@ -79,43 +81,51 @@ public class ShareeListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
switch (ShareType.fromValue(viewType)) {
|
||||
case PUBLIC_LINK, EMAIL -> {
|
||||
return new LinkShareViewHolder(
|
||||
FileDetailsShareLinkShareItemBinding.inflate(LayoutInflater.from(fileActivity),
|
||||
parent,
|
||||
false),
|
||||
fileActivity,
|
||||
viewThemeUtils);
|
||||
}
|
||||
case NEW_PUBLIC_LINK -> {
|
||||
if (encrypted) {
|
||||
return new NewSecureFileDropViewHolder(
|
||||
FileDetailsShareSecureFileDropAddNewItemBinding.inflate(LayoutInflater.from(fileActivity),
|
||||
boolean shareViaLink = MDMConfig.INSTANCE.shareViaLink(fileActivity);
|
||||
|
||||
if (shareViaLink) {
|
||||
switch (ShareType.fromValue(viewType)) {
|
||||
case PUBLIC_LINK, EMAIL -> {
|
||||
return new LinkShareViewHolder(
|
||||
FileDetailsShareLinkShareItemBinding.inflate(LayoutInflater.from(fileActivity),
|
||||
parent,
|
||||
false),
|
||||
fileActivity,
|
||||
viewThemeUtils);
|
||||
}
|
||||
case NEW_PUBLIC_LINK -> {
|
||||
if (encrypted) {
|
||||
return new NewSecureFileDropViewHolder(
|
||||
FileDetailsShareSecureFileDropAddNewItemBinding.inflate(LayoutInflater.from(fileActivity),
|
||||
parent,
|
||||
false)
|
||||
);
|
||||
} else {
|
||||
return new NewLinkShareViewHolder(
|
||||
FileDetailsSharePublicLinkAddNewItemBinding.inflate(LayoutInflater.from(fileActivity),
|
||||
parent,
|
||||
false)
|
||||
);
|
||||
} else {
|
||||
return new NewLinkShareViewHolder(
|
||||
FileDetailsSharePublicLinkAddNewItemBinding.inflate(LayoutInflater.from(fileActivity),
|
||||
parent,
|
||||
false)
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
case INTERNAL -> {
|
||||
return new InternalShareViewHolder(
|
||||
FileDetailsShareInternalShareLinkBinding.inflate(LayoutInflater.from(fileActivity), parent, false),
|
||||
fileActivity);
|
||||
}
|
||||
default -> {
|
||||
return new ShareViewHolder(FileDetailsShareShareItemBinding.inflate(LayoutInflater.from(fileActivity),
|
||||
parent,
|
||||
false),
|
||||
user,
|
||||
fileActivity,
|
||||
viewThemeUtils);
|
||||
}
|
||||
}
|
||||
case INTERNAL -> {
|
||||
return new InternalShareViewHolder(
|
||||
FileDetailsShareInternalShareLinkBinding.inflate(LayoutInflater.from(fileActivity), parent, false),
|
||||
fileActivity);
|
||||
}
|
||||
default -> {
|
||||
return new ShareViewHolder(FileDetailsShareShareItemBinding.inflate(LayoutInflater.from(fileActivity),
|
||||
parent,
|
||||
false),
|
||||
user,
|
||||
fileActivity,
|
||||
viewThemeUtils);
|
||||
}
|
||||
} else {
|
||||
return new InternalShareViewHolder(
|
||||
FileDetailsShareInternalShareLinkBinding.inflate(LayoutInflater.from(fileActivity), parent, false),
|
||||
fileActivity);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,6 +137,16 @@ public class ShareeListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
|
||||
final OCShare share = shares.get(position);
|
||||
|
||||
boolean shareViaLink = MDMConfig.INSTANCE.shareViaLink(fileActivity);
|
||||
|
||||
if (!shareViaLink) {
|
||||
if (holder instanceof InternalShareViewHolder internalShareViewHolder) {
|
||||
internalShareViewHolder.bind(share, listener);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (holder instanceof LinkShareViewHolder publicShareViewHolder) {
|
||||
publicShareViewHolder.bind(share, listener);
|
||||
} else if (holder instanceof InternalShareViewHolder internalShareViewHolder) {
|
||||
|
@ -148,7 +168,12 @@ public class ShareeListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return shares.size();
|
||||
boolean shareViaLink = MDMConfig.INSTANCE.shareViaLink(fileActivity);
|
||||
if (shareViaLink) {
|
||||
return shares.size();
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
|
|
|
@ -246,7 +246,6 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda
|
|||
disableSearchView(binding.searchView);
|
||||
}
|
||||
|
||||
checkShareLink();
|
||||
checkShareViaUser();
|
||||
}
|
||||
|
||||
|
@ -256,13 +255,6 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda
|
|||
}
|
||||
}
|
||||
|
||||
private void checkShareLink() {
|
||||
if (!MDMConfig.INSTANCE.shareViaLink(requireContext())) {
|
||||
binding.sharedWithYouContainer.setVisibility(View.GONE);
|
||||
binding.sharesList.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private void disableSearchView(View view) {
|
||||
view.setEnabled(false);
|
||||
|
||||
|
|
Loading…
Reference in a new issue