From 437c160b42b6685f7eef83f331d2deab5f8066ed Mon Sep 17 00:00:00 2001 From: A117870935 Date: Mon, 8 May 2023 16:13:41 +0530 Subject: [PATCH] Master rebased and AutoUpload icon changes in file detail fragment. --- .../datamodel/SyncedFolderProvider.java | 42 ------------------- .../android/ui/activity/ShareActivity.java | 3 -- .../ui/fragment/FileDetailFragment.java | 18 ++++---- 3 files changed, 8 insertions(+), 55 deletions(-) diff --git a/app/src/main/java/com/owncloud/android/datamodel/SyncedFolderProvider.java b/app/src/main/java/com/owncloud/android/datamodel/SyncedFolderProvider.java index 803f8c8aa380..3a57dd2b8781 100644 --- a/app/src/main/java/com/owncloud/android/datamodel/SyncedFolderProvider.java +++ b/app/src/main/java/com/owncloud/android/datamodel/SyncedFolderProvider.java @@ -218,48 +218,6 @@ public SyncedFolder findByLocalPathAndAccount(String localPath, User user) { } - /** - * method to check if sync folder for the remote path exist in table or not - * @param remotePath to be check - * @param user for which we are looking - * @return - */ - public boolean findByRemotePathAndAccount(String remotePath, User user) { - boolean result = false; - - //if path ends with / then remove the last / to work the query right way - //because the sub folders of synced folders will not have the slash at the end - if(remotePath.endsWith("/")){ - remotePath = remotePath.substring(0, remotePath.length()-1); - } - - Cursor cursor = mContentResolver.query( - ProviderMeta.ProviderTableMeta.CONTENT_URI_SYNCED_FOLDERS, - null, - ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_REMOTE_PATH + " LIKE ? AND " + - ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_ACCOUNT + " =? ", - new String[]{"%"+remotePath + "%", user.getAccountName()}, - null); - - if (cursor != null && cursor.getCount() >= 1) { - result = true; - } else { - if (cursor == null) { - Log_OC.e(TAG, "Sync folder db cursor for remote path = " + remotePath + " in NULL."); - } else { - Log_OC.e(TAG, cursor.getCount() + " items for remote path = " + remotePath - + " available in sync folder db. Expected 1 or greater than 1. Failed to update sync folder db."); - } - } - - if (cursor != null) { - cursor.close(); - } - - return result; - - } - /** * Delete all synced folders for an account * diff --git a/app/src/main/java/com/owncloud/android/ui/activity/ShareActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/ShareActivity.java index de4adc4f1ff2..6935f28b0019 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/ShareActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/ShareActivity.java @@ -26,8 +26,6 @@ import android.os.Bundle; import com.nextcloud.client.account.User; -import com.nextcloud.client.core.Clock; -import com.nextcloud.client.preferences.AppPreferences; import com.nextcloud.java.util.Optional; import com.owncloud.android.R; import com.owncloud.android.databinding.ShareActivityBinding; @@ -69,7 +67,6 @@ protected void onCreate(Bundle savedInstanceState) { ShareActivityBinding binding = ShareActivityBinding.inflate(getLayoutInflater()); setContentView(binding.getRoot()); - syncedFolderProvider = new SyncedFolderProvider(getContentResolver(), appPreferences, clock); OCFile file = getFile(); Optional optionalUser = getUser(); diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java index 91055f31adbb..b85499d2719a 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java @@ -44,15 +44,13 @@ import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.nextcloud.client.account.User; import com.nextcloud.client.account.UserAccountManager; -import com.nextcloud.client.core.Clock; -import com.nextcloud.client.device.DeviceInfo; import com.nextcloud.client.di.Injectable; import com.nextcloud.client.jobs.BackgroundJobManager; import com.nextcloud.client.network.ClientFactory; import com.nextcloud.client.network.ConnectivityService; import com.nextcloud.client.preferences.AppPreferences; -import com.nextcloud.ui.fileactions.FileActionsBottomSheet; import com.nextcloud.utils.EditorUtils; +import com.nextcloud.ui.fileactions.FileActionsBottomSheet; import com.nextcloud.utils.MenuUtils; import com.owncloud.android.MainApp; import com.owncloud.android.R; @@ -132,11 +130,8 @@ public class FileDetailFragment extends FileFragment implements OnClickListener, @Inject FileDataStorageManager storageManager; @Inject ViewThemeUtils viewThemeUtils; @Inject BackgroundJobManager backgroundJobManager; - @Inject DeviceInfo deviceInfo; @Inject EditorUtils editorUtils; - @Inject Clock clock; - - private SyncedFolderProvider syncedFolderProvider; + @Inject SyncedFolderProvider syncedFolderProvider; /** * Public factory method to create new FileDetailFragment instances. @@ -226,8 +221,6 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, throw new IllegalArgumentException("Arguments may not be null"); } - syncedFolderProvider =new SyncedFolderProvider(requireActivity().getContentResolver(), preferences, clock); - setFile(arguments.getParcelable(ARG_FILE)); parentFolder = arguments.getParcelable(ARG_PARENT_FOLDER); user = arguments.getParcelable(ARG_USER); @@ -252,6 +245,11 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, return null; } + FloatingActionButton fabMain = requireActivity().findViewById(R.id.fab_main); + if (fabMain != null) { + fabMain.hide(); + } + if (getFile().getTags().isEmpty()) { binding.tagsGroup.setVisibility(View.GONE); } else { @@ -568,7 +566,7 @@ private void setFilePreview(OCFile file) { .getFolderTypeIcon(file.isSharedWithMe() || file.isSharedWithSharee(), file.isSharedViaLink(), file.isEncrypted(), file.isGroupFolder(), - //syncedFolderProvider.findByRemotePathAndAccount(file.getRemotePath(), user), + syncedFolderProvider.findByRemotePathAndAccount(file.getRemotePath(), user), file.getMountType(), requireContext(), viewThemeUtils)); int leftRightPadding = requireContext().getResources().getDimensionPixelSize(R.dimen.standard_padding);