These methods store the files in primary storage (internal SD card) which is protected
This cannot be seen on an unrooted device when USB is connected.
Files stored here are automatically removed when app is uninstalled.
App doesn't require any specific permissions to read / write from this location.
Context.getExternalFilesDir()
Context.getExternalCacheDir()
These methods store the files in primary storage (internal SD card) which is un-protected
This can be seen on an unrooted device when USB is connected.
Files stored here are automatically removed when app is uninstalled.
App doesn't require any specific permissions to read / write from this location.
The
main call to onSizeChanged() is done after the construction of your view but
before the drawing. At this time the system will calculate the size of your
view and notify you by calling onSizeChanged()
CalculateTextPosition
: finds out the x,y co-ordinates within view so that the text is centered.
createBitmap :
creates a canvas -> draws over it using the textPaint.
But while doing that
it just punches a hole on the canvas using the Portar Duff
// this is the magic
– Clear mode punches out the bitmap
ViewPager associates
each page with a key Object instead of working with Views directly. This key is
used to track and uniquely identify a given page independent of its position in
the adapter
A very simple
PagerAdapter may choose to use the page Views themselves as key objects,
returning them from instantiateItem(ViewGroup,
int) after creation and adding them to the parent ViewGroup. A matching destroyItem(ViewGroup,
int, Object) implementation would remove the View from the parent ViewGroup
and isViewFromObject(View,
Object) could be implemented as return view == object;.
You will also find a
LibraryAdapter which is just a simple recyclerview adapter for recyclerview on
the third page which shows popular android opensource libraries.
Since we are doing
the Architecture explanation here , we will not go into details of how the elastic
effect is achieved and how awesomely that InkPageIndicator is implemented.
That info is for the
Learnings from Plaid series which will definitely cover in that series :-) till
that time just appreciate the effect.
Today we are going to look at how Plaid app communicates with Dribble API and that its the same mechanism with which it communicates with Designer News and Producthunt APIs. but for the purpose of this blog we are going to look at only the Dribble APIs.
This is the tree that we will discuss today.
Data->api
Designernews
Dribble
Producthunt
If you open the
navigation drawer and click on
Dribble following
My Dribble Shots
My Dribble likes
You will be asked
for a login into Dribble.
Plaid app uses Retrofit to for the communication with
Dribble API , why ? Just because its
awesome , you will see how in this post. Retrofit is popular
library among all android developers for communicating with Rest APIs and its
from SQUARE.
for Dribblelogin
activity , in AndroidManifest.xml, we haveandroid:launchmode = "SingleTop" ,
Once we are
redirected back to the activity after authentication , we use the same activity
instance and redeliver the intent to same activity.
This time onNewIntent() is invoked and since we will receive the access token as part of this intent we fetch the accesstoken. Then we authenticate with Dribble auth endpoint using the client ID / SECRET and the access token that we received. Once the authentication is successful , the logged in user is displayed.
Responsible for loading data from the
various sources. Instantiating classes are responsible for
providing the {code onDataLoaded} method to
do something with the data.
Important bit to
note here is DataManager extends from BaseDatamanager which has an abstract
method onDataLoded which will be called once the data is fetched from sources selected in the filter
DataManager constructor accepts filterAdapter and then loads data from all the
filters in the adapter
It also implements
filtersChanged listener interface so that it gets notified when the filters
change and then it can load resources of that filter
Important bit to
note here is DataManager extends from BaseDatamanager which has an abstract
method
public abstract void
onDataLoaded(List<? extends PlaidItem> data);
In HomeAcivity when
the Datamanager is initialized this method is implemented