Skip to content

Commit

Permalink
update sample example
Browse files Browse the repository at this point in the history
  • Loading branch information
AliAzaz committed May 21, 2019
1 parent d495653 commit adbabdb
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
3 changes: 0 additions & 3 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
public class MainActivity extends AppCompatActivity {

Button btnSubmit;
com.edittextpicker.aliazaz.EditTextPicker txtBoxRange, txtBoxRangeMaskPat, txtBoxDefault, txtMask, textPhone;
com.edittextpicker.aliazaz.EditTextPicker txtBoxRange, txtBoxRangeMaskPat, txtBoxDefault, txtDate, txtPhone;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -26,8 +26,8 @@ private void initializingComponents() {
txtBoxRange = findViewById(R.id.txtBoxRange);
txtBoxRangeMaskPat = findViewById(R.id.txtBoxRangeMaskPat);
txtBoxDefault = findViewById(R.id.txtBoxDefault);
txtMask = findViewById(R.id.txtMask);
textPhone = findViewById(R.id.textPhone);
txtDate = findViewById(R.id.txtDate);
txtPhone = findViewById(R.id.txtPhone);
}

private void settingListeners() {
Expand All @@ -54,16 +54,22 @@ private boolean validateComponents() {
if (!txtBoxRangeMaskPat.isRangeTextValidate())
return false;

return txtBoxDefault.isTextEqualToPattern();
if (!txtBoxDefault.isTextEqualToPattern())
return false;

if (!txtDate.isEmptyTextBox())
return false;

return txtPhone.isEmptyTextBox();
}

private void clearFields() {

txtBoxRange.setText(null);
txtBoxRangeMaskPat.setText(null);
txtBoxDefault.setText(null);
txtMask.setText(null);
textPhone.setText(null);
txtDate.setText(null);
txtPhone.setText(null);

}
}
12 changes: 6 additions & 6 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@
app:layout_constraintStart_toEndOf="@+id/textView4"
app:layout_constraintTop_toBottomOf="@+id/txtBoxRangeMaskPat"
app:pattern="[^0-9]{2,4}[0-9]{3,5}"
app:required="true"
app:required="false"
app:type="equal" />

<com.edittextpicker.aliazaz.EditTextPicker
android:id="@+id/txtMask"
android:id="@+id/txtDate"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
Expand All @@ -163,7 +163,7 @@
app:required="false" />

<com.edittextpicker.aliazaz.EditTextPicker
android:id="@+id/textPhone"
android:id="@+id/txtPhone"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
Expand All @@ -175,9 +175,9 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView3"
app:layout_constraintTop_toBottomOf="@+id/txtMask"
app:layout_constraintTop_toBottomOf="@+id/txtDate"
app:mask="+92(###)####-###"
app:required="false" />
app:required="true" />

<Button
android:id="@+id/btnSubmit"
Expand All @@ -189,7 +189,7 @@
android:text="SUBMIT"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textPhone" />
app:layout_constraintTop_toBottomOf="@+id/txtPhone" />


</android.support.constraint.ConstraintLayout>

0 comments on commit adbabdb

Please sign in to comment.