Thursday, August 04, 2011

Some Leaked Info of Google Android from Github

This is a listing which appeared in githtub. Okay this is so not-updated info, because some of you maybe have been read this before and I am too late to post it now Ha ha. I have read these listing and I got some of these codename are false but you could save this in your mind as a good info for predicting the next codename of Android. Here it is:

/**
 *
 * @author Brad Fitzpatrick, bradfitz@android.com
 */
public class JankableListAdapter implements ListAdapter
{
    private static final String TAG = "JankableListAdapter";

    private static final String[] CODE_NAMES = new String[] {
        "1.0",
        "Petit Four",
        "Cupcake",
        "Donut",
        "Eclair",
        "Froyo",
        "Gingerbread",
        "Haggis",
        "Icelandic Icing",
        "Jalape\u00f1o",
        "Koala Krisps",
        "Liver",
        "Minced Meat",
        "Nuts",
        "Otter",
        "Penguin",
        "Quail",
        "Rabbit",
        "Salad",
        "Taco",
        "Umbilical Cord",
        "Vodka",
        "Wurst",
        "Xiaodianxin",
        "Yoghurt",
        "Zatar",
    };

    private final int mJankMillis;
    private final LayoutInflater mInflater;
    private final boolean mAsyncEffect;

    public JankableListAdapter(LayoutInflater inflater,
                               int jankMillis,
                               boolean asyncEffect) {
        super();
        mInflater = inflater;
        mJankMillis = jankMillis;
    mAsyncEffect = asyncEffect;
    }

    public View getView(final int position, View convertView, ViewGroup parent) {
        final View view = convertView != null
        ? convertView
        : mInflater.inflate(R.layout.list_item, null);

        // Note which position this View is currently being used for,
        // so we can change it later in our Async callback, to see if
        // it's still the same one then.  (so it doesn't get recycled
        // to be somebody else's then...)
        view.setTag(R.string.tag_async_list_pos, position);

        final TextView tv = (TextView) view.findViewById(R.id.textview_in_list_item);
    final ImageView iv = (ImageView) view.findViewById(R.id.star_in_list_item);
        final String newText = CODE_NAMES[position];
        tv.setText(newText);
    iv.setImageResource(android.R.drawable.btn_star_big_on);

    if (mJankMillis > 0) {
        try {
        Thread.sleep(mJankMillis);
        } catch (InterruptedException e) {}
    }

    if (!mAsyncEffect) {
        return view;
    }

        tv.setTextSize(15.0f);
        tv.setTypeface(Typeface.create(tv.getTypeface(), Typeface.NORMAL));
    iv.setImageResource(android.R.drawable.btn_star_big_off);

    new AsyncTask<Void, Void, Void>() {
            @Override protected Void doInBackground(Void... unused) {
                try {
                    Thread.sleep(500);
                } catch (InterruptedException e) {}
                return null;
            }

            @Override protected void onPostExecute(Void result) {
                if (Integer.valueOf(position).equals(view.getTag(R.string.tag_async_list_pos))) {
                    // The view (and its children) is still the same,
                    // and hasn't been re-used by the ListView.
                    iv.setImageResource(android.R.drawable.btn_star_big_on);
                    tv.setTypeface(Typeface.create(tv.getTypeface(), Typeface.BOLD));
                    tv.setTextSize(25.0f);
                } else {
                    Log.v(TAG, "async callback done, but View's been re-used. ignoring.");
                }
            }
    }.execute();

        return view;
    }

    public boolean areAllItemsEnabled() { return true; }
    public boolean isEnabled(int position) { return true; }
    public int getCount() { return CODE_NAMES.length; }
    public boolean isEmpty() { return false; }
    public Object getItem(int position) { return CODE_NAMES[position]; }
    public long getItemId(int position) { return position; }
    public int getItemViewType(int position) { return 42; }
    public boolean hasStableIds() { return true; }
    public void registerDataSetObserver(DataSetObserver observer) {}
    public void unregisterDataSetObserver(DataSetObserver observer) {}
    public int getViewTypeCount() { return 1; }
}


You may notice that "Higgins" has been changed to "Honeycomb". In that case, maybe these are false Wakakak :D.
Source

No comments: