Skip to content

Commit

Permalink
Propagate cta customization to all screens
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenVinouze committed Jul 7, 2017
1 parent 21eb0c8 commit 076889c
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ abstract class AbstractRegisterActivity : AppCompatActivity() {
protected val toolbar: Toolbar by bindView(R.id.register_toolbar)
protected val usernameEditText: MaterialEditText by bindView(R.id.login_username_edittext)
protected val passwordEditText: MaterialEditText? by bindOptionalView(R.id.login_password_edittext)
protected val ctaButton: Button by bindView(R.id.register_cta_button)
protected val facebookButton: Button? by bindOptionalView(R.id.register_facebook)
protected val googleButton: Button? by bindOptionalView(R.id.register_google)
protected val separator: ViewGroup? by bindOptionalView(R.id.register_separator)
Expand All @@ -50,7 +51,12 @@ abstract class AbstractRegisterActivity : AppCompatActivity() {
supportActionBar?.setDisplayHomeAsUpEnabled(true)
supportActionBar?.setDisplayShowTitleEnabled(false)

val sources = ConfigurationManager.sharedInstance(this).sources
val configuration = ConfigurationManager.sharedInstance(this)
val sources = configuration.sources

ctaButton.setTextColor(configuration.ctaTextColor)
ctaButton.background = configuration.ctaBackground
ctaButton.typeface = configuration.ctaTextFont

if (!sources.contains(RegisterSource.FACEBOOK) && !sources.contains(RegisterSource.GOOGLE)) {
separator?.visibility = View.GONE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ import com.wopata.register_ui.R
*/
class ResetPasswordActivity : AbstractRegisterActivity() {

private val resetButton: Button by bindView(R.id.reset_button)

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

toolbar.title = getString(R.string.ResetTitle)

resetButton.setOnClickListener {
ctaButton.setOnClickListener {
reset()
}
usernameEditText.setOnEditorActionListener { _, _, _ ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.wopata.register_ui.activities

import android.content.Intent
import android.os.Bundle
import android.widget.Button
import android.widget.TextView
import butterknife.bindView
import com.wopata.register_core.managers.RegisterManager
Expand All @@ -15,7 +14,6 @@ import com.wopata.register_ui.R
*/
class SignInActivity : AbstractRegisterActivity() {

private val signInButton: Button by bindView(R.id.sign_in_button)
private val signUpButton: TextView by bindView(R.id.sign_in_sign_up_button)
private val resetPasswordButton: TextView by bindView(R.id.sign_in_reset_button)

Expand All @@ -24,7 +22,7 @@ class SignInActivity : AbstractRegisterActivity() {

toolbar.title = getString(R.string.SignInTitle)

signInButton.setOnClickListener {
ctaButton.setOnClickListener {
signIn()
}
passwordEditText?.setOnEditorActionListener { _, _, _ ->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.wopata.register_ui.activities

import android.os.Bundle
import android.widget.Button
import android.widget.TextView
import butterknife.bindView
import com.wopata.register_core.managers.RegisterManager
Expand All @@ -14,15 +13,14 @@ import com.wopata.register_ui.R
*/
class SignUpActivity : AbstractRegisterActivity() {

private val signUpButton: Button by bindView(R.id.sign_up_button)
private val signInButton: TextView by bindView(R.id.sign_up_sign_in_button)

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

toolbar.title = getString(R.string.SignUpTitle)

signUpButton.setOnClickListener {
ctaButton.setOnClickListener {
signUp()
}
passwordEditText?.setOnEditorActionListener { _, _, _ ->
Expand Down
2 changes: 1 addition & 1 deletion ui/src/main/res/layout/activity_reset_password.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
android:inputType="textEmailAddress" />

<Button
android:id="@+id/reset_button"
android:id="@+id/register_cta_button"
style="@style/RegisterButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down
2 changes: 1 addition & 1 deletion ui/src/main/res/layout/activity_signin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
android:inputType="textPassword" />

<Button
android:id="@+id/sign_in_button"
android:id="@+id/register_cta_button"
style="@style/RegisterButton"
android:layout_marginTop="@dimen/register_screen_spacing"
android:text="@string/LoginButtonTitle" />
Expand Down
2 changes: 1 addition & 1 deletion ui/src/main/res/layout/activity_signup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
android:inputType="textPassword" />

<Button
android:id="@+id/sign_up_button"
android:id="@+id/register_cta_button"
style="@style/RegisterButton"
android:layout_marginBottom="@dimen/register_standard_spacing"
android:layout_marginTop="@dimen/register_screen_spacing"
Expand Down

0 comments on commit 076889c

Please sign in to comment.