// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// 	public static final String VERSION = "1.3.0";
// 	public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
// 
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXTextPrompt.java
// public interface GDXTextPrompt {
// 
// 	/**
// 	 * Type of input used by the textfield
// 	 */
// 	enum InputType {
// 		/**
// 		 * prints readable text
// 		 */
// 		PLAIN_TEXT,
// 
// 		/**
// 		 * hides typed text behind specified character
// 		 */
// 		PASSWORD
// 	}
// 
// 	/**
// 	 * Sets the title
// 	 *
// 	 * @param title String value to set the title
// 	 * @return The same instance that the method was called from.
// 	 */
// 	GDXTextPrompt setTitle(CharSequence title);
// 
// 
// 	/**
// 	 * Set the character limit for input. Default is 16.
// 	 *
// 	 * @param maxLength
// 	 * @return
// 	 */
// 	GDXTextPrompt setMaxLength(int maxLength);
// 
// 	/**
// 	 * Shows the dialog. show() can only be called after build() has been called
// 	 * else there might be strange behavior. Runs asynchronously on a different thread.
// 	 *
// 	 * @return The same instance that the method was called from.
// 	 */
// 	GDXTextPrompt show();
// 
// 	/**
// 	 * Dismisses the dialog. You can show the dialog again.
// 	 *
// 	 * @return The same instance that the method was called from.
// 	 */
// 	GDXTextPrompt dismiss();
// 
// 	/**
// 	 * This builds the button and prepares for usage.
// 	 *
// 	 * @return The same instance that the method was called from.
// 	 */
// 	GDXTextPrompt build();
// 
// 	/**
// 	 * Sets the message.
// 	 *
// 	 * @param message The text to be displayed at the body of the dialog. Desktop implementation will ignore this method.
// 	 * @return The same instance that the method was called from.
// 	 */
// 	GDXTextPrompt setMessage(CharSequence message);
// 
// 	/**
// 	 * Sets the default value for the input field.
// 	 *
// 	 * @param inputTip Placeholder for the text input field.
// 	 * @return The same instance that the method was called from.
// 	 */
// 	GDXTextPrompt setValue(CharSequence inputTip);
// 
// 	/**
// 	 * Sets the label for the cancel button on the dialog.
// 	 *
// 	 * @param label Text of the cancel button
// 	 * @return The same instance that the method was called from.
// 	 */
// 	GDXTextPrompt setCancelButtonLabel(CharSequence label);
// 
// 	/**
// 	 * Sets the label for the confirm button on the dialog.
// 	 *
// 	 * @param label Text of the confirm button
// 	 * @return The same instance that the method was called from.
// 	 */
// 	GDXTextPrompt setConfirmButtonLabel(CharSequence label);
// 
// 	/**
// 	 * Sets the {@link TextPromptListener}
// 	 *
// 	 * @param listener listener to be called when the event is triggered
// 	 * @return The same instance that the method was called from.
// 	 */
// 	GDXTextPrompt setTextPromptListener(TextPromptListener listener);
// 
// 	/**
// 	 * Sets the type of input for the text input field.
// 	 *
// 	 * @param inputType type of input
// 	 * @return The same instance that the method was called from.
// 	 */
// 	GDXTextPrompt setInputType(InputType inputType);
// }
// 
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/TextPromptListener.java
// public interface TextPromptListener {
// 
// 	public void cancel();
// 
// 	public void confirm(String text);
// 
// }


