Skip to content

"Only available offline" added to Drawer - #2468

Merged
davigonz merged 10 commits into
masterfrom
feature/filter_offline_available_files
Mar 21, 2019
Merged

davigonz merged 10 commits into
masterfrom
feature/filter_offline_available_files

Conversation

@abelgardep

@abelgardep abelgardep commented Mar 6, 2019 •

Copy link
Copy Markdown
Contributor

Implements #407


BUGS & IMRPOVEMENTS

}

public Vector<OCFile> getFolderContent(OCFile f/*, boolean onlyOnDevice*/) {
public Vector<OCFile> getFolderContent(OCFile f, boolean onlyAvailableOffline/*, boolean onlyOnDevice*/) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove /*, boolean onlyOnDevice*/, if we need it in the future, we will include it. And please delete all the // TODO Enable when "On Device" is recovered occurrences as well as the code related to it.

if (f != null && f.isFolder() && f.getFileId() != -1) {
// TODO Enable when "On Device" is recovered ?
return getFolderContent(f.getFileId()/*, onlyOnDevice*/);
return getFolderContent(f.getFileId(), onlyAvailableOffline/*, onlyOnDevice*/);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

// TODO better implementation, filtering in the access to database instead of here
// TODO Enable when "On Device" is recovered ?
Vector<OCFile> tmp = getFolderContent(folder/*, onlyOnDevice*/);
Vector<OCFile> tmp = getFolderContent(folder,false/*, onlyOnDevice*/);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave a space between folder and false. I'd highly recommend you to use the Android Studio option Code -> Reformat code to avoid some style issues in the future. Besides, delete /*, onlyOnDevice*/

// stage 1: remove the local files already registered in the files database
// TODO Enable when "On Device" is recovered ?
Vector<OCFile> files = getFolderContent(folder.getFileId()/*, false*/);
Vector<OCFile> files = getFolderContent(folder.getFileId(), false/*, false*/);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete /*, false*/


private Vector<OCFile> getFolderContent(long parentId/*, boolean onlyOnDevice*/) {

private Vector<OCFile> getFolderContent(long parentId, boolean onlyAvailableOffline/*, boolean onlyOnDevice*/) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete /*, boolean onlyOnDevice*/

if (mFile != null) {
// TODO Enable when "On Device" is recovered ?
Vector<OCFile> files = getStorageManager().getFolderContent(mFile/*, false*/);
Vector<OCFile> files = getStorageManager().getFolderContent(mFile, false/*, false*/);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

file.getFileLength(), mContext
));

if(!mOnlyAvailableOffline){

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reformat code in this file

file.getFileLength(), mContext
));
}else{
lastModV.setVisibility(View.VISIBLE);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This call is present when mOnlyAvailableOffline is both true and false so can be move out of the if, else. Check the other calls just in case.

return ((args != null) && args.getBoolean(ARG_JUST_FOLDERS, false));
}

protected boolean isShowingOnlyAvailableOffline() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

protected not needed. Android Studio warns you about that.

Screenshot 2019-03-13 at 17 28 17


// If available offline option and folder is not available offline -> list root
if(!directory.isAvailableOffline() && isShowingOnlyAvailableOffline()){
directory = storageManager.getFileByPath("/");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davigonz

Copy link
Copy Markdown
Contributor

@abelgardep have a look at the changes requested

The av. offline icon does not look that good, it's too much clear. Since I provided you the icons, I've already replaced them so you just have to take care of the rest of the changes.

@abelgardep

Copy link
Copy Markdown
Contributor Author

@davigonz I've applied the changes requested


// Create result cursor before syncing folder again, in order to enable faster loading
for (OCFile file : mCurrentStorageManager.getFolderContent(browsedDir)) {
for (OCFile file : mCurrentStorageManager.getFolderContent(browsedDir,false)) {

@davigonz davigonz Mar 15, 2019 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still pending, space after browsedDir,

Vector<OCFile> findFiles(OCFile root, String query) {
Vector<OCFile> result = new Vector<OCFile>();
for (OCFile f : mCurrentStorageManager.getFolderContent(root)) {
for (OCFile f : mCurrentStorageManager.getFolderContent(root,false)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, space after root,

case R.id.nav_only_available_offline: ;
menuItem.setChecked(true);
mCheckedMenuItem = menuItem.getItemId();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pending also

file.getFileLength(), mContext
));
if (!mOnlyAvailableOffline) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this extra line here?

@@ -136,7 +137,7 @@ protected void onAccountSet(boolean stateWasRecovered) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's still some // TODO Enable when "On Device" is recovered ? code in this class

@davigonz

Copy link
Copy Markdown
Contributor

@abelgardep a couple of changes more and ready for QA

@abelgardep

Copy link
Copy Markdown
Contributor Author

@davigonz Done

@davigonz

Copy link
Copy Markdown
Contributor

@jesmrec ready to test

@jesmrec

jesmrec commented Mar 19, 2019

Copy link
Copy Markdown
Member

Let's start with the QA

@jesmrec

jesmrec commented Mar 19, 2019 •

Copy link
Copy Markdown
Member

(1) [FIXED]

If the item is in a deep folder (f ex /Test/Folder1/Folder2/Folder3/Folder4/Folder5/Folder6 ), the path string is ellipsized at the end in this way:

Screen Shot 2019-03-19 at 16 29 01

To keep the same behaviour as in other views in the app, it should be in the middle, like in the uploads view:

Screen Shot 2019-03-19 at 16 29 53

Android 8

@jesmrec

jesmrec commented Mar 19, 2019 •

Copy link
Copy Markdown
Member

(2) [FIXED]

In terms of usability, the av. offline view should have an option to move back to the file list. Actually, the way is by opening the drawer and selecting "All files". But, it needs two taps to go back.

Here, i see two options:

  1. Switch the hamburger button to a back arrow (like in multiselection mode, or the share view as examples)
  2. Improve the behaviour of the back button, that currently minimizes the app.

If the favourite option is the 1., the 2. should be addressed as well to go back.

What do you think? CC @davigonz

@davigonz

davigonz commented Mar 19, 2019 •

Copy link
Copy Markdown
Contributor

Improve the behaviour of the back button, that currently minimizes the app.

I would go this way since is how the app also behaves when tapping back button from Uploads view.

Changing the hamburguer button to a back arrow does not look that natural from a user point of view when switching between different side menu options.

@abelgardep
abelgardep force-pushed the feature/filter_offline_available_files branch from 41052e3 to efafa8d Compare March 20, 2019 13:22
@jesmrec

jesmrec commented Mar 21, 2019

Copy link
Copy Markdown
Member

Everything fixed and 2nd QA round done.

Approved.

@jesmrec
jesmrec self-requested a review March 21, 2019 11:48
@davigonz
davigonz merged commit 2265d41 into master Mar 21, 2019
@davigonz
davigonz deleted the feature/filter_offline_available_files branch March 21, 2019 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants