@@ -885,7 +885,10 @@ && shouldSetCollectionInfo(semanticsNode)) {
885
885
// Scopes routes are not focusable, only need to set the content
886
886
// for non-scopes-routes semantics nodes.
887
887
if (semanticsNode .hasFlag (Flag .IS_TEXT_FIELD )) {
888
- result .setText (semanticsNode .getValueLabelHint ());
888
+ result .setText (semanticsNode .getValue ());
889
+ if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .P ) {
890
+ result .setHintText (semanticsNode .getTextFieldHint ());
891
+ }
889
892
} else if (!semanticsNode .hasFlag (Flag .SCOPES_ROUTE )) {
890
893
CharSequence content = semanticsNode .getValueLabelHint ();
891
894
if (Build .VERSION .SDK_INT < Build .VERSION_CODES .P ) {
@@ -2773,18 +2776,47 @@ private float max(float a, float b, float c, float d) {
2773
2776
return Math .max (a , Math .max (b , Math .max (c , d )));
2774
2777
}
2775
2778
2776
- private CharSequence getValueLabelHint () {
2777
- CharSequence [] array ;
2779
+ private CharSequence getValue () {
2780
+ if (Build .VERSION .SDK_INT < Build .VERSION_CODES .LOLLIPOP ) {
2781
+ return value ;
2782
+ } else {
2783
+ return createSpannableString (value , valueAttributes );
2784
+ }
2785
+ }
2786
+
2787
+ private CharSequence getLabel () {
2778
2788
if (Build .VERSION .SDK_INT < Build .VERSION_CODES .LOLLIPOP ) {
2779
- array = new CharSequence [] { value , label , hint } ;
2789
+ return label ;
2780
2790
} else {
2781
- array =
2782
- new CharSequence [] {
2783
- createSpannableString (value , valueAttributes ),
2784
- createSpannableString (label , labelAttributes ),
2785
- createSpannableString (hint , hintAttributes ),
2786
- };
2791
+ return createSpannableString (label , labelAttributes );
2792
+ }
2793
+ }
2794
+
2795
+ private CharSequence getHint () {
2796
+ if (Build .VERSION .SDK_INT < Build .VERSION_CODES .LOLLIPOP ) {
2797
+ return hint ;
2798
+ } else {
2799
+ return createSpannableString (hint , hintAttributes );
2800
+ }
2801
+ }
2802
+
2803
+ private CharSequence getValueLabelHint () {
2804
+ CharSequence [] array = new CharSequence [] {getValue (), getLabel (), getHint ()};
2805
+ CharSequence result = null ;
2806
+ for (CharSequence word : array ) {
2807
+ if (word != null && word .length () > 0 ) {
2808
+ if (result == null || result .length () == 0 ) {
2809
+ result = word ;
2810
+ } else {
2811
+ result = TextUtils .concat (result , ", " , word );
2812
+ }
2813
+ }
2787
2814
}
2815
+ return result ;
2816
+ }
2817
+
2818
+ private CharSequence getTextFieldHint () {
2819
+ CharSequence [] array = new CharSequence [] {getLabel (), getHint ()};
2788
2820
CharSequence result = null ;
2789
2821
for (CharSequence word : array ) {
2790
2822
if (word != null && word .length () > 0 ) {
0 commit comments