Skip to content

Commit

Permalink
#6 Add other colors getter/setters
Browse files Browse the repository at this point in the history
  • Loading branch information
raycoarana committed Jul 25, 2019
1 parent 02d5a87 commit fa1017e
Showing 1 changed file with 65 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.xmlpull.v1.XmlPullParserException;

import androidx.annotation.ColorRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.annotation.XmlRes;
Expand Down Expand Up @@ -352,6 +353,7 @@ private StaticLayout buildErrorTextLayout(int width) {
return staticLayout;
}

@SuppressLint("RtlHardcoded")
private Alignment getAlignment() {
switch (mErrorTextGravity) {
case Gravity.CENTER:
Expand Down Expand Up @@ -557,6 +559,7 @@ public void writeToParcel(Parcel out, int flags) {
}
}

@NonNull
@Override
public String toString() {
String str = "CodeInputView.SavedState{" + Integer.toHexString(System.identityHashCode(this));
Expand Down Expand Up @@ -599,6 +602,7 @@ private SavedState(Parcel in) {
* @see #getImeOptions
* @see android.view.inputmethod.EditorInfo
*/
@SuppressWarnings("unused")
public void setImeOptions(int imeOptions) {
mInputContentType.imeOptions = imeOptions;
}
Expand All @@ -610,6 +614,7 @@ public void setImeOptions(int imeOptions) {
* @see #setImeOptions(int)
* @see android.view.inputmethod.EditorInfo
*/
@SuppressWarnings("unused")
public int getImeOptions() {
return mInputContentType.imeOptions;
}
Expand All @@ -625,6 +630,7 @@ public int getImeOptions() {
* @see #getImeActionId
* @see android.view.inputmethod.EditorInfo
*/
@SuppressWarnings("unused")
public void setImeActionLabel(CharSequence label, int actionId) {
mInputContentType.imeActionLabel = label;
mInputContentType.imeActionId = actionId;
Expand All @@ -636,6 +642,7 @@ public void setImeActionLabel(CharSequence label, int actionId) {
* @see #setImeActionLabel
* @see android.view.inputmethod.EditorInfo
*/
@SuppressWarnings("unused")
public CharSequence getImeActionLabel() {
return mInputContentType.imeActionLabel;
}
Expand All @@ -646,6 +653,7 @@ public CharSequence getImeActionLabel() {
* @see #setImeActionLabel
* @see android.view.inputmethod.EditorInfo
*/
@SuppressWarnings("unused")
public int getImeActionId() {
return mInputContentType.imeActionId;
}
Expand All @@ -671,6 +679,7 @@ public void setOnEditorActionListener(OnEditorActionListener l) {
* @see #getPrivateImeOptions()
* @see EditorInfo#privateImeOptions
*/
@SuppressWarnings("unused")
public void setPrivateImeOptions(String type) {
mInputContentType.privateImeOptions = type;
}
Expand All @@ -681,6 +690,7 @@ public void setPrivateImeOptions(String type) {
* @see #setPrivateImeOptions(String)
* @see EditorInfo#privateImeOptions
*/
@SuppressWarnings("unused")
public String getPrivateImeOptions() {
return mInputContentType.privateImeOptions;
}
Expand Down Expand Up @@ -712,13 +722,15 @@ public void setInputExtras(@XmlRes int xmlResId) throws XmlPullParserException,
* @see #setInputExtras(int)
* @see EditorInfo#extras
*/
@SuppressWarnings("unused")
public Bundle getInputExtras(boolean create) {
if (mInputContentType.extras == null && create) {
mInputContentType.extras = new Bundle();
}
return mInputContentType.extras;
}

@SuppressWarnings("unused")
public void setTextColor(@ColorRes int resId, @Nullable Resources.Theme theme) {
setTextColor(ResourcesCompat.getColor(getResources(), resId, theme));
}
Expand All @@ -729,10 +741,12 @@ public void setTextColor(int color) {
invalidate();
}

@SuppressWarnings("unused")
public int getTextColor() {
return mTextColor;
}

@SuppressWarnings("unused")
public void setErrorTextColor(@ColorRes int resId, @Nullable Resources.Theme theme) {
setErrorTextColor(ResourcesCompat.getColor(getResources(), resId, theme));
}
Expand All @@ -743,10 +757,56 @@ public void setErrorTextColor(int color) {
invalidate();
}

@SuppressWarnings("unused")
public int getErrorTextColor() {
return mErrorTextColor;
}

@SuppressWarnings("unused")
public void setErrorColor(@ColorRes int resId, @Nullable Resources.Theme theme) {
setErrorColor(ResourcesCompat.getColor(getResources(), resId, theme));
}

public void setErrorColor(int color) {
mErrorColor = color;
invalidate();
}

@SuppressWarnings("unused")
public int getErrorColor() {
return mErrorColor;
}

@SuppressWarnings("unused")
public void setUnderlineColor(@ColorRes int resId, @Nullable Resources.Theme theme) {
setUnderlineColor(ResourcesCompat.getColor(getResources(), resId, theme));
}

public void setUnderlineColor(int color) {
mUnderlineColor = color;
invalidate();
}

@SuppressWarnings("unused")
public int getUnderlineColor() {
return mUnderlineColor;
}

@SuppressWarnings("unused")
public void setUnderlineSelectedColor(@ColorRes int resId, @Nullable Resources.Theme theme) {
setUnderlineSelectedColor(ResourcesCompat.getColor(getResources(), resId, theme));
}

public void setUnderlineSelectedColor(int color) {
mUnderlineSelectedColor = color;
invalidate();
}

@SuppressWarnings("unused")
public int getUnderlineSelectedColor() {
return mUnderlineSelectedColor;
}

/**
* Detects the del key and delete the numbers
*/
Expand Down Expand Up @@ -883,6 +943,7 @@ public void addOnCompleteListener(OnCodeCompleteListener listener) {
*
* @param listener listener to remove
*/
@SuppressWarnings("unused")
public void removeOnCompleteListener(OnCodeCompleteListener listener) {
mInputCompletedListeners.remove(listener);
}
Expand All @@ -902,6 +963,7 @@ public void addOnDigitInputListener(OnDigitInputListener listener) {
*
* @param listener listener to remove
*/
@SuppressWarnings("unused")
public void removeOnDigitInputListener(OnDigitInputListener listener) {
mDigitInputListeners.remove(listener);
}
Expand Down Expand Up @@ -1152,7 +1214,7 @@ public boolean getShowPasswordWhileTyping() {
*
* @param enabled true to show password while typing or false to not show never
*/
@SuppressWarnings("SameParameterValue")
@SuppressWarnings({"unused", "SameParameterValue"})
public void setShowPasswordWhileTyping(boolean enabled) {
mShowPasswordWhileTyping = enabled;

Expand All @@ -1176,7 +1238,7 @@ public int getTimeCharacterIsShownWhileTyping() {
*
* @param timeInMillis true to hide the code or false the display it.
*/
@SuppressWarnings("SameParameterValue")
@SuppressWarnings({"unused", "SameParameterValue"})
public void setTimeCharacterIsShownWhileTyping(int timeInMillis) {
mTimeCharacterIsShownWhileTypingInMillis = timeInMillis;
mTimeCharacterIsShownWhileTypingInNano = TimeUnit.MILLISECONDS.toNanos(timeInMillis);
Expand Down Expand Up @@ -1220,7 +1282,7 @@ public boolean getShowKeyBoard() {
*
* @param value true to show the keyboard when focus gained or tapped, false to not show it
*/
@SuppressWarnings("SameParameterValue")
@SuppressWarnings({"unused", "SameParameterValue"})
public void setShowKeyboard(boolean value) {
mShowKeyboard = value;
invalidate();
Expand Down

0 comments on commit fa1017e

Please sign in to comment.