44import android .graphics .Bitmap ;
55import android .graphics .BlurMaskFilter ;
66import android .graphics .Canvas ;
7+ import android .graphics .Color ;
78import android .graphics .drawable .BitmapDrawable ;
89import android .graphics .drawable .Drawable ;
910import android .util .Log ;
2728
2829import static android .view .ViewGroup .LayoutParams .MATCH_PARENT ;
2930import static android .view .ViewGroup .LayoutParams .WRAP_CONTENT ;
31+ import static com .android .launcher3 .icons .GraphicsUtils .setColorAlphaBound ;
3032
3133public class ThemedSmartspaceHostView extends SmartspaceHostView {
3234 private static final String TAG = "ThemedSmartspaceHostView" ;
@@ -123,9 +125,33 @@ private void overrideLayout(LinearLayout l) {
123125 }
124126
125127 private TextView replaceTextView (TextView tv ) {
126- return mDstv == null
127- ? tv
128- : mDstv .cloneTextView (tv );
128+ if (mDstv != null ) {
129+ int textAlpha = Color .alpha (tv .getCurrentTextColor ());
130+ if (Themes .getAttrBoolean (getContext (), R .attr .isWorkspaceDarkText )) {
131+ tv .getPaint ().clearShadowLayer ();
132+ } else {
133+ tv .getPaint ().setShadowLayer (mDstv .mShadowInfo .ambientShadowBlur , 0 , 0 ,
134+ setColorAlphaBound (mDstv .mShadowInfo .ambientShadowColor , textAlpha ));
135+ }
136+ tv .setLetterSpacing (mDstv .getLetterSpacing ());
137+ tv .setTextColor (mDstv .getTextColors ());
138+ tv .setMaxLines (mDstv .getMaxLines ());
139+ tv .setEllipsize (mDstv .getEllipsize ());
140+ tv .setTypeface (mDstv .getTypeface ());
141+ }
142+
143+ int minPadding = getContext ().getResources ()
144+ .getDimensionPixelSize (R .dimen .text_vertical_padding );
145+ tv .setPadding (tv .getPaddingLeft (), Math .max (tv .getPaddingTop (), minPadding ),
146+ tv .getPaddingRight (), Math .max (tv .getPaddingBottom (), minPadding ));
147+ tv .setHorizontallyScrolling (true );
148+
149+ return tv ;
150+
151+ // We do not have to clone the textView, since we are not using the double shadow.
152+ //return mDstv == null
153+ // ? tv
154+ // : mDstv.cloneTextView(tv);
129155 }
130156
131157 private void overrideView (View v , int textColor , int maxDividerSize ) {
@@ -138,9 +164,10 @@ private void overrideView(View v, int textColor, int maxDividerSize) {
138164 for (int i = 0 ; i < vg .getChildCount (); i ++) {
139165 View vc = vg .getChildAt (i );
140166 if (vc instanceof TextView ) {
141- ViewGroup .LayoutParams lp = vc .getLayoutParams ();
142- vg .removeViewAt (i );
143- vg .addView (replaceTextView ((TextView ) vc ), i , lp );
167+ replaceTextView ((TextView ) vc );
168+ //ViewGroup.LayoutParams lp = vc.getLayoutParams();
169+ //vg.removeViewAt(i);
170+ //vg.addView(replaceTextView((TextView) vc), i, lp);
144171 } else if (vc instanceof ImageView ) {
145172 ImageView iv = (ImageView ) vc ;
146173 ViewGroup .LayoutParams lp = iv .getLayoutParams ();
0 commit comments