From 5dd83a5fe685dd3268986ca0a73f21c4dcbc6af5 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 11 Jul 2015 21:23:58 +0200 Subject: null check otr fingerprint before display --- src/main/java/eu/siacs/conversations/utils/CryptoHelper.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/eu/siacs/conversations/utils/CryptoHelper.java b/src/main/java/eu/siacs/conversations/utils/CryptoHelper.java index 466bc409..2dec203d 100644 --- a/src/main/java/eu/siacs/conversations/utils/CryptoHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/CryptoHelper.java @@ -91,7 +91,9 @@ public final class CryptoHelper { } public static String prettifyFingerprint(String fingerprint) { - if (fingerprint.length() < 40) { + if (fingerprint==null) { + return ""; + } else if (fingerprint.length() < 40) { return fingerprint; } StringBuilder builder = new StringBuilder(fingerprint); -- cgit v1.2.3 From 4274fe90ac8d08cd7e837d7c03a91ed9ea0f9b19 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 11 Jul 2015 21:24:30 +0200 Subject: try to catch weird npe in android sdk --- src/main/java/eu/siacs/conversations/persistance/FileBackend.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java index ee53e90e..ab191285 100644 --- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java @@ -235,6 +235,8 @@ public class FileBackend { } else { throw new FileCopyException(R.string.error_out_of_memory); } + } catch (NullPointerException e) { + throw new FileCopyException(R.string.error_io_exception); } finally { close(os); close(is); -- cgit v1.2.3 From 58bc4cba0656d2dcdd554097ae5f8362bfb478a0 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 11 Jul 2015 21:24:51 +0200 Subject: only try to change affilations for known jids --- .../java/eu/siacs/conversations/services/XmppConnectionService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 2dd0f04c..ee212aed 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -1699,7 +1699,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa public void changeAffiliationsInConference(final Conversation conference, MucOptions.Affiliation before, MucOptions.Affiliation after) { List jids = new ArrayList<>(); for (MucOptions.User user : conference.getMucOptions().getUsers()) { - if (user.getAffiliation() == before) { + if (user.getAffiliation() == before && user.getJid() != null) { jids.add(user.getJid()); } } -- cgit v1.2.3 From 558d065d48b43c190cac706870cf8d97c70ecbfd Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 12 Jul 2015 17:59:22 +0200 Subject: made lock button reflect encryption status of the next messages instead of the last --- .../conversations/ui/ConversationActivity.java | 26 +++++++++------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index a507a5fe..a488e3f2 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -374,8 +374,7 @@ public class ConversationActivity extends XmppActivity } else { menuAdd.setVisible(!isConversationsOverviewHideable()); if (this.getSelectedConversation() != null) { - if (this.getSelectedConversation().getLatestMessage() - .getEncryption() != Message.ENCRYPTION_NONE) { + if (this.getSelectedConversation().getNextEncryption(forceEncryption()) != Message.ENCRYPTION_NONE) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { menuSecure.setIcon(R.drawable.ic_lock_white_24dp); } else { @@ -740,14 +739,11 @@ public class ConversationActivity extends XmppActivity break; case R.id.encryption_choice_pgp: if (hasPgp()) { - if (conversation.getAccount().getKeys() - .has("pgp_signature")) { - conversation - .setNextEncryption(Message.ENCRYPTION_PGP); + if (conversation.getAccount().getKeys().has("pgp_signature")) { + conversation.setNextEncryption(Message.ENCRYPTION_PGP); item.setChecked(true); } else { - announcePgp(conversation.getAccount(), - conversation); + announcePgp(conversation.getAccount(),conversation); } } else { showInstallPgpDialog(); @@ -757,16 +753,16 @@ public class ConversationActivity extends XmppActivity conversation.setNextEncryption(Message.ENCRYPTION_NONE); break; } - xmppConnectionService.databaseBackend - .updateConversation(conversation); + xmppConnectionService.databaseBackend.updateConversation(conversation); fragment.updateChatMsgHint(); + invalidateOptionsMenu(); return true; } }); popup.inflate(R.menu.encryption_choices); MenuItem otr = popup.getMenu().findItem(R.id.encryption_choice_otr); - MenuItem none = popup.getMenu().findItem( - R.id.encryption_choice_none); + MenuItem none = popup.getMenu().findItem(R.id.encryption_choice_none); + MenuItem pgp = popup.getMenu().findItem(R.id.encryption_choice_pgp); if (conversation.getMode() == Conversation.MODE_MULTI) { otr.setEnabled(false); } else { @@ -782,12 +778,10 @@ public class ConversationActivity extends XmppActivity otr.setChecked(true); break; case Message.ENCRYPTION_PGP: - popup.getMenu().findItem(R.id.encryption_choice_pgp) - .setChecked(true); + pgp.setChecked(true); break; default: - popup.getMenu().findItem(R.id.encryption_choice_none) - .setChecked(true); + none.setChecked(true); break; } popup.show(); -- cgit v1.2.3 From 84bfe8c72132923bfb6ac6f6adb2c56d1d037172 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 12 Jul 2015 20:17:12 +0200 Subject: catch exception on broken android phones --- src/main/java/eu/siacs/conversations/ui/ConversationFragment.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 7983fdca..d254ece7 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -3,6 +3,7 @@ package eu.siacs.conversations.ui; import android.app.AlertDialog; import android.app.Fragment; import android.app.PendingIntent; +import android.content.ActivityNotFoundException; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; @@ -513,7 +514,12 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa } shareIntent.setType(mime); } - activity.startActivity(Intent.createChooser(shareIntent, getText(R.string.share_with))); + try { + activity.startActivity(Intent.createChooser(shareIntent, getText(R.string.share_with))); + } catch (ActivityNotFoundException e) { + //This should happen only on faulty androids because normally chooser is always available + Toast.makeText(activity,R.string.no_application_found_to_open_file,Toast.LENGTH_SHORT).show(); + } } private void copyText(Message message) { -- cgit v1.2.3 From ffffca10f0c3e399fbbcde200ea4758acc5ba03f Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 13 Jul 2015 12:55:13 +0200 Subject: renamed colors --- .../services/NotificationService.java | 2 +- .../eu/siacs/conversations/ui/XmppActivity.java | 20 +++---- src/main/res/drawable/es_slidingpane_shadow.xml | 2 +- src/main/res/drawable/grey.xml | 2 +- src/main/res/drawable/infocard_border.xml | 4 +- src/main/res/drawable/message_border.xml | 2 +- src/main/res/drawable/snackbar.xml | 2 +- .../fragment_conversations_overview.xml | 6 +- src/main/res/layout/account_row.xml | 4 +- src/main/res/layout/actionview_search.xml | 4 +- src/main/res/layout/activity_about.xml | 4 +- src/main/res/layout/activity_change_password.xml | 22 ++++---- src/main/res/layout/activity_contact_details.xml | 12 ++-- src/main/res/layout/activity_edit_account.xml | 64 +++++++++++----------- src/main/res/layout/activity_muc_details.xml | 12 ++-- .../layout/activity_publish_profile_picture.xml | 16 +++--- .../res/layout/activity_start_conversation.xml | 2 +- src/main/res/layout/activity_verify_otr.xml | 24 ++++---- src/main/res/layout/contact.xml | 6 +- src/main/res/layout/contact_key.xml | 4 +- src/main/res/layout/conversation_list_row.xml | 12 ++-- src/main/res/layout/create_contact_dialog.xml | 8 +-- src/main/res/layout/fragment_conversation.xml | 14 ++--- .../res/layout/fragment_conversations_overview.xml | 6 +- src/main/res/layout/join_conference_dialog.xml | 8 +-- src/main/res/layout/list_item_tag.xml | 2 +- src/main/res/layout/manage_accounts.xml | 4 +- src/main/res/layout/message_received.xml | 8 +-- src/main/res/layout/message_sent.xml | 8 +-- src/main/res/layout/message_status.xml | 2 +- src/main/res/layout/quickedit.xml | 2 +- src/main/res/values-v21/themes.xml | 4 +- src/main/res/values/colors.xml | 28 +++++----- src/main/res/values/strings.xml | 1 + src/main/res/values/styles.xml | 2 +- src/main/res/values/themes.xml | 4 +- 36 files changed, 162 insertions(+), 165 deletions(-) (limited to 'src') diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java index 2b59e473..956f704e 100644 --- a/src/main/java/eu/siacs/conversations/services/NotificationService.java +++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java @@ -178,7 +178,7 @@ public class NotificationService { } private void setNotificationColor(final Builder mBuilder) { - mBuilder.setColor(mXmppConnectionService.getResources().getColor(R.color.primary)); + mBuilder.setColor(mXmppConnectionService.getResources().getColor(R.color.green500)); } private void updateNotification(final boolean notify) { diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java index ddad1e30..7c994c31 100644 --- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java @@ -334,14 +334,14 @@ public abstract class XmppActivity extends Activity { super.onCreate(savedInstanceState); metrics = getResources().getDisplayMetrics(); ExceptionHelper.init(getApplicationContext()); - mPrimaryTextColor = getResources().getColor(R.color.primarytext); - mSecondaryTextColor = getResources().getColor(R.color.secondarytext); - mColorRed = getResources().getColor(R.color.red); - mColorOrange = getResources().getColor(R.color.orange); - mColorGreen = getResources().getColor(R.color.green); - mPrimaryColor = getResources().getColor(R.color.primary); - mPrimaryBackgroundColor = getResources().getColor(R.color.primarybackground); - mSecondaryBackgroundColor = getResources().getColor(R.color.secondarybackground); + mPrimaryTextColor = getResources().getColor(R.color.black87); + mSecondaryTextColor = getResources().getColor(R.color.black54); + mColorRed = getResources().getColor(R.color.red500); + mColorOrange = getResources().getColor(R.color.orange500); + mColorGreen = getResources().getColor(R.color.green500); + mPrimaryColor = getResources().getColor(R.color.green500); + mPrimaryBackgroundColor = getResources().getColor(R.color.grey50); + mSecondaryBackgroundColor = getResources().getColor(R.color.grey200); this.mTheme = findTheme(); setTheme(this.mTheme); this.mUsingEnterKey = usingEnterKey(); @@ -719,10 +719,6 @@ public abstract class XmppActivity extends Activity { return this.mColorRed; } - public int getPrimaryColor() { - return this.mPrimaryColor; - } - public int getOnlineColor() { return this.mColorGreen; } diff --git a/src/main/res/drawable/es_slidingpane_shadow.xml b/src/main/res/drawable/es_slidingpane_shadow.xml index 44ffd4ea..de96e08f 100644 --- a/src/main/res/drawable/es_slidingpane_shadow.xml +++ b/src/main/res/drawable/es_slidingpane_shadow.xml @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/src/main/res/drawable/infocard_border.xml b/src/main/res/drawable/infocard_border.xml index 7c7ded57..e01e1442 100644 --- a/src/main/res/drawable/infocard_border.xml +++ b/src/main/res/drawable/infocard_border.xml @@ -1,13 +1,13 @@ - + + android:color="@color/black12" > - + \ No newline at end of file diff --git a/src/main/res/drawable/snackbar.xml b/src/main/res/drawable/snackbar.xml index 951d7aee..2645b136 100644 --- a/src/main/res/drawable/snackbar.xml +++ b/src/main/res/drawable/snackbar.xml @@ -1,7 +1,7 @@ - + diff --git a/src/main/res/layout-w945dp/fragment_conversations_overview.xml b/src/main/res/layout-w945dp/fragment_conversations_overview.xml index 50039c03..7ae1788d 100644 --- a/src/main/res/layout-w945dp/fragment_conversations_overview.xml +++ b/src/main/res/layout-w945dp/fragment_conversations_overview.xml @@ -9,15 +9,15 @@ android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" - android:background="@color/primarybackground" + android:background="@color/grey50" android:orientation="vertical" > diff --git a/src/main/res/layout/account_row.xml b/src/main/res/layout/account_row.xml index 0e73dd64..06716a10 100644 --- a/src/main/res/layout/account_row.xml +++ b/src/main/res/layout/account_row.xml @@ -32,7 +32,7 @@ android:layout_height="wrap_content" android:scrollHorizontally="false" android:singleLine="true" - android:textColor="@color/primarytext" + android:textColor="@color/black87" android:textSize="?attr/TextSizeHeadline" /> diff --git a/src/main/res/layout/actionview_search.xml b/src/main/res/layout/actionview_search.xml index cc5fc9d7..8b657f4a 100644 --- a/src/main/res/layout/actionview_search.xml +++ b/src/main/res/layout/actionview_search.xml @@ -14,6 +14,8 @@ android:layout_height="wrap_content" android:focusable="true" android:inputType="textEmailAddress|textNoSuggestions" - android:textColor="@color/ondarktext" /> + android:textColor="@color/white" + android:textColorHint="@color/white70" + android:hint="@string/search_for_contacts_or_groups"/> \ No newline at end of file diff --git a/src/main/res/layout/activity_about.xml b/src/main/res/layout/activity_about.xml index ab0e34eb..d7d23f0f 100644 --- a/src/main/res/layout/activity_about.xml +++ b/src/main/res/layout/activity_about.xml @@ -1,7 +1,7 @@ @@ -15,7 +15,7 @@ android:layout_marginRight="@dimen/activity_horizontal_margin" android:layout_marginTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" - android:textColor="@color/primarytext" + android:textColor="@color/black87" android:textSize="?attr/TextSizeBody" android:typeface="monospace"/> diff --git a/src/main/res/layout/activity_change_password.xml b/src/main/res/layout/activity_change_password.xml index 28d531c2..1a4d00d8 100644 --- a/src/main/res/layout/activity_change_password.xml +++ b/src/main/res/layout/activity_change_password.xml @@ -2,7 +2,7 @@ + android:background="@color/grey50"> @@ -94,7 +94,7 @@ android:layout_height="fill_parent" android:layout_marginBottom="7dp" android:layout_marginTop="7dp" - android:background="@color/divider"/> + android:background="@color/black12"/>