Dec 8 | 7:25 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Chandra S. | has entered the room |
Mark M. |
hello, Chandra!
|
Chandra S. |
Hi Mark
|
Mark M. |
how can I help you today?
|
Chandra S. |
I actually new to the new Android SDK dev so sorry if I ask the noob question :-)
|
Mark M. |
go right ahead
|
Chandra S. |
I want to ask about strategy for data persistence to store user session, like userid, etc. If the device rooted, then the shared preferences data can be changed right? So user can change that. Should the data be encrypted or what is the best practive?
|
Mark M. |
well, the user probably knows the user's user ID
|
Mark M. |
so, I am not sure why you are worried about encrypting a user ID
|
Mark M. |
if the user changes their user ID, either your server will not recognize the user ID, or the user will not know the password of the changed user ID
|
Mark M. |
the best practice is to put your defenses on your server
|
Dec 8 | 7:30 PM |
Chandra S. |
I see.. Got it, Mark.. So implement like key in the REST communication
|
Mark M. |
something along those lines, yes
|
Chandra S. |
OK.. I also confuse about choosing fragment or activity, whether my application use 1 activity and many fragments on top of that or many activity?
|
Mark M. |
either is fine
|
Mark M. |
the reason fragments were introduced is to help make it easier to support larger-screen UIs, such as for tablets
|
Chandra S. |
Is there any cons from the memory used if I use activity only?
|
Mark M. |
the belief being that you might be able to decompose your UI into phone-sized chunks, showing one at a time on phone-sized screens and more than one at a time on larger screens
|
Mark M. |
not really
|
Mark M. |
I would not expect memory consumption to change much, at least for ordinary use cases
|
Johnny | has entered the room |
Mark M. |
there are some cases where going with a single activity can be very useful, due to the limitations of passing data between activities using Intents
|
Mark M. |
(BTW, hello, Johnny -- I will be with you shortly!)
|
Chandra S. |
I'm reading the Telegram source and they use only a few activity only, so I'm little bit confuse
|
Johnny |
Hi Mark
|
Mark M. |
Chandra: that was their design decision to make
|
Mark M. |
I don't use Telegram, and so I have no idea what their UI looks like on phones or tablets
|
Mark M. |
again, there is nothing wrong with using either fewer activities (backed by fragments) or in mostly using activities
|
Chandra S. |
OK.. How about changing transition between Activities? Like for example making it slide from right?
|
Dec 8 | 7:35 PM |
Mark M. |
I haven't played with that, sorry
|
Mark M. |
I know that there are some hooks for changing activity transitions, but personally I would leave that alone
|
Mark M. |
let me take a question from Johnny, and I will be back with you shortly
|
Mark M. |
Johnny: your turn! do you have a question?
|
Chandra S. |
OK Mark..
|
Johnny |
View paste
|
Johnny |
<View
android:id="@+id/box”
android:layout_width="20dp"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:background="@color/black” />
|
Johnny |
sorry for formatting
|
Mark M. |
in general, use Hierarchy View or uiautomatorviewer to examine the UI as it is being displayed in the emulator, to try to determine where your box has gone
|
Johnny |
ah ok I'll check that out, thanks
|
Mark M. |
beyond that, post the layout XML somewhere, and perhaps I can see something amiss in the layout
|
Dec 8 | 7:40 PM |
Mark M. |
while you are working on that, let me take another question from Chandra, and I will be back with you in a bit
|
Johnny |
I'll see if I can work it out first, thanks :)
|
Mark M. |
Chandra: your turn! do you have another question?
|
Mark M. |
OK, if either of you have a question, go right ahead
|
Johnny |
Also just wondering, have you played around with ripple effect and elevation?
|
Dec 8 | 7:45 PM |
Chandra S. |
Just check whether I'm disconnected or not :-D
|
Mark M. |
hmmm... Campfire may be having a bad day
|
Johnny |
Problem I have is, I can't seem to get ripple effect and item being raised effect happening at the same time when I press a view. It animates fine, but only does the ripple effect after I leave the touch area
|
Mark M. |
Johnny: I did some work with ripples with RecyclerView, but otherwise not
|
Mark M. |
and I have not messed with elevation much
|
Mark M. |
definitely not changing elevation on the fly in response to touch input
|
Mark M. |
sorry
|
Johnny |
No worries
|
Mark M. |
Chandra: I am not sure whether the problem was on my end or Campfire's, but you're not disconnected AFAICT
|
Dec 8 | 7:50 PM |
Johnny |
View paste
|
Mark M. |
is it a fixed part of the layout XML, or are you adding it dynamcally?
|
Mark M. |
er, dynamically
|
Johnny |
fixed
|
Mark M. |
do you have android:visibility="gone" on it? are you toggling visibility on it at runtime?
|
Dec 8 | 7:55 PM |
Chandra S. |
Hi Mark, Johnny, since there's no discussion can I ask again?
|
Mark M. |
Chandra: yes, go right ahead -- right now, it is open for anyone
|
Mark M. |
particularly given the connection issues
|
Dec 8 | 8:00 PM |
Johnny |
View paste
|
Mark M. |
Johnny: what else is driving the height of the RelativeLayout?
|
Chandra S. |
Ah I didn't see any conversation up there until I quit and rejoin
|
Johnny |
This is inside a recyclerview
|
Chandra S. |
Related to our last conversation on fragment or activity, what kind of data that can't be pass easily between activities so in that case we have to use fragment? Could Singleton did that?
|
Johnny |
I'll let Chandra go first
|
Mark M. |
Chandra: big data (>1MB, like a photo) or data that cannot go into Intent extras
|
Mark M. |
those become more difficult to pass across to another activity
|
Chandra S. |
I see.. OK.. Still related to the data persistence, I have a list of data to be shown in Recyclerview, still confuse on how to combine the Singleton and SQLite, and sync the data to the server.
|
Mark M. |
I am not sure what "the Singleton" is
|
Mark M. |
typically, you have a single instance of SQLiteOpenHelper
|
Mark M. |
whether that is a singleton, or is managed by something else, depends on implementation details
|
Mark M. |
in terms of syncing data to the server, an IntentService is a typical solution
|
Mark M. |
whether triggered by user input, on a scheduled basis (e.g., JobScheduler or AlarmManager), etc.
|
Mark M. |
Johnny: my earlier point was that if nothing else is forcing the RelativeLayout to a certain height, match_parent on a child of the RelativeLayout will not force it to a certain height, so the RelativeLayout might have a height of 0
|
Chandra S. |
I see.. OK..
|
Mark M. |
I assume, though, your RelativeLayout has other stuff beyond the missing box in it, like TextViews or ImageViews or something
|
Dec 8 | 8:05 PM |
Chandra S. |
View paste
|
Mark M. |
well, here's the Stack Overflow I point everyone to: https://stackoverflow.com/a/32951118/115145
|
Mark M. |
personally, I use OkHttp, or things layered atop of it (e.g., Retrofit, Picasso)
|
Chandra S. |
Got it, Mark
|
Chandra S. |
I also still confuse about LayoutInflater, on what it actually did
|
Mark M. |
it, um, inflates layouts :-)
|
Mark M. |
it takes the layout XML and returns the tree of Views and ViewGroups defined in that XML
|
Chandra S. |
So the onCreateView method was called by the hosted activity right?
|
Mark M. |
either that or by the FragmentManager
|
Dec 8 | 8:10 PM |
Mark M. |
I seem to recall looking at the LayoutInflater code once or twice and concluding that it is pretty nasty
|
Chandra S. |
View paste
|
Chandra S. |
That code?
|
Mark M. |
no, the implementation of LayoutInflater itself
|
Mark M. | |
Chandra S. |
I see.. Since I'm looking at this code and still confuse who call the method, what container was giving, since it just pass the container to the inflate method
|
Mark M. |
that depends on how the fragment is being added to the activity
|
Mark M. |
(BTW, Johnny, if you have additional questions, go right ahead, and I'll take 'em as they come in)
|
Mark M. |
Chandra: if you are using dynamic fragments, with a FragmentTransaction, you supply the container
|
Mark M. |
if you are using static fragments (<fragment> tags in a layout), then a FrameLayout(?) is created for you by LayoutInflater, and that is the container
|
Johnny |
View paste
|
Chandra S. |
Ah I see.. Got it, Mark..
|