Przeglądaj źródła

Reduce lint

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
tobiasKaminsky 3 lat temu
rodzic
commit
891146eb8a

+ 0 - 33
src/main/java/com/owncloud/android/ui/fragment/util/SharingMenuHelper.java

@@ -32,8 +32,6 @@ import com.owncloud.android.lib.resources.shares.OCShare;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
-import androidx.annotation.VisibleForTesting;
-
 import static com.owncloud.android.lib.resources.shares.OCShare.CREATE_PERMISSION_FLAG;
 import static com.owncloud.android.lib.resources.shares.OCShare.MAXIMUM_PERMISSIONS_FOR_FILE;
 import static com.owncloud.android.lib.resources.shares.OCShare.MAXIMUM_PERMISSIONS_FOR_FOLDER;
@@ -50,30 +48,6 @@ public final class SharingMenuHelper {
         // utility class -> private constructor
     }
 
-    /**
-     * Sets checked/visiblity state on the given {@link MenuItem} based on the given criteria.
-     *
-     * @param fileListing            the {@link MenuItem} to be setup
-     * @param isFolder               flag if it is a folder
-     * @param isEditingAllowed       flag if editing is allowed
-     * @param publicSharePermissions share permissions of the link
-     */
-    public static void setupHideFileListingMenuItem(MenuItem fileListing,
-                                                    boolean isFolder,
-                                                    boolean isEditingAllowed,
-                                                    int publicSharePermissions) {
-        if (!isFolder) {
-            fileListing.setVisible(false);
-        } else {
-            if (isEditingAllowed) {
-                boolean readOnly = (publicSharePermissions & OCShare.READ_PERMISSION_FLAG) != 0;
-                fileListing.setChecked(!readOnly);
-            } else {
-                fileListing.setVisible(false);
-            }
-        }
-    }
-
     /**
      * Sets checked/visibility state on the given {@link MenuItem} based on the given criteria.
      *
@@ -122,7 +96,6 @@ public final class SharingMenuHelper {
         }
     }
 
-    @VisibleForTesting
     public static boolean isUploadAndEditingAllowed(OCShare share) {
         if (share.getPermissions() == NO_PERMISSION) {
             return false;
@@ -133,7 +106,6 @@ public final class SharingMenuHelper {
             MAXIMUM_PERMISSIONS_FOR_FILE);
     }
 
-    @VisibleForTesting
     public static boolean isReadOnly(OCShare share) {
         if (share.getPermissions() == NO_PERMISSION) {
             return false;
@@ -142,7 +114,6 @@ public final class SharingMenuHelper {
         return (share.getPermissions() & ~SHARE_PERMISSION_FLAG) == READ_PERMISSION_FLAG;
     }
 
-    @VisibleForTesting
     public static boolean isFileDrop(OCShare share) {
         if (share.getPermissions() == NO_PERMISSION) {
             return false;
@@ -165,10 +136,6 @@ public final class SharingMenuHelper {
     /**
      * method to get the current checked index from the list of permissions
      *
-     * @param context
-     * @param share
-     * @param permissionArray
-     * @return
      */
     public static int getPermissionCheckedItem(Context context, OCShare share, String[] permissionArray) {
         if (SharingMenuHelper.isUploadAndEditingAllowed(share)) {

+ 0 - 71
src/main/res/menu/fragment_file_detail_sharing_email_link.xml

@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?><!--
-  Nextcloud Android client application
-  @author TSI-mc
-
-  Copyright (C) 2018 Andy Scherzinger
-  Copyright (C) 2021 TSI-mc
-
-  This program is free software; you can redistribute it and/or
-  modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
-  License as published by the Free Software Foundation; either
-  version 3 of the License, or any later version.
-
-  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 AFFERO GENERAL PUBLIC LICENSE for more details.
-
-  You should have received a copy of the GNU Affero General Public
-  License along with this program.  If not, see <http://www.gnu.org/licenses/>.
--->
-<menu xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    xmlns:tools="http://schemas.android.com/tools"
-    tools:ignore="AppCompatResource">
-    <group
-        android:id="@+id/folder_permission"
-        android:checkableBehavior="single">
-        <item
-            android:id="@+id/link_share_read_only"
-            android:title="@string/link_share_read_only" />
-        <item
-            android:id="@+id/link_share_allow_upload_and_editing"
-            android:title="@string/link_share_allow_upload_and_editing" />
-        <item
-            android:id="@+id/link_share_file_drop"
-            android:title="@string/link_share_file_drop" />
-    </group>
-    <item
-        android:id="@+id/allow_editing"
-        android:checkable="true"
-        android:showAsAction="never"
-        android:title="@string/allow_editing"
-        android:visible="false"
-        app:showAsAction="never" />
-    <item
-        android:id="@+id/action_hide_file_download"
-        android:checkable="true"
-        android:showAsAction="never"
-        android:title="@string/share_via_link_hide_download"
-        app:showAsAction="never" />
-    <item
-        android:id="@+id/action_password"
-        android:showAsAction="never"
-        android:title="@string/share_via_link_menu_password_label"
-        app:showAsAction="never" />
-    <item
-        android:id="@+id/action_share_expiration_date"
-        android:showAsAction="never"
-        android:title="@string/share_expiration_date_label"
-        app:showAsAction="never" />
-    <item
-        android:id="@+id/action_share_send_note"
-        android:showAsAction="never"
-        android:title="@string/share_send_note"
-        app:showAsAction="never" />
-    <item
-        android:id="@+id/action_unshare"
-        android:showAsAction="never"
-        android:title="@string/unshare"
-        app:showAsAction="never" />
-</menu>

+ 0 - 87
src/main/res/menu/fragment_file_detail_sharing_public_link.xml

@@ -1,87 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?><!--
-  Nextcloud Android client application
-
-  @author TSI-mc
-
-  Copyright (C) 2018 Andy Scherzinger
-  Copyright (C) 2021 TSI-mc
-
-  This program is free software; you can redistribute it and/or
-  modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
-  License as published by the Free Software Foundation; either
-  version 3 of the License, or any later version.
-
-  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 AFFERO GENERAL PUBLIC LICENSE for more details.
-
-  You should have received a copy of the GNU Affero General Public
-  License along with this program.  If not, see <http://www.gnu.org/licenses/>.
--->
-<menu xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    xmlns:tools="http://schemas.android.com/tools"
-    tools:ignore="AppCompatResource">
-    <group
-        android:id="@+id/folder_permission"
-        android:checkableBehavior="single">
-        <item
-            android:id="@+id/link_share_read_only"
-            android:title="@string/link_share_read_only" />
-        <item
-            android:id="@+id/link_share_allow_upload_and_editing"
-            android:title="@string/link_share_allow_upload_and_editing" />
-        <item
-            android:id="@+id/link_share_file_drop"
-            android:title="@string/link_share_file_drop" />
-    </group>
-    <item
-        android:id="@+id/allow_editing"
-        android:checkable="true"
-        android:showAsAction="never"
-        android:visible="false"
-        android:title="@string/allow_editing"
-        app:showAsAction="never" />
-    <item
-        android:id="@+id/action_hide_file_download"
-        android:checkable="true"
-        android:showAsAction="never"
-        android:title="@string/share_via_link_hide_download"
-        app:showAsAction="never" />
-    <item
-        android:id="@+id/action_password"
-        android:showAsAction="never"
-        android:title="@string/share_via_link_menu_password_label"
-        app:showAsAction="never" />
-    <item
-        android:id="@+id/action_share_expiration_date"
-        android:showAsAction="never"
-        android:title="@string/share_expiration_date_label"
-        app:showAsAction="never" />
-    <item
-        android:id="@+id/action_share_send_link"
-        android:showAsAction="never"
-        android:title="@string/share_via_link_send_link_label"
-        app:showAsAction="never" />
-    <item
-        android:id="@+id/action_share_send_note"
-        android:showAsAction="never"
-        android:title="@string/share_send_note"
-        app:showAsAction="never" />
-    <item
-        android:id="@+id/action_edit_label"
-        android:showAsAction="never"
-        android:title="@string/edit_label"
-        app:showAsAction="never" />
-    <item
-        android:id="@+id/action_unshare"
-        android:showAsAction="never"
-        android:title="@string/unshare"
-        app:showAsAction="never" />
-    <item
-        android:id="@+id/action_add_another_public_share_link"
-        android:showAsAction="never"
-        android:title="@string/add_another_public_share_link"
-        app:showAsAction="never" />
-</menu>

+ 0 - 85
src/main/res/menu/item_user_sharing_settings.xml

@@ -1,85 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  Nesxtcloud Android client application
-
-  @author TSI-mc
-
-  Copyright (C) 2018 Andy Scherzinger
-  Copyright (C) 2021 TSI-mc
-
-  This program is free software; you can redistribute it and/or
-  modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
-  License as published by the Free Software Foundation; either
-  version 3 of the License, or any later version.
-
-  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 AFFERO GENERAL PUBLIC LICENSE for more details.
-
-  You should have received a copy of the GNU Affero General Public
-  License along with this program.  If not, see <http://www.gnu.org/licenses/>.
--->
-<menu xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    xmlns:tools="http://schemas.android.com/tools"
-    tools:ignore="AppCompatResource">
-    <group
-        android:id="@+id/folder_permission"
-        android:checkableBehavior="single">
-        <item
-            android:id="@+id/link_share_read_only"
-            android:title="@string/link_share_read_only" />
-        <item
-            android:id="@+id/link_share_allow_upload_and_editing"
-            android:title="@string/link_share_allow_upload_and_editing" />
-        <item
-            android:id="@+id/link_share_file_drop"
-            android:title="@string/link_share_file_drop" />
-    </group>
-
-    <item
-        android:id="@+id/allow_editing"
-        android:checkable="true"
-        android:showAsAction="never"
-        android:visible="false"
-        android:title="@string/allow_editing"
-        app:showAsAction="never" />
-
-    <item
-        android:id="@+id/allow_creating"
-        android:checkable="true"
-        android:showAsAction="never"
-        android:visible="false"
-        android:title="@string/allow_creating"
-        app:showAsAction="never" />
-    <item
-        android:id="@+id/allow_deleting"
-        android:checkable="true"
-        android:showAsAction="never"
-        android:visible="false"
-        android:title="@string/allow_deleting"
-        app:showAsAction="never" />
-
-    <item
-        android:id="@+id/allow_resharing"
-        android:checkable="true"
-        android:showAsAction="never"
-        android:title="@string/allow_resharing"
-        app:showAsAction="never" />
-    <item
-        android:id="@+id/action_expiration_date"
-        android:showAsAction="never"
-        android:title="@string/share_expiration_date_label"
-        app:showAsAction="never" />
-    <item
-        android:id="@+id/action_share_send_note"
-        android:showAsAction="never"
-        android:title="@string/share_send_note"
-        app:showAsAction="never" />
-    <item
-        android:id="@+id/action_unshare"
-        android:showAsAction="never"
-        android:title="@string/share_privilege_unshare"
-        app:showAsAction="never" />
-</menu>

+ 0 - 10
src/main/res/values/strings.xml

@@ -453,7 +453,6 @@
 
     <string name="share_dialog_title">Sharing</string>
     <string name="share_file">Share %1$s</string>
-    <string name="share_via_link_menu_password_label">Password protect (%1$s)</string>
     <string name="share_expiration_date_label">Expires %1$s</string>
     <string name="share_expiration_date_format">%1$s</string>
     <string name="share_no_expiration_date_label">Set expiration date</string>
@@ -471,8 +470,6 @@
     <string name="share_room_clarification">%1$s (conversation)</string>
     <string name="share_known_remote_on_clarification">on %1$s</string>
 
-    <string name="share_privilege_unshare">Unshare</string>
-
     <string name="action_clear_failed_uploads">Clear failed uploads</string>
 
     <string name="action_switch_grid_view">Grid view</string>
@@ -912,15 +909,10 @@
     <string name="qr_could_not_be_read">QR code could not be read!</string>
     <string name="note_icon_hint">Note icon</string>
     <string name="add_another_public_share_link">Add another link</string>
-    <string name="unshare">Unshare</string>
-    <string name="allow_editing">Allow editing</string>
     <string name="add_new_public_share">Add new public share link</string>
-    <string name="edit_label">Change name</string>
     <string name="public_share_name">New name</string>
     <string name="share_link_with_label">Share link (%1$s)</string>
     <string name="share_link">Share link</string>
-    <string name="allow_creating">Allow creating</string>
-    <string name="allow_deleting">Allow deleting</string>
     <string name="allow_resharing">Allow resharing</string>
     <string name="link_share_read_only">Read only</string>
     <string name="link_share_editing">Editing</string>
@@ -970,12 +962,10 @@
     <string name="common_next">Next</string>
     <string name="send_share">Send Share</string>
     <string name="no_share_permission_selected">Please select at least one permission to share.</string>
-    <string name="share_link_empty_exp_date">You must select expiration date.</string>
     <string name="share_link_empty_note_message">Please enter note.</string>
     <string name="share_copy_link">Share &amp; Copy Link</string>
     <string name="set_note">Set Note</string>
     <string name="share_open_in">Open in…</string>
-    <string name="share_advanced_permissions">Advanced permissions</string>
     <string name="share_send_new_email">Send new email</string>
     <string name="link_name">Link Name</string>
     <string name="delete_link">Delete Link</string>