Skip to content

Commit

Permalink
Master rebased and AutoUpload icon changes in file detail fragment.
Browse files Browse the repository at this point in the history
  • Loading branch information
surinder-tsys committed May 15, 2023
1 parent 4b0d069 commit 437c160
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<User> optionalUser = getUser();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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);
Expand All @@ -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 {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 437c160

Please sign in to comment.