2019-07-26 03:25:34 +02:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
package org.mozilla.fenix.home.sessioncontrol.viewholders.onboarding
|
|
|
|
|
|
|
|
import android.view.View
|
|
|
|
import androidx.navigation.Navigation
|
|
|
|
import androidx.recyclerview.widget.RecyclerView
|
|
|
|
import kotlinx.android.synthetic.main.onboarding_manual_signin.view.*
|
|
|
|
import org.mozilla.fenix.R
|
2020-06-25 20:21:31 +02:00
|
|
|
import org.mozilla.fenix.components.metrics.Event
|
2020-08-20 18:05:11 +02:00
|
|
|
import org.mozilla.fenix.ext.addUnderline
|
2020-06-25 20:21:31 +02:00
|
|
|
import org.mozilla.fenix.ext.components
|
2019-07-26 03:25:34 +02:00
|
|
|
import org.mozilla.fenix.home.HomeFragmentDirections
|
2020-08-20 18:05:11 +02:00
|
|
|
import org.mozilla.fenix.onboarding.OnboardingController
|
|
|
|
import org.mozilla.fenix.onboarding.OnboardingInteractor
|
2019-07-26 03:25:34 +02:00
|
|
|
|
2020-05-12 23:05:08 +02:00
|
|
|
class OnboardingManualSignInViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
|
|
|
|
|
|
|
private val headerText = view.header_text
|
|
|
|
|
2019-07-26 03:25:34 +02:00
|
|
|
init {
|
2020-08-20 18:05:11 +02:00
|
|
|
val interactor = OnboardingInteractor(OnboardingController(itemView.context))
|
|
|
|
|
|
|
|
view.fxa_sign_in_button.setOnClickListener {
|
2020-06-25 20:21:31 +02:00
|
|
|
it.context.components.analytics.metrics.track(Event.OnboardingManualSignIn)
|
|
|
|
|
2020-04-14 06:43:45 +02:00
|
|
|
val directions = HomeFragmentDirections.actionGlobalTurnOnSync()
|
2019-07-26 03:25:34 +02:00
|
|
|
Navigation.findNavController(view).navigate(directions)
|
|
|
|
}
|
2020-08-20 18:05:11 +02:00
|
|
|
|
|
|
|
view.learn_more.addUnderline()
|
|
|
|
view.learn_more.setOnClickListener {
|
|
|
|
interactor.onLearnMoreClicked()
|
|
|
|
}
|
2019-07-26 03:25:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
fun bind() {
|
2020-05-12 23:05:08 +02:00
|
|
|
val context = itemView.context
|
2020-08-20 18:05:11 +02:00
|
|
|
headerText.text = context.getString(R.string.onboarding_firefox_account_header)
|
2019-07-26 03:25:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
companion object {
|
|
|
|
const val LAYOUT_ID = R.layout.onboarding_manual_signin
|
|
|
|
}
|
|
|
|
}
|