Add a y translation to clock complication.

The clock complication comes with internal paddings that make the
spacing with the complications below too large, even without any layout
engine margin. Without a better solution, add a y translation to the
clock so reduce the spacing, and also change its text size to dp unit
so it doesn't respond to system text size change, which would mess up
the translation.

Test: https://screenshot.googleplex.com/BLfQEhA6i2t4qyu
Test: https://screenshot.googleplex.com/BbuvDvfmahtNy5U
Bug: 257553229
Change-Id: I7350981a28af590f6e70fb4fab004d5180cda502
This commit is contained in:
Darrell Shi
2022-11-28 16:07:02 +00:00
parent e5f9a95ae2
commit 21cbd24566
3 changed files with 31 additions and 22 deletions

View File

@@ -14,25 +14,32 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<com.android.systemui.shared.shadow.DoubleShadowTextClock
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/time_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@*android:string/config_clockFontFamily"
android:textColor="@android:color/white"
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:letterSpacing="0.02"
android:textSize="@dimen/dream_overlay_complication_clock_time_text_size"
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"
app:keyShadowAlpha="0.3"
app:ambientShadowBlur="@dimen/dream_overlay_clock_ambient_text_shadow_radius"
app:ambientShadowOffsetX="@dimen/dream_overlay_clock_ambient_text_shadow_dx"
app:ambientShadowOffsetY="@dimen/dream_overlay_clock_ambient_text_shadow_dy"
app:ambientShadowAlpha="0.3"
/>
android:layout_height="wrap_content">
<com.android.systemui.shared.shadow.DoubleShadowTextClock
android:id="@+id/time_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@*android:string/config_clockFontFamily"
android:textColor="@android:color/white"
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:letterSpacing="0.02"
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"
app:keyShadowAlpha="0.3"
app:ambientShadowBlur="@dimen/dream_overlay_clock_ambient_text_shadow_radius"
app:ambientShadowOffsetX="@dimen/dream_overlay_clock_ambient_text_shadow_dx"
app:ambientShadowOffsetY="@dimen/dream_overlay_clock_ambient_text_shadow_dy"
app:ambientShadowAlpha="0.3"
/>
</FrameLayout>

View File

@@ -1500,7 +1500,8 @@
<dimen name="dream_overlay_status_bar_extra_margin">8dp</dimen>
<!-- Dream overlay complications related dimensions -->
<dimen name="dream_overlay_complication_clock_time_text_size">86sp</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_home_controls_padding">28dp</dimen>
<dimen name="dream_overlay_complication_clock_subtitle_text_size">24sp</dimen>
<dimen name="dream_overlay_complication_preview_text_size">36sp</dimen>

View File

@@ -45,11 +45,12 @@ public interface DreamClockTimeComplicationModule {
@Provides
@Named(DREAM_CLOCK_TIME_COMPLICATION_VIEW)
static View provideComplicationView(LayoutInflater layoutInflater) {
final TextClock view = Preconditions.checkNotNull((TextClock)
final View view = Preconditions.checkNotNull(
layoutInflater.inflate(R.layout.dream_overlay_complication_clock_time,
null, false),
"R.layout.dream_overlay_complication_clock_time did not properly inflated");
view.setFontVariationSettings(TAG_WEIGHT + WEIGHT);
((TextClock) view.findViewById(R.id.time_view)).setFontVariationSettings(
TAG_WEIGHT + WEIGHT);
return view;
}
}