<commit_before>package org.appcelerator.titanium.module.ui;

import org.appcelerator.titanium.TitaniumModuleManager;
import org.appcelerator.titanium.api.ITitaniumButton;
import org.appcelerator.titanium.config.TitaniumConfig;
import org.appcelerator.titanium.util.Log;
import org.appcelerator.titanium.util.TitaniumColorHelper;
import org.appcelerator.titanium.util.TitaniumFileHelper;
import org.json.JSONException;
import org.json.JSONObject;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import android.os.Message;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;

public class TitaniumButton extends TitaniumBaseNativeControl
	implements ITitaniumButton, OnClickListener
{
	private static final String LCAT = "TiButton";
	@SuppressWarnings("unused")
	private static final boolean DBG = TitaniumConfig.LOGD;

	private static final int MSG_CLICK = 300;

	public static final String CLICK_EVENT = "click";

	private String title; // Button text
	private String imagePath;
	private String backgroundImage;
	private String backgroundSelectedImage;
	private String color;
	private String backgroundColor;

	public TitaniumButton(TitaniumModuleManager tmm)
	{
		super(tmm);
		eventManager.supportEvent(CLICK_EVENT);
	}

	protected void setLocalOptions(JSONObject o) throws JSONException
	{
		super.setLocalOptions(o);

		if (o.has("title")) {
			this.title = o.getString("title");
		}
		if (o.has("image")) {
			this.imagePath = o.getString("image");
		}
		if (o.has("backgroundImage")) {
			this.backgroundImage = o.getString("backgroundImage");
		}
		if (o.has("backgroundSelectedImage")) {
			this.backgroundSelectedImage = o.getString("backgroundSelectedImage");
		}
		if (o.has("color")) {
			this.color = o.getString("color");
		}
		if (o.has("backgroundColor")) {
			this.backgroundColor = o.getString("backgroundColor");
		}
	}

	private boolean isImageButton() {
		return (imagePath != null );
	}

	public void createControl(TitaniumModuleManager tmm)
	{
		Context context = tmm.getAppContext();
		if(!isImageButton()) {<commit_msg>Turned off background image support in the native button until I can get NinePatch working<commit_after>package org.appcelerator.titanium.module.ui;

import org.appcelerator.titanium.TitaniumModuleManager;
import org.appcelerator.titanium.api.ITitaniumButton;
import org.appcelerator.titanium.config.TitaniumConfig;
import org.appcelerator.titanium.util.Log;
import org.appcelerator.titanium.util.TitaniumColorHelper;
import org.appcelerator.titanium.util.TitaniumFileHelper;
import org.json.JSONException;
import org.json.JSONObject;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import android.os.Message;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;

public class TitaniumButton extends TitaniumBaseNativeControl
	implements ITitaniumButton, OnClickListener
{
	private static final String LCAT = "TiButton";
	@SuppressWarnings("unused")
	private static final boolean DBG = TitaniumConfig.LOGD;

	private static final int MSG_CLICK = 300;

	public static final String CLICK_EVENT = "click";

	private String title; // Button text
	private String imagePath;
	private String backgroundImage;
	private String backgroundSelectedImage;
	private String color;
	private String backgroundColor;

	public TitaniumButton(TitaniumModuleManager tmm)
	{
		super(tmm);
		eventManager.supportEvent(CLICK_EVENT);
	}

	protected void setLocalOptions(JSONObject o) throws JSONException
	{
		super.setLocalOptions(o);

		if (o.has("title")) {
			this.title = o.getString("title");
		}
		if (o.has("image")) {
			this.imagePath = o.getString("image");
		}
		if (o.has("backgroundImage")) {
			//this.backgroundImage = o.getString("backgroundImage");
		}
		if (o.has("backgroundSelectedImage")) {
			//this.backgroundSelectedImage = o.getString("backgroundSelectedImage");
		}
		if (o.has("color")) {
			this.color = o.getString("color");
		}
		if (o.has("backgroundColor")) {
			this.backgroundColor = o.getString("backgroundColor");
		}
	}

	private boolean isImageButton() {
		return (imagePath != null );
	}

	public void createControl(TitaniumModuleManager tmm)
	{
		Context context = tmm.getAppContext();
		if(!isImageButton()) {
{'fraction_non_alphanumeric': 0.10866176798040525, 'fraction_numerical': 0.0013360053440213762, 'mean_word_length': 5.576866764275256, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3875163', 'n_tokens_mistral': 1462, 'n_tokens_neox': 1370, 'n_words': 288}