|
@@ -1,22 +1,21 @@
|
|
|
-/**
|
|
|
- * ownCloud Android client application
|
|
|
+/*
|
|
|
+ * ownCloud Android client application
|
|
|
*
|
|
|
- * @author masensio
|
|
|
- * @author David A. Velasco
|
|
|
- * Copyright (C) 2015 ownCloud Inc.
|
|
|
+ * @author masensio
|
|
|
+ * @author David A. Velasco
|
|
|
+ * Copyright (C) 2015 ownCloud Inc.
|
|
|
*
|
|
|
- * This program is free software: you can redistribute it and/or modify
|
|
|
- * it under the terms of the GNU General Public License version 2,
|
|
|
- * as published by the Free Software Foundation.
|
|
|
+ * This program is free software: you can redistribute it and/or modify
|
|
|
+ * it under the terms of the GNU General Public License version 2,
|
|
|
+ * as published by the Free Software Foundation.
|
|
|
*
|
|
|
- * This program is distributed in the hope that it will be useful,
|
|
|
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
- * GNU General Public License for more details.
|
|
|
- *
|
|
|
- * You should have received a copy of the GNU General Public License
|
|
|
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
+ * This program is distributed in the hope that it will be useful,
|
|
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
+ * GNU General Public License for more details.
|
|
|
*
|
|
|
+ * You should have received a copy of the GNU General Public License
|
|
|
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
*/
|
|
|
|
|
|
package com.owncloud.android.ui.fragment;
|
|
@@ -83,7 +82,7 @@ public class EditShareFragment extends Fragment {
|
|
|
|
|
|
/** Listener for changes on privilege checkboxes */
|
|
|
private CompoundButton.OnCheckedChangeListener mOnPrivilegeChangeListener;
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* Public factory method to create new EditShareFragment instances.
|
|
|
*
|
|
@@ -116,7 +115,8 @@ public class EditShareFragment extends Fragment {
|
|
|
mAccount = getArguments().getParcelable(ARG_ACCOUNT);
|
|
|
}
|
|
|
|
|
|
- refreshCapabilitiesFromDB();
|
|
|
+ FileDataStorageManager storageManager = new FileDataStorageManager(mAccount, getContext().getContentResolver());
|
|
|
+ mCapabilities = storageManager.getCapability(mAccount.name);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -140,7 +140,7 @@ public class EditShareFragment extends Fragment {
|
|
|
// Inflate the layout for this fragment
|
|
|
View view = inflater.inflate(R.layout.edit_share_layout, container, false);
|
|
|
|
|
|
- ((TextView)view.findViewById(R.id.editShareTitle)).setText(
|
|
|
+ ((TextView) view.findViewById(R.id.editShareTitle)).setText(
|
|
|
getResources().getString(R.string.share_with_edit_title, mShare.getSharedWithDisplayName()));
|
|
|
|
|
|
View headerDivider = view.findViewById(R.id.share_header_divider);
|
|
@@ -159,9 +159,9 @@ public class EditShareFragment extends Fragment {
|
|
|
* instance ready to use. If not ready, does nothing.
|
|
|
*/
|
|
|
public void refreshCapabilitiesFromDB() {
|
|
|
- if(getActivity() instanceof FileActivity){
|
|
|
- FileActivity fileActivity = ((FileActivity)getActivity());
|
|
|
- if(fileActivity.getStorageManager() != null){
|
|
|
+ if (getActivity() instanceof FileActivity) {
|
|
|
+ FileActivity fileActivity = ((FileActivity) getActivity());
|
|
|
+ if (fileActivity.getStorageManager() != null) {
|
|
|
mCapabilities = fileActivity.getStorageManager().getCapability(mAccount.name);
|
|
|
}
|
|
|
}
|
|
@@ -189,7 +189,7 @@ public class EditShareFragment extends Fragment {
|
|
|
|
|
|
if (isFederated) {
|
|
|
shareSwitch.setVisibility(View.INVISIBLE);
|
|
|
- } else if(mCapabilities != null && mCapabilities.getFilesSharingResharing().isFalse()){
|
|
|
+ } else if (mCapabilities != null && mCapabilities.getFilesSharingResharing().isFalse()) {
|
|
|
shareSwitch.setVisibility(View.GONE);
|
|
|
}
|
|
|
|
|
@@ -285,7 +285,7 @@ public class EditShareFragment extends Fragment {
|
|
|
/// else, getView() cannot be NULL
|
|
|
|
|
|
CompoundButton subordinate;
|
|
|
- switch(compound.getId()) {
|
|
|
+ switch (compound.getId()) {
|
|
|
case R.id.canShareSwitch:
|
|
|
Log_OC.v(TAG, "canShareCheckBox toggled to " + isChecked);
|
|
|
updatePermissionsToShare();
|
|
@@ -304,7 +304,7 @@ public class EditShareFragment extends Fragment {
|
|
|
subordinate = (CompoundButton) getView().findViewById(sSubordinateCheckBoxIds[i]);
|
|
|
subordinate.setVisibility(View.VISIBLE);
|
|
|
if (!subordinate.isChecked() &&
|
|
|
- !mFile.isSharedWithMe()) { // see (1)
|
|
|
+ !mFile.isSharedWithMe()) { // see (1)
|
|
|
toggleDisablingListener(subordinate);
|
|
|
}
|
|
|
}
|
|
@@ -329,8 +329,8 @@ public class EditShareFragment extends Fragment {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(!(mFile.isFolder() && isChecked && mFile.isSharedWithMe()) // see (1)
|
|
|
- || isFederated ) {
|
|
|
+ if (!(mFile.isFolder() && isChecked && mFile.isSharedWithMe()) // see (1)
|
|
|
+ || isFederated) {
|
|
|
updatePermissionsToShare();
|
|
|
}
|
|
|
|
|
@@ -381,7 +381,7 @@ public class EditShareFragment extends Fragment {
|
|
|
}
|
|
|
} else {
|
|
|
boolean allDisabled = true;
|
|
|
- for (int i=0; allDisabled && i<sSubordinateCheckBoxIds.length; i++) {
|
|
|
+ for (int i = 0; allDisabled && i < sSubordinateCheckBoxIds.length; i++) {
|
|
|
allDisabled &=
|
|
|
sSubordinateCheckBoxIds[i] == subordinateCheckBoxView.getId() ||
|
|
|
!((CheckBox) getView().findViewById(sSubordinateCheckBoxIds[i])).isChecked()
|
|
@@ -389,7 +389,7 @@ public class EditShareFragment extends Fragment {
|
|
|
}
|
|
|
if (canEditCompound.isChecked() && allDisabled) {
|
|
|
toggleDisablingListener(canEditCompound);
|
|
|
- for (int i=0; i<sSubordinateCheckBoxIds.length; i++) {
|
|
|
+ for (int i = 0; i < sSubordinateCheckBoxIds.length; i++) {
|
|
|
getView().findViewById(sSubordinateCheckBoxIds[i]).setVisibility(View.GONE);
|
|
|
}
|
|
|
}
|