Office Hours — Today, April 7

Tuesday, April 4

Apr 7
8:50 AM
Mark M.
has entered the room
Mark M.
turned on guest access
9:00 AM
wuqiang
has entered the room
wuqiang
hi
Mark M.
hello, wuquiang!
how can I help you today?
wuqiang
yes
i’m still coding a chat app
Today I saw WeChat’s solution (WeChat is China most populay Chat App)
Mark M.
I have heard of WeChat, but I have never used it myself
9:05 AM
wuqiang
it almost include every function in our daily life
of course , BottomSheetDialog is great
click a icon on the bottom , whole content will be pushed up ,(EXCEPT Tool Bar)
Just like this
Mark M.
perhaps they are hiding and showing some view that is below that icon bar at the bottom
wuqiang
let me try it
i have another question
9:10 AM
wuqiang
View paste
in any chatting app nowadays it could send text message , image message ,voice message ,video message …
and as you know : different messages need different views to display it . so how could I achieve this ?
in any chatting app nowadays it could send text message , image message ,voice message ,video message …
and as you know : different messages need different views to display it . so how could I achieve this ?
Mark M.
if you are asking how to display these items in the chat transcript, use a RecyclerView and a vertical LinearLayoutManager, with different row types for different chat message types
wuqiang
now , I have made a token in my sent message to indicate the message type
my point is how to use different view to display different message
Mark M.
as I said, use a RecyclerView, with different row types for different message types
use one row type for plain text
use another row type for photos
use another row type for videos
and so on
wuqiang
great idea
thinks
9:15 AM
wuqiang
but sometimes it could display image along with some texts like this
9:20 AM
Mark M.
you are welcome to create a row type for that too, and decide when to use it
wuqiang
in you book have a method : android:windowSoftInputMode="adjustPan" ,it let the whole Activity page (include ToolBar) push up
9:25 AM
Mark M.
yes
but only for when the user opens the soft keyboard
wuqiang
but if i don't want the ToolBar push up ,how could I do that ?
Mark M.
that should already be working
you have a scrollable view (the RecyclerView)
so, if the user opens the soft keyboard, Android should shrink the height of the RecyclerView
in terms of hiding and showing that grid of emoji, have your RecyclerView fill the space below the toolbar and above the chat entry EditText
then, as you hide and show that grid, the RecyclerView will change height
you can do this via RelativeLayout or ConstraintLayout, with appropriate anchoring rules
or, you can do this with a LinearLayout and android:layout_weight
wuqiang
thank u very much
i'll try all you ideas
9:30 AM
Paul R.
has entered the room
Paul R.
Greetings.
Mark M.
hello, Paul!
wuqiang: OK, that sounds good -- let me take a question from Paul, and I will return to you in a bit
Paul: your turn! do you have a question?
Paul R.
I do.
As you may remember I was struggling to come up with a solution to notifications for my app.
I eventually decided upon using the device as both a client and a server.
In client mode it receives messages pushed out from FCM (GCM).
In server mode it pushes notifications to the FCM Google servers which then get pushed to clients.
Now I want to write this up and post it somewhere to get feedback from critics.
Would you recommend anyplace other than Stack Overflow for this?
Mark M.
um
9:35 AM
Mark M.
there's a code review Stack Exchange, though I think it is for shorter things than this
if you're a Reddit guy, you could write up your plan as a blog post or something and link to it from Reddit, I guess
Paul R.
Hmm. Didn't know that.
Mark M.
Paul R.
Am aware of Reddit but hardly ever use it.
Do you mind if I "tag" you on Stack * when I post it.
And would that be "commonsguy"?
Mark M.
yes, insofar as I don't think that works :-)
I don't think you can @ somebody who has not commented on the question or answer
Paul R.
You could be correct.
Mark M.
and I'm probably not on Code Review anyway
Paul R.
What tags would get your attention?
Mark M.
if you post it on the regular Stack Overflow, and you do not get any love, you can use the Stack Overflow "bump" service for Warescription members
Paul R.
Other than "android".
Refresh my memory on how "bump" works. (reference is ok)
9:40 AM
Mark M.
log into the Warescription site, choose Other > Stack Overflow Bump from the nav bar, and paste in the URL to the question
if it is in the android tag and is older than 24 hours, I'll get an email
and I'll take a look at it
you are limited to one bump per week
Paul R.
Excellent. I have one more question but I'll go to the end of the line if need be.
Mark M.
OK
wuqiang: your turn! do you have another question?
wuqiang
yes
Paul R.
Good question!
wuqiang
when key board pushed up ,I want the message will be pushed too,u konw my means .... i pool english ....
Mark M.
if you are using RecyclerView for the chat transcript, you can see if using app:reverseLayout="true" and app:stackFromEnd="true" handle that automatically
Paul R.
It strikes me that I am using RecyclerView for a chat app and I get the desired behavior. Not sure if I had to do anything special though.
9:45 AM
Mark M.
otherwise, you can call scrollToPosition() on the RecyclerView to scroll to the last position, though I forget the recipe for finding out when you would need to call that
Paul R.
fwiw, my code is at github.com/pajato/GameChat/...
wuqiang
thanks
let me try it later
Mark M.
OK, let me take another question from Paul, and if there is time I will be back with you before the end of the chat
Paul: back to you! do you have another question?
Paul R.
Sorry, I just checked my code. It uses scrollToPosition so grep for that if you want to see the code.
My question:
wuqiang
thanks Paul R too
9:50 AM
Paul R.
I want to present my app, focusing on Firebase and the app features. Where would you recommend I look to present it?
Mark M.
present, as in like a meetup or conference?
Paul R.
Yes.
As in what conferences do you consider high quality.
Mark M.
well, my first criterion is: where is it located?
so, in this case: what continent are you on?
Paul R.
The hub of the Universe, Boston. :-)
Mark M.
well, you just missed your local droidcon
(at least in terms of presenting)
Paul R.
Yes, I did much to my chagrin. And my son (same name) is presenting.
fwiw, he is doing a talk on Play Store automation.
Mark M.
that might have been the first father-son pair of presentations at any Android conference :-)
I'm sure that there are 1+ meetups in Boston that you could try
Paul R.
We'll work on that.
Mark M.
droidcon NYC will probably run again in the fall
Paul R.
I'll talk to Steve Patterson / Beth Mezias in Boston. NYC is a good suggestion.
Mark M.
AnDevCon moved to DC (from Boston) for this year, and their call for presenters long since closed
I cannot think of other regional ones in the Northeast off the top of my head
9:55 AM
Mark M.
I keep tabs on the Boston/Pittsburgh/DC triangle, as my Secret Mountain Lair is in eastern Pennsylvania
Paul R.
Would you recommend contacting a Google Firebase product manager?
Mark M.
I wouldn't know how to contact a Firebase product manager
you might see if there is a local GDE with Firebase expertise
Paul R.
GDE?
Mark M.
Google Development Engineer
Paul R.
Like in the Boston office? Good idean.
Mark M.
it's their equivalent of the old Microsoft MVP program for community leaders
oh, sorry, Google Development Expert
Paul R.
Very cool.
Good answers to both question. Thanks, and talk to you soon.
Mark M.
you're welcome!
wuqiang: any last questions?
wuqiang
thanks
today i have no question
Mark M.
OK
wuqiang
let my try all of these
10:00 AM
Mark M.
OK, that's a wrap for this morning's chat
the next one is in six hours, at 4pm US Eastern
the transcript for this chat will be posted to https://commonsware.com/office-hours/ shortly
have a pleasant, um, six hours!
wuqiang
has left the room
Paul R.
has left the room
Mark M.
turned off guest access
10:20 AM
Mark M.
has left the room
3:55 PM
Mark M.
has entered the room
Mark M.
turned on guest access
4:00 PM
wuqiang
has entered the room
wuqiang
Hi
Mark M.
hello, wuquiang!
how can I help you?
wuqiang
In china now is midnight
first i want to say thanks ,without your help i can’t go so far
Mark M.
I am happy to be useful!
wuqiang
below is my job after our last conversation
4:05 PM
wuqiang
then i have another question
How to check weather the KeyBoard is Pop-up ?
I use the event below :
view.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
Mark M.
I do not know of a good way to detect when the soft keyboard appears or disappears
usually, we try not to do anything different in our apps when the keyboard appears or disappears
wuqiang
o
4:10 PM
wuqiang
Mark M.
that is strange behavior
what are you using for that grid of emoji?
wuqiang
in fact ,now, it is noly a mimc picture
Mark M.
ah, OK
ImageView is trying to maintain the aspect ratio of the image
and the height of the ImageView is being reduced due to something in your layout
wuqiang
when the mimic picture is open then open KeyBoard , bad thing is happing like that ....
so I need a good way to detect weather KeyBoard is open .....
4:15 PM
Mark M.
sorry, I do not have an answer for that
wuqiang
in fact I have tryed PageView within the part of mimic picture, But it will take whole screen
Mark M.
a ViewPager can be sized however you want
wuqiang
How can we accommodate a PageView within a half Fragment ?
Mark M.
I am not certain what "a half Fragment" means, exactly
but a ViewPager is just like a Button, or a FrameLayout, or any other View/ViewGroup
4:20 PM
Mark M.
so, you can make a ViewPager take up half the space of a vertical LinearLayout using weights
or, you can make a ViewPager take up half the space of a ConstraintLayout using a guideline
wuqiang
That explains a lot ,thanks
5:00 PM
Mark M.
that is a wrap for this afternoon's chat
the next office hours will be 9am US Eastern on Tuesday
have a pleasant evening!
wuqiang
has left the room
Mark M.
turned off guest access

Tuesday, April 4