Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
9964385d
Commit
9964385d
authored
Apr 27, 2018
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add forgot password feature.
parent
380d3688
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
432 additions
and
19 deletions
+432
-19
LoginPresenter.kt
...droid/authentication/login/presentation/LoginPresenter.kt
+11
-1
LoginView.kt
...et/android/authentication/login/presentation/LoginView.kt
+12
-0
LoginFragment.kt
...t/rocket/android/authentication/login/ui/LoginFragment.kt
+21
-0
AuthenticationNavigator.kt
...id/authentication/presentation/AuthenticationNavigator.kt
+12
-0
RegisterUsernameFragment.kt
...ntication/registerusername/ui/RegisterUsernameFragment.kt
+7
-2
ResetPasswordFragmentModule.kt
...ntication/resetpassword/di/ResetPasswordFragmentModule.kt
+30
-0
ResetPasswordFragmentProvider.kt
...ication/resetpassword/di/ResetPasswordFragmentProvider.kt
+12
-0
ResetPasswordPresenter.kt
...tion/resetpassword/presentation/ResetPasswordPresenter.kt
+50
-0
ResetPasswordView.kt
...ntication/resetpassword/presentation/ResetPasswordView.kt
+22
-0
ResetPasswordFragment.kt
.../authentication/resetpassword/ui/ResetPasswordFragment.kt
+130
-0
ActivityBuilder.kt
...java/chat/rocket/android/dagger/module/ActivityBuilder.kt
+2
-0
Ui.kt
app/src/main/java/chat/rocket/android/util/extensions/Ui.kt
+27
-15
fragment_authentication_log_in.xml
app/src/main/res/layout/fragment_authentication_log_in.xml
+16
-1
fragment_authentication_reset_password.xml
...ain/res/layout/fragment_authentication_reset_password.xml
+40
-0
strings.xml
app/src/main/res/values-es/strings.xml
+10
-0
strings.xml
app/src/main/res/values-fr/strings.xml
+10
-0
strings.xml
app/src/main/res/values-hi-rIN/strings.xml
+10
-0
strings.xml
app/src/main/res/values-pt-rBR/strings.xml
+5
-0
strings.xml
app/src/main/res/values/strings.xml
+5
-0
No files found.
app/src/main/java/chat/rocket/android/authentication/login/presentation/LoginPresenter.kt
View file @
9964385d
...
@@ -59,6 +59,7 @@ class LoginPresenter @Inject constructor(
...
@@ -59,6 +59,7 @@ class LoginPresenter @Inject constructor(
setupConnectionInfo
(
currentServer
)
setupConnectionInfo
(
currentServer
)
setupLoginView
()
setupLoginView
()
setupUserRegistrationView
()
setupUserRegistrationView
()
setupForgotPasswordView
()
setupCasView
()
setupCasView
()
setupOauthServicesView
()
setupOauthServicesView
()
}
}
...
@@ -107,6 +108,8 @@ class LoginPresenter @Inject constructor(
...
@@ -107,6 +108,8 @@ class LoginPresenter @Inject constructor(
fun
signup
()
=
navigator
.
toSignUp
()
fun
signup
()
=
navigator
.
toSignUp
()
fun
forgotPassword
()
=
navigator
.
toForgotPassword
()
private
fun
setupLoginView
()
{
private
fun
setupLoginView
()
{
if
(
settings
.
isLoginFormEnabled
())
{
if
(
settings
.
isLoginFormEnabled
())
{
view
.
showFormView
()
view
.
showFormView
()
...
@@ -127,8 +130,15 @@ class LoginPresenter @Inject constructor(
...
@@ -127,8 +130,15 @@ class LoginPresenter @Inject constructor(
private
fun
setupUserRegistrationView
()
{
private
fun
setupUserRegistrationView
()
{
if
(
settings
.
isRegistrationEnabledForNewUsers
()
&&
settings
.
isLoginFormEnabled
())
{
if
(
settings
.
isRegistrationEnabledForNewUsers
()
&&
settings
.
isLoginFormEnabled
())
{
view
.
showSignUpView
()
view
.
setupSignUpView
()
view
.
setupSignUpView
()
view
.
showSignUpView
()
}
}
private
fun
setupForgotPasswordView
()
{
if
(
settings
.
isPasswordResetEnabled
())
{
view
.
setupForgotPasswordView
()
view
.
showForgotPasswordView
()
}
}
}
}
...
...
app/src/main/java/chat/rocket/android/authentication/login/presentation/LoginView.kt
View file @
9964385d
...
@@ -65,6 +65,18 @@ interface LoginView : LoadingView, MessageView {
...
@@ -65,6 +65,18 @@ interface LoginView : LoadingView, MessageView {
*/
*/
fun
setupSignUpView
()
fun
setupSignUpView
()
/**
* Shows the forgot password view if enabled by the server settings.
*
* REMARK: We must set up the forgot password view listener [setupForgotPasswordView].
*/
fun
showForgotPasswordView
()
/**
* Setups the forgot password view when tapped.
*/
fun
setupForgotPasswordView
()
/**
/**
* Hides the sign up view.
* Hides the sign up view.
*/
*/
...
...
app/src/main/java/chat/rocket/android/authentication/login/ui/LoginFragment.kt
View file @
9964385d
...
@@ -240,6 +240,27 @@ class LoginFragment : Fragment(), LoginView {
...
@@ -240,6 +240,27 @@ class LoginFragment : Fragment(), LoginView {
}
}
}
}
override
fun
showForgotPasswordView
()
{
ui
{
text_forgot_your_password
.
isVisible
=
true
}
}
override
fun
setupForgotPasswordView
()
{
ui
{
val
reset
=
getString
(
R
.
string
.
msg_reset
)
val
forgotPassword
=
String
.
format
(
getString
(
R
.
string
.
msg_forgot_password
),
reset
)
text_forgot_your_password
.
text
=
forgotPassword
val
resetListener
=
object
:
ClickableSpan
()
{
override
fun
onClick
(
view
:
View
)
=
presenter
.
forgotPassword
()
}
TextHelper
.
addLink
(
text_forgot_your_password
,
arrayOf
(
reset
),
arrayOf
(
resetListener
))
}
}
override
fun
hideSignUpView
()
{
override
fun
hideSignUpView
()
{
ui
{
ui
{
text_new_to_rocket_chat
.
isVisible
=
false
text_new_to_rocket_chat
.
isVisible
=
false
...
...
app/src/main/java/chat/rocket/android/authentication/presentation/AuthenticationNavigator.kt
View file @
9964385d
...
@@ -5,6 +5,7 @@ import chat.rocket.android.R
...
@@ -5,6 +5,7 @@ import chat.rocket.android.R
import
chat.rocket.android.authentication.domain.model.LoginDeepLinkInfo
import
chat.rocket.android.authentication.domain.model.LoginDeepLinkInfo
import
chat.rocket.android.authentication.login.ui.LoginFragment
import
chat.rocket.android.authentication.login.ui.LoginFragment
import
chat.rocket.android.authentication.registerusername.ui.RegisterUsernameFragment
import
chat.rocket.android.authentication.registerusername.ui.RegisterUsernameFragment
import
chat.rocket.android.authentication.resetpassword.ui.ResetPasswordFragment
import
chat.rocket.android.authentication.signup.ui.SignupFragment
import
chat.rocket.android.authentication.signup.ui.SignupFragment
import
chat.rocket.android.authentication.twofactor.ui.TwoFAFragment
import
chat.rocket.android.authentication.twofactor.ui.TwoFAFragment
import
chat.rocket.android.authentication.ui.AuthenticationActivity
import
chat.rocket.android.authentication.ui.AuthenticationActivity
...
@@ -12,6 +13,7 @@ import chat.rocket.android.authentication.ui.newServerIntent
...
@@ -12,6 +13,7 @@ import chat.rocket.android.authentication.ui.newServerIntent
import
chat.rocket.android.main.ui.MainActivity
import
chat.rocket.android.main.ui.MainActivity
import
chat.rocket.android.server.ui.changeServerIntent
import
chat.rocket.android.server.ui.changeServerIntent
import
chat.rocket.android.util.extensions.addFragmentBackStack
import
chat.rocket.android.util.extensions.addFragmentBackStack
import
chat.rocket.android.util.extensions.toPreviousView
import
chat.rocket.android.webview.ui.webViewIntent
import
chat.rocket.android.webview.ui.webViewIntent
class
AuthenticationNavigator
(
internal
val
activity
:
AuthenticationActivity
)
{
class
AuthenticationNavigator
(
internal
val
activity
:
AuthenticationActivity
)
{
...
@@ -28,6 +30,10 @@ class AuthenticationNavigator(internal val activity: AuthenticationActivity) {
...
@@ -28,6 +30,10 @@ class AuthenticationNavigator(internal val activity: AuthenticationActivity) {
}
}
}
}
fun
toPreviousView
()
{
activity
.
toPreviousView
()
}
fun
toTwoFA
(
username
:
String
,
password
:
String
)
{
fun
toTwoFA
(
username
:
String
,
password
:
String
)
{
activity
.
addFragmentBackStack
(
"TwoFAFragment"
,
R
.
id
.
fragment_container
)
{
activity
.
addFragmentBackStack
(
"TwoFAFragment"
,
R
.
id
.
fragment_container
)
{
TwoFAFragment
.
newInstance
(
username
,
password
)
TwoFAFragment
.
newInstance
(
username
,
password
)
...
@@ -40,6 +46,12 @@ class AuthenticationNavigator(internal val activity: AuthenticationActivity) {
...
@@ -40,6 +46,12 @@ class AuthenticationNavigator(internal val activity: AuthenticationActivity) {
}
}
}
}
fun
toForgotPassword
()
{
activity
.
addFragmentBackStack
(
"ResetPasswordFragment"
,
R
.
id
.
fragment_container
)
{
ResetPasswordFragment
.
newInstance
()
}
}
fun
toWebPage
(
url
:
String
)
{
fun
toWebPage
(
url
:
String
)
{
activity
.
startActivity
(
activity
.
webViewIntent
(
url
))
activity
.
startActivity
(
activity
.
webViewIntent
(
url
))
activity
.
overridePendingTransition
(
R
.
anim
.
slide_up
,
R
.
anim
.
hold
)
activity
.
overridePendingTransition
(
R
.
anim
.
slide_up
,
R
.
anim
.
hold
)
...
...
app/src/main/java/chat/rocket/android/authentication/registerusername/ui/RegisterUsernameFragment.kt
View file @
9964385d
...
@@ -16,7 +16,8 @@ import kotlinx.android.synthetic.main.fragment_authentication_register_username.
...
@@ -16,7 +16,8 @@ import kotlinx.android.synthetic.main.fragment_authentication_register_username.
import
javax.inject.Inject
import
javax.inject.Inject
class
RegisterUsernameFragment
:
Fragment
(),
RegisterUsernameView
{
class
RegisterUsernameFragment
:
Fragment
(),
RegisterUsernameView
{
@Inject
lateinit
var
presenter
:
RegisterUsernamePresenter
@Inject
lateinit
var
presenter
:
RegisterUsernamePresenter
private
lateinit
var
userId
:
String
private
lateinit
var
userId
:
String
private
lateinit
var
authToken
:
String
private
lateinit
var
authToken
:
String
...
@@ -41,7 +42,11 @@ class RegisterUsernameFragment : Fragment(), RegisterUsernameView {
...
@@ -41,7 +42,11 @@ class RegisterUsernameFragment : Fragment(), RegisterUsernameView {
authToken
=
arguments
?.
getString
(
AUTH_TOKEN
)
?:
""
authToken
=
arguments
?.
getString
(
AUTH_TOKEN
)
?:
""
}
}
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?):
View
?
=
container
?.
inflate
(
R
.
layout
.
fragment_authentication_register_username
)
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?
):
View
?
=
container
?.
inflate
(
R
.
layout
.
fragment_authentication_register_username
)
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
super
.
onViewCreated
(
view
,
savedInstanceState
)
super
.
onViewCreated
(
view
,
savedInstanceState
)
...
...
app/src/main/java/chat/rocket/android/authentication/resetpassword/di/ResetPasswordFragmentModule.kt
0 → 100644
View file @
9964385d
package
chat.rocket.android.authentication.resetpassword.di
import
android.arch.lifecycle.LifecycleOwner
import
chat.rocket.android.authentication.resetpassword.presentation.ResetPasswordView
import
chat.rocket.android.authentication.resetpassword.ui.ResetPasswordFragment
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.dagger.scope.PerFragment
import
dagger.Module
import
dagger.Provides
import
kotlinx.coroutines.experimental.Job
@Module
@PerFragment
class
ResetPasswordFragmentModule
{
@Provides
fun
resetPasswordView
(
frag
:
ResetPasswordFragment
):
ResetPasswordView
{
return
frag
}
@Provides
fun
provideLifecycleOwner
(
frag
:
ResetPasswordFragment
):
LifecycleOwner
{
return
frag
}
@Provides
fun
provideCancelStrategy
(
owner
:
LifecycleOwner
,
jobs
:
Job
):
CancelStrategy
{
return
CancelStrategy
(
owner
,
jobs
)
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/authentication/resetpassword/di/ResetPasswordFragmentProvider.kt
0 → 100644
View file @
9964385d
package
chat.rocket.android.authentication.resetpassword.di
import
chat.rocket.android.authentication.resetpassword.ui.ResetPasswordFragment
import
dagger.Module
import
dagger.android.ContributesAndroidInjector
@Module
abstract
class
ResetPasswordFragmentProvider
{
@ContributesAndroidInjector
(
modules
=
[
ResetPasswordFragmentModule
::
class
])
abstract
fun
provideResetPasswordFragment
():
ResetPasswordFragment
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/authentication/resetpassword/presentation/ResetPasswordPresenter.kt
0 → 100644
View file @
9964385d
package
chat.rocket.android.authentication.resetpassword.presentation
import
chat.rocket.android.authentication.presentation.AuthenticationNavigator
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.infraestructure.RocketChatClientFactory
import
chat.rocket.android.util.extensions.isEmail
import
chat.rocket.android.util.extensions.launchUI
import
chat.rocket.android.util.retryIO
import
chat.rocket.common.RocketChatException
import
chat.rocket.common.util.ifNull
import
chat.rocket.core.RocketChatClient
import
chat.rocket.core.internal.rest.forgotPassword
import
javax.inject.Inject
class
ResetPasswordPresenter
@Inject
constructor
(
private
val
view
:
ResetPasswordView
,
private
val
strategy
:
CancelStrategy
,
private
val
navigator
:
AuthenticationNavigator
,
factory
:
RocketChatClientFactory
,
serverInteractor
:
GetCurrentServerInteractor
)
{
private
val
currentServer
=
serverInteractor
.
get
()
!!
private
val
client
:
RocketChatClient
=
factory
.
create
(
currentServer
)
fun
resetPassword
(
email
:
String
)
{
when
{
email
.
isBlank
()
->
view
.
alertBlankEmail
()
!
email
.
isEmail
()
->
view
.
alertInvalidEmail
()
else
->
launchUI
(
strategy
)
{
view
.
showLoading
()
try
{
retryIO
(
"forgotPassword(email = $email)"
)
{
client
.
forgotPassword
(
email
)
}
navigator
.
toPreviousView
()
view
.
emailSent
()
}
catch
(
exception
:
RocketChatException
)
{
exception
.
message
?.
let
{
view
.
showMessage
(
it
)
}.
ifNull
{
view
.
showGenericErrorMessage
()
}
}
finally
{
view
.
hideLoading
()
}
}
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/authentication/resetpassword/presentation/ResetPasswordView.kt
0 → 100644
View file @
9964385d
package
chat.rocket.android.authentication.resetpassword.presentation
import
chat.rocket.android.core.behaviours.LoadingView
import
chat.rocket.android.core.behaviours.MessageView
interface
ResetPasswordView
:
LoadingView
,
MessageView
{
/**
* Alerts the user about a blank email.
*/
fun
alertBlankEmail
()
/**
* Alerts the user about a invalid email.
*/
fun
alertInvalidEmail
()
/**
* Shows a successful email sent message.
*/
fun
emailSent
()
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/authentication/resetpassword/ui/ResetPasswordFragment.kt
0 → 100644
View file @
9964385d
package
chat.rocket.android.authentication.resetpassword.ui
import
DrawableHelper
import
android.os.Build
import
android.os.Bundle
import
android.support.v4.app.Fragment
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
android.widget.Toast
import
chat.rocket.android.R
import
chat.rocket.android.authentication.resetpassword.presentation.ResetPasswordPresenter
import
chat.rocket.android.authentication.resetpassword.presentation.ResetPasswordView
import
chat.rocket.android.util.extensions.*
import
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_authentication_reset_password.*
import
javax.inject.Inject
class
ResetPasswordFragment
:
Fragment
(),
ResetPasswordView
{
@Inject
lateinit
var
presenter
:
ResetPasswordPresenter
companion
object
{
fun
newInstance
()
=
ResetPasswordFragment
()
}
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
AndroidSupportInjection
.
inject
(
this
)
}
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?
):
View
?
=
container
?.
inflate
(
R
.
layout
.
fragment_authentication_reset_password
)
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
super
.
onViewCreated
(
view
,
savedInstanceState
)
activity
?.
apply
{
text_email
.
requestFocus
()
showKeyboard
(
text_email
)
}
if
(
Build
.
VERSION
.
SDK_INT
<=
Build
.
VERSION_CODES
.
M
)
{
tintEditTextDrawableStart
()
}
setupOnClickListener
()
}
override
fun
alertBlankEmail
()
{
ui
{
vibrateShakeAndRequestFocusForTextEmail
()
}
}
override
fun
alertInvalidEmail
()
{
ui
{
vibrateShakeAndRequestFocusForTextEmail
()
showMessage
(
R
.
string
.
msg_invalid_email
)
}
}
override
fun
emailSent
()
{
showToast
(
R
.
string
.
msg_check_your_email_to_reset_your_password
,
Toast
.
LENGTH_LONG
)
}
override
fun
showLoading
()
{
ui
{
disableUserInput
()
view_loading
.
setVisible
(
true
)
}
}
override
fun
hideLoading
()
{
ui
{
view_loading
.
setVisible
(
false
)
enableUserInput
()
}
}
override
fun
showMessage
(
resId
:
Int
)
{
ui
{
showToast
(
resId
)
}
}
override
fun
showMessage
(
message
:
String
)
{
ui
{
showToast
(
message
)
}
}
override
fun
showGenericErrorMessage
()
{
showMessage
(
getString
(
R
.
string
.
msg_generic_error
))
}
private
fun
tintEditTextDrawableStart
()
{
ui
{
val
emailDrawable
=
DrawableHelper
.
getDrawableFromId
(
R
.
drawable
.
ic_email_black_24dp
,
it
)
DrawableHelper
.
wrapDrawable
(
emailDrawable
)
DrawableHelper
.
tintDrawable
(
emailDrawable
,
it
,
R
.
color
.
colorDrawableTintGrey
)
DrawableHelper
.
compoundDrawable
(
text_email
,
emailDrawable
)
}
}
private
fun
enableUserInput
()
{
button_reset_password
.
isEnabled
=
true
text_email
.
isEnabled
=
true
}
private
fun
disableUserInput
()
{
button_reset_password
.
isEnabled
=
false
text_email
.
isEnabled
=
true
}
private
fun
vibrateShakeAndRequestFocusForTextEmail
()
{
vibrateSmartPhone
()
text_email
.
shake
()
text_email
.
requestFocus
()
}
private
fun
setupOnClickListener
()
{
button_reset_password
.
setOnClickListener
{
presenter
.
resetPassword
(
text_email
.
textContent
)
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/dagger/module/ActivityBuilder.kt
View file @
9964385d
...
@@ -3,6 +3,7 @@ package chat.rocket.android.dagger.module
...
@@ -3,6 +3,7 @@ package chat.rocket.android.dagger.module
import
chat.rocket.android.authentication.di.AuthenticationModule
import
chat.rocket.android.authentication.di.AuthenticationModule
import
chat.rocket.android.authentication.login.di.LoginFragmentProvider
import
chat.rocket.android.authentication.login.di.LoginFragmentProvider
import
chat.rocket.android.authentication.registerusername.di.RegisterUsernameFragmentProvider
import
chat.rocket.android.authentication.registerusername.di.RegisterUsernameFragmentProvider
import
chat.rocket.android.authentication.resetpassword.di.ResetPasswordFragmentProvider
import
chat.rocket.android.authentication.server.di.ServerFragmentProvider
import
chat.rocket.android.authentication.server.di.ServerFragmentProvider
import
chat.rocket.android.authentication.signup.di.SignupFragmentProvider
import
chat.rocket.android.authentication.signup.di.SignupFragmentProvider
import
chat.rocket.android.authentication.twofactor.di.TwoFAFragmentProvider
import
chat.rocket.android.authentication.twofactor.di.TwoFAFragmentProvider
...
@@ -33,6 +34,7 @@ abstract class ActivityBuilder {
...
@@ -33,6 +34,7 @@ abstract class ActivityBuilder {
ServerFragmentProvider
::
class
,
ServerFragmentProvider
::
class
,
LoginFragmentProvider
::
class
,
LoginFragmentProvider
::
class
,
RegisterUsernameFragmentProvider
::
class
,
RegisterUsernameFragmentProvider
::
class
,
ResetPasswordFragmentProvider
::
class
,
SignupFragmentProvider
::
class
,
SignupFragmentProvider
::
class
,
TwoFAFragmentProvider
::
class
TwoFAFragmentProvider
::
class
])
])
...
...
app/src/main/java/chat/rocket/android/util/extensions/Ui.kt
View file @
9964385d
...
@@ -29,30 +29,42 @@ fun View.isVisible(): Boolean {
...
@@ -29,30 +29,42 @@ fun View.isVisible(): Boolean {
}
}
fun
ViewGroup
.
inflate
(
@LayoutRes
resource
:
Int
,
attachToRoot
:
Boolean
=
false
):
View
=
fun
ViewGroup
.
inflate
(
@LayoutRes
resource
:
Int
,
attachToRoot
:
Boolean
=
false
):
View
=
LayoutInflater
.
from
(
context
).
inflate
(
resource
,
this
,
attachToRoot
)
LayoutInflater
.
from
(
context
).
inflate
(
resource
,
this
,
attachToRoot
)
fun
AppCompatActivity
.
addFragment
(
tag
:
String
,
layoutId
:
Int
,
newInstance
:
()
->
Fragment
)
{
fun
AppCompatActivity
.
addFragment
(
tag
:
String
,
layoutId
:
Int
,
newInstance
:
()
->
Fragment
)
{
val
fragment
=
supportFragmentManager
.
findFragmentByTag
(
tag
)
?:
newInstance
()
val
fragment
=
supportFragmentManager
.
findFragmentByTag
(
tag
)
?:
newInstance
()
supportFragmentManager
.
beginTransaction
()
supportFragmentManager
.
beginTransaction
()
.
replace
(
layoutId
,
fragment
,
tag
)
.
replace
(
layoutId
,
fragment
,
tag
)
.
commit
()
.
commit
()
}
}
fun
AppCompatActivity
.
addFragmentBackStack
(
tag
:
String
,
layoutId
:
Int
,
fun
AppCompatActivity
.
addFragmentBackStack
(
newInstance
:
()
->
Fragment
)
{
tag
:
String
,
layoutId
:
Int
,
newInstance
:
()
->
Fragment
)
{
val
fragment
=
supportFragmentManager
.
findFragmentByTag
(
tag
)
?:
newInstance
()
val
fragment
=
supportFragmentManager
.
findFragmentByTag
(
tag
)
?:
newInstance
()
supportFragmentManager
.
beginTransaction
()
supportFragmentManager
.
beginTransaction
()
.
setCustomAnimations
(
R
.
anim
.
enter_from_right
,
R
.
anim
.
exit_to_left
,
.
setCustomAnimations
(
R
.
anim
.
enter_from_left
,
R
.
anim
.
exit_to_right
)
R
.
anim
.
enter_from_right
,
R
.
anim
.
exit_to_left
,
.
replace
(
layoutId
,
fragment
,
tag
)
R
.
anim
.
enter_from_left
,
R
.
anim
.
exit_to_right
.
addToBackStack
(
tag
)
)
.
commit
()
.
replace
(
layoutId
,
fragment
,
tag
)
.
addToBackStack
(
tag
)
.
commit
()
}
fun
AppCompatActivity
.
toPreviousView
()
{
supportFragmentManager
.
popBackStack
()
}
}
fun
Activity
.
hideKeyboard
()
{
fun
Activity
.
hideKeyboard
()
{
if
(
currentFocus
!=
null
)
{
if
(
currentFocus
!=
null
)
{
val
imm
=
getSystemService
(
Context
.
INPUT_METHOD_SERVICE
)
as
InputMethodManager
val
imm
=
getSystemService
(
Context
.
INPUT_METHOD_SERVICE
)
as
InputMethodManager
imm
.
hideSoftInputFromWindow
(
currentFocus
.
windowToken
,
InputMethodManager
.
RESULT_UNCHANGED_SHOWN
)
imm
.
hideSoftInputFromWindow
(
currentFocus
.
windowToken
,
InputMethodManager
.
RESULT_UNCHANGED_SHOWN
)
}
}
}
}
...
@@ -62,16 +74,16 @@ fun Activity.showKeyboard(view: View) {
...
@@ -62,16 +74,16 @@ fun Activity.showKeyboard(view: View) {
}
}
fun
Activity
.
showToast
(
@StringRes
resource
:
Int
,
duration
:
Int
=
Toast
.
LENGTH_SHORT
)
=
fun
Activity
.
showToast
(
@StringRes
resource
:
Int
,
duration
:
Int
=
Toast
.
LENGTH_SHORT
)
=
showToast
(
getString
(
resource
),
duration
)
showToast
(
getString
(
resource
),
duration
)
fun
Activity
.
showToast
(
message
:
String
,
duration
:
Int
=
Toast
.
LENGTH_SHORT
)
=
fun
Activity
.
showToast
(
message
:
String
,
duration
:
Int
=
Toast
.
LENGTH_SHORT
)
=
Toast
.
makeText
(
this
,
message
,
duration
).
show
()
Toast
.
makeText
(
this
,
message
,
duration
).
show
()
fun
Fragment
.
showToast
(
@StringRes
resource
:
Int
,
duration
:
Int
=
Toast
.
LENGTH_SHORT
)
=
fun
Fragment
.
showToast
(
@StringRes
resource
:
Int
,
duration
:
Int
=
Toast
.
LENGTH_SHORT
)
=
showToast
(
getString
(
resource
),
duration
)
showToast
(
getString
(
resource
),
duration
)
fun
Fragment
.
showToast
(
message
:
String
,
duration
:
Int
=
Toast
.
LENGTH_SHORT
)
=
fun
Fragment
.
showToast
(
message
:
String
,
duration
:
Int
=
Toast
.
LENGTH_SHORT
)
=
activity
?.
showToast
(
message
,
duration
)
activity
?.
showToast
(
message
,
duration
)
fun
RecyclerView
.
isAtBottom
():
Boolean
{
fun
RecyclerView
.
isAtBottom
():
Boolean
{
val
manager
:
RecyclerView
.
LayoutManager
?
=
layoutManager
val
manager
:
RecyclerView
.
LayoutManager
?
=
layoutManager
...
...
app/src/main/res/layout/fragment_authentication_log_in.xml
View file @
9964385d
...
@@ -72,6 +72,21 @@
...
@@ -72,6 +72,21 @@
app:layout_constraintTop_toBottomOf=
"@+id/button_cas"
app:layout_constraintTop_toBottomOf=
"@+id/button_cas"
tools:visibility=
"visible"
/>
tools:visibility=
"visible"
/>
<TextView
android:id=
"@+id/text_forgot_your_password"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"@dimen/screen_edge_left_and_right_margins"
android:layout_marginStart=
"@dimen/screen_edge_left_and_right_margins"
android:layout_marginTop=
"8dp"
android:gravity=
"center"
android:textColorLink=
"@color/colorAccent"
android:visibility=
"gone"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/text_new_to_rocket_chat"
tools:visibility=
"visible"
/>
<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"
...
@@ -99,7 +114,7 @@
...
@@ -99,7 +114,7 @@
android:visibility=
"gone"
android:visibility=
"gone"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/text_
new_to_rocket_chat
"
app:layout_constraintTop_toBottomOf=
"@+id/text_
forgot_your_password
"
tools:visibility=
"visible"
>
tools:visibility=
"visible"
>
<TextView
<TextView
...
...
app/src/main/res/layout/fragment_authentication_reset_password.xml
0 → 100644
View file @
9964385d
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
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=
"match_parent"
tools:context=
".authentication.resetpassword.ui.ResetPasswordFragment"
>
<TextView
android:id=
"@+id/text_headline"
style=
"@style/Authentication.Headline.TextView"
android:layout_centerHorizontal=
"true"
android:text=
"@string/title_reset_password"
/>
<EditText
android:id=
"@+id/text_email"
style=
"@style/Authentication.EditText"
android:layout_below=
"@id/text_headline"
android:layout_marginTop=
"32dp"
android:drawableStart=
"@drawable/ic_email_black_24dp"
android:hint=
"@string/msg_email"
android:imeOptions=
"actionDone"
android:inputType=
"textEmailAddress"
/>
<com.wang.avi.AVLoadingIndicatorView
android:id=
"@+id/view_loading"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:visibility=
"gone"
app:indicatorName=
"BallPulseIndicator"
tools:visibility=
"visible"
/>
<Button
android:id=
"@+id/button_reset_password"
style=
"@style/Authentication.Button"
android:layout_alignParentBottom=
"true"
android:text=
"@string/title_reset_password"
/>
</RelativeLayout>
\ No newline at end of file
app/src/main/res/values-es/strings.xml
View file @
9964385d
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
<string
name=
"title_sign_in_your_server"
>
Inicia sesión en tu servidor
</string>
<string
name=
"title_sign_in_your_server"
>
Inicia sesión en tu servidor
</string>
<string
name=
"title_log_in"
>
Iniciar sesión
</string>
<string
name=
"title_log_in"
>
Iniciar sesión
</string>
<string
name=
"title_register_username"
>
Registrar nombre de usuario
</string>
<string
name=
"title_register_username"
>
Registrar nombre de usuario
</string>
// TODO: Add proper translation.
<string
name=
"title_reset_password"
>
Reset Password
</string>
<string
name=
"title_sign_up"
>
Regístrate
</string>
<string
name=
"title_sign_up"
>
Regístrate
</string>
<string
name=
"title_authentication"
>
Autenticación
</string>
<string
name=
"title_authentication"
>
Autenticación
</string>
<string
name=
"title_legal_terms"
>
Términos legales
</string>
<string
name=
"title_legal_terms"
>
Términos legales
</string>
...
@@ -51,6 +53,14 @@
...
@@ -51,6 +53,14 @@
<string
name=
"msg_avatar_url"
>
URL del avatar
</string>
<string
name=
"msg_avatar_url"
>
URL del avatar
</string>
<string
name=
"msg_or_continue_using_social_accounts"
>
O continuar usando cuentas sociales
</string>
<string
name=
"msg_or_continue_using_social_accounts"
>
O continuar usando cuentas sociales
</string>
<string
name=
"msg_new_user"
>
Nuevo usuario? %1$s
</string>
<string
name=
"msg_new_user"
>
Nuevo usuario? %1$s
</string>
// TODO: Add proper translation.
<string
name=
"msg_forgot_password"
>
Forgot password? %1$s
</string>
// TODO: Add proper translation.
<string
name=
"msg_reset"
>
Reset
</string>
// TODO: Add proper translation.
<string
name=
"msg_check_your_email_to_reset_your_password"
>
Email sent! Check your inbox to reset your password.
</string>
// TODO: Add proper translation.
<string
name=
"msg_invalid_email"
>
Please type a valid e-mail
</string>
<string
name=
"msg_new_user_agreement"
>
Al continuar estás aceptando nuestra\n%1$s y %2$s
</string>
<string
name=
"msg_new_user_agreement"
>
Al continuar estás aceptando nuestra\n%1$s y %2$s
</string>
<string
name=
"msg_2fa_code"
>
Código 2FA
</string>
<string
name=
"msg_2fa_code"
>
Código 2FA
</string>
<string
name=
"msg_yesterday"
>
Ayer
</string>
<string
name=
"msg_yesterday"
>
Ayer
</string>
...
...
app/src/main/res/values-fr/strings.xml
View file @
9964385d
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
<string
name=
"title_sign_in_your_server"
>
Connectez-vous sur votre serveur
</string>
<string
name=
"title_sign_in_your_server"
>
Connectez-vous sur votre serveur
</string>
<string
name=
"title_log_in"
>
S\'identifier
</string>
<string
name=
"title_log_in"
>
S\'identifier
</string>
<string
name=
"title_register_username"
>
Enregistrer le nom d\'utilisateur
</string>
<string
name=
"title_register_username"
>
Enregistrer le nom d\'utilisateur
</string>
// TODO: Add proper translation.
<string
name=
"title_reset_password"
>
Reset password
</string>
<string
name=
"title_sign_up"
>
S\'inscrire
</string>
<string
name=
"title_sign_up"
>
S\'inscrire
</string>
<string
name=
"title_authentication"
>
Authentification
</string>
<string
name=
"title_authentication"
>
Authentification
</string>
<string
name=
"title_legal_terms"
>
Termes légaux
</string>
<string
name=
"title_legal_terms"
>
Termes légaux
</string>
...
@@ -51,6 +53,14 @@
...
@@ -51,6 +53,14 @@
<string
name=
"msg_avatar_url"
>
URL de l\'avatar
</string>
<string
name=
"msg_avatar_url"
>
URL de l\'avatar
</string>
<string
name=
"msg_or_continue_using_social_accounts"
>
Ou continuer en utilisant les comptes sociaux
</string>
<string
name=
"msg_or_continue_using_social_accounts"
>
Ou continuer en utilisant les comptes sociaux
</string>
<string
name=
"msg_new_user"
>
Nouvel utilisateur? %1$s
</string>
<string
name=
"msg_new_user"
>
Nouvel utilisateur? %1$s
</string>
// TODO: Add proper translation.
<string
name=
"msg_forgot_password"
>
Forgot password? %1$s
</string>
// TODO: Add proper translation.
<string
name=
"msg_reset"
>
Reset
</string>
// TODO: Add proper translation.
<string
name=
"msg_check_your_email_to_reset_your_password"
>
Email sent! Check your inbox to reset your password.
</string>
// TODO: Add proper translation.
<string
name=
"msg_invalid_email"
>
Please type a valid e-mail
</string>
<string
name=
"msg_new_user_agreement"
>
En procédant, vous acceptez notre\n%1$s et %2$s
</string>
<string
name=
"msg_new_user_agreement"
>
En procédant, vous acceptez notre\n%1$s et %2$s
</string>
<string
name=
"msg_2fa_code"
>
Code 2FA
</string>
<string
name=
"msg_2fa_code"
>
Code 2FA
</string>
<string
name=
"msg_yesterday"
>
Hier
</string>
<string
name=
"msg_yesterday"
>
Hier
</string>
...
...
app/src/main/res/values-hi-rIN/strings.xml
View file @
9964385d
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
<string
name=
"title_sign_in_your_server"
>
अपने सर्वर में साइन इन करें
</string>
<string
name=
"title_sign_in_your_server"
>
अपने सर्वर में साइन इन करें
</string>
<string
name=
"title_log_in"
>
लॉग इन करें
</string>
<string
name=
"title_log_in"
>
लॉग इन करें
</string>
<string
name=
"title_register_username"
>
रजिस्टर उपयोगकर्ता नाम
</string>
<string
name=
"title_register_username"
>
रजिस्टर उपयोगकर्ता नाम
</string>
// TODO: Add proper translation.
<string
name=
"title_reset_password"
>
Reset password
</string>
<string
name=
"title_sign_up"
>
साइन अप करें
</string>
<string
name=
"title_sign_up"
>
साइन अप करें
</string>
<string
name=
"title_authentication"
>
प्रमाणीकरण
</string>
<string
name=
"title_authentication"
>
प्रमाणीकरण
</string>
<string
name=
"title_legal_terms"
>
कानूनी शर्तें
</string>
<string
name=
"title_legal_terms"
>
कानूनी शर्तें
</string>
...
@@ -52,6 +54,14 @@
...
@@ -52,6 +54,14 @@
<string
name=
"msg_avatar_url"
>
अवतार यूआरएल
</string>
<string
name=
"msg_avatar_url"
>
अवतार यूआरएल
</string>
<string
name=
"msg_or_continue_using_social_accounts"
>
या सामाजिक खाते का उपयोग करना जारी रखें
</string>
<string
name=
"msg_or_continue_using_social_accounts"
>
या सामाजिक खाते का उपयोग करना जारी रखें
</string>
<string
name=
"msg_new_user"
>
नया उपयोगकर्ता? %1$s
</string>
<string
name=
"msg_new_user"
>
नया उपयोगकर्ता? %1$s
</string>
// TODO: Add proper translation.
<string
name=
"msg_forgot_password"
>
Forgot password? %1$s
</string>
// TODO: Add proper translation.
<string
name=
"msg_reset"
>
Reset
</string>
// TODO: Add proper translation.
<string
name=
"msg_check_your_email_to_reset_your_password"
>
Email sent! Check your inbox to reset your password.
</string>
// TODO: Add proper translation.
<string
name=
"msg_invalid_email"
>
Please type a valid e-mail
</string>
<string
name=
"msg_new_user_agreement"
>
आगे बढ़कर आप हमारे %1$s और %2$s से सहमत हो रहे हैं
</string>
<string
name=
"msg_new_user_agreement"
>
आगे बढ़कर आप हमारे %1$s और %2$s से सहमत हो रहे हैं
</string>
<string
name=
"msg_2fa_code"
>
कोड 2FA
</string>
<string
name=
"msg_2fa_code"
>
कोड 2FA
</string>
<string
name=
"msg_yesterday"
>
कल
</string>
<string
name=
"msg_yesterday"
>
कल
</string>
...
...
app/src/main/res/values-pt-rBR/strings.xml
View file @
9964385d
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
<string
name=
"title_sign_in_your_server"
>
Faça login no seu servidor
</string>
<string
name=
"title_sign_in_your_server"
>
Faça login no seu servidor
</string>
<string
name=
"title_log_in"
>
Entrar
</string>
<string
name=
"title_log_in"
>
Entrar
</string>
<string
name=
"title_register_username"
>
Registre o nome de usuário
</string>
<string
name=
"title_register_username"
>
Registre o nome de usuário
</string>
<string
name=
"title_reset_password"
>
Redefinir senha
</string>
<string
name=
"title_sign_up"
>
Inscreva-se
</string>
<string
name=
"title_sign_up"
>
Inscreva-se
</string>
<string
name=
"title_authentication"
>
Autenticação
</string>
<string
name=
"title_authentication"
>
Autenticação
</string>
<string
name=
"title_legal_terms"
>
Termos Legais
</string>
<string
name=
"title_legal_terms"
>
Termos Legais
</string>
...
@@ -52,6 +53,10 @@
...
@@ -52,6 +53,10 @@
<string
name=
"msg_avatar_url"
>
URL do avatar
</string>
<string
name=
"msg_avatar_url"
>
URL do avatar
</string>
<string
name=
"msg_or_continue_using_social_accounts"
>
Ou continue através de contas sociais
</string>
<string
name=
"msg_or_continue_using_social_accounts"
>
Ou continue através de contas sociais
</string>
<string
name=
"msg_new_user"
>
Novo usuário? %1$s
</string>
<string
name=
"msg_new_user"
>
Novo usuário? %1$s
</string>
<string
name=
"msg_forgot_password"
>
Esqueceu a senha? %1$s
</string>
<string
name=
"msg_reset"
>
Redefinir
</string>
<string
name=
"msg_check_your_email_to_reset_your_password"
>
Email enviado! Verifique sua caixa de entrada para redefinir sua senha.
</string>
<string
name=
"msg_invalid_email"
>
Por favor informe um e-mail válido
</string>
<string
name=
"msg_new_user_agreement"
>
Ao proceder você concorda com nossos %1$s e %2$s
</string>
<string
name=
"msg_new_user_agreement"
>
Ao proceder você concorda com nossos %1$s e %2$s
</string>
<string
name=
"msg_2fa_code"
>
Código 2FA
</string>
<string
name=
"msg_2fa_code"
>
Código 2FA
</string>
<string
name=
"msg_yesterday"
>
ontem
</string>
<string
name=
"msg_yesterday"
>
ontem
</string>
...
...
app/src/main/res/values/strings.xml
View file @
9964385d
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
<string
name=
"title_sign_in_your_server"
>
Sign in your server
</string>
<string
name=
"title_sign_in_your_server"
>
Sign in your server
</string>
<string
name=
"title_log_in"
>
Log in
</string>
<string
name=
"title_log_in"
>
Log in
</string>
<string
name=
"title_register_username"
>
Register username
</string>
<string
name=
"title_register_username"
>
Register username
</string>
<string
name=
"title_reset_password"
>
Reset password
</string>
<string
name=
"title_sign_up"
>
Sign up
</string>
<string
name=
"title_sign_up"
>
Sign up
</string>
<string
name=
"title_authentication"
>
Authentication
</string>
<string
name=
"title_authentication"
>
Authentication
</string>
<string
name=
"title_legal_terms"
>
Legal Terms
</string>
<string
name=
"title_legal_terms"
>
Legal Terms
</string>
...
@@ -53,6 +54,10 @@
...
@@ -53,6 +54,10 @@
<string
name=
"msg_avatar_url"
>
avatar URL
</string>
<string
name=
"msg_avatar_url"
>
avatar URL
</string>
<string
name=
"msg_or_continue_using_social_accounts"
>
Or continue using social accounts
</string>
<string
name=
"msg_or_continue_using_social_accounts"
>
Or continue using social accounts
</string>
<string
name=
"msg_new_user"
>
New user? %1$s
</string>
<string
name=
"msg_new_user"
>
New user? %1$s
</string>
<string
name=
"msg_forgot_password"
>
Forgot password? %1$s
</string>
<string
name=
"msg_reset"
>
Reset
</string>
<string
name=
"msg_check_your_email_to_reset_your_password"
>
Email sent! Check your inbox to reset your password.
</string>
<string
name=
"msg_invalid_email"
>
Please type a valid e-mail
</string>
<string
name=
"msg_new_user_agreement"
>
By proceeding you are agreeing to our\n%1$s and %2$s
</string>
<string
name=
"msg_new_user_agreement"
>
By proceeding you are agreeing to our\n%1$s and %2$s
</string>
<string
name=
"msg_2fa_code"
>
2FA Code
</string>
<string
name=
"msg_2fa_code"
>
2FA Code
</string>
<string
name=
"msg_more_than_ninety_nine_unread_messages"
translatable=
"false"
>
99+
</string>
<string
name=
"msg_more_than_ninety_nine_unread_messages"
translatable=
"false"
>
99+
</string>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment