Wednesday, January 20, 2016

Learnings from Nick Butcher's Plaid App - Part-1

Manifest.xml

  • Activity Alias

       Why to use activity alias and how to use it ?
       This is the best explanation so far i have seen :
       http://blog.danlew.net/2014/01/16/preserve-your-launchers-use-activity-alias/


<activity  
   android:name=".ui.HomeActivity"  
   android:label="@string/app_name"  
   android:theme="@style/Plaid.Home"  
   android:exported="true" />  
 <!-- use an alias in case we want to change the launch activity later without breaking  
    homescreen shortcuts. Note must be defined after the targetActivity -->  
 <activity-alias  
   android:name=".Launcher"  
   android:label="@string/app_name"  
   android:targetActivity=".ui.HomeActivity">  
   <intent-filter>  
     <action android:name="android.intent.action.MAIN" />  
     <category android:name="android.intent.category.LAUNCHER" />  
   </intent-filter>  
 </activity-alias>  

activity_home.xml

  • ViewStub

      I didnt know about ViewStub and its advantage. Please go through this article
      http://android-developers.blogspot.com/2009/03/android-layout-tricks-3-optimize-with.html
  • Progressbar tinting using the accent color

    android:indeterminateTint="?android:colorAccent" 
    android:indeterminateTintMode="src_in"
     <ProgressBar  
       android:id="@android:id/empty"  
       android:layout_width="wrap_content"  
       android:layout_height="wrap_content"  
       android:layout_gravity="center"  
       android:indeterminate="true"  
       android:indeterminateTint="?android:colorAccent"  
       android:indeterminateTintMode="src_in" />  

No comments:

Post a Comment