git rm; application toast pool; G1 bug

Alright, I know I saw it somewhere. How do I get git to add deletion of files to the transaction (when I deleted them w/out git rm and don’t want to git rm the whole list of them)? Can’t find the original answer but Stack Overflow’s top answer works for what I want. When I’ve done all my other adds and find there’s a bunch of deleted files left over… “git add -u”

On to fun stuff. I thought it seemed a bit wasteful to create toasts over and over, so I created a toast pool.

    // repository for created toasts
    private Map<Long,Toast> mToasts = new HashMap<Long,Toast>();
    private static final Long TOAST_LOG_DELETED = new Long(R.string.log_entry_deleted);
    private static final Long TOAST_LOG_CREATED = new Long(R.string.new_log_entry);
    protected void showToast(Long id) {
        Toast t = mToasts.get(id);
            mToasts.put(id, (t = Toast.makeText(this, id.intValue(), Toast.LENGTH_SHORT)));;

Initially I put this in an Activity that was creating a lot of toasts… then I thought, why not do this application-wide? Then if I need to show a toast with an Activity that’s finish()ing, it’ll still show. Plus better to have just one implementation and pool. So I put it in my Application object (WhenDidI) and the constants in my constant class (C). Now my toast calls look like this:

    ((WhenDidI) getApplication()).showToast(C.TOAST_LOG_DELETED);

A little wordy, but otherwise – good idea, no?

Asked my first question on StackOverflow yesterday. Seeing a bug with TimePicker apparently only on my G1. I’ll probably figure something out…

Most things in WhenDidI work as expected at this point, so I’m going to start getting familiar with styles and applying them everywhere. About time. This is a great post to help with understanding how styles are used in Android.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: