Adding close button

This commit is contained in:
Maxime NATUREL 2022-09-12 17:14:31 +02:00
parent 648311e2b1
commit 97cdda45d6
3 changed files with 27 additions and 1 deletions

View file

@ -406,6 +406,7 @@
<string name="action_reset">Reset</string> <string name="action_reset">Reset</string>
<string name="action_learn_more">Learn more</string> <string name="action_learn_more">Learn more</string>
<string name="action_next">Next</string> <string name="action_next">Next</string>
<string name="action_got_it">Got it</string>
<string name="copied_to_clipboard">Copied to clipboard</string> <string name="copied_to_clipboard">Copied to clipboard</string>

View file

@ -16,8 +16,10 @@
package im.vector.app.features.settings.devices.v2.more package im.vector.app.features.settings.devices.v2.more
import android.os.Bundle
import android.os.Parcelable import android.os.Parcelable
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentManager
import com.airbnb.mvrx.fragmentViewModel import com.airbnb.mvrx.fragmentViewModel
@ -44,6 +46,17 @@ class SessionLearnMoreBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSh
return BottomSheetSessionLearnMoreBinding.inflate(inflater, container, false) return BottomSheetSessionLearnMoreBinding.inflate(inflater, container, false)
} }
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
initCloseButton()
}
private fun initCloseButton() {
views.bottomSheetSessionLearnMoreCloseButton.debouncedClicks {
dismiss()
}
}
override fun invalidate() = withState(viewModel) { viewState -> override fun invalidate() = withState(viewModel) { viewState ->
super.invalidate() super.invalidate()
views.bottomSheetSessionLearnMoreTitle.text = viewState.title views.bottomSheetSessionLearnMoreTitle.text = viewState.title

View file

@ -34,12 +34,24 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toTopOf="@id/bottomSheetSessionLearnMoreCloseButton"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/bottomSheetSessionLearnMoreTitle" app:layout_constraintTop_toBottomOf="@id/bottomSheetSessionLearnMoreTitle"
tools:text="Further context on verified sessions. What do those mean, and how do they differ from unverified ones." /> tools:text="Further context on verified sessions. What do those mean, and how do they differ from unverified ones." />
<Button
android:id="@+id/bottomSheetSessionLearnMoreCloseButton"
style="@style/Widget.Vector.Button.CallToAction"
android:layout_width="0dp"
android:layout_height="56dp"
android:layout_marginTop="24dp"
android:text="@string/action_got_it"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/bottomSheetSessionLearnMoreDescription" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>