Commit 5c2c87aa authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Updates views.

parent e81dd162
......@@ -25,4 +25,14 @@ interface LoginView : LoadingView, MessageView {
* the user (i.e. The fields are empty/blank)
*/
fun disableButtonLogin()
}
\ No newline at end of file
/**
* Enables the forget password button after requesting a processing to log in.
*/
fun enableButtonForgetPassword()
/**
* Disables the forget password button when requesting a processing to log in.
*/
fun disableButtonForgetPassword()
}
......@@ -186,6 +186,24 @@ class LoginFragment : Fragment(), LoginView {
}
}
override fun enableButtonForgetPassword() {
context?.let {
button_forgot_your_password.isEnabled = true
button_forgot_your_password.setTextColor(
ContextCompat.getColorStateList(it, R.color.colorAccent)
)
}
}
override fun disableButtonForgetPassword() {
context?.let {
button_forgot_your_password.isEnabled = false
button_forgot_your_password.setTextColor(
ContextCompat.getColorStateList(it, R.color.colorAuthenticationButtonDisabled)
)
}
}
private fun requestStoredCredentials() {
activity?.requestStoredCredentials()?.let { credentials ->
onCredentialRetrieved(credentials.first, credentials.second)
......@@ -223,6 +241,7 @@ class LoginFragment : Fragment(), LoginView {
private fun enableUserInput() {
ui {
enableButtonLogin()
enableButtonForgetPassword()
text_username_or_email.isEnabled = true
text_password.isEnabled = true
}
......@@ -231,6 +250,7 @@ class LoginFragment : Fragment(), LoginView {
private fun disableUserInput() {
ui {
disableButtonLogin()
disableButtonForgetPassword()
text_username_or_email.isEnabled = false
text_password.isEnabled = false
}
......
......@@ -33,12 +33,10 @@ import chat.rocket.android.util.extensions.textContent
import chat.rocket.android.util.extensions.ui
import chat.rocket.common.util.ifNull
import dagger.android.support.AndroidSupportInjection
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import kotlinx.android.synthetic.main.app_bar_chat_room.*
import kotlinx.android.synthetic.main.fragment_authentication_server.*
import okhttp3.HttpUrl
import java.util.concurrent.TimeUnit
import javax.inject.Inject
fun newInstance() = ServerFragment()
......@@ -242,7 +240,6 @@ class ServerFragment : Fragment(), ServerView {
private fun subscribeEditText() {
serverUrlDisposable = text_server_url.asObservable()
.debounce(300, TimeUnit.MILLISECONDS, AndroidSchedulers.mainThread())
.filter { it.isNotBlank() }
.subscribe {
if (it.toString().isValidUrl()) {
......
......@@ -21,10 +21,8 @@ import chat.rocket.android.util.extensions.showToast
import chat.rocket.android.util.extensions.textContent
import chat.rocket.android.util.extensions.ui
import dagger.android.support.AndroidSupportInjection
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import kotlinx.android.synthetic.main.fragment_authentication_two_fa.*
import java.util.concurrent.TimeUnit
import javax.inject.Inject
fun newInstance(username: String, password: String): Fragment {
......@@ -162,7 +160,6 @@ class TwoFAFragment : Fragment(), TwoFAView {
private fun subscribeEditText() {
twoFaCodeDisposable = text_two_factor_authentication_code.asObservable()
.debounce(300, TimeUnit.MILLISECONDS, AndroidSchedulers.mainThread())
.subscribe {
if (it.isNotBlank()) {
enableButtonConfirm()
......
......@@ -10,14 +10,14 @@
<TextView
android:id="@+id/text_login"
style="@style/Authentication.Headline.TextView"
style="@style/Authentication.TextView.Headline"
android:text="@string/title_log_in"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/text_username_or_email"
style="@style/Authentication.EditText"
style="@style/Authentication.EditText.Border"
android:layout_marginTop="16dp"
android:drawableStart="@drawable/ic_at_black_20dp"
android:hint="@string/msg_username_or_email"
......@@ -29,7 +29,7 @@
<EditText
android:id="@+id/text_password"
style="@style/Authentication.EditText"
style="@style/Authentication.EditText.Border"
android:layout_marginTop="10dp"
android:drawableStart="@drawable/ic_key_black_20dp"
android:hint="@string/msg_password"
......@@ -41,7 +41,7 @@
<Button
android:id="@+id/button_log_in"
style="@style/Authentication.Button.Flat"
style="@style/Authentication.Button"
android:layout_marginTop="20dp"
android:backgroundTint="@color/colorAuthenticationButtonDisabled"
android:enabled="false"
......@@ -52,15 +52,9 @@
<Button
android:id="@+id/button_forgot_your_password"
style="?borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="48dp"
style="@style/Authentication.Button.Borderless"
android:layout_marginTop="10dp"
android:text="@string/msg_forgot__your_password"
android:textAllCaps="false"
android:textColor="@color/colorAccent"
android:textSize="18sp"
android:textStyle="bold"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
......
......@@ -151,7 +151,7 @@
<Button
android:id="@+id/button_cas"
style="@style/Authentication.Button.Flat"
style="@style/Authentication.Button"
android:layout_marginTop="10dp"
android:clickable="false"
android:text="@string/action_login_or_sign_up"
......@@ -208,7 +208,7 @@
<Button
android:id="@+id/button_login_with_email"
style="@style/Authentication.Button.Flat"
style="@style/Authentication.Button"
android:layout_marginTop="32dp"
android:text="@string/msg_login_with_email"
android:visibility="gone"
......@@ -219,15 +219,9 @@
<Button
android:id="@+id/button_create_an_account"
style="?borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="48dp"
style="@style/Authentication.Button.Borderless"
android:layout_marginTop="10dp"
android:text="@string/msg_create_account"
android:textAllCaps="false"
android:textColor="@color/colorAccent"
android:textSize="18sp"
android:textStyle="bold"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
......
......@@ -19,7 +19,7 @@
<TextView
android:id="@+id/text_on_boarding_title"
style="@style/Authentication.Headline.TextView"
style="@style/Authentication.TextView.Headline"
android:layout_marginTop="32dp"
android:text="@string/msg_welcome_to_rocket_chat"
app:layout_constraintEnd_toEndOf="parent"
......@@ -28,7 +28,7 @@
<TextView
android:id="@+id/text_on_boarding_description"
style="@style/Authentication.Description.TextView"
style="@style/Authentication.TextView.Description"
android:text="@string/msg_team_communication"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
......
......@@ -9,14 +9,14 @@
<TextView
android:id="@+id/text_sign_in_to_your_server"
style="@style/Authentication.Headline.TextView"
style="@style/Authentication.TextView.Headline"
android:text="@string/title_register_username"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/text_username"
style="@style/Authentication.EditText"
style="@style/Authentication.EditText.Border"
android:layout_marginTop="16dp"
android:drawableStart="@drawable/ic_at_black_20dp"
android:hint="@string/msg_username"
......@@ -28,7 +28,7 @@
<Button
android:id="@+id/button_use_this_username"
style="@style/Authentication.Button.Flat"
style="@style/Authentication.Button"
android:layout_marginTop="20dp"
android:backgroundTint="@color/colorAuthenticationButtonDisabled"
android:enabled="false"
......
......@@ -9,14 +9,14 @@
<TextView
android:id="@+id/text_reset_password"
style="@style/Authentication.Headline.TextView"
style="@style/Authentication.TextView.Headline"
android:text="@string/title_reset_password"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/text_email"
style="@style/Authentication.EditText"
style="@style/Authentication.EditText.Border"
android:layout_marginTop="16dp"
android:drawableStart="@drawable/ic_email_black_20dp"
android:hint="@string/msg_email"
......@@ -28,7 +28,7 @@
<Button
android:id="@+id/button_reset_password"
style="@style/Authentication.Button.Flat"
style="@style/Authentication.Button"
android:layout_marginTop="20dp"
android:backgroundTint="@color/colorAuthenticationButtonDisabled"
android:enabled="false"
......
......@@ -24,7 +24,7 @@
<TextView
android:id="@+id/text_sign_in_to_your_server"
style="@style/Authentication.Headline.TextView"
style="@style/Authentication.TextView.Headline"
android:layout_marginTop="8dp"
android:text="@string/title_sign_in_your_server"
app:layout_constraintEnd_toEndOf="parent"
......@@ -49,7 +49,7 @@
<EditText
android:id="@+id/text_server_url"
style="@style/Authentication.Text.Hint"
style="@style/Authentication.EditText.Hint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
......@@ -65,7 +65,7 @@
<Button
android:id="@+id/button_connect"
style="@style/Authentication.Button.Flat"
style="@style/Authentication.Button"
android:layout_marginTop="20dp"
android:backgroundTint="@color/colorAuthenticationButtonDisabled"
android:enabled="false"
......
......@@ -13,14 +13,14 @@
<TextView
android:id="@+id/text_sign_up"
style="@style/Authentication.Headline.TextView"
style="@style/Authentication.TextView.Headline"
android:text="@string/title_sign_up"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/text_name"
style="@style/Authentication.EditText"
style="@style/Authentication.EditText.Border"
android:layout_marginTop="16dp"
android:drawableStart="@drawable/ic_person_black_20dp"
android:hint="@string/msg_name"
......@@ -32,7 +32,7 @@
<EditText
android:id="@+id/text_username"
style="@style/Authentication.EditText"
style="@style/Authentication.EditText.Border"
android:layout_marginTop="10dp"
android:drawableStart="@drawable/ic_at_black_20dp"
android:hint="@string/msg_username"
......@@ -44,7 +44,7 @@
<EditText
android:id="@+id/text_password"
style="@style/Authentication.EditText"
style="@style/Authentication.EditText.Border"
android:layout_marginTop="10dp"
android:drawableStart="@drawable/ic_key_black_20dp"
android:hint="@string/msg_password"
......@@ -56,7 +56,7 @@
<EditText
android:id="@+id/text_email"
style="@style/Authentication.EditText"
style="@style/Authentication.EditText.Border"
android:layout_marginTop="10dp"
android:drawableStart="@drawable/ic_email_black_20dp"
android:hint="@string/msg_email"
......@@ -68,7 +68,7 @@
<Button
android:id="@+id/button_register"
style="@style/Authentication.Button.Flat"
style="@style/Authentication.Button"
android:layout_marginTop="20dp"
android:backgroundTint="@color/colorAuthenticationButtonDisabled"
android:enabled="false"
......
......@@ -9,14 +9,14 @@
<TextView
android:id="@+id/text_two_factor_authentication"
style="@style/Authentication.Headline.TextView"
style="@style/Authentication.TextView.Headline"
android:text="Two-factor Authentication"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/text_two_factor_authentication_code"
style="@style/Authentication.EditText"
style="@style/Authentication.EditText.Border"
android:layout_marginTop="16dp"
android:imeOptions="actionDone"
android:inputType="text"
......@@ -26,7 +26,7 @@
<Button
android:id="@+id/button_confirm"
style="@style/Authentication.Button.Flat"
style="@style/Authentication.Button"
android:layout_marginTop="20dp"
android:backgroundTint="@color/colorAuthenticationButtonDisabled"
android:enabled="false"
......
......@@ -12,17 +12,17 @@
<!-- Widget styles. -->
<!-- Authentication -->
<style name="Authentication.Headline.TextView" parent="TextAppearance.AppCompat">
<style name="Authentication.TextView.Headline" parent="TextAppearance.AppCompat">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textSize">22sp</item>
<item name="android:textSize">24sp</item>
<item name="android:lineSpacingExtra">4sp</item>
<item name="android:fontFamily">sans-serif</item>
<item name="android:textColor">#FF2F343D</item>
<item name="android:textColor">@color/colorPrimary</item>
<item name="android:textStyle">bold</item>
</style>
<style name="Authentication.Description.TextView" parent="TextAppearance.AppCompat">
<style name="Authentication.TextView.Description" parent="TextAppearance.AppCompat">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textSize">16sp</item>
......@@ -52,7 +52,7 @@
<item name="android:letterSpacing">0.04</item>
</style>
<style name="Authentication.Text.Hint" parent="TextAppearance.AppCompat">
<style name="Authentication.EditText.Hint" parent="TextAppearance.AppCompat">
<item name="android:textSize">17sp</item>
<item name="android:fontFamily">sans-serif</item>
<item name="android:textStyle">normal</item>
......@@ -60,20 +60,20 @@
<item name="android:lineSpacingExtra">3sp</item>
</style>
<style name="Authentication.EditText" parent="Widget.AppCompat.EditText">
<style name="Authentication.EditText.Border" parent="Widget.AppCompat.EditText">
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">48dp</item>
<item name="android:paddingStart">@dimen/edit_text_margin</item>
<item name="android:paddingEnd">@dimen/edit_text_margin</item>
<item name="android:maxLines">1</item>
<item name="android:drawablePadding">@dimen/edit_text_drawable_padding</item>
<item name="android:textColor">#9ea2a8</item>
<item name="android:textColorHint">#9ea2a8</item>
<item name="android:textColor">@color/colorPrimaryText</item>
<item name="android:textColorHint">@color/colorAuthenticationSecondaryText</item>
<item name="android:fontFamily">sans-serif</item>
<item name="android:background">@drawable/rounded_border</item>
</style>
<style name="Authentication.Button.Flat" parent="Widget.AppCompat.Button.Borderless">
<style name="Authentication.Button" parent="Widget.AppCompat.Button.Borderless">
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">48dp</item>
<item name="android:foreground">?selectableItemBackground</item>
......@@ -86,6 +86,17 @@
<item name="android:background">@drawable/rounded_color_accent</item>
</style>
<style name="Authentication.Button.Borderless" parent="Widget.AppCompat.Button.Borderless">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">48dp</item>
<item name="android:textAllCaps">false</item>
<item name="android:textColor">@color/colorAccent</item>
<item name="android:textSize">18sp</item>
<item name="android:textStyle">bold</item>
<item name="android:fontFamily">sans-serif</item>
<item name="android:lineSpacingExtra">2sp</item>
</style>
<style name="Authentication.AVLoadingIndicatorView" parent="AVLoadingIndicatorView">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
......@@ -150,7 +161,7 @@
<item name="android:textSize">10sp</item>
</style>
<style name="Profile.EditText" parent="Authentication.EditText">
<style name="Profile.EditText" parent="Authentication.EditText.Border">
<item name="android:background">@drawable/style_edit_text_profile</item>
</style>
......
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