1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-08 05:47:05 +09:00

870: Design fixes (#915)

* #870: search screen, add swipe

* #870: fixes

* #870: fixes

* #870: fix

* #870: fixes

* #870: fixes

* #870: fix

* #870: start tests

* Update workflow.yml
This commit is contained in:
Konstantin Ivanov 2020-09-24 11:40:40 +03:00 committed by GitHub
parent 0b5e3a717b
commit cfdac1d1c7
Signed by: github
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 116 additions and 70 deletions

View file

@ -70,6 +70,7 @@ class PageNavigationFragment
}
)
}
viewPager.setCurrentItem(1, false)
TabLayoutMediator(tabLayout, viewPager) { tab, position ->
when (position) {
POSITION_FROM -> tab.text = getString(R.string.page_nav_link_from)

View file

@ -15,7 +15,9 @@ import com.agileburo.anytype.presentation.search.PageSearchView
import com.agileburo.anytype.presentation.search.PageSearchViewModel
import com.agileburo.anytype.presentation.search.PageSearchViewModelFactory
import com.agileburo.anytype.ui.base.ViewStateFragment
import com.google.android.material.bottomsheet.BottomSheetBehavior
import kotlinx.android.synthetic.main.fragment_page_search.*
import kotlinx.android.synthetic.main.fragment_page_search.sheet
import javax.inject.Inject
class PageSearchFragment : ViewStateFragment<PageSearchView>(R.layout.fragment_page_search) {
@ -37,6 +39,20 @@ class PageSearchFragment : ViewStateFragment<PageSearchView>(R.layout.fragment_p
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
BottomSheetBehavior.from(sheet).apply {
state = BottomSheetBehavior.STATE_EXPANDED
isHideable = true
addBottomSheetCallback(
object : BottomSheetBehavior.BottomSheetCallback() {
override fun onSlide(bottomSheet: View, slideOffset: Float) {}
override fun onStateChanged(bottomSheet: View, newState: Int) {
if (newState == BottomSheetBehavior.STATE_HIDDEN) {
vm.onBottomSheetHidden()
}
}
}
)
}
vm.state.observe(viewLifecycleOwner, this)
vm.navigation.observe(viewLifecycleOwner, navObserver)
clearSearchText = searchView.findViewById(R.id.clearSearchText)

View file

@ -18,7 +18,7 @@
android:id="@+id/close"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_marginTop="16dp"
android:layout_marginTop="18dp"
android:layout_marginEnd="16dp"
android:src="@drawable/ic_close_round" />

View file

@ -3,6 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:background="@drawable/gradient_rectangle">
<ImageView
@ -42,6 +43,7 @@
android:layout_marginEnd="20dp"
android:fontFamily="@font/graphik_semibold"
android:text="@string/enter_your_code"
android:letterSpacing="-0.0218"
android:textColor="@color/black"
android:textSize="22sp"
app:layout_constraintEnd_toEndOf="parent"
@ -56,6 +58,7 @@
android:layout_marginTop="14dp"
android:layout_marginEnd="20dp"
android:fontFamily="@font/inter_regular"
android:lineSpacingMultiplier="1.21"
android:text="@string/enter_invitation_text"
android:textColor="#2C2B27"
android:textSize="15sp"

View file

@ -54,6 +54,7 @@
android:layout_marginStart="@dimen/auth_default_margin_start"
android:layout_marginTop="11dp"
android:layout_marginEnd="@dimen/auth_default_margin_end"
android:gravity="top"
android:background="@null"
android:fontFamily="@font/inconsolata"
android:hint="@string/type_your_keychain"

View file

@ -1,63 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:clickable="true"
android:focusable="true">
android:background="@drawable/home_dashboard_cover">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="14dp"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/searchView"
tools:visibility="visible" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/sheet"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:clickable="true"
android:focusable="true"
app:layout_behavior="@string/bottom_sheet_behavior">
<include
android:id="@+id/searchView"
android:layout_width="0dp"
android:layout_height="36dp"
layout="@layout/widget_search_view"
android:layout_marginTop="@dimen/dp_16"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginEnd="@dimen/dp_16"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="14dp"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/searchView"
tools:visibility="visible" />
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:indeterminateTint="#FFB522"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="gone" />
<include
android:id="@+id/searchView"
layout="@layout/widget_search_view"
android:layout_width="0dp"
android:layout_height="36dp"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_16"
android:layout_marginEnd="@dimen/dp_16"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvScreenStateMessage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:layout_marginTop="64dp"
android:layout_marginEnd="64dp"
android:textSize="15sp"
android:fontFamily="@font/inter_regular"
android:textColor="#6C6A5F"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/searchView"
tools:text="There are no pages named cbbjh. Try creating a new one or search for something else." />
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:indeterminateTint="#FFB522"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="gone" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/tvScreenStateMessage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:layout_marginTop="64dp"
android:layout_marginEnd="64dp"
android:fontFamily="@font/inter_regular"
android:textColor="#6C6A5F"
android:textSize="15sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/searchView"
tools:text="There are no pages named cbbjh. Try creating a new one or search for something else." />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -103,6 +103,7 @@
android:id="@+id/ivArrowForward"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginEnd="12dp"
app:layout_constraintBottom_toBottomOf="@+id/name"
app:layout_constraintEnd_toEndOf="parent"

View file

@ -35,9 +35,10 @@
android:layout_marginStart="@dimen/auth_default_margin_start"
android:layout_marginTop="20dp"
android:layout_marginBottom="10dp"
android:fontFamily="@font/graphik_semibold"
android:letterSpacing="-0.0218"
android:text="@string/organize_everything"
android:textColor="@color/black"
android:fontFamily="@font/graphik_semibold"
android:textSize="22sp"
app:layout_constraintBottom_toTopOf="@+id/textView"
app:layout_constraintStart_toStartOf="parent"
@ -51,6 +52,7 @@
android:layout_marginEnd="@dimen/auth_default_margin_end"
android:layout_marginBottom="18dp"
android:fontFamily="@font/inter_regular"
android:lineSpacingMultiplier="1.21"
android:text="@string/start_login_text"
android:textColor="#2C2B27"
android:textSize="15sp"

View file

@ -147,12 +147,14 @@
</style>
<style name="KeychainDialogTitleStyle">
<item name="fontFamily">@font/graphik_regular</item>
<item name="android:textColor">@color/black</item>
<item name="android:textSize">28sp</item>
<item name="android:textStyle">bold</item>
</style>
<style name="KeychainDialogSubtitleStyle">
<item name="fontFamily">@font/inter_regular</item>
<item name="android:textColor">@color/black</item>
<item name="android:lineSpacingExtra">4sp</item>
<item name="android:textSize">15sp</item>

View file

@ -6,7 +6,7 @@
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:layout_height="64dp"
android:gravity="center"
android:layout_gravity="center"
android:fontFamily="@font/graphik_semibold"

View file

@ -34,7 +34,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="1dp"
app:layout_constraintStart_toEndOf="@+id/icon"
app:layout_constraintTop_toBottomOf="@+id/title"
tools:text="Big section heading" />

View file

@ -35,7 +35,7 @@
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="7dp"
android:layout_marginTop="6dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/bookmarkDescription" />
@ -56,7 +56,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="11dp"
android:layout_marginTop="13dp"
android:layout_marginEnd="16dp"
android:ellipsize="end"
android:maxLines="1"
@ -72,7 +72,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="7dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="16dp"
android:lineSpacingExtra="5sp"
app:layout_constraintEnd_toStartOf="@+id/bookmarkImage"
@ -87,7 +87,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginTop="8dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="12dp"
app:layout_constraintBottom_toBottomOf="parent"

View file

@ -14,6 +14,7 @@
android:contentDescription="@string/content_desc_page_toolbar_search"
android:paddingTop="@dimen/dp_12"
android:paddingBottom="@dimen/dp_12"
android:scaleType="center"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/btnNavigation"
app:layout_constraintStart_toStartOf="parent"
@ -27,6 +28,7 @@
android:contentDescription="@string/content_desc_page_toolbar_navigation"
android:paddingTop="@dimen/dp_12"
android:paddingBottom="@dimen/dp_12"
android:scaleType="center"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/btnAddDoc"
app:layout_constraintHorizontal_bias="0.5"
@ -41,6 +43,7 @@
android:contentDescription="@string/content_desc_page_toolbar_add_doc"
android:paddingTop="@dimen/dp_12"
android:paddingBottom="@dimen/dp_12"
android:scaleType="center"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"

View file

@ -10,6 +10,8 @@
android:background="@color/divider_color" />
<TextView
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
style="@style/PageIconPickerActionTitleStyle"
android:text="@string/page_icon_picker_choose_emoji" />
@ -17,8 +19,6 @@
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_vertical|end"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:contentDescription="@string/content_description_upload_photo"
android:src="@drawable/ic_page_icon_picker_choose_emoji" />

View file

@ -10,6 +10,8 @@
android:background="@color/divider_color" />
<TextView
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
style="@style/PageIconPickerActionTitleStyle"
android:text="@string/page_icon_picker_pick_emoji_randomly" />
@ -17,8 +19,6 @@
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_vertical|end"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:contentDescription="@string/content_description_upload_photo"
android:src="@drawable/ic_page_icon_picker_random_emoji" />

View file

@ -11,14 +11,14 @@
<TextView
style="@style/PageIconPickerActionTitleStyle"
android:text="@string/page_icon_picker_upload_photo" />
android:text="@string/page_icon_picker_upload_photo"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"/>
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_vertical|end"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:contentDescription="@string/content_description_upload_photo"
android:src="@drawable/ic_page_icon_picker_upload_photo" />

View file

@ -4,8 +4,8 @@
<style name="PageIconPickerActionTitleStyle">
<item name="android:layout_gravity">center_vertical</item>
<item name="android:textColor">@color/black</item>
<item name="android:textSize">15sp</item>
<item name="android:fontFamily">@font/graphik_medium</item>
<item name="android:textSize">17sp</item>
<item name="android:fontFamily">@font/inter_regular</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
</style>

View file

@ -69,4 +69,12 @@ class PageSearchViewModel(
fun onOpenPageClicked(pageId: String) {
navigate(EventWrapper(AppNavigation.Command.LaunchDocument(id = pageId)))
}
fun onBottomSheetHidden() {
navigateToDesktop()
}
fun navigateToDesktop() {
navigation.postValue(EventWrapper(AppNavigation.Command.ExitToDesktop))
}
}