Skip to content

Commit 01529d8

Browse files
authored
Update Authentication (Login and Signup) Screens (#1747)
2 parents 7cb7c0b + 819b23e commit 01529d8

21 files changed

+266
-265
lines changed

Simplenote/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,10 @@
174174

175175
<activity
176176
android:name=".authentication.SimplenoteSignupActivity"
177-
android:theme="@style/SignUpOverride" />
177+
android:theme="@style/Style.Authentication" />
178178

179179
<activity android:name=".authentication.NewCredentialsActivity"
180-
android:theme="@style/SignUpOverride"/>
180+
android:theme="@style/Style.Authentication"/>
181181

182182
<activity
183183
android:name="com.automattic.simplenote.StyleActivity"

Simplenote/src/main/java/com/automattic/simplenote/PreferencesFragment.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
import com.automattic.simplenote.utils.PrefUtils;
5757
import com.automattic.simplenote.utils.SimplenoteProgressDialogFragment;
5858
import com.simperium.Simperium;
59-
import com.simperium.android.ProgressDialogFragment;
6059
import com.simperium.client.Bucket;
6160
import com.simperium.client.BucketObjectMissingException;
6261
import com.simperium.client.BucketObjectNameInvalid;
@@ -397,7 +396,7 @@ private void showProgressDialogDeleteAccount() {
397396
}
398397

399398
mProgressDialogFragment = SimplenoteProgressDialogFragment.newInstance(getString(R.string.requesting_message));
400-
mProgressDialogFragment.show(activity.getSupportFragmentManager(), ProgressDialogFragment.TAG);
399+
mProgressDialogFragment.show(activity.getSupportFragmentManager(), SimplenoteProgressDialogFragment.TAG);
401400
}
402401

403402
private void closeProgressDialogDeleteAccount() {

Simplenote/src/main/java/com/automattic/simplenote/authentication/MagicLinkableFragment.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ import androidx.fragment.app.DialogFragment
1414
import androidx.fragment.app.Fragment
1515
import com.automattic.simplenote.R
1616
import com.automattic.simplenote.authentication.magiclink.MagicLinkConfirmationFragment
17+
import com.automattic.simplenote.utils.SimplenoteProgressDialogFragment
1718
import com.google.android.material.textfield.TextInputLayout
18-
import com.simperium.android.ProgressDialogFragment
1919

2020
/**
2121
* Base class used to share logic between sign up and login, specifically related to magic links.
2222
*/
2323
abstract class MagicLinkableFragment : Fragment() {
2424

25-
private var progressDialogFragment: ProgressDialogFragment? = null
25+
private var progressDialogFragment: SimplenoteProgressDialogFragment? = null
2626

2727
private var emailField: EditText? = null
2828

@@ -92,17 +92,17 @@ abstract class MagicLinkableFragment : Fragment() {
9292
}
9393

9494
fun showProgressDialog(label: String) {
95-
val existingProgressFrag = parentFragmentManager.findFragmentByTag(ProgressDialogFragment.TAG)
95+
val existingProgressFrag = parentFragmentManager.findFragmentByTag(SimplenoteProgressDialogFragment.TAG)
9696
if (existingProgressFrag == null) {
9797
progressDialogFragment =
98-
ProgressDialogFragment.newInstance(label)
98+
SimplenoteProgressDialogFragment.newInstance(label)
9999
progressDialogFragment?.setStyle(DialogFragment.STYLE_NO_TITLE, R.style.Simperium)
100-
progressDialogFragment?.show(requireFragmentManager(), ProgressDialogFragment.TAG)
100+
progressDialogFragment?.show(requireFragmentManager(), SimplenoteProgressDialogFragment.TAG)
101101
}
102102
}
103103

104104
protected fun hideDialogProgress() {
105-
val existingProgressFrag = progressDialogFragment ?: (parentFragmentManager.findFragmentByTag(ProgressDialogFragment.TAG) as ProgressDialogFragment?)
105+
val existingProgressFrag = progressDialogFragment ?: (parentFragmentManager.findFragmentByTag(SimplenoteProgressDialogFragment.TAG) as SimplenoteProgressDialogFragment?)
106106
existingProgressFrag?.let {
107107
if (!it.isHidden) {
108108
it.dismiss()

Simplenote/src/main/java/com/automattic/simplenote/authentication/NewCredentialsActivity.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,18 @@ import androidx.appcompat.widget.AppCompatButton
2626
import androidx.appcompat.widget.Toolbar
2727
import androidx.core.content.ContextCompat
2828
import com.automattic.simplenote.R
29+
import com.automattic.simplenote.ThemedAppCompatActivity
2930
import com.automattic.simplenote.utils.AccountNetworkUtils
3031
import com.automattic.simplenote.utils.AccountVerificationEmailHandler
3132
import com.automattic.simplenote.utils.AppLog
3233
import com.automattic.simplenote.utils.HtmlCompat
34+
import com.automattic.simplenote.utils.SimplenoteProgressDialogFragment
3335
import com.automattic.simplenote.utils.SystemBarUtils
34-
import com.google.android.material.color.MaterialColors
36+
import com.automattic.simplenote.utils.getColorStr
3537
import com.google.android.material.textfield.TextInputLayout
3638
import com.simperium.Simperium
3739
import com.simperium.SimperiumNotInitializedException
3840
import com.simperium.android.CredentialsActivity
39-
import com.simperium.android.ProgressDialogFragment
4041
import com.simperium.client.AuthException
4142
import com.simperium.client.AuthException.FailureType
4243
import com.simperium.client.AuthProvider
@@ -48,14 +49,14 @@ import java.io.UnsupportedEncodingException
4849
import java.net.URLEncoder
4950
import java.util.regex.Pattern
5051

51-
open class NewCredentialsActivity : AppCompatActivity() {
52+
open class NewCredentialsActivity : ThemedAppCompatActivity() {
5253
companion object {
5354
val PATTERN_NEWLINES_RETURNS_TABS: Pattern = Pattern.compile("[\n\r\t]")
5455
const val PREF_HIDE_EMAIL_FIELD: String = "pref_hide_email_field"
5556
const val PASSWORD_LENGTH_LOGIN: Int = 4
5657
const val PASSWORD_LENGTH_MINIMUM: Int = 8
5758
}
58-
private var progressDialogFragment: ProgressDialogFragment? = null
59+
private var progressDialogFragment: SimplenoteProgressDialogFragment? = null
5960
private var button: AppCompatButton? = null
6061
private var simperium: Simperium? = null
6162
private var missingEmailMessage: TextView? = null
@@ -155,8 +156,7 @@ open class NewCredentialsActivity : AppCompatActivity() {
155156
missingEmailMessage?.visibility = View.VISIBLE
156157
inputEmail?.visibility = View.GONE
157158

158-
val colorLink: String =
159-
Integer.toHexString(MaterialColors.getColor(missingEmailMessage!!, R.attr.onMainBackgroundColor) and 16777215)
159+
val colorLink = getColorStr(R.color.text_link)
160160
val boldEmail = "<b><font color=\"#${colorLink}\">${email}<font/></b>"
161161
missingEmailMessage?.text = HtmlCompat.fromHtml(
162162
String.format(
@@ -488,8 +488,8 @@ open class NewCredentialsActivity : AppCompatActivity() {
488488
val password = this.getEditTextString(inputPassword!!)
489489
if (this.isValidPasswordLogin()) {
490490
this.progressDialogFragment =
491-
ProgressDialogFragment.newInstance(this.getString(R.string.simperium_dialog_progress_logging_in))
492-
progressDialogFragment?.show(this.supportFragmentManager, ProgressDialogFragment.TAG)
491+
SimplenoteProgressDialogFragment.newInstance(this.getString(R.string.simperium_dialog_progress_logging_in))
492+
progressDialogFragment?.show(this.supportFragmentManager, SimplenoteProgressDialogFragment.TAG)
493493
simperium?.authorizeUser(email, password, this.authListener)
494494
} else {
495495
this.showDialogError(this.getString(R.string.simperium_dialog_message_password_login, PASSWORD_LENGTH_LOGIN))
@@ -500,10 +500,10 @@ open class NewCredentialsActivity : AppCompatActivity() {
500500
val email = this.getEditTextString(inputEmail)
501501
val password = this.getEditTextString(inputPassword)
502502
if (this.isValidPassword(email, password)) {
503-
this.progressDialogFragment = ProgressDialogFragment.newInstance(
503+
this.progressDialogFragment = SimplenoteProgressDialogFragment.newInstance(
504504
this.getString(R.string.simperium_dialog_progress_signing_up)
505505
)
506-
progressDialogFragment?.show(this.supportFragmentManager, ProgressDialogFragment.TAG)
506+
progressDialogFragment?.show(this.supportFragmentManager, SimplenoteProgressDialogFragment.TAG)
507507
simperium?.createUser(email, password, this.authListener)
508508
} else {
509509
this.showDialogError(this.getString(R.string.simperium_dialog_message_password, PASSWORD_LENGTH_MINIMUM))

Simplenote/src/main/java/com/automattic/simplenote/authentication/SignupFragment.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
import com.automattic.simplenote.utils.BrowserUtils;
3030
import com.automattic.simplenote.utils.DisplayUtils;
3131
import com.automattic.simplenote.utils.NetworkUtils;
32+
import com.automattic.simplenote.utils.SimplenoteProgressDialogFragment;
3233
import com.google.android.material.textfield.TextInputLayout;
33-
import com.simperium.android.ProgressDialogFragment;
3434
import com.simperium.util.Logger;
3535

3636
import org.json.JSONException;
@@ -59,7 +59,7 @@ public class SignupFragment extends Fragment {
5959
private static final MediaType JSON_MEDIA_TYPE =
6060
MediaType.parse("application/json; charset=utf-8");
6161

62-
private ProgressDialogFragment progressDialogFragment;
62+
private SimplenoteProgressDialogFragment progressDialogFragment;
6363

6464
@Nullable
6565
@Override
@@ -117,9 +117,9 @@ public void onClick(View v) {
117117

118118
private void showProgressDialog() {
119119
progressDialogFragment =
120-
ProgressDialogFragment.newInstance(getString(R.string.simperium_dialog_progress_signing_up));
120+
SimplenoteProgressDialogFragment.newInstance(getString(R.string.simperium_dialog_progress_signing_up));
121121
progressDialogFragment.setStyle(DialogFragment.STYLE_NO_TITLE, R.style.Simperium);
122-
progressDialogFragment.show(requireFragmentManager(), ProgressDialogFragment.TAG);
122+
progressDialogFragment.show(requireFragmentManager(), SimplenoteProgressDialogFragment.TAG);
123123
}
124124

125125
private void hideDialogProgress() {

Simplenote/src/main/java/com/automattic/simplenote/authentication/SimplenoteAuthenticationActivity.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424
import com.automattic.simplenote.Simplenote;
2525
import com.automattic.simplenote.analytics.AnalyticsTracker;
2626
import com.automattic.simplenote.utils.IntentUtils;
27+
import com.automattic.simplenote.utils.SimplenoteProgressDialogFragment;
2728
import com.automattic.simplenote.utils.StrUtils;
2829
import com.automattic.simplenote.utils.SystemBarUtils;
2930
import com.automattic.simplenote.utils.WordPressUtils;
3031
import com.automattic.simplenote.viewmodels.MagicLinkUiState;
3132
import com.automattic.simplenote.viewmodels.CompleteMagicLinkViewModel;
3233
import com.simperium.android.AuthenticationActivity;
33-
import com.simperium.android.ProgressDialogFragment;
3434

3535
import net.openid.appauth.AuthorizationException;
3636
import net.openid.appauth.AuthorizationRequest;
@@ -65,34 +65,34 @@ public class SimplenoteAuthenticationActivity extends AuthenticationActivity {
6565
@Override
6666
public void onCreate(Bundle savedInstanceState) {
6767
super.onCreate(savedInstanceState);
68-
68+
6969
// Setup edge-to-edge display only on Android 15+ to avoid breaking existing theming
7070
// Since this extends Simperium's AuthenticationActivity, we need to be conservative
7171
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
7272
WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
7373
// Use auto-theming to properly handle dark mode
74-
boolean isLightTheme = (getResources().getConfiguration().uiMode & android.content.res.Configuration.UI_MODE_NIGHT_MASK)
74+
boolean isLightTheme = (getResources().getConfiguration().uiMode & android.content.res.Configuration.UI_MODE_NIGHT_MASK)
7575
!= android.content.res.Configuration.UI_MODE_NIGHT_YES;
7676
SystemBarUtils.setSystemBarsAppearance(this, isLightTheme, isLightTheme);
77-
77+
7878
// Apply navigation bar insets to avoid button overlap with 3-button navigation
7979
ViewCompat.setOnApplyWindowInsetsListener(findViewById(android.R.id.content), (v, windowInsets) -> {
8080
Insets systemBars = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
81-
81+
8282
// Apply bottom padding to avoid navigation bar overlap
8383
v.setPadding(
8484
v.getPaddingLeft(),
8585
v.getPaddingTop(),
8686
v.getPaddingRight(),
8787
systemBars.bottom
8888
);
89-
89+
9090
return WindowInsetsCompat.CONSUMED;
9191
});
9292
}
9393

9494
final Intent intent = getIntent();
95-
95+
9696
final boolean isMagicLink = intent.getBooleanExtra(KEY_IS_MAGIC_LINK, false);
9797
final String authKey = intent.getStringExtra(KEY_MAGIC_LINK_AUTH_KEY);
9898
final String authCode = intent.getStringExtra(KEY_MAGIC_LINK_AUTH_CODE);
@@ -245,24 +245,24 @@ protected void onRestoreInstanceState(Bundle savedInstanceState) {
245245
}
246246

247247
private void showLoadingDialog(@StringRes int stringRes) {
248-
final Fragment fragment = getSupportFragmentManager().findFragmentByTag(ProgressDialogFragment.TAG);
248+
final Fragment fragment = getSupportFragmentManager().findFragmentByTag(SimplenoteProgressDialogFragment.TAG);
249249
if (fragment == null) {
250-
final ProgressDialogFragment progressDialogFragment = ProgressDialogFragment.newInstance(getString(stringRes));
250+
final SimplenoteProgressDialogFragment progressDialogFragment = SimplenoteProgressDialogFragment.newInstance(getString(stringRes));
251251
progressDialogFragment.setStyle(DialogFragment.STYLE_NO_TITLE, R.style.Simperium);
252-
progressDialogFragment.show(getSupportFragmentManager(), ProgressDialogFragment.TAG);
252+
progressDialogFragment.show(getSupportFragmentManager(), SimplenoteProgressDialogFragment.TAG);
253253
}
254254
}
255255

256256
private void hideDialog() {
257-
final Fragment fragment = getSupportFragmentManager().findFragmentByTag(ProgressDialogFragment.TAG);
257+
final Fragment fragment = getSupportFragmentManager().findFragmentByTag(SimplenoteProgressDialogFragment.TAG);
258258
if (fragment != null) {
259259
try {
260-
final ProgressDialogFragment progressDialogFragment = (ProgressDialogFragment) fragment;
260+
final SimplenoteProgressDialogFragment progressDialogFragment = (SimplenoteProgressDialogFragment) fragment;
261261
if (!progressDialogFragment.isHidden()) {
262262
progressDialogFragment.dismiss();
263263
}
264264
} catch (final ClassCastException e) {
265-
Log.e(TAG, "We have a class other than ProgressDialogFragment", e);
265+
Log.e(TAG, "We have a class other than SimplenoteProgressDialogFragment", e);
266266
}
267267
}
268268
}

Simplenote/src/main/java/com/automattic/simplenote/authentication/SimplenoteSignupActivity.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@
1111
import androidx.fragment.app.FragmentManager;
1212

1313
import com.automattic.simplenote.R;
14+
import com.automattic.simplenote.ThemedAppCompatActivity;
1415
import com.automattic.simplenote.authentication.magiclink.MagicLinkConfirmationFragment;
1516
import com.automattic.simplenote.utils.SystemBarUtils;
1617

1718
import dagger.hilt.android.AndroidEntryPoint;
1819

1920
@AndroidEntryPoint
20-
public class SimplenoteSignupActivity extends AppCompatActivity {
21+
public class SimplenoteSignupActivity extends ThemedAppCompatActivity {
2122
public final static String SIGNUP_FRAGMENT_TAG = "signup";
2223

2324
// Used to differentiate between sign in and sign up in the sign in activity
@@ -46,7 +47,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
4647
final boolean isSignUp = !getIntent().getBooleanExtra(KEY_IS_LOGIN, false);
4748
initContainer(isSignUp);
4849
initToolbar(isSignUp);
49-
50+
5051
// Setup edge-to-edge display with proper WindowInsets handling
5152
// Use auto-theming to properly handle status bar appearance based on theme
5253
SystemBarUtils.setupEdgeToEdgeWithAutoTheming(

Simplenote/src/main/java/com/automattic/simplenote/authentication/magiclink/MagicLinkConfirmationFragment.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ import com.automattic.simplenote.Simplenote
1818
import com.automattic.simplenote.authentication.SignInFragment
1919
import com.automattic.simplenote.utils.HtmlCompat
2020
import com.automattic.simplenote.utils.NetworkUtils
21+
import com.automattic.simplenote.utils.SimplenoteProgressDialogFragment
2122
import com.automattic.simplenote.viewmodels.CompleteMagicLinkViewModel
2223
import com.automattic.simplenote.viewmodels.MagicLinkUiState
23-
import com.simperium.android.ProgressDialogFragment
2424
import dagger.hilt.android.AndroidEntryPoint
2525
import javax.inject.Inject
2626

@@ -29,7 +29,7 @@ class MagicLinkConfirmationFragment : Fragment() {
2929

3030
@Inject lateinit var simplenote: Simplenote
3131

32-
private var progressDialogFragment: ProgressDialogFragment? = null
32+
private var progressDialogFragment: SimplenoteProgressDialogFragment? = null
3333

3434
private var codeEditText: EditText? = null
3535
private var actionCodeButton: Button? = null
@@ -124,9 +124,9 @@ class MagicLinkConfirmationFragment : Fragment() {
124124

125125
private fun showProgressDialog(label: String) {
126126
progressDialogFragment =
127-
ProgressDialogFragment.newInstance(label)
127+
SimplenoteProgressDialogFragment.newInstance(label)
128128
progressDialogFragment?.setStyle(DialogFragment.STYLE_NO_TITLE, R.style.Simperium)
129-
progressDialogFragment?.show(requireFragmentManager(), ProgressDialogFragment.TAG)
129+
progressDialogFragment?.show(requireFragmentManager(), SimplenoteProgressDialogFragment.TAG)
130130
}
131131

132132
private fun hideDialogProgress() {

Simplenote/src/main/res/drawable/ic_simplenote_blue_24dp.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
android:viewportWidth="24">
99

1010
<path
11-
android:fillColor="@color/blue"
11+
android:fillColor="@color/authentication_logo"
1212
android:pathData="M24,12c0-6.3-5-11.7-10.9-12C11.9,0,10.7,0.3,9.8,1C8.9,1.8,8.3,2.9,8.2,4.1c-0.2,2.7,2.2,4.3,4.5,5c5.6,1.6,8.9,5.6,8.6,10.5C23,17.5,24,14.9,24,12L24,12z M11.5,13.7c-5.3-1.5-8.4-5.4-8-10c0-0.1,0-0.1,0-0.2C1.3,5.7,0,8.7,0,12c0,6.3,5.1,11.8,11.1,12c1.3,0,2.6-0.3,3.6-1.2c1-0.9,1.7-2.1,1.8-3.5C16.9,15.7,13.5,14.3,11.5,13.7L11.5,13.7z" >
1313
</path>
1414

Simplenote/src/main/res/layout/activity_signup.xml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22

33
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
4-
xmlns:app="http://schemas.android.com/apk/res-auto"
54
xmlns:tools="http://schemas.android.com/tools"
65
android:id="@+id/main"
76
android:layout_width="match_parent"
@@ -12,13 +11,8 @@
1211
<androidx.appcompat.widget.Toolbar
1312
android:id="@+id/toolbar"
1413
android:layout_width="match_parent"
15-
android:layout_height="?attr/actionBarSize"
16-
android:background="?attr/toolbarColor"
14+
android:layout_height="wrap_content"
1715
android:elevation="0dp"
18-
app:titleTextColor="@color/text_title"
19-
app:navigationIconTint="@color/text_title"
20-
app:popupTheme="@style/ThemeOverlay.MaterialComponents"
21-
app:theme="@style/ThemeOverlay.MaterialComponents"
2216
tools:layout_height="wrap_content" />
2317

2418
<FrameLayout

0 commit comments

Comments
 (0)