Use ConstraintLayout for MainActivity

This commit is contained in:
Moez Bhatti
2018-03-12 00:28:05 -07:00
parent 32a979f1e9
commit 4a9175ef99
6 changed files with 126 additions and 139 deletions
@@ -47,7 +47,6 @@ import io.reactivex.subjects.PublishSubject
import io.reactivex.subjects.Subject
import kotlinx.android.synthetic.main.drawer_view.*
import kotlinx.android.synthetic.main.main_activity.*
import kotlinx.android.synthetic.main.toolbar_search.*
import presentation.common.MenuItemAdapter
import presentation.common.Navigator
import presentation.common.base.QkThemedActivity
@@ -53,7 +53,7 @@
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_weight="1"
tools:text="Moez Bhatti" />
tools:text="@tools:sample/full_names" />
<presentation.common.widget.QkTextView
android:id="@+id/date"
@@ -73,7 +73,7 @@
android:layout_marginTop="2dp"
android:ellipsize="end"
android:maxLines="1"
tools:text="Hey! How's it going?" />
tools:text="@tools:sample/lorem/random" />
</LinearLayout>
+104 -77
View File
@@ -24,96 +24,123 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:orientation="vertical">
android:animateLayoutChanges="true">
<include layout="@layout/toolbar_search" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar"
android:focusable="true"
android:focusableInTouchMode="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:background="@color/white">
<FrameLayout
android:layout_width="match_parent"
<presentation.common.widget.QkEditText
android:id="@+id/toolbarSearch"
style="@style/ToolbarText"
app:textColorHint="tertiary"
tools:hint="Search something"
tools:textSize="16sp" />
</android.support.v7.widget.Toolbar>
<android.support.constraint.Group
android:id="@+id/syncing"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="syncingProgress,syncingLabel"
tools:visibility="gone" />
<ProgressBar
android:id="@+id/syncingProgress"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="32dp"
android:layout_marginStart="32dp"
app:layout_constraintBottom_toTopOf="@id/syncingLabel"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/toolbar"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed" />
<presentation.common.widget.QkTextView
android:id="@+id/syncingLabel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="32dp"
android:layout_marginStart="32dp"
android:gravity="center"
android:text="@string/main_syncing"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/syncingProgress"
app:textColor="tertiary" />
<presentation.common.widget.QkTextView
android:id="@+id/empty"
style="@style/TextSecondary"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1">
android:layout_gravity="center"
android:gravity="center"
android:padding="56dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/toolbar"
tools:text="Your conversations will appear here"
tools:visibility="gone" />
<LinearLayout
android:id="@+id/syncing"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="32dp"
android:gravity="center"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="0dp"
android:layout_height="0dp"
android:clipChildren="false"
android:clipToPadding="false"
android:paddingBottom="8dp"
android:paddingTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/toolbar"
tools:listitem="@layout/conversation_list_item" />
<ProgressBar
android:id="@+id/syncingProgress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp" />
<View
android:layout_width="0dp"
android:layout_height="8dp"
android:background="@drawable/ab_shadow"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/toolbar" />
<presentation.common.widget.QkTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/main_syncing"
app:textColor="tertiary" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/compose"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:src="@drawable/ic_add_black_24dp"
android:tint="@color/white"
app:layout_anchor="@+id/recyclerView"
app:layout_anchorGravity="bottom|right|end"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
tools:backgroundTint="@color/tools_theme" />
</LinearLayout>
</android.support.constraint.ConstraintLayout>
<presentation.common.widget.QkTextView
android:id="@+id/empty"
style="@style/TextSecondary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:padding="56dp" />
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="false"
android:clipToPadding="false"
android:paddingBottom="8dp"
android:paddingTop="8dp"
tools:listitem="@layout/conversation_list_item" />
<View
android:layout_width="match_parent"
android:layout_height="8dp"
android:background="@drawable/ab_shadow" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/compose"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_margin="16dp"
android:src="@drawable/ic_add_black_24dp"
android:tint="@color/white"
app:layout_anchor="@+id/recyclerView"
app:layout_anchorGravity="bottom|right|end"
tools:backgroundTint="@color/tools_theme" />
</FrameLayout>
</LinearLayout>
<FrameLayout
<include
android:id="@+id/drawer"
layout="@layout/drawer_view"
android:layout_width="320dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/white"
android:orientation="vertical">
<include
layout="@layout/drawer_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
android:background="@color/white" />
</android.support.v4.widget.DrawerLayout>
+3 -14
View File
@@ -18,24 +18,13 @@
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
-->
<android.support.v7.widget.Toolbar android:id="@+id/toolbar"
style="@style/Toolbar"
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="56dp"
android:gravity="center_vertical"
android:minHeight="56dp">
xmlns:tools="http://schemas.android.com/tools">
<presentation.common.widget.QkTextView
android:id="@+id/toolbarTitle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@null"
android:gravity="left|center_vertical"
android:maxLines="1"
android:singleLine="true"
android:textSize="20sp"
app:textColor="primary"
style="@style/ToolbarText"
tools:text="Conversations" />
</android.support.v7.widget.Toolbar>
@@ -1,45 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
~
~ This file is part of QKSMS.
~
~ QKSMS 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.
~
~ QKSMS 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 QKSMS. If not, see <http://www.gnu.org/licenses/>.
-->
<android.support.v7.widget.Toolbar android:id="@+id/toolbar"
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="56dp"
android:background="@color/white"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="center_vertical"
android:minHeight="56dp">
<presentation.common.widget.QkEditText
android:id="@+id/toolbarSearch"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@null"
android:gravity="left|center_vertical"
android:maxLines="1"
android:singleLine="true"
android:textSize="16sp"
app:textColor="primary"
app:textColorHint="tertiary"
tools:hint="Search something" />
</android.support.v7.widget.Toolbar>
+17
View File
@@ -83,6 +83,23 @@
<item name="android:textStyle">bold</item>
</style>
<style name="Toolbar">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">56dp</item>
<item name="android:gravity">center_vertical</item>
</style>
<style name="ToolbarText">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">match_parent</item>
<item name="android:background">@null</item>
<item name="android:gravity">start|center_vertical</item>
<item name="android:maxLines">1</item>
<item name="android:singleLine">true</item>
<item name="android:textSize">20sp</item>
<item name="textColor">primary</item>
</style>
<style name="CollapsingToolbarCollapsedText">
<item name="android:textSize">20sp</item>
</style>