aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/AndroidManifest.xml6
-rw-r--r--src/main/java/de/pixart/messenger/crypto/PgpEngine.java11
-rw-r--r--src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java12
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java43
-rw-r--r--src/main/java/de/pixart/messenger/ui/EditAccountActivity.java88
-rw-r--r--src/main/java/de/pixart/messenger/ui/SetPresenceActivity.java207
-rw-r--r--src/main/java/de/pixart/messenger/ui/SettingsActivity.java3
-rw-r--r--src/main/java/de/pixart/messenger/ui/XmppActivity.java13
-rw-r--r--src/main/res/layout/dialog_presence.xml8
-rw-r--r--src/main/res/menu/editaccount.xml2
-rw-r--r--src/main/res/values-ca/strings.xml1
-rw-r--r--src/main/res/values-ceb/strings.xml1
-rw-r--r--src/main/res/values-cs/strings.xml1
-rw-r--r--src/main/res/values-de/strings.xml1
-rw-r--r--src/main/res/values-es/strings.xml1
-rw-r--r--src/main/res/values-eu/strings.xml1
-rw-r--r--src/main/res/values-fil/strings.xml1
-rw-r--r--src/main/res/values-fr/strings.xml1
-rw-r--r--src/main/res/values-gl/strings.xml1
-rw-r--r--src/main/res/values-id/strings.xml1
-rw-r--r--src/main/res/values-it/strings.xml1
-rw-r--r--src/main/res/values-nl/strings.xml1
-rw-r--r--src/main/res/values-pl/strings.xml1
-rw-r--r--src/main/res/values-ro/strings.xml1
-rw-r--r--src/main/res/values-sv/strings.xml1
-rw-r--r--src/main/res/values-tr/strings.xml1
-rw-r--r--src/main/res/values/strings.xml9
27 files changed, 127 insertions, 291 deletions
diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml
index da6744a24..92ab4706c 100644
--- a/src/main/AndroidManifest.xml
+++ b/src/main/AndroidManifest.xml
@@ -136,12 +136,6 @@
android:label="@string/create_account"
android:launchMode="singleTask" />
<activity
- android:name=".ui.SetPresenceActivity"
- android:configChanges="orientation|screenSize"
- android:label="@string/change_presence"
- android:launchMode="singleTop"
- android:windowSoftInputMode="stateHidden|adjustResize" />
- <activity
android:name=".ui.SettingsActivity"
android:label="@string/title_activity_settings" />
<activity
diff --git a/src/main/java/de/pixart/messenger/crypto/PgpEngine.java b/src/main/java/de/pixart/messenger/crypto/PgpEngine.java
index 9228c1c84..cc1ee41dc 100644
--- a/src/main/java/de/pixart/messenger/crypto/PgpEngine.java
+++ b/src/main/java/de/pixart/messenger/crypto/PgpEngine.java
@@ -197,7 +197,7 @@ public class PgpEngine {
});
}
- public void generateSignature(Intent intent, final Account account, String status, final UiCallback<Account> callback) {
+ public void generateSignature(Intent intent, final Account account, String status, final UiCallback<String> callback) {
if (account.getPgpId() == 0) {
return;
}
@@ -231,19 +231,18 @@ public class PgpEngine {
}
}
} catch (IOException e) {
- callback.error(R.string.openpgp_error, account);
+ callback.error(R.string.openpgp_error, null);
return;
}
- account.setPgpSignature(signatureBuilder.toString());
- callback.success(account);
+ callback.success(signatureBuilder.toString());
return;
case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED:
- callback.userInputRequried(result.getParcelableExtra(OpenPgpApi.RESULT_INTENT), account);
+ callback.userInputRequried(result.getParcelableExtra(OpenPgpApi.RESULT_INTENT), status);
return;
case OpenPgpApi.RESULT_CODE_ERROR:
OpenPgpError error = result.getParcelableExtra(OpenPgpApi.RESULT_ERROR);
if (error != null && "signing subkey not found!".equals(error.getMessage())) {
- callback.error(0, account);
+ callback.error(0, null);
} else {
logError(account, error);
callback.error(R.string.unable_to_connect_to_keychain, null);
diff --git a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java
index c0c74d78b..1a6129a49 100644
--- a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java
+++ b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java
@@ -654,6 +654,10 @@ public class DatabaseBackend extends SQLiteOpenHelper {
public void insertPresenceTemplate(PresenceTemplate template) {
SQLiteDatabase db = this.getWritableDatabase();
+ String whereToDelete = PresenceTemplate.MESSAGE + "=?";
+ String[] whereToDeleteArgs = {template.getStatusMessage()};
+ db.delete(PresenceTemplate.TABELNAME, whereToDelete, whereToDeleteArgs);
+ db.delete(PresenceTemplate.TABELNAME, PresenceTemplate.UUID + " not in (select " + PresenceTemplate.UUID + " from " + PresenceTemplate.TABELNAME + " order by " + PresenceTemplate.LAST_USED + " desc limit 9)", null);
db.insert(PresenceTemplate.TABELNAME, null, template.getContentValues());
}
@@ -668,14 +672,6 @@ public class DatabaseBackend extends SQLiteOpenHelper {
return templates;
}
- public void deletePresenceTemplate(PresenceTemplate template) {
- Log.d(Config.LOGTAG, "deleting presence template with uuid " + template.getUuid());
- SQLiteDatabase db = this.getWritableDatabase();
- String where = PresenceTemplate.UUID + "=?";
- String[] whereArgs = {template.getUuid()};
- db.delete(PresenceTemplate.TABELNAME, where, whereArgs);
- }
-
public CopyOnWriteArrayList<Conversation> getConversations(int status) {
CopyOnWriteArrayList<Conversation> list = new CopyOnWriteArrayList<>();
SQLiteDatabase db = this.getReadableDatabase();
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index 06311c441..716a39434 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -3833,15 +3833,16 @@ public class XmppConnectionService extends Service {
}
public void sendPresence(final Account account, final boolean includeIdleTimestamp) {
- PresencePacket packet;
+ Presence.Status status;
if (manuallyChangePresence()) {
- packet = mPresenceGenerator.selfPresence(account, account.getPresenceStatus());
- String message = account.getPresenceStatusMessage();
- if (message != null && !message.isEmpty()) {
- packet.addChild(new Element("status").setContent(message));
- }
+ status = account.getPresenceStatus();
} else {
- packet = mPresenceGenerator.selfPresence(account, getTargetPresence());
+ status = getTargetPresence();
+ }
+ PresencePacket packet = mPresenceGenerator.selfPresence(account, status);
+ String message = account.getPresenceStatusMessage();
+ if (message != null && !message.isEmpty()) {
+ packet.addChild(new Element("status").setContent(message));
}
if (mLastActivity > 0 && includeIdleTimestamp) {
long since = Math.min(mLastActivity, System.currentTimeMillis()); //don't send future dates
@@ -4139,29 +4140,15 @@ public class XmppConnectionService extends Service {
return pending;
}
- public void changeStatus(Account account, Presence.Status status, String statusMessage, boolean send) {
- if (!statusMessage.isEmpty()) {
- databaseBackend.insertPresenceTemplate(new PresenceTemplate(status, statusMessage));
+ public void changeStatus(Account account, PresenceTemplate template, String signature) {
+ if (!template.getStatusMessage().isEmpty()) {
+ databaseBackend.insertPresenceTemplate(template);
}
- changeStatusReal(account, status, statusMessage, send);
- }
-
- private void changeStatusReal(Account account, Presence.Status status, String statusMessage, boolean send) {
- account.setPresenceStatus(status);
- account.setPresenceStatusMessage(statusMessage);
+ account.setPgpSignature(signature);
+ account.setPresenceStatus(template.getStatus());
+ account.setPresenceStatusMessage(template.getStatusMessage());
databaseBackend.updateAccount(account);
- if (account.isEnabled() && send) {
- sendPresence(account);
- }
- }
-
- public void changeStatus(Presence.Status status, String statusMessage) {
- if (!statusMessage.isEmpty()) {
- databaseBackend.insertPresenceTemplate(new PresenceTemplate(status, statusMessage));
- }
- for (Account account : getAccounts()) {
- changeStatusReal(account, status, statusMessage, true);
- }
+ sendPresence(account);
}
public List<PresenceTemplate> getPresenceTemplates(Account account) {
diff --git a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
index a24dd3691..eddbc44b6 100644
--- a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
@@ -1,9 +1,11 @@
package de.pixart.messenger.ui;
+import android.app.Activity;
import android.app.AlertDialog.Builder;
import android.app.PendingIntent;
import android.content.ActivityNotFoundException;
import android.content.Intent;
+import android.content.IntentSender;
import android.content.SharedPreferences;
import android.databinding.DataBindingUtil;
import android.graphics.Bitmap;
@@ -54,6 +56,7 @@ import de.pixart.messenger.crypto.axolotl.XmppAxolotlSession;
import de.pixart.messenger.databinding.ActivityEditAccountBinding;
import de.pixart.messenger.databinding.DialogPresenceBinding;
import de.pixart.messenger.entities.Account;
+import de.pixart.messenger.entities.Presence;
import de.pixart.messenger.entities.PresenceTemplate;
import de.pixart.messenger.services.BarcodeProvider;
import de.pixart.messenger.services.XmppConnectionService;
@@ -61,6 +64,7 @@ import de.pixart.messenger.services.XmppConnectionService.OnAccountUpdate;
import de.pixart.messenger.services.XmppConnectionService.OnCaptchaRequested;
import de.pixart.messenger.ui.adapter.KnownHostsAdapter;
import de.pixart.messenger.ui.adapter.PresenceTemplateAdapter;
+import de.pixart.messenger.ui.util.PendingItem;
import de.pixart.messenger.utils.CryptoHelper;
import de.pixart.messenger.utils.UIHelper;
import de.pixart.messenger.utils.XmppUri;
@@ -77,6 +81,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
OnKeyStatusUpdated, OnCaptchaRequested, KeyChainAliasCallback, XmppConnectionService.OnShowErrorToast, XmppConnectionService.OnMamPreferencesFetched {
private static final int REQUEST_DATA_SAVER = 0xf244;
+ private static final int REQUEST_CHANGE_STATUS = 0xee11;
private TextInputLayout mAccountJidLayout;
private EditText mPassword;
private TextInputLayout mPasswordLayout;
@@ -125,6 +130,8 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
private Account mAccount;
private String messageFingerprint;
+ private final PendingItem<PresenceTemplate> mPendingPresenceTemplate = new PendingItem<>();
+
private boolean mFetchingAvatar = false;
private final OnClickListener mSaveButtonClickListener = new OnClickListener() {
@@ -436,6 +443,14 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
if (requestCode == REQUEST_BATTERY_OP || requestCode == REQUEST_DATA_SAVER) {
updateAccountInformation(mAccount == null);
}
+ if (requestCode == REQUEST_CHANGE_STATUS) {
+ PresenceTemplate template = mPendingPresenceTemplate.pop();
+ if (template != null && resultCode == Activity.RESULT_OK) {
+ generateSignature(data, template);
+ } else {
+ Log.d(Config.LOGTAG, "pgp result not ok");
+ }
+ }
}
@Override
@@ -887,21 +902,88 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
boolean manualStatus = sharedPreferences.getBoolean(SettingsActivity.MANUALLY_CHANGE_PRESENCE, getResources().getBoolean(R.bool.manually_change_presence));
AlertDialog.Builder builder = new AlertDialog.Builder(this);
final DialogPresenceBinding binding = DataBindingUtil.inflate(getLayoutInflater(), R.layout.dialog_presence, null, false);
+ String current = mAccount.getPresenceStatusMessage();
+ if (current != null && !current.trim().isEmpty()) {
+ binding.statusMessage.append(current);
+ }
+ setAvailabilityRadioButton(mAccount.getPresenceStatus(), binding);
binding.show.setVisibility(manualStatus ? View.VISIBLE : View.GONE);
List<PresenceTemplate> templates = xmppConnectionService.getPresenceTemplates(mAccount);
PresenceTemplateAdapter presenceTemplateAdapter = new PresenceTemplateAdapter(this, R.layout.simple_list_item, templates);
binding.statusMessage.setAdapter(presenceTemplateAdapter);
binding.statusMessage.setOnItemClickListener((parent, view, position, id) -> {
PresenceTemplate template = (PresenceTemplate) parent.getItemAtPosition(position);
- Log.d(Config.LOGTAG, "selected: " + template.getStatusMessage());
+ setAvailabilityRadioButton(template.getStatus(), binding);
});
- builder.setTitle(R.string.change_presence);
+ builder.setTitle(R.string.edit_status_message_title);
builder.setView(binding.getRoot());
builder.setNegativeButton(R.string.cancel, null);
- builder.setPositiveButton(R.string.confirm, null);
+ builder.setPositiveButton(R.string.confirm, (dialog, which) -> {
+ PresenceTemplate template = new PresenceTemplate(getAvailabilityRadioButton(binding), binding.statusMessage.getText().toString().trim());
+ if (mAccount.getPgpId() != 0 && hasPgp()) {
+ generateSignature(null, template);
+ } else {
+ xmppConnectionService.changeStatus(mAccount, template, null);
+ }
+ });
builder.create().show();
}
+ private void generateSignature(Intent intent, PresenceTemplate template) {
+ xmppConnectionService.getPgpEngine().generateSignature(intent, mAccount, template.getStatusMessage(), new UiCallback<String>() {
+ @Override
+ public void success(String signature) {
+ xmppConnectionService.changeStatus(mAccount, template, signature);
+ }
+
+ @Override
+ public void error(int errorCode, String object) {
+
+ }
+
+ @Override
+ public void userInputRequried(PendingIntent pi, String object) {
+ mPendingPresenceTemplate.push(template);
+ try {
+ startIntentSenderForResult(pi.getIntentSender(), REQUEST_CHANGE_STATUS, null, 0, 0, 0);
+ } catch (final IntentSender.SendIntentException ignored) {
+ }
+ }
+ });
+ }
+
+ private static void setAvailabilityRadioButton(Presence.Status status, DialogPresenceBinding binding) {
+ if (status == null) {
+ binding.online.setChecked(true);
+ return;
+ }
+ switch (status) {
+ case DND:
+ binding.dnd.setChecked(true);
+ break;
+ case XA:
+ binding.xa.setChecked(true);
+ break;
+ case AWAY:
+ binding.xa.setChecked(true);
+ break;
+ default:
+ binding.online.setChecked(true);
+ }
+ }
+
+ private static Presence.Status getAvailabilityRadioButton(DialogPresenceBinding binding) {
+ if (binding.dnd.isChecked()) {
+ return Presence.Status.DND;
+ } else if (binding.xa.isChecked()) {
+ return Presence.Status.XA;
+ } else if (binding.away.isChecked()) {
+ return Presence.Status.AWAY;
+ } else {
+ return Presence.Status.ONLINE;
+ }
+ }
+
@Override
public void alias(String alias) {
if (alias != null) {
diff --git a/src/main/java/de/pixart/messenger/ui/SetPresenceActivity.java b/src/main/java/de/pixart/messenger/ui/SetPresenceActivity.java
deleted file mode 100644
index 383763402..000000000
--- a/src/main/java/de/pixart/messenger/ui/SetPresenceActivity.java
+++ /dev/null
@@ -1,207 +0,0 @@
-package de.pixart.messenger.ui;
-
-import android.content.Intent;
-import android.databinding.DataBindingUtil;
-import android.os.Bundle;
-import android.os.Handler;
-import android.util.Pair;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.widget.ArrayAdapter;
-import android.widget.ImageButton;
-import android.widget.TextView;
-
-import java.util.List;
-
-import de.pixart.messenger.R;
-import de.pixart.messenger.databinding.ActivitySetPresenceBinding;
-import de.pixart.messenger.entities.Account;
-import de.pixart.messenger.entities.ListItem;
-import de.pixart.messenger.entities.Presence;
-import de.pixart.messenger.entities.PresenceTemplate;
-import de.pixart.messenger.utils.UIHelper;
-
-public class SetPresenceActivity extends XmppActivity implements View.OnClickListener {
-
- //data
- protected Account mAccount;
- private List<PresenceTemplate> mTemplates;
-
- private ActivitySetPresenceBinding binding;
-
- private Pair<Integer, Intent> mPostponedActivityResult;
-
- private Runnable onPresenceChanged = new Runnable() {
- @Override
- public void run() {
- finish();
- }
- };
-
- protected void onCreate(final Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- this.binding = DataBindingUtil.setContentView(this, R.layout.activity_set_presence);
- ArrayAdapter adapter = ArrayAdapter.createFromResource(this,
- R.array.presence_show_options,
- R.layout.simple_list_item);
- this.binding.presenceShow.setAdapter(adapter);
- this.binding.presenceShow.setSelection(1);
- this.binding.changePresence.setOnClickListener(v -> executeChangePresence());
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.change_presence, menu);
- return super.onCreateOptionsMenu(menu);
- }
-
- @Override
- public boolean onOptionsItemSelected(final MenuItem item) {
- if (item.getItemId() == R.id.action_account_details) {
- if (mAccount != null) {
- switchToAccount(mAccount);
- }
- return true;
- } else {
- return super.onOptionsItemSelected(item);
- }
- }
-
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
- if (resultCode == RESULT_OK) {
- if (xmppConnectionServiceBound && mAccount != null) {
- if (requestCode == REQUEST_ANNOUNCE_PGP) {
- announcePgp(mAccount, null, data, onPresenceChanged);
- }
- this.mPostponedActivityResult = null;
- } else {
- this.mPostponedActivityResult = new Pair<>(requestCode, data);
- }
- }
- }
-
- private void executeChangePresence() {
- Presence.Status status = getStatusFromSpinner();
- boolean allAccounts = this.binding.allAccounts.isChecked();
- String statusMessage = this.binding.presenceStatusMessage.getText().toString().trim();
- if (allAccounts && noAccountUsesPgp()) {
- xmppConnectionService.changeStatus(status, statusMessage);
- finish();
- } else if (mAccount != null) {
- if (mAccount.getPgpId() == 0 || !hasPgp()) {
- xmppConnectionService.changeStatus(mAccount, status, statusMessage, true);
- finish();
- } else {
- xmppConnectionService.changeStatus(mAccount, status, statusMessage, false);
- announcePgp(mAccount, null, null, onPresenceChanged);
- }
- }
- }
-
- private Presence.Status getStatusFromSpinner() {
- switch (this.binding.presenceShow.getSelectedItemPosition()) {
- case 0:
- return Presence.Status.CHAT;
- case 2:
- return Presence.Status.AWAY;
- case 3:
- return Presence.Status.XA;
- case 4:
- return Presence.Status.DND;
- default:
- return Presence.Status.ONLINE;
- }
- }
-
- private void setStatusInSpinner(Presence.Status status) {
- switch (status) {
- case AWAY:
- this.binding.presenceShow.setSelection(2);
- break;
- case XA:
- this.binding.presenceShow.setSelection(3);
- break;
- case CHAT:
- this.binding.presenceShow.setSelection(0);
- break;
- case DND:
- this.binding.presenceShow.setSelection(4);
- break;
- default:
- this.binding.presenceShow.setSelection(1);
- break;
- }
- }
-
- @Override
- protected void refreshUiReal() {
-
- }
-
- @Override
- void onBackendConnected() {
- mAccount = extractAccount(getIntent());
- if (mAccount != null) {
- setStatusInSpinner(mAccount.getPresenceStatus());
- String message = mAccount.getPresenceStatusMessage();
- if (this.binding.presenceStatusMessage.getText().length() == 0 && message != null) {
- this.binding.presenceStatusMessage.append(message);
- }
- mTemplates = xmppConnectionService.getPresenceTemplates(mAccount);
- if (this.mPostponedActivityResult != null) {
- this.onActivityResult(mPostponedActivityResult.first, RESULT_OK, mPostponedActivityResult.second);
- }
- boolean e = noAccountUsesPgp();
- this.binding.allAccounts.setEnabled(e);
- }
- redrawTemplates();
- }
-
- private void redrawTemplates() {
- if (mTemplates == null || mTemplates.size() == 0) {
- this.binding.templates.setVisibility(View.GONE);
- } else {
- this.binding.templates.removeAllViews();
- this.binding.templates.setVisibility(View.VISIBLE);
- LayoutInflater inflater = getLayoutInflater();
- for (PresenceTemplate template : mTemplates) {
- View templateLayout = inflater.inflate(R.layout.presence_template, this.binding.templates, false);
- templateLayout.setTag(template);
- setListItemBackgroundOnView(templateLayout);
- templateLayout.setOnClickListener(this);
- TextView message = templateLayout.findViewById(R.id.presence_status_message);
- TextView status = templateLayout.findViewById(R.id.status);
- ImageButton button = templateLayout.findViewById(R.id.delete_button);
- button.setTag(template);
- button.setOnClickListener(this);
- ListItem.Tag tag = UIHelper.getTagForStatus(this, template.getStatus());
- status.setText(tag.getName());
- status.setBackgroundColor(tag.getColor());
- message.setText(template.getStatusMessage());
- this.binding.templates.addView(templateLayout);
- }
- }
- }
-
- @Override
- public void onClick(View v) {
- PresenceTemplate template = (PresenceTemplate) v.getTag();
- if (template == null) {
- return;
- }
- if (v.getId() == R.id.presence_template) {
- setStatusInSpinner(template.getStatus());
- this.binding.presenceStatusMessage.getEditableText().clear();
- this.binding.presenceStatusMessage.getEditableText().append(template.getStatusMessage());
- new Handler().post(() -> this.binding.scrollView.smoothScrollTo(0,0));
- } else if (v.getId() == R.id.delete_button) {
- xmppConnectionService.databaseBackend.deletePresenceTemplate(template);
- mTemplates.remove(template);
- redrawTemplates();
- }
- }
-}
diff --git a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java
index 733642579..54bfaa854 100644
--- a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java
@@ -425,9 +425,6 @@ public class SettingsActivity extends XmppActivity implements
|| name.equals(MANUALLY_CHANGE_PRESENCE)) {
xmppConnectionService.toggleScreenEventReceiver();
}
- if (name.equals(MANUALLY_CHANGE_PRESENCE) && !noAccountUsesPgp()) {
- Toast.makeText(this, R.string.republish_pgp_keys, Toast.LENGTH_LONG).show();
- }
xmppConnectionService.refreshAllPresences();
}
} else if (name.equals("dont_trust_system_cas")) {
diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java
index d38563d04..ba03663f3 100644
--- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java
@@ -556,7 +556,7 @@ public abstract class XmppActivity extends AppCompatActivity {
startActivityForResult(ChooseContactActivity.create(this,conversation), REQUEST_INVITE_TO_CONVERSATION);
}
- protected void announcePgp(Account account, final Conversation conversation, Intent intent, final Runnable onSuccess) {
+ protected void announcePgp(final Account account, final Conversation conversation, Intent intent, final Runnable onSuccess) {
if (account.getPgpId() == 0) {
choosePgpSignId(account);
} else {
@@ -567,10 +567,10 @@ public abstract class XmppActivity extends AppCompatActivity {
if (status == null) {
status = "";
}
- xmppConnectionService.getPgpEngine().generateSignature(intent, account, status, new UiCallback<Account>() {
+ xmppConnectionService.getPgpEngine().generateSignature(intent, account, status, new UiCallback<String>() {
@Override
- public void userInputRequried(PendingIntent pi, Account account) {
+ public void userInputRequried(PendingIntent pi, String signature) {
try {
startIntentSenderForResult(pi.getIntentSender(), REQUEST_ANNOUNCE_PGP, null, 0, 0, 0);
} catch (final SendIntentException ignored) {
@@ -578,7 +578,8 @@ public abstract class XmppActivity extends AppCompatActivity {
}
@Override
- public void success(Account account) {
+ public void success(String signature) {
+ account.setPgpSignature(signature);
xmppConnectionService.databaseBackend.updateAccount(account);
xmppConnectionService.sendPresence(account);
if (conversation != null) {
@@ -592,8 +593,8 @@ public abstract class XmppActivity extends AppCompatActivity {
}
@Override
- public void error(int error, Account account) {
- if (error == 0 && account != null) {
+ public void error(int error, String signature) {
+ if (error == 0) {
account.setPgpSignId(0);
account.unsetPgpSignature();
xmppConnectionService.databaseBackend.updateAccount(account);
diff --git a/src/main/res/layout/dialog_presence.xml b/src/main/res/layout/dialog_presence.xml
index bc0f30c32..164a79840 100644
--- a/src/main/res/layout/dialog_presence.xml
+++ b/src/main/res/layout/dialog_presence.xml
@@ -17,23 +17,25 @@
android:layout_marginBottom="?attr/dialog_vertical_padding">
<RadioButton
+ android:id="@+id/online"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/presence_online" />
<RadioButton
- android:id="@+id/radioButton"
+ android:id="@+id/away"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/presence_away" />
<RadioButton
- android:id="@+id/radioButton2"
+ android:id="@+id/xa"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/presence_xa" />
<RadioButton
+ android:id="@+id/dnd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/presence_dnd" />
@@ -49,7 +51,7 @@
android:layout_height="wrap_content"
android:ems="10"
android:hint="@string/status_message"
- android:inputType="textPersonName" />
+ android:inputType="textShortMessage"/>
</android.support.design.widget.TextInputLayout>
</LinearLayout>
diff --git a/src/main/res/menu/editaccount.xml b/src/main/res/menu/editaccount.xml
index c476a3ed2..fbc5841ea 100644
--- a/src/main/res/menu/editaccount.xml
+++ b/src/main/res/menu/editaccount.xml
@@ -4,7 +4,7 @@
<item
android:id="@+id/action_change_presence"
android:icon="@drawable/ic_new_releases_white_24dp"
- android:title="@string/change_presence"
+ android:title="@string/edit_status_message"
app:showAsAction="always" />
<item android:id="@+id/action_share"
diff --git a/src/main/res/values-ca/strings.xml b/src/main/res/values-ca/strings.xml
index f6caf5334..7a0db098f 100644
--- a/src/main/res/values-ca/strings.xml
+++ b/src/main/res/values-ca/strings.xml
@@ -153,7 +153,6 @@
<string name="unpublish_pgp">Treu la clau pública OpenPGP</string>
<string name="unpublish_pgp_message">Esteu segur que voleu eliminar la vostra clau pública OpenPGP de l\'anunci de la vostra presència?\nEls vostres contactes ja no podran enviar missatges xifrats amb OpenPGP.</string>
<string name="openpgp_has_been_published">S\'ha publicat la clau pública OpenPGP.</string>
- <string name="republish_pgp_keys">Recordeu tornar a publicar les vostres claus públiques de OpenPGP.</string>
<string name="mgmt_account_are_you_sure">Estàs segur?</string>
<string name="mgmt_account_delete_confirm_text">Si suprimiu el vostre compte, es perdrà tot l\'historial de la conversa</string>
<string name="attach_record_voice">Registre de veu</string>
diff --git a/src/main/res/values-ceb/strings.xml b/src/main/res/values-ceb/strings.xml
index 53a71c5da..d446125c1 100644
--- a/src/main/res/values-ceb/strings.xml
+++ b/src/main/res/values-ceb/strings.xml
@@ -165,7 +165,6 @@
<string name="unpublish_pgp">Tanggala ang OpenPGP nga publiko nga yawe</string>
<string name="unpublish_pgp_message">Sigurado ka nga imung tanggalun imung OpenPGP nga publik nga yawe gekan sa presensya sa pahibalo?\n Imung mga kontak kay dili na pwedi ipadala sa imuha ug OpenPGP nga naka-encrypt nga mga mensahe.</string>
<string name="openpgp_has_been_published">Gilunsad ang publikong yawe sa OpenPGP.</string>
- <string name="republish_pgp_keys">Hinumdumi nga ilunsad ang imong mga pang-publik nga yawe sa OpenPGP!</string>
<string name="mgmt_account_are_you_sure">Sure jud ka?</string>
<string name="mgmt_account_delete_confirm_text">Kon imong tangtangon ang imong account, ang imong tibuok kasaysayan sa gepaga-istoryahan kay mawala</string>
<string name="attach_record_voice">Irekord ang tingog</string>
diff --git a/src/main/res/values-cs/strings.xml b/src/main/res/values-cs/strings.xml
index 58af052c7..de949f07a 100644
--- a/src/main/res/values-cs/strings.xml
+++ b/src/main/res/values-cs/strings.xml
@@ -145,7 +145,6 @@
<string name="mgmt_account_publish_avatar">Zveřejnit avatar</string>
<string name="mgmt_account_publish_pgp">Zveřejnit OpenPGP klíč</string>
<string name="openpgp_has_been_published">Veřejný OpenPGP klíč byl zveřejněn.</string>
- <string name="republish_pgp_keys">Nezapomeňte znovuzveřejnit své veřejné OpenPGP klíče!</string>
<string name="mgmt_account_are_you_sure">Jste si jisti?</string>
<string name="attach_record_voice">Nahrát hlas</string>
<string name="account_settings_jabber_id">Jabber ID</string>
diff --git a/src/main/res/values-de/strings.xml b/src/main/res/values-de/strings.xml
index 533a2ee2c..f6ec65b4d 100644
--- a/src/main/res/values-de/strings.xml
+++ b/src/main/res/values-de/strings.xml
@@ -161,7 +161,6 @@
<string name="unpublish_pgp">Öffentlichen OpenPGP-Schlüssel verwerfen</string>
<string name="unpublish_pgp_message">Bist du sicher, dass du deinen öffentlichen OpenPGP-Schlüssel aus deiner Anwesenheitsmitteilung entfernen möchtest?\\nDeine Kontakte können dir dann keine OpenPGP-verschlüsselten Nachrichten senden.</string>
<string name="openpgp_has_been_published">Öffentlicher OpenPGP-Schlüssel wurde veröffentlicht.</string>
- <string name="republish_pgp_keys">Deine öffentliche OpenPGP-Schlüssel müssen veröffentlicht werden!</string>
<string name="mgmt_account_are_you_sure">Bist du dir sicher?</string>
<string name="mgmt_account_delete_confirm_text">Wenn du dein Profil löschst, gehen alle Gesprächsverläufe verloren</string>
<string name="attach_record_voice">Sprache aufzeichnen</string>
diff --git a/src/main/res/values-es/strings.xml b/src/main/res/values-es/strings.xml
index 4aa16119c..d3eeff6e4 100644
--- a/src/main/res/values-es/strings.xml
+++ b/src/main/res/values-es/strings.xml
@@ -161,7 +161,6 @@
<string name="unpublish_pgp">Eliminar la clave pública OpenPGP</string>
<string name="unpublish_pgp_message">¿Estás seguro de que quieres eliminar tu clave pública OpenPGP de tu anuncio de presencia?\nTus contactos no podrán enviarte mensajes cifrados con OpenPGP.</string>
<string name="openpgp_has_been_published">Clave pública OpenPGP ha sido publicada.</string>
- <string name="republish_pgp_keys">¡Recuerda republicar tus claves públicas OpenPGP!</string>
<string name="mgmt_account_are_you_sure">¿Estás seguro?</string>
<string name="mgmt_account_delete_confirm_text">Si borras tu cuenta, tu historial de conversaciones también se perderá</string>
<string name="attach_record_voice">Grabar audio</string>
diff --git a/src/main/res/values-eu/strings.xml b/src/main/res/values-eu/strings.xml
index 55fbe20a2..f898b7c88 100644
--- a/src/main/res/values-eu/strings.xml
+++ b/src/main/res/values-eu/strings.xml
@@ -149,7 +149,6 @@
<string name="unpublish_pgp">OpenPGP gako publikoa kendu</string>
<string name="unpublish_pgp_message">Ziur zure OpenPGP gako publikoa zure presentzia eguneraketetatik kendu nahi duzula?\nZure kontaktuek ezin dizute gehiago OpenPGPz enkriptatutako mezuak bidali.</string>
<string name="openpgp_has_been_published">OpenPGP gako publikoa argitaratu da.</string>
- <string name="republish_pgp_keys">Gogoratu ezazu zure OpenPGP gako publikoak birrargitaratzeaz!</string>
<string name="mgmt_account_are_you_sure">Ziur al zaude?</string>
<string name="mgmt_account_delete_confirm_text">Zure kontua ezabatzen baduzu, zure elkarrizketen historia guztia galduko da</string>
<string name="attach_record_voice">Ahotsa grabatu</string>
diff --git a/src/main/res/values-fil/strings.xml b/src/main/res/values-fil/strings.xml
index a4112e089..29722d1e4 100644
--- a/src/main/res/values-fil/strings.xml
+++ b/src/main/res/values-fil/strings.xml
@@ -165,7 +165,6 @@
<string name="unpublish_pgp">Alisin ang OpenPGP public key</string>
<string name="unpublish_pgp_message">Sigurado kabang ailisin sa iyong presensyang anunsyo ang OpenPGP public key? Ang iyong mga kontak ay hindi na pwedeng magpadala sayo ng OpenPGP encrypted na mga mensahe.</string>
<string name="openpgp_has_been_published">Napublish na ang OpenPGP public key.</string>
- <string name="republish_pgp_keys">Tandaan na i-publish ulit ang iyong OpenPGP public keys!</string>
<string name="mgmt_account_are_you_sure">Sigurado ka ba?</string>
<string name="mgmt_account_delete_confirm_text">Kapag dinelete mo ang iyong account, ang lahat na pag-uusap na nangyari sa iyong account ay mawala</string>
<string name="attach_record_voice">I-rekord ang boses</string>
diff --git a/src/main/res/values-fr/strings.xml b/src/main/res/values-fr/strings.xml
index a811bd0f9..856e3da4b 100644
--- a/src/main/res/values-fr/strings.xml
+++ b/src/main/res/values-fr/strings.xml
@@ -145,7 +145,6 @@
<string name="unpublish_pgp">Supprimer la clef publique OpenPGP</string>
<string name="unpublish_pgp_message">Êtes vous sûr de vouloir supprimer votre clef publique OpenPGP de votre annonce de présence?\nVos contacts ne pourront plus vous envoyer de message chiffrés avec OpenPGP.</string>
<string name="openpgp_has_been_published">La clef publique OpenPGP a été publiée</string>
- <string name="republish_pgp_keys">N\'oubliez pas de republier votre clef publique OpenPGP!</string>
<string name="mgmt_account_are_you_sure">Êtes-vous sûr?</string>
<string name="mgmt_account_delete_confirm_text">Si vous supprimez votre compte ainsi que tout votre historique de conversation sera perdu</string>
<string name="attach_record_voice">Enregistrer un son</string>
diff --git a/src/main/res/values-gl/strings.xml b/src/main/res/values-gl/strings.xml
index 0f6d1d2c1..2be2b35d4 100644
--- a/src/main/res/values-gl/strings.xml
+++ b/src/main/res/values-gl/strings.xml
@@ -153,7 +153,6 @@
<string name="unpublish_pgp">Eliminar a chave pública OpenPGP</string>
<string name="unpublish_pgp_message">Está seguro de que quere eliminar a súa chave pública OpenPGP do seu anuncio de presencia? \nOs seus contactos non poderán enviarlle mensaxes cifradas con OpenPGP.</string>
<string name="openpgp_has_been_published">Publicouse a chave pública OpenPGP</string>
- <string name="republish_pgp_keys">Lembre voltar a publicar a súas chaves OpenPGP!</string>
<string name="mgmt_account_are_you_sure">Seguro?</string>
<string name="mgmt_account_delete_confirm_text">Si elimina a conta perderá todo o historial de conversas</string>
<string name="attach_record_voice">Grabar audio</string>
diff --git a/src/main/res/values-id/strings.xml b/src/main/res/values-id/strings.xml
index cbee0299f..7b1808606 100644
--- a/src/main/res/values-id/strings.xml
+++ b/src/main/res/values-id/strings.xml
@@ -165,7 +165,6 @@
<string name="unpublish_pgp">Hapus kunci terbuka OpenPGP</string>
<string name="unpublish_pgp_message">Yakin ingin menghapus kunci terbuka OpenPGP dari pemberitahuan anda?\nkontak anda tidak lagi dapat mengirimkan pesan terenkripsi OpenPGP.</string>
<string name="openpgp_has_been_published">Kunci terbuka OpenPGP telah ditampilkan.</string>
- <string name="republish_pgp_keys">Ingatlah untuk menampilkan kembali kunci terbuka OpenPGP anda!</string>
<string name="mgmt_account_are_you_sure">Apakah kamu yakin?</string>
<string name="mgmt_account_delete_confirm_text">Jika anda menghapus akun anda, semua riwayat percakapan anda akan hilang</string>
<string name="attach_record_voice">Rekam suara</string>
diff --git a/src/main/res/values-it/strings.xml b/src/main/res/values-it/strings.xml
index 554026f64..f0ffebcd9 100644
--- a/src/main/res/values-it/strings.xml
+++ b/src/main/res/values-it/strings.xml
@@ -153,7 +153,6 @@
<string name="unpublish_pgp">Rimuovi chiave pubblica OpenPGP</string>
<string name="unpublish_pgp_message">Sei sicuro di volere rimuovere la tua chiave pubblica OpenPGP dalla dichiarazione di presenza?\nI tuoi contatti non potranno più inviarti messaggi cifrati con OpenPGP.</string>
<string name="openpgp_has_been_published">La chiave pubblica OpenPGP è stata pubblicata.</string>
- <string name="republish_pgp_keys">Ricorda di ripubblicare le tue chiavi pubbliche OpenPGP!</string>
<string name="mgmt_account_are_you_sure">Sei sicuro?</string>
<string name="mgmt_account_delete_confirm_text">Se elimini il tuo account perderai tutta la cronologia delle conversazioni</string>
<string name="attach_record_voice">Registra la voce</string>
diff --git a/src/main/res/values-nl/strings.xml b/src/main/res/values-nl/strings.xml
index 1c7f7be78..dedccd5f0 100644
--- a/src/main/res/values-nl/strings.xml
+++ b/src/main/res/values-nl/strings.xml
@@ -153,7 +153,6 @@
<string name="unpublish_pgp">OpenPGP-publieke sleutel verwijderen</string>
<string name="unpublish_pgp_message">Weet je zeker dat je je OpenPGP-publieke sleutel uit je aanwezigheidsaankondiging wil verwijderen?\nJe contacten zullen je geen OpenPGP-versleutelde berichten meer kunnen sturen.</string>
<string name="openpgp_has_been_published">OpenPGP-publieke sleutel is gepubliceerd.</string>
- <string name="republish_pgp_keys">Vergeet niet je OpenPGP-publieke sleutels opnieuw te publiceren!</string>
<string name="mgmt_account_are_you_sure">Weet je het zeker?</string>
<string name="mgmt_account_delete_confirm_text">Als je je account verwijdert, wordt je volledige gespreksgeschiedenis gewist</string>
<string name="attach_record_voice">Stem opnemen</string>
diff --git a/src/main/res/values-pl/strings.xml b/src/main/res/values-pl/strings.xml
index 1f3848e07..f4d3b0d90 100644
--- a/src/main/res/values-pl/strings.xml
+++ b/src/main/res/values-pl/strings.xml
@@ -152,7 +152,6 @@
<string name="unpublish_pgp">Usuń klucz publiczny OpenPGP</string>
<string name="unpublish_pgp_message">Czy na pewno chcesz usunąć klucz publiczny OpenPGP ze swojej propagacji obecności?\nTwoje kontakty nie będą już mogły wysyłać Ci wiadomości zaszyfrowanych OpenPGP.</string>
<string name="openpgp_has_been_published">Klucz publiczny OpenPGP został opublikowany.</string>
- <string name="republish_pgp_keys">Pamiętaj, by ponownie opublikować swoje klucze publiczne OpenPGP!</string>
<string name="mgmt_account_are_you_sure">Czy na pewno?</string>
<string name="mgmt_account_delete_confirm_text">Jeśli usuniesz swoje konto, cała historia wiadomości zostanie stracona.</string>
<string name="attach_record_voice">Nagraj głos</string>
diff --git a/src/main/res/values-ro/strings.xml b/src/main/res/values-ro/strings.xml
index aa278bf02..9c6b2fd04 100644
--- a/src/main/res/values-ro/strings.xml
+++ b/src/main/res/values-ro/strings.xml
@@ -157,7 +157,6 @@
<string name="unpublish_pgp">Șterge cheia publică OpenPGP</string>
<string name="unpublish_pgp_message">Sigur doriți să vă ștergeți cheia publică OpenPGP din mesajele de prezență?\nContactele dumneavoastră nu vor mai putea să vă trimită mesaje criptate cu OpenPGP.</string>
<string name="openpgp_has_been_published">Cheia publică OpenPGP a fost publicată.</string>
- <string name="republish_pgp_keys">Amintiți-vă să vă republicați cheile publice OpenPGP!</string>
<string name="mgmt_account_are_you_sure">Sigur doriți asta?</string>
<string name="mgmt_account_delete_confirm_text">Dacă vă ștergeți contul, întregul istoric de conversații va fi pierdut</string>
<string name="attach_record_voice">Înregistrare voce</string>
diff --git a/src/main/res/values-sv/strings.xml b/src/main/res/values-sv/strings.xml
index bfe43e344..0bfb46e99 100644
--- a/src/main/res/values-sv/strings.xml
+++ b/src/main/res/values-sv/strings.xml
@@ -149,7 +149,6 @@
<string name="unpublish_pgp">Ta bort OpenPGP publik nyckel</string>
<string name="unpublish_pgp_message">Är du säker på att du vill ta bort din OpenPGP publik nyckel från din tillgänglighetsuppdatering?\nDina kontakter kommer inte längre att kunna skicka dig OpenPGP-krypterade meddelande.</string>
<string name="openpgp_has_been_published">OpenPGP-nyckel har publicerats.</string>
- <string name="republish_pgp_keys">Kom ihåg att återpublicera dina publika OpenPGP nycklar.</string>
<string name="mgmt_account_are_you_sure">Är du säker?</string>
<string name="mgmt_account_delete_confirm_text">Om du tar bort ditt konto kommer hela konversationshistoriken att försvinna</string>
<string name="attach_record_voice">Spela in röst</string>
diff --git a/src/main/res/values-tr/strings.xml b/src/main/res/values-tr/strings.xml
index 734ab3267..75b84374c 100644
--- a/src/main/res/values-tr/strings.xml
+++ b/src/main/res/values-tr/strings.xml
@@ -165,7 +165,6 @@
<string name="unpublish_pgp">OpenPGP genel anahtarını kaldırın</string>
<string name="unpublish_pgp_message">OpenPGP genel anahtarınızı varlığınızın duyurusundan kaldırmak istediğinize emin misiniz? \ N Kişileriniz artık size OpenPGP şifrelenmiş mesajlar gönderemeyecek.</string>
<string name="openpgp_has_been_published">OpenPGP genel anahtarı paylaşıldı.</string>
- <string name="republish_pgp_keys">OpenPGP genel anahtarlarınızı tekrar yayınlamayı unutmayın!</string>
<string name="mgmt_account_are_you_sure">Emin misiniz?</string>
<string name="mgmt_account_delete_confirm_text">Hesabınızı silerseniz, tüm görüşme geçmişiniz kaybolur</string>
<string name="attach_record_voice">Kayıt sesi</string>
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 2b08ef294..41dc187be 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -160,7 +160,6 @@
<string name="unpublish_pgp">Remove OpenPGP public key</string>
<string name="unpublish_pgp_message">Are you sure you want to remove your OpenPGP public key from your presence announcement?\nYour contacts will no longer be able to send you OpenPGP encrypted messages.</string>
<string name="openpgp_has_been_published">OpenPGP public key has been published.</string>
- <string name="republish_pgp_keys">Remember to republish your OpenPGP public keys!</string>
<string name="mgmt_account_are_you_sure">Are you sure?</string>
<string name="mgmt_account_delete_confirm_text">If you delete your account, your entire conversation history will be lost</string>
<string name="attach_record_voice">Record voice</string>
@@ -468,7 +467,7 @@
<string name="account_status_bind_failure">Bind failure</string>
<string name="account_status_host_unknown">Server not responsible for domain</string>
<string name="server_info_broken">Broken</string>
- <string name="pref_presence_settings">Presence</string>
+ <string name="pref_presence_settings">Availability</string>
<string name="pref_away_when_screen_off">Away when screen is off</string>
<string name="pref_away_when_screen_off_summary">Marks your resource as away when the screen is turned off</string>
<string name="pref_dnd_on_silent_mode">\"Do not disturb\" in silent mode</string>
@@ -561,8 +560,8 @@
<string name="create_account">Create new account</string>
<string name="use_existing_accout">Use an existing account</string>
<string name="pick_your_username">Choose your username</string>
- <string name="pref_manually_change_presence">Manually change presence</string>
- <string name="pref_manually_change_presence_summary">Change your presence inside your account</string>
+ <string name="pref_manually_change_presence">Manage availability manually</string>
+ <string name="pref_manually_change_presence_summary">Set your availability when editing your status message.</string>
<string name="change_presence">Change Presence</string>
<string name="status_message">Status message</string>
<string name="all_accounts_on_this_device">Set for all accounts on this device</string>
@@ -770,4 +769,6 @@
<string name="pref_scroll_to_bottom_summary">Scroll down after sending a message</string>
<string name="pref_scroll_to_bottom">Scroll to bottom</string>
<string name="no_camera_permission">Pix-Art Messenger needs access to the camera</string>
+ <string name="edit_status_message_title">Edit Status Message</string>
+ <string name="edit_status_message">Edit status message</string>
</resources>