diff --git a/android/app/src/main/kotlin/com/chicagoroboto/features/info/InfoFragment.kt b/android/app/src/main/kotlin/com/chicagoroboto/features/info/InfoFragment.kt index d1f2067..b024982 100644 --- a/android/app/src/main/kotlin/com/chicagoroboto/features/info/InfoFragment.kt +++ b/android/app/src/main/kotlin/com/chicagoroboto/features/info/InfoFragment.kt @@ -2,10 +2,14 @@ package com.chicagoroboto.features.info import android.content.Intent import android.content.Intent.ACTION_VIEW +import android.graphics.Typeface import android.net.Uri import android.os.Bundle import android.view.View +import androidx.constraintlayout.motion.widget.MotionLayout +import androidx.constraintlayout.motion.widget.TransitionAdapter import androidx.core.view.updateLayoutParams +import androidx.core.view.updatePadding import androidx.fragment.app.Fragment import androidx.lifecycle.lifecycleScope import androidx.recyclerview.widget.LinearLayoutManager @@ -17,6 +21,7 @@ import com.chicagoroboto.ext.presentations import com.chicagoroboto.features.info.InfoPresenter.Event.ClickedLibrary import com.chicagoroboto.features.shared.Presentation import com.chicagoroboto.features.shared.startPresentation +import com.chicagoroboto.view.MotionLayoutInsetHelper import dev.chrisbanes.insetter.doOnApplyWindowInsets import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.collect @@ -29,8 +34,10 @@ class InfoFragment : Fragment(R.layout.info) { presenterProvider.get().startPresentation(Dispatchers.Main) } - @Inject lateinit var presenterProvider: Provider + @Inject + lateinit var presenterProvider: Provider + private val motionLayoutInsetHelper = MotionLayoutInsetHelper() private lateinit var binding: InfoBinding private val adapter = InfoAdapter { library -> presentation.presenter.events.offer(ClickedLibrary(library)) @@ -39,16 +46,25 @@ class InfoFragment : Fragment(R.layout.info) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) binding = InfoBinding.bind(view) + + binding.motionLayoutRoot.setTransitionListener(object : TransitionAdapter() { + + override fun onTransitionStarted(motionLayout: MotionLayout?, startId: Int, endId: Int) { + val typefaceStyle = if (endId == R.id.expanded) Typeface.BOLD else Typeface.NORMAL + binding.toolbarText.setTypeface(binding.toolbarText.typeface, typefaceStyle) + } + }) + binding.list.apply { layoutManager = LinearLayoutManager(context, VERTICAL, false) adapter = this@InfoFragment.adapter } - binding.inset.doOnApplyWindowInsets { view, insets, initialState -> + binding.inset.doOnApplyWindowInsets { _, insets, _ -> view.updateLayoutParams { height = insets.systemWindowInsetTop } } - binding.contributorInvite.setOnClickListener { + binding.contributeImg.setOnClickListener { startActivity(Intent(ACTION_VIEW, Uri.parse(getString(R.string.github_link)))) } } diff --git a/android/app/src/main/res/layout/info.xml b/android/app/src/main/res/layout/info.xml index 14435e7..ea2da21 100644 --- a/android/app/src/main/res/layout/info.xml +++ b/android/app/src/main/res/layout/info.xml @@ -1,6 +1,7 @@ @@ -14,215 +15,101 @@ app:layout_constraintTop_toTopOf="parent" /> - - - - - - - - + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/inset"> - + - + android:layout_marginEnd="16dp" /> - + - - - - - - - + android:textColor="?attr/colorOnPrimary" + app:layout_constraintEnd_toStartOf="@id/toolbar_text_space_place_holder" /> - + android:visibility="invisible" + app:layout_constraintHorizontal_bias="0.45" /> - -