use of com.owncloud.android.ui.adapter.SendButtonAdapter in project android by nextcloud.
the class SendFilesDialog method onCreateView.
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.send_files_fragment, container, false);
// populate send apps
Intent sendIntent = IntentUtil.createSendIntent(requireContext(), files);
List<ResolveInfo> matches = requireActivity().getPackageManager().queryIntentActivities(sendIntent, 0);
if (matches.isEmpty()) {
Toast.makeText(getContext(), R.string.no_send_app, Toast.LENGTH_SHORT).show();
dismiss();
return null;
}
List<SendButtonData> sendButtonDataList = setupSendButtonData(matches);
SendButtonAdapter.ClickListener clickListener = setupSendButtonClickListener(sendIntent);
RecyclerView sendButtonsView = view.findViewById(R.id.send_button_recycler_view);
sendButtonsView.setLayoutManager(new GridLayoutManager(getActivity(), 4));
sendButtonsView.setAdapter(new SendButtonAdapter(sendButtonDataList, clickListener));
return view;
}
use of com.owncloud.android.ui.adapter.SendButtonAdapter in project android by nextcloud.
the class SendShareDialog method onCreateView.
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
view = inflater.inflate(R.layout.send_share_fragment, container, false);
LinearLayout sendShareButtons = view.findViewById(R.id.send_share_buttons);
View divider = view.findViewById(R.id.divider);
// Share with people
TextView sharePeopleText = view.findViewById(R.id.share_people_button);
sharePeopleText.setOnClickListener(v -> shareFile(file));
ImageView sharePeopleImageView = view.findViewById(R.id.share_people_icon);
themeShareButtonImage(sharePeopleImageView);
sharePeopleImageView.setOnClickListener(v -> shareFile(file));
// Share via link button
TextView shareLinkText = view.findViewById(R.id.share_link_button);
shareLinkText.setOnClickListener(v -> shareByLink());
ImageView shareLinkImageView = view.findViewById(R.id.share_link_icon);
themeShareButtonImage(shareLinkImageView);
shareLinkImageView.setOnClickListener(v -> shareByLink());
if (hideNcSharingOptions) {
sendShareButtons.setVisibility(View.GONE);
divider.setVisibility(View.GONE);
} else if (file.isSharedWithMe() && !file.canReshare()) {
showResharingNotAllowedSnackbar();
if (file.isFolder()) {
shareLinkText.setVisibility(View.GONE);
shareLinkImageView.setVisibility(View.GONE);
sharePeopleText.setVisibility(View.GONE);
sharePeopleImageView.setVisibility(View.GONE);
getDialog().hide();
} else {
shareLinkText.setEnabled(false);
shareLinkText.setAlpha(0.3f);
shareLinkImageView.setEnabled(false);
shareLinkImageView.setAlpha(0.3f);
sharePeopleText.setEnabled(false);
sharePeopleText.setAlpha(0.3f);
sharePeopleImageView.setEnabled(false);
sharePeopleImageView.setAlpha(0.3f);
}
}
// populate send apps
Intent sendIntent = IntentUtil.createSendIntent(requireContext(), file);
List<SendButtonData> sendButtonDataList = setupSendButtonData(sendIntent);
if ("off".equalsIgnoreCase(getContext().getString(R.string.send_files_to_other_apps))) {
sharePeopleText.setVisibility(View.GONE);
}
SendButtonAdapter.ClickListener clickListener = setupSendButtonClickListener(sendIntent);
RecyclerView sendButtonsView = view.findViewById(R.id.send_button_recycler_view);
sendButtonsView.setLayoutManager(new GridLayoutManager(getActivity(), 4));
sendButtonsView.setAdapter(new SendButtonAdapter(sendButtonDataList, clickListener));
return view;
}
Aggregations