Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1348 from jbc25/oppia-1628-phone-number-ui-fix
added text input layout style to phone number edittext
- Loading branch information
Showing
3 changed files
with
103 additions
and
36 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
...src/main/java/org/digitalcampus/oppia/utils/ui/fields/ValidableNestedTextInputLayout.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package org.digitalcampus.oppia.utils.ui.fields; | ||
|
||
import android.content.Context; | ||
import android.util.AttributeSet; | ||
import android.widget.EditText; | ||
|
||
import androidx.annotation.Nullable; | ||
|
||
import com.google.android.material.textfield.TextInputLayout; | ||
|
||
import org.digitalcampus.mobile.learning.R; | ||
|
||
public class ValidableNestedTextInputLayout extends ValidableTextInputLayout { | ||
|
||
public ValidableNestedTextInputLayout(Context context) { | ||
super(context); | ||
} | ||
|
||
public ValidableNestedTextInputLayout(Context context, AttributeSet attrs) { | ||
super(context, attrs); | ||
} | ||
|
||
public ValidableNestedTextInputLayout(Context context, AttributeSet attrs, int defStyleAttr) { | ||
super(context, attrs, defStyleAttr); | ||
} | ||
|
||
|
||
|
||
@Nullable | ||
@Override | ||
public EditText getEditText() { | ||
return getNestedTextInputLayout() != null ? getNestedTextInputLayout().getEditText() : null; | ||
} | ||
|
||
@Override | ||
public void setError(@Nullable CharSequence errorText) { | ||
TextInputLayout nestedTextInputLayout = getNestedTextInputLayout(); | ||
if (nestedTextInputLayout != null) { | ||
nestedTextInputLayout.setError(errorText); | ||
} | ||
} | ||
|
||
@Override | ||
public void setErrorEnabled(boolean enabled) { | ||
TextInputLayout nestedTextInputLayout = getNestedTextInputLayout(); | ||
if (nestedTextInputLayout != null) { | ||
nestedTextInputLayout.setErrorEnabled(enabled); | ||
} | ||
} | ||
|
||
private TextInputLayout getNestedTextInputLayout() { | ||
return findViewById(R.id.ccp_text_input_layout); | ||
} | ||
} |
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
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