Skip to content
Snippets Groups Projects
Commit 0db85cab authored by Kamal Bramwell's avatar Kamal Bramwell
Browse files

Deleted RegistrationFlowActivity

parent 5477bcef
No related branches found
No related tags found
No related merge requests found
package io.elixxir.feature.registration.registration
import android.content.Intent
import android.os.Bundle
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.core.view.ViewCompat
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsControllerCompat
import androidx.lifecycle.lifecycleScope
import com.google.android.material.snackbar.Snackbar
import io.elixxir.core.ui.util.getTransition
import io.elixxir.core.ui.view.SnackBarActivity
import io.elixxir.feature.registration.R
import io.elixxir.feature.registration.databinding.ActivityRegistrationFlowBinding
/**
* Presents and handles navigation for registration and restore account UI.
*/
class RegistrationFlowActivity : AppCompatActivity(), SnackBarActivity {
private lateinit var binding: ActivityRegistrationFlowBinding
private val viewModel: RegistrationViewModel by viewModels()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
lifecycleScope.launchWhenResumed {
observeEvents()
}
WindowCompat.setDecorFitsSystemWindows(window, false)
hideSystemBars()
binding = ActivityRegistrationFlowBinding.inflate(layoutInflater)
setContentView(binding.root)
}
private fun hideSystemBars() {
val windowInsetsController =
ViewCompat.getWindowInsetsController(window.decorView) ?: return
// Configure the behavior of the hidden system bars
windowInsetsController.systemBarsBehavior =
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
// Hide both the status bar and the navigation bar
windowInsetsController.hide(WindowInsetsCompat.Type.systemBars())
}
private suspend fun observeEvents() {
viewModel.registrationComplete.collect { complete ->
if (complete) onRegistrationComplete()
}
}
private fun onRegistrationComplete() {
// TODO: Explicit deep link to MainActivity in :feature:home module
// val activity = Intent(
// this@RegistrationFlowActivity,
// MainActivity::class.java
// )
//
// val options = getTransition(R.anim.fade_in, R.anim.fade_out)
// startActivity(activity, options)
// ActivityCompat.finishAfterTransition(this)
}
override fun createSnackMessage(msg: String, forceMessage: Boolean): Snackbar {
return Snackbar.make(binding.root, msg, Snackbar.LENGTH_LONG).apply {
view.translationZ = 10f
show()
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
</data>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/brand_background"
tools:context="ui.intro.registration.RegistrationFlowActivity">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/registrationNavHost"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/nav_registration" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</layout>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment