/*
 * Copyright (c) 2015. Jay Paulynice (jay.paulynice@gmail.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.jigdraw.draw.activity;

import static com.jigdraw.draw.util.ToastUtil.shortToast;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.ListView;

import com.jigdraw.draw.R;
import com.jigdraw.draw.tasks.JigsawHistoryLoader;

/**
 * History activity to see list of jigsaw images created.
 *
 * @author Jay Paulynice
 */
public class JigsawHistoryActivity extends BaseJigsawActivity {
    /** Class name for logging */
    private static final String TAG = "JigsawHistoryActivity";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        Log.d(TAG, "Staring jigsaw history activity...");
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_history);
        initMenuBar();
        initViews();
    }

    private void initViews() {
        Log.d(TAG, "initializing history list view...");
        ListView lv = (ListView) findViewById(R.id.history_list);
        JigsawHistoryLoader task = new JigsawHistoryLoader
                (getApplicationContext(), lv);

        shortToast(getApplicationContext(), "Loading drawing history...");
        task.execute();

        lv.setLongClickable(true);
        lv.setOnItemLongClickListener(getOnItemLongClickListener());
        lv.setOnItemClickListener(getOnItemClickListener());
    }

    private OnItemLongClickListener getOnItemLongClickListener() {
        return new OnItemLongClickListener() {
            public boolean onItemLongClick(AdapterView<?> arg0, View arg1,
                                           final int pos, long id) {
                return true;
            }
        };
    }

    private OnItemClickListener getOnItemClickListener() {
        return new OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> arg0, View arg1,
                                    final int pos, long id) {
                Log.d(TAG, "clicked element with id: " + id);
            }
        };
    }
}
@@ -1477,24 +1477,76 @@
 anceState);%0A
+        init();%0A    %7D%0A    %0A    private void init()%7B%0A
         setC
@@ -2835,8 +2835,9 @@
 %0A    %7D%0A%7D
+%0A

Update JigsawHistoryActivity.java