open manage account + certificate chooser when cbe mode is enabled
This commit is contained in:
parent
53125dbccc
commit
569b9f4e66
|
@ -15,7 +15,9 @@
|
|||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
<uses-permission android:name="android.permission.NFC"/>
|
||||
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" tools:node="remove" />
|
||||
<uses-permission
|
||||
android:name="android.permission.READ_PHONE_STATE"
|
||||
tools:node="remove"/>
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
|
@ -48,8 +50,8 @@
|
|||
<activity
|
||||
android:name=".ui.StartConversationActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:launchMode="singleTask"
|
||||
android:label="@string/title_activity_start_conversation" >
|
||||
android:label="@string/title_activity_start_conversation"
|
||||
android:launchMode="singleTask">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SENDTO"/>
|
||||
|
||||
|
@ -89,9 +91,11 @@
|
|||
<activity
|
||||
android:name=".ui.ManageAccountActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/title_activity_manage_accounts" />
|
||||
android:label="@string/title_activity_manage_accounts"
|
||||
android:launchMode="singleTask"/>
|
||||
<activity
|
||||
android:name=".ui.EditAccountActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:windowSoftInputMode="stateHidden|adjustResize"/>
|
||||
<activity
|
||||
android:name=".ui.ConferenceDetailsActivity"
|
||||
|
@ -150,6 +154,7 @@
|
|||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="eu.siacs.conversations.ui.SettingsActivity"/>
|
||||
</activity>
|
||||
|
||||
<service android:name=".services.ExportLogsService"/>
|
||||
</application>
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ import net.java.otr4j.session.SessionStatus;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import de.timroes.android.listview.EnhancedListView;
|
||||
import eu.siacs.conversations.Config;
|
||||
|
@ -105,7 +106,7 @@ public class ConversationActivity extends XmppActivity
|
|||
private Toast prepareFileToast;
|
||||
|
||||
private boolean mActivityPaused = false;
|
||||
private boolean mRedirected = true;
|
||||
private AtomicBoolean mRedirected = new AtomicBoolean(false);
|
||||
|
||||
public Conversation getSelectedConversation() {
|
||||
return this.mSelectedConversation;
|
||||
|
@ -631,6 +632,12 @@ public class ConversationActivity extends XmppActivity
|
|||
this.mConversationFragment.reInit(getSelectedConversation());
|
||||
} else {
|
||||
setSelectedConversation(null);
|
||||
if (mRedirected.compareAndSet(false,true)) {
|
||||
Intent intent = new Intent(this, StartConversationActivity.class);
|
||||
intent.putExtra("init",true);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -985,7 +992,7 @@ public class ConversationActivity extends XmppActivity
|
|||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
this.mRedirected = false;
|
||||
this.mRedirected.set(false);
|
||||
if (this.xmppConnectionServiceBound) {
|
||||
this.onBackendConnected();
|
||||
}
|
||||
|
@ -1049,14 +1056,16 @@ public class ConversationActivity extends XmppActivity
|
|||
}
|
||||
|
||||
if (xmppConnectionService.getAccounts().size() == 0) {
|
||||
if (!mRedirected) {
|
||||
this.mRedirected = true;
|
||||
if (mRedirected.compareAndSet(false,true)) {
|
||||
if (Config.X509_VERIFICATION) {
|
||||
startActivity(new Intent(this, ManageAccountActivity.class));
|
||||
} else {
|
||||
startActivity(new Intent(this, EditAccountActivity.class));
|
||||
}
|
||||
finish();
|
||||
}
|
||||
} else if (conversationList.size() <= 0) {
|
||||
if (!mRedirected) {
|
||||
this.mRedirected = true;
|
||||
if (mRedirected.compareAndSet(false,true)) {
|
||||
Intent intent = new Intent(this, StartConversationActivity.class);
|
||||
intent.putExtra("init",true);
|
||||
startActivity(intent);
|
||||
|
@ -1406,26 +1415,12 @@ public class ConversationActivity extends XmppActivity
|
|||
@Override
|
||||
protected void refreshUiReal() {
|
||||
updateConversationList();
|
||||
if (xmppConnectionService != null && xmppConnectionService.getAccounts().size() == 0) {
|
||||
if (!mRedirected) {
|
||||
this.mRedirected = true;
|
||||
startActivity(new Intent(this, EditAccountActivity.class));
|
||||
finish();
|
||||
}
|
||||
} else if (conversationList.size() == 0) {
|
||||
if (!mRedirected) {
|
||||
this.mRedirected = true;
|
||||
Intent intent = new Intent(this, StartConversationActivity.class);
|
||||
intent.putExtra("init",true);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
} else {
|
||||
if (conversationList.size() > 0) {
|
||||
ConversationActivity.this.mConversationFragment.updateMessages();
|
||||
updateActionBarTitle();
|
||||
}
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountUpdate() {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package eu.siacs.conversations.ui;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.content.Intent;
|
||||
|
@ -20,6 +22,7 @@ import android.widget.Toast;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import eu.siacs.conversations.Config;
|
||||
import eu.siacs.conversations.R;
|
||||
|
@ -35,6 +38,7 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
|
|||
protected final List<Account> accountList = new ArrayList<>();
|
||||
protected ListView accountListView;
|
||||
protected AccountAdapter mAccountAdapter;
|
||||
protected AtomicBoolean mInvokedAddAccount = new AtomicBoolean(false);
|
||||
|
||||
@Override
|
||||
public void onAccountUpdate() {
|
||||
|
@ -47,6 +51,11 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
|
|||
accountList.clear();
|
||||
accountList.addAll(xmppConnectionService.getAccounts());
|
||||
}
|
||||
ActionBar actionBar = getActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setHomeButtonEnabled(this.accountList.size() > 0);
|
||||
actionBar.setDisplayHomeAsUpEnabled(this.accountList.size() > 0);
|
||||
}
|
||||
invalidateOptionsMenu();
|
||||
mAccountAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
@ -93,9 +102,12 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
|
|||
|
||||
@Override
|
||||
void onBackendConnected() {
|
||||
this.accountList.clear();
|
||||
this.accountList.addAll(xmppConnectionService.getAccounts());
|
||||
mAccountAdapter.notifyDataSetChanged();
|
||||
refreshUiReal();
|
||||
if (Config.X509_VERIFICATION && this.accountList.size() == 0) {
|
||||
if (mInvokedAddAccount.compareAndSet(false,true)) {
|
||||
addAccountFromKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -195,7 +207,11 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
|
|||
}
|
||||
|
||||
private void addAccountFromKey() {
|
||||
try {
|
||||
KeyChain.choosePrivateKeyAlias(this, this, null, null, null, -1, null);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
Toast.makeText(this,R.string.device_does_not_support_certificates,Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
private void publishAvatar(Account account) {
|
||||
|
|
|
@ -535,4 +535,5 @@
|
|||
<string name="action_renew_certificate">Renew certificate</string>
|
||||
<string name="error_fetching_omemo_key">Error fetching OMEMO key!</string>
|
||||
<string name="verified_omemo_key_with_certificate">Verified OMEMO key with certificate!</string>
|
||||
<string name="device_does_not_support_certificates">Your device does not support the selection of client certificates!</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue