mirror of
https://github.com/oxen-io/session-android.git
synced 2023-12-14 02:53:01 +01:00
c113a447cf
* refactor: Migrate home screen to data binding * Add view binding * Migrate ConversationView to view binding * Migrate ConversationActivityV2 to view binding * View model refactor * Move more functionality to the view model * Add ui state events flow * Update conversation item bindings * Update profile picture view bindings * Replace Kotlin synthetics with view bindings * Fix qr code fragment binding and optimize imports * View binding refactors * Make TextSecurePreferences an interface and add an implementation to improve testability * Add conversation repository * Migrate remaining TextSecurePreferences functions into the interface * Add unit conversation unit tests * Add unit test coverage for remaining view model functions
59 lines
No EOL
1.9 KiB
Kotlin
59 lines
No EOL
1.9 KiB
Kotlin
package org.thoughtcrime.securesms.onboarding
|
|
|
|
import android.content.Context
|
|
import android.os.Build
|
|
import android.util.AttributeSet
|
|
import android.view.LayoutInflater
|
|
import android.view.View
|
|
import android.widget.FrameLayout
|
|
import network.loki.messenger.databinding.ViewSeedReminderBinding
|
|
|
|
class SeedReminderView : FrameLayout {
|
|
private lateinit var binding: ViewSeedReminderBinding
|
|
|
|
var title: CharSequence
|
|
get() = binding.titleTextView.text
|
|
set(value) { binding.titleTextView.text = value }
|
|
var subtitle: CharSequence
|
|
get() = binding.subtitleTextView.text
|
|
set(value) { binding.subtitleTextView.text = value }
|
|
var delegate: SeedReminderViewDelegate? = null
|
|
|
|
constructor(context: Context) : super(context) {
|
|
setUpViewHierarchy()
|
|
}
|
|
|
|
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
|
|
setUpViewHierarchy()
|
|
}
|
|
|
|
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
|
|
setUpViewHierarchy()
|
|
}
|
|
|
|
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) {
|
|
setUpViewHierarchy()
|
|
}
|
|
|
|
private fun setUpViewHierarchy() {
|
|
binding = ViewSeedReminderBinding.inflate(LayoutInflater.from(context), this, true)
|
|
binding.button.setOnClickListener { delegate?.handleSeedReminderViewContinueButtonTapped() }
|
|
}
|
|
|
|
fun setProgress(progress: Int, isAnimated: Boolean) {
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
|
binding.progressBar.setProgress(progress, isAnimated)
|
|
} else {
|
|
binding.progressBar.progress = progress
|
|
}
|
|
}
|
|
|
|
fun hideContinueButton() {
|
|
binding.button.visibility = View.GONE
|
|
}
|
|
}
|
|
|
|
interface SeedReminderViewDelegate {
|
|
|
|
fun handleSeedReminderViewContinueButtonTapped()
|
|
} |