Skip to content
Snippets Groups Projects
Commit 1d3317bb authored by Taras's avatar Taras
Browse files

Create LoginSuggestionBottomSheet

parent 8c90733f
No related branches found
No related tags found
No related merge requests found
package org.futo.circles.auth.feature.log_in.suggestion
import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.navigation.fragment.navArgs
import dagger.hilt.android.AndroidEntryPoint
import org.futo.circles.auth.R
import org.futo.circles.auth.databinding.BottomSheetLoginSuggestionBinding
import org.futo.circles.core.base.fragment.TransparentBackgroundBottomSheetDialogFragment
@AndroidEntryPoint
class LoginSuggestionBottomSheet : TransparentBackgroundBottomSheetDialogFragment() {
private var binding: BottomSheetLoginSuggestionBinding? = null
private val args: LoginSuggestionBottomSheetArgs by navArgs()
private var applySuggestionListener: LoginSuggestionListener? = null
override fun onAttach(context: Context) {
super.onAttach(context)
applySuggestionListener = (parentFragment as? LoginSuggestionListener)
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
): View? {
binding = BottomSheetLoginSuggestionBinding.inflate(inflater, container, false)
return binding?.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setupViews()
}
private fun setupViews() {
binding?.let {
with(it) {
tvTitle.text = getString(R.string.did_you_mean_format, args.userId)
btnOk.apply {
text = getString(R.string.log_in_as_format, args.userId)
setOnClickListener {
applySuggestionListener?.onLoginSuggestionApplied(args.userId)
dismiss()
}
btnCancel.setOnClickListener { dismiss() }
}
}
}
}
override fun onDestroyView() {
super.onDestroyView()
binding = null
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="8dp"
android:paddingBottom="8dp">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardBackgroundColor="@color/post_card_background_color"
app:cardCornerRadius="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="4dp">
<View
android:layout_width="48dp"
android:layout_height="2dp"
android:layout_gravity="center_horizontal"
android:background="@color/divider_color" />
<TextView
android:id="@+id/tvTitle"
style="@style/body"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginVertical="8dp"
tools:text="Did you mean userId?" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/divider_height"
android:background="@color/divider_color" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btnOk"
style="@style/AccentButtonStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
tools:text="Login as useirId" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btnCancel"
style="@style/NegativeButtonStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:text="@string/no_let_me_try_again" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</FrameLayout>
\ No newline at end of file
......@@ -114,6 +114,8 @@
<string name="next">Next</string>
<string name="add_a_new_circle">Add a new circle</string>
<string name="login_field_hint">\@user:example.com</string>
<string name="did_you_mean_format">Did you mean %s?</string>
<string name="log_in_as_format">Log in as %s</string>
<string name="circle_explanation"><![CDATA[Tip: A <b>circle</b> works like a secure, private version of Facebook or Twitter. Everyone posts to their own timeline, and you see posts from all the timelines that you\'re following.
......@@ -125,6 +127,7 @@ Or, think about all of your friends across all of the places you\'ve ever lived.
<br/><br/>Everyone in the group posts to the same timeline, and everyone in the group can see every post.
<br/><br/>For example, you might want to create a group for your book club, or your sports team, or your scout troop.
<br/><br/>If you want to share with lots of different people who <i>don\'t</i> all know each other, then you should invite those people to follow you in a <b>Circle</b> instead.]]></string>
<string name="no_let_me_try_again">No, let me try again</string>
<plurals name="days">
<item quantity="one">%1$d day</item>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment