Skip to content

Commit

Permalink
File action menu icon changed and test case added.
Browse files Browse the repository at this point in the history
NMC-2131: Hide send-share menu from 3 dot menu and hide see details menu from Preview fragments.
  • Loading branch information
surinder-tsys committed Sep 3, 2024
1 parent 76a21c0 commit ed3fa56
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 9 deletions.
6 changes: 3 additions & 3 deletions app/src/main/java/com/nextcloud/ui/fileactions/FileAction.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ enum class FileAction(@IdRes val id: Int, @StringRes val title: Int, @DrawableRe

// generic file actions
EDIT(R.id.action_edit, R.string.action_edit, R.drawable.ic_edit),
SEE_DETAILS(R.id.action_see_details, R.string.actionbar_see_details, R.drawable.ic_information_outline),
SEE_DETAILS(R.id.action_see_details, R.string.actionbar_see_details, R.drawable.ic_share),
REMOVE_FILE(R.id.action_remove_file, R.string.common_remove, R.drawable.ic_delete),

// File moving
RENAME_FILE(R.id.action_rename_file, R.string.common_rename, R.drawable.ic_rename),
MOVE_OR_COPY(R.id.action_move_or_copy, R.string.actionbar_move_or_copy, R.drawable.ic_external),
MOVE_OR_COPY(R.id.action_move_or_copy, R.string.actionbar_move_or_copy, R.drawable.ic_content_copy),

// favorites
FAVORITE(R.id.action_favorite, R.string.favorite, R.drawable.ic_star),
UNSET_FAVORITE(R.id.action_unset_favorite, R.string.unset_favorite, R.drawable.ic_star_outline),

// Uploads and downloads
DOWNLOAD_FILE(R.id.action_download_file, R.string.filedetails_download, R.drawable.ic_cloud_download),
SYNC_FILE(R.id.action_sync_file, R.string.filedetails_sync_file, R.drawable.ic_cloud_sync_on),
SYNC_FILE(R.id.action_sync_file, R.string.filedetails_sync_file, R.drawable.ic_cloud_download),
CANCEL_SYNC(R.id.action_cancel_sync, R.string.common_cancel_sync, R.drawable.ic_cloud_sync_off),

// File sharing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -632,12 +632,13 @@ public void openActionsMenu(final int filesCount, final Set<OCFile> checkedFiles

List<Integer> toHide = new ArrayList<>();
if (isAPKorAAB(checkedFiles)) {
toHide.add(R.id.action_send_share_file);
toHide.add(R.id.action_export_file);
toHide.add(R.id.action_sync_file);
toHide.add(R.id.action_download_file);
}

// NMC: always hide the share menu because we have renamed another menu for sharing (NMC)
toHide.add(R.id.action_send_share_file);

FileActionsBottomSheet.newInstance(filesCount, checkedFiles, isOverflow, toHide)
.setResultListener(childFragmentManager, this, (id) -> {
onFileActionChosen(id, checkedFiles);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,9 @@ class PreviewImageFragment : FileFragment(), Injectable {
R.id.action_move_or_copy,
R.id.action_favorite,
R.id.action_unset_favorite,
R.id.action_pin_to_homescreen
R.id.action_pin_to_homescreen,
// hide this option for NMC
R.id.action_see_details
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,9 @@ class PreviewMediaActivity :
R.id.action_move_or_copy,
R.id.action_favorite,
R.id.action_unset_favorite,
R.id.action_pin_to_homescreen
R.id.action_pin_to_homescreen,
// hide this option for NMC
R.id.action_see_details
)

if (getFile() != null && getFile().isSharedWithMe && !getFile().canReshare()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,9 @@ class PreviewMediaFragment : FileFragment(), OnTouchListener, Injectable {
R.id.action_move_or_copy,
R.id.action_favorite,
R.id.action_unset_favorite,
R.id.action_pin_to_homescreen
R.id.action_pin_to_homescreen,
// hide this option for NMC
R.id.action_see_details
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,9 @@ private void showFileActions(OCFile file) {
R.id.action_move_or_copy,
R.id.action_favorite,
R.id.action_unset_favorite,
R.id.action_pin_to_homescreen
R.id.action_pin_to_homescreen,
//hide this option for NMC
R.id.action_see_details
));
if (getFile() != null && getFile().isSharedWithMe() && !getFile().canReshare()) {
additionalFilter.add(R.id.action_send_share_file);
Expand Down
17 changes: 17 additions & 0 deletions app/src/test/java/com/nmc/android/FileActionIconTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.nmc.android

import com.nextcloud.ui.fileactions.FileAction
import org.junit.Assert
import org.junit.Test
import com.owncloud.android.R

class FileActionIconTest {

@Test
fun verifyShareAndSyncFileIcon(){
val list = FileAction.SORTED_VALUES
Assert.assertEquals(R.drawable.ic_share,list[4].icon)
Assert.assertEquals(R.drawable.ic_content_copy,list[7].icon)
Assert.assertEquals(R.drawable.ic_cloud_download,list[8].icon)
}
}

0 comments on commit ed3fa56

Please sign in to comment.