diff options
Diffstat (limited to 'src')
19 files changed, 54 insertions, 13 deletions
diff --git a/src/main/java/de/pixart/messenger/services/AlarmReceiver.java b/src/main/java/de/pixart/messenger/services/AlarmReceiver.java index e20b567dd..e4c07366d 100644 --- a/src/main/java/de/pixart/messenger/services/AlarmReceiver.java +++ b/src/main/java/de/pixart/messenger/services/AlarmReceiver.java @@ -3,9 +3,11 @@ package de.pixart.messenger.services; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; +import android.support.v4.content.ContextCompat; import android.util.Log; import de.pixart.messenger.Config; +import de.pixart.messenger.utils.Compatibility; public class AlarmReceiver extends BroadcastReceiver { public static final int SCHEDULE_ALARM_REQUEST_CODE = 523976483; @@ -14,8 +16,15 @@ public class AlarmReceiver extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { if (intent.getAction().contains("exportlogs")) { Log.d(Config.LOGTAG, "Received alarm broadcast to export logs"); - Intent i = new Intent(context, ExportLogsService.class); - context.startService(i); + try { + if (Compatibility.runsAndTargetsTwentySix(context)) { + ContextCompat.startForegroundService(context, new Intent(context, ExportLogsService.class)); + } else { + context.startService(new Intent(context, ExportLogsService.class)); + } + } catch (RuntimeException e) { + Log.d(Config.LOGTAG, "AlarmReceiver was unable to start ExportLogsService"); + } } } } diff --git a/src/main/java/de/pixart/messenger/services/NotificationService.java b/src/main/java/de/pixart/messenger/services/NotificationService.java index 3d19e05c7..c186732bf 100644 --- a/src/main/java/de/pixart/messenger/services/NotificationService.java +++ b/src/main/java/de/pixart/messenger/services/NotificationService.java @@ -505,7 +505,7 @@ public class NotificationService { mBuilder.setContentText(names.toString()); mBuilder.setStyle(style); if (conversation != null) { - mBuilder.setContentIntent(createContentIntent(conversation)); + mBuilder.setContentIntent(createOpenConversationsIntent()); } mBuilder.setGroupSummary(true); mBuilder.setGroup(CONVERSATIONS_GROUP); diff --git a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java index 775e8f6dc..3d9c0e63e 100644 --- a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java +++ b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java @@ -440,10 +440,14 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat protected void updateInfoButtons() { if (this.binding.accountRegisterNew.isChecked() && this.binding.accountJid.getText().length() > 0 && !this.binding.accountJid.getText().toString().contains("@")) { - final String jid = this.binding.accountJid.getText().toString(); - if (!mUsernameMode && Jid.of(jid).getDomain().toLowerCase().equals("pix-art.de")) { - this.binding.showPrivacyPolicy.setVisibility(View.VISIBLE); - this.binding.showTermsOfUse.setVisibility(View.VISIBLE); + try { + final String jid = this.binding.accountJid.getText().toString(); + if (!mUsernameMode && Jid.of(jid).getDomain().toLowerCase().equals("pix-art.de")) { + this.binding.showPrivacyPolicy.setVisibility(View.VISIBLE); + this.binding.showTermsOfUse.setVisibility(View.VISIBLE); + } + } catch (Exception e) { + e.printStackTrace(); } } else { this.binding.showPrivacyPolicy.setVisibility(View.GONE); @@ -600,6 +604,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat final MenuItem changePresence = menu.findItem(R.id.action_change_presence); final MenuItem actionShare = menu.findItem(R.id.action_share); final MenuItem shareBarcode = menu.findItem(R.id.action_share_barcode); + final MenuItem shareQRCode = menu.findItem(R.id.action_show_qr_code); final MenuItem announcePGP = menu.findItem(R.id.mgmt_account_announce_pgp); renewCertificate.setVisible(mAccount != null && mAccount.getPrivateKeyAlias() != null); @@ -624,6 +629,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat changePresence.setVisible(false); actionShare.setVisible(false); shareBarcode.setVisible(false); + shareQRCode.setVisible(false); } if (mAccount != null) { diff --git a/src/main/java/de/pixart/messenger/ui/LocationActivity.java b/src/main/java/de/pixart/messenger/ui/LocationActivity.java index ed42c4636..ec8893e5e 100644 --- a/src/main/java/de/pixart/messenger/ui/LocationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/LocationActivity.java @@ -27,6 +27,9 @@ public abstract class LocationActivity extends XmppActivity implements LocationL protected abstract void setmLastLocation(final Location location); protected void requestLocationUpdates() { + if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { + return; + } final Location lastKnownLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); if (lastKnownLocation != null) { setmLastLocation(lastKnownLocation); diff --git a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java index 1c0992cf1..5d3b0cfd7 100644 --- a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java @@ -39,6 +39,7 @@ import de.pixart.messenger.entities.Account; import de.pixart.messenger.services.ExportLogsService; import de.pixart.messenger.services.MemorizingTrustManager; import de.pixart.messenger.ui.util.StyledAttributes; +import de.pixart.messenger.utils.Compatibility; import de.pixart.messenger.utils.TimeframeUtils; import rocks.xmpp.addr.Jid; @@ -547,7 +548,15 @@ public class SettingsActivity extends XmppActivity implements } private void startExport() { - ContextCompat.startForegroundService(this, new Intent(this, ExportLogsService.class)); + try { + if (Compatibility.runsAndTargetsTwentySix(this)) { + ContextCompat.startForegroundService(this, new Intent(this, ExportLogsService.class)); + } else { + this.startService(new Intent(this, ExportLogsService.class)); + } + } catch (RuntimeException e) { + Log.d(Config.LOGTAG, "SettingsActivity was unable to start ExportLogsService"); + } } private void displayToast(final String msg) { diff --git a/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java b/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java index fbed2daeb..046c9cba0 100644 --- a/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java +++ b/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java @@ -46,6 +46,7 @@ public class UpdaterActivity extends XmppActivity { String store; ProgressDialog mProgressDialog; DownloadTask downloadTask; + TextView textView; @Override protected void onCreate(Bundle savedInstanceState) { @@ -56,8 +57,7 @@ public class UpdaterActivity extends XmppActivity { this.mTheme = findTheme(); setTheme(this.mTheme); - TextView textView = findViewById(R.id.updater); - textView.setText(R.string.update_info); + textView = findViewById(R.id.updater); mProgressDialog = new ProgressDialog(UpdaterActivity.this) { //show warning on back pressed @@ -85,6 +85,7 @@ public class UpdaterActivity extends XmppActivity { this.mTheme = findTheme(); setTheme(this.mTheme); setTitle(getString(R.string.update_service)); + textView.setText(R.string.update_info); setSupportActionBar(findViewById(R.id.toolbar)); configureActionBar(getSupportActionBar()); if (getIntent() != null && getIntent().getStringExtra("update").equals("PixArtMessenger_UpdateService")) { diff --git a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java index dd24c440d..8ba2587b5 100644 --- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java +++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java @@ -413,12 +413,17 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie private void displayXmppMessage(final ViewHolder viewHolder, final String body) { String contact = body.toLowerCase(); contact = contact.split(":")[1]; + boolean group = (contact.split("\\?")[1]) != null && (contact.split("\\?")[1]).length() > 0 && (contact.split("\\?")[1]).equalsIgnoreCase("join"); contact = contact.split("\\?")[0]; String add_contact = activity.getString(R.string.add_to_contact_list) + " (" + contact + ")"; viewHolder.audioPlayer.setVisibility(View.GONE); viewHolder.download_button.setVisibility(View.VISIBLE); viewHolder.download_button.setText(add_contact); - viewHolder.download_button.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_account_card_details_grey600_48dp, 0, 0, 0); + if (group) { + viewHolder.download_button.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_account_multiple_plus_grey600_48dp, 0, 0, 0); + } else { + viewHolder.download_button.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_account_plus_grey600_48dp, 0, 0, 0); + } viewHolder.download_button.setOnClickListener(v -> { try { Intent intent = new Intent(Intent.ACTION_VIEW); diff --git a/src/main/res/drawable-hdpi/ic_account_multiple_plus_grey600_48dp.png b/src/main/res/drawable-hdpi/ic_account_multiple_plus_grey600_48dp.png Binary files differnew file mode 100644 index 000000000..43518be0c --- /dev/null +++ b/src/main/res/drawable-hdpi/ic_account_multiple_plus_grey600_48dp.png diff --git a/src/main/res/drawable-hdpi/ic_account_plus_grey600_48dp.png b/src/main/res/drawable-hdpi/ic_account_plus_grey600_48dp.png Binary files differnew file mode 100644 index 000000000..f922777ef --- /dev/null +++ b/src/main/res/drawable-hdpi/ic_account_plus_grey600_48dp.png diff --git a/src/main/res/drawable-mdpi/ic_account_multiple_plus_grey600_48dp.png b/src/main/res/drawable-mdpi/ic_account_multiple_plus_grey600_48dp.png Binary files differnew file mode 100644 index 000000000..bc1099bd2 --- /dev/null +++ b/src/main/res/drawable-mdpi/ic_account_multiple_plus_grey600_48dp.png diff --git a/src/main/res/drawable-mdpi/ic_account_plus_grey600_48dp.png b/src/main/res/drawable-mdpi/ic_account_plus_grey600_48dp.png Binary files differnew file mode 100644 index 000000000..da2e9201d --- /dev/null +++ b/src/main/res/drawable-mdpi/ic_account_plus_grey600_48dp.png diff --git a/src/main/res/drawable-xhdpi/ic_account_multiple_plus_grey600_48dp.png b/src/main/res/drawable-xhdpi/ic_account_multiple_plus_grey600_48dp.png Binary files differnew file mode 100644 index 000000000..104d3284f --- /dev/null +++ b/src/main/res/drawable-xhdpi/ic_account_multiple_plus_grey600_48dp.png diff --git a/src/main/res/drawable-xhdpi/ic_account_plus_grey600_48dp.png b/src/main/res/drawable-xhdpi/ic_account_plus_grey600_48dp.png Binary files differnew file mode 100644 index 000000000..9824b4aa8 --- /dev/null +++ b/src/main/res/drawable-xhdpi/ic_account_plus_grey600_48dp.png diff --git a/src/main/res/drawable-xxhdpi/ic_account_multiple_plus_grey600_48dp.png b/src/main/res/drawable-xxhdpi/ic_account_multiple_plus_grey600_48dp.png Binary files differnew file mode 100644 index 000000000..ef22d5cea --- /dev/null +++ b/src/main/res/drawable-xxhdpi/ic_account_multiple_plus_grey600_48dp.png diff --git a/src/main/res/drawable-xxhdpi/ic_account_plus_grey600_48dp.png b/src/main/res/drawable-xxhdpi/ic_account_plus_grey600_48dp.png Binary files differnew file mode 100644 index 000000000..9e4797692 --- /dev/null +++ b/src/main/res/drawable-xxhdpi/ic_account_plus_grey600_48dp.png diff --git a/src/main/res/drawable-xxxhdpi/ic_account_multiple_plus_grey600_48dp.png b/src/main/res/drawable-xxxhdpi/ic_account_multiple_plus_grey600_48dp.png Binary files differnew file mode 100644 index 000000000..bb0090be1 --- /dev/null +++ b/src/main/res/drawable-xxxhdpi/ic_account_multiple_plus_grey600_48dp.png diff --git a/src/main/res/drawable-xxxhdpi/ic_account_plus_grey600_48dp.png b/src/main/res/drawable-xxxhdpi/ic_account_plus_grey600_48dp.png Binary files differnew file mode 100644 index 000000000..37bf7dbab --- /dev/null +++ b/src/main/res/drawable-xxxhdpi/ic_account_plus_grey600_48dp.png diff --git a/src/main/res/layout/activity_updater.xml b/src/main/res/layout/activity_updater.xml index 7dc7bae15..5079bb605 100644 --- a/src/main/res/layout/activity_updater.xml +++ b/src/main/res/layout/activity_updater.xml @@ -18,7 +18,6 @@ android:layout_below="@id/toolbar" android:layout_centerHorizontal="true" android:padding="@dimen/card_padding_regular" - android:text="Current" android:textAppearance="@style/TextAppearance.Conversations.Body1" android:textStyle="normal" /> diff --git a/src/standardPush/java/de/pixart/messenger/services/InstanceIdService.java b/src/standardPush/java/de/pixart/messenger/services/InstanceIdService.java index 3e9a00a3c..d812105aa 100644 --- a/src/standardPush/java/de/pixart/messenger/services/InstanceIdService.java +++ b/src/standardPush/java/de/pixart/messenger/services/InstanceIdService.java @@ -1,15 +1,24 @@ package de.pixart.messenger.services; import android.content.Intent; +import android.support.v4.content.ContextCompat; +import android.util.Log; import com.google.firebase.iid.FirebaseInstanceIdService; +import de.pixart.messenger.Config; +import de.pixart.messenger.utils.Compatibility; + public class InstanceIdService extends FirebaseInstanceIdService { @Override public void onTokenRefresh() { Intent intent = new Intent(this, XmppConnectionService.class); intent.setAction(XmppConnectionService.ACTION_FCM_TOKEN_REFRESH); - startService(intent); + try { + startService(intent); + } catch (Exception e) { + Log.e(Config.LOGTAG, "unable to refresh FCM token", e); + } } } |