import de.tomgrill.gdxdialogs.core.listener.TextPromptListener;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.text.InputFilter;
import android.text.InputType;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXTextPrompt;
	private CharSequence inputValue = "";

	private EditText userInput;

	private AlertDialog alertDialog;

	private boolean isBuild = false;

	private int inputType = android.text.InputType.TYPE_CLASS_TEXT;

	public AndroidGDXTextPrompt(Activity activity) {
		this.activity = activity;
	}


	@Override
	public GDXTextPrompt show() {
		if (alertDialog == null || !isBuild) {
			throw new RuntimeException(GDXTextPrompt.class.getSimpleName() + " has not been build. Use build() before" +
					" show().");
		}

		// When alert dialog is null, an except. is thrown and the code never gets here. No point in checking
		if (userInput != null) {
			userInput.setText(inputValue);
		}

		activity.runOnUiThread(new Runnable() {
			@Override
			public void run() {
// Path: core/src/de/tomgrill/gdxdialogs/core/GDXDialogsVars.java
// public class GDXDialogsVars {
// 	public static final String VERSION = "1.3.0";
// 	public static final String LOG_TAG = "gdx-dialogs (" + VERSION + ")";
// }
// 
// Path: core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXTextPrompt.java
// public interface GDXTextPrompt {
// 
// 	/**
// 	 * Type of input used by the textfield
// 	 */
// 	enum InputType {
// 		/**
// 		 * prints readable text
// 		 */
// 		PLAIN_TEXT,
// 
// 		/**
// 		 * hides typed text behind specified character
// 		 */
// 		PASSWORD
// 	}
// 
// 	/**
// 	 * Sets the title
// 	 *
// 	 * @param title String value to set the title
// 	 * @return The same instance that the method was called from.
// 	 */
// 	GDXTextPrompt setTitle(CharSequence title);
// 
// 
// 	/**
// 	 * Set the character limit for input. Default is 16.
// 	 *
// 	 * @param maxLength
// 	 * @return
// 	 */
// 	GDXTextPrompt setMaxLength(int maxLength);
// 
// 	/**
// 	 * Shows the dialog. show() can only be called after build() has been called
// 	 * else there might be strange behavior. Runs asynchronously on a different thread.
// 	 *
// 	 * @return The same instance that the method was called from.
// 	 */
// 	GDXTextPrompt show();
// 
// 	/**
// 	 * Dismisses the dialog. You can show the dialog again.
// 	 *
// 	 * @return The same instance that the method was called from.
// 	 */
// 	GDXTextPrompt dismiss();
// 
// 	/**
// 	 * This builds the button and prepares for usage.
// 	 *
// 	 * @return The same instance that the method was called from.
// 	 */
// 	GDXTextPrompt build();
// 
// 	/**
// 	 * Sets the message.
// 	 *
// 	 * @param message The text to be displayed at the body of the dialog. Desktop implementation will ignore this method.
// 	 * @return The same instance that the method was called from.
// 	 */
// 	GDXTextPrompt setMessage(CharSequence message);
// 
// 	/**
// 	 * Sets the default value for the input field.
// 	 *
// 	 * @param inputTip Placeholder for the text input field.
// 	 * @return The same instance that the method was called from.
// 	 */
// 	GDXTextPrompt setValue(CharSequence inputTip);
// 
// 	/**
// 	 * Sets the label for the cancel button on the dialog.
// 	 *
// 	 * @param label Text of the cancel button
// 	 * @return The same instance that the method was called from.
// 	 */
// 	GDXTextPrompt setCancelButtonLabel(CharSequence label);
// 
// 	/**
// 	 * Sets the label for the confirm button on the dialog.
// 	 *
// 	 * @param label Text of the confirm button
// 	 * @return The same instance that the method was called from.
// 	 */
// 	GDXTextPrompt setConfirmButtonLabel(CharSequence label);
// 
// 	/**
// 	 * Sets the {@link TextPromptListener}
// 	 *
// 	 * @param listener listener to be called when the event is triggered
// 	 * @return The same instance that the method was called from.
// 	 */
// 	GDXTextPrompt setTextPromptListener(TextPromptListener listener);
// 
// 	/**
// 	 * Sets the type of input for the text input field.
// 	 *
// 	 * @param inputType type of input
// 	 * @return The same instance that the method was called from.
// 	 */
// 	GDXTextPrompt setInputType(InputType inputType);
// }
// 
// Path: core/src/de/tomgrill/gdxdialogs/core/listener/TextPromptListener.java
// public interface TextPromptListener {
// 
// 	public void cancel();
// 
// 	public void confirm(String text);
// 
// }


// Path: android/src/de/tomgrill/gdxdialogs/android/dialogs/AndroidGDXTextPrompt.java
import de.tomgrill.gdxdialogs.core.listener.TextPromptListener;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.text.InputFilter;
import android.text.InputType;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import com.badlogic.gdx.Gdx;
import de.tomgrill.gdxdialogs.core.GDXDialogsVars;
import de.tomgrill.gdxdialogs.core.dialogs.GDXTextPrompt;

	private CharSequence inputValue = "";

	private EditText userInput;

	private AlertDialog alertDialog;

	private boolean isBuild = false;

	private int inputType = android.text.InputType.TYPE_CLASS_TEXT;

	public AndroidGDXTextPrompt(Activity activity) {
		this.activity = activity;
	}


	@Override
	public GDXTextPrompt show() {
		if (alertDialog == null || !isBuild) {
			throw new RuntimeException(GDXTextPrompt.class.getSimpleName() + " has not been build. Use build() before" +
					" show().");
		}

		// When alert dialog is null, an except. is thrown and the code never gets here. No point in checking
		if (userInput != null) {
			userInput.setText(inputValue);
		}

		activity.runOnUiThread(new Runnable() {
			@Override
			public void run() {
				Gdx.app.debug(GDXDialogsVars.LOG_TAG, AndroidGDXTextPrompt.class.getSimpleName() + " now shown.");