<commit_before>package com.group5.android.fd.activity.dialog;

import android.app.Dialog;
import android.content.Context;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;

import com.group5.android.fd.R;
import com.group5.android.fd.entity.AbstractEntity;
import com.group5.android.fd.entity.ItemEntity;
import com.group5.android.fd.entity.OrderItemEntity;

public class NumberPickerDialog extends Dialog implements OnClickListener {
	protected EditText m_vwQuantity;
	protected Button m_vwPlus;
	protected Button m_vwSubtract;
	protected Button m_vwbtnSet;
	protected Button m_vwCancel;
	protected boolean m_isSet = false;
	protected AbstractEntity m_entity = null;

	/*
	 * oldQuantity va quantity luu tru gia tri so luong truoc va sau khi duoc
	 * thay doi
	 */

	public NumberPickerDialog(Context context) {
		super(context);
		initLayout();
	}

	public void setEntity(AbstractEntity entity) {
		m_entity = entity;
		if (entity instanceof ItemEntity) {
			setQuantity(2);

		} else if (entity instanceof OrderItemEntity) {
			setQuantity(((OrderItemEntity) m_entity).quantity);
		}

	}

	protected void setQuantity(int quantity) {
		m_vwQuantity.setText(String.valueOf(quantity));
		m_vwQuantity.selectAll();
	}

	public AbstractEntity getEntity() {
		return m_entity;
	}

	protected void initLayout() {
		requestWindowFeature(Window.FEATURE_NO_TITLE);

		setContentView(R.layout.dialog_quantity_set);
		getWindow().setLayout(LayoutParams.FILL_PARENT,
				LayoutParams.WRAP_CONTENT);

		m_vwQuantity = (EditText) findViewById(R.id.txtQuantity);
		m_vwPlus = (Button) findViewById(R.id.btnPlus);
		m_vwSubtract = (Button) findViewById(R.id.btnSubtract);
		m_vwbtnSet = (Button) findViewById(R.id.btnSet);
		m_vwCancel = (Button) findViewById(R.id.btnCancel);

		/*
		 * thiet lap gia tri mac dinh cho text hien thi o EditText
		 */

		m_vwbtnSet.setOnClickListener(this);
		m_vwPlus.setOnClickListener(this);<commit_msg>fixed NumberPicker<commit_after>package com.group5.android.fd.activity.dialog;

import android.app.Dialog;
import android.content.Context;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;

import com.group5.android.fd.R;
import com.group5.android.fd.entity.AbstractEntity;
import com.group5.android.fd.entity.ItemEntity;
import com.group5.android.fd.entity.OrderItemEntity;

public class NumberPickerDialog extends Dialog implements OnClickListener {
	protected EditText m_vwQuantity;
	protected Button m_vwPlus;
	protected Button m_vwSubtract;
	protected Button m_vwbtnSet;
	protected Button m_vwCancel;
	protected boolean m_isSet = false;
	protected AbstractEntity m_entity = null;

	/*
	 * oldQuantity va quantity luu tru gia tri so luong truoc va sau khi duoc
	 * thay doi
	 */

	public NumberPickerDialog(Context context) {
		super(context);
		initLayout();
	}

	public void setEntity(AbstractEntity entity) {
		m_entity = entity;
		if (entity instanceof ItemEntity) {
			setQuantity(2);

		} else if (entity instanceof OrderItemEntity) {
			setQuantity(((OrderItemEntity) m_entity).quantity);
		}

	}

	protected void setQuantity(int quantity) {
		m_vwQuantity.setText(String.valueOf(quantity));
		m_vwQuantity.selectAll();
		m_isSet = false;
	}

	public AbstractEntity getEntity() {
		return m_entity;
	}

	protected void initLayout() {
		requestWindowFeature(Window.FEATURE_NO_TITLE);

		setContentView(R.layout.dialog_quantity_set);
		getWindow().setLayout(LayoutParams.FILL_PARENT,
				LayoutParams.WRAP_CONTENT);

		m_vwQuantity = (EditText) findViewById(R.id.txtQuantity);
		m_vwPlus = (Button) findViewById(R.id.btnPlus);
		m_vwSubtract = (Button) findViewById(R.id.btnSubtract);
		m_vwbtnSet = (Button) findViewById(R.id.btnSet);
		m_vwCancel = (Button) findViewById(R.id.btnCancel);

		/*
		 * thiet lap gia tri mac dinh cho text hien thi o EditText
		 */

		m_vwbtnSet.setOnClickListener(this);
		m_vwPlus.setOnClickListener(this);
{'fraction_non_alphanumeric': 0.09773371104815864, 'fraction_numerical': 0.0028328611898017, 'mean_word_length': 5.240058910162003, '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': '2014802', 'n_tokens_mistral': 1487, 'n_tokens_neox': 1347, 'n_words': 290}