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
|
2019-08-03 00:50:42 +02:00
|
|
|
import androidx.appcompat.content.res.AppCompatResources
|
2019-11-22 21:48:31 +01:00
|
|
|
import androidx.core.content.ContextCompat
|
2019-07-26 03:25:34 +02:00
|
|
|
import androidx.navigation.Navigation
|
|
|
|
import androidx.recyclerview.widget.RecyclerView
|
|
|
|
import kotlinx.android.synthetic.main.onboarding_manual_signin.view.*
|
2019-08-03 00:50:42 +02:00
|
|
|
import mozilla.components.support.ktx.android.view.putCompoundDrawablesRelativeWithIntrinsicBounds
|
2019-07-26 03:25:34 +02:00
|
|
|
import org.mozilla.fenix.R
|
|
|
|
import org.mozilla.fenix.home.HomeFragmentDirections
|
|
|
|
|
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 {
|
|
|
|
view.turn_on_sync_button.setOnClickListener {
|
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)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fun bind() {
|
2020-05-12 23:05:08 +02:00
|
|
|
val context = itemView.context
|
|
|
|
|
|
|
|
val appName = context.getString(R.string.app_name)
|
|
|
|
headerText.text = context.getString(R.string.onboarding_firefox_account_header, appName)
|
|
|
|
val icon = AppCompatResources.getDrawable(context, R.drawable.ic_onboarding_firefox_accounts)
|
|
|
|
icon?.setTint(ContextCompat.getColor(context, R.color.white_color))
|
|
|
|
headerText.putCompoundDrawablesRelativeWithIntrinsicBounds(start = icon)
|
2019-07-26 03:25:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
companion object {
|
|
|
|
const val LAYOUT_ID = R.layout.onboarding_manual_signin
|
|
|
|
}
|
|
|
|
}
|