Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
259 changes: 134 additions & 125 deletions sms2webhook/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,155 +1,164 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<?xml version="1.0" encoding="utf-8"?><!--
Wrapped in a scroll container because a landscape viewport is shorter than the
toolbar, the status card and the buttons together. With the log pinned
top-and-bottom it was measured at 150 units — about one row — with no way to
reach the rest. Here the log keeps a minimum height, so a short viewport
scrolls rather than squeezing it away, and fillViewport lets it still expand
to fill a tall one.
-->
<androidx.core.widget.NestedScrollView
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:id="@+id/contentScroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?android:attr/colorBackground"
android:fillViewport="true"
tools:context=".MainActivity">

<!-- Toolbar -->
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/app_toolbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.Material3.Dark.ActionBar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:popupTheme="@style/ThemeOverlay.Material3.Light" />

<!-- Sync status: one state, not three running totals.
Replaces Inbox / Uploaded / Failed plus a progress bar, which answered
"what has happened in my history" rather than "is anything outstanding".
On a device holding 624 messages with an empty cache the old counters
read Uploaded 0, Failed 0, indistinguishable from a fully synced phone. -->
<com.google.android.material.card.MaterialCardView
android:id="@+id/statusCard"
android:layout_width="0dp"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
app:cardCornerRadius="12dp"
app:cardElevation="4dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/app_toolbar">
android:orientation="vertical">

<LinearLayout
<!-- Toolbar -->
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/app_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.Material3.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.Material3.Light" />

<!-- Sync status: one state, not three running totals.
Replaces Inbox / Uploaded / Failed plus a progress bar, which answered
"what has happened in my history" rather than "is anything outstanding".
On a device holding 624 messages with an empty cache the old counters
read Uploaded 0, Failed 0, indistinguishable from a fully synced phone. -->
<com.google.android.material.card.MaterialCardView
android:id="@+id/statusCard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
app:cardCornerRadius="12dp"
app:cardElevation="4dp">

<TextView
android:id="@+id/statusHeadline"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?attr/textAppearanceHeadlineMedium"
tools:text="624 uploaded" />
android:orientation="vertical"
android:padding="16dp">

<TextView
android:id="@+id/statusDetail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:textAppearance="?attr/textAppearanceBodyMedium"
android:textColor="?attr/colorOnSurfaceVariant"
tools:text="Tap Sync to send them." />
<TextView
android:id="@+id/statusHeadline"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?attr/textAppearanceHeadlineMedium"
tools:text="624 uploaded" />

</LinearLayout>
<TextView
android:id="@+id/statusDetail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:textAppearance="?attr/textAppearanceBodyMedium"
android:textColor="?attr/colorOnSurfaceVariant"
tools:text="Tap Sync to send them." />

</com.google.android.material.card.MaterialCardView>
</LinearLayout>

<!-- Action Buttons -->
<LinearLayout
android:id="@+id/actionButtonsLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/statusCard">

<com.google.android.material.button.MaterialButton
android:id="@+id/syncButton"
style="@style/Widget.SMS2Webhook.Button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/sync_sms"
app:icon="@android:drawable/ic_menu_rotate" />
</com.google.android.material.card.MaterialCardView>

<com.google.android.material.button.MaterialButton
android:id="@+id/stopSyncButton"
style="@style/Widget.SMS2Webhook.Button"
android:layout_width="0dp"
<!-- Action Buttons -->
<LinearLayout
android:id="@+id/actionButtonsLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="8dp"
android:text="@string/stop_sync"
android:visibility="gone"
app:icon="@android:drawable/ic_media_pause" />

</LinearLayout>
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:gravity="center"
android:orientation="horizontal">

<com.google.android.material.button.MaterialButton
android:id="@+id/syncButton"
style="@style/Widget.SMS2Webhook.Button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/sync_sms"
app:icon="@android:drawable/ic_menu_rotate" />

<com.google.android.material.button.MaterialButton
android:id="@+id/stopSyncButton"
style="@style/Widget.SMS2Webhook.Button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="8dp"
android:text="@string/stop_sync"
android:visibility="gone"
app:icon="@android:drawable/ic_media_pause" />

<!-- Activity Log Card -->
<com.google.android.material.card.MaterialCardView
android:id="@+id/logCard"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
app:cardCornerRadius="12dp"
app:cardElevation="4dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/actionButtonsLayout">
</LinearLayout>

<LinearLayout
<!-- Activity Log Card.
weight=1 lets it fill a tall viewport; minHeight keeps it usable on a
short one, where the page scrolls instead. -->
<com.google.android.material.card.MaterialCardView
android:id="@+id/logCard"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<!-- Log Header -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorSurfaceVariant"
android:padding="16dp"
android:text="@string/activity_logs"
android:textAppearance="?attr/textAppearanceTitleMedium"
android:textColor="?attr/colorOnSurfaceVariant" />

<!-- Log Content -->
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshLayout"
android:layout_height="0dp"
android:layout_weight="1"
android:minHeight="180dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
app:cardCornerRadius="12dp"
app:cardElevation="4dp">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="vertical">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/logRecyclerView"
<!-- Log Header -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorSurfaceVariant"
android:padding="16dp"
android:text="@string/activity_logs"
android:textAppearance="?attr/textAppearanceTitleMedium"
android:textColor="?attr/colorOnSurfaceVariant" />

<!-- Log Content -->
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="8dp"
android:clipToPadding="false"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/item_log_entry" />
android:layout_height="0dp"
android:layout_weight="1">

</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/logRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="8dp"
android:clipToPadding="false"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/item_log_entry" />

</LinearLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

</LinearLayout>

</com.google.android.material.card.MaterialCardView>
</com.google.android.material.card.MaterialCardView>

</LinearLayout>

</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
Loading