Profile cover photo
Profile photo
Albaraa Mishlawi
34 followers -
Web & Mobile Developer
Web & Mobile Developer

34 followers
About
Albaraa Mishlawi's posts

Post has shared content
Android Support Library 23.1.1 available now

This release of the Android Support Library (http://goo.gl/x0n2NM) contains a number of important bug and crash fixes, including fixes to
- Loaders in nested fragments
- Styling of FloatingActionButton on devices prior to Ice Cream Sandwich
- ProGuard usage for the Preferences Support Library
- RecyclerView swipe to dismiss bug (https://goo.gl/0kmOIk)

As well as many other fixes throughout the Design, RecyclerView, Palette, and Leanback Support Libraries.

You’ll also find a new API for retrieving header views for NavigationView with getHeaderView(): http://goo.gl/dt3RmU

Please continue to file any Support Library bugs at https://goo.gl/B8MvOe

Post has shared content
Android pro tip: One-line custom fonts in XML with data binding!

I started playing with data binding last night for real, and I'm amazed by the power it gives you.  Check out this one-liner to set a custom font on a TextView:

@BindingAdapter({"bind:font"})
public static void setFont(TextView textView, String fontName){
 textView.setTypeface(Typeface.createFromAsset(textView.getContext().getAssets(), "fonts/" + fontName));
}

In XML:
<TextView
app:font="@{`Source-Sans-Pro-Regular.ttf`}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>

Previously, this used to take endless lines of repetitive Java code (one for each TextView!). The missing custom typeface support in TextView has been a grievance held against the Android platform for years.  There's even an inventive library to address it[2]. Data binding makes all of that obselete.  If you can't tell, I'm in love!!  It's terse, powerful, and one of the biggest leaps forward I've seen for Android productivity.

As usual, you need to put your font file in assets/fonts/, and make sure to include the data binding framework.  And if you're doing this to many TextViews, just get a little more fancy and cache the Typeface instead of creating it every time (thanks for the reminder +Ian Lake!)

[1] https://developer.android.com/tools/data-binding/guide.html
[2] Calligraphy: https://github.com/chrisjenx/Calligraphy
Photo

Post has attachment
Ya Allah Make Me Strong In Your Way 
Photo

Post has attachment
Wait while more posts are being loaded