Skip to content

Commit ce5817a

Browse files
committed
add custom permissions to bottom sheet
Signed-off-by: alperozturk <alper_ozturk@proton.me>
1 parent 933cbcb commit ce5817a

3 files changed

Lines changed: 17 additions & 24 deletions

File tree

app/src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -692,8 +692,8 @@ public void onQuickPermissionChanged(OCShare share, int permission) {
692692
}
693693

694694
@Override
695-
public void openShareDetails(OCShare share) {
696-
modifyExistingShare(share, FileDetailsSharingProcessFragment.SCREEN_TYPE_CUSTOM_PERMISSION);
695+
public void openShareDetail(OCShare share) {
696+
modifyExistingShare(share, FileDetailsSharingProcessFragment.SCREEN_TYPE_PERMISSION);
697697
}
698698

699699
//launcher for contact permission

app/src/main/java/com/owncloud/android/ui/fragment/FileDetailsSharingProcessFragment.kt

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ class FileDetailsSharingProcessFragment :
7171
// types of screens to be displayed
7272
const val SCREEN_TYPE_PERMISSION = 1 // permissions screen
7373
const val SCREEN_TYPE_NOTE = 2 // note screen
74-
const val SCREEN_TYPE_CUSTOM_PERMISSION = 3 // custom permissions screen
75-
7674

7775
/**
7876
* fragment instance to be called while creating new share for internal and external share
@@ -189,11 +187,7 @@ class FileDetailsSharingProcessFragment :
189187

190188
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
191189
super.onViewCreated(view, savedInstanceState)
192-
if (shareProcessStep == SCREEN_TYPE_PERMISSION || shareProcessStep == SCREEN_TYPE_CUSTOM_PERMISSION) {
193-
if (shareProcessStep == SCREEN_TYPE_CUSTOM_PERMISSION) {
194-
binding.customPermissionRadioButton.isChecked = true
195-
}
196-
190+
if (shareProcessStep == SCREEN_TYPE_PERMISSION) {
197191
showShareProcessFirst()
198192
} else {
199193
showShareProcessSecond()
@@ -295,16 +289,18 @@ class FileDetailsSharingProcessFragment :
295289
if (share?.isFolder == true) updateViewForFolder() else updateViewForFile()
296290

297291
// custom permissions / read only / allow upload and editing / file drop
298-
if (sharePermissionManager.isCustomPermission(share)) {
299-
binding.customPermissionRadioButton.isChecked = true
300-
binding.customPermissionLayout.setVisibilityWithAnimation(true)
301-
} else if (SharingMenuHelper.isUploadAndEditingAllowed(share)) {
302-
binding.editingRadioButton.isChecked = true
303-
} else if (SharingMenuHelper.isFileDrop(share) && share?.isFolder == true) {
304-
binding.fileDropRadioButton.isChecked = true
305-
} else if (SharingMenuHelper.isReadOnly(share)) {
306-
binding.viewOnlyRadioButton.isChecked = true
307-
} // TODO:
292+
binding.run {
293+
if (sharePermissionManager.isCustomPermission(share)) {
294+
customPermissionRadioButton.isChecked = true
295+
customPermissionLayout.setVisibilityWithAnimation(true)
296+
} else if (SharingMenuHelper.isUploadAndEditingAllowed(share)) {
297+
editingRadioButton.isChecked = true
298+
} else if (SharingMenuHelper.isFileDrop(share) && share?.isFolder == true) {
299+
fileDropRadioButton.isChecked = true
300+
} else if (SharingMenuHelper.isReadOnly(share)) {
301+
viewOnlyRadioButton.isChecked = true
302+
}
303+
}
308304

309305
shareType = share?.shareType ?: ShareType.NO_SHARED
310306

app/src/main/java/com/owncloud/android/ui/fragment/QuickSharingPermissionsBottomSheetDialog.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,9 @@
3232
import androidx.recyclerview.widget.LinearLayoutManager;
3333

3434
import static com.owncloud.android.lib.resources.shares.OCShare.CREATE_PERMISSION_FLAG;
35-
import static com.owncloud.android.lib.resources.shares.OCShare.DELETE_PERMISSION_FLAG;
3635
import static com.owncloud.android.lib.resources.shares.OCShare.MAXIMUM_PERMISSIONS_FOR_FILE;
3736
import static com.owncloud.android.lib.resources.shares.OCShare.MAXIMUM_PERMISSIONS_FOR_FOLDER;
3837
import static com.owncloud.android.lib.resources.shares.OCShare.READ_PERMISSION_FLAG;
39-
import static com.owncloud.android.lib.resources.shares.OCShare.SHARE_PERMISSION_FLAG;
40-
import static com.owncloud.android.lib.resources.shares.OCShare.UPDATE_PERMISSION_FLAG;
4138

4239
/**
4340
* File Details Quick Sharing permissions options {@link Dialog} styled as a bottom sheet for main actions.
@@ -119,7 +116,7 @@ private void handlePermissionChanged(List<QuickPermissionModel> quickPermissionM
119116
permissionFlag = CREATE_PERMISSION_FLAG + READ_PERMISSION_FLAG;
120117
} else if (permissionName.equalsIgnoreCase(res.getString(R.string.share_custom_permission))) {
121118
dismiss();
122-
actions.openShareDetails(ocShare);
119+
actions.openShareDetail(ocShare);
123120
return;
124121
}
125122

@@ -155,6 +152,6 @@ protected void onStop() {
155152

156153
public interface QuickPermissionSharingBottomSheetActions {
157154
void onQuickPermissionChanged(OCShare share, int permission);
158-
void openShareDetails(OCShare share);
155+
void openShareDetail(OCShare share);
159156
}
160157
}

0 commit comments

Comments
 (0)