<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Arnaud Camus</title>
		<description>Personal website where I share about technology, leadership and other topics important to me.</description>
		<link>/</link>
		<atom:link href="/feed.xml" rel="self" type="application/rss+xml" />
		
			<item>
				<title>A Tale of Two Platforms: Keeping Android & iOS in Sync</title>
				<description>&lt;p&gt;Over its 4 first years, Impraise’s mobile applications have grown with various updates, refactoring and feature changes. While being a young startup allowed us to “move fast and break things”, we grew to a stage where we had to invest more on testing, stability and future proof implementations.
We evaluated the pros and cons of various architectures &amp;amp; frameworks, for both our Android and iOS applications.&lt;/p&gt;

&lt;p&gt;Our goal was to find an Architecture:
– Easily testable and maintainable
– Easily adaptable to Android and iOS
– Adoptable without massive refactoring needed
– With an unidirectional flow of events&lt;/p&gt;

&lt;p&gt;We adopted &lt;code class=&quot;highlighter-rouge&quot;&gt;Clean Swift&lt;/code&gt; as a base for our iOS architecture, and adapted it to Android. In this talk, I share with Guilherme, our lead mobile developer, the similarities and differences of our implementations, as well as their advantages and drawbacks.&lt;/p&gt;

&lt;center&gt;
&lt;iframe src=&quot;https://player.vimeo.com/video/267250251&quot; width=&quot;640&quot; height=&quot;360&quot; frameborder=&quot;0&quot; allow=&quot;autoplay; fullscreen&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;
&lt;/center&gt;

&lt;p&gt;The video is hosted on &lt;a href=&quot;https://vimeo.com/267250251&quot;&gt;Vimeo&lt;/a&gt; by &lt;a href=&quot;https://vimeo.com/appdevcon&quot;&gt;Appdevcon&lt;/a&gt; .&lt;/p&gt;
</description>
				<pubDate>Fri, 16 Mar 2018 00:00:00 +0000</pubDate>
				<link>/appdevcon-conference-talk</link>
				<guid isPermaLink="true">/appdevcon-conference-talk</guid>
			</item>
		
			<item>
				<title>Building mobile sign up flows @ Droidcon Berlin</title>
				<description>&lt;p&gt;Last week I went to Berlin to attempt to &lt;a href=&quot;https://twitter.com/search?q=%23droidconde&quot;&gt;#DroidconDe&lt;/a&gt; where I gave my first public talk. It was a great experience, slightly stressful but I got some good feedback afterward. And eh, I love to receive feedback.&lt;/p&gt;

&lt;p&gt;This year the event was really well organized and 3 of the 4 stages were recorded and you can find all talks &lt;a href=&quot;https://www.youtube.com/playlist?list=PL9Pfzam3fFdeURdCGf1vlBrnMn3MxjvRS&quot;&gt;on the Droidcon Berlin youtube channel&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Here’s my talk, entitled &lt;strong&gt;Build a Sign up flow that doesn’t suck&lt;/strong&gt; with tips to improve your sign up and login screens on Android.&lt;/p&gt;

&lt;center&gt;
&lt;iframe width=&quot;480&quot; height=&quot;360&quot; src=&quot;http://www.youtube.com/embed/6ivxjklDRFY&quot; frameborder=&quot;0&quot;&gt; &lt;/iframe&gt;
&lt;/center&gt;

