package com.kamontat.checkidnumber.view.fragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import com.kamontat.checkidnumber.R;

/**
 * @author kamontat
 * @version 1.0
 * @since Thu 11/May/2017 - 10:22 PM
 */
public class InputFragment extends Fragment {
	private TextView message;
	private EditText input;
	private Button button;
	
	public InputFragment() {
		// Required empty public constructor
	}
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		// Inflate the layout for this fragment
		View view = inflater.inflate(R.layout.fragment_input, container, false);
		
		message = (TextView) view.findViewById(R.id.input_message);
		input = (EditText) view.findViewById(R.id.input_id_number);
		button = (Button) view.findViewById(R.id.input_btn);
		
		return view;
	}
}

@@ -63,57 +63,176 @@
 oid.
-os.Bundle;%0Aimport android.support.v4.app.Fragment
+app.Activity;%0Aimport android.content.Context;%0Aimport android.os.Bundle;%0Aimport android.support.v4.app.Fragment;%0Aimport android.text.TextWatcher;%0Aimport android.util.Log
 ;%0Aim
@@ -322,16 +322,68 @@
 wGroup;%0A
+import android.view.inputmethod.InputMethodManager;%0A
 import a
@@ -711,16 +711,93 @@
 tton;%0A%09%0A
+%09private View.OnClickListener clickListener;%0A%09private TextWatcher watcher;%0A%09%0A
 %09public 
@@ -1220,77 +1220,914 @@
 ;%0A%09%09
-button = (Button) view.findViewById(R.id.input_btn);%0A%09%09%0A%09%09return view
+if (watcher != null) input.addTextChangedListener(watcher);%0A%09%09button = (Button) view.findViewById(R.id.input_btn);%0A%09%09if (clickListener != null) button.setOnClickListener(clickListener);%0A%09%09%0A%09%09return view;%0A%09%7D%0A%09%0A%09public String getInput() %7B%0A%09%09return input.getText().toString();%0A%09%7D%0A%09%0A%09public void setTextColor(int id) %7B%0A%09%09input.setTextColor(id);%0A%09%7D%0A%09%0A%09public void setInputListener(TextWatcher watcher) %7B%0A%09%09this.watcher = watcher;%0A%09%7D%0A%09%0A%09public void setButton(View.OnClickListener clickListener) %7B%0A%09%09this.clickListener = clickListener;%0A%09%7D%0A%09%0A%09public void setButtonEnable(boolean b) %7B%0A%09%09button.setEnabled(b);%0A%09%7D%0A%09%0A%09public void showKeyboard(Activity activity) %7B%0A%09%09if (input.requestFocus()) %7B%0A%09%09%09InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);%0A%09%09%09imm.showSoftInput(input, InputMethodManager.SHOW_IMPLICIT);%0A%09%09%7D%0A%09%7D%0A%09%0A%09public void clearText() %7B%0A%09%09input.setText(%22%22)
 ;%0A%09%7D

Update with main