Nov 19 | 7:25 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Paul | has entered the room |
Mark M. |
hello, Paul!
|
Mark M. |
how can I help you today?
|
Paul |
Greetings. I want to pick your brain about a dilemma I face.
|
Mark M. |
be sure to put my brain back when you're done with it
|
Paul |
Briefly I have an app with 1 activity and two fragments each displayed side by side on a tablet and in a view pager on a smart phone.
|
Nov 19 | 7:30 PM |
Paul |
There is a toolbar attached to the activity but as I test the app more and more it strikes me that there should be two toolbars, one on each fragment.
|
Paul |
My dilemma is over whether to continue using the activity attached toolbar and manage it as best I can from each fragment or have no activity toolbar but manage a toolbar on each fragment.
|
Paul |
Is that clear so far?
|
Mark M. |
yes
|
Paul |
Now I would love to hear how you would approach this dilemma.
|
Mark M. |
first question: when the user swipes between the pages in the ViewPager, do you want the toolbar to appear to move with the page, or not?
|
Ron | has entered the room |
Mark M. |
(BTW, hello, Ron -- I will be with you shortly!)
|
Ron |
(HI)
|
Paul |
Probably less important than getting the content right.
|
Paul |
But it would clearly be a nice UX feature.
|
Mark M. |
"it" meaning "move with the page"?
|
Nov 19 | 7:35 PM |
Paul |
yes.
|
Mark M. |
then a toolbar per fragment would seem to be the choice
|
Mark M. |
I'm assuming that your original reason for considering this is to get toolbar buttons closer to the right fragment on the tablet
|
Mark M. |
in which case, a per-fragment toolbar gives you that, plus the desired toolbar-moves-with-the-page behavior
|
Mark M. |
personally, I would *not* want the toolbar to appear to move with the page, if the toolbar is at the top, as that's not what the user will be used to
|
Paul |
My main reason was that the options menus are different on each fragment and the title and sub-title might be different on each toolbar.
|
Mark M. |
in a single-bar approach, the two menus get merged, and you only get the one title
|
Mark M. |
so, if you want each fragment to get its own title, that calls for separate toolbars per fragment
|
Paul |
Yes, that was the catalyst to move me to consider two toolbars, one per fragment.
|
Mark M. |
and since you like the toolbar-moves-with-the-page behavior, you seem to be set
|
Mark M. |
let me take a question from Ron, and I'll be back with you in a bit for more follow-up or other questions
|
Mark M. |
Ron: your turn! do you have a question?
|
Ron |
View paste
(8 more lines)
|
Paul |
I am. The fact that you did not weigh in with a "that's a stupid idea", helps considerably! Thanks.
|
Nov 19 | 7:40 PM |
Mark M. |
Ron: to be honest, I'm not sure if Android Studio is using Gradle tasks for the install process or not
|
Mark M. |
there is installDebug (and installRelease if you have signing keys), but I haven't paid attention to see if that's what Studio is using or not
|
Ron |
I think it is but I want it to be done on a single variant not all variants
|
Mark M. |
well, deciding which variants to worry about is a matter of filtering them as you loop through android.applicationVariants or android.libraryVariants
|
Ron |
Yeah, I got that part working okay
|
Ron |
But trying to 'attach' or 'insert' my tasks between two other tasks is driving me nuts.
|
Mark M. |
I haven't used whenAdded
|
Paul |
Mark, I am going to abort. Thanks for your help and I'll chat with you soon.
|
Paul | has left the room |
Mark M. |
I have only chained onto a handful of well-defined tasks (e.g., variant.javaCompile)
|
Ron |
What I am trying to do for any particular variant is insert my task when it 'compiles' or 'builds'
|
Mark M. |
well, javaCompile isn't the worst choice then
|
Nov 19 | 7:45 PM |
Ron |
I have tried that one, any others?
|
Ron |
How are you 'chaining in'?
|
Mark M. |
variant.javaCompile.dependsOn task
|
Ron |
Okay, I'll give that a try! Thanks
|
Mark M. |
I'm having difficulty navigating the plugin DSL docs (as usual)
|
Mark M. |
and I'm blanking on other candidates
|
Mark M. |
you can see variant.javaCompile.dependsOn task in action in the Staticizer Gradle plugin sample
|
Mark M. |
part of Version 8.1 of the book
|
Ron |
Yes, it is a real nightmare to figure it our from the docs.
|
Ron |
I'll look at your example,
|
Ron |
That is all I have for tonight! Thanks again!
|
Ron | has left the room |
Mark M. |
you're welcome!
|
Nov 19 | 8:25 PM |
Mark M. | turned off guest access |