Procházet zdrojové kódy

Add comments and rename vars

jabarros před 9 roky
rodič
revize
bf0af8e3a6

+ 1 - 1
res/values/setup.xml

@@ -24,7 +24,7 @@
     
     <!-- Flags to enable/disable some features -->
     <string name = "send_files_to_other_apps">on</string>
-    <string name = "share_by_link_feature">on</string>
+    <string name = "share_via_link_feature">on</string>
     <string name = "share_with_users_feature">on</string>
     
     

+ 3 - 3
src/com/owncloud/android/files/FileMenuFilter.java

@@ -181,8 +181,8 @@ public class FileMenuFilter {
         }
 
         // SHARE FILE
-        boolean shareByLinkAllowed = (mContext != null  &&
-                mContext.getString(R.string.share_by_link_feature).equalsIgnoreCase("on"));
+        boolean shareViaLinkAllowed = (mContext != null  &&
+                mContext.getString(R.string.share_via_link_feature).equalsIgnoreCase("on"));
         boolean shareWithUsersAllowed = (mContext != null  &&
                 mContext.getString(R.string.share_with_users_feature).equalsIgnoreCase("on"));
 
@@ -191,7 +191,7 @@ public class FileMenuFilter {
                 (capability.getFilesSharingApiEnabled().isTrue() ||
                         capability.getFilesSharingApiEnabled().isUnknown()
                 );
-        if ((!shareByLinkAllowed && !shareWithUsersAllowed) ||  mFile == null || !shareApiEnabled) {
+        if ((!shareViaLinkAllowed && !shareWithUsersAllowed) ||  mFile == null || !shareApiEnabled) {
             toHide.add(R.id.action_share_file);
         } else {
             toShow.add(R.id.action_share_file);

+ 14 - 9
src/com/owncloud/android/ui/fragment/ShareFileFragment.java

@@ -213,9 +213,6 @@ public class ShareFileFragment extends Fragment
             size.setText(DisplayUtils.bytesToHumanReadable(mFile.getFileLength()));
         }
 
-        // Check which share sections are allowed to be shown
-        showShareSections(view);
-
         //  Add User Button
         Button addUserGroupButton = (Button)
                 view.findViewById(R.id.addUserButton);
@@ -245,6 +242,9 @@ public class ShareFileFragment extends Fragment
         // Set listener for user actions on edit permission
         initEditPermissionListener(view);
 
+        // Hide share features sections that are not enabled
+        hideNotEnabledShareSections(view);
+
         return view;
     }
 
@@ -860,21 +860,26 @@ public class ShareFileFragment extends Fragment
         dialog.show(getFragmentManager(), SharePasswordDialogFragment.PASSWORD_FRAGMENT);
     }
 
-    private void showShareSections(View shareView) {
-        LinearLayout shareWithUsersSection = (LinearLayout) shareView.findViewById(R.id.shareWithUsersSection);
-        LinearLayout shareViaLinkSection = (LinearLayout) shareView.findViewById(R.id.shareViaLinkSection);
+    /**
+     * Hide share features sections that are not enabled
+     * @param view
+     */
+    private void hideNotEnabledShareSections(View view) {
+        LinearLayout shareWithUsersSection = (LinearLayout) view.findViewById(R.id.shareWithUsersSection);
+        LinearLayout shareViaLinkSection = (LinearLayout) view.findViewById(R.id.shareViaLinkSection);
 
-        boolean shareByLinkAllowed = getActivity().getString(R.string.share_by_link_feature).equalsIgnoreCase("on");
+        boolean shareViaLinkAllowed = getActivity().getString(R.string.share_via_link_feature).equalsIgnoreCase("on");
         boolean shareWithUsersAllowed = getActivity().getString(R.string.share_with_users_feature).equalsIgnoreCase("on");
 
-        if (!shareByLinkAllowed) {
+        // Hide share via link section if it is not enabled
+        if (!shareViaLinkAllowed) {
             shareViaLinkSection.setVisibility(View.GONE);
         }
 
+        // Hide share with users section if it is not enabled
         if (!shareWithUsersAllowed) {
             shareWithUsersSection.setVisibility(View.GONE);
         }
-
     }
 
 }