Oct 15 | 8:55 AM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Oct 15 | 9:00 AM |
Tejas | has entered the room |
Tejas |
Hi Mark.
|
Oct 15 | 9:05 AM |
Mark M. |
whoops, sorry about the delay
|
Mark M. |
how can I help you today?
|
Tejas |
Ah that is fine. I have a doubt on the Singleton pattern.
|
Tejas |
View paste
|
Mark M. |
the better solution is to allow your singleton to be lazy-created
|
Tejas |
I am using it like below:
|
Tejas |
View paste
|
Mark M. |
OK, so what does the splash screen have to do with anything?
|
Randall M. | has entered the room |
Tejas |
I have the API calls on the Splash screen which populates an ArrayList on the Singleton.
|
Mark M. |
(BTW, hello, Randall -- I will be with you shortly!)
|
Randall M. |
Good morning...thanks.
|
Mark M. |
Tejas: then you should move those calls somewhere else, so that they can be invoked as needed when the singleton gets created
|
Oct 15 | 9:10 AM |
Tejas |
Okay. I get your point. Thanks.
|
Mark M. |
you are certainly welcome to detect that this list is empty, then start up the splash screen and finish() the activity that you are on, but the user may not appreciate this behavior
|
Mark M. |
it's like switching over to another browser tab, only to find yourself at the site's home page, rather than the page that you were on
|
Mark M. |
occasionally, this sort of behavior might be required (e.g., authentication), though even then, some sort of dialog would be a better choice, so as not to lose the user's place
|
Mark M. |
anyway, let me take a question from Randall, and I will be back with you in a bit
|
Mark M. |
Randall: your turn! do you have a question?
|
Tejas |
Okay.
|
Randall M. |
Is there a way to positively identify a system dialog that pops up over top of your activity? E.g., when the user long-presses the power button, a dialog prompting to "Power off" or toggle Airplane mode appears; is there a way to know that that dialog specifically is the one currently on-screen?
|
Mark M. |
um, not really
|
Randall M. |
All I seem to be able to know is that I lost focus (or gained it when the dialog is dismissed).
|
Mark M. |
there were some hack ways of doing that using ActivityManager, but they're pretty much all kaput as of Android 6.0
|
Mark M. |
why do you feel that you need to know this?
|
Randall M. |
I was hoping there was some method to get the "top-most thing", but I haven't found anything.
|
Oct 15 | 9:15 AM |
Randall M. |
It's related to all the "kiosk mode" hackery I implemented, if you happen to recall previous discussions with me about how to lock down the app and the device. When a patient finishes a procedure, they need to shut down the device, and so I need to be able to allow that dialog.
|
Mark M. |
I haven't played with kiosk mode, whether the official Android 5.0+ stuff or any, um, "hackery" :-)
|
Randall M. |
The client wanted to prevent user access to the airplane mode toggle, and I informed them then that that also prevented them from powering down, and they said it wasn't a problem. Well, last week, they decided it was a problem.
|
Mark M. |
moreover, what exactly is on that dialog is device-specific, and I forget if you are running on specific hardware or not
|
Randall M. |
We're still on 4.4.2. Would you be able to point me to the "hack ways of doing that using ActivityManager"?
|
Randall M. |
Yes, they supply the hardware to the patients, so it's a known environment.
|
Mark M. |
I seem to recall that the original solution involved getRunningTasks()
|
Mark M. |
the Android 5.x solution involved getRunningAppProcesses()
|
Randall M. |
Hmmm, that's actually where I started, but I didn't seem to get anything useful from the tasks info. Maybe I should look again.
|
Mark M. |
Android 6.0 seems to have locked down getRunningAppProcesses(), from what I have seen in Stack Overflow questions
|
Mark M. |
at the end, once you get the process and the RunningAppProcessInfo, you'd be looking for the process with IMPORTANCE_FOREGROUND, IIRC
|
Oct 15 | 9:20 AM |
Randall M. |
Ok, I'll take another look then.
|
Mark M. |
from there, you'd have to do your own analysis to determine what process is associated with that particular system dialog, and therefore whether the foreground process is that process
|
Randall M. |
Ultimately, I'm trying to convince them that a custom Android build is what they really need...and the more I learn about more recent Android versions, the more I think that's going to have to be the case if they want to retain their current "feature" set.
|
Mark M. |
oh, absolutely
|
Mark M. |
unless you can get the official kiosk mode offered in Android 5.0 to meet your needs
|
Randall M. |
Only if it can be configured to allow multiple processes. Like, they need access to the phone stuff.
|
Mark M. |
oh, that probably won't work
|
Mark M. |
the kiosk mode stuff is designed for things like students taking tests
|
Mark M. |
where the app is locked into the test app
|
Randall M. |
Yeah.
|
Mark M. |
er, where the *device* is locked into the test app
|
Mark M. |
so, yes, a custom ROM is probably the right answer, though that greatly increases the development and maintenance costs
|
Mark M. |
let me take another question from Tejas, and I'll be back with you in a bit
|
Randall M. |
Yeah, it's not going to be pretty.
|
Mark M. |
Tejas: your turn! do you have another question?
|
Tejas |
No. Pretty much around the same question. I was loading the navigation drawer from the API. Seems that I need to show a ProgressDialog and fetch the list on navigation drawer onCreate() if I detect the list to be empty.
|
Mark M. |
I don't know about the ProgressDialog bit
|
Mark M. |
I'd just use a loading indicator in the drawer itself
|
Oct 15 | 9:25 AM |
Tejas |
Yes. That could do the trick. Thanks. That is it from me.
|
Mark M. |
if the user doesn't open the drawer right away, the fact that you're busily loading the list in the background should not stop the user from doing what the user wants
|
Mark M. |
OK, if you come up with another question, chime in to let me know, and I can add you back into the rotation
|
Mark M. |
Randall: back to you! do you have another question?
|
Tejas |
Sure.
|
Tejas | has left the room |
Randall M. |
I think that's pretty much it from me. I have a phone call coming up with them shortly, so I'm going to play around with the task stuff again so I can have a definitive answer for them. Do I recall correctly that you said you were NOT attending the Big Android BBQ next week?
|
Mark M. |
correct, I am not attending the BBQ
|
Mark M. |
have some brisket for me
|
Mark M. |
:-)
|
Randall M. |
heh
|
Randall M. |
I was hoping to meet you IRL. Some other time...
|
Randall M. |
Thanks for the pointer...I'm going to go try again.
|
Mark M. |
this topic gets discussed a lot on Stack Overflow, so there should be some more detailed recipes there
|
Oct 15 | 9:40 AM |
Randall M. | has left the room |
Randall M. | has entered the room |
Mark M. |
hello again!
|
Oct 15 | 10:00 AM |
Randall M. | has left the room |
Mark M. | turned off guest access |