Profile cover photo
Profile photo
Vlad Mihalachi
258 followers -
Take the risk, or lose the chance.
Take the risk, or lose the chance.

258 followers
About
Vlad's posts

Post is pinned.Post has attachment
'Just Quote It!' is now finally available for Android and Android Wear! Try it out!
#app‬   #android   #playstore   #androidwear   #justquoteit  

Post has attachment
The Android Wear version of the new app "Just Quote It!" is ready! #justquoteit #androidwear #app

PhotoPhotoPhotoPhoto
04/08/16
4 Photos - View album

Post has shared content

Post has shared content
So much to learn of data binding, thanks +Lisa Wray for this kind of posts!
Pro tip: More data binding — Easy view visibility in XML!

I heard you guys like data binding.  Here's another trick I've added to my portfolio: boolean visibility.

When I first started on Android, it seemed so obvious to me a View was visible, or not, I often made mistakes in my xml files like:

android:visible="false"

Don't laugh!  You know you do too.  After four years I can now type View.GONE in my sleep, so when I first started with data binding, I imported View and wrote code like this:
<data>
<import type="android.view.View"/>
</data>

<TextView 
android:visibility="@{user.role== null ? View.GONE : View.VISIBLE}"
/>

You know this pattern; it exists wherever optional fields of data are displayed in the UI.  My code reviewer objected this was awkward and wordy.  I began to point out that View has three states of visibility and therefore a boolean would not do when I realized he was right.  I had some kind of View-induced Stockholm syndrome and there was now a better way — I had known it when I first started.

I now use 
app:visible="@{user.role!= null}"

and in my Java code, I wrote ONCE AND FOREVER:
@BindingAdapter({"bind:visible"})
public static void setVisible(View view, boolean visible) {
view.setVisibility(visible ? View.VISIBLE : View.GONE);
}

AND THEN I WAS FREE.

Notes:
- Someone will probably ask; data binding does avoid NPEs (e.g. android:text="@{user.role}" would not throw an exception if role is null) but it will not automatically hide the view—just make it empty. Sometimes this is enough; often (like in the example user badge) you need to hide the view to achieve correct alignment or avoid gaps.
- What about View.INVISIBLE?!  You can still use it. If you want.

Data binding: 
https://developer.android.com/tools/data-binding/guide.html
Photo

Post has shared content
Android Studio 1.4 Preview 1 is now available in the canary channel, with a number of new features - a new theme editor, network and GPU monitors,  a vector icon wizard, new lint checks, new quickfixes, etc.

For more information, see the release announcement:
http://tools.android.com/recent/androidstudio14preview1incanarychannel

Post has shared content

Post has shared content
How to use a U2F security key to protect access to your Dropbox account: http://bit.ly/1TnlmFL
Photo

Post has attachment
do you ever wonder at what point you just got to say fuck it man? Like when you gotta stop living up here, and start living down here? #8mile  
Photo

Post has shared content
It's warmed up enough to try 3d printing again, and I needed to test my printer after repairing a z coupling. So, shark clip.
Animated Photo

Post has shared content
100 days of Google Dev, Episode 65/100

Android Performance Patterns Season 3 is here!!!

No one wants to be stuck inside all day, debugging the performance of their app; So Android Performance Patterns is here to get you back in the sun!

+Colt McAnlis has 12 great new episodes covering topics like Enums, Shared Memory, and Networking Performance.

It's like a summer pool party, but for performance... and also you don't have to deal with 1/2 lbs of leftover guacamole... (seriously.. what are we supposed to do with this stuff?)

https://goo.gl/qHoY0D

#GoogleDev100 / #PERFMATTERS
Wait while more posts are being loaded