Merge "[Overlay] Bottom align text in clocktime complication" into tm-qpr-dev
This commit is contained in:
@@ -29,9 +29,10 @@
|
||||
android:format12Hour="@string/dream_time_complication_12_hr_time_format"
|
||||
android:format24Hour="@string/dream_time_complication_24_hr_time_format"
|
||||
android:fontFeatureSettings="pnum, lnum"
|
||||
android:includeFontPadding="false"
|
||||
android:letterSpacing="0.02"
|
||||
android:maxLines="1"
|
||||
android:textSize="@dimen/dream_overlay_complication_clock_time_text_size"
|
||||
android:translationY="@dimen/dream_overlay_complication_clock_time_translation_y"
|
||||
app:keyShadowBlur="@dimen/dream_overlay_clock_key_text_shadow_radius"
|
||||
app:keyShadowOffsetX="@dimen/dream_overlay_clock_key_text_shadow_dx"
|
||||
app:keyShadowOffsetY="@dimen/dream_overlay_clock_key_text_shadow_dy"
|
||||
@@ -40,6 +41,7 @@
|
||||
app:ambientShadowOffsetX="@dimen/dream_overlay_clock_ambient_text_shadow_dx"
|
||||
app:ambientShadowOffsetY="@dimen/dream_overlay_clock_ambient_text_shadow_dy"
|
||||
app:ambientShadowAlpha="0.3"
|
||||
/>
|
||||
app:removeTextDescent="true"
|
||||
app:textDescentExtraPadding="@dimen/dream_overlay_clock_text_descent_extra_padding" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
@@ -1591,7 +1591,6 @@
|
||||
<dimen name="dream_overlay_bottom_affordance_radius">32dp</dimen>
|
||||
<dimen name="dream_overlay_bottom_affordance_padding">14dp</dimen>
|
||||
<dimen name="dream_overlay_complication_clock_time_text_size">86dp</dimen>
|
||||
<dimen name="dream_overlay_complication_clock_time_translation_y">28dp</dimen>
|
||||
<dimen name="dream_overlay_complication_clock_subtitle_text_size">24sp</dimen>
|
||||
<dimen name="dream_overlay_complication_preview_text_size">36sp</dimen>
|
||||
<dimen name="dream_overlay_complication_preview_icon_padding">28dp</dimen>
|
||||
@@ -1692,6 +1691,7 @@
|
||||
<dimen name="dream_overlay_clock_ambient_text_shadow_dx">0dp</dimen>
|
||||
<dimen name="dream_overlay_clock_ambient_text_shadow_dy">0dp</dimen>
|
||||
<dimen name="dream_overlay_clock_ambient_text_shadow_radius">1dp</dimen>
|
||||
<dimen name="dream_overlay_clock_text_descent_extra_padding">1dp</dimen>
|
||||
|
||||
<!-- Shadow for dream overlay status bar complications -->
|
||||
<dimen name="dream_overlay_status_bar_key_text_shadow_dx">0.5dp</dimen>
|
||||
|
||||
@@ -40,6 +40,9 @@
|
||||
<attr name="ambientShadowOffsetX" />
|
||||
<attr name="ambientShadowOffsetY" />
|
||||
<attr name="ambientShadowAlpha" />
|
||||
<attr name="removeTextDescent" format="boolean" />
|
||||
<!-- padding to add back when removing text descent so it ensures text is not clipped -->
|
||||
<attr name="textDescentExtraPadding" format="dimension" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="DoubleShadowTextView">
|
||||
|
||||
@@ -22,6 +22,7 @@ import android.widget.TextClock
|
||||
import com.android.systemui.shared.R
|
||||
import com.android.systemui.shared.shadow.DoubleShadowTextHelper.ShadowInfo
|
||||
import com.android.systemui.shared.shadow.DoubleShadowTextHelper.applyShadows
|
||||
import kotlin.math.floor
|
||||
|
||||
/** Extension of [TextClock] which draws two shadows on the text (ambient and key shadows) */
|
||||
class DoubleShadowTextClock
|
||||
@@ -89,6 +90,21 @@ constructor(
|
||||
ambientShadowOffsetY.toFloat(),
|
||||
ambientShadowAlpha
|
||||
)
|
||||
val removeTextDescent =
|
||||
attributes.getBoolean(R.styleable.DoubleShadowTextClock_removeTextDescent, false)
|
||||
val textDescentExtraPadding =
|
||||
attributes.getDimensionPixelSize(
|
||||
R.styleable.DoubleShadowTextClock_textDescentExtraPadding,
|
||||
0
|
||||
)
|
||||
if (removeTextDescent) {
|
||||
setPaddingRelative(
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
textDescentExtraPadding - floor(paint.fontMetrics.descent.toDouble()).toInt()
|
||||
)
|
||||
}
|
||||
} finally {
|
||||
attributes.recycle()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user