Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@ package com.ichi2.anki.introduction
import android.os.Bundle
import android.os.Parcelable
import android.view.View
import android.widget.Button
import androidx.core.os.bundleOf
import androidx.fragment.app.Fragment
import androidx.fragment.app.setFragmentResult
import com.ichi2.anki.R
import com.ichi2.anki.databinding.IntroductionLayoutBinding
import com.ichi2.anki.introduction.SetupCollectionFragment.CollectionSetupOption.DeckPickerWithNewCollection
import com.ichi2.anki.introduction.SetupCollectionFragment.CollectionSetupOption.SyncFromExistingAccount
import dev.androidbroadcast.vbpd.viewBinding
import kotlinx.parcelize.Parcelize

/**
Expand All @@ -58,18 +59,16 @@ import kotlinx.parcelize.Parcelize
* if the app is uninstalled.
*/
class SetupCollectionFragment : Fragment(R.layout.introduction_layout) {
val binding by viewBinding(IntroductionLayoutBinding::bind)

override fun onViewCreated(
view: View,
savedInstanceState: Bundle?,
) {
super.onViewCreated(view, savedInstanceState)

view.findViewById<Button>(R.id.get_started).apply {
setOnClickListener { setResult(DeckPickerWithNewCollection) }
}
view.findViewById<Button>(R.id.sync_profile).apply {
setOnClickListener { setResult(SyncFromExistingAccount) }
}
binding.getStarted.setOnClickListener { setResult(DeckPickerWithNewCollection) }
binding.syncProfile.setOnClickListener { setResult(SyncFromExistingAccount) }
}

private fun setResult(option: CollectionSetupOption) {
Expand Down