mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
1 - add gmail-specific hint in RegistrationActivity
This commit is contained in:
@@ -34,20 +34,21 @@
|
||||
android:background="@color/signal_primary"
|
||||
android:gravity="center"
|
||||
android:padding="16dp"
|
||||
android:text="Login to Delta Chat"
|
||||
android:text="@string/RegistrationActivity_header"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sub_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/signal_primary"
|
||||
android:gravity="center"
|
||||
android:paddingBottom="48dp"
|
||||
android:text="For known email providers additional settings are setup automatically.
|
||||
Sometimes IMAP needs to be enabled in the web frontend. Consult your email provider or friends for help."
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:text="@string/RegistrationActivity_subheader"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintTop_toBottomOf="@id/header" />
|
||||
|
||||
@@ -83,7 +84,7 @@ Sometimes IMAP needs to be enabled in the web frontend. Consult your email provi
|
||||
android:id="@+id/email_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="Email address"
|
||||
android:hint="@string/email_address"
|
||||
android:inputType="textEmailAddress" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
@@ -101,7 +102,7 @@ Sometimes IMAP needs to be enabled in the web frontend. Consult your email provi
|
||||
android:id="@+id/password_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="Password"
|
||||
android:hint="@string/password"
|
||||
android:inputType="textPassword" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
@@ -119,7 +120,7 @@ Sometimes IMAP needs to be enabled in the web frontend. Consult your email provi
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:gravity="center"
|
||||
android:text="Advanced"
|
||||
android:text="@string/advanced"
|
||||
android:textColor="@color/blue_400"
|
||||
app:layout_constraintEnd_toStartOf="@+id/advanced_icon"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
@@ -130,6 +131,7 @@ Sometimes IMAP needs to be enabled in the web frontend. Consult your email provi
|
||||
android:id="@+id/advanced_icon"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:contentDescription="@string/icon"
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/ic_menu_remove_holo_light"
|
||||
android:tint="@color/blue_400"
|
||||
@@ -144,7 +146,7 @@ Sometimes IMAP needs to be enabled in the web frontend. Consult your email provi
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="24dp"
|
||||
android:gravity="center"
|
||||
android:text="Inbox"
|
||||
android:text="@string/RegistrationActivity_inbox"
|
||||
app:layout_constraintStart_toStartOf="@id/guideline_root_start"
|
||||
app:layout_constraintTop_toBottomOf="@id/advanced_text" />
|
||||
|
||||
@@ -160,7 +162,7 @@ Sometimes IMAP needs to be enabled in the web frontend. Consult your email provi
|
||||
android:id="@+id/imap_login_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="IMAP login-name"
|
||||
android:hint="@string/RegistrationActivity_imap_login"
|
||||
android:inputType="text" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
@@ -178,7 +180,7 @@ Sometimes IMAP needs to be enabled in the web frontend. Consult your email provi
|
||||
android:id="@+id/imap_server_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="IMAP server"
|
||||
android:hint="@string/RegistrationActivity_imap_server"
|
||||
android:inputType="number" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
@@ -196,7 +198,7 @@ Sometimes IMAP needs to be enabled in the web frontend. Consult your email provi
|
||||
android:id="@+id/imap_port_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="IMAP port"
|
||||
android:hint="@string/RegistrationActivity_imap_port"
|
||||
android:inputType="number" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
@@ -206,7 +208,7 @@ Sometimes IMAP needs to be enabled in the web frontend. Consult your email provi
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="IMAP Security"
|
||||
android:text="@string/RegistrationActivity_imap_security"
|
||||
app:layout_constraintEnd_toEndOf="@id/guideline_root_end"
|
||||
app:layout_constraintStart_toStartOf="@id/guideline_root_start"
|
||||
app:layout_constraintTop_toBottomOf="@id/imap_port" />
|
||||
@@ -231,7 +233,7 @@ Sometimes IMAP needs to be enabled in the web frontend. Consult your email provi
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="24dp"
|
||||
android:gravity="center"
|
||||
android:text="Outbox"
|
||||
android:text="@string/RegistrationActivity_outbox"
|
||||
app:layout_constraintStart_toStartOf="@id/guideline_root_start"
|
||||
app:layout_constraintTop_toBottomOf="@id/outbox_view_spacer_top" />
|
||||
|
||||
@@ -247,7 +249,7 @@ Sometimes IMAP needs to be enabled in the web frontend. Consult your email provi
|
||||
android:id="@+id/smtp_login_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="SMTP login-name"
|
||||
android:hint="@string/RegistrationActivity_smtp_login"
|
||||
android:inputType="textPassword" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
@@ -265,7 +267,7 @@ Sometimes IMAP needs to be enabled in the web frontend. Consult your email provi
|
||||
android:id="@+id/smtp_password_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="SMTP Password"
|
||||
android:hint="@string/RegistrationActivity_smtp_password"
|
||||
android:inputType="textPassword" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
@@ -283,7 +285,7 @@ Sometimes IMAP needs to be enabled in the web frontend. Consult your email provi
|
||||
android:id="@+id/smtp_server_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="SMTP server"
|
||||
android:hint="@string/RegistrationActivity_smtp_server"
|
||||
android:inputType="text" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
@@ -301,7 +303,7 @@ Sometimes IMAP needs to be enabled in the web frontend. Consult your email provi
|
||||
android:id="@+id/smtp_port_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="SMTP port"
|
||||
android:hint="@string/RegistrationActivity_smtp_port"
|
||||
android:inputType="number" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
@@ -311,7 +313,7 @@ Sometimes IMAP needs to be enabled in the web frontend. Consult your email provi
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="SMTP Security"
|
||||
android:text="@string/RegistrationActivity_smtp_security"
|
||||
app:layout_constraintEnd_toEndOf="@id/guideline_root_end"
|
||||
app:layout_constraintStart_toStartOf="@id/guideline_root_start"
|
||||
app:layout_constraintTop_toBottomOf="@id/smtp_port" />
|
||||
|
||||
+42
-15
@@ -1370,20 +1370,47 @@
|
||||
<string name="recipient_preferences__about">About</string>
|
||||
<!-- EOF -->
|
||||
|
||||
<!--Intro view-->
|
||||
<string name="Intro1Headline">Delta Chat</string>
|
||||
<string name="Intro1Message">The messenger with the <b>broadest audience</b> in the world. <b>Free</b> and <b>independent</b>.</string>
|
||||
<string name="Intro2Headline">Independent</string>
|
||||
<string name="Intro2Message"><b>There is no Delta Chat server.</b> The app only uses your mail server.</string>
|
||||
<string name="Intro3Headline">Fast</string>
|
||||
<string name="Intro3Message"><b>Push messages</b> in seconds.<br/>Rapid interface.</string>
|
||||
<string name="Intro4Headline">Powerful</string>
|
||||
<string name="Intro4Message"><b>Unlimited</b> chats, images, videos, audio messages and more. Multi-client capable.</string>
|
||||
<string name="Intro5Headline">Free</string>
|
||||
<string name="Intro5Message"><b>Delta Chat</b> is free forever.<br/>Open-source. No ads. No subscription. No vendor lock-in.</string>
|
||||
<string name="Intro6Headline">Encrypted</string>
|
||||
<string name="Intro6Message"><b>Encrypted</b> with all common algorithms. Messages stay on your servers.</string>
|
||||
<string name="Intro7Headline">Trustworthy</string>
|
||||
<string name="Intro7Message"><b>Delta Chat</b> is safe for business use, compatible and standards-based.</string>
|
||||
<string name="WelcomeActivity_intro1_headline">Delta Chat</string>
|
||||
<string name="WelcomeActivity_intro1_message">The messenger with the <b>broadest audience</b> in the world. <b>Free</b> and <b>independent</b>.</string>
|
||||
<string name="WelcomeActivity_intro2_headline">Independent</string>
|
||||
<string name="WelcomeActivity_intro2_message"><b>There is no Delta Chat server.</b> The app only uses your mail server.</string>
|
||||
<string name="WelcomeActivity_intro3_headline">Fast</string>
|
||||
<string name="WelcomeActivity_intro3_message"><b>Push messages</b> in seconds.<br/>Rapid interface.</string>
|
||||
<string name="WelcomeActivity_intro4_headline">Powerful</string>
|
||||
<string name="WelcomeActivity_intro4_message"><b>Unlimited</b> chats, images, videos, audio messages and more. Multi-client capable.</string>
|
||||
<string name="WelcomeActivity_intro5_headline">Free</string>
|
||||
<string name="WelcomeActivity_intro5_message"><b>Delta Chat</b> is free forever.<br/>Open-source. No ads. No subscription. No vendor lock-in.</string>
|
||||
<string name="WelcomeActivity_intro6_headline">Encrypted</string>
|
||||
<string name="WelcomeActivity_intro6_message"><b>Encrypted</b> with all common algorithms. Messages stay on your servers.</string>
|
||||
<string name="WelcomeActivity_intro7_headline">Trustworthy</string>
|
||||
<string name="WelcomeActivity_intro7_message"><b>Delta Chat</b> is safe for business use, compatible and standards-based.</string>
|
||||
|
||||
<string name="RegistrationActivity_header">Login to Delta Chat</string>
|
||||
<string name="RegistrationActivity_subheader">For known email providers additional settings are setup automatically. Sometimes IMAP needs to be enabled in the web frontend. Consult your email provider or friends for help.</string>
|
||||
<string name="RegistrationActivity_inbox">Inbox</string>
|
||||
<string name="RegistrationActivity_imap_login">IMAP login-name</string>
|
||||
<string name="RegistrationActivity_imap_server">IMAP server</string>
|
||||
<string name="RegistrationActivity_imap_port">IMAP port</string>
|
||||
<string name="RegistrationActivity_imap_security">IMAP Security</string>
|
||||
<string name="RegistrationActivity_outbox">Outbox</string>
|
||||
<string name="RegistrationActivity_smtp_login">SMTP login-name</string>
|
||||
<string name="RegistrationActivity_smtp_password">SMTP Password</string>
|
||||
<string name="RegistrationActivity_smtp_server">SMTP server</string>
|
||||
<string name="RegistrationActivity_smtp_port">SMTP port</string>
|
||||
<string name="RegistrationActivity_smtp_security">SMTP Security</string>
|
||||
<string name="RegistrationActivity_dialog_gmail_title">GMail information</string>
|
||||
<string name="RegistrationActivity_dialog_gmail_text">For GMail Accounts you need to create an App-Password if you have 2FA enabled. If this setting is not available, you need to enable Less Secure Apps.</string>
|
||||
<string name="RegistrationActivity_error_mail">Please enter a valid email address</string>
|
||||
<string name="RegistrationActivity_error_server">Please enter a valid server / IP address</string>
|
||||
<string name="RegistrationActivity_error_port">Please enter a valid port (1–65535)</string>
|
||||
<string name="RegistrationActivity_dialog_permission_text">Delta Chat needs access to your contacts and media in order to connect with friends and send files</string>
|
||||
<string name="RegistrationActivity_error_required_fields">Please enter a valid email address and a password</string>
|
||||
|
||||
<!-- Generic and reusable strings -->
|
||||
<string name="email_address">Email address</string>
|
||||
<string name="password">Password</string>
|
||||
<string name="advanced">Advanced</string>
|
||||
<string name="icon">icon</string>
|
||||
<string name="loading">Loading …</string>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -19,6 +19,7 @@ import android.widget.Toast;
|
||||
import com.dd.CircularProgressButton;
|
||||
|
||||
import org.thoughtcrime.securesms.permissions.Permissions;
|
||||
import org.thoughtcrime.securesms.util.Dialogs;
|
||||
|
||||
/**
|
||||
* The register account activity. Prompts ths user for their registration information
|
||||
@@ -46,7 +47,8 @@ public class RegistrationActivity extends BaseActionBarActivity {
|
||||
private Group advancedGroup;
|
||||
private ImageView advancedIcon;
|
||||
private ProgressDialog progressDialog;
|
||||
private TextView subHeaderText;
|
||||
private boolean gmailDialogShown;
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle bundle) {
|
||||
@@ -67,7 +69,6 @@ public class RegistrationActivity extends BaseActionBarActivity {
|
||||
passwordInput = findViewById(R.id.password_text);
|
||||
advancedGroup = findViewById(R.id.advanced_group);
|
||||
advancedIcon = findViewById(R.id.advanced_icon);
|
||||
subHeaderText = findViewById(R.id.sub_header);
|
||||
CircularProgressButton loginButton = findViewById(R.id.register_button);
|
||||
TextView advancedTextView = findViewById(R.id.advanced_text);
|
||||
TextInputEditText imapServerInput = findViewById(R.id.imap_server_text);
|
||||
@@ -104,15 +105,14 @@ public class RegistrationActivity extends BaseActionBarActivity {
|
||||
}
|
||||
|
||||
private void verifyEmail(TextInputEditText view) {
|
||||
String error = "Please enter a valid email address";
|
||||
String error = getString(R.string.RegistrationActivity_error_mail);
|
||||
String email = view.getText().toString();
|
||||
if (!matchesEmailPattern(email)) {
|
||||
view.setError(error);
|
||||
}
|
||||
if (!TextUtils.isEmpty(email) && isGmail(email)) {
|
||||
subHeaderText.setText("For GMail Accounts you need to create an App-Password if you have 2FA enabled. If this setting is not available, you need to enable Less Secure Apps");
|
||||
} else {
|
||||
subHeaderText.setText("For known email providers additional settings are setup automatically. Sometimes IMAP needs to be enabled in the web frontend. Consult your email provider or friends for help.");
|
||||
if (!TextUtils.isEmpty(email) && isGmail(email) && !gmailDialogShown) {
|
||||
gmailDialogShown = true;
|
||||
Dialogs.showInfoDialog(this, getString(R.string.RegistrationActivity_dialog_gmail_title), getString(R.string.RegistrationActivity_dialog_gmail_text));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,11 +121,11 @@ public class RegistrationActivity extends BaseActionBarActivity {
|
||||
}
|
||||
|
||||
private boolean isGmail(String email) {
|
||||
return email != null && (email.contains("@gmail.") || email.contains("@googlemail."));
|
||||
return email != null && (email.toLowerCase().contains("@gmail.") || email.toLowerCase().contains("@googlemail."));
|
||||
}
|
||||
|
||||
private void verifyServer(TextInputEditText view) {
|
||||
String error = "Please enter a valid server / IP address";
|
||||
String error = getString(R.string.RegistrationActivity_error_server);
|
||||
String server = view.getText().toString();
|
||||
if (!TextUtils.isEmpty(server) && !Patterns.DOMAIN_NAME.matcher(server).matches()
|
||||
&& !Patterns.IP_ADDRESS.matcher(server).matches()
|
||||
@@ -135,7 +135,7 @@ public class RegistrationActivity extends BaseActionBarActivity {
|
||||
}
|
||||
|
||||
private void verifyPort(TextInputEditText view) {
|
||||
String error = "Please enter a valid port (1-65535)";
|
||||
String error = getString(R.string.RegistrationActivity_error_port);
|
||||
String portString = view.getText().toString();
|
||||
if (!portString.isEmpty()) {
|
||||
try {
|
||||
@@ -166,14 +166,14 @@ public class RegistrationActivity extends BaseActionBarActivity {
|
||||
.request(Manifest.permission.WRITE_CONTACTS, Manifest.permission.READ_CONTACTS,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE)
|
||||
.ifNecessary()
|
||||
.withRationaleDialog("Delta Chat needs access to your contacts and media in order to connect with friends and send files",
|
||||
.withRationaleDialog(getString(R.string.RegistrationActivity_dialog_permission_text),
|
||||
R.drawable.ic_contacts_white_48dp, R.drawable.ic_folder_white_48dp)
|
||||
.execute();
|
||||
}
|
||||
|
||||
private void onLogin() {
|
||||
if (!verifyRequiredFields()) {
|
||||
Toast.makeText(this, "Please enter a valid email address and a password", Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(this, R.string.RegistrationActivity_error_required_fields, Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
setupConfig();
|
||||
@@ -184,13 +184,11 @@ public class RegistrationActivity extends BaseActionBarActivity {
|
||||
}
|
||||
|
||||
progressDialog = new ProgressDialog(this);
|
||||
progressDialog.setMessage("Loading ...");
|
||||
progressDialog.setMessage(getString(R.string.loading));
|
||||
progressDialog.setCanceledOnTouchOutside(false);
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, "Cancel", (dialog, which) -> stopLoginProcess());
|
||||
progressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getString(android.R.string.cancel), (dialog, which) -> stopLoginProcess());
|
||||
progressDialog.show();
|
||||
|
||||
// TODO start configuration process via bindings
|
||||
}
|
||||
|
||||
private boolean verifyRequiredFields() {
|
||||
|
||||
@@ -34,9 +34,9 @@ public class WelcomeActivity extends BaseActionBarActivity {
|
||||
|
||||
private int icons[] = new int[]{R.drawable.intro1, R.drawable.intro2, R.drawable.intro3, R.drawable.intro4, R.drawable.intro5, R.drawable.intro6, R.drawable.intro7};
|
||||
|
||||
private int titles[] = new int[]{R.string.Intro1Headline, R.string.Intro2Headline, R.string.Intro3Headline, R.string.Intro4Headline, R.string.Intro5Headline, R.string.Intro6Headline, R.string.Intro7Headline};
|
||||
private int titles[] = new int[]{R.string.WelcomeActivity_intro1_headline, R.string.WelcomeActivity_intro2_headline, R.string.WelcomeActivity_intro3_headline, R.string.WelcomeActivity_intro4_headline, R.string.WelcomeActivity_intro5_headline, R.string.WelcomeActivity_intro6_headline, R.string.WelcomeActivity_intro7_headline};
|
||||
|
||||
private int messages[] = new int[]{R.string.Intro1Message, R.string.Intro2Message, R.string.Intro3Message, R.string.Intro4Message, R.string.Intro5Message, R.string.Intro6Message, R.string.Intro7Message};
|
||||
private int messages[] = new int[]{R.string.WelcomeActivity_intro1_message, R.string.WelcomeActivity_intro2_message, R.string.WelcomeActivity_intro3_message, R.string.WelcomeActivity_intro4_message, R.string.WelcomeActivity_intro5_message, R.string.WelcomeActivity_intro6_message, R.string.WelcomeActivity_intro7_message};
|
||||
|
||||
WelcomePagerAdapter(Context context) {
|
||||
this.context = context;
|
||||
|
||||
Reference in New Issue
Block a user