Commit 0230c4c4 authored by divyanshu's avatar divyanshu

new screens

parent a6ba2e01
......@@ -100,7 +100,6 @@ class LoginPresenter @Inject constructor(
fun setupView() {
setupConnectionInfo(currentServer)
setupLoginView()
setupUserRegistrationView()
setupForgotPasswordView()
setupCasView()
setupOauthServicesView()
......@@ -161,7 +160,6 @@ class LoginPresenter @Inject constructor(
if (settings.isLoginFormEnabled()) {
view.showFormView()
view.setupLoginButtonListener()
view.setupGlobalListener()
} else {
view.hideFormView()
}
......@@ -178,13 +176,6 @@ class LoginPresenter @Inject constructor(
}
}
private fun setupUserRegistrationView() {
if (settings.isRegistrationEnabledForNewUsers() && settings.isLoginFormEnabled()) {
view.setupSignUpView()
view.showSignUpView()
}
}
private fun setupForgotPasswordView() {
if (settings.isPasswordResetEnabled()) {
view.setupForgotPasswordView()
......@@ -203,94 +194,6 @@ class LoginPresenter @Inject constructor(
"{\"loginStyle\":\"popup\",\"credentialToken\":\"${generateRandomString(40)}\",\"isCordova\":true}".encodeToBase64()
var totalSocialAccountsEnabled = 0
if (settings.isFacebookAuthenticationEnabled()) {
val clientId = getOauthClientId(services, SERVICE_NAME_FACEBOOK)
if (clientId != null) {
view.setupFacebookButtonListener(
OauthHelper.getFacebookOauthUrl(
clientId,
currentServer,
state
), state
)
view.enableLoginByFacebook()
totalSocialAccountsEnabled++
}
}
if (settings.isGithubAuthenticationEnabled()) {
val clientId = getOauthClientId(services, SERVICE_NAME_GITHUB)
if (clientId != null) {
view.setupGithubButtonListener(
OauthHelper.getGithubOauthUrl(
clientId,
state
), state
)
view.enableLoginByGithub()
totalSocialAccountsEnabled++
}
}
if (settings.isGoogleAuthenticationEnabled()) {
val clientId = getOauthClientId(services, SERVICE_NAME_GOOGLE)
if (clientId != null) {
view.setupGoogleButtonListener(
OauthHelper.getGoogleOauthUrl(
clientId,
currentServer,
state
), state
)
view.enableLoginByGoogle()
totalSocialAccountsEnabled++
}
}
if (settings.isLinkedinAuthenticationEnabled()) {
val clientId = getOauthClientId(services, SERVICE_NAME_LINKEDIN)
if (clientId != null) {
view.setupLinkedinButtonListener(
OauthHelper.getLinkedinOauthUrl(
clientId,
currentServer,
state
), state
)
view.enableLoginByLinkedin()
totalSocialAccountsEnabled++
}
}
if (settings.isMeteorAuthenticationEnabled()) {
//TODO: Remove until we have this implemented
// view.enableLoginByMeteor()
// totalSocialAccountsEnabled++
}
if (settings.isTwitterAuthenticationEnabled()) {
//TODO: Remove until Twitter provides support to OAuth2
// view.enableLoginByTwitter()
// totalSocialAccountsEnabled++
}
if (settings.isGitlabAuthenticationEnabled()) {
val clientId = getOauthClientId(services, SERVICE_NAME_GILAB)
if (clientId != null) {
val gitlabOauthUrl = if (settings.gitlabUrl() != null) {
OauthHelper.getGitlabOauthUrl(
host = settings.gitlabUrl(),
clientId = clientId,
serverUrl = currentServer,
state = state
)
} else {
OauthHelper.getGitlabOauthUrl(
clientId = clientId,
serverUrl = currentServer,
state = state
)
}
view.setupGitlabButtonListener(gitlabOauthUrl, state)
view.enableLoginByGitlab()
totalSocialAccountsEnabled++
}
}
getCustomOauthServices(services).let {
for (service in it) {
val serviceName = getCustomOauthServiceName(service)
......@@ -330,21 +233,9 @@ class LoginPresenter @Inject constructor(
totalSocialAccountsEnabled++
}
}
if (totalSocialAccountsEnabled > 0) {
view.enableOauthView()
if (totalSocialAccountsEnabled > 3) {
view.setupFabListener()
}
} else {
view.disableOauthView()
}
} else {
view.disableOauthView()
}
} catch (exception: RocketChatException) {
Timber.e(exception)
view.disableOauthView()
}
}
}
......
......@@ -54,18 +54,6 @@ interface LoginView : LoadingView, MessageView {
*/
fun setupCasButtonListener(casUrl: String, casToken: String)
/**
* Shows the sign up view if the new users registration is enabled by the server settings.
*
* REMARK: We must set up the sign up view listener [setupSignUpView].
*/
fun showSignUpView()
/**
* Setups the sign up view when tapped.
*/
fun setupSignUpView()
/**
* Shows the forgot password view if enabled by the server settings.
*
......@@ -78,118 +66,6 @@ interface LoginView : LoadingView, MessageView {
*/
fun setupForgotPasswordView()
/**
* Hides the sign up view.
*/
fun hideSignUpView()
/**
* Enables and shows the oauth view if there is login via social accounts enabled by the server settings.
*
* REMARK: We must show at maximum *three* social accounts views ([enableLoginByFacebook], [enableLoginByGithub], [enableLoginByGoogle],
* [enableLoginByLinkedin], [enableLoginByMeteor], [enableLoginByTwitter], [enableLoginByGitlab], [addCustomOauthServiceButton] or [addSamlServiceButton]) for the oauth view.
* If the possibility of login via social accounts exceeds 3 different ways we should set up the FAB ([setupFabListener]) to show the remaining view(s).
*/
fun enableOauthView()
/**
* Disables and hides the Oauth view if there is not login via social accounts enabled by the server settings.
*/
fun disableOauthView()
/**
* Shows the login button.
*/
fun showLoginButton()
/**
* Hides the login button.
*/
fun hideLoginButton()
/**
* Shows the "login by Facebook view if it is enable by the server settings.
*/
fun enableLoginByFacebook()
/**
* Shows the "login by Github" view if it is enable by the server settings.
*
* REMARK: We must set up the Github button listener before enabling it [setupGithubButtonListener].
*/
fun enableLoginByGithub()
/**
* Setups the Github button when tapped.
*
* @param githubUrl The Github OAuth URL to authenticate with.
* @param state A random string generated by the app, which you'll verify later (to protect against forgery attacks).
*/
fun setupGithubButtonListener(githubUrl: String, state: String)
/**
* Shows the "login by Google" view if it is enable by the server settings.
*
* REMARK: We must set up the Google button listener before enabling it [setupGoogleButtonListener].
*/
fun enableLoginByGoogle()
/**
* Setups the Google button when tapped.
*
* @param googleUrl The Google OAuth URL to authenticate with.
* @param state A random string generated by the app, which you'll verify later (to protect against forgery attacks).
*/
fun setupGoogleButtonListener(googleUrl: String, state: String)
/**
* Shows the "login by Linkedin" view if it is enable by the server settings.
*
* REMARK: We must set up the Linkedin button listener before enabling it [setupLinkedinButtonListener].
*/
fun enableLoginByLinkedin()
/**
* Setups the Linkedin button when tapped.
*
* @param linkedinUrl The Linkedin OAuth URL to authenticate with.
* @param state A random string generated by the app, which you'll verify later (to protect against forgery attacks).
*/
fun setupLinkedinButtonListener(linkedinUrl: String, state: String)
/**
* Setups the Facebook button when tapped.
*
* @param facebookOauthUrl The Facebook OAuth URL to authenticate with.
* @param state A random string generated by the app, which you'll verify later (to protect against forgery attacks).
*/
fun setupFacebookButtonListener(facebookOauthUrl: String, state: String)
/**
* Shows the "login by Meteor" view if it is enable by the server settings.
*/
fun enableLoginByMeteor()
/**
* Shows the "login by Twitter" view if it is enable by the server settings.
*/
fun enableLoginByTwitter()
/**
* Shows the "login by Gitlab" view if it is enable by the server settings.
*
* REMARK: We must set up the Gitlab button listener before enabling it [setupGitlabButtonListener].
*/
fun enableLoginByGitlab()
/**
* Setups the Gitlab button when tapped.
*
* @param gitlabUrl The Gitlab OAuth URL to authenticate with.
* @param state A random string generated by the app, which you'll verify later (to protect against forgery attacks).
*/
fun setupGitlabButtonListener(gitlabUrl: String, state: String)
/**
* Adds a custom OAuth button in the oauth view.
*
......@@ -225,13 +101,6 @@ interface LoginView : LoadingView, MessageView {
buttonColor: Int
)
/**
* Setups the FloatingActionButton to show more social accounts views (expanding the oauth view interface to show the remaining view(s)).
*/
fun setupFabListener()
fun setupGlobalListener()
/**
* Alerts the user about a wrong inputted username or email.
*/
......
package chat.rocket.android.authentication.loginoptions.di
import androidx.lifecycle.LifecycleOwner
import chat.rocket.android.authentication.login.ui.LoginFragment
import chat.rocket.android.authentication.loginoptions.presentation.LoginOptionsView
import chat.rocket.android.authentication.loginoptions.ui.LoginOptionsFragment
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
class LoginOptionsFragmentModule {
@Provides
@PerFragment
fun provideJob() = Job()
@Provides
@PerFragment
fun loginOptionsView(frag: LoginOptionsFragment): LoginOptionsView{
return frag
}
@Provides
@PerFragment
fun provideLifecycleOwner(frag: LoginOptionsFragment): LifecycleOwner {
return frag
}
@Provides
@PerFragment
fun provideCancelStrategy(owner: LifecycleOwner, jobs: Job): CancelStrategy {
return CancelStrategy(owner, jobs)
}
}
\ No newline at end of file
package chat.rocket.android.authentication.loginoptions.di
import chat.rocket.android.authentication.loginoptions.ui.LoginOptionsFragment
import chat.rocket.android.dagger.scope.PerFragment
import dagger.Module
import dagger.android.ContributesAndroidInjector
@Module abstract class LoginOptionsFragmentProvider {
@ContributesAndroidInjector(modules = [LoginOptionsFragmentModule::class])
@PerFragment
abstract fun providesLoginOptionFragment(): LoginOptionsFragment
}
\ No newline at end of file
package chat.rocket.android.authentication.loginoptions.presentation
import chat.rocket.android.core.behaviours.LoadingView
import chat.rocket.android.core.behaviours.MessageView
interface LoginOptionsView : LoadingView, MessageView {
/**
* Shows the "login by Facebook view if it is enable by the server settings.
*/
fun enableLoginByFacebook()
/**
* Shows the "login by Github" view if it is enable by the server settings.
*
* REMARK: We must set up the Github button listener before enabling it [setupGithubButtonListener].
*/
fun enableLoginByGithub()
/**
* Setups the Github button when tapped.
*
* @param githubUrl The Github OAuth URL to authenticate with.
* @param state A random string generated by the app, which you'll verify later (to protect against forgery attacks).
*/
fun setupGithubButtonListener(githubUrl: String, state: String)
/**
* Shows the "login by Google" view if it is enable by the server settings.
*
* REMARK: We must set up the Google button listener before enabling it [setupGoogleButtonListener].
*/
fun enableLoginByGoogle()
/**
* Setups the Google button when tapped.
*
* @param googleUrl The Google OAuth URL to authenticate with.
* @param state A random string generated by the app, which you'll verify later (to protect against forgery attacks).
*/
fun setupGoogleButtonListener(googleUrl: String, state: String)
/**
* Shows the "login by Linkedin" view if it is enable by the server settings.
*
* REMARK: We must set up the Linkedin button listener before enabling it [setupLinkedinButtonListener].
*/
fun enableLoginByLinkedin()
/**
* Setups the Linkedin button when tapped.
*
* @param linkedinUrl The Linkedin OAuth URL to authenticate with.
* @param state A random string generated by the app, which you'll verify later (to protect against forgery attacks).
*/
fun setupLinkedinButtonListener(linkedinUrl: String, state: String)
/**
* Setups the Facebook button when tapped.
*
* @param facebookOauthUrl The Facebook OAuth URL to authenticate with.
* @param state A random string generated by the app, which you'll verify later (to protect against forgery attacks).
*/
fun setupFacebookButtonListener(facebookOauthUrl: String, state: String)
/**
* Shows the "login by Gitlab" view if it is enable by the server settings.
*
* REMARK: We must set up the Gitlab button listener before enabling it [setupGitlabButtonListener].
*/
fun enableLoginByGitlab()
/**
* Setups the Gitlab button when tapped.
*
* @param gitlabUrl The Gitlab OAuth URL to authenticate with.
* @param state A random string generated by the app, which you'll verify later (to protect against forgery attacks).
*/
fun setupGitlabButtonListener(gitlabUrl: String, state: String)
}
package chat.rocket.android.authentication.loginoptions.ui
import android.app.Activity
import android.content.Intent
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.view.isVisible
import chat.rocket.android.R
import chat.rocket.android.authentication.login.ui.REQUEST_CODE_FOR_OAUTH
import chat.rocket.android.authentication.loginoptions.presentation.LoginOptionsPresenter
import chat.rocket.android.authentication.loginoptions.presentation.LoginOptionsView
import chat.rocket.android.authentication.ui.AuthenticationActivity
import chat.rocket.android.util.extensions.showToast
import chat.rocket.android.util.extensions.ui
import chat.rocket.android.webview.oauth.ui.INTENT_OAUTH_CREDENTIAL_SECRET
import chat.rocket.android.webview.oauth.ui.INTENT_OAUTH_CREDENTIAL_TOKEN
import chat.rocket.android.webview.oauth.ui.oauthWebViewIntent
import dagger.android.support.AndroidSupportInjection
import kotlinx.android.synthetic.main.app_bar_chat_room.*
import kotlinx.android.synthetic.main.fragment_authentication_login_options.*
import javax.inject.Inject
class LoginOptionsFragment : Fragment() {
class LoginOptionsFragment : Fragment(), LoginOptionsView {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_login_options, container, false)
}
@Inject
lateinit var presenter: LoginOptionsPresenter
companion object {
fun newInstance() = LoginOptionsFragment()
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
AndroidSupportInjection.inject(this)
}
override fun onCreateView(inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? = inflater.inflate(R.layout.fragment_authentication_login_options, container, false)
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
presenter.setupView()
setupToolbar()
setupClickListener()
}
private fun setupClickListener() {
button_create_account.setOnClickListener {
presenter.toCreateAccount()
}
button_login.setOnClickListener {
presenter.toLogin()
}
}
private fun setupToolbar() {
val toolbar = (activity as AuthenticationActivity).toolbar
val textServerName = (activity as AuthenticationActivity).text_room_name
textServerName.text = "open.rocket.chat"
toolbar.isVisible = true
toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp)
toolbar.setNavigationOnClickListener {
(activity as AuthenticationActivity).onBackPressed()
}
}
override fun enableLoginByFacebook() {
ui{
button_facebook.isClickable = true
}
}
override fun setupFacebookButtonListener(facebookOauthUrl: String, state: String) {
ui { activity ->
button_facebook.setOnClickListener {
startActivityForResult(
activity.oauthWebViewIntent(facebookOauthUrl, state),
REQUEST_CODE_FOR_OAUTH
)
activity.overridePendingTransition(R.anim.slide_up, R.anim.hold)
}
}
}
override fun enableLoginByGithub() {
ui {
button_github.isClickable = true
}
}
override fun setupGithubButtonListener(githubUrl: String, state: String) {
ui { activity ->
button_github.setOnClickListener {
startActivityForResult(
activity.oauthWebViewIntent(githubUrl, state),
REQUEST_CODE_FOR_OAUTH
)
activity.overridePendingTransition(R.anim.slide_up, R.anim.hold)
}
}
}
override fun enableLoginByGoogle() {
ui {
button_google.isClickable = true
}
}
override fun setupGoogleButtonListener(googleUrl: String, state: String) {
ui { activity ->
button_google.setOnClickListener {
startActivityForResult(
activity.oauthWebViewIntent(googleUrl, state),
REQUEST_CODE_FOR_OAUTH
)
activity.overridePendingTransition(R.anim.slide_up, R.anim.hold)
}
}
}
override fun enableLoginByLinkedin() {
ui {
button_linkedin.isClickable = true
}
}
override fun setupLinkedinButtonListener(linkedinUrl: String, state: String) {
ui { activity ->
button_linkedin.setOnClickListener {
startActivityForResult(
activity.oauthWebViewIntent(linkedinUrl, state),
REQUEST_CODE_FOR_OAUTH
)
activity.overridePendingTransition(R.anim.slide_up, R.anim.hold)
}
}
}
override fun enableLoginByGitlab() {
ui {
button_gitlab.isClickable = true
}
}
override fun setupGitlabButtonListener(gitlabUrl: String, state: String) {
ui { activity ->
button_gitlab.setOnClickListener {
startActivityForResult(
activity.oauthWebViewIntent(gitlabUrl, state),
REQUEST_CODE_FOR_OAUTH
)
activity.overridePendingTransition(R.anim.slide_up, R.anim.hold)
}
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if (resultCode == Activity.RESULT_OK && data != null){
when(requestCode){
REQUEST_CODE_FOR_OAUTH -> {
presenter.authenticateWithOauth(
data.getStringExtra(INTENT_OAUTH_CREDENTIAL_TOKEN),
data.getStringExtra(INTENT_OAUTH_CREDENTIAL_SECRET)
)
}
}
}
}
override fun showLoading() {
ui {
view_loading.isVisible = true
}
}
override fun hideLoading() {
ui {
view_loading.isVisible = false
}
}
override fun showMessage(resId: Int) {
ui {
showToast(resId)
}
}
override fun showMessage(message: String) {
ui {
showToast(message)
}
}
override fun showGenericErrorMessage() {
showMessage(R.string.msg_generic_error)
}
}
package chat.rocket.android.authentication.onboarding.di
import androidx.lifecycle.LifecycleOwner
import chat.rocket.android.authentication.onboarding.presentation.OnBoardingView
import chat.rocket.android.authentication.onboarding.ui.OnBoardingFragment
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
class OnBoardingFragmentModule {
@Provides
@PerFragment
fun provideJob() = Job()
@Provides
@PerFragment
fun onBoardingView(frag: OnBoardingFragment): OnBoardingView{
return frag
}
@Provides
@PerFragment
fun provideLifecycleOwner(frag: OnBoardingFragment): LifecycleOwner {
return frag
}
@Provides
@PerFragment
fun provideCancelStrategy(owner: LifecycleOwner, jobs: Job): CancelStrategy {
return CancelStrategy(owner, jobs)
}
}
\ No newline at end of file
package chat.rocket.android.authentication.onboarding.di
import chat.rocket.android.authentication.onboarding.ui.OnBoardingFragment
import chat.rocket.android.dagger.scope.PerFragment
import dagger.Module
import dagger.android.ContributesAndroidInjector
@Module abstract class OnBoardingFragmentProvider {
@ContributesAndroidInjector(modules = [OnBoardingFragmentModule::class])
@PerFragment
abstract fun provideOnBoardingFragment(): OnBoardingFragment
}
\ No newline at end of file
package chat.rocket.android.authentication.onboarding.presentation
import chat.rocket.android.authentication.presentation.AuthenticationNavigator
import chat.rocket.android.core.lifecycle.CancelStrategy
import javax.inject.Inject
class OnBoardingPresenter @Inject constructor(
private val view: OnBoardingView,
private val strategy: CancelStrategy,
private val navigator: AuthenticationNavigator
) {
fun createServer(){
navigator.toWebPage("https://cloud.rocket.chat/trial")
}
}
\ No newline at end of file
package chat.rocket.android.authentication.onboarding.presentation
import chat.rocket.android.core.behaviours.LoadingView
interface OnBoardingView : LoadingView{
}
\ No newline at end of file
package chat.rocket.android.authentication.onboarding
package chat.rocket.android.authentication.onboarding.ui
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.view.isVisible
import chat.rocket.android.R
import chat.rocket.android.authentication.domain.model.getLoginDeepLinkInfo
import chat.rocket.android.authentication.onboarding.presentation.OnBoardingPresenter
import chat.rocket.android.authentication.onboarding.presentation.OnBoardingView
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() {
import dagger.android.support.AndroidSupportInjection
import kotlinx.android.synthetic.main.app_bar_chat_room.*
import kotlinx.android.synthetic.main.fragment_authentication_on_boarding.*
import javax.inject.Inject
class OnBoardingFragment : Fragment(), OnBoardingView {
@Inject
lateinit var presenter: OnBoardingPresenter
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? = container?.inflate(R.layout.fragment_on_boarding)
savedInstanceState: Bundle?): View? = container?.inflate(R.layout.fragment_authentication_on_boarding)
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setupOnClickListener()
setupToobar()
}
private fun setupToobar() {
val toolbar = (activity as AuthenticationActivity).toolbar
toolbar.isVisible = false
}
private fun setupOnClickListener() {
val deepLinkInfo = activity?.intent?.getLoginDeepLinkInfo()
button_connect_server.setOnClickListener {
val deepLinkInfo = activity?.intent?.getLoginDeepLinkInfo()
(activity as AuthenticationActivity).addFragmentBackStack("ServerFragment", R.id.fragment_container) {
ServerFragment.newInstance(deepLinkInfo)
ServerFragment.newInstance(deepLinkInfo)
}
}
button_join_community.setOnClickListener {
(activity as AuthenticationActivity).addFragmentBackStack("ServerFragment", R.id.fragment_container) {
ServerFragment.newInstance(deepLinkInfo)
}
}
button_create_server.setOnClickListener {
presenter.createServer()
}
}
companion object {
fun newInstance() = OnBoardingFragment()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
AndroidSupportInjection.inject(this)
}
override fun showLoading() {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun hideLoading() {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
companion object {
fun newInstance() = OnBoardingFragment()
}
}
......@@ -4,6 +4,7 @@ import android.content.Intent
import chat.rocket.android.R
import chat.rocket.android.authentication.domain.model.LoginDeepLinkInfo
import chat.rocket.android.authentication.login.ui.LoginFragment
import chat.rocket.android.authentication.loginoptions.ui.LoginOptionsFragment
import chat.rocket.android.authentication.registerusername.ui.RegisterUsernameFragment
import chat.rocket.android.authentication.resetpassword.ui.ResetPasswordFragment
import chat.rocket.android.authentication.signup.ui.SignupFragment
......@@ -18,6 +19,12 @@ import chat.rocket.android.webview.ui.webViewIntent
class AuthenticationNavigator(internal val activity: AuthenticationActivity) {
fun toLoginOptions() {
activity.addFragmentBackStack("LoginOptionFragment", R.id.fragment_container) {
LoginOptionsFragment.newInstance()
}
}
fun toLogin() {
activity.addFragmentBackStack("LoginFragment", R.id.fragment_container) {
LoginFragment.newInstance()
......@@ -63,6 +70,12 @@ class AuthenticationNavigator(internal val activity: AuthenticationActivity) {
}
}
fun toCreateAccount() {
activity.addFragmentBackStack("SignUpFragment", R.id.fragment_container){
SignupFragment.newInstance()
}
}
fun toChatList() {
activity.startActivity(Intent(activity, MainActivity::class.java))
activity.finish()
......
......@@ -102,7 +102,7 @@ class RegisterUsernameFragment : Fragment(), RegisterUsernameView {
private fun tintEditTextDrawableStart() {
ui {
val atDrawable = DrawableHelper.getDrawableFromId(R.drawable.ic_at_black_24dp, it)
val atDrawable = DrawableHelper.getDrawableFromId(R.drawable.ic_at_black_20dp, it)
DrawableHelper.wrapDrawable(atDrawable)
DrawableHelper.tintDrawable(atDrawable, it, R.color.colorDrawableTintGrey)
DrawableHelper.compoundDrawable(text_username, atDrawable)
......
......@@ -103,7 +103,7 @@ class ResetPasswordFragment : Fragment(), ResetPasswordView {
private fun tintEditTextDrawableStart() {
ui {
val emailDrawable = DrawableHelper.getDrawableFromId(R.drawable.ic_email_black_24dp, it)
val emailDrawable = DrawableHelper.getDrawableFromId(R.drawable.ic_email_black_20dp, it)
DrawableHelper.wrapDrawable(emailDrawable)
DrawableHelper.tintDrawable(emailDrawable, it, R.color.colorDrawableTintGrey)
DrawableHelper.compoundDrawable(text_email, emailDrawable)
......
......@@ -35,7 +35,7 @@ class ServerPresenter @Inject constructor(
fun connect(server: String) {
//code that leads to login screen (smart lock will be implemented after this)
connectToServer(server) {
navigator.toLogin()
navigator.toLoginOptions()
}
}
......
......@@ -10,6 +10,7 @@ import android.view.ViewGroup
import android.view.ViewTreeObserver
import android.widget.AdapterView
import android.widget.ArrayAdapter
import androidx.core.view.isVisible
import chat.rocket.android.BuildConfig
import chat.rocket.android.R
import chat.rocket.android.authentication.domain.model.LoginDeepLinkInfo
......@@ -21,6 +22,7 @@ import chat.rocket.android.helper.KeyboardHelper
import chat.rocket.android.util.extensions.*
import chat.rocket.common.util.ifNull
import dagger.android.support.AndroidSupportInjection
import kotlinx.android.synthetic.main.app_bar_chat_room.*
import kotlinx.android.synthetic.main.fragment_authentication_server.*
import okhttp3.HttpUrl
import javax.inject.Inject
......@@ -60,6 +62,7 @@ class ServerFragment : Fragment(), ServerView {
super.onViewCreated(view, savedInstanceState)
constraint_layout.viewTreeObserver.addOnGlobalLayoutListener(layoutListener)
setupOnClickListener()
setupToobar()
deepLinkInfo?.let {
val uri = Uri.parse(it.url)
......@@ -104,6 +107,11 @@ class ServerFragment : Fragment(), ServerView {
}
}
private fun setupToobar() {
val toolbar = (activity as AuthenticationActivity).toolbar
toolbar.isVisible = false
}
override fun onDestroyView() {
super.onDestroyView()
constraint_layout.viewTreeObserver.removeOnGlobalLayoutListener(layoutListener)
......@@ -146,10 +154,10 @@ class ServerFragment : Fragment(), ServerView {
hideLoading()
AlertDialog.Builder(it)
.setMessage(getString(R.string.msg_ver_not_recommended, BuildConfig.RECOMMENDED_SERVER_VERSION))
.setPositiveButton(R.string.msg_ok, { _, _ ->
.setPositiveButton(R.string.msg_ok) { _, _ ->
performConnect()
})
.create()
}
.create()
.show()
}
}
......@@ -212,12 +220,14 @@ class ServerFragment : Fragment(), ServerView {
private fun setupOnClickListener() {
ui {
button_connect.setOnClickListener {
// val url = text_server_url.textContent.ifEmpty(text_server_url.hintContent)
// presenter.checkServer("${protocol}${url.sanitize()}")
(activity as AuthenticationActivity).addFragmentBackStack("LoginOption", R.id.fragment_container){
LoginOptionsFragment.newInstance()
}
val url = text_server_url.textContent.ifEmpty(text_server_url.hintContent)
presenter.checkServer("$protocol${url.sanitize()}")
}
}
}
private fun joinCommunity(){
val url = "https://open.rocket.chat"
presenter.checkServer("$protocol${url.sanitize()}")
}
}
\ No newline at end of file
......@@ -30,12 +30,12 @@ class SignupFragment : Fragment(), SignupView {
@Inject
lateinit var presenter: SignupPresenter
private val layoutListener = ViewTreeObserver.OnGlobalLayoutListener {
if (KeyboardHelper.isSoftKeyboardShown(relative_layout.rootView)) {
bottom_container.setVisible(false)
if (KeyboardHelper.isSoftKeyboardShown(constraint_layout.rootView)) {
text_new_user_agreement.setVisible(false)
} else {
bottom_container.apply {
text_new_user_agreement.apply {
postDelayed({
ui { setVisible(true) }
ui { setVisible(false) }
}, 3)
}
}
......@@ -63,7 +63,7 @@ class SignupFragment : Fragment(), SignupView {
tintEditTextDrawableStart()
}
relative_layout.viewTreeObserver.addOnGlobalLayoutListener(layoutListener)
constraint_layout.viewTreeObserver.addOnGlobalLayoutListener(layoutListener)
setUpNewUserAgreementListener()
......@@ -78,7 +78,7 @@ class SignupFragment : Fragment(), SignupView {
}
override fun onDestroyView() {
relative_layout.viewTreeObserver.removeOnGlobalLayoutListener(layoutListener)
constraint_layout.viewTreeObserver.removeOnGlobalLayoutListener(layoutListener)
super.onDestroyView()
}
......@@ -163,10 +163,10 @@ class SignupFragment : Fragment(), SignupView {
private fun tintEditTextDrawableStart() {
ui {
val personDrawable =
DrawableHelper.getDrawableFromId(R.drawable.ic_person_black_24dp, it)
val atDrawable = DrawableHelper.getDrawableFromId(R.drawable.ic_at_black_24dp, it)
DrawableHelper.getDrawableFromId(R.drawable.ic_person_black_20dp, it)
val atDrawable = DrawableHelper.getDrawableFromId(R.drawable.ic_at_black_20dp, it)
val lockDrawable = DrawableHelper.getDrawableFromId(R.drawable.ic_lock_black_24dp, it)
val emailDrawable = DrawableHelper.getDrawableFromId(R.drawable.ic_email_black_24dp, it)
val emailDrawable = DrawableHelper.getDrawableFromId(R.drawable.ic_email_black_20dp, it)
val drawables = arrayOf(personDrawable, atDrawable, lockDrawable, emailDrawable)
DrawableHelper.wrapDrawables(drawables)
......
......@@ -44,7 +44,10 @@ class TwoFAFragment : Fragment(), TwoFAView {
password = arguments?.getString(PASSWORD) ?: ""
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? = container?.inflate(R.layout.fragment_authentication_two_fa)
override fun onCreateView(inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? = container?.inflate(R.layout.fragment_authentication_two_fa)
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
......
......@@ -6,11 +6,8 @@ import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.appcompat.app.AppCompatActivity
import chat.rocket.android.R
import chat.rocket.android.authentication.domain.model.LoginDeepLinkInfo
import chat.rocket.android.authentication.domain.model.getLoginDeepLinkInfo
import chat.rocket.android.authentication.onboarding.OnBoardingFragment
import chat.rocket.android.authentication.onboarding.ui.OnBoardingFragment
import chat.rocket.android.authentication.presentation.AuthenticationPresenter
import chat.rocket.android.authentication.server.ui.ServerFragment
import chat.rocket.android.util.extensions.addFragment
import dagger.android.AndroidInjection
import dagger.android.AndroidInjector
......@@ -37,13 +34,12 @@ class AuthenticationActivity : AppCompatActivity(), HasSupportFragmentInjector {
override fun onStart() {
super.onStart()
val deepLinkInfo = intent.getLoginDeepLinkInfo()
launch(UI + job) {
val newServer = intent.getBooleanExtra(INTENT_ADD_NEW_SERVER, false)
// if we got authenticateWithDeepLink information, pass true to newServer also
presenter.loadCredentials(newServer || deepLinkInfo != null) { authenticated ->
presenter.loadCredentials(newServer) { authenticated ->
if (!authenticated) {
showServerInput(deepLinkInfo)
showOnBoarding()
}
}
}
......@@ -56,19 +52,15 @@ class AuthenticationActivity : AppCompatActivity(), HasSupportFragmentInjector {
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
val currentFragment = supportFragmentManager.findFragmentById(R.id.fragment_container)
if (currentFragment != null) {
currentFragment.onActivityResult(requestCode, resultCode, data)
}
supportFragmentManager.findFragmentById(R.id.fragment_container)?.onActivityResult(requestCode, resultCode, data)
}
override fun supportFragmentInjector(): AndroidInjector<Fragment> {
return fragmentDispatchingAndroidInjector
}
fun showServerInput(deepLinkInfo: LoginDeepLinkInfo?) {
private fun showOnBoarding() {
addFragment("OnBoardingFragment", R.id.fragment_container, allowStateLoss = true) {
// ServerFragment.newInstance(deepLinkInfo)
OnBoardingFragment.newInstance()
}
}
......
......@@ -2,6 +2,8 @@ package chat.rocket.android.dagger.module
import chat.rocket.android.authentication.di.AuthenticationModule
import chat.rocket.android.authentication.login.di.LoginFragmentProvider
import chat.rocket.android.authentication.loginoptions.di.LoginOptionsFragmentProvider
import chat.rocket.android.authentication.onboarding.di.OnBoardingFragmentProvider
import chat.rocket.android.authentication.registerusername.di.RegisterUsernameFragmentProvider
import chat.rocket.android.authentication.resetpassword.di.ResetPasswordFragmentProvider
import chat.rocket.android.authentication.server.di.ServerFragmentProvider
......@@ -39,14 +41,16 @@ abstract class ActivityBuilder {
@PerActivity
@ContributesAndroidInjector(
modules = [AuthenticationModule::class,
ServerFragmentProvider::class,
LoginFragmentProvider::class,
RegisterUsernameFragmentProvider::class,
ResetPasswordFragmentProvider::class,
SignupFragmentProvider::class,
TwoFAFragmentProvider::class
]
modules = [AuthenticationModule::class,
OnBoardingFragmentProvider::class,
ServerFragmentProvider::class,
LoginOptionsFragmentProvider::class,
LoginFragmentProvider::class,
RegisterUsernameFragmentProvider::class,
ResetPasswordFragmentProvider::class,
SignupFragmentProvider::class,
TwoFAFragmentProvider::class
]
)
abstract fun bindAuthenticationActivity(): AuthenticationActivity
......
......@@ -154,10 +154,10 @@ class ProfileFragment : Fragment(), ProfileView, ActionMode.Callback {
private fun tintEditTextDrawableStart() {
(activity as MainActivity).apply {
val personDrawable =
DrawableHelper.getDrawableFromId(R.drawable.ic_person_black_24dp, this)
val atDrawable = DrawableHelper.getDrawableFromId(R.drawable.ic_at_black_24dp, this)
DrawableHelper.getDrawableFromId(R.drawable.ic_person_black_20dp, this)
val atDrawable = DrawableHelper.getDrawableFromId(R.drawable.ic_at_black_20dp, this)
val emailDrawable =
DrawableHelper.getDrawableFromId(R.drawable.ic_email_black_24dp, this)
DrawableHelper.getDrawableFromId(R.drawable.ic_email_black_20dp, this)
val linkDrawable = DrawableHelper.getDrawableFromId(R.drawable.ic_link_black_24dp, this)
val drawables = arrayOf(personDrawable, atDrawable, emailDrawable, linkDrawable)
......
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportWidth="20"
android:viewportHeight="20">
<path
android:fillType="evenOdd"
android:pathData="M0 0h20v20H0z" />
<path
android:fillType="evenOdd"
android:strokeColor="#2F343D"
android:strokeWidth="1.5"
android:pathData="M 10 7 C 11.6568542495 7 13 8.34314575051 13 10 C 13 11.6568542495 11.6568542495 13 10 13 C 8.34314575051 13 7 11.6568542495 7 10 C 7 8.34314575051 8.34314575051 7 10 7 Z" />
<path
android:fillType="evenOdd"
android:strokeColor="#2F343D"
android:strokeWidth="1.5"
android:pathData="M12.68 16.469A7 7 0 1 1 17 10v0.542" />
<path
android:fillType="evenOdd"
android:strokeColor="#2F343D"
android:strokeWidth="1.5"
android:pathData="M17 10.49c0 1.387-0.781 2.51-2 2.51-1.219 0-2-1.112-2-2.51V6" />
</vector>
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M23.983,11.3C23.877,13.492 23.269,15.232 22.159,16.52C21.049,17.808 19.556,18.453 17.682,18.453C16.855,18.453 16.142,18.294 15.541,17.978C14.94,17.661 14.486,17.207 14.179,16.616C13.217,17.815 11.963,18.414 10.415,18.414C9.012,18.414 7.926,17.888 7.157,16.835C6.388,15.782 6.1,14.391 6.292,12.661C6.465,11.249 6.866,9.993 7.496,8.892C8.125,7.792 8.921,6.947 9.882,6.356C10.843,5.766 11.881,5.47 12.996,5.47C14.371,5.47 15.543,5.753 16.514,6.318L17.423,6.87L16.687,14.292C16.591,14.968 16.675,15.486 16.94,15.846C17.204,16.205 17.624,16.385 18.201,16.385C19.085,16.385 19.826,15.925 20.421,15.005C21.017,14.085 21.344,12.88 21.402,11.39C21.565,8.402 20.89,6.106 19.376,4.501C17.862,2.896 15.62,2.093 12.65,2.093C10.795,2.093 9.142,2.513 7.69,3.352C6.239,4.19 5.095,5.383 4.259,6.928C3.423,8.473 2.952,10.243 2.846,12.238C2.692,15.268 3.375,17.612 4.893,19.268C6.412,20.925 8.685,21.753 11.713,21.753C12.511,21.753 13.347,21.674 14.222,21.515C15.096,21.357 15.851,21.145 16.485,20.88L17.033,22.857C16.447,23.2 15.656,23.476 14.662,23.685C13.667,23.895 12.665,24 11.655,24C9.118,24 6.955,23.544 5.167,22.632C3.379,21.721 2.046,20.377 1.166,18.6C0.287,16.824 -0.095,14.703 0.02,12.238C0.135,9.875 0.741,7.756 1.837,5.881C2.932,4.006 4.425,2.558 6.314,1.535C8.202,0.511 10.334,0 12.708,0C15.12,0 17.197,0.46 18.936,1.38C20.676,2.301 21.979,3.617 22.844,5.329C23.709,7.041 24.088,9.032 23.983,11.3ZM9.493,12.661C9.387,13.791 9.497,14.65 9.824,15.236C10.151,15.822 10.68,16.116 11.41,16.116C11.881,16.116 12.328,15.932 12.751,15.563C13.174,15.195 13.525,14.665 13.804,13.971L14.409,7.897C14.034,7.786 13.65,7.73 13.256,7.73C12.15,7.73 11.293,8.15 10.682,8.989C10.072,9.828 9.675,11.052 9.493,12.661Z" />
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportWidth="20"
android:viewportHeight="20">
<path
android:fillType="evenOdd"
android:pathData="M0 0h20v20H0z" />
<path
android:fillType="evenOdd"
android:strokeColor="#2F343D"
android:strokeWidth="1.5"
android:pathData="M3 3.75c-0.69 0-1.25 0.56 -1.25 1.25v10c0 0.69 0.56 1.25 1.25 1.25h14c0.69 0 1.25-0.56 1.25-1.25V5c0-0.69-0.56-1.25-1.25-1.25H3z" />
<path
android:fillType="evenOdd"
android:strokeColor="#2F343D"
android:strokeWidth="1.5"
android:pathData="M16.074 7.064l-6.01 4.01-6.01-4.01" />
</vector>
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M20,4L4,4c-1.1,0 -1.99,0.9 -1.99,2L2,18c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2zM20,8l-8,5 -8,-5L4,6l8,5 8,-5v2z" />
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportWidth="20"
android:viewportHeight="20">
<path
android:fillType="evenOdd"
android:pathData="M0 0h20v20H0z" />
<path
android:fillType="evenOdd"
android:strokeColor="#2F343D"
android:strokeWidth="1.5"
android:pathData="M4 15.106c0-3.783 4.5-3.026 4.5-4.54 0 0 0.086-1.004-0.41-1.513C7.473 8.423 7 7.665 7 6.405 7 4.525 8.343 3 10 3s3 1.524 3 3.405c0 1.243-0.46 2.017-1.105 2.648-0.472 0.496 -0.395 1.514-0.395 1.514 0 1.513 4.5 0.756 4.5 4.54 0 0-1.195 0.893 -6 0.893s-6-0.894-6-0.894z" />
</vector>
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M12,12c2.21,0 4,-1.79 4,-4s-1.79,-4 -4,-4 -4,1.79 -4,4 1.79,4 4,4zM12,14c-2.67,0 -8,1.34 -8,4v2h16v-2c0,-2.66 -5.33,-4 -8,-4z" />
</vector>
\ No newline at end of file
......@@ -4,8 +4,13 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@style/AuthenticationTheme"
android:orientation="vertical"
tools:context=".authentication.ui.AuthenticationActivity">
<include
android:id="@+id/layout_app_bar"
layout="@layout/app_bar_chat_room" />
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
......
......@@ -140,36 +140,38 @@
android:layout_marginEnd="16dp"
android:background="#e1e5e8" />
<com.google.android.material.button.MaterialButton
android:id="@+id/button_email_login"
android:layout_width="0dp"
android:layout_height="56dp"
<Button
android:id="@+id/button_login"
style="@style/Authentication.Button"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/image_more_login_option"
app:cornerRadius="2dp"
app:backgroundTint="@color/colorAccent"
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="32dp"
android:text="Login with e-mail"
android:textSize="16sp"
android:textAllCaps="false" />
android:text="Login with e-mail" />
<Button
android:layout_width="0dp"
android:id="@+id/button_create_account"
android:layout_width="wrap_content"
android:layout_height="48dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/button_email_login"
app:layout_constraintTop_toBottomOf="@id/button_login"
style="?borderlessButtonStyle"
android:layout_marginTop="10dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="Create an account"
android:textSize="18sp"
android:textStyle="bold"
android:textColor="@color/colorAccent"
android:textAllCaps="false" />
<com.wang.avi.AVLoadingIndicatorView
android:id="@+id/view_loading"
style="@style/Authentication.AVLoadingIndicatorView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:visibility="gone"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -4,7 +4,7 @@
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/colorWhite"
tools:context="chat.rocket.android.authentication.onboarding.OnBoardingFragment">
tools:context="chat.rocket.android.authentication.onboarding.ui.OnBoardingFragment">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
......@@ -22,13 +22,7 @@
<TextView
android:id="@+id/text_onboarding_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="24sp"
android:fontFamily="sans-serif"
android:textStyle="bold"
android:textColor="#2f343d"
android:lineSpacingExtra="4sp"
style="@style/Authentication.Headline.TextView"
android:text="Welcome to Rocket.Chat"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
......@@ -37,13 +31,7 @@
<TextView
android:id="@+id/text_onboarding_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:fontFamily="sans-serif"
android:textStyle="normal"
android:textColor="#54585e"
android:lineSpacingExtra="4sp"
style="@style/Authentication.Description.TextView"
android:text="Open Source Communication"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
......@@ -150,6 +138,7 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/button_create_server"
android:layout_width="0dp"
android:layout_height="60dp"
app:layout_constraintStart_toStartOf="parent"
......
<?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:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
......@@ -9,32 +9,41 @@
<TextView
android:id="@+id/text_headline"
style="@style/Authentication.Headline.TextView"
android:layout_centerHorizontal="true"
android:text="@string/title_register_username" />
android:text="@string/title_register_username"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="30dp"
android:layout_marginStart="21dp" />
<EditText
android:id="@+id/text_username"
style="@style/Authentication.EditText"
android:layout_below="@id/text_headline"
android:layout_marginTop="32dp"
android:drawableStart="@drawable/ic_at_black_24dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/text_headline"
android:layout_marginTop="16dp"
android:drawableStart="@drawable/ic_at_black_20dp"
android:hint="@string/msg_username"
android:imeOptions="actionDone"
android:inputType="text" />
<Button
android:id="@+id/button_use_this_username"
style="@style/Authentication.Button"
android:text="@string/action_use_this_username"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/text_username"
android:layout_marginTop="20dp" />
<com.wang.avi.AVLoadingIndicatorView
android:id="@+id/view_loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
style="@style/Authentication.AVLoadingIndicatorView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:visibility="gone"
app:indicatorName="BallPulseIndicator"
tools:visibility="visible" />
<Button
android:id="@+id/button_use_this_username"
style="@style/Authentication.Button"
android:layout_alignParentBottom="true"
android:text="@string/action_use_this_username" />
</RelativeLayout>
\ No newline at end of file
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?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:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
......@@ -9,32 +9,41 @@
<TextView
android:id="@+id/text_headline"
style="@style/Authentication.Headline.TextView"
android:layout_centerHorizontal="true"
android:text="@string/title_reset_password" />
android:text="@string/title_reset_password"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="21dp"
android:layout_marginTop="30dp" />
<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"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/text_headline"
android:layout_marginTop="30dp"
android:drawableStart="@drawable/ic_email_black_20dp"
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"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="20dp"
app:layout_constraintTop_toBottomOf="@id/text_email"
android:text="@string/title_reset_password" />
</RelativeLayout>
\ No newline at end of file
<com.wang.avi.AVLoadingIndicatorView
android:id="@+id/view_loading"
style="@style/Authentication.AVLoadingIndicatorView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:visibility="gone"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -21,13 +21,7 @@
<TextView
android:id="@+id/text_headline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="22sp"
android:fontFamily="sans-serif"
android:textStyle="bold"
android:textColor="#2f343d"
android:lineSpacingExtra="6sp"
style="@style/Authentication.Headline.TextView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/image_server"
......@@ -81,30 +75,23 @@
<Button
android:id="@+id/button_connect"
android:layout_width="0dp"
android:layout_height="48dp"
style="@style/Authentication.Button"
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_marginTop="20dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:textAllCaps="false"/>
android:layout_marginEnd="16dp" />
<com.wang.avi.AVLoadingIndicatorView
android:id="@+id/view_loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Authentication.AVLoadingIndicatorView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:visibility="gone"
app:indicatorName="BallPulseIndicator"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>
<?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:tools="http://schemas.android.com/tools"
android:id="@+id/relative_layout"
android:id="@+id/constraint_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="true"
tools:context=".authentication.signup.ui.SignupFragment">
<ScrollView
android:id="@+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/text_headline"
style="@style/Authentication.Headline.TextView"
android:text="@string/title_sign_up"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="21dp"
android:layout_marginTop="30dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:id="@+id/text_name"
style="@style/Authentication.EditText"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/text_headline"
android:layout_marginTop="16dp"
android:drawableStart="@drawable/ic_person_black_20dp"
android:hint="@string/msg_name"
android:imeOptions="actionNext"
android:inputType="textCapWords" />
<TextView
android:id="@+id/text_headline"
style="@style/Authentication.Headline.TextView"
android:layout_gravity="center"
android:text="@string/title_sign_up" />
<EditText
android:id="@+id/text_username"
style="@style/Authentication.EditText"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/text_name"
android:layout_marginTop="10dp"
android:drawableStart="@drawable/ic_at_black_20dp"
android:hint="@string/msg_username"
android:imeOptions="actionNext"
android:inputType="text" />
<EditText
android:id="@+id/text_name"
style="@style/Authentication.EditText"
android:layout_marginTop="32dp"
android:drawableStart="@drawable/ic_person_black_24dp"
android:hint="@string/msg_name"
android:imeOptions="actionNext"
android:inputType="textCapWords" />
<EditText
android:id="@+id/text_password"
style="@style/Authentication.EditText"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/text_username"
android:layout_marginTop="10dp"
android:drawableStart="@drawable/ic_key_black_20dp"
android:hint="@string/msg_password"
android:imeOptions="actionNext"
android:inputType="textPassword" />
<EditText
android:id="@+id/text_username"
style="@style/Authentication.EditText"
android:layout_marginTop="16dp"
android:drawableStart="@drawable/ic_at_black_24dp"
android:hint="@string/msg_username"
android:imeOptions="actionNext"
android:inputType="text" />
<EditText
android:id="@+id/text_email"
style="@style/Authentication.EditText"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/text_password"
android:layout_marginTop="10dp"
android:drawableStart="@drawable/ic_email_black_20dp"
android:hint="@string/msg_email"
android:imeOptions="actionDone"
android:inputType="textEmailAddress" />
<EditText
android:id="@+id/text_password"
style="@style/Authentication.EditText"
android:layout_marginTop="16dp"
android:drawableStart="@drawable/ic_lock_black_24dp"
android:hint="@string/msg_password"
android:imeOptions="actionNext"
android:inputType="textPassword" />
<Button
android:id="@+id/button_sign_up"
style="@style/Authentication.Button"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/text_email"
android:layout_marginTop="20dp"
android:text="Register" />
<EditText
android:id="@+id/text_email"
style="@style/Authentication.EditText"
android:layout_marginBottom="16dp"
android:layout_marginTop="16dp"
android:drawableStart="@drawable/ic_email_black_24dp"
android:hint="@string/msg_email"
android:imeOptions="actionDone"
android:inputType="textEmailAddress" />
</LinearLayout>
</ScrollView>
<TextView
android:id="@+id/text_new_user_agreement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_margin="@dimen/screen_edge_left_and_right_margins"
android:fitsSystemWindows="true"
android:textColor="@color/colorPrimaryText"
android:textColorLink="@color/colorAccent" />
<com.wang.avi.AVLoadingIndicatorView
android:id="@+id/view_loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/scroll_view"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
style="@style/Authentication.AVLoadingIndicatorView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:visibility="gone"
app:indicatorName="BallPulseIndicator"
tools:visibility="visible" />
<LinearLayout
android:id="@+id/bottom_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical">
<TextView
android:id="@+id/text_new_user_agreement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="@dimen/screen_edge_left_and_right_margins"
android:gravity="center"
android:textColorLink="@color/colorAccent" />
<Button
android:id="@+id/button_sign_up"
style="@style/Authentication.Button"
android:text="@string/title_sign_up" />
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?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:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
......@@ -9,32 +9,50 @@
<TextView
android:id="@+id/text_headline"
style="@style/Authentication.Headline.TextView"
android:layout_centerHorizontal="true"
android:text="@string/title_log_in" />
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginStart="21dp"
android:layout_marginTop="30dp"
android:text="Two-factor Authentication" />
<TextView
android:id="@+id/text_description"
style="@style/Authentication.Description.TextView"
android:text="What’s your 2FA code?"
app:layout_constraintTop_toBottomOf="@id/text_headline"
app:layout_constraintStart_toStartOf="@id/text_headline"
android:layout_marginTop="4dp" />
<EditText
android:id="@+id/text_two_factor_auth"
style="@style/Authentication.EditText"
android:layout_below="@id/text_headline"
android:layout_marginTop="32dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/text_description"
android:layout_marginTop="16dp"
android:drawableStart="@drawable/ic_vpn_key_black_24dp"
android:hint="@string/msg_2fa_code"
android:imeOptions="actionDone"
android:inputType="text" />
<Button
android:id="@+id/button_log_in"
style="@style/Authentication.Button"
android:text="Confirm"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/text_two_factor_auth"
android:layout_marginTop="20dp" />
<com.wang.avi.AVLoadingIndicatorView
android:id="@+id/view_loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
style="@style/Authentication.AVLoadingIndicatorView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:visibility="gone"
app:indicatorName="BallPulseIndicator"
tools:visibility="visible" />
<Button
android:id="@+id/button_log_in"
style="@style/Authentication.Button"
android:layout_alignParentBottom="true"
android:text="@string/title_log_in" />
</RelativeLayout>
\ No newline at end of file
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -108,7 +108,7 @@
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_marginTop="16dp"
android:src="@drawable/ic_at_black_24dp"
android:src="@drawable/ic_at_black_20dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/text_channel_name" />
......
......@@ -32,7 +32,7 @@
android:id="@+id/image_mention"
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/ic_at_black_24dp"
android:src="@drawable/ic_at_black_20dp"
android:tint="@color/icon_grey"
app:layout_constraintBottom_toTopOf="@+id/text_no_mention"
app:layout_constraintEnd_toEndOf="parent"
......
......@@ -32,7 +32,7 @@
android:id="@+id/text_name"
style="@style/Profile.EditText"
android:layout_marginTop="32dp"
android:drawableStart="@drawable/ic_person_black_24dp"
android:drawableStart="@drawable/ic_person_black_20dp"
android:hint="@string/msg_name"
android:inputType="textCapWords" />
......@@ -40,7 +40,7 @@
android:id="@+id/text_username"
style="@style/Profile.EditText"
android:layout_marginTop="16dp"
android:drawableStart="@drawable/ic_at_black_24dp"
android:drawableStart="@drawable/ic_at_black_20dp"
android:hint="@string/msg_username"
android:inputType="text" />
......@@ -48,7 +48,7 @@
android:id="@+id/text_email"
style="@style/Profile.EditText"
android:layout_marginTop="16dp"
android:drawableStart="@drawable/ic_email_black_24dp"
android:drawableStart="@drawable/ic_email_black_20dp"
android:hint="@string/msg_email"
android:inputType="textEmailAddress" />
......
......@@ -2,10 +2,10 @@
<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:layout_height="48dp"
android:textSize="16sp"
android:textColor="@color/colorPrimaryText"
android:textAlignment="center"
android:background="@color/colorWhite"
android:padding="10dp"
android:padding="12dp"
tools:text="https" />
\ No newline at end of file
......@@ -23,7 +23,7 @@
<item
android:id="@+id/action_profile"
android:icon="@drawable/ic_person_black_24dp"
android:icon="@drawable/ic_person_black_20dp"
android:title="@string/title_profile" />
<item
......
......@@ -2,8 +2,8 @@
<resources>
<!-- Main colors -->
<color name="colorPrimary">#FF303030</color> <!-- Material Grey 850 -->
<color name="colorPrimaryDark">#FF212121</color> <!-- Material Grey 900 -->
<color name="colorPrimary">#2f343d</color>
<color name="colorPrimaryDark">#2f343d</color>
<color name="colorAccent">#1d74f5</color>
<!-- Text colors -->
......
......@@ -8,8 +8,8 @@
<dimen name="message_item_top_and_bottom_padding">6dp</dimen>
<dimen name="member_item_top_and_bottom_padding">6dp</dimen>
<dimen name="edit_text_margin">10dp</dimen>
<dimen name="edit_text_drawable_padding">16dp</dimen>
<dimen name="edit_text_margin">16dp</dimen>
<dimen name="edit_text_drawable_padding">10dp</dimen>
<dimen name="text_view_drawable_padding">8dp</dimen>
......
......@@ -51,15 +51,15 @@
<string name="msg_generic_error">Sorry, an error has occurred, please try again</string>
<string name="msg_no_data_to_display">No data to display</string>
<string name="msg_profile_update_successfully">Profile update successfully</string>
<string name="msg_username">username</string>
<string name="msg_username_or_email">username or email</string>
<string name="msg_password">password</string>
<string name="msg_name">name</string>
<string name="msg_email">email</string>
<string name="msg_username">Username</string>
<string name="msg_username_or_email">Username or email</string>
<string name="msg_password">Password</string>
<string name="msg_name">Name</string>
<string name="msg_email">Email</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_new_user">New user? %1$s</string>
<string name="msg_forgot_password">Forgot password? %1$s</string>
<string name="msg_forgot_password">Forgot password?</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>
......
......@@ -15,7 +15,7 @@
<style name="AuthenticationTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:statusBarColor">@color/colorPrimaryDark</item>
<item name="android:windowBackground">@color/colorPrimary</item>
<item name="android:windowBackground">@color/colorWhite</item>
</style>
<!-- Widget styles. -->
......@@ -30,32 +30,54 @@
<item name="android:background">@drawable/style_edit_text_authentication</item>
</style>
<style name="Authentication.Headline.TextView" parent="TextAppearance.AppCompat.Headline">
<style name="Authentication.Headline.TextView" parent="TextAppearance.AppCompat">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginTop">20dp</item>
<item name="android:layout_marginStart">@dimen/screen_edge_left_and_right_margins</item>
<item name="android:layout_marginEnd">@dimen/screen_edge_left_and_right_margins</item>
<item name="android:textSize">22sp</item>
<item name="android:fontFamily">sans-serif</item>
<item name="android:textColor">#2f343d</item>
<item name="android:textStyle">bold</item>
</style>
<style name="Authentication.Description.TextView" 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>
<item name="android:textColor">#54585e</item>
</style>
<style name="Authentication.EditText" parent="Widget.AppCompat.EditText">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">50dp</item>
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">48dp</item>
<item name="android:layout_marginStart">@dimen/screen_edge_left_and_right_margins</item>
<item name="android:layout_marginEnd">@dimen/screen_edge_left_and_right_margins</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:drawableTint" tools:ignore="NewApi">@color/colorDrawableTintGrey</item>
<item name="android:textColor">#9ea2a8</item>
<item name="android:textColorHint">#9ea2a8</item>
<item name="android:fontFamily">sans-serif</item>
<item name="android:background">@drawable/style_edit_text_authentication</item>
<item name="android:background">@drawable/rounded_border</item>
</style>
<style name="Authentication.Button" parent="Widget.AppCompat.Button">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">48dp</item>
<item name="android:layout_marginStart">16dp</item>
<item name="android:layout_marginEnd">16dp</item>
<item name="android:textColor">@color/colorWhite</item>
<item name="android:textSize">18sp</item>
<item name="android:textAllCaps">false</item>
<item name="android:background">@drawable/rounded_color_accent</item>
</style>
<style name="Authentication.AVLoadingIndicatorView" parent="AVLoadingIndicatorView">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:background">@drawable/effect_ripple</item>
<item name="indicatorColor">@color/colorPrimary</item>
<item name="indicatorName">BallPulseIndicator</item>
</style>
<style name="EditText.Password" parent="TextAppearance.AppCompat">
......
#Fri May 18 17:08:16 IST 2018
#Wed Jul 25 20:36:29 IST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-rc-1-all.zip
distributionSha256Sum=9af7345c199f1731c187c96d3fe3d31f5405192a42046bafa71d846c3d9adacb
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