Profile

Cover photo
Amokrane Chentir
Works at Lookout Mobile Security
Attended ISIMA
334 followers|31,499 views
AboutPostsPhotosVideos

Stream

 
 
After struggling with trying to figure out how various pieces fit together, I've done some research and put together the complete Android Activity/Fragment lifecycle chart. This has two parallel lifecycles (activities and fragments) which are organized vertically by time. Lifecycle stages will occur in the vertical order in which they're displayed, across activities and fragments. In this way, you can see how your fragments interact with your activities.

In addition to the attached image, I've also got an SVG: http://staticfree.info/~steve/complete_android_fragment_lifecycle.svg which is suitable for printing.

If this is missing lifecycle steps or is inaccurate in any way, let me know so I can update it!

#Android #androiddev  
1
Add a comment...
 
 
The website goes on to provide technical details and remediation advice, but you can already tell your boss “I can’t do that today, boss.  We have to respond to heartbleed.com.”  If he spends even 30 seconds glancing at that executive summary he’ll say “Crikey.  Yep, you do.”  I particularly liked the recognition that most remediation of Heartbleed would be done by businesses, which is probably why the writer focused on “business critical documents” rather than the more anodyne “data.”  Data gets weighed by the gigabyte but business critical documents spur immediate action when threatened.
1
Add a comment...
 
 
Heartbleed in pictures.

This is the most accessible explanation yet, from xkcd.

http://m.xkcd.com/1354/

#Heartbleed #xkcd #security
1
Add a comment...
 
 
Android Mockup & Concept Tool - Update - Version 3.1

Version 3.1 is here bringing a lot of new things. + a suggest form. You can now suggest what I should include in the next version from google apps & android os elements.

Downloadhttp://goo.gl/JzZWM4

changelog - march 28, 2014

• Fixed alignment stuff
• Renamed some stuff
• Organized & Color coordinated Stuff to be more visible

• Notification Drawer Style [Right side]
• Holo Light & Holo Dark Overflow Menu
• Actionbar Spinner
• Actionbar Transparent
• Actionbar Contextual Holo Style
• Actionbar Pull To Refresh
• Actionbar Chrome Style
• Actionbar Bottom
• Actionbar Youtube Style
• Compose Bar
• Holo Light & Holo Dark Alert Popup
• About App Popup
• Picker Popup
         • Custom Header
         • Holo
• Holo Colors
1
Add a comment...
Have him in circles
334 people
Charles De Meulenaer's profile photo
Islem MALKI's profile photo

Amokrane Chentir

Shared publicly  - 
 
Mind blown!
 
Looks like Google has hidden registration links for #googleio in random Developer pages (hint look at the bottom):

https://developers.google.com/analytics/devguides/collection/android/v4/

Found one valid one!

#googleio #io14
1
Add a comment...

Amokrane Chentir

Shared publicly  - 
1
Add a comment...

Amokrane Chentir

Shared publicly  - 
 
 
Android App Polishing: Show UI State Through Icons

With the release of Capitaine Train for Android[0], several people recently asked me how we implemented some of the tips & tricks available in the application (some of these tricks are barely visible but remember, I love details :p). In order to showcase some of the most interesting application bits of code, I thought it could be helpful to Android developers to start a small series of posts. Feel free to comment this article if you want me to describe something you found nice in the Capitaine Train application.

As some of you may have noticed, we put a lot of attention to the search form in the Capitaine Train Android app. As I explained in my previous article[1], I'm not a huge fan of long texts. While often offering a great explanation, text requires a lot of parsing time. Icons are often a great alternative to text because they allow user to understand what's going on more rapidly.

When creating the search form, we thought about leveraging icons to help user better understand the current "form state". As a consequence, the form heavily relies on icons:

  • The "To" icon changes whether the search is round trip or not
  • Mandatory fields (i.e "From", "To" and "Passengers") icons turn red when missing
  • A red icon turns grey in edit mode while animating back to red if the field is not set when exiting the edit mode
  • The "Passengers" icon changes depending on the current number of selected passengers (see screencast)

As you can see in the screencast, the change is done as smoothly as possible simply fading between the different states. This can be done fairly easily thanks to a LevelListDrawable[2]. Here is the XML we use in Capitaine Train Android for the "Passengers" icon.

