Jan 20 | 8:55 AM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Jan 20 | 9:00 AM |
Gerrit | has entered the room |
Gerrit |
Hi Mark!
|
Mark M. |
hello, Gerrit!
|
Mark M. |
how can I help you today?
|
Gerrit |
I've got two somewhat similar problems that can be catagorized as "lost in refactoration" (pun intended).
|
Gerrit |
View paste
|
Gerrit |
View paste
|
Mark M. |
well, RecyclerView itself is not tied to activity or fragment
|
Mark M. |
make sure that whatever trigger you are using for initiating the action mode works (e.g., OnLongClickListener)
|
Mark M. |
the MVI sample from the latest "Android's Architecture Components" offers an action mode, though that sample is a bit involved
|
Jan 20 | 9:05 AM |
Mark M. |
but that action mode is for a RecyclerView shown in a fragment
|
Mark M. |
and so perhaps it can give you some clues
|
Mark M. |
I do not recall having to do anything out of the ordinary to get the action mode to work in a fragment
|
Gerrit |
Ok, I'll have a look at that MVI one as well then, and you're probably right that I'll have to recheck the listener.
|
Mark M. |
in that sample, I am using data binding, and I have an android:onLongClick attribute that calls into my ViewHolder, and that eventually triggers the action mode
|
Mark M. |
DialogPreference is not tied to an activity or fragment either, so I am not completely clear on what the issue is
|
Mark M. |
(with regards to your second area of concern)
|
Gerrit |
View paste
|
Mark M. |
"xml based preferences approach is deprecated" -- I am not certain what you are referring to
|
Mark M. |
"Is deprecation the team sport at android dev" -- no, but it feels like that there is a per-major-release quota
|
Mark M. |
"Can a DialogPreference fragment be launched from a normal activity" -- I wouldn't do that
|
Jan 20 | 9:10 AM |
Mark M. |
"should I use a normal dialog that's accessing shared preferences for this ?" -- whether it should be a dialog or not is difficult to answer (my tendency is to avoid dialogs where possible), but if the host is not a PreferenceFragment, it should be a normal dialog, not a DialogPreference
|
Mark M. |
*Preference classes are for the preference system only
|
Gerrit |
View paste
|
Mark M. |
ah, OK
|
Mark M. |
PreferenceActivity in general is deprecated
|
Mark M. |
the current direction is a regular activity hosting a PreferenceFragment
|
Mark M. |
but that is for collecting preferences "in bulk"
|
Mark M. |
in your case, this is just a regular portion of your UI that *happens* to persist its data in SharedPreferences
|
Mark M. |
as it turns out, that same MVI sample has a "filter mode" drop-down menu that is backed by SharedPreferences
|
Mark M. |
in my case, I am demonstrating Model-View-Intent, including the repository pattern, so I have a FilterModeRepository that is backed by SharedPreferences
|
Mark M. |
the change in the filter mode simply triggers actions which flows through the MVI setup to both affect the UI change and update the repositoyr
|
Mark M. |
er, repository
|
Jan 20 | 9:15 AM |
Gerrit |
View paste
|
Mark M. |
it happens that your two areas of concern are illustrated there
|
Mark M. |
just reading the GUI architecture chapter, and the subsequent chapter on MVI, may help
|
Mark M. |
note that while I spend a lot of pages on the MVI sample app, it is mostly for the MVI
|
Mark M. |
er, MVI functionality
|
Mark M. |
I am re-re-re-re-writing the tutorials to build that MVI app from scratch, and so I am not covering the full details of every bit of code in "Android's Architecture Components"
|
Jan 20 | 9:25 AM |
Gerrit |
Can I bug you with 2 gradle questions as well?
|
Mark M. |
sure
|
Mark M. |
if you're lucky, I can even answer them!
|
Gerrit |
Yeah, my stack overflow searches have the same result ;-)
|
Gerrit |
Can you get the Buildconfig.debug variable read in gradle somehow, so that I can adjust the version for debug builds (like say +1) ?
|
Mark M. |
that's not how it works
|
Mark M. |
Gradle isn't a script for building an app
|
Mark M. |
Gradle is a script for building an object model of how to build an app
|
Mark M. |
hence, your script is always both debuggable and not-debuggable
|
Mark M. |
instead, you would need to arrange to change the version in debug tasks
|
Mark M. |
for example, see https://github.com/commonsguy/cwac-saferoom/blo...
|
Jan 20 | 9:30 AM |
Mark M. |
that's a fairly standard block of Gradle code in my CWAC libraries
|
Mark M. |
it is setting up the publishing stuff for Maven
|
Mark M. |
but in this block, I am iterating over all the build variants and adding a custom task for the non-debug variants: https://github.com/commonsguy/cwac-saferoom/blo...
|
Mark M. |
I presume that there is a similar approach that you could iterate over the build variants and adjust your version for the debug variants
|
Gerrit |
View paste
|
Mark M. |
ok
|
Jan 20 | 9:35 AM |
Mark M. |
I am not certain then if I answered your question, but it's about the best that I have on that particular point
|
Gerrit | |
Jan 20 | 9:40 AM |
Gerrit |
View paste
|
Mark M. |
that is far outside my area of expertise, sorry
|
Gerrit |
OK, no problem
|
Jan 20 | 9:45 AM |
Gerrit |
View paste
|
Mark M. |
if your question is "why do I have an action bar?", I do not know, as it sounds like your theme should be requesting to not have one
|
Mark M. |
if your question is "why do I have my app name in the action bar?", well, that's the default action bar title, and AFAIK the theme doesn't affect that
|
Jan 20 | 9:50 AM |
Gerrit |
Yes, it should be the first question, so I presume that though I changed (added) this style, I forgot to change it in manifest as well.
|
Mark M. |
that's a possibility
|
Jan 20 | 9:55 AM |
Gerrit |
Ok, that's all for me, thank you for your time, and have a nice weekend.
|
Mark M. |
you too!
|
Gerrit |
Thanks, see you later.
|
Jan 20 | 10:00 AM |
Gerrit | has left the room |
Mark M. | turned off guest access |