|
@@ -188,20 +188,20 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
|
|
|
Log_OC.d(TAG, "onCreateView");
|
|
|
|
|
|
// use grey as fallback for elements where custom theming is not available
|
|
|
- if (ThemeUtils.themingEnabled()) {
|
|
|
+ if (ThemeUtils.themingEnabled(getContext())) {
|
|
|
getContext().getTheme().applyStyle(R.style.FallbackThemingTheme, true);
|
|
|
}
|
|
|
|
|
|
- int accentColor = ThemeUtils.primaryAccentColor();
|
|
|
+ int accentColor = ThemeUtils.primaryAccentColor(getContext());
|
|
|
|
|
|
// Inflate the layout for this fragment
|
|
|
View view = inflater.inflate(R.layout.share_file_layout, container, false);
|
|
|
|
|
|
// Setup layout
|
|
|
// Image
|
|
|
- ImageView icon = (ImageView) view.findViewById(R.id.shareFileIcon);
|
|
|
+ ImageView icon = view.findViewById(R.id.shareFileIcon);
|
|
|
icon.setImageDrawable(
|
|
|
- MimeTypeUtil.getFileTypeIcon(mFile.getMimetype(), mFile.getFileName(), mAccount)
|
|
|
+ MimeTypeUtil.getFileTypeIcon(mFile.getMimetype(), mFile.getFileName(), mAccount, getContext())
|
|
|
);
|
|
|
if (MimeTypeUtil.isImage(mFile)) {
|
|
|
String remoteId = String.valueOf(mFile.getRemoteId());
|
|
@@ -212,18 +212,19 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
|
|
|
}
|
|
|
|
|
|
// Title
|
|
|
- TextView title = (TextView) view.findViewById(R.id.shareWithUsersSectionTitle);
|
|
|
+ TextView title = view.findViewById(R.id.shareWithUsersSectionTitle);
|
|
|
title.setTextColor(accentColor);
|
|
|
|
|
|
// Name
|
|
|
- TextView fileNameHeader = (TextView) view.findViewById(R.id.shareFileName);
|
|
|
+ TextView fileNameHeader = view.findViewById(R.id.shareFileName);
|
|
|
fileNameHeader.setText(getResources().getString(R.string.share_file, mFile.getFileName()));
|
|
|
|
|
|
View headerDivider = view.findViewById(R.id.share_header_divider);
|
|
|
- headerDivider.getBackground().setColorFilter(ThemeUtils.primaryAccentColor(), PorterDuff.Mode.SRC_ATOP);
|
|
|
+ headerDivider.getBackground().setColorFilter(ThemeUtils.primaryAccentColor(getContext()),
|
|
|
+ PorterDuff.Mode.SRC_ATOP);
|
|
|
|
|
|
// Size
|
|
|
- TextView size = (TextView) view.findViewById(R.id.shareFileSize);
|
|
|
+ TextView size = view.findViewById(R.id.shareFileSize);
|
|
|
if (mFile.isFolder()) {
|
|
|
size.setVisibility(View.GONE);
|
|
|
} else {
|
|
@@ -231,7 +232,7 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
|
|
|
}
|
|
|
|
|
|
// Add User Button
|
|
|
- Button addUserGroupButton = (Button) view.findViewById(R.id.addUserButton);
|
|
|
+ Button addUserGroupButton = view.findViewById(R.id.addUserButton);
|
|
|
addUserGroupButton.getBackground().setColorFilter(accentColor, PorterDuff.Mode.SRC_ATOP);
|
|
|
addUserGroupButton.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
@@ -280,8 +281,8 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
|
|
|
*/
|
|
|
private void initShareViaLinkListener(View shareView) {
|
|
|
mOnShareViaLinkSwitchCheckedChangeListener = new OnShareViaLinkListener();
|
|
|
- SwitchCompat shareViaLinkSwitch = (SwitchCompat) shareView.findViewById(R.id.shareViaLinkSectionSwitch);
|
|
|
- ThemeUtils.tintSwitch(shareViaLinkSwitch, ThemeUtils.primaryAccentColor(), true);
|
|
|
+ SwitchCompat shareViaLinkSwitch = shareView.findViewById(R.id.shareViaLinkSectionSwitch);
|
|
|
+ ThemeUtils.tintSwitch(shareViaLinkSwitch, ThemeUtils.primaryAccentColor(getContext()), true);
|
|
|
shareViaLinkSwitch.setOnCheckedChangeListener(mOnShareViaLinkSwitchCheckedChangeListener);
|
|
|
}
|
|
|
|
|
@@ -342,10 +343,10 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
|
|
|
private void initExpirationListener(View shareView) {
|
|
|
mOnExpirationDateInteractionListener = new OnExpirationDateInteractionListener();
|
|
|
|
|
|
- SwitchCompat expirationSwitch = (SwitchCompat) shareView.findViewById(R.id.shareViaLinkExpirationSwitch);
|
|
|
+ SwitchCompat expirationSwitch = shareView.findViewById(R.id.shareViaLinkExpirationSwitch);
|
|
|
expirationSwitch.setOnCheckedChangeListener(mOnExpirationDateInteractionListener);
|
|
|
|
|
|
- ThemeUtils.tintSwitch(expirationSwitch, ThemeUtils.primaryAccentColor());
|
|
|
+ ThemeUtils.tintSwitch(expirationSwitch, ThemeUtils.primaryAccentColor(getContext()));
|
|
|
|
|
|
shareView.findViewById(R.id.shareViaLinkExpirationLabel).
|
|
|
setOnClickListener(mOnExpirationDateInteractionListener);
|
|
@@ -422,9 +423,9 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
|
|
|
private void initPasswordListener(View shareView) {
|
|
|
mOnPasswordInteractionListener = new OnPasswordInteractionListener();
|
|
|
|
|
|
- SwitchCompat passwordSwitch = (SwitchCompat) shareView.findViewById(R.id.shareViaLinkPasswordSwitch);
|
|
|
+ SwitchCompat passwordSwitch = shareView.findViewById(R.id.shareViaLinkPasswordSwitch);
|
|
|
passwordSwitch.setOnCheckedChangeListener(mOnPasswordInteractionListener);
|
|
|
- ThemeUtils.tintSwitch(passwordSwitch, ThemeUtils.primaryAccentColor());
|
|
|
+ ThemeUtils.tintSwitch(passwordSwitch, ThemeUtils.primaryAccentColor(getContext()));
|
|
|
|
|
|
shareView.findViewById(R.id.shareViaLinkPasswordLabel).setOnClickListener(mOnPasswordInteractionListener);
|
|
|
|
|
@@ -487,9 +488,9 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
|
|
|
private void initEditPermissionListener(View shareView) {
|
|
|
mOnEditPermissionInteractionListener = new OnEditPermissionInteractionListener();
|
|
|
|
|
|
- SwitchCompat permissionSwitch = (SwitchCompat) shareView.findViewById(R.id.shareViaLinkEditPermissionSwitch);
|
|
|
+ SwitchCompat permissionSwitch = shareView.findViewById(R.id.shareViaLinkEditPermissionSwitch);
|
|
|
permissionSwitch.setOnCheckedChangeListener(mOnEditPermissionInteractionListener);
|
|
|
- ThemeUtils.tintSwitch(permissionSwitch, ThemeUtils.primaryAccentColor());
|
|
|
+ ThemeUtils.tintSwitch(permissionSwitch, ThemeUtils.primaryAccentColor(getContext()));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -501,9 +502,9 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
|
|
|
private void initHideFileListingListener(View shareView) {
|
|
|
mOnHideFileListingPermissionInteractionListener = new OnHideFileListingPermissionInteractionListener();
|
|
|
|
|
|
- SwitchCompat permissionSwitch = (SwitchCompat) shareView.findViewById(R.id.shareViaLinkFileListingPermissionSwitch);
|
|
|
+ SwitchCompat permissionSwitch = shareView.findViewById(R.id.shareViaLinkFileListingPermissionSwitch);
|
|
|
permissionSwitch.setOnCheckedChangeListener(mOnHideFileListingPermissionInteractionListener);
|
|
|
- ThemeUtils.tintSwitch(permissionSwitch, ThemeUtils.primaryAccentColor());
|
|
|
+ ThemeUtils.tintSwitch(permissionSwitch, ThemeUtils.primaryAccentColor(getContext()));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -654,8 +655,8 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
|
|
|
);
|
|
|
|
|
|
// Show data
|
|
|
- TextView noShares = (TextView) getView().findViewById(R.id.shareNoUsers);
|
|
|
- ListView usersList = (ListView) getView().findViewById(R.id.shareUsersList);
|
|
|
+ TextView noShares = getView().findViewById(R.id.shareNoUsers);
|
|
|
+ ListView usersList = getView().findViewById(R.id.shareUsersList);
|
|
|
|
|
|
if (mPrivateShares.size() > 0) {
|
|
|
noShares.setVisibility(View.GONE);
|
|
@@ -668,7 +669,7 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
|
|
|
}
|
|
|
|
|
|
// Set Scroll to initial position
|
|
|
- ScrollView scrollView = (ScrollView) getView().findViewById(R.id.shareScroll);
|
|
|
+ ScrollView scrollView = getView().findViewById(R.id.shareScroll);
|
|
|
scrollView.scrollTo(0, 0);
|
|
|
}
|
|
|
|
|
@@ -747,7 +748,8 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
|
|
|
|
|
|
// GetLink button
|
|
|
AppCompatButton getLinkButton = getGetLinkButton();
|
|
|
- getLinkButton.getBackground().setColorFilter(ThemeUtils.primaryAccentColor(), PorterDuff.Mode.SRC_ATOP);
|
|
|
+ getLinkButton.getBackground().setColorFilter(ThemeUtils.primaryAccentColor(getContext()),
|
|
|
+ PorterDuff.Mode.SRC_ATOP);
|
|
|
getLinkButton.setVisibility(View.VISIBLE);
|
|
|
getLinkButton.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
@@ -958,8 +960,8 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
|
|
|
* @param view share file view
|
|
|
*/
|
|
|
private void hideNotEnabledShareSections(View view) {
|
|
|
- LinearLayout shareWithUsersSection = (LinearLayout) view.findViewById(R.id.shareWithUsersSection);
|
|
|
- LinearLayout shareViaLinkSection = (LinearLayout) view.findViewById(R.id.shareViaLinkSection);
|
|
|
+ LinearLayout shareWithUsersSection = view.findViewById(R.id.shareWithUsersSection);
|
|
|
+ LinearLayout shareViaLinkSection = view.findViewById(R.id.shareViaLinkSection);
|
|
|
|
|
|
boolean shareViaLinkAllowed = getActivity().getResources().getBoolean(R.bool.share_via_link_feature);
|
|
|
boolean shareWithUsersAllowed = getActivity().getResources().getBoolean(R.bool.share_with_users_feature);
|