Created
January 17, 2018 21:59
-
-
Save anonymous/94dc957a5d942a8b611d7b8b0656eecd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.cris.zeiterfassungv2; | |
import android.os.Bundle; | |
import android.support.v7.app.AppCompatActivity; | |
import android.text.Editable; | |
import android.text.InputType; | |
import android.text.TextWatcher; | |
import android.widget.EditText; | |
import android.widget.TableLayout; | |
import android.widget.TableRow; | |
public class MainActivity extends AppCompatActivity { | |
public TableRow lastRow; | |
public newRowTextWatcher tw; | |
public Time24hFormatValidator time24; | |
public Sum sum; | |
public void AddRow() | |
{ | |
TableRow row = new TableRow(MainActivity.this); | |
EditText txt1 = new EditText(MainActivity.this); | |
EditText txt2 = new EditText(MainActivity.this); | |
EditText txt3 = new EditText(MainActivity.this); | |
EditText txt4 = new EditText(MainActivity.this); | |
EditText txt5 = new EditText(MainActivity.this); | |
EditText txt6 = new EditText(MainActivity.this); | |
EditText txt7 = new EditText(MainActivity.this); | |
row.addView(txt1); | |
row.addView(txt2); | |
row.addView(txt3); | |
row.addView(txt4); | |
row.addView(txt5); | |
row.addView(txt6); | |
row.addView(txt7); | |
txt1.setBackgroundResource(R.drawable.cellshape); | |
txt2.setBackgroundResource(R.drawable.cellshape); | |
txt3.setBackgroundResource(R.drawable.cellshape); | |
txt4.setBackgroundResource(R.drawable.cellshape); | |
txt5.setBackgroundResource(R.drawable.cellshape); | |
txt6.setBackgroundResource(R.drawable.cellshape); | |
txt7.setBackgroundResource(R.drawable.cellshape); | |
txt1.setInputType(InputType.TYPE_CLASS_TEXT); | |
txt2.setInputType(InputType.TYPE_CLASS_TEXT); | |
txt3.setInputType(InputType.TYPE_DATETIME_VARIATION_TIME); | |
txt4.setInputType(InputType.TYPE_DATETIME_VARIATION_TIME); | |
txt5.setInputType(InputType.TYPE_CLASS_NUMBER); | |
txt6.setInputType(InputType.TYPE_CLASS_TEXT); | |
txt7.setInputType(InputType.TYPE_CLASS_TEXT); | |
txt1.addTextChangedListener(tw); | |
txt2.addTextChangedListener(tw); | |
txt3.addTextChangedListener(tw); | |
txt4.addTextChangedListener(tw); | |
txt5.addTextChangedListener(tw); | |
txt6.addTextChangedListener(tw); | |
txt7.addTextChangedListener(tw); | |
txt3.addTextChangedListener(time24); | |
txt4.addTextChangedListener(time24); | |
TableLayout table = (TableLayout) findViewById(R.id.tabelle); | |
table.addView(row); | |
lastRow = row; | |
} | |
@Override | |
protected void onCreate(Bundle savedInstanceState) | |
{ | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
tw = new newRowTextWatcher(this); | |
time24 = new Time24hFormatValidator(this); | |
lastRow = (TableRow) findViewById(R.id.firstRow); | |
EditText txt1 = (EditText) findViewById(R.id.etOrderNo); | |
EditText txt2 = (EditText) findViewById(R.id.etMachineID); | |
EditText txt3 = (EditText) findViewById(R.id.etstarttime); | |
EditText txt4 = (EditText) findViewById(R.id.etendtime); | |
EditText txt5 = (EditText) findViewById(R.id.etdecimaltime); | |
EditText txt6 = (EditText) findViewById(R.id.etrework); | |
EditText txt7 = (EditText) findViewById(R.id.etstatus); | |
txt1.addTextChangedListener(tw); | |
txt2.addTextChangedListener(tw); | |
txt3.addTextChangedListener(tw); | |
txt4.addTextChangedListener(tw); | |
txt5.addTextChangedListener(tw); | |
txt6.addTextChangedListener(tw); | |
txt7.addTextChangedListener(tw); | |
txt3.addTextChangedListener(time24); | |
txt4.addTextChangedListener(time24); | |
/* txt3.addTextChangedListener(sum); | |
txt4.addTextChangedListener(sum); | |
txt5.addTextChangedListener(sum);*/ | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment