费了几天功夫,终于改成了。没办法,把TextView给改了。

费了几天功夫,终于改成了。没办法,把TextView给改了。
0

#1

时钟小部件加了个文字描边,适应各种明亮色壁纸。用阴影不是太清晰,描边就好多了。

改了framework.jar里的android/widget/TextView
然后 DeskColock.apk里的res/layout/digital_widget_time.xml中TextView和TextClock都加个属性shadowDx="-2000"

--- F:\XiaoMi\framework.jar\android.widget\TextView.smali.o
+++ F:\XiaoMi\framework.jar\android.widget\TextView.smali
@@ -257,6 +257,11 @@
 
 .field private mShadowRadius:F
 
+#=============================
+.field private mOuterColor:I
+.field private mStrokeWidth:F
+
+
 .field private mSingleLine:Z
 
 .field private mSpacingAdd:F
@@ -20883,7 +20888,50 @@
     .end packed-switch
 .end method
 
+#===================================
 .method protected onDraw(Landroid/graphics/Canvas;)V
+    .registers 5
+
+    iget v0, p0, Landroid/widget/TextView;->mOuterColor:I
+
+    if-eqz v0, :cond_23
+
+    iget v0, p0, Landroid/widget/TextView;->mCurTextColor:I
+
+    iget v1, p0, Landroid/widget/TextView;->mOuterColor:I
+
+    iput v1, p0, Landroid/widget/TextView;->mCurTextColor:I
+
+    iget-object v1, p0, Landroid/widget/TextView;->mTextPaint:Landroid/text/TextPaint;
+
+    iget v2, p0, Landroid/widget/TextView;->mStrokeWidth:F
+
+    invoke-virtual {v1, v2}, Landroid/text/TextPaint;->setStrokeWidth(F)V
+
+    iget-object v1, p0, Landroid/widget/TextView;->mTextPaint:Landroid/text/TextPaint;
+
+    sget-object v2, Landroid/graphics/Paint$Style;->FILL_AND_STROKE:Landroid/graphics/Paint$Style;
+
+    invoke-virtual {v1, v2}, Landroid/text/TextPaint;->setStyle(Landroid/graphics/Paint$Style;)V
+
+    invoke-virtual {p0, p1}, Landroid/widget/TextView;->onDraw2(Landroid/graphics/Canvas;)V
+
+    iput v0, p0, Landroid/widget/TextView;->mCurTextColor:I
+
+    iget-object v0, p0, Landroid/widget/TextView;->mTextPaint:Landroid/text/TextPaint;
+
+    const/4 v1, 0x0
+
+    invoke-virtual {v0, v1}, Landroid/text/TextPaint;->setStrokeWidth(F)V
+
+    :cond_23
+    invoke-virtual {p0, p1}, Landroid/widget/TextView;->onDraw2(Landroid/graphics/Canvas;)V
+
+    return-void
+.end method
+#===================================
+
+.method protected onDraw2(Landroid/graphics/Canvas;)V
     .registers 42
     .param p1, "canvas"    # Landroid/graphics/Canvas;
 
@@ -31339,13 +31387,41 @@
 .end method
 
 .method public setShadowLayer(FFFI)V
-    .registers 6
+    .registers 7
     .param p1, "radius"    # F
     .param p2, "dx"    # F
     .param p3, "dy"    # F
     .param p4, "color"    # I
 
     .prologue
+
+#========================================
+
+    const/high16 v0, -0x3b860000    # -1000.0f
+
+    cmpg-float v0, p2, v0
+
+    if-gez v0, :cond_14aa
+
+    const/4 v0, 0x0
+
+    iput v0, p0, Landroid/widget/TextView;->mShadowRadius:F
+
+    iput v0, p0, Landroid/widget/TextView;->mShadowDx:F
+
+    iput v0, p0, Landroid/widget/TextView;->mShadowDy:F
+
+    iput v0, p0, Landroid/widget/TextView;->mShadowColor:I
+
+    iput p4, p0, Landroid/widget/TextView;->mOuterColor:I
+
+    iput p1, p0, Landroid/widget/TextView;->mStrokeWidth:F
+
+    return-void
+
+    :cond_14aa
+
+
     .line 3355
     iget-object v0, p0, Landroid/widget/TextView;->mTextPaint:Landroid/text/TextPaint;
 

#2

Wow!



#3

Wow!