Commit e2d80203 authored by divyanshu's avatar divyanshu

connect server screen

parent bd2591df
...@@ -7,12 +7,28 @@ import android.view.LayoutInflater ...@@ -7,12 +7,28 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import chat.rocket.android.R import chat.rocket.android.R
import chat.rocket.android.authentication.domain.model.getLoginDeepLinkInfo
import chat.rocket.android.authentication.server.ui.ServerFragment
import chat.rocket.android.authentication.ui.AuthenticationActivity
import chat.rocket.android.util.extensions.addFragment
import chat.rocket.android.util.extensions.addFragmentBackStack
import chat.rocket.android.util.extensions.inflate
import kotlinx.android.synthetic.main.fragment_on_boarding.*
class OnBoardingFragment : Fragment() { class OnBoardingFragment : Fragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? { savedInstanceState: Bundle?): View? = container?.inflate(R.layout.fragment_on_boarding)
return inflater.inflate(R.layout.fragment_on_boarding, container, false)
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
button_connect_server.setOnClickListener {
val deepLinkInfo = activity?.intent?.getLoginDeepLinkInfo()
(activity as AuthenticationActivity).addFragmentBackStack("ServerFragment", R.id.fragment_container) {
ServerFragment.newInstance(deepLinkInfo)
}
}
} }
companion object { companion object {
......
...@@ -28,7 +28,7 @@ class ServerFragment : Fragment(), ServerView { ...@@ -28,7 +28,7 @@ class ServerFragment : Fragment(), ServerView {
lateinit var presenter: ServerPresenter lateinit var presenter: ServerPresenter
private var deepLinkInfo: LoginDeepLinkInfo? = null private var deepLinkInfo: LoginDeepLinkInfo? = null
private val layoutListener = ViewTreeObserver.OnGlobalLayoutListener { private val layoutListener = ViewTreeObserver.OnGlobalLayoutListener {
text_server_url.isCursorVisible = KeyboardHelper.isSoftKeyboardShown(relative_layout.rootView) text_server_url.isCursorVisible = KeyboardHelper.isSoftKeyboardShown(constraint_layout.rootView)
} }
companion object { companion object {
...@@ -56,7 +56,7 @@ class ServerFragment : Fragment(), ServerView { ...@@ -56,7 +56,7 @@ class ServerFragment : Fragment(), ServerView {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
relative_layout.viewTreeObserver.addOnGlobalLayoutListener(layoutListener) constraint_layout.viewTreeObserver.addOnGlobalLayoutListener(layoutListener)
setupOnClickListener() setupOnClickListener()
deepLinkInfo?.let { deepLinkInfo?.let {
...@@ -66,7 +66,7 @@ class ServerFragment : Fragment(), ServerView { ...@@ -66,7 +66,7 @@ class ServerFragment : Fragment(), ServerView {
} }
text_server_protocol.adapter = ArrayAdapter<String>(activity, text_server_protocol.adapter = ArrayAdapter<String>(activity,
android.R.layout.simple_dropdown_item_1line, arrayOf("https://", "http://")) R.layout.spinner_list, arrayOf("https://", "http://"))
text_server_protocol.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { text_server_protocol.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) { override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
when(position) { when(position) {
...@@ -104,7 +104,7 @@ class ServerFragment : Fragment(), ServerView { ...@@ -104,7 +104,7 @@ class ServerFragment : Fragment(), ServerView {
override fun onDestroyView() { override fun onDestroyView() {
super.onDestroyView() super.onDestroyView()
relative_layout.viewTreeObserver.removeOnGlobalLayoutListener(layoutListener) constraint_layout.viewTreeObserver.removeOnGlobalLayoutListener(layoutListener)
} }
override fun showInvalidServerUrlMessage() = showMessage(getString(R.string.msg_invalid_server_url)) override fun showInvalidServerUrlMessage() = showMessage(getString(R.string.msg_invalid_server_url))
......
...@@ -67,7 +67,7 @@ class AuthenticationActivity : AppCompatActivity(), HasSupportFragmentInjector { ...@@ -67,7 +67,7 @@ class AuthenticationActivity : AppCompatActivity(), HasSupportFragmentInjector {
} }
fun showServerInput(deepLinkInfo: LoginDeepLinkInfo?) { fun showServerInput(deepLinkInfo: LoginDeepLinkInfo?) {
addFragment("ServerFragment", R.id.fragment_container, allowStateLoss = true) { addFragment("OnBoardingFragment", R.id.fragment_container, allowStateLoss = true) {
// ServerFragment.newInstance(deepLinkInfo) // ServerFragment.newInstance(deepLinkInfo)
OnBoardingFragment.newInstance() OnBoardingFragment.newInstance()
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
android:shape="rectangle"> android:shape="rectangle">
<solid <solid
android:color="@color/colorPrimaryDark" /> android:color="@color/colorWhite" />
<corners <corners
android:radius="2dp" /> android:radius="2dp" />
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/relative_layout" android:id="@+id/constraint_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:focusableInTouchMode="true" android:focusableInTouchMode="true"
android:background="@color/colorWhite"
tools:context=".authentication.server.ui.ServerFragment"> tools:context=".authentication.server.ui.ServerFragment">
<ImageView
android:id="@+id/image_server"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_server"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="40dp" />
<TextView <TextView
android:id="@+id/text_headline" android:id="@+id/text_headline"
style="@style/Authentication.Headline.TextView" android:layout_width="wrap_content"
android:layout_centerHorizontal="true" android:layout_height="wrap_content"
android:textSize="22sp"
android:fontFamily="sans-serif"
android:textStyle="bold"
android:textColor="#2f343d"
android:lineSpacingExtra="6sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/image_server"
android:layout_marginTop="8dp"
android:text="@string/title_sign_in_your_server" /> android:text="@string/title_sign_in_your_server" />
<EditText <RelativeLayout
android:id="@+id/text_server_url" android:id="@+id/view_server"
style="@style/Authentication.EditText" android:layout_width="0dp"
android:layout_below="@id/text_headline" android:layout_height="48dp"
android:layout_marginStart="-6dp" android:background="@drawable/rounded_border"
android:layout_marginTop="32dp" app:layout_constraintStart_toStartOf="parent"
android:layout_toEndOf="@id/protocol_container" app:layout_constraintEnd_toEndOf="parent"
android:cursorVisible="false" app:layout_constraintTop_toBottomOf="@id/text_headline"
android:hint="@string/default_server" android:layout_marginTop="24dp"
android:imeOptions="actionDone" android:layout_marginStart="16dp"
android:inputType="text|textUri" android:layout_marginEnd="16dp">
android:paddingEnd="0dp" />
<FrameLayout <FrameLayout
android:id="@+id/protocol_container" android:id="@+id/protocol_container"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:background="@drawable/style_edit_text_authentication" >
android:layout_marginStart="@dimen/screen_edge_left_and_right_margins"
android:layout_below="@id/text_headline"
android:layout_marginTop="32dp">
<Spinner <Spinner
android:id="@+id/text_server_protocol" android:id="@+id/text_server_protocol"
android:spinnerMode="dropdown" android:spinnerMode="dropdown"
android:layout_width="120dp" android:layout_width="120dp"
android:layout_height="50dp" android:layout_height="match_parent"
android:layout_margin="1dp"
android:backgroundTint="@color/actionMenuColor" /> android:backgroundTint="@color/actionMenuColor" />
</FrameLayout> </FrameLayout>
<EditText
android:id="@+id/text_server_url"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:cursorVisible="false"
android:hint="@string/default_server"
android:imeOptions="actionDone"
android:inputType="text|textUri"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_centerVertical="true"
android:textSize="17sp"
android:textColorHint="#9ea2a8"
android:textColor="#9ea2a8"
android:layout_toEndOf="@id/protocol_container"
android:background="@color/colorWhite" />
</RelativeLayout>
<Button
android:id="@+id/button_connect"
android:layout_width="0dp"
android:layout_height="48dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/view_server"
android:layout_marginTop="20dp"
android:text="@string/action_connect"
android:textSize="18sp"
android:textColor="@color/colorWhite"
android:background="@drawable/rounded_color_accent"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:textAllCaps="false"/>
<com.wang.avi.AVLoadingIndicatorView <com.wang.avi.AVLoadingIndicatorView
android:id="@+id/view_loading" android:id="@+id/view_loading"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerInParent="true" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:visibility="gone" android:visibility="gone"
app:indicatorName="BallPulseIndicator" app:indicatorName="BallPulseIndicator"
tools:visibility="visible" /> tools:visibility="visible" />
<Button </androidx.constraintlayout.widget.ConstraintLayout>
android:id="@+id/button_connect"
style="@style/Authentication.Button"
android:layout_alignParentBottom="true"
android:text="@string/action_connect" />
</RelativeLayout>
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
android:layout_marginTop="8dp"/> android:layout_marginTop="8dp"/>
<RelativeLayout <RelativeLayout
android:id="@+id/view_connect_server" android:id="@+id/button_connect_server"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="60dp" android:layout_height="60dp"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
...@@ -94,12 +94,12 @@ ...@@ -94,12 +94,12 @@
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/view_join_community" android:id="@+id/button_join_community"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="60dp" android:layout_height="60dp"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/view_connect_server" app:layout_constraintTop_toBottomOf="@id/button_connect_server"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:background="@drawable/rounded_border" android:background="@drawable/rounded_border"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
android:layout_height="60dp" android:layout_height="60dp"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/view_join_community" app:layout_constraintTop_toBottomOf="@id/button_join_community"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
......
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textColor="@color/colorPrimaryText"
android:textAlignment="center"
android:background="@color/colorWhite"
android:padding="10dp"
tools:text="https" />
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment