Skip to content

Commit

Permalink
add "Create Account" button
Browse files Browse the repository at this point in the history
  • Loading branch information
adbenitez committed Feb 7, 2024
1 parent 101b09a commit d7219ed
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
14 changes: 12 additions & 2 deletions res/layout/welcome_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,24 @@

<Button
style="@style/ButtonPrimary"
android:id="@+id/login_button"
android:id="@+id/register_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="24dp"
android:paddingRight="24dp"
android:layout_marginBottom="16dp"
android:background="@drawable/button_bg"
android:text="@string/login_header"/>
android:text="@string/register_title"/>

<Button
style="@style/ButtonSecondary"
android:id="@+id/login_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="24dp"
android:paddingRight="24dp"
android:layout_marginBottom="16dp"
android:text="@string/login_title"/>

<Button
style="@style/ButtonSecondary"
Expand Down
2 changes: 2 additions & 0 deletions res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@
<!-- welcome and login -->
<string name="welcome_chat_over_email">Charla por correo electr贸nico.</string>
<string name="scan_invitation_code">Escanear c贸digo de invitaci贸n</string>
<string name="register_title">Crear cuenta</string>
<string name="login_title">Iniciar sesi贸n</string>
<string name="login_header">Inicie sesi贸n en su servidor</string>
<string name="login_explain">Iniciar sesi贸n con una cuenta de correo existente</string>
Expand Down Expand Up @@ -942,6 +943,7 @@
<string name="qrshow_join_contact_no_connection_toast">No hay conexi贸n a Internet, no se puede configurar con c贸digo QR.</string>
<string name="qraccount_ask_create_and_login">驴Crear una nueva direcci贸n de correo en \"%1$s\" e ingresar all铆?</string>
<string name="qraccount_ask_create_and_login_another">驴Crear una nueva direcci贸n de correo en \"%1$s\" e ingresar ah铆?\n\nTu cuenta existente no ser谩 eliminada. Usar el 铆tem \"Cambiar cuenta\" para cambiar entre tus cuentas.</string>
<string name="register_hint">驴Crear una nueva direcci贸n de correo en \"%1$s\" e ingresar ah铆?\n\nSi lo que desea es iniciar sesi贸n con una de sus cuentas de correo existente, usa el bot贸n \"Iniciar sesi贸n\"</string>
<!-- deprecated, use set_name_and_avatar_explain instead -->
<string name="qraccount_success_enter_name">Ingreso satisfactorio鈥攖u direcci贸n de email es %1$s\n\nSi lo deseas, puedes ingresar un nombre y una imagen de perfil, que ser谩 mostrada a los usuarios que escribas.</string>
<string name="set_name_and_avatar_explain">Establece un nombre que tus contactos puedan reconocer. Tambi茅n puedes establecer una foto de perfil.</string>
Expand Down
2 changes: 2 additions & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@
<!-- welcome and login -->
<string name="welcome_chat_over_email">Chat over E-Mail.</string>
<string name="scan_invitation_code">Scan Invitation Code</string>
<string name="register_title">Create Account</string>
<string name="login_title">Log In</string>
<string name="login_header">Log into your E-Mail Account</string>
<string name="login_explain">Log in with an existing e-mail account</string>
Expand Down Expand Up @@ -930,6 +931,7 @@
<string name="qrshow_join_contact_no_connection_toast">No internet connection, can\'t perform QR code setup.</string>
<string name="qraccount_ask_create_and_login">Create new e-mail address on \"%1$s\" and log in there?</string>
<string name="qraccount_ask_create_and_login_another">Create new e-mail address on \"%1$s\" and log in there?\n\nYour existing account will not be deleted. Use the \"Switch Account\" item to switch between your accounts.</string>
<string name="register_hint">Create new e-mail address on \"%1$s\" and log in there?\n\nIf what you want is to log in using your existing email account, use the \"Log In\" button instead.</string>
<!-- deprecated, use set_name_and_avatar_explain instead -->
<string name="qraccount_success_enter_name">Login successful鈥攜our e-mail address is %1$s\n\nIf you like, you can now enter a name and an profile image that will be displayed to people you write to.</string>
<string name="set_name_and_avatar_explain">Set a name that your contacts will recognize. You can also set a profile image.</string>
Expand Down
14 changes: 14 additions & 0 deletions src/org/thoughtcrime/securesms/WelcomeActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,25 @@ public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.welcome_activity);

Button registerButton = findViewById(R.id.register_button);
Button loginButton = findViewById(R.id.login_button);
View addAsSecondDeviceButton = findViewById(R.id.add_as_second_device_button);
View scanQrButton = findViewById(R.id.scan_qr_button);
View backupButton = findViewById(R.id.backup_button);

registerButton.setOnClickListener((view) -> {
String qrAccount = "dcaccount:https://nine.testrun.org/new";
String domain = dcContext.checkQr(qrAccount).getText1();
new AlertDialog.Builder(this)
.setMessage(getString(R.string.register_hint, domain))
.setCancelable(false)
.setNegativeButton(R.string.cancel, null)
.setPositiveButton(R.string.ok, (dialog, which) -> {
manualConfigure = false;
startQrAccountCreation(qrAccount);
})
.show();
});
loginButton.setOnClickListener((view) -> startRegistrationActivity());
addAsSecondDeviceButton.setOnClickListener((view) -> startAddAsSecondDeviceActivity());
scanQrButton.setOnClickListener((view) -> startRegistrationQrActivity());
Expand Down

0 comments on commit d7219ed

Please sign in to comment.