mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Merge pull request #1 from deltachat/master
Updates from the master-root
This commit is contained in:
+11
-2
@@ -147,7 +147,17 @@
|
||||
<activity android:name=".NewConversationActivity"
|
||||
android:theme="@style/TextSecure.LightNoActionBar"
|
||||
android:windowSoftInputMode="stateAlwaysVisible"
|
||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize">
|
||||
|
||||
<intent-filter>
|
||||
<data android:scheme="mailto"/>
|
||||
<action android:name="android.intent.action.VIEW"/>
|
||||
<action android:name="android.intent.action.SENDTO"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<category android:name="android.intent.category.BROWSABLE"/>
|
||||
</intent-filter>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity android:name=".ContactMultiSelectionActivity"
|
||||
android:label="@string/contacts_title"
|
||||
@@ -164,7 +174,6 @@
|
||||
|
||||
<activity android:name=".RegistrationActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/TextSecure.LightNoActionBar"
|
||||
android:windowSoftInputMode="stateUnchanged"
|
||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||
|
||||
|
||||
+1
-1
Submodule jni/messenger-backend updated: b9733fadf4...e7c29efd29
@@ -27,49 +27,37 @@
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_end="16dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/signal_primary"
|
||||
android:gravity="center"
|
||||
android:padding="16dp"
|
||||
android:text="@string/login_header"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sub_header"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/signal_primary"
|
||||
android:gravity="center"
|
||||
android:paddingBottom="48dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:text="@string/login_subheader"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintTop_toBottomOf="@id/header" />
|
||||
<!--<TextView-->
|
||||
<!--android:id="@+id/header"-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:background="@color/signal_primary"-->
|
||||
<!--android:gravity="center"-->
|
||||
<!--android:paddingLeft="16dp"-->
|
||||
<!--android:paddingRight="16dp"-->
|
||||
<!--android:paddingTop="16dp"-->
|
||||
<!--android:text="@string/login_header"-->
|
||||
<!--android:textColor="@color/white"-->
|
||||
<!--android:textSize="20sp"-->
|
||||
<!--android:textStyle="bold" />-->
|
||||
|
||||
<android.support.v4.widget.Space
|
||||
android:id="@+id/fab_spacer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="28dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/sub_header" />
|
||||
android:layout_height="28dp" />
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_forum_white_24dp"
|
||||
android:tint="@color/grey_700"
|
||||
app:backgroundTint="@color/white"
|
||||
app:elevation="1dp"
|
||||
app:fabSize="normal"
|
||||
app:layout_constraintBottom_toBottomOf="@id/fab_spacer"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
<!--<android.support.design.widget.FloatingActionButton-->
|
||||
<!--android:id="@+id/fab"-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:src="@drawable/ic_forum_white_24dp"-->
|
||||
<!--android:tint="@color/grey_700"-->
|
||||
<!--app:backgroundTint="@color/white"-->
|
||||
<!--app:elevation="1dp"-->
|
||||
<!--app:fabSize="normal"-->
|
||||
<!--app:layout_constraintBottom_toBottomOf="@id/fab_spacer"-->
|
||||
<!--app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!--app:layout_constraintStart_toStartOf="parent" />-->
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/email"
|
||||
@@ -78,7 +66,7 @@
|
||||
app:errorEnabled="true"
|
||||
app:layout_constraintEnd_toEndOf="@id/guideline_root_end"
|
||||
app:layout_constraintStart_toStartOf="@id/guideline_root_start"
|
||||
app:layout_constraintTop_toBottomOf="@id/fab">
|
||||
app:layout_constraintTop_toBottomOf="@id/fab_spacer">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/email_text"
|
||||
@@ -107,13 +95,26 @@
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sub_header"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:text="@string/login_subheader"
|
||||
android:textColor="@color/black"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/password" />
|
||||
|
||||
<android.support.constraint.Group
|
||||
android:id="@+id/advanced_group"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:constraint_referenced_ids="inbox, imap_login, imap_server, imap_port, imap_security_label, imap_security, outbox_view_spacer_top,
|
||||
outbox, smtp_login, smtp_password, smtp_server, smtp_port, smtp_security_label, smtp_security, register_button_spacer_top" />
|
||||
outbox, smtp_login, smtp_password, smtp_server, smtp_port, smtp_security_label, smtp_security" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/advanced_text"
|
||||
@@ -125,7 +126,7 @@
|
||||
app:layout_constraintEnd_toStartOf="@+id/advanced_icon"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="@id/guideline_root_start"
|
||||
app:layout_constraintTop_toBottomOf="@id/password" />
|
||||
app:layout_constraintTop_toBottomOf="@id/sub_header" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/advanced_icon"
|
||||
@@ -139,7 +140,7 @@
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline_root_end"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toEndOf="@id/advanced_text"
|
||||
app:layout_constraintTop_toBottomOf="@id/password" />
|
||||
app:layout_constraintTop_toBottomOf="@id/sub_header" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/inbox"
|
||||
@@ -323,33 +324,33 @@
|
||||
app:layout_constraintStart_toStartOf="@id/guideline_root_start"
|
||||
app:layout_constraintTop_toBottomOf="@id/smtp_security_label" />
|
||||
|
||||
<android.support.v4.widget.Space
|
||||
android:id="@+id/register_button_spacer_top"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="16dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/smtp_security" />
|
||||
<!--<android.support.v4.widget.Space-->
|
||||
<!--android:id="@+id/register_button_spacer_top"-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="16dp"-->
|
||||
<!--app:layout_constraintTop_toBottomOf="@id/smtp_security" />-->
|
||||
|
||||
<com.dd.CircularProgressButton
|
||||
android:id="@+id/register_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:background="@color/signal_primary"
|
||||
android:textColor="@color/white"
|
||||
app:cpb_colorIndicator="@color/white"
|
||||
app:cpb_colorProgress="@color/textsecure_primary"
|
||||
app:cpb_cornerRadius="50dp"
|
||||
app:cpb_selectorIdle="@drawable/progress_button_state"
|
||||
app:cpb_textIdle="@string/login_title"
|
||||
app:layout_constraintEnd_toEndOf="@id/guideline_root_end"
|
||||
app:layout_constraintStart_toStartOf="@id/guideline_root_start"
|
||||
app:layout_constraintTop_toBottomOf="@id/register_button_spacer_top" />
|
||||
<!--<com.dd.CircularProgressButton-->
|
||||
<!--android:id="@+id/register_button"-->
|
||||
<!--android:layout_width="0dp"-->
|
||||
<!--android:layout_height="50dp"-->
|
||||
<!--android:layout_marginEnd="16dp"-->
|
||||
<!--android:layout_marginStart="16dp"-->
|
||||
<!--android:background="@color/signal_primary"-->
|
||||
<!--android:textColor="@color/white"-->
|
||||
<!--app:cpb_colorIndicator="@color/white"-->
|
||||
<!--app:cpb_colorProgress="@color/textsecure_primary"-->
|
||||
<!--app:cpb_cornerRadius="50dp"-->
|
||||
<!--app:cpb_selectorIdle="@drawable/progress_button_state"-->
|
||||
<!--app:cpb_textIdle="@string/login_title"-->
|
||||
<!--app:layout_constraintEnd_toEndOf="@id/guideline_root_end"-->
|
||||
<!--app:layout_constraintStart_toStartOf="@id/guideline_root_start"-->
|
||||
<!--app:layout_constraintTop_toBottomOf="@id/register_button_spacer_top" />-->
|
||||
|
||||
<android.support.v4.widget.Space
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="16dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/register_button" />
|
||||
<!--<android.support.v4.widget.Space-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="16dp"-->
|
||||
<!--app:layout_constraintTop_toBottomOf="@id/register_button" />-->
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item android:title="@string/ok"
|
||||
android:id="@+id/apply_background"
|
||||
android:icon="?menu_accept_icon"
|
||||
app:showAsAction="always|withText"/>
|
||||
|
||||
</menu>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item android:title="@string/ok"
|
||||
android:id="@+id/do_register"
|
||||
android:icon="?menu_accept_icon"
|
||||
app:showAsAction="always|withText"/>
|
||||
|
||||
</menu>
|
||||
@@ -303,12 +303,12 @@
|
||||
<string name="pref_blocked_contacts">Blocked contacts</string>
|
||||
<string name="pref_profile_photo_remove_ask">Remove profile photo?</string>
|
||||
<string name="pref_help_url">https://delta.chat/en/help</string>
|
||||
<!-- Translators: The URL should not be localized, it is not clear which language the receiver prefers and the language will be detected on the server -->
|
||||
<string name="pref_password_and_account_settings">Password and account settings</string>
|
||||
<string name="pref_who_can_see_this_information">Who can see this information?</string>
|
||||
<string name="pref_who_can_see_profile_explain">Your profile picture and name will be shown alongside your messages when communicating with other users. Already sent information can not be deleted or removed.</string>
|
||||
<string name="pref_your_name">Your name</string>
|
||||
<string name="pref_default_status_label">Status text</string>
|
||||
<!-- Translators: The URL should not be localized, it is not clear which language the receiver prefers and the language will be detected on the server -->
|
||||
<string name="pref_default_status_text">Sent with my Delta Chat Messenger: https://delta.chat</string>
|
||||
<string name="pref_enter_sends">Enter key sends</string>
|
||||
<string name="pref_enter_sends_explain">Pressing the Enter key will send text messages</string>
|
||||
@@ -552,7 +552,7 @@
|
||||
<string name="group_name_desktop">Group name</string>
|
||||
<string name="remove_desktop">Remove</string>
|
||||
<string name="save_desktop">Save</string>
|
||||
<string name="show_qr_verify_code_desktop">Show QR verify code</string>
|
||||
<string name="show_qr_verify_code_desktop">Show QR invite code</string>
|
||||
<string name="show_qr_invite_code_desktop">Show QR invite code</string>
|
||||
<string name="add_contact_desktop">Add contact</string>
|
||||
<string name="login_required_desktop">required</string>
|
||||
@@ -589,15 +589,15 @@
|
||||
|
||||
<!-- deprecated on android, please remove if unused on desktop -->
|
||||
<!-- see qrscan_ask_join_group -->
|
||||
<string name="qrscan_ask_join_verified_group">Do you want to join the verified group \"%1$s\"?</string>
|
||||
<string name="qrscan_ask_join_verified_group">Do you want to join the group \"%1$s\"?</string>
|
||||
<!-- see ask_start_chat_with -->
|
||||
<string name="qrscan_ask_fingerprint_ask_oob">Start chatting with \"%1$s\"?</string>
|
||||
<string name="qrscan_ask_fingerprint_ask_oob">Chat with %1$s?</string>
|
||||
<!-- see ask_start_chat_with -->
|
||||
<string name="qrscan_ask_chatting_fingerprint_ok">Contact \"%1$s\" verified. Start chatting?</string>
|
||||
<string name="qrscan_ask_chatting_fingerprint_ok">Chat with %1$s?</string>
|
||||
<!-- see qrshow_join_group_title -->
|
||||
<string name="qrshow_join_verified_group_title">QR invite code</string>
|
||||
<!-- see qrshow_join_group_hint -->
|
||||
<string name="qrshow_join_verified_group_hint">Scan this to join the verified group \"%1$s\".</string>
|
||||
<string name="qrshow_join_verified_group_hint">Scan this to join the group \"%1$s\".</string>
|
||||
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -55,6 +55,13 @@ public class DcContext {
|
||||
public final static int DC_QR_URL = 332;
|
||||
public final static int DC_QR_ERROR = 400;
|
||||
|
||||
public final static int DC_LP_IMAP_SOCKET_STARTTLS = 0x100;
|
||||
public final static int DC_LP_IMAP_SOCKET_SSL = 0x200;
|
||||
public final static int DC_LP_IMAP_SOCKET_PLAIN = 0x400;
|
||||
public final static int DC_LP_SMTP_SOCKET_STARTTLS = 0x10000;
|
||||
public final static int DC_LP_SMTP_SOCKET_SSL = 0x20000;
|
||||
public final static int DC_LP_SMTP_SOCKET_PLAIN = 0x40000;
|
||||
|
||||
public DcContext(String osName) {
|
||||
handleEvent(0,0,0); // call handleEvent() to make sure it is not optimized away and JNI won't find it
|
||||
contextCPtr = createContextCPtr(osName);
|
||||
|
||||
@@ -181,8 +181,13 @@ public class ConversationFragment extends Fragment
|
||||
}
|
||||
}else{
|
||||
String name = getListAdapter().getChatName();
|
||||
String message = getString(R.string.chat_no_messages_hint, name, name);
|
||||
noMessageTextView.setText(message);
|
||||
if(dcContext.getChat((int)threadId).isSelfTalk()) {
|
||||
noMessageTextView.setText(R.string.chat_no_messages);
|
||||
}
|
||||
else {
|
||||
String message = getString(R.string.chat_no_messages_hint, name, name);
|
||||
noMessageTextView.setText(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -453,8 +453,7 @@ public class CreateProfileActivity extends BaseActionBarActivity {
|
||||
|
||||
if (result) {
|
||||
if (captureFile != null) captureFile.delete();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) handleFinishedLollipop();
|
||||
else handleFinishedLegacy();
|
||||
handleFinishedLegacy();
|
||||
} else {
|
||||
Toast.makeText(CreateProfileActivity.this, R.string.error, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
@@ -480,32 +479,4 @@ public class CreateProfileActivity extends BaseActionBarActivity {
|
||||
if (nextIntent != null) startActivity(nextIntent);
|
||||
finish();
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
private void handleFinishedLollipop() {
|
||||
int[] revealLocation = new int[2];
|
||||
|
||||
reveal.getLocationInWindow(revealLocation);
|
||||
|
||||
Animator animation = ViewAnimationUtils.createCircularReveal(reveal, reveal.getWidth(), 0, 0f, (float) Math.max(reveal.getWidth(), reveal.getHeight()));
|
||||
animation.setDuration(500);
|
||||
animation.addListener(new Animator.AnimatorListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
if (nextIntent != null) startActivity(nextIntent);
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancel(Animator animation) {}
|
||||
@Override
|
||||
public void onAnimationRepeat(Animator animation) {}
|
||||
});
|
||||
|
||||
reveal.setVisibility(View.VISIBLE);
|
||||
animation.start();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,10 @@ package org.thoughtcrime.securesms;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.net.MailTo;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
@@ -40,12 +43,41 @@ public class NewConversationActivity extends ContactSelectionActivity {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static final String TAG = NewConversationActivity.class.getSimpleName();
|
||||
private static final String MAILTO = "mailto";
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle bundle, boolean ready) {
|
||||
super.onCreate(bundle, ready);
|
||||
assert getSupportActionBar() != null;
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
handleIntent();
|
||||
}
|
||||
|
||||
private void handleIntent() {
|
||||
Intent intent = getIntent();
|
||||
String action = intent.getAction();
|
||||
if(Intent.ACTION_VIEW.equals(action) || Intent.ACTION_SENDTO.equals(action)) {
|
||||
try {
|
||||
Uri uri = intent.getData();
|
||||
if(uri != null) {
|
||||
String scheme = uri.getScheme();
|
||||
if(scheme != null && scheme.equals(MAILTO) ) {
|
||||
MailTo mailto = MailTo.parse(uri.toString());
|
||||
String recipientsList = mailto.getTo();
|
||||
if(recipientsList != null && !recipientsList.isEmpty()) {
|
||||
String[] recipientsArray = recipientsList.split(",");
|
||||
if (recipientsArray.length >= 1) {
|
||||
String recipient = recipientsArray[0];
|
||||
onContactSelected(DcContact.DC_CONTACT_ID_NEW_CONTACT, recipient);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception e) {
|
||||
Log.e(TAG, "start activity from external 'mailto:' link failed", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,10 +9,15 @@ import android.support.annotation.IdRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.constraint.Group;
|
||||
import android.support.design.widget.TextInputEditText;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Patterns;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
@@ -56,6 +61,9 @@ public class RegistrationActivity extends BaseActionBarActivity implements DcEve
|
||||
private ProgressDialog progressDialog;
|
||||
private boolean gmailDialogShown;
|
||||
|
||||
MenuItem loginMenuItem;
|
||||
Spinner imapSecurity;
|
||||
Spinner smtpSecurity;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle bundle) {
|
||||
@@ -66,6 +74,30 @@ public class RegistrationActivity extends BaseActionBarActivity implements DcEve
|
||||
DcHelper.getContext(this).eventCenter.addObserver(this, DcContext.DC_EVENT_CONFIGURE_PROGRESS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = this.getMenuInflater();
|
||||
menu.clear();
|
||||
inflater.inflate(R.menu.registration, menu);
|
||||
loginMenuItem = menu.findItem(R.id.do_register);
|
||||
super.onPrepareOptionsMenu(menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
int id = item.getItemId();
|
||||
|
||||
if (id == R.id.do_register) {
|
||||
onLogin();
|
||||
return true;
|
||||
} else if (id == android.R.id.home) {
|
||||
// handle close button click here
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
@@ -82,19 +114,29 @@ public class RegistrationActivity extends BaseActionBarActivity implements DcEve
|
||||
passwordInput = findViewById(R.id.password_text);
|
||||
advancedGroup = findViewById(R.id.advanced_group);
|
||||
advancedIcon = findViewById(R.id.advanced_icon);
|
||||
CircularProgressButton loginButton = findViewById(R.id.register_button);
|
||||
// CircularProgressButton loginButton = findViewById(R.id.register_button);
|
||||
TextView advancedTextView = findViewById(R.id.advanced_text);
|
||||
TextInputEditText imapServerInput = findViewById(R.id.imap_server_text);
|
||||
TextInputEditText imapPortInput = findViewById(R.id.imap_port_text);
|
||||
TextInputEditText smtpServerInput = findViewById(R.id.smtp_server_text);
|
||||
TextInputEditText smtpPortInput = findViewById(R.id.smtp_port_text);
|
||||
|
||||
imapSecurity = findViewById(R.id.imap_security);
|
||||
smtpSecurity = findViewById(R.id.smtp_security);
|
||||
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setTitle(R.string.login_header);
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
actionBar.setHomeAsUpIndicator(R.drawable.ic_close_white_24dp);
|
||||
}
|
||||
|
||||
emailInput.setOnFocusChangeListener((view, focused) -> focusListener(view, focused, VerificationType.EMAIL));
|
||||
imapServerInput.setOnFocusChangeListener((view, focused) -> focusListener(view, focused, VerificationType.SERVER));
|
||||
imapPortInput.setOnFocusChangeListener((view, focused) -> focusListener(view, focused, VerificationType.PORT));
|
||||
smtpServerInput.setOnFocusChangeListener((view, focused) -> focusListener(view, focused, VerificationType.SERVER));
|
||||
smtpPortInput.setOnFocusChangeListener((view, focused) -> focusListener(view, focused, VerificationType.PORT));
|
||||
loginButton.setOnClickListener(l -> onLogin());
|
||||
// loginButton.setOnClickListener(l -> onLogin());
|
||||
advancedTextView.setOnClickListener(l -> onAdvancedSettings());
|
||||
advancedIcon.setOnClickListener(l -> onAdvancedSettings());
|
||||
advancedIcon.setRotation(45);
|
||||
@@ -107,11 +149,25 @@ public class RegistrationActivity extends BaseActionBarActivity implements DcEve
|
||||
imapServerInput.setText(DcHelper.get(this, CONFIG_MAIL_SERVER));
|
||||
imapPortInput.setText(DcHelper.get(this, CONFIG_MAIL_PORT));
|
||||
TextInputEditText smtpLoginInput = findViewById(R.id.smtp_login_text);
|
||||
TextInputEditText smtpPasswordInput = findViewById(R.id.smtp_port_text);
|
||||
TextInputEditText smtpPasswordInput = findViewById(R.id.smtp_password_text);
|
||||
smtpLoginInput.setText(DcHelper.get(this, CONFIG_SEND_USER));
|
||||
smtpPasswordInput.setText(DcHelper.get(this, CONFIG_SEND_PASSWORD));
|
||||
smtpServerInput.setText(DcHelper.get(this, CONFIG_SEND_SERVER));
|
||||
smtpPortInput.setText(DcHelper.get(this, CONFIG_SEND_PORT));
|
||||
|
||||
int server_flags = DcHelper.getInt(this, "server_flags", 0);
|
||||
|
||||
int sel = 0;
|
||||
if((server_flags&DcContext.DC_LP_IMAP_SOCKET_SSL)!=0) sel = 1;
|
||||
if((server_flags&DcContext.DC_LP_IMAP_SOCKET_STARTTLS)!=0) sel = 2;
|
||||
if((server_flags&DcContext.DC_LP_IMAP_SOCKET_PLAIN)!=0) sel = 3;
|
||||
imapSecurity.setSelection(sel);
|
||||
|
||||
sel = 0;
|
||||
if((server_flags&DcContext.DC_LP_SMTP_SOCKET_SSL)!=0) sel = 1;
|
||||
if((server_flags&DcContext.DC_LP_SMTP_SOCKET_STARTTLS)!=0) sel = 2;
|
||||
if((server_flags&DcContext.DC_LP_SMTP_SOCKET_PLAIN)!=0) sel = 3;
|
||||
smtpSecurity.setSelection(sel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,15 +274,24 @@ public class RegistrationActivity extends BaseActionBarActivity implements DcEve
|
||||
}
|
||||
|
||||
private void setupConfig() {
|
||||
setConfig(R.id.email_text, "addr");
|
||||
setConfig(R.id.password_text, "mail_pw");
|
||||
setConfig(R.id.imap_server_text, "mail_server");
|
||||
setConfig(R.id.imap_port_text, "mail_port");
|
||||
setConfig(R.id.imap_login_text, "mail_user");
|
||||
setConfig(R.id.smtp_server_text, "send_server");
|
||||
setConfig(R.id.smtp_port_text, "send_port");
|
||||
setConfig(R.id.smtp_login_text, "send_user");
|
||||
setConfig(R.id.smtp_password_text, "send_pw");
|
||||
setConfig(R.id.email_text, "addr", true);
|
||||
setConfig(R.id.password_text, "mail_pw", false);
|
||||
setConfig(R.id.imap_server_text, "mail_server", true);
|
||||
setConfig(R.id.imap_port_text, "mail_port", true);
|
||||
setConfig(R.id.imap_login_text, "mail_user", false);
|
||||
setConfig(R.id.smtp_server_text, "send_server", true);
|
||||
setConfig(R.id.smtp_port_text, "send_port", true);
|
||||
setConfig(R.id.smtp_login_text, "send_user", false);
|
||||
setConfig(R.id.smtp_password_text, "send_pw", false);
|
||||
|
||||
int server_flags = 0;
|
||||
if(imapSecurity.getSelectedItemPosition()==1) server_flags |= DcContext.DC_LP_IMAP_SOCKET_SSL;
|
||||
if(imapSecurity.getSelectedItemPosition()==2) server_flags |= DcContext.DC_LP_IMAP_SOCKET_STARTTLS;
|
||||
if(imapSecurity.getSelectedItemPosition()==3) server_flags |= DcContext.DC_LP_IMAP_SOCKET_PLAIN;
|
||||
if(smtpSecurity.getSelectedItemPosition()==1) server_flags |= DcContext.DC_LP_SMTP_SOCKET_SSL;
|
||||
if(smtpSecurity.getSelectedItemPosition()==2) server_flags |= DcContext.DC_LP_SMTP_SOCKET_STARTTLS;
|
||||
if(smtpSecurity.getSelectedItemPosition()==3) server_flags |= DcContext.DC_LP_SMTP_SOCKET_PLAIN;
|
||||
DcHelper.getContext(this).setConfigInt("server_flags", server_flags);
|
||||
|
||||
// calling configure() results in
|
||||
// receiving multiple DC_EVENT_CONFIGURE_PROGRESS events
|
||||
@@ -234,12 +299,13 @@ public class RegistrationActivity extends BaseActionBarActivity implements DcEve
|
||||
DcHelper.getContext(this).configure();
|
||||
}
|
||||
|
||||
private void setConfig(@IdRes int viewId, String configTarget) {
|
||||
private void setConfig(@IdRes int viewId, String configTarget, boolean doTrim) {
|
||||
TextInputEditText view = findViewById(viewId);
|
||||
String value = view.getText().toString().trim();
|
||||
if (!value.isEmpty()) {
|
||||
DcHelper.getContext(this).setConfig(configTarget, value);
|
||||
String value = view.getText().toString();
|
||||
if(doTrim) {
|
||||
value = value.trim();
|
||||
}
|
||||
DcHelper.getContext(this).setConfig(configTarget, value.isEmpty()? null : value);
|
||||
}
|
||||
|
||||
private void stopLoginProcess() {
|
||||
|
||||
@@ -74,8 +74,8 @@ public class ChatBackgroundActivity extends BaseActionBarActivity {
|
||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = this.getMenuInflater();
|
||||
menu.clear();
|
||||
inflater.inflate(R.menu.group_create, menu);
|
||||
acceptMenuItem = menu.findItem(R.id.menu_create_group);
|
||||
inflater.inflate(R.menu.chat_background, menu);
|
||||
acceptMenuItem = menu.findItem(R.id.apply_background);
|
||||
acceptMenuItem.setEnabled(false);
|
||||
super.onPrepareOptionsMenu(menu);
|
||||
return true;
|
||||
@@ -85,7 +85,7 @@ public class ChatBackgroundActivity extends BaseActionBarActivity {
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
int id = item.getItemId();
|
||||
|
||||
if (id == R.id.menu_create_group) {
|
||||
if (id == R.id.apply_background) {
|
||||
// handle confirmation button click here
|
||||
Context context = getApplicationContext();
|
||||
if(imageUri != null){
|
||||
|
||||
Reference in New Issue
Block a user