&lt;p&gt;Many good talks have been given during this 2 days conference, here’s a small collection of presentation I liked:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=iAJrL0P6uGA&quot;&gt;The Cognitive Abilities of the Human Mind&lt;/a&gt; - Janne Jul Jensen (UX)&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=X28Oogg2Q3k&quot;&gt;Dismantling droids for breakfast&lt;/a&gt; - Siegfried Rasthofer (Security / Reverse-engineering)&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=Cfb3RAyQg4w&quot;&gt;Recyclerview to the rescue&lt;/a&gt; - Brett Duncavage (Dev)&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=sdkcuvZCh1U&quot;&gt;Layout traversals on Android&lt;/a&gt; -  Lucas Rocha (Dev)&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=Q_dQ-sxV1nw&quot;&gt;Android @ Dropbox&lt;/a&gt; - Aakash Kambuj (Dev / PM)&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=-BvN0X5tqjw&quot;&gt;Kotlin: the swift of Android&lt;/a&gt; -  Svetlana Isakova (Dev)&lt;/li&gt;
&lt;/ul&gt;
</description>
				<pubDate>Wed, 10 Jun 2015 00:00:00 +0000</pubDate>
				<link>/my-first-tech-talk-droidcon-berlin</link>
				<guid isPermaLink="true">/my-first-tech-talk-droidcon-berlin</guid>
			</item>
		
			<item>
				<title>Combining Glide and Stetho to easily debug your image loading system</title>
				<description>&lt;p&gt;Downloading, managing and displaying efficiently images on Android can be a difficult task. Luckily, libraries like &lt;a href=&quot;https://github.com/bumptech/glide&quot;&gt;Glide&lt;/a&gt;  or &lt;a href=&quot;http://square.github.io/picasso/&quot;&gt;Picasso&lt;/a&gt; made it really handy for any developer. While they both are really easy to implement and integrate perfectly within the &lt;code class=&quot;highlighter-rouge&quot;&gt;Activity&lt;/code&gt; and &lt;code class=&quot;highlighter-rouge&quot;&gt;Fragment&lt;/code&gt; lifecyle; Glide proposes also a killing feature: letting the developer choose his network stack.&lt;/p&gt;

&lt;p&gt;On its side, &lt;a href=&quot;http://facebook.github.io/stetho/&quot;&gt;Stetho&lt;/a&gt; is an Android debug bridge tool which bring View hierarchy, Network &amp;amp; DB inspection and more into your Chrome Developer Tools. It is really handy and comes almost for free in terms of implementation. (&lt;a href=&quot;http://littlerobots.nl/blog/stetho-for-android-debug-builds-only/&quot;&gt;Here’s a good tutorial&lt;/a&gt; to only use it with your &lt;code class=&quot;highlighter-rouge&quot;&gt;Debug&lt;/code&gt; builds)&lt;/p&gt;

&lt;p&gt;So we have 2 good libraries, and both of them support &lt;a href=&quot;http://square.github.io/okhttp/&quot;&gt;OkHttp&lt;/a&gt; as a networking client.&lt;/p&gt;

&lt;p&gt;Now let’s see how can we combine them to see every HTTP requests from Glide into your Developer Tools.&lt;/p&gt;

&lt;h3 id=&quot;1-setting-up-the-network-inspection-via-stetho&quot;&gt;1. Setting up the Network inspection via Stetho&lt;/h3&gt;

&lt;p&gt;First, in your gradle file you should have:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;debugCompile 'com.facebook.stetho:stetho:1.1.0'
debugCompile 'com.facebook.stetho:stetho-okhttp:1.1.0'
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Then in your Application class you enable the webkit inspector:&lt;/p&gt;

&lt;p&gt;Stetho.initialize(Stetho.newInitializerBuilder(context)
                        .enableWebKitInspector(Stetho.defaultInspectorModulesProvider(context))
                        .build());
You finally just need to add a &lt;code class=&quot;highlighter-rouge&quot;&gt;StethoInterceptor&lt;/code&gt; to your &lt;code class=&quot;highlighter-rouge&quot;&gt;OkHttpClient&lt;/code&gt; and ta-daaa!&lt;/p&gt;

&lt;p&gt;OkHttpClient okClient = new OkHttpClient();
            okClient.networkInterceptors().add(new StethoInterceptor());&lt;/p&gt;

&lt;h3 id=&quot;2-configuring-glide-to-use-okhttp-and-stetho&quot;&gt;2. Configuring Glide to use OkHttp and Stetho&lt;/h3&gt;