<?xml version="1.0" encoding="utf-8"?>
<level-list xmlns:android="http://schemas.android.com/apk/res/android">

    <!-- The error icon -->
    <item
        android:drawable="@drawable/ic_search_passengers_0"
        android:maxLevel="0"
        />

    <item
        android:drawable="@drawable/ic_search_passengers_1"
        android:maxLevel="1"
        />

    <item
        android:drawable="@drawable/ic_search_passengers_2"
        android:maxLevel="2"
        />

    <item
        android:drawable="@drawable/ic_search_passengers_several"
        android:maxLevel="10000"
        />

</level-list>

Starting API 11, you can animate changes in a LevelListDrawable or more globally in any DrawableContainer. Unfortunately, the framework only exposes the XML attributes in <selector /> (I really don't know why it has not being exposed to all DrawableContainer :s). Fortunately for us, you can tweak the fading duration values in your Java code with the set[Enter|Exit]FadeDuration(int) methods (yep I also don't know why the duration is an 'int' rather than a 'long').

In our code, we simply update the icon whenever there is an impacting change (an error occurred, the number of selected passenger changed, etc.). Here are some notes about the following snippet of code:

  • mFieldErrorState is a bit mask gathering all of the fields that are currently in error
  • mEditMode contains the current "edit mode" ("Passengers", "From", "To", etc.).
  • LEVEL_ERROR is 0 & LEVEL_NORMAL is 1

private void updateIcons(boolean animated) {
    final int animationDuration = (int) ANIMATION_DURATION;

    // Update the "From" icon...

    // Update the "To" icon...

    final Drawable passengersIcon = mPassengersView.getCompoundDrawables()[TextViewAdditions.INDEX_LEFT];
    if (passengersIcon != null) {
        if (passengersIcon instanceof LevelListDrawable) {
            ((LevelListDrawable) passengersIcon).setEnterFadeDuration(animationDuration);
            ((LevelListDrawable) passengersIcon).setExitFadeDuration(animationDuration);
        }
        int level = LEVEL_ERROR;
        if ((mFieldErrorState & ERROR_PASSENGERS) == 0 || mEditMode == EDIT_MODE_PASSENGERS) {
            level = Math.max(LEVEL_NORMAL, mPassengerIds.size());
        }
        passengersIcon.setLevel(level);
        if (!animated) {
            passengersIcon.jumpToCurrentState();
        }
    }
}

[0]: https://play.google.com/store/apps/details?id=com.capitainetrain.android
[1]: https://plus.google.com/118417777153109946393/posts/FABaJhRMCuy
[2]: http://developer.android.com/reference/android/graphics/drawable/LevelListDrawable.html
1
Add a comment...
 
 
Android App Polishing: Adding Subtle Attention Seekers

With the release of Capitaine Train for Android[0], several people recently asked me how we implemented some of the tips & tricks available in the application (some of these tricks are barely visible but remember, I love details :p). In order to showcase some of the most interesting application bits of code, I thought it could be helpful to Android developers to start a small series of posts. Feel free to comment this article if you want me to describe something you found nice in the Capitaine Train application.

During the entire development of the Capitaine Train Android app, we kept one important thing in mind: be subtle but still understandable. Although this rule is easy to understand it is always hard to implement correctly.

Some great examples of adding subtle but yet understandable visual tricks are the search form and the passenger detail screen. Indeed, when launching a new train search with some missing required fields, the field animates to indicate the user something is wrong. An equivalent is the "Add a passenger" ActionBar button than wobble when the user is tapping the empty screen indicating she/he has no registered passengers yet. This wobbling button is like saying "Hey, guy, tap me to create a new passenger!". The gif attached to this post demonstrates the animation but let's be honest I'm not a gif expert :s I highly encourage you to have a look at the Capitaine Train and try it out directly ;).

When used appropriately, attention seekers, are way better than these pretty ugly Toasts displayed right in the middle of the screen. Why? Mostly because they are subtle and require less time to be scanned/parsed than a long and difficult to read text.

But how to implement such an animation? It generally consists on several "back and forth"... We could have obviously implemented this using a sequence of ObjectAnimators or a pretty weird TimeInterpolator but that would have been quite painful. The trick is simply to leverage the animation framework by using the Keyframe[1] & PropertyValuesHolder[2] objects.

A Keyframe is an object that holds a time/value pair describing a particular state in an animation. For instance Keyframe.ofInt(.5f, Color.RED) indicates the color should be Color.RED at 50% of the animation duration.

