Skip to content
Snippets Groups Projects
frag_home.xml 8.2 KiB
Newer Older
<?xml version="1.0" encoding="utf-8"?><!--
Copyright (C) 2004-2016 Savoir-faire Linux Inc.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
<androidx.coordinatorlayout.widget.CoordinatorLayout 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/content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">
    <!-- Smartlist to display swarms -->
    <androidx.fragment.app.FragmentContainerView
        android:id="@+id/fragment_container"
        android:name="cx.ring.fragments.SmartListFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/searchbar_scrolling_view_behavior" />
    <com.google.android.material.appbar.AppBarLayout
        android:id="@+id/app_bar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fitsSystemWindows="true">
        <LinearLayout
            android:id="@+id/app_bar_container"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/background_appbar_gradient"
            android:orientation="vertical"
            app:layout_scrollFlags="scroll|enterAlways|snap|exitUntilCollapsed">

            <!-- Search bar to search for a swarm or for new contacts -->
            <com.google.android.material.search.SearchBar
                android:id="@+id/search_bar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:backgroundTint="@color/searchbar_color"
                android:hint="@string/searchbar_hint"
                android:textAppearance="@style/TextAppearance.Material3.SearchBar"
                app:autoShowKeyboard="true"
                app:navigationIcon="@android:color/transparent" />
            <!-- Donation card -->
            <include
                android:id="@+id/donation_card"
                layout="@layout/frag_donation_card"
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:layout_marginBottom="16dp"
                android:layout_marginEnd="16dp"
                android:layout_marginStart="16dp"
                android:visibility="gone"/>

            <!-- Received invitations -->
            <include
                android:id="@+id/invitation_card"
                layout="@layout/frag_invitation_card" />

        </LinearLayout>

    </com.google.android.material.appbar.AppBarLayout>
    <!-- Search view to display search results -->
    <com.google.android.material.search.SearchView
        android:id="@+id/search_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        android:hint="@string/searchbar_hint"
        app:layout_anchor="@id/search_bar"
        tools:visibility="gone">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">
            <!-- Buttons (QR code and new swarm) -->
            <LinearLayout
                android:id="@+id/buttons"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <!-- QR Code button -->
                <com.google.android.material.card.MaterialCardView
                    android:id="@+id/qr_code"
                    style="@style/Widget.MaterialComponents.Button.OutlinedButton"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="8dp"
                    android:layout_marginTop="8dp"
                    android:layout_marginEnd="8dp"
                    android:layout_marginBottom="8dp"
                    android:layout_weight="1"
                    app:cardCornerRadius="@dimen/button_corner_radius"
                    tools:visibility="visible">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:drawablePadding="8dp"
                        android:text="@string/qr_code"
                        android:textSize="@dimen/text_size_large"
                        app:drawableStartCompat="@drawable/baseline_qr_code_2_black_24dp"
                        app:drawableTint="@color/icon_color" />

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

                <!-- New swarm button -->
                <com.google.android.material.card.MaterialCardView
                    android:id="@+id/new_swarm"
                    style="@style/Widget.MaterialComponents.Button.OutlinedButton"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="8dp"
                    android:layout_marginEnd="8dp"
                    android:layout_marginBottom="8dp"
                    android:layout_weight="1"
                    app:cardCornerRadius="@dimen/button_corner_radius"
                    tools:visibility="visible">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:drawablePadding="8dp"
                        android:text="@string/new_swarm"
                        android:textSize="@dimen/text_size_large"
                        app:drawableStartCompat="@drawable/baseline_group_add_24"
                        app:drawableTint="@color/icon_color" />

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

            </LinearLayout>

            <!-- Search results -->
            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/searchResult"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:clipToPadding="false"
                android:divider="@null"
                android:paddingBottom="8dp"
                tools:listitem="@layout/item_smartlist" />

        </LinearLayout>

    </com.google.android.material.search.SearchView>

    <!-- Floating button to start a new conversation -->
    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
            android:id="@+id/new_swarm_fab"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom|end"
            android:layout_margin="8dp"
            android:backgroundTint="@color/fab_background_color"
            android:outlineProvider="none"
            android:text="@string/start_conversation"
            android:textColor="@color/fab_text_color"
            app:icon="@drawable/baseline_chat_24"
            app:iconTint="@color/fab_text_color"
            app:layout_anchorGravity="bottom|center_horizontal"
            app:pressedTranslationZ="12dp"
            app:shapeAppearanceOverlay="@style/Widget.AppTheme.MainActionButton" />
    </FrameLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>