&lt;p&gt;Glide provides also a basic &lt;code class=&quot;highlighter-rouge&quot;&gt;GlideModule&lt;/code&gt; to directly use OkHttp. I recommend you to read how to integrate it directly &lt;a href=&quot;https://github.com/bumptech/glide/wiki/Integration-Libraries#okhttp&quot;&gt;in their page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;But this is not enough to make it work. The &lt;code class=&quot;highlighter-rouge&quot;&gt;OkHttpGlideModule&lt;/code&gt; does not allow you to configure the &lt;code class=&quot;highlighter-rouge&quot;&gt;OkHttpClient&lt;/code&gt;. You do need to compile the &lt;code class=&quot;highlighter-rouge&quot;&gt;okhttp-integration&lt;/code&gt; library but you will have to create your own &lt;code class=&quot;highlighter-rouge&quot;&gt;GlideModule&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;public class StethoOkHttpGlideModule  implements GlideModule {
    @Override
    public void applyOptions(Context context, GlideBuilder builder) { }

    @Override
    public void registerComponents(Context context, Glide glide) {
        OkHttpClient client = new OkHttpClient();
        client.networkInterceptors().add(new StethoInterceptor());
        glide.register(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(client));
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And do not forget to reference you module in your &lt;code class=&quot;highlighter-rouge&quot;&gt;AndroidManifest.xml&lt;/code&gt; file:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; &amp;lt;meta-data android:name=&quot;utils.glide.StethoOkHttpGlideModule&quot;
            android:value=&quot;GlideModule&quot; /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;3-try-it&quot;&gt;3. Try it!&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;https://arnaud-camus.fr//assets/media/glide-stetho.png&quot; alt=&quot;And enjoy!&quot; /&gt;&lt;/p&gt;
</description>
				<pubDate>Sun, 10 May 2015 00:00:00 +0000</pubDate>
				<link>/combining-glide-and-stetho-to-easily-debug-your-image-loading-system</link>
				<guid isPermaLink="true">/combining-glide-and-stetho-to-easily-debug-your-image-loading-system</guid>
			</item>
		
			<item>
				<title>Material design, extended Toolbar and scrolling</title>
				<description>&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;OBSELETE&lt;/strong&gt;: With the Design Support Library announced during IO15 comes the &lt;a href=&quot;http://developer.android.com/reference/android/support/design/widget/CollapsingToolbarLayout.html&quot;&gt;CollapsingToolbarLayout&lt;/a&gt; which is much more powerful, elegant and easier to use. Use it!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The &lt;code class=&quot;highlighter-rouge&quot;&gt;ToolBar&lt;/code&gt; is a widget introduced by Google through the app-compat version 21 last fall. It basically replaces the good old &lt;code class=&quot;highlighter-rouge&quot;&gt;ActionBar&lt;/code&gt; and bring much more controls on it. Styling and customisation is also much easier because you directly integrate the &lt;code class=&quot;highlighter-rouge&quot;&gt;ToolBar&lt;/code&gt; into your view hierarchy, giving you all the benefits of the View class.&lt;/p&gt;

&lt;p&gt;One issue with this extended version of the action bar is the &lt;code class=&quot;highlighter-rouge&quot;&gt;height&lt;/code&gt; it can takes on the screen. And collapsing the toolbar’s content while scrolling a list is tricky.&lt;/p&gt;

&lt;h3 id=&quot;objectives&quot;&gt;Objectives:&lt;/h3&gt;

&lt;p&gt;Fade out the white text when we start scrolling and display the toolbar’s title.
Reverse it when the we scroll up to the top.
Make the Floating Action Button follow the edge of the header.
Support properly the elevation on Lollipop.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;TL;DR:&lt;/em&gt; The whole source code is available on &lt;a href=&quot;https://github.com/lynfogeek/CollapsingHeader&quot;&gt;my github&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://arnaud-camus.fr//assets/media/collapsing_header.png&quot; alt=&quot;Result&quot; /&gt;&lt;/p&gt;

&lt;p&gt;First step, from a layout perspective, it is pretty simple and straight forward: I use a &lt;code class=&quot;highlighter-rouge&quot;&gt;ToolBar&lt;/code&gt;, a &lt;code class=&quot;highlighter-rouge&quot;&gt;ListView&lt;/code&gt; and a Floating Action Button:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;RelativeLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
xmlns:tools=&quot;http://schemas.android.com/tools&quot;
xmlns:fab=&quot;http://schemas.android.com/apk/res-auto&quot;
android:layout_width=&quot;match_parent&quot;
android:layout_height=&quot;match_parent&quot;
android:orientation=&quot;vertical&quot;
tools:context=&quot;.MainActivity&quot;&amp;gt;

&amp;lt;android.support.v7.widget.Toolbar
    android:id=&quot;@+id/toolbar&quot;
    android:layout_width=&quot;match_parent&quot;
    android:layout_height=&quot;wrap_content&quot;
    android:elevation=&quot;4dp&quot;
    android:background=&quot;?attr/colorPrimary&quot;
    app:theme=&quot;@style/ThemeOverlay.AppCompat.Dark.ActionBar&quot;/&amp;gt;

&amp;lt;ListView
    android:id=&quot;@+id/listview&quot;
    android:layout_below=&quot;@+id/toolbar&quot;
    android:layout_width=&quot;match_parent&quot;
    android:layout_height=&quot;match_parent&quot;/&amp;gt;


&amp;lt;com.getbase.floatingactionbutton.FloatingActionButton
    android:layout_width=&quot;wrap_content&quot;
    android:layout_height=&quot;wrap_content&quot;
    android:id=&quot;@+id/favorite&quot;
    android:layout_alignBottom=&quot;@+id/toolbar&quot;
    android:layout_alignParentRight=&quot;true&quot;
    android:layout_alignParentEnd=&quot;true&quot;
    android:layout_marginRight=&quot;8dp&quot;
    android:layout_marginEnd=&quot;8dp&quot;
    android:elevation=&quot;8dp&quot;
    android:layout_marginBottom=&quot;-32dp&quot;
    fab:fab_icon=&quot;@drawable/ic_favorite_outline_white_24dp&quot;
    fab:fab_colorNormal=&quot;@color/accent&quot;
    fab:fab_size=&quot;mini&quot;
    /&amp;gt;
&amp;lt;/RelativeLayout&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Then, I use another layout containing the header’s &lt;code class=&quot;highlighter-rouge&quot;&gt;TextView&lt;/code&gt;s. I inflate it in my Activity and attach it to the &lt;code class=&quot;highlighter-rouge&quot;&gt;ListView&lt;/code&gt; using &lt;code class=&quot;highlighter-rouge&quot;&gt;mListView.addHeaderView(view);&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;FrameLayout&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;xmlns:android=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://schemas.android.com/apk/res/android&quot;&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;android:layout_width=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;match_parent&quot;&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;android:layout_height=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;wrap_content&quot;&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;android:elevation=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;4dp&quot;&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;android:background=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;?attr/colorPrimary&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;LinearLayout&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;android:layout_width=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;match_parent&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;android:layout_height=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;wrap_content&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;android:id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;@+id/container&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;android:orientation=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;vertical&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;android:paddingLeft=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;16dp&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;android:paddingRight=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;16dp&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;android:paddingBottom=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;16dp&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;

    &lt;span class=&quot;nt&quot;&gt;&amp;lt;TextView&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;android:layout_width=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;match_parent&quot;&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;android:layout_height=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;wrap_content&quot;&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;android:textColor=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;@color/icons&quot;&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;android:textSize=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;24sp&quot;&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;android:text=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;@string/title&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;

    &lt;span class=&quot;nt&quot;&gt;&amp;lt;TextView&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;android:layout_width=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;match_parent&quot;&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;android:layout_height=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;wrap_content&quot;&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;android:layout_marginTop=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;16dp&quot;&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;android:textColor=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;@color/icons&quot;&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;android:textSize=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;14sp&quot;&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;android:text=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;@string/description&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;&amp;lt;/LinearLayout&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/FrameLayout&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;To react on the scroll event, we need to listen to the &lt;code class=&quot;highlighter-rouge&quot;&gt;AbsListView.OnScrollListener&lt;/code&gt;. In the method &lt;code class=&quot;highlighter-rouge&quot;&gt;onScroll&lt;/code&gt;. we simply check if the top position of the first list item visible and if it is the item #0. Finally, if its Y position is more than -16dp, we display the header’s content and hide the &lt;code class=&quot;highlighter-rouge&quot;&gt;ActionBar&lt;/code&gt;’s title. Otherwise, it is the opposite.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;if (view != null &amp;amp;&amp;amp; view.getChildCount() &amp;gt; 0 &amp;amp;&amp;amp; firstVisibleItem == 0) {
    if (view.getChildAt(0).getTop() &amp;lt; -dpToPx(16)) {
        toggleHeader(false, false);
    } else {
        toggleHeader(true, true);
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code class=&quot;highlighter-rouge&quot;&gt;toggleHeader&lt;/code&gt; function is shown below. It starts an &lt;code class=&quot;highlighter-rouge&quot;&gt;ObjectAnimator&lt;/code&gt; controlling the alpha property from the current opacity and toggle the visibility of the title.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;private void toggleHeader(boolean visible, boolean force) {
if ((force &amp;amp;&amp;amp; visible) || (visible &amp;amp;&amp;amp; mContainerHeader.getAlpha() == 0f)) {
    fade.setFloatValues(mContainerHeader.getAlpha(), 1f);
    fade.start();
} else if (force || (!visible &amp;amp;&amp;amp; mContainerHeader.getAlpha() == 1f)){
    fade.setFloatValues(mContainerHeader.getAlpha(), 0f);
    fade.start();
}
// Toggle the visibility of the title.
if (getSupportActionBar() != null) {
    getSupportActionBar().setDisplayShowTitleEnabled(!visible);
}
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;To polish the effect, you can coordinate the &lt;code class=&quot;highlighter-rouge&quot;&gt;ToolBar&lt;/code&gt; and &lt;code class=&quot;highlighter-rouge&quot;&gt;headerView&lt;/code&gt;’s elevation and update the Y position of the FAB so it always follow the edge of our header. Here’s a last snippet of code to do so:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;public void onScroll(AbsListView view,
                    int firstVisibleItem,
                    int visibleItemCount,
                    int totalItemCount) {
   if (view != null &amp;amp;&amp;amp; view.getChildCount() &amp;gt; 0 &amp;amp;&amp;amp; firstVisibleItem == 0) {
       int translation = view.getChildAt(0).getHeight() + view.getChildAt(0).getTop();
       mFab.setTranslationY(translation&amp;gt;0  ? translation : 0);
   }

   if (isLollipop()) {
       if (firstVisibleItem == 0) {
           mToolbar.setElevation(0);
       } else {
           mToolbar.setElevation(dpToPx(4));
       }
   }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And this is the &lt;a href=&quot;https://github.com/lynfogeek/CollapsingHeader&quot;&gt;result&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://arnaud-camus.fr//assets/media/collapsing_header_animated.gif&quot; alt=&quot;Final result&quot; /&gt;&lt;/p&gt;
</description>
				<pubDate>Mon, 23 Feb 2015 00:00:00 +0000</pubDate>
				<link>/material-design-extended-toolbar-and-scrolling</link>
				<guid isPermaLink="true">/material-design-extended-toolbar-and-scrolling</guid>
			</item>
		
			<item>
				<title>Open Sourcing the Droidcon Netherlands app</title>
				<description>&lt;p&gt;&lt;a href=&quot;http://droidcon.com/&quot;&gt;Droidcon&lt;/a&gt; is a global developer conference series which takes place every year in a dozen of different cities around the world. The quality of the talks is really impressive, every time I go to one of these events I learn a lot on various technical and design points.&lt;/p&gt;

&lt;p&gt;This year, I had the chance to make the conference app for the Dutch edition. &lt;a href=&quot;http://www.droidcon.nl/&quot;&gt;Droidcon NL&lt;/a&gt; took place in Amsterdam between the 23rd and 25th of November.&lt;/p&gt;

&lt;h2 id=&quot;the-application&quot;&gt;The application&lt;/h2&gt;

&lt;p&gt;The goal of this app was not to be the best conference app ever but a simple and easy to use application. I chose to follow the &lt;a href=&quot;http://www.google.com/design/spec/&quot;&gt;Material Design guidelines&lt;/a&gt; which give a really nice look &amp;amp; feel, and allows doing some nice effects really efficiently.&lt;/p&gt;

&lt;p&gt;The app lists the schedule in the home screen, and you can get more information for each conference, such as the description, location and speaker. I also implemented a simple &lt;a href=&quot;http://www.google.com/design/spec/components/buttons.html#buttons-floating-action-button&quot;&gt;Floating Action Button&lt;/a&gt; to favorite a talk, this simply highlights it on the main screen.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://arnaud-camus.fr//assets/media/screenshot_droidconnl.png&quot; alt=&quot;The App&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;the-source-code&quot;&gt;The source code&lt;/h2&gt;

&lt;p&gt;During the event, I talked to many people about the app, and besides some tips for improvement, few developers asked me if the source code will be available. So I decided to clean it, refactor a few classes and here we go. &lt;a href=&quot;https://github.com/lynfogeek/droidconNL-2014&quot;&gt;You can browse / fork / download the source code from my github.&lt;/a&gt; It’s released under &lt;a href=&quot;https://github.com/lynfogeek/droidconNL-2014/blob/master/LICENSE&quot;&gt;Apache v2 license&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;the-app&quot;&gt;The app&lt;/h2&gt;

&lt;p&gt;If you just want to try it, &lt;a href=&quot;appbox-octopress&quot;&gt;the application is still available on the Google Play&lt;/a&gt;, maybe I will update it for next year ;)&lt;/p&gt;
</description>
				<pubDate>Sun, 30 Nov 2014 00:00:00 +0000</pubDate>
				<link>/open-sourcing-the-droidcon-netherlands-app</link>
				<guid isPermaLink="true">/open-sourcing-the-droidcon-netherlands-app</guid>
			</item>
		
			<item>
				<title>3 ways Gradle can help in your daily work</title>
				<description>&lt;p&gt;This post is the first one of a small series of tips to optimize your development environment. And to start from the beginning, why not talking about our dear friend Gradle?&lt;/p&gt;

&lt;p&gt;Here I will show you 3 easy customizations that make your daily life easier. I will explain you how to:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#buildvariants&quot;&gt;Create multiples Build Variants&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#autoincrement&quot;&gt;Auto-increment your app’s version code and name after a build release&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#signapplication&quot;&gt;Sign your application from a configuration file or from a prompt&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;-create-multiples-build-variants&quot;&gt;&lt;a name=&quot;buildvariants&quot;&gt;&lt;/a&gt; Create multiples Build Variants&lt;/h2&gt;

&lt;p&gt;Gradle allows you to easily manage build variants. These ones are composed by a build type (Debug, Release) and product flavor you have created. Different product flavors can be used to build a free and pro version of your application, or different APKs according to the Android version, for example.&lt;/p&gt;

&lt;p&gt;I use these build variants to create different APKs for my applications in development and release mode. The apps have a different &lt;code class=&quot;highlighter-rouge&quot;&gt;applicationId&lt;/code&gt;, different resources such as the launcher and the app name (helpful to know which variant you are using). They also connect to different web services and log the errors to the console or send them to Crashlytics, according to the flavor.&lt;/p&gt;

&lt;p&gt;In your build.gradle:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    android {
      productFlavors {
        prod {
            applicationId &quot;com.example.myapplication&quot;
        }
        staging {
          applicationId &quot;com.example.myapplication.dev&quot;
        }
      }
    }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;https://arnaud-camus.fr//assets/buildvariants.png&quot; alt=&quot;Build variant&quot; /&gt;
Once your project has been synced in Android Studio, you will be able to choose the Build Variant on the bottom right of your IDE.&lt;/p&gt;

&lt;p&gt;Don’t forget to create your prod/ and staging/ sub-folders in order to compile different source code and resources into your APK.&lt;/p&gt;

&lt;h2 id=&quot;-auto-increment-your-apps-version-code-and-name&quot;&gt;&lt;a name=&quot;autoincrement&quot;&gt;&lt;/a&gt; Auto-increment your app’s version code and name&lt;/h2&gt;

&lt;p&gt;In order to not forget to increment the &lt;code class=&quot;highlighter-rouge&quot;&gt;versionCode&lt;/code&gt; attribute in my &lt;code class=&quot;highlighter-rouge&quot;&gt;AndroidManifest.xml&lt;/code&gt; before submitting an app on the Play Store, I have found and adapted the following solution to handle it automatically after each Release build.&lt;/p&gt;

&lt;p&gt;To do so, first, include on the top of your build.gradle file the following import:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;import java.util.regex.Pattern
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Then, copy this task and read the comment to understand it!&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;task('increaseVersionCodeRelease') &amp;lt;&amp;lt; { //create a new task
    def manifestFile = rootProject.file(&quot;app/src/main/AndroidManifest.xml&quot;) //locate your Manifest
    def manifestText = manifestFile.getText() //get the file's content
    //search for the current versionCode
    def pattern = Pattern.compile(&quot;versionCode=\&quot;(\\d+)\&quot;&quot;)
    def matcher = pattern.matcher(manifestText)
    matcher.find()
    // increment it and update the file
    def versionCode = Integer.parseInt(matcher.group(1)) +1
    def manifestContent = matcher.replaceAll(&quot;versionCode=\&quot;&quot; + versionCode + &quot;\&quot;&quot;)
    manifestFile.write(manifestContent)
    // get the new content
    manifestText = manifestFile.getText()

    // search for the current versionName
    def pattern2 = Pattern.compile(&quot;versionName=\&quot;(\\d+).(\\d+).(\\d+)\&quot;&quot;) //I use Semantic Versioning
    def matcher2 = pattern2.matcher(manifestText)
    matcher2.find()
    def versionCodeName = Integer.parseInt(matcher2.group(1))
    def versionCodeName2 = Integer.parseInt(matcher2.group(2))
    // increment it and update the file
    def versionCodeName3 = Integer.parseInt(matcher2.group(3)) +1
    def manifestContent2 = matcher2.replaceAll(&quot;versionName=\&quot;&quot; + versionCodeName +&quot;.&quot; + versionCodeName2 +&quot;.&quot; + versionCodeName3 + &quot;\&quot;&quot;)
    manifestFile.write(manifestContent2)
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In order to get this task executed when the ProdRelease build processes, add this:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;tasks.whenTaskAdded { task -&amp;gt;
    if (task.name == 'assembleProdRelease') {
        task.dependsOn 'increaseVersionCodeRelease'
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; It only increments the latest number of the version and you could create another flavor with its own task to increment the first number of the version, when you are building a new major release.&lt;/p&gt;

&lt;h2 id=&quot;-sign-your-application-from-a-configuration-file-or-from-a-prompt&quot;&gt;&lt;a name=&quot;signapplication&quot;&gt;&lt;/a&gt; Sign your application from a configuration file or from a prompt&lt;/h2&gt;

&lt;p&gt;There are many ways to sign your application APK. And I will describe below 2 of them. The first one uses a configuration file. Create a file containing the following:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;storeFile=/path_to_your/keystore
storePassword=p@ss
keyAlias=MyAliasName
keyPassword=p@ssw0rd
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And then add this in your build.gradle.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;signingConfigs {
release {
    def propsFile = rootProject.file('app/keys.properties')
    def props = new Properties()
    props.load(new FileInputStream(propsFile))

    storeFile file(props['storeFile'])
    storePassword props['storePassword']
    keyAlias props['keyAlias']
    keyPassword props['keyPassword']
}
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Note that in this example my configuration file is named keys.properties and located into the &lt;code class=&quot;highlighter-rouge&quot;&gt;app&lt;/code&gt; sub-directory.&lt;/p&gt;

&lt;p&gt;If you don’t want your password to be saved in a file, another solution is ask the user to input it from the console:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;signingConfigs {
  release {
     storeFile file(System.console().readLine(&quot;\nEnter keystore path:&quot;))
     storePassword System.console().readLine(&quot;\nEnter keystore password:&quot;)
     keyAlias System.console().readLine(&quot;\nEnter key alias: &quot;)
     keyPassword System.console().readLine(&quot;\nEnter key password:&quot;)
  }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If you want to learn more about Gradle you can read &lt;a href=&quot;http://tools.android.com/tech-docs/new-build-system/user-guide&quot;&gt;the official guide&lt;/a&gt;.
Do you have some other tips to share? Feel free to comment below!&lt;/p&gt;
</description>
				<pubDate>Wed, 15 Oct 2014 00:00:00 +0000</pubDate>
				<link>/3-tips-gradle-helps-android-development</link>
				<guid isPermaLink="true">/3-tips-gradle-helps-android-development</guid>
			</item>
		
	</channel>
</rss>