A PropertyValuesHolder is a class that associates a property to some values. It is particularly useful whenever you want to animate several properties at once with a single ValueAnimator.

When developing the Capitaine Train application we created several attention seekers and tried them all. We finally ended up using only 2 different animations:
  
  • The "nope" animation: used whenever a field is invalid (this is the case when trying to start a search with some missing mandatory fields)
  • The "tada" animation: used to indicate the user the action she/he is looking for is probably a tap-away from this button (this is the case when tapping the empty state with no passenger and/or when tapping the "no cards" cell on the passenger detail screen)


public static ObjectAnimator tada(View view) {
    return tada(view, 1f);
}

public static ObjectAnimator tada(View view, float shakeFactor) {

    PropertyValuesHolder pvhScaleX = PropertyValuesHolder.ofKeyframe(View.SCALE_X,
            Keyframe.ofFloat(0f, 1f),
            Keyframe.ofFloat(.1f, .9f),
            Keyframe.ofFloat(.2f, .9f),
            Keyframe.ofFloat(.3f, 1.1f),
            Keyframe.ofFloat(.4f, 1.1f),
            Keyframe.ofFloat(.5f, 1.1f),
            Keyframe.ofFloat(.6f, 1.1f),
            Keyframe.ofFloat(.7f, 1.1f),
            Keyframe.ofFloat(.8f, 1.1f),
            Keyframe.ofFloat(.9f, 1.1f),
            Keyframe.ofFloat(1f, 1f)
    );

    PropertyValuesHolder pvhScaleY = PropertyValuesHolder.ofKeyframe(View.SCALE_Y,
            Keyframe.ofFloat(0f, 1f),
            Keyframe.ofFloat(.1f, .9f),
            Keyframe.ofFloat(.2f, .9f),
            Keyframe.ofFloat(.3f, 1.1f),
            Keyframe.ofFloat(.4f, 1.1f),
            Keyframe.ofFloat(.5f, 1.1f),
            Keyframe.ofFloat(.6f, 1.1f),
            Keyframe.ofFloat(.7f, 1.1f),
            Keyframe.ofFloat(.8f, 1.1f),
            Keyframe.ofFloat(.9f, 1.1f),
            Keyframe.ofFloat(1f, 1f)
    );

    PropertyValuesHolder pvhRotate = PropertyValuesHolder.ofKeyframe(View.ROTATION,
            Keyframe.ofFloat(0f, 0f),
            Keyframe.ofFloat(.1f, -3f * shakeFactor),
            Keyframe.ofFloat(.2f, -3f * shakeFactor),
            Keyframe.ofFloat(.3f, 3f * shakeFactor),
            Keyframe.ofFloat(.4f, -3f * shakeFactor),
            Keyframe.ofFloat(.5f, 3f * shakeFactor),
            Keyframe.ofFloat(.6f, -3f * shakeFactor),
            Keyframe.ofFloat(.7f, 3f * shakeFactor),
            Keyframe.ofFloat(.8f, -3f * shakeFactor),
            Keyframe.ofFloat(.9f, 3f * shakeFactor),
            Keyframe.ofFloat(1f, 0)
    );

    return ObjectAnimator.ofPropertyValuesHolder(view, pvhScaleX, pvhScaleY, pvhRotate).
            setDuration(1000);
}

public static ObjectAnimator nope(View view) {
    int delta = view.getResources().getDimensionPixelOffset(R.dimen.spacing_medium);

    PropertyValuesHolder pvhTranslateX = PropertyValuesHolder.ofKeyframe(View.TRANSLATION_X,
            Keyframe.ofFloat(0f, 0),
            Keyframe.ofFloat(.10f, -delta),
            Keyframe.ofFloat(.26f, delta),
            Keyframe.ofFloat(.42f, -delta),
            Keyframe.ofFloat(.58f, delta),
            Keyframe.ofFloat(.74f, -delta),
            Keyframe.ofFloat(.90f, delta),
            Keyframe.ofFloat(1f, 0f)
    );

    return ObjectAnimator.ofPropertyValuesHolder(view, pvhTranslateX).
            setDuration(500);
}

Once again, attention seekers are great but they should be used with parsimony. The less you use them, the greater their influence is.

#gde #android

