hedzr / android-file-chooser

a lightweight file/folder chooser or picker
Apache License 2.0
284 stars 62 forks source link

(#45) display file path #48

Closed Guiorgy closed 5 years ago

Guiorgy commented 5 years ago

an alternative solution to showing current directory in the title. a TextView at the top of the list with the current path. If whole path doesn't fit, then it gets trimmed from the left. This will not remove _folowDir, but rather give an alternative, as it doesn't require the title to be enabled. Oh, and I also updated android-maven-gradle-plugin: 2.0 -> 2.1 and kotlin-gradle-plugin: 1.3.11 -> 1.3.21.

heres a demo: demo

hedzr commented 5 years ago

nice job!

hedzr commented 5 years ago

i will update readme with the gif link tomorrow.

Guiorgy commented 5 years ago

In the first commit swap lines 1021 and 1022 please :p

Those 2:

if (i == -1) break;
i = path.indexOf("/", i + 1);

need to be swapped

hedzr commented 5 years ago

should i swap these two lines?

                if (i == -1) break;
                i = path.indexOf("/", i + 1);

PS:

  1. what do you think of the _path renamed to _pathView?

I added customizePathView(callback), renamed to _pathView because _path is a confusing name, and reformatted the codes, be kindly informed pls.

Guiorgy commented 5 years ago

@hedzr

  1. if (i == -1) break; is just incase there are no '/' in path (somehow), which would throw OutOfBoundException, though I have yet to have that problem...
  2. Honestly, my naming scense is the worst. :) feel free to rename anything anyway you prefere.
  3. I like the idea of the callback.
  4. I just realised, but TextView.setPadding(l,t,r,b) takes in px. We should use UiUtil.dip2px(dip) there!
hedzr commented 5 years ago

Got it. I appreciate for your consideration/understanding. About last point, i'd remembered to find another time to do that.

Guiorgy commented 5 years ago

By the way, @hedzr, most demo apps usually have toggleable settings to let the user test more stuff. like this: this example from calcdialog. What do you think about trying the same?

hedzr commented 5 years ago

Good idea but need a bit time, I think it could be planned soon because more and more properties done.

Guiorgy commented 5 years ago

@hedzr, I can give it a try, if you don't mind that is?

hedzr commented 5 years ago

It was my pleasure!

Guiorgy commented 5 years ago

@hedzr, looking at ChooserDiag:

    public ChooserDialog titleFollowsDir(boolean followDir) {
        _followDir = followDir;
        return this;
    }

    public ChooserDialog followDir(boolean followDir) {
        _followDir = followDir;
        return this;
    }

those 2 do the same. 1 is redundant.

hedzr commented 5 years ago

yes, 2nd (followDir) is redundant, should be removed.