Right-align "end time" portion of the schedule setter.
This is more like what the mocks show. To make it happen, this changes the layout to a ConstraintLayout with a guideline in the middle to make sure that the start and end time sections take up no more than half the screen. Confirmed that it wraps rather than overlapping when the text becomes too large. Flag: android.app.modes_ui Bug: 346396147 Test: manual Change-Id: I56adbd24594121a9cb5b4374f2eeecdfd40f61e4
This commit is contained in:
@@ -30,63 +30,78 @@
|
||||
android:paddingBottom="24dp">
|
||||
|
||||
<!-- Start time & end time row -->
|
||||
<LinearLayout
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="fill_horizontal"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<!-- Start time: title (non-clickable preference), time setter -->
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
<!-- Start time title (non-clickable preference) -->
|
||||
<TextView
|
||||
android:id="@+id/start_time_label"
|
||||
android:clickable="false"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Medium"
|
||||
android:text="@string/zen_mode_start_time" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/start_time_label"
|
||||
android:clickable="false"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Medium"
|
||||
android:text="@string/zen_mode_start_time" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/start_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Title"
|
||||
android:textColor="?android:attr/colorAccent"
|
||||
android:textSize="40sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- End time: title (non-clickable preference), time setter -->
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
<!-- Start time display + setter -->
|
||||
<TextView
|
||||
android:id="@+id/start_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/start_time_label"
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Title"
|
||||
android:textColor="?android:attr/colorAccent"
|
||||
android:textSize="40sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/end_time_label"
|
||||
android:clickable="false"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Medium"
|
||||
android:text="@string/zen_mode_end_time" />
|
||||
<!-- Center boundary to make sure each only expands to take up at most half the space -->
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.5" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/end_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Title"
|
||||
android:textColor="?android:attr/colorAccent"
|
||||
android:textSize="40sp" />
|
||||
<!-- End time title (non-clickable preference), left-aligned to edge of time display -->
|
||||
<TextView
|
||||
android:id="@+id/end_time_label"
|
||||
android:clickable="false"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@+id/end_time"
|
||||
app:layout_constraintStart_toEndOf="@+id/guideline"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Medium"
|
||||
android:text="@string/zen_mode_end_time" />
|
||||
|
||||
</LinearLayout>
|
||||
<!-- End time setter; right-aligned -->
|
||||
<TextView
|
||||
android:id="@+id/end_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@+id/end_time_label"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/guideline"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Title"
|
||||
android:textColor="?android:attr/colorAccent"
|
||||
android:textSize="40sp" />
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<!-- Schedule duration display row -->
|
||||
<LinearLayout
|
||||
|
||||
Reference in New Issue
Block a user