[0]: https://play.google.com/store/apps/details?id=com.capitainetrain.android
[1]: http://developer.android.com/reference/android/animation/Keyframe.html
[2]: http://developer.android.com/reference/android/animation/PropertyValuesHolder.html
1
Add a comment...
 
 
Android App Polishing: Customizing Soft Keyboard Action Button

With the release of Capitaine Train for Android[0], several people recently asked me how we implemented some of the tips & tricks available in the application (some of these tricks are barely visible but remember, I love details :p). In order to showcase some of the most interesting application bits of code, I thought it could be helpful to Android developers to start a small series of posts. Feel free to comment this article if you want me to describe something you found nice in the Capitaine Train application. 

A long long time ago, Android 1.6 introduced soft input methods. Soft input methods has many advantages over traditional hardware keyboards. It obviously requires less hardware and may help to build lighter devices. It also allow content-dependent keyboards. For instance, a keyboard may be different when typing a person name, an email address or a pin code.

By default, the Android framework bundles several constants you may use to control the keyboard that will appear. From the code perspective, this can be controlled with the android:inputType[1] XML attributes on TextView. You can also change the "Enter" button to display a text that better match its purpose. This can be done thanks to the android:imeOptions attribute (see [2] for an exhaustive list of all the possible values):

<EditText
    android:id="@+id/password"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:imeOptions="actionDone"
    android:inputType="textPassword" />

While a "Done" button can fit almost all purposes (log in form, sign up form, etc.) it is quite ambiguous and not really satisfying to my mind. At Capitaine Train we wanted the action button to better reflect the actual action it performs. As a consequence, when signing in, we wanted the button to display "Sign in" rather that "Done". Because that's what it does after all!

Android lets you customize the action button thanks to the android:imeActionLabel[3] and android:imeActionId[4] attributes (or their TextView#setActionLabelId(CharSequence, int)[5] Java equivalent). Using these methods basically consists on setting a label to the done button and a unique id used to identify the action. Here is what your XML layout should be look like:

<EditText
    android:id="@+id/password"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:imeActionId="@+id/action_sign_in"
    android:imeActionLabel="@string/sign_in_short"
    android:inputType="textPassword" />

The second part consists on catch all taps on the soft input keyboard action button made with the appropriate action id:

mEditText = (EditText) view.findViewById(R.id.password);
mEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
   @Override
    public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
        if (actionId == R.id.action_sign_in) {
            // Do sign in
            return true;
        }
        return false;
    }
});

#gde   #android  

[0]: https://play.google.com/store/apps/details?id=com.capitainetrain.android
[1]: http://developer.android.com/reference/android/widget/TextView.html#attr_android:inputType
[2]: http://developer.android.com/reference/android/widget/TextView.html#attr_android:imeOptions
[3]: http://developer.android.com/reference/android/widget/TextView.html#attr_android:imeActionLabel
[4]: http://developer.android.com/reference/android/widget/TextView.html#attr_android:imeActionId
[5]: http://developer.android.com/reference/android/widget/TextView.html#setImeActionLabel(java.lang.CharSequence,%20int)
1
Add a comment...
 
 
Whenever you're working on the (SQLite) persistence layer of your #Android app, especially when debugging a problem, it can be invaluable to see the executed SQL statements in plain text in logcat.

So for verbose logging simply set the appropriate properties with "adb shell" like this:

adb shell setprop log.tag.SQLiteLog V
adb shell setprop log.tag.SQLiteStatements V
adb shell stop
adb shell start

That's it. Whenever any of the installed apps now accesses the database you should see the executed statement in the log output.

These simple lines saved me some gray hair today :)
1
Malek Chentir's profile photo
 
Je ne parle pas anglais.yà t'il 1 lien.moi aussi c Chentir
 ·  Translate
Add a comment...
People
Have him in circles
334 people
Charles De Meulenaer's profile photo
Islem MALKI's profile photo
Work
Occupation
Web & Mobile Developer
Employment
  • Lookout Mobile Security
    Client Software Engineer, 2012 - present
  • KerniX
    Mobile Developer, 2011 - 2012
  • SubMate
    Software Developer Intern, 2011 - 2011
  • Trace One
    Software Developer Intern, 2010 - 2010
Basic Information
Gender
Male
Apps with Google+ Sign-in
Story
Introduction
Software Engineer at Lookout Mobile Security.
Education
  • ISIMA
    Software Engineering, 2009 - 2011