<commit_before>package com.github.klondike.android.campfire;

import java.util.ArrayList;

import android.app.ListActivity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Parcelable;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

import com.github.klondike.java.campfire.Campfire;
import com.github.klondike.java.campfire.CampfireException;
import com.github.klondike.java.campfire.Room;

public class RoomList extends ListActivity { 
	private static final int MENU_CLEAR = 0;
	
	private Campfire campfire = null;
	private ArrayList<Room> rooms = null;
	
	private LoadRoomsTask loadRoomsTask = null;
	private ProgressDialog dialog = null;
	
	private boolean forResult = false;
	private boolean shortcut = false;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
        setContentView(R.layout.room_list);
        
        getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.room_title);
        ((TextView) findViewById(R.id.room_title)).setText(R.string.room_list_title);
        
        Intent intent = getIntent();
        Bundle extras = intent.getExtras();
        if (extras != null)
        	forResult = extras.getBoolean("for_result", false);
        
        String action = intent.getAction();
        shortcut = (action != null && action.equals(Intent.ACTION_CREATE_SHORTCUT));
        
        RoomListHolder holder = (RoomListHolder) getLastNonConfigurationInstance();
        if (holder != null) {
	    	rooms = holder.rooms;
	    	loadRoomsTask = holder.loadRoomsTask;
	    	if (loadRoomsTask != null) {
	    		loadRoomsTask.context = this;
	    		loadingDialog();
	    	}
        }
        
        verifyLogin();
    }
    
    public void verifyLogin() {
    	campfire = Utils.getCampfire(this);
        if (campfire != null)
        	onLogin();
        else
	        startActivityForResult(new Intent(this, Login.class), Login.RESULT_LOGIN);
    }
    
    public void onLogin() {
    	if (loadRoomsTask == null) {
	    	if (rooms == null)
	    		new LoadRoomsTask(this).execute();
	    	else
	    		displayRooms();
    	}
    }
    
    @Override
    public Object onRetainNonConfigurationInstance() {
    	RoomListHolder holder = new RoomListHolder();
    	holder.rooms = this.rooms;
    	holder.loadRoomsTask = this.loadRoomsTask;
    	return holder;
    }
    
    public void onLoadRooms(ArrayList<Room> rooms, CampfireException exception) {
    	if (exception == null && rooms != null) {
    		this.rooms = rooms;
        	displayRooms();
    	} else {
			Utils.alert(this, exception);
			finish();
		}
    }
    
    public void selectRoom(Room room) {
    	if (forResult) {
        	setResult(RESULT_OK, new Intent().putExtra("room_id", room.id));
        	finish();
    	} else if (shortcut) {
        	Intent roomIntent = roomIntent(room).putExtra("shortcut", true);
    		//roomIntent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
    		
    		Intent intent = new Intent();
    		intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, roomIntent);
    		intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, room.name);
    		//Parcelable resource = Intent.ShortcutIconResource.fromContext(this, R.drawable.icon);
    		intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, R.drawable.icon);
    		
    		setResult(RESULT_OK, intent);
    		
    		finish();
    	} else
    		startActivity(new Intent(this, RoomView.class).putExtra("room_id", room.id));
    }
    
    public void displayRooms() {
    	if (rooms.size() <= 0)
			((TextView) findViewById(R.id.rooms_empty)).setVisibility(View.VISIBLE);
		setListAdapter(new ArrayAdapter<Room>(RoomList.this, android.R.layout.simple_list_item_1, rooms));
    }
    
    public void onListItemClick(ListView parent, View v, int position, long id) {
    	selectRoom((Room) parent.getItemAtPosition(position));
    }
    
    public static Intent roomIntent(Room room) {
    	Intent intent = new Intent(Intent.ACTION_MAIN).putExtra("room_id", room.id);
    	intent.setClassName("com.github.klondike.android.campfire", "com.github.klondike.android.campfire.RoomView");
    	return intent;
    }
    <commit_msg>Fine, I'll leave it with the stock icon for now - posted to StackOverflow to help me resolve the problem<commit_after>package com.github.klondike.android.campfire;

import java.util.ArrayList;

import android.app.ListActivity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Parcelable;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

import com.github.klondike.java.campfire.Campfire;
import com.github.klondike.java.campfire.CampfireException;
import com.github.klondike.java.campfire.Room;

public class RoomList extends ListActivity { 
	private static final int MENU_CLEAR = 0;
	
	private Campfire campfire = null;
	private ArrayList<Room> rooms = null;
	
	private LoadRoomsTask loadRoomsTask = null;
	private ProgressDialog dialog = null;
	
	private boolean forResult = false;
	private boolean shortcut = false;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
        setContentView(R.layout.room_list);
        
        getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.room_title);
        ((TextView) findViewById(R.id.room_title)).setText(R.string.room_list_title);
        
        Intent intent = getIntent();
        Bundle extras = intent.getExtras();
        if (extras != null)
        	forResult = extras.getBoolean("for_result", false);
        
        String action = intent.getAction();
        shortcut = (action != null && action.equals(Intent.ACTION_CREATE_SHORTCUT));
        
        RoomListHolder holder = (RoomListHolder) getLastNonConfigurationInstance();
        if (holder != null) {
	    	rooms = holder.rooms;
	    	loadRoomsTask = holder.loadRoomsTask;
	    	if (loadRoomsTask != null) {
	    		loadRoomsTask.context = this;
	    		loadingDialog();
	    	}
        }
        
        verifyLogin();
    }
    
    public void verifyLogin() {
    	campfire = Utils.getCampfire(this);
        if (campfire != null)
        	onLogin();
        else
	        startActivityForResult(new Intent(this, Login.class), Login.RESULT_LOGIN);
    }
    
    public void onLogin() {
    	if (loadRoomsTask == null) {
	    	if (rooms == null)
	    		new LoadRoomsTask(this).execute();
	    	else
	    		displayRooms();
    	}
    }
    
    @Override
    public Object onRetainNonConfigurationInstance() {
    	RoomListHolder holder = new RoomListHolder();
    	holder.rooms = this.rooms;
    	holder.loadRoomsTask = this.loadRoomsTask;
    	return holder;
    }
    
    public void onLoadRooms(ArrayList<Room> rooms, CampfireException exception) {
    	if (exception == null && rooms != null) {
    		this.rooms = rooms;
        	displayRooms();
    	} else {
			Utils.alert(this, exception);
			finish();
		}
    }
    
    public void selectRoom(Room room) {
    	if (forResult) {
        	setResult(RESULT_OK, new Intent().putExtra("room_id", room.id));
        	finish();
    	} else if (shortcut) {
        	Intent roomIntent = roomIntent(room).putExtra("shortcut", true);
    		//roomIntent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
    		
    		Intent intent = new Intent();
    		intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, roomIntent);
    		intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, room.name);

    		// returning a Parcelable shortcut icon resource causes a force close on acore?!
    		// Parcelable resource = Intent.ShortcutIconResource.fromContext(this, R.drawable.icon);
    		// intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, resource);
    		
    		// returning just the resource int doesn't work, but it's here as a placeholder
    		intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, R.drawable.icon);
    		
    		setResult(RESULT_OK, intent);
    		
    		finish();
    	} else
    		startActivity(new Intent(this, RoomView.class).putExtra("room_id", room.id));
    }
    
    public void displayRooms() {
    	if (rooms.size() <= 0)
			((TextView) findViewById(R.id.rooms_empty)).setVisibility(View.VISIBLE);
		setListAdapter(new ArrayAdapter<Room>(RoomList.this, android.R.layout.simple_list_item_1, rooms));
    }
    
    public void onListItemClick(ListView parent, View v, int position, long id) {
    	selectRoom((Room) parent.getItemAtPosition(position));
    }
    
    public static Intent roomIntent(Room room) {
    	Intent intent = new Intent(Intent.ACTION_MAIN).putExtra("room_id", room.id);
    	intent.setClassName("com.github.klondike.android.campfire", "com.github.klondike.android.campfire.RoomView");
    	return intent;
    }
    
{'fraction_non_alphanumeric': 0.10741743367623173, 'fraction_numerical': 0.0006497022198159177, 'mean_word_length': 3.1232142857142855, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4497907', 'n_tokens_mistral': 2934, 'n_tokens_neox': 2832, 'n_words': 561}