From 0b5e3a717bfabb9b440371c4e09b74b27efe7739 Mon Sep 17 00:00:00 2001 From: Evgenii Kozlov Date: Wed, 23 Sep 2020 21:00:25 +0200 Subject: [PATCH] Fix/dashboard positioning (#913) --- .../anytype/ui/desktop/LinearConcatAdapter.kt | 11 ++++++++--- .../main/res/layout/item_dashboard_profile_header.xml | 4 +--- app/src/main/res/layout/item_profile_container.xml | 3 +-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/agileburo/anytype/ui/desktop/LinearConcatAdapter.kt b/app/src/main/java/com/agileburo/anytype/ui/desktop/LinearConcatAdapter.kt index 3826c9e3a8..c07d961a92 100644 --- a/app/src/main/java/com/agileburo/anytype/ui/desktop/LinearConcatAdapter.kt +++ b/app/src/main/java/com/agileburo/anytype/ui/desktop/LinearConcatAdapter.kt @@ -3,6 +3,7 @@ package com.agileburo.anytype.ui.desktop import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.widget.FrameLayout import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.agileburo.anytype.R @@ -12,9 +13,13 @@ class LinearConcatAdapter(val adapter: DashboardProfileAdapter) : RecyclerView.Adapter() { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): LinearConcatHolder { - val view = - LayoutInflater.from(parent.context).inflate(R.layout.item_profile_container, parent, false) - view.recyclerView.layoutManager = LinearLayoutManager(parent.context) + val inflater = LayoutInflater.from(parent.context) + val view = inflater.inflate(R.layout.item_profile_container, parent, false) + view.recyclerView.apply { + layoutManager = LinearLayoutManager(parent.context) + val lp = (layoutParams as FrameLayout.LayoutParams) + lp.height = (parent.height / 2) - lp.topMargin - lp.bottomMargin + } return LinearConcatHolder(view) } diff --git a/app/src/main/res/layout/item_dashboard_profile_header.xml b/app/src/main/res/layout/item_dashboard_profile_header.xml index 536d496443..52ae9e7847 100644 --- a/app/src/main/res/layout/item_dashboard_profile_header.xml +++ b/app/src/main/res/layout/item_dashboard_profile_header.xml @@ -17,9 +17,8 @@ style="@style/HomeDashboardGreetingStyle" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginStart="20dp" android:layout_marginTop="43dp" - android:layout_marginEnd="20dp" + android:layout_marginEnd="10dp" android:lineSpacingExtra="2sp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -30,7 +29,6 @@ android:id="@+id/avatar" android:layout_width="@dimen/width_avatar_on_dashboard" android:layout_height="@dimen/height_avatar_on_dashboard" - android:layout_marginStart="20dp" android:layout_marginTop="24dp" android:background="@drawable/circle_solid_default" app:layout_constraintStart_toStartOf="parent" diff --git a/app/src/main/res/layout/item_profile_container.xml b/app/src/main/res/layout/item_profile_container.xml index 4c04e555ae..8768d86c6c 100644 --- a/app/src/main/res/layout/item_profile_container.xml +++ b/app/src/main/res/layout/item_profile_container.xml @@ -2,9 +2,8 @@ - + android:layout_height="match_parent" /> \ No newline at end of file