ArticleListActivity: add a w800dp layout
authorDa Risk <da_risk@geekorum.com>
Sun, 06 Oct 2019 19:48:26 -0700
changeset 513 0fb677cb65c7
parent 512 037e1827862d
child 514 f2e9c17efa57
ArticleListActivity: add a w800dp layout Also tweaks a few things for w800 existing layouts
app/src/main/java/com/geekorum/ttrss/articles_list/ArticleListActivity.kt
app/src/main/res/layout-w800dp/activity_article_list.xml
app/src/main/res/layout-w800dp/activity_login_account.xml
app/src/main/res/layout-w800dp/activity_settings.xml
app/src/main/res/layout/drawer_header.xml
app/src/main/res/values-night/colors.xml
app/src/main/res/values/colors.xml
--- a/app/src/main/java/com/geekorum/ttrss/articles_list/ArticleListActivity.kt	Fri Oct 04 11:01:35 2019 -0700
+++ b/app/src/main/java/com/geekorum/ttrss/articles_list/ArticleListActivity.kt	Sun Oct 06 19:48:26 2019 -0700
@@ -68,7 +68,7 @@
     }
 
     private lateinit var binding: ActivityArticleListBinding
-    private val drawerLayout: DrawerLayout
+    private val drawerLayout: DrawerLayout?
         get() = binding.headlinesDrawer
 
 
@@ -99,7 +99,7 @@
         }
         activityViewModel.feedSelectedEvent.observe(this, EventObserver {
             navController.navigate(ArticlesListDirections.actionShowFeed(it.id, it.title))
-            drawerLayout.closeDrawers()
+            drawerLayout?.closeDrawers()
         })
 
         activityViewModel.articleSelectedEvent.observe(this, EventObserver { (position, article) ->
@@ -134,12 +134,12 @@
                 when (destination.id) {
                     R.id.articlesListFragment -> {
                         binding.appBar.setExpanded(true)
-                        drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED)
+                        drawerLayout?.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED)
                         binding.fab.show()
                     }
                     R.id.articlesSearchFragment -> {
                         binding.appBar.setExpanded(true)
-                        drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED)
+                        drawerLayout?.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED)
                         //TODO hide fab. but fab has scrollaware behavior that get it shown back when scrolling
                     }
                 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/layout-w800dp/activity_article_list.xml	Sun Oct 06 19:48:26 2019 -0700
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+    Geekttrss is a RSS feed reader application on the Android Platform.
+
+    Copyright (C) 2017-2019 by Frederic-Charles Barthelery.
+
+    This file is part of Geekttrss.
+
+    Geekttrss 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.
+
+    Geekttrss 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 Geekttrss.  If not, see <http://www.gnu.org/licenses/>.
+
+-->
+<layout 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">
+
+    <data>
+        <variable
+            name="activityViewModel"
+            type="com.geekorum.ttrss.articles_list.ActivityViewModel" />
+    </data>
+
+    <androidx.coordinatorlayout.widget.CoordinatorLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:fitsSystemWindows="true"
+            tools:context="com.geekorum.ttrss.articles_list.ArticleListActivity">
+
+        <View android:id="@+id/header"
+              android:layout_width="match_parent"
+              android:layout_height="192dp"
+              android:background="@color/article_list_header"  />
+
+        <!-- Let the app bar draw the status bar -->
+        <!-- Override stateListAnimator to not lift elevation        -->
+        <com.google.android.material.appbar.AppBarLayout
+                android:id="@+id/app_bar"
+                android:fitsSystemWindows="true"
+                app:statusBarForeground="?colorPrimaryDark"
+                android:layout_width="match_parent"
+                app:layout_constraintTop_toTopOf="parent"
+                android:layout_height="wrap_content"
+                >
+
+            <com.google.android.material.appbar.MaterialToolbar
+                    android:id="@+id/toolbar"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    app:layout_scrollFlags="noScroll"
+                    android:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar"
+                    style="?appBarToolbarStyle"
+                    />
+        </com.google.android.material.appbar.AppBarLayout>
+
+        <androidx.constraintlayout.widget.ConstraintLayout
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_marginTop="?actionBarSize"
+                android:fitsSystemWindows="true"
+                >
+
+            <com.google.android.material.navigation.NavigationView
+                    android:id="@+id/navigation_view"
+                    android:layout_width="300dp"
+                    android:layout_height="match_parent"
+                    app:layout_constraintStart_toStartOf="parent"
+                    app:headerLayout="@layout/drawer_header"
+                    />
+
+            <androidx.coordinatorlayout.widget.CoordinatorLayout
+                    android:layout_width="0dp"
+                    android:layout_height="match_parent"
+                    android:layout_marginStart="24dp"
+                    android:layout_marginEnd="88dp"
+                    app:layout_constraintWidth_max="384dp"
+                    app:layout_constraintEnd_toEndOf="parent"
+                    app:layout_constraintStart_toEndOf="@+id/navigation_view"
+                    app:layout_behavior="@string/appbar_scrolling_view_behavior">
+
+                <fragment android:id="@+id/middle_pane_layout"
+                        android:name="androidx.navigation.fragment.NavHostFragment"
+                        android:layout_width="match_parent"
+                        android:layout_height="match_parent"
+                        app:defaultNavHost="true"
+                        app:navGraph="@navigation/articles_list"
+                        />
+
+                <com.geekorum.geekdroid.views.banners.BannerContainer
+                        android:id="@+id/banner_container"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        app:layout_behavior="@string/bottom_sheet_behavior"
+                        app:behavior_skipCollapsed="true"
+                        app:layout_insetEdge="bottom"
+                        android:elevation="8dp"
+                        tools:layout_height="0dp"
+                        android:theme="@style/ThemeOverlay.AppTheme.BottomSheet" />
+
+            </androidx.coordinatorlayout.widget.CoordinatorLayout>
+        </androidx.constraintlayout.widget.ConstraintLayout>
+
+            <com.google.android.material.floatingactionbutton.FloatingActionButton
+                    android:id="@+id/fab"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_margin="@dimen/fab_margin"
+                    android:src="@drawable/ic_refresh"
+                    app:layout_anchor="@id/header"
+                    app:layout_anchorGravity="bottom|end"
+                    android:onClick="@{() -> activityViewModel.refresh()}"
+                    />
+
+        </androidx.coordinatorlayout.widget.CoordinatorLayout>
+
+
+</layout>
--- a/app/src/main/res/layout-w800dp/activity_login_account.xml	Fri Oct 04 11:01:35 2019 -0700
+++ b/app/src/main/res/layout-w800dp/activity_login_account.xml	Sun Oct 06 19:48:26 2019 -0700
@@ -48,6 +48,7 @@
                     android:id="@+id/toolbar"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
+                    android:elevation="0dp"
                     style="?appBarToolbarStyle"
                     />
 
--- a/app/src/main/res/layout-w800dp/activity_settings.xml	Fri Oct 04 11:01:35 2019 -0700
+++ b/app/src/main/res/layout-w800dp/activity_settings.xml	Sun Oct 06 19:48:26 2019 -0700
@@ -41,13 +41,14 @@
                     android:id="@+id/toolbar"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
+                    android:elevation="0dp"
                     style="?appBarToolbarStyle"
                     />
 
         </com.google.android.material.appbar.AppBarLayout>
 
         <com.google.android.material.card.MaterialCardView
-                android:layout_width="560dp"
+                android:layout_width="512dp"
                 android:layout_height="match_parent"
                 app:layout_constraintStart_toStartOf="parent"
                 app:layout_constraintEnd_toEndOf="parent"
--- a/app/src/main/res/layout/drawer_header.xml	Fri Oct 04 11:01:35 2019 -0700
+++ b/app/src/main/res/layout/drawer_header.xml	Sun Oct 06 19:48:26 2019 -0700
@@ -24,7 +24,7 @@
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
-    android:layout_height="120dp"
+    android:layout_height="128dp"
     android:orientation="vertical"
     android:weightSum="1"
     android:clickable="false">
--- a/app/src/main/res/values-night/colors.xml	Fri Oct 04 11:01:35 2019 -0700
+++ b/app/src/main/res/values-night/colors.xml	Sun Oct 06 19:48:26 2019 -0700
@@ -35,4 +35,6 @@
 
     <color name="image_scrim">#88000000</color>
 
+    <!-- Article list activity -->
+    <color name="article_list_header">@color/dark_color_primary_surface</color>
 </resources>
--- a/app/src/main/res/values/colors.xml	Fri Oct 04 11:01:35 2019 -0700
+++ b/app/src/main/res/values/colors.xml	Sun Oct 06 19:48:26 2019 -0700
@@ -54,4 +54,6 @@
     <color name="image_scrim">#ccffffff</color>
     <color name="article_text_color">?android:textColorTertiary</color>
 
+    <!-- Article list activity -->
+    <color name="article_list_header">@color/primary_lighter</color>
 </resources>