ui: fix tablet mode, cleanup

Change-Id: Ia293d0dae8f6a554ab6c46cd48c11d0ff4c8ce2f
diff --git a/ring-android/app/src/main/res/layout-w720dp-land/activity_home.xml b/ring-android/app/src/main/res/layout-w720dp-land/activity_home.xml
index e3afa4d..44a9198 100644
--- a/ring-android/app/src/main/res/layout-w720dp-land/activity_home.xml
+++ b/ring-android/app/src/main/res/layout-w720dp-land/activity_home.xml
@@ -30,45 +30,54 @@
 
     </androidx.drawerlayout.widget.DrawerLayout>
 
-    <RelativeLayout
+    <androidx.coordinatorlayout.widget.CoordinatorLayout
         android:id="@+id/content_frame"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:paddingEnd="0dp"
         android:paddingStart="@dimen/drawer_content_padding">
 
-        <androidx.appcompat.widget.Toolbar
-            android:id="@+id/main_toolbar"
+        <com.google.android.material.appbar.AppBarLayout
+            android:id="@+id/app_bar"
+            style="@style/Widget.MaterialComponents.AppBarLayout.Surface"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_alignParentStart="true"
-            android:layout_alignParentTop="true"
-            android:minHeight="?attr/actionBarSize"
-            app:contentInsetStart="@dimen/toolbar_content_inset"
-            app:elevation="@dimen/toolbar_elevation" />
+            android:minHeight="?attr/actionBarSize">
 
-        <LinearLayout
-            android:id="@+id/toolbar_spacer"
-            android:layout_width="match_parent"
-            android:layout_height="72sp"
-            android:layout_below="@+id/main_toolbar"
-            android:background="@color/color_primary_light"
-            android:elevation="@dimen/toolbar_elevation"
-            android:gravity="center_vertical"
-            android:orientation="horizontal"
-            android:paddingEnd="0dp"
-            android:paddingStart="@dimen/toolbar_content_inset"
-            android:visibility="gone">
+            <com.google.android.material.appbar.CollapsingToolbarLayout
+                android:id="@+id/toolbar_layout"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                app:layout_scrollFlags="noScroll"
+                app:toolbarId="@id/toolbar"
+                app:collapsedTitleGravity="bottom"
+                app:titleTextColor="@color/textColorPrimary"
+                app:expandedTitleMarginStart="72dp"
+                app:expandedTitleTextAppearance="@style/TextAppearance.MaterialComponents.Headline6">
 
-            <TextView
-                android:id="@+id/toolbar_spacer_title"
-                style="@style/ToolbarTitle"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:text="@string/menu_item_accounts"
-                android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />
+                <com.google.android.material.appbar.MaterialToolbar
+                    android:id="@+id/main_toolbar"
+                    android:layout_width="match_parent"
+                    android:layout_height="?attr/actionBarSize"
+                    app:contentInsetStart="@dimen/toolbar_content_inset"
+                    app:titleMarginStart="24dp"
+                    app:layout_collapseMode="pin"/>
+            </com.google.android.material.appbar.CollapsingToolbarLayout>
 
-        </LinearLayout>
+        </com.google.android.material.appbar.AppBarLayout>
+
+        <com.google.android.material.floatingactionbutton.FloatingActionButton
+            android:id="@+id/action_button"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="@dimen/fab_margin_mini"
+            app:elevation="6dp"
+            app:fabSize="mini"
+            app:layout_anchor="@id/app_bar"
+            app:layout_anchorGravity="bottom"
+            app:pressedTranslationZ="12dp"
+            app:rippleColor="@android:color/white"
+            app:srcCompat="@drawable/baseline_add_24" />
 
         <FrameLayout
             android:id="@+id/main_frame"
@@ -76,23 +85,8 @@
             android:layout_height="match_parent"
             android:layout_alignParentStart="true"
             android:layout_below="@+id/toolbar_spacer"
-            android:orientation="vertical" />
+            android:orientation="vertical"
+            app:layout_behavior="@string/appbar_scrolling_view_behavior" />
 
-        <com.google.android.material.floatingactionbutton.FloatingActionButton
-            android:id="@+id/action_button"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignBottom="@+id/toolbar_spacer"
-            android:layout_alignParentStart="true"
-            android:layout_marginBottom="@dimen/action_button_bpadding"
-            android:layout_marginStart="@dimen/action_button_lpadding"
-            android:adjustViewBounds="false"
-            android:baselineAlignBottom="false"
-            android:visibility="gone"
-            app:elevation="6dp"
-            app:fabSize="mini"
-            app:pressedTranslationZ="12dp"
-            app:rippleColor="@android:color/white" />
-
-    </RelativeLayout>
+    </androidx.coordinatorlayout.widget.CoordinatorLayout>
 </FrameLayout>
\ No newline at end of file
diff --git a/ring-android/app/src/main/res/layout-w720dp-land/frag_smartlist.xml b/ring-android/app/src/main/res/layout-w720dp-land/frag_smartlist.xml
index 8f2c94e..ca26793 100644
--- a/ring-android/app/src/main/res/layout-w720dp-land/frag_smartlist.xml
+++ b/ring-android/app/src/main/res/layout-w720dp-land/frag_smartlist.xml
@@ -7,88 +7,6 @@
     android:animateLayoutChanges="true"
     tools:context=".client.HomeActivity">
 
-    <LinearLayout
-        android:id="@+id/newcontact_element"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_below="@+id/error_msg_pane"
-        android:background="?android:attr/selectableItemBackground"
-        android:orientation="vertical"
-        android:visibility="gone">
-
-        <include
-            layout="@layout/item_contact"
-            android:layout_width="match_parent"
-            android:layout_height="72dp" />
-
-        <View
-            android:layout_width="match_parent"
-            android:layout_height="1dp"
-            android:background="?android:attr/listDivider" />
-
-    </LinearLayout>
-
-    <FrameLayout
-        android:id="@+id/smartlist_layout"
-        android:layout_width="320dp"
-        android:layout_height="match_parent"
-        android:layout_below="@+id/newcontact_element">
-
-        <androidx.recyclerview.widget.RecyclerView
-            android:id="@+id/confs_list"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:layout_marginStart="0dp"
-            android:clipToPadding="false"
-            android:divider="@null"
-            android:elevation="2dp"
-            android:paddingBottom="8dp"
-            tools:listitem="@layout/item_smartlist" />
-
-        <TextView
-            android:id="@+id/empty_text_view"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_gravity="center"
-            android:gravity="center"
-            android:visibility="gone"
-            tools:text="0 conversations"
-            tools:visibility="visible" />
-
-        <ProgressBar
-            android:id="@+id/loading_indicator"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_gravity="center" />
-
-        <com.google.android.material.floatingactionbutton.FloatingActionButton
-            android:id="@+id/newconv_fab"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_gravity="bottom|end"
-            android:layout_margin="@dimen/fab_margin"
-            android:elevation="6dp"
-            app:backgroundTint="@color/color_primary_light"
-            app:elevation="6dp"
-            app:pressedTranslationZ="12dp"
-            app:rippleColor="@color/color_primary_dark"
-            app:srcCompat="@drawable/baseline_dialpad_24" />
-
-    </FrameLayout>
-
-    <View
-        android:id="@+id/separator"
-        android:layout_width="1dp"
-        android:layout_height="match_parent"
-        android:layout_toEndOf="@+id/smartlist_layout"
-        android:background="@color/darker_gray" />
-
-    <FrameLayout
-        android:id="@+id/conversation_container"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:layout_toEndOf="@+id/separator" />
-
     <RelativeLayout
         android:id="@+id/error_msg_pane"
         android:layout_width="match_parent"
@@ -124,4 +42,88 @@
             tools:text="No connectivity"/>
     </RelativeLayout>
 
+    <LinearLayout
+        android:id="@+id/newcontact_element"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_below="@+id/error_msg_pane"
+        android:background="?android:attr/selectableItemBackground"
+        android:orientation="vertical"
+        android:visibility="gone"
+        tools:visibility="visible">
+
+        <include
+            layout="@layout/item_contact"
+            android:layout_width="match_parent"
+            android:layout_height="72dp" />
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="1dp"
+            android:background="?android:attr/listDivider" />
+
+    </LinearLayout>
+
+    <androidx.coordinatorlayout.widget.CoordinatorLayout
+        android:id="@+id/list_coordinator"
+        android:layout_width="320dp"
+        android:layout_height="match_parent"
+        android:layout_below="@id/newcontact_element">
+
+        <androidx.recyclerview.widget.RecyclerView
+            android:id="@+id/confs_list"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_marginStart="0dp"
+            android:clipToPadding="false"
+            android:divider="@null"
+            android:elevation="2dp"
+            android:paddingBottom="8dp"
+            tools:listitem="@layout/item_smartlist" />
+
+        <TextView
+            android:id="@+id/empty_text_view"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:gravity="center"
+            android:visibility="gone"
+            tools:text="0 conversations"
+            tools:visibility="visible" />
+
+        <ProgressBar
+            android:id="@+id/loading_indicator"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center" />
+
+        <com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
+            android:id="@+id/newconv_fab"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignWithParentIfMissing="false"
+            android:layout_gravity="bottom|end"
+            android:layout_margin="@dimen/fab_margin"
+            android:elevation="6dp"
+            android:text="@string/start_conversation"
+            app:elevation="6dp"
+            app:icon="@drawable/baseline_add_24"
+            app:pressedTranslationZ="12dp"
+            app:layout_anchorGravity="bottom|right|end"/>
+
+    </androidx.coordinatorlayout.widget.CoordinatorLayout>
+
+    <View
+        android:id="@+id/separator"
+        android:layout_width="1dp"
+        android:layout_height="match_parent"
+        android:layout_toEndOf="@+id/list_coordinator"
+        android:background="@color/darker_gray" />
+
+    <FrameLayout
+        android:id="@+id/conversation_container"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_toEndOf="@+id/separator" />
+
 </RelativeLayout>
\ No newline at end of file
diff --git a/ring-android/app/src/main/res/layout/activity_account_settings.xml b/ring-android/app/src/main/res/layout/activity_account_settings.xml
index 7b58296..b0ba258 100644
--- a/ring-android/app/src/main/res/layout/activity_account_settings.xml
+++ b/ring-android/app/src/main/res/layout/activity_account_settings.xml
@@ -6,31 +6,24 @@
     android:orientation="vertical"
     tools:context=".account.AccountEditionActivity">
 
-    <LinearLayout
+    <com.google.android.material.appbar.AppBarLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:background="@color/color_primary_light"
-        android:elevation="4dp"
-        android:orientation="vertical">
+        android:elevation="@dimen/toolbar_elevation"
+        style="@style/Widget.MaterialComponents.AppBarLayout.Surface">
 
-        <androidx.appcompat.widget.Toolbar
+        <com.google.android.material.appbar.MaterialToolbar
             android:id="@+id/main_toolbar"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:background="@color/color_primary_light"
-            android:minHeight="?attr/actionBarSize"
-            android:popupTheme="@style/Theme.MaterialComponents.Light.NoActionBar"
-            android:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar"
-            app:contentInsetStart="72dp" />
+            android:minHeight="?attr/actionBarSize" />
 
         <com.google.android.material.tabs.TabLayout
             android:id="@+id/sliding_tabs"
-            style="@style/Widget.MaterialComponents.TabLayout.Colored"
-            android:background="@color/color_primary_light"
             android:layout_width="match_parent"
-            android:layout_height="48dp" />
+            android:layout_height="wrap_content" />
 
-    </LinearLayout>
+    </com.google.android.material.appbar.AppBarLayout>
 
     <RelativeLayout
         android:layout_width="match_parent"
@@ -46,7 +39,8 @@
                 android:id="@+id/pager"
                 android:layout_width="wrap_content"
                 android:layout_height="match_parent"
-                android:layout_alignParentBottom="true" />
+                android:layout_alignParentBottom="true"
+                app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
 
             <FrameLayout
                 android:id="@+id/fragment_container"
diff --git a/ring-android/app/src/main/res/layout/frag_call.xml b/ring-android/app/src/main/res/layout/frag_call.xml
index a2dfc70..3f65cd1 100644
--- a/ring-android/app/src/main/res/layout/frag_call.xml
+++ b/ring-android/app/src/main/res/layout/frag_call.xml
@@ -18,7 +18,8 @@
 -->
 <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">
+    xmlns:tools="http://schemas.android.com/tools"
+    tools:context=".client.CallActivity">
 
     <data>
 
@@ -31,7 +32,7 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:keepScreenOn="true"
-        tools:context=".client.CallActivity">
+        tools:background="@color/cardview_dark_background">
 
         <RelativeLayout
             android:layout_width="match_parent"
@@ -94,7 +95,7 @@
                         app:enable_color_transition="true"
                         app:ripple_color="@color/white"
                         app:ripple_count="3"
-                        app:ripple_duration="5000"
+                        app:ripple_duration="3000"
                         app:ripple_stroke_width="15dp" />
 
                     <ImageView
diff --git a/ring-android/app/src/main/res/layout/frag_conversation.xml b/ring-android/app/src/main/res/layout/frag_conversation.xml
index 340ae05..522f391 100644
--- a/ring-android/app/src/main/res/layout/frag_conversation.xml
+++ b/ring-android/app/src/main/res/layout/frag_conversation.xml
@@ -17,38 +17,14 @@
             android:paddingTop="?attr/actionBarSize">
 
             <LinearLayout
-                android:id="@+id/trustRequestMessageLayout"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_alignParentTop="true"
-                android:orientation="vertical"
-                android:visibility="visible">
-
-                <TextView
-                    android:id="@+id/tvTrustRequestMessage"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:background="@color/surface"
-                    android:textColor="@color/textColorPrimary"
-                    android:gravity="center"
-                    android:padding="30dp"
-                    tools:text="Jean is not in your contacts yet" />
-
-                <View
-                    android:layout_width="match_parent"
-                    android:layout_height="1dp"
-                    android:background="@color/lighter_gray" />
-
-            </LinearLayout>
-
-            <LinearLayout
                 android:id="@+id/ongoingcall_pane"
                 android:layout_width="match_parent"
                 android:layout_height="48dp"
-                android:background="#e3c1c1"
+                android:background="@color/red_300"
                 android:gravity="center"
                 android:onClick="@{() -> presenter.onClick()}"
-                android:visibility="gone">
+                android:visibility="gone"
+                tools:visibility="visible">
 
                 <TextView
                     android:layout_width="wrap_content"
@@ -59,6 +35,33 @@
                     android:textColor="@color/textColorPrimary" />
             </LinearLayout>
 
+            <LinearLayout
+                android:id="@+id/trustRequestMessageLayout"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_below="@id/ongoingcall_pane"
+                android:layout_alignParentTop="false"
+                android:orientation="vertical"
+                android:visibility="visible"
+                tools:visibility="visible">
+
+                <TextView
+                    android:id="@+id/tvTrustRequestMessage"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:background="@color/surface"
+                    android:gravity="center"
+                    android:padding="24dp"
+                    android:textColor="@color/textColorPrimary"
+                    tools:text="Jean is not in your contacts yet" />
+
+                <View
+                    android:layout_width="match_parent"
+                    android:layout_height="1dp"
+                    android:background="@color/lighter_gray" />
+
+            </LinearLayout>
+
             <ProgressBar
                 android:id="@+id/pb_loading"
                 android:layout_width="64dp"
diff --git a/ring-android/app/src/main/res/layout/item_codec.xml b/ring-android/app/src/main/res/layout/item_codec.xml
index c7e1f4a..e9c5067 100644
--- a/ring-android/app/src/main/res/layout/item_codec.xml
+++ b/ring-android/app/src/main/res/layout/item_codec.xml
@@ -29,7 +29,7 @@
         android:layout_width="wrap_content"
         android:layout_height="?android:attr/listPreferredItemHeight"
         android:layout_marginEnd="16dp"
-        android:layout_marginStart="16dp"
+        android:layout_marginStart="72dp"
         android:gravity="center_vertical"
         android:textColor="@color/textColorPrimary"
         android:textSize="16sp"
@@ -54,8 +54,6 @@
         android:layout_height="wrap_content"
         android:layout_alignParentEnd="true"
         android:layout_centerVertical="true"
-        android:layout_marginLeft="16dp"
-        android:layout_marginRight="16dp"
         android:clickable="false"
         android:focusable="false" />
 
diff --git a/ring-android/app/src/main/res/layout/item_menu.xml b/ring-android/app/src/main/res/layout/item_menu.xml
index 21c97f4..b64c3fb 100644
--- a/ring-android/app/src/main/res/layout/item_menu.xml
+++ b/ring-android/app/src/main/res/layout/item_menu.xml
@@ -1,5 +1,4 @@
 <?xml version="1.0" encoding="utf-8"?>
-
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
@@ -13,7 +12,6 @@
         android:layout_height="wrap_content"
         android:layout_centerVertical="true"
         android:layout_marginStart="16dp"
-        android:alpha="0.54"
         tools:src="@drawable/baseline_home_24"/>
 
     <TextView
@@ -25,7 +23,7 @@
         android:layout_marginStart="72dp"
         android:fontFamily="sans-serif-medium"
         android:gravity="center_vertical"
-        android:textColor="@color/textColorSecondary"
+        android:textColor="@color/textColorPrimary"
         android:textSize="14sp"
         tools:text="Home" />
 
diff --git a/ring-android/app/src/main/res/values-night/colors.xml b/ring-android/app/src/main/res/values-night/colors.xml
index 2f51441..4e7b9e3 100644
--- a/ring-android/app/src/main/res/values-night/colors.xml
+++ b/ring-android/app/src/main/res/values-night/colors.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
-    <color name="background">@color/grey_900</color>
+    <color name="background">@color/grey_950</color>
     <color name="surface">@color/grey_700</color>
 
     <color name="colorPrimary">@color/white</color>
diff --git a/ring-android/app/src/main/res/values/material_colors.xml b/ring-android/app/src/main/res/values/material_colors.xml
index d0e78ac..5c94802 100644
--- a/ring-android/app/src/main/res/values/material_colors.xml
+++ b/ring-android/app/src/main/res/values/material_colors.xml
@@ -275,5 +275,6 @@
     <color name="grey_800">#424242</color>
     <color name="grey_850">#323232</color>
     <color name="grey_900">#212121</color>
+    <color name="grey_950">#121212</color>
 
 </resources>
\ No newline at end of file