Amazon Gift Cards

Thursday, November 20, 2014

Back doing the android :)

For the last 3 years I was working under HealthGuru.com and was focused on doing mainly Javascript and PHP, was part of the team that builds client website (pluggable module sites) like the video sites of Diabetic Living Online.com and Pregnancy.org and web embed widgets like in sites Medhelp or Health Boards. It was a lot of fun doing it and learn a lot especially Javascript and how browser behaves. But sadly everything has to end, last year HealthGuru were brought by another company and since then it was on maintenance mode and last month I'm not with them anymore.

Now back in Android, as you could see I still do some android apps under Ramen Tech but almost no update on the blog :( One reason is that during those years i was relying on my previous knowledge on Android, i was using Fragment without understanding why it was created hah, i didnt know about the cool projects that Square gave to the android, and a lot more. And since Android changed a lot from 3 years ago, it was a perfect time to update my skills :)

As a start i'll do a shameless plug of the apps i created to enhance my skills
Throwback Thursday Reminder - if you never want to forget that you have to do tbt, explanation why i did this is on my G+ page

Social Days Reminder - for the ones that love posting theme/event based post on social networks, imagine getting reminded that today you have to post science sunday :)

For both project i used ButterKnife and appcompat-v7 to make it look consistent across all version (4.1+).

Wednesday, September 17, 2014

A tool for publishing screenshot for your android apps

Found a get app, if you're publishing app Android Apps you might need this app, it cleans your action bar before you take a screenshot.
Clean Status Bar

Wednesday, September 3, 2014

RecyclerView setEmptyView

From Android Docs, RecyclerView is a more advanced and flexible version of ListView because it is more efficient and it doesnt care about the visuals. From the looks of it, it expects that the RecyclerView must always have data but thats not always possible, as i search how empty views is done in RecyclerView i cant seem to find one (If you know one or his better then the following codes, please comment below).
So here is what i did
private void checkAdapterIsEmpty () {
        if (mAdapter.getItemCount() == 0) {
            mEmptyView.setVisibility(View.VISIBLE);
        } else {
            mEmptyView.setVisibility(View.GONE);
        }
    }

    protected void setupRecyclerView() {
        mAdapter = new MyAdapter(mItemList);
        mAdapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
            @Override
            public void onChanged() {
                super.onChanged();
                checkAdapterIsEmpty();
            }
        });

        mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
        mRecyclerView.setHasFixedSize(true);

        mRecyclerView.setAdapter(mAdapter);
        checkAdapterIsEmpty();
    }

Tuesday, September 2, 2014

Android Wish

My friends over altlimit network created chipnship and my wish is to get this android collectable :)


Wednesday, July 30, 2014

Super slow when debugging with a device with ART

As i was debugging an android app on my nexus 5 i found that its super slow in nexus 5 but really fast on other mobile, turns out if you have ART enabled (kitkat+) the device cannot ensure the compiled matches the bytecode instructions. From stackoverflow.com they recommended to switch back to dalvik. Thats a bummer for in L ART is the only runtime, i hope they fix this in the future.

Monday, May 26, 2014

RelativeLayout alignParentBottom DialogFragment Listview

I havent done android programming until recently so i havent stumble on anything that i could blog about (plus stackoverflow has the answer to almost everything :] ). I was trying to recreate how Google+ did the new post dialog, in my head i could use DialogFragment and RelativeLayout where i stick the action row to the bottom via alignParentBottom and an EditText on top with layout_below the action layout. But this has a problem, DialogFragment and alignParentBottom dont play along really well as it would just align the action layout to the bottom of the screen regardless of the onscreen keyboard.

Now there are some suggestion where you extends RelativeLayout and compute for the keyboard size and resize the RelativeLayout Here in stackoverflow, but i recently found that adding a listview with layout_below the actionbar would cause the parent to recompute the child layout. Now this might be a bug or its just how RelativeLayout is done since its quite complicated do the calculation. I tested it on 4.4.2 on nexus 5 and 7, 4.3.1 on cm 10.2 on xperia z, 4.3 on xiaomi mi3 and nexus 7 2012, 4.1.2 on xperia acro s, 4.0.3 Star N8000. I cant seem to find a phone lying around thats 4.2 but its safe to assume it would also work.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">

    <EditText
        android:id="@+id/editTxt"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:hint="Write something"
        android:gravity="top|left"
        android:layout_above="@+id/actionLayout"
        />
    <ListView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/actionLayout"
        />
    <LinearLayout
        android:id="@+id/actionLayout"
        android:layout_width="wrap_content"
        android:layout_height="52dp"
        android:layout_alignParentBottom="true"
        >
    </LinearLayout>
</RelativeLayout>