Adjust the layout carefully, so that remote grid views perfectly overlap the bitmap generated from the binding view, whether left-aligned, right-aligned or centered, and regardless of the size of the widget, text, margins or spacing. Display the clock in the correct text size.
129 lines
6.2 KiB
XML
129 lines
6.2 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
xmlns:tools="http://schemas.android.com/tools"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="match_parent"
|
|
android:fitsSystemWindows="true"
|
|
android:orientation="vertical"
|
|
tools:context=".ui.activities.MainActivity">
|
|
<com.google.android.material.card.MaterialCardView
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
app:cardElevation="0dp"
|
|
app:cardCornerRadius="0dp"
|
|
android:id="@+id/toolbar"
|
|
android:transitionName="toolbar"
|
|
app:cardBackgroundColor="@color/colorPrimary">
|
|
<LinearLayout
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:orientation="vertical">
|
|
<RelativeLayout
|
|
android:layout_width="match_parent"
|
|
android:layout_height="56dp"
|
|
android:gravity="center_vertical">
|
|
<ImageView
|
|
android:layout_width="48dp"
|
|
android:layout_height="48dp"
|
|
android:padding="12dp"
|
|
android:layout_marginTop="2dp"
|
|
android:src="@drawable/round_arrow_back_24"
|
|
android:clickable="true"
|
|
android:focusable="true"
|
|
android:background="?attr/selectableItemBackgroundBorderless"
|
|
app:tint="@color/colorPrimaryText"
|
|
android:layout_centerVertical="true"
|
|
android:layout_alignParentLeft="true"
|
|
android:alpha="0"
|
|
android:layout_marginLeft="8dp"
|
|
android:translationX="4dp"
|
|
android:id="@+id/action_back"/>
|
|
<LinearLayout
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:orientation="horizontal"
|
|
android:layout_centerInParent="true">
|
|
<TextView
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="match_parent"
|
|
android:text="@string/app_name"
|
|
android:gravity="center"
|
|
android:textStyle="bold"
|
|
android:id="@+id/fragment_title"
|
|
android:transitionName="fragment_title"
|
|
android:layout_marginBottom="6dp"
|
|
style="@style/AnotherWidget.Main.Title"/>
|
|
</LinearLayout>
|
|
<ImageView
|
|
android:id="@+id/action_settings"
|
|
android:layout_width="48dp"
|
|
android:layout_height="48dp"
|
|
android:layout_alignParentRight="true"
|
|
android:layout_marginRight="8dp"
|
|
android:background="?attr/selectableItemBackgroundBorderless"
|
|
android:clickable="true"
|
|
android:focusable="true"
|
|
android:transitionName="action_back"
|
|
android:padding="8dp"
|
|
android:scaleX="-1"
|
|
android:src="@drawable/round_short_text_24"
|
|
app:tint="@color/colorPrimaryText" />
|
|
</RelativeLayout>
|
|
<com.google.android.material.card.MaterialCardView
|
|
android:layout_width="match_parent"
|
|
android:layout_height="140dp"
|
|
android:id="@+id/preview"
|
|
android:animateLayoutChanges="true"
|
|
app:cardBackgroundColor="@color/colorAccent"
|
|
app:cardCornerRadius="0dp"
|
|
app:cardElevation="0dp">
|
|
<ImageView
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:scaleType="fitStart"
|
|
android:adjustViewBounds="true"
|
|
android:id="@+id/widget_bg" />
|
|
<RelativeLayout
|
|
android:layout_width="match_parent"
|
|
android:layout_height="match_parent"
|
|
android:animateLayoutChanges="true">
|
|
<LinearLayout
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:layout_centerInParent="true"
|
|
android:layout_gravity="center"
|
|
android:orientation="vertical"
|
|
android:padding="8dp"
|
|
android:id="@+id/widget"
|
|
android:alpha="0"
|
|
android:animateLayoutChanges="true"
|
|
android:gravity="center" />
|
|
<ProgressBar
|
|
android:layout_width="32dp"
|
|
android:layout_height="32dp"
|
|
android:layout_centerInParent="true"
|
|
android:indeterminate="true"
|
|
android:indeterminateTint="@android:color/white"
|
|
android:id="@+id/widget_loader" />
|
|
</RelativeLayout>
|
|
</com.google.android.material.card.MaterialCardView>
|
|
</LinearLayout>
|
|
</com.google.android.material.card.MaterialCardView>
|
|
<com.google.android.material.card.MaterialCardView
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
app:cardElevation="0dp"
|
|
app:cardPreventCornerOverlap="true"
|
|
app:cardCornerRadius="0dp"
|
|
app:cardBackgroundColor="@color/colorPrimary"
|
|
android:orientation="vertical">
|
|
<androidx.fragment.app.FragmentContainerView
|
|
android:id="@+id/settings_fragment"
|
|
android:name="androidx.navigation.fragment.NavHostFragment"
|
|
app:defaultNavHost="false"
|
|
app:navGraph="@navigation/settings_nav_graph"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="match_parent" />
|
|
</com.google.android.material.card.MaterialCardView>
|
|
</LinearLayout> |