Office Hours — Today, November 14

Monday, November 6

Nov 14
3:50 PM
Mark M.
has entered the room
Mark M.
turned on guest access
4:05 PM
Susheel
has entered the room
Susheel
Hi Mark!
Mark M.
hello, Susheel!
how can I help you today?
Susheel
I have a layout file that uses weights in a vertical linearlayout to set percentage for height attributes for it's children. It works as desired but I'm wondering if I can do the same using constraintlayout. Is that possible?
Mark M.
sure
Susheel
I was wondering how I can achieve that
Mark M.
guidelines is one approach, putting the guidelines at the appropriate percentages
Susheel
Ah!
Mark M.
the still-in-progress 1.1 offers another option, with app:layout_constraintWidth_default="percent" and app:layout_constraintHeight_default="percent"
I demonstrate the guidelines approach in the book, in the chapter on ConstraintLayout basics
Susheel
I didn't even realize I could place guidelines at a certain percentage.
4:10 PM
Mark M.
Susheel
just constraint the guideline's left and right and then give the percentage for horizontal case
Mark M.
app:layout_constraintGuide_percent
Susheel
yep
constraintlayout is amazing. I am able to do a lot of tasks in a declarative way.
Mark M.
it's a jack-of-all-trades, which IMHO makes it terribly complex to explain
but, more people use ConstraintLayout than have to explain it
Susheel
At droidconSF the team that worked on constraintlayout demosntrated how to implement a bunch of cool animations using constraintlayout.
So that's a good thing I guess?
Mark M.
if you're into animations, sure
Susheel
Have you looked into Epoxy by AirBnB? Not sure if I asked you about this before. But apparently, it's an amazing library for building complex layouts using recyclerview.
Mark M.
Lisa Wray did a presentation on RecyclerView at last year's droidcon NYC, and she demoed Epoxy in that
Susheel
Yeah. Radical Recyclerview.
Mark M.
right
4:15 PM
Susheel
Loved that talk.
Do you plan to cover 3rd party stuff like that in your book?
Mark M.
I cover a variety of third-party libraries already
there are thousands
I will not cover them all
Susheel
True! I was being greedy :)
But you're right. Lisa's talk is good.
Mathias
has entered the room
Mathias
Evening
Susheel
HI Mathias.
Mark M.
Mathias: hi! Susheel has already asked a couple of questions, so it's your turn -- do you have a question?
Susheel
Mark, I'm good. You can get his question
4:20 PM
Mathias
cool
i have a strange google play issue:
View paste
Hi, need some help with a warning message in the play console.

Just put up a new version of the app and noticed a warning about "excessive wakeup" for my app.

Did some reading up, and according to google
(https://developer.android.com/topic/performance/vitals/wakeup.html) it is supposed to be because i wakeup my app up too often through AlarmManager.

"You app sets a wakeup alarm by calling one of the set() methods in AlarmManager with either the RTC_WAKEUP or ELAPSED_REALTIME_WAKEUP flag. When a wakeup alarm is triggered, the device comes out of low-power mode"

But i don't use it anywhere, there's not even any reference at all to that class anywhere in my project!

The only think i can think of is that i use the Timer class to update a counter every second, but that only happens when the app is showing on-screen.

I was wondering if you had any tips as to where i could look? I'm a little bit stumped.
Mark M.
my guess would be a third-party library
what all are you using?
Mathias
my thought too, but i cant see what it would be
i can list them hangon
View paste (14 more lines)
compile 'org.springframework.android:spring-android-rest-template:2.0.0.M3'
    compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.8.5'
    compile 'com.fasterxml.jackson.core:jackson-annotations:2.8.5'
    compile 'com.fasterxml.jackson.core:jackson-core:2.8.5'
    compile 'com.google.code.gson:gson:2.7'
    compile 'com.google.android.gms:play-services-maps:11.0.4'
    compile 'com.google.android.gms:play-services-location:11.0.4'
    compile 'com.google.firebase:firebase-core:11.0.4'
    compile 'com.google.firebase:firebase-messaging:11.0.4'
    compile 'com.tapadoo.android:alerter:2.0.1'
    compile 'se.emilsjolander:stickylistheaders:2.7.0@aar'
    compile ('com.github.HITGIF:TextFieldBoxes:1.3.5') {
        exclude group: 'com.android.support'//i already have a specific version below
    }
...
stickylistheaders - small library for nice listview sections. tapadoo - nice alert dropdown. hitgif - nice looking text fields
4:25 PM
Mark M.
the only things in there that might be using AlarmManager/JobScheduler would be Play Services and Firebase
Mathias
exactly!
my thought too. so i simply cannot understand why the console is warning
Mark M.
you might run a Gradle dependencies report and see if there is some transitive dependency that looks odd
Mathias
ah! good idea
Mark M.
you might also use the APK Analyzer to see if there are references from your release APK to AlarmManager or JobScheduler
on Android Studio 3.0, you can right-click over a method reference in the analyzer and find usages
from there, you might be able to (painfully) back-track and figure out where this is coming from
Mathias
checked the dependency tree. none of my smaller libraries have any dependencies at all. Only one with transitives are the google and firebase stuff, basically
and retrofix -> okhttp
Mark M.
that's not surprising, though it doesn't really help :-(
4:30 PM
Mathias
no, unfortunately not
Mark M.
I don't have any other ideas for you, unfortunately
Mathias
ok, it was worth a shot
Mark M.
let me switch back to Susheel, and I'll return to you in a bit
Mathias
np
Mark M.
Susheel: back to you -- do you have another question?
Susheel
Actually Mark I am good for now. I got the help I wanted. Thank you. Have a pleasant evening :)
Mark M.
OK -- you too!
Mathias: back to you!
Susheel
has left the room
Mathias
well. I do have geofences and things set up, that would of course wake up my app. But then the play console warning should write that, one would assume...
4:35 PM
Mathias
oh well, i guess i'll leave it be for now and revisit at another time
Mark M.
OK
Mathias
take care, talk to you another day :)
Mark M.
have a pleasant evening!
Mathias
has left the room
4:55 PM
Susheel
has entered the room
Susheel
Do you have time for a quick one Mark?
Mark M.
sure
Susheel
I have a textview with a layout weight attribute. But I want only the text to be clickable. How can I do that?
Mark M.
um
ClickableSpan, perhaps
Susheel
Cool I will look into it.
Mark M.
it'd be simpler to change the TextView to wrap_content and put it in a FrameLayout that has your weight
Susheel
Probably. The idea is to reduce view hierarchies. But I've heard framelayout is not bad perfornance wise
Am I right?
performance*
Mark M.
as I think I've said a few times: beware premature optimization
for example, using spans isn't free
Susheel
Haha! I remember you saying that.
Oh I see.
I do not know the inner workings of spans.
But that's good to know
5:00 PM
Mark M.
so unless you're going to do serious performance analysis to determine which of the two is faster, go with whatever you feel is more maintainable
then, if later you determine that you have performance issues, revisit the decision perhaps
Susheel
Cool thank you Mark!
Mark M.
that's a wrap for today's chat -- tomorrow's is at 9am US Eastern
the transcript will go up on https://commonsware.com/office-hours/ shortly
have a pleasant day!
Susheel
And as usual I want to thank you for all you do. Earlier, I didn't mean to bother you with the Epoxy example in your book. I just had no idea how much work goes into everything from your end.
Thanks you too
Mark M.
no worries
see ya!
Susheel
has left the room
Mark M.
turned off guest access

Monday, November 6

 

Office Hours

People in this transcript

  • Mark Murphy
  • Mathias
  • Susheel