Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Simplenote/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,10 @@

<activity
android:name=".authentication.SimplenoteSignupActivity"
android:theme="@style/SignUpOverride" />
android:theme="@style/Style.Authentication" />

<activity android:name=".authentication.NewCredentialsActivity"
android:theme="@style/SignUpOverride"/>
android:theme="@style/Style.Authentication"/>

<activity
android:name="com.automattic.simplenote.StyleActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
import com.automattic.simplenote.utils.PrefUtils;
import com.automattic.simplenote.utils.SimplenoteProgressDialogFragment;
import com.simperium.Simperium;
import com.simperium.android.ProgressDialogFragment;
import com.simperium.client.Bucket;
import com.simperium.client.BucketObjectMissingException;
import com.simperium.client.BucketObjectNameInvalid;
Expand Down Expand Up @@ -397,7 +396,7 @@ private void showProgressDialogDeleteAccount() {
}

mProgressDialogFragment = SimplenoteProgressDialogFragment.newInstance(getString(R.string.requesting_message));
mProgressDialogFragment.show(activity.getSupportFragmentManager(), ProgressDialogFragment.TAG);
mProgressDialogFragment.show(activity.getSupportFragmentManager(), SimplenoteProgressDialogFragment.TAG);
}

private void closeProgressDialogDeleteAccount() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ import androidx.fragment.app.DialogFragment
import androidx.fragment.app.Fragment
import com.automattic.simplenote.R
import com.automattic.simplenote.authentication.magiclink.MagicLinkConfirmationFragment
import com.automattic.simplenote.utils.SimplenoteProgressDialogFragment
import com.google.android.material.textfield.TextInputLayout
import com.simperium.android.ProgressDialogFragment

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

private var progressDialogFragment: ProgressDialogFragment? = null
private var progressDialogFragment: SimplenoteProgressDialogFragment? = null

private var emailField: EditText? = null

Expand Down Expand Up @@ -92,17 +92,17 @@ abstract class MagicLinkableFragment : Fragment() {
}

fun showProgressDialog(label: String) {
val existingProgressFrag = parentFragmentManager.findFragmentByTag(ProgressDialogFragment.TAG)
val existingProgressFrag = parentFragmentManager.findFragmentByTag(SimplenoteProgressDialogFragment.TAG)
if (existingProgressFrag == null) {
progressDialogFragment =
ProgressDialogFragment.newInstance(label)
SimplenoteProgressDialogFragment.newInstance(label)
progressDialogFragment?.setStyle(DialogFragment.STYLE_NO_TITLE, R.style.Simperium)
progressDialogFragment?.show(requireFragmentManager(), ProgressDialogFragment.TAG)
progressDialogFragment?.show(requireFragmentManager(), SimplenoteProgressDialogFragment.TAG)
}
}

protected fun hideDialogProgress() {
val existingProgressFrag = progressDialogFragment ?: (parentFragmentManager.findFragmentByTag(ProgressDialogFragment.TAG) as ProgressDialogFragment?)
val existingProgressFrag = progressDialogFragment ?: (parentFragmentManager.findFragmentByTag(SimplenoteProgressDialogFragment.TAG) as SimplenoteProgressDialogFragment?)
existingProgressFrag?.let {
if (!it.isHidden) {
it.dismiss()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,18 @@ import androidx.appcompat.widget.AppCompatButton
import androidx.appcompat.widget.Toolbar
import androidx.core.content.ContextCompat
import com.automattic.simplenote.R
import com.automattic.simplenote.ThemedAppCompatActivity
import com.automattic.simplenote.utils.AccountNetworkUtils
import com.automattic.simplenote.utils.AccountVerificationEmailHandler
import com.automattic.simplenote.utils.AppLog
import com.automattic.simplenote.utils.HtmlCompat
import com.automattic.simplenote.utils.SimplenoteProgressDialogFragment
import com.automattic.simplenote.utils.SystemBarUtils
import com.google.android.material.color.MaterialColors
import com.automattic.simplenote.utils.getColorStr
import com.google.android.material.textfield.TextInputLayout
import com.simperium.Simperium
import com.simperium.SimperiumNotInitializedException
import com.simperium.android.CredentialsActivity
import com.simperium.android.ProgressDialogFragment
import com.simperium.client.AuthException
import com.simperium.client.AuthException.FailureType
import com.simperium.client.AuthProvider
Expand All @@ -48,14 +49,14 @@ import java.io.UnsupportedEncodingException
import java.net.URLEncoder
import java.util.regex.Pattern

open class NewCredentialsActivity : AppCompatActivity() {
open class NewCredentialsActivity : ThemedAppCompatActivity() {
companion object {
val PATTERN_NEWLINES_RETURNS_TABS: Pattern = Pattern.compile("[\n\r\t]")
const val PREF_HIDE_EMAIL_FIELD: String = "pref_hide_email_field"
const val PASSWORD_LENGTH_LOGIN: Int = 4
const val PASSWORD_LENGTH_MINIMUM: Int = 8
}
private var progressDialogFragment: ProgressDialogFragment? = null
private var progressDialogFragment: SimplenoteProgressDialogFragment? = null
private var button: AppCompatButton? = null
private var simperium: Simperium? = null
private var missingEmailMessage: TextView? = null
Expand Down Expand Up @@ -155,8 +156,7 @@ open class NewCredentialsActivity : AppCompatActivity() {
missingEmailMessage?.visibility = View.VISIBLE
inputEmail?.visibility = View.GONE

val colorLink: String =
Integer.toHexString(MaterialColors.getColor(missingEmailMessage!!, R.attr.onMainBackgroundColor) and 16777215)
val colorLink = getColorStr(R.color.text_link)
val boldEmail = "<b><font color=\"#${colorLink}\">${email}<font/></b>"
missingEmailMessage?.text = HtmlCompat.fromHtml(
String.format(
Expand Down Expand Up @@ -488,8 +488,8 @@ open class NewCredentialsActivity : AppCompatActivity() {
val password = this.getEditTextString(inputPassword!!)
if (this.isValidPasswordLogin()) {
this.progressDialogFragment =
ProgressDialogFragment.newInstance(this.getString(R.string.simperium_dialog_progress_logging_in))
progressDialogFragment?.show(this.supportFragmentManager, ProgressDialogFragment.TAG)
SimplenoteProgressDialogFragment.newInstance(this.getString(R.string.simperium_dialog_progress_logging_in))
progressDialogFragment?.show(this.supportFragmentManager, SimplenoteProgressDialogFragment.TAG)
simperium?.authorizeUser(email, password, this.authListener)
} else {
this.showDialogError(this.getString(R.string.simperium_dialog_message_password_login, PASSWORD_LENGTH_LOGIN))
Expand All @@ -500,10 +500,10 @@ open class NewCredentialsActivity : AppCompatActivity() {
val email = this.getEditTextString(inputEmail)
val password = this.getEditTextString(inputPassword)
if (this.isValidPassword(email, password)) {
this.progressDialogFragment = ProgressDialogFragment.newInstance(
this.progressDialogFragment = SimplenoteProgressDialogFragment.newInstance(
this.getString(R.string.simperium_dialog_progress_signing_up)
)
progressDialogFragment?.show(this.supportFragmentManager, ProgressDialogFragment.TAG)
progressDialogFragment?.show(this.supportFragmentManager, SimplenoteProgressDialogFragment.TAG)
simperium?.createUser(email, password, this.authListener)
} else {
this.showDialogError(this.getString(R.string.simperium_dialog_message_password, PASSWORD_LENGTH_MINIMUM))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
import com.automattic.simplenote.utils.BrowserUtils;
import com.automattic.simplenote.utils.DisplayUtils;
import com.automattic.simplenote.utils.NetworkUtils;
import com.automattic.simplenote.utils.SimplenoteProgressDialogFragment;
import com.google.android.material.textfield.TextInputLayout;
import com.simperium.android.ProgressDialogFragment;
import com.simperium.util.Logger;

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

private ProgressDialogFragment progressDialogFragment;
private SimplenoteProgressDialogFragment progressDialogFragment;

@Nullable
@Override
Expand Down Expand Up @@ -117,9 +117,9 @@ public void onClick(View v) {

private void showProgressDialog() {
progressDialogFragment =
ProgressDialogFragment.newInstance(getString(R.string.simperium_dialog_progress_signing_up));
SimplenoteProgressDialogFragment.newInstance(getString(R.string.simperium_dialog_progress_signing_up));
progressDialogFragment.setStyle(DialogFragment.STYLE_NO_TITLE, R.style.Simperium);
progressDialogFragment.show(requireFragmentManager(), ProgressDialogFragment.TAG);
progressDialogFragment.show(requireFragmentManager(), SimplenoteProgressDialogFragment.TAG);
}

private void hideDialogProgress() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
import com.automattic.simplenote.Simplenote;
import com.automattic.simplenote.analytics.AnalyticsTracker;
import com.automattic.simplenote.utils.IntentUtils;
import com.automattic.simplenote.utils.SimplenoteProgressDialogFragment;
import com.automattic.simplenote.utils.StrUtils;
import com.automattic.simplenote.utils.SystemBarUtils;
import com.automattic.simplenote.utils.WordPressUtils;
import com.automattic.simplenote.viewmodels.MagicLinkUiState;
import com.automattic.simplenote.viewmodels.CompleteMagicLinkViewModel;
import com.simperium.android.AuthenticationActivity;
import com.simperium.android.ProgressDialogFragment;

import net.openid.appauth.AuthorizationException;
import net.openid.appauth.AuthorizationRequest;
Expand Down Expand Up @@ -65,34 +65,34 @@ public class SimplenoteAuthenticationActivity extends AuthenticationActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

// Setup edge-to-edge display only on Android 15+ to avoid breaking existing theming
// Since this extends Simperium's AuthenticationActivity, we need to be conservative
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
// Use auto-theming to properly handle dark mode
boolean isLightTheme = (getResources().getConfiguration().uiMode & android.content.res.Configuration.UI_MODE_NIGHT_MASK)
boolean isLightTheme = (getResources().getConfiguration().uiMode & android.content.res.Configuration.UI_MODE_NIGHT_MASK)
!= android.content.res.Configuration.UI_MODE_NIGHT_YES;
SystemBarUtils.setSystemBarsAppearance(this, isLightTheme, isLightTheme);

// Apply navigation bar insets to avoid button overlap with 3-button navigation
ViewCompat.setOnApplyWindowInsetsListener(findViewById(android.R.id.content), (v, windowInsets) -> {
Insets systemBars = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());

// Apply bottom padding to avoid navigation bar overlap
v.setPadding(
v.getPaddingLeft(),
v.getPaddingTop(),
v.getPaddingRight(),
systemBars.bottom
);

return WindowInsetsCompat.CONSUMED;
});
}

final Intent intent = getIntent();

final boolean isMagicLink = intent.getBooleanExtra(KEY_IS_MAGIC_LINK, false);
final String authKey = intent.getStringExtra(KEY_MAGIC_LINK_AUTH_KEY);
final String authCode = intent.getStringExtra(KEY_MAGIC_LINK_AUTH_CODE);
Expand Down Expand Up @@ -245,24 +245,24 @@ protected void onRestoreInstanceState(Bundle savedInstanceState) {
}

private void showLoadingDialog(@StringRes int stringRes) {
final Fragment fragment = getSupportFragmentManager().findFragmentByTag(ProgressDialogFragment.TAG);
final Fragment fragment = getSupportFragmentManager().findFragmentByTag(SimplenoteProgressDialogFragment.TAG);
if (fragment == null) {
final ProgressDialogFragment progressDialogFragment = ProgressDialogFragment.newInstance(getString(stringRes));
final SimplenoteProgressDialogFragment progressDialogFragment = SimplenoteProgressDialogFragment.newInstance(getString(stringRes));
progressDialogFragment.setStyle(DialogFragment.STYLE_NO_TITLE, R.style.Simperium);
progressDialogFragment.show(getSupportFragmentManager(), ProgressDialogFragment.TAG);
progressDialogFragment.show(getSupportFragmentManager(), SimplenoteProgressDialogFragment.TAG);
}
}

private void hideDialog() {
final Fragment fragment = getSupportFragmentManager().findFragmentByTag(ProgressDialogFragment.TAG);
final Fragment fragment = getSupportFragmentManager().findFragmentByTag(SimplenoteProgressDialogFragment.TAG);
if (fragment != null) {
try {
final ProgressDialogFragment progressDialogFragment = (ProgressDialogFragment) fragment;
final SimplenoteProgressDialogFragment progressDialogFragment = (SimplenoteProgressDialogFragment) fragment;
if (!progressDialogFragment.isHidden()) {
progressDialogFragment.dismiss();
}
} catch (final ClassCastException e) {
Log.e(TAG, "We have a class other than ProgressDialogFragment", e);
Log.e(TAG, "We have a class other than SimplenoteProgressDialogFragment", e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
import androidx.fragment.app.FragmentManager;

import com.automattic.simplenote.R;
import com.automattic.simplenote.ThemedAppCompatActivity;
import com.automattic.simplenote.authentication.magiclink.MagicLinkConfirmationFragment;
import com.automattic.simplenote.utils.SystemBarUtils;

import dagger.hilt.android.AndroidEntryPoint;

@AndroidEntryPoint
public class SimplenoteSignupActivity extends AppCompatActivity {
public class SimplenoteSignupActivity extends ThemedAppCompatActivity {
public final static String SIGNUP_FRAGMENT_TAG = "signup";

// Used to differentiate between sign in and sign up in the sign in activity
Expand Down Expand Up @@ -46,7 +47,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
final boolean isSignUp = !getIntent().getBooleanExtra(KEY_IS_LOGIN, false);
initContainer(isSignUp);
initToolbar(isSignUp);

// Setup edge-to-edge display with proper WindowInsets handling
// Use auto-theming to properly handle status bar appearance based on theme
SystemBarUtils.setupEdgeToEdgeWithAutoTheming(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import com.automattic.simplenote.Simplenote
import com.automattic.simplenote.authentication.SignInFragment
import com.automattic.simplenote.utils.HtmlCompat
import com.automattic.simplenote.utils.NetworkUtils
import com.automattic.simplenote.utils.SimplenoteProgressDialogFragment
import com.automattic.simplenote.viewmodels.CompleteMagicLinkViewModel
import com.automattic.simplenote.viewmodels.MagicLinkUiState
import com.simperium.android.ProgressDialogFragment
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject

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

@Inject lateinit var simplenote: Simplenote

private var progressDialogFragment: ProgressDialogFragment? = null
private var progressDialogFragment: SimplenoteProgressDialogFragment? = null

private var codeEditText: EditText? = null
private var actionCodeButton: Button? = null
Expand Down Expand Up @@ -124,9 +124,9 @@ class MagicLinkConfirmationFragment : Fragment() {

private fun showProgressDialog(label: String) {
progressDialogFragment =
ProgressDialogFragment.newInstance(label)
SimplenoteProgressDialogFragment.newInstance(label)
progressDialogFragment?.setStyle(DialogFragment.STYLE_NO_TITLE, R.style.Simperium)
progressDialogFragment?.show(requireFragmentManager(), ProgressDialogFragment.TAG)
progressDialogFragment?.show(requireFragmentManager(), SimplenoteProgressDialogFragment.TAG)
}

private fun hideDialogProgress() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
android:viewportWidth="24">

<path
android:fillColor="@color/blue"
android:fillColor="@color/authentication_logo"
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" >
</path>

Expand Down
8 changes: 1 addition & 7 deletions Simplenote/src/main/res/layout/activity_signup.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout 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/main"
android:layout_width="match_parent"
Expand All @@ -12,13 +11,8 @@
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/toolbarColor"
android:layout_height="wrap_content"
android:elevation="0dp"
app:titleTextColor="@color/text_title"
app:navigationIconTint="@color/text_title"
app:popupTheme="@style/ThemeOverlay.MaterialComponents"
app:theme="@style/ThemeOverlay.MaterialComponents"
tools:layout_height="wrap_content" />

<FrameLayout
Expand Down
2 changes: 1 addition & 1 deletion Simplenote/src/main/res/layout/authentication_fancy_or.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ android:layout_marginVertical="10dp">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/magic_link_login_with_wordpress_or_break"
android:textColor="?attr/onMainBackgroundColor"
android:textColor="@color/text_subtitle"
android:paddingHorizontal="5dp"
/>
<View
Expand Down
Loading