diff options
Diffstat (limited to '')
40 files changed, 229 insertions, 172 deletions
diff --git a/res/layout/account_row.xml b/res/layout/account_row.xml index 5494e436..230a5a98 100644 --- a/res/layout/account_row.xml +++ b/res/layout/account_row.xml @@ -28,14 +28,14 @@ android:scrollHorizontally="false" android:singleLine="true" android:textColor="@color/primarytext" - android:textSize="18sp" /> + android:textSize="?attr/TextSizeHeadline" /> <TextView android:id="@+id/account_status" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/account_status_unknown" - android:textSize="14sp" + android:textSize="?attr/TextSizeBody" android:textColor="@color/secondarytext" android:textStyle="bold"/> </LinearLayout> diff --git a/res/layout/activity_contact_details.xml b/res/layout/activity_contact_details.xml index a00b2340..b3672e59 100644 --- a/res/layout/activity_contact_details.xml +++ b/res/layout/activity_contact_details.xml @@ -44,7 +44,7 @@ android:layout_height="wrap_content" android:paddingLeft="8dp" android:singleLine="true" - android:textSize="14sp" + android:textSize="?attr/TextSizeBody" android:textColor="@color/primarytext"/> <TextView @@ -52,7 +52,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="16dp" - android:textSize="18sp" + android:textSize="?attr/TextSizeHeadline" android:textColor="@color/primarytext" android:textStyle="bold" /> <TextView @@ -61,7 +61,7 @@ android:layout_height="wrap_content" android:paddingLeft="8dp" android:singleLine="true" - android:textSize="14sp" + android:textSize="?attr/TextSizeBody" android:textColor="@color/primarytext"/> </LinearLayout> @@ -80,7 +80,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="8dp" - android:textSize="14sp" + android:textSize="?attr/TextSizeBody" android:textColor="@color/primarytext" /> <TextView style="@style/sectionHeader" @@ -95,7 +95,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/send_presence_updates" - android:textSize="14sp" + android:textSize="?attr/TextSizeBody" android:textColor="@color/primarytext" /> <CheckBox @@ -103,7 +103,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/receive_presence_updates" - android:textSize="14sp" + android:textSize="?attr/TextSizeBody" android:textColor="@color/primarytext" /> <TextView style="@style/sectionHeader" diff --git a/res/layout/activity_edit_account.xml b/res/layout/activity_edit_account.xml index 2c08b926..04f63795 100644 --- a/res/layout/activity_edit_account.xml +++ b/res/layout/activity_edit_account.xml @@ -27,7 +27,7 @@ android:layout_height="wrap_content" android:text="@string/account_settings_jabber_id" android:textColor="@color/primarytext" - android:textSize="14sp" /> + android:textSize="?attr/TextSizeBody" /> <AutoCompleteTextView android:id="@+id/account_jid" @@ -42,7 +42,7 @@ android:layout_marginTop="8dp" android:text="@string/account_settings_password" android:textColor="@color/primarytext" - android:textSize="14sp" /> + android:textSize="?attr/TextSizeBody" /> <EditText android:id="@+id/account_password" @@ -58,7 +58,7 @@ android:layout_marginTop="8dp" android:text="@string/register_account" android:textColor="@color/primarytext" - android:textSize="14sp" /> + android:textSize="?attr/TextSizeBody" /> <TextView android:id="@+id/account_confirm_password_desc" @@ -66,7 +66,7 @@ android:layout_height="wrap_content" android:text="@string/account_settings_confirm_password" android:textColor="@color/primarytext" - android:textSize="14sp" + android:textSize="?attr/TextSizeBody" android:visibility="gone" /> <EditText @@ -94,7 +94,7 @@ android:gravity="center_horizontal" android:text="@string/additional_information" android:textColor="@color/secondarytext" - android:textSize="18sp" + android:textSize="?attr/TextSizeHeadline" android:textStyle="bold" /> <TableLayout @@ -177,7 +177,7 @@ android:gravity="center_horizontal" android:text="@string/otr_fingerprint" android:textColor="@color/secondarytext" - android:textSize="18sp" + android:textSize="?attr/TextSizeHeadline" android:textStyle="bold" /> <TextView @@ -185,7 +185,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="8dp" - android:textSize="14sp" + android:textSize="?attr/TextSizeBody" android:typeface="monospace" /> </LinearLayout> </LinearLayout> diff --git a/res/layout/activity_muc_details.xml b/res/layout/activity_muc_details.xml index 49b4cef3..c3eb263d 100644 --- a/res/layout/activity_muc_details.xml +++ b/res/layout/activity_muc_details.xml @@ -24,7 +24,7 @@ android:singleLine="true" android:text="@string/account_settings_example_jabber_id" android:textColor="@color/primarytext" - android:textSize="14sp"/> + android:textSize="?attr/TextSizeBody"/> <TextView style="@style/sectionHeader" @@ -64,7 +64,7 @@ android:layout_height="wrap_content" android:singleLine="true" android:textColor="@color/primarytext" - android:textSize="18sp" /> + android:textSize="?attr/TextSizeHeadline" /> <TextView android:id="@+id/muc_role" @@ -72,7 +72,7 @@ android:layout_height="wrap_content" android:singleLine="true" android:textColor="@color/primarytext" - android:textSize="14sp" /> + android:textSize="?attr/TextSizeBody" /> </LinearLayout> <ImageButton diff --git a/res/layout/activity_publish_profile_picture.xml b/res/layout/activity_publish_profile_picture.xml index e5d9d1a0..f23ae6c4 100644 --- a/res/layout/activity_publish_profile_picture.xml +++ b/res/layout/activity_publish_profile_picture.xml @@ -90,7 +90,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@color/primarytext" - android:textSize="18sp"/> + android:textSize="?attr/TextSizeHeadline"/> <TextView android:id="@+id/hint_or_warning" @@ -99,7 +99,7 @@ android:layout_height="wrap_content" android:text="@string/publish_avatar_explanation" android:textColor="@color/primarytext" - android:textSize="14sp" + android:textSize="?attr/TextSizeBody" android:minLines="3" /> </LinearLayout> diff --git a/res/layout/contact.xml b/res/layout/contact.xml index f16ad061..ff55ccac 100644 --- a/res/layout/contact.xml +++ b/res/layout/contact.xml @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="fill_parent" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:padding="8dp" - android:paddingBottom="8dp" - android:background="?android:attr/activatedBackgroundIndicator"> + android:background="?android:attr/activatedBackgroundIndicator" + android:padding="8dp" > <ImageView android:id="@+id/contact_photo" @@ -12,40 +11,41 @@ android:layout_height="48dp" android:layout_alignParentLeft="true" android:scaleType="centerCrop" - android:src="@drawable/ic_profile"> + android:src="@drawable/ic_profile" > </ImageView> + <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_toRightOf="@+id/contact_photo" android:layout_centerVertical="true" + android:layout_toRightOf="@+id/contact_photo" android:orientation="vertical" - android:paddingLeft="8dp"> - <TextView - android:id="@+id/contact_display_name" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textSize="18sp" - android:textColor="@color/primarytext" - android:singleLine="true" - /> - <TextView - android:id="@+id/contact_jid" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:singleLine="true" - android:textSize="14sp" - android:textColor="@color/primarytext" - /> - <TextView - android:id="@+id/key" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textSize="18sp" - android:textColor="@color/primarytext" - android:typeface="monospace" - android:visibility="gone" - /> + android:paddingLeft="8dp" > + + <TextView + android:id="@+id/contact_display_name" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:singleLine="true" + android:textSize="?attr/TextSizeHeadline" + android:textColor="@color/primarytext" /> + + <TextView + android:id="@+id/contact_jid" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:singleLine="true" + android:textColor="@color/primarytext" + android:textSize="?attr/TextSizeBody" /> + + <TextView + android:id="@+id/key" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textColor="@color/primarytext" + android:textSize="?attr/TextSizeHeadline" + android:typeface="monospace" + android:visibility="gone" /> </LinearLayout> </RelativeLayout>
\ No newline at end of file diff --git a/res/layout/contact_key.xml b/res/layout/contact_key.xml index fdd1ddba..904523a1 100644 --- a/res/layout/contact_key.xml +++ b/res/layout/contact_key.xml @@ -16,7 +16,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@color/primarytext" - android:textSize="18sp" + android:textSize="?attr/TextSizeHeadline" android:typeface="monospace" /> <TextView diff --git a/res/layout/conversation_list_row.xml b/res/layout/conversation_list_row.xml index a6001e5f..8fdd64b7 100644 --- a/res/layout/conversation_list_row.xml +++ b/res/layout/conversation_list_row.xml @@ -26,7 +26,7 @@ android:layout_alignLeft="@+id/conversation_lastwrapper" android:layout_toLeftOf="@+id/conversation_lastupdate" android:singleLine="true" - android:textSize="18sp" + android:textSize="?attr/TextSizeHeadline" android:textColor="@color/primarytext" android:typeface="sans" /> @@ -42,7 +42,7 @@ android:id="@+id/conversation_lastmsg" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:textSize="14sp" + android:textSize="?attr/TextSizeBody" android:textColor="@color/primarytext" android:singleLine="true" android:scrollHorizontally="false" @@ -63,7 +63,7 @@ android:layout_alignBaseline="@+id/conversation_name" android:layout_alignParentRight="true" android:gravity="right" - android:textSize="12sp" + android:textSize="?attr/TextSizeInfo" android:textColor="@color/secondarytext"/> </RelativeLayout> diff --git a/res/layout/create_contact_dialog.xml b/res/layout/create_contact_dialog.xml index 4b5b9a04..a1e6f6ad 100644 --- a/res/layout/create_contact_dialog.xml +++ b/res/layout/create_contact_dialog.xml @@ -9,7 +9,7 @@ android:id="@+id/your_account" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textSize="14sp" + android:textSize="?attr/TextSizeBody" android:textColor="@color/primarytext" android:text="@string/your_account" /> <Spinner @@ -22,7 +22,7 @@ android:layout_marginTop="8dp" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textSize="14sp" + android:textSize="?attr/TextSizeBody" android:textColor="@color/primarytext" android:text="@string/account_settings_jabber_id" /> diff --git a/res/layout/dialog_clear_history.xml b/res/layout/dialog_clear_history.xml index 10ceaae5..7edb4b87 100644 --- a/res/layout/dialog_clear_history.xml +++ b/res/layout/dialog_clear_history.xml @@ -8,7 +8,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/clear_histor_msg" - android:textSize="14sp" + android:textSize="?attr/TextSizeBody" android:paddingBottom="8dp"/> <CheckBox android:id="@+id/end_conversation_checkbox" diff --git a/res/layout/dialog_verify_otr.xml b/res/layout/dialog_verify_otr.xml index c518c647..301f465a 100644 --- a/res/layout/dialog_verify_otr.xml +++ b/res/layout/dialog_verify_otr.xml @@ -13,14 +13,14 @@ android:paddingTop="8dp" android:text="Jabber ID" android:textColor="@color/primarytext" - android:textSize="18sp"/> + android:textSize="?attr/TextSizeHeadline"/> <TextView android:id="@+id/verify_otr_jid" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="8dp" - android:textSize="14sp" + android:textSize="?attr/TextSizeBody" android:textColor="@color/secondarytext"/> <TextView android:layout_width="wrap_content" @@ -28,14 +28,14 @@ android:paddingTop="8dp" android:text="@string/otr_fingerprint" android:textColor="@color/primarytext" - android:textSize="18sp"/> + android:textSize="?attr/TextSizeHeadline"/> <TextView android:id="@+id/verify_otr_fingerprint" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="8dp" - android:textSize="14sp" + android:textSize="?attr/TextSizeBody" android:typeface="monospace" android:textColor="@color/secondarytext"/> <TextView @@ -43,7 +43,7 @@ android:layout_height="wrap_content" android:paddingTop="8dp" android:text="@string/your_fingerprint" - android:textSize="18sp" + android:textSize="?attr/TextSizeHeadline" android:textColor="@color/primarytext"/> <TextView @@ -51,7 +51,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="8dp" - android:textSize="14sp" + android:textSize="?attr/TextSizeBody" android:typeface="monospace" android:textColor="@color/secondarytext"/> </LinearLayout> diff --git a/res/layout/fragment_conversation.xml b/res/layout/fragment_conversation.xml index 3f7f27e5..b16e4113 100644 --- a/res/layout/fragment_conversation.xml +++ b/res/layout/fragment_conversation.xml @@ -81,7 +81,7 @@ android:layout_centerVertical="true" android:paddingLeft="24dp" android:textColor="@color/ondarktext" - android:textSize="14sp" + android:textSize="?attr/TextSizeBody" android:layout_toLeftOf="@+id/snackbar_action"/> <TextView @@ -96,7 +96,7 @@ android:paddingTop="16dp" android:textAllCaps="true" android:textColor="@color/ondarktext" - android:textSize="14sp" + android:textSize="?attr/TextSizeBody" android:textStyle="bold" /> </RelativeLayout> diff --git a/res/layout/join_conference_dialog.xml b/res/layout/join_conference_dialog.xml index 431bf59e..a36a5ef7 100644 --- a/res/layout/join_conference_dialog.xml +++ b/res/layout/join_conference_dialog.xml @@ -9,7 +9,7 @@ android:id="@+id/your_account" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textSize="14sp" + android:textSize="?attr/TextSizeBody" android:textColor="@color/primarytext" android:text="@string/your_account" /> <Spinner @@ -22,7 +22,7 @@ android:layout_marginTop="8dp" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textSize="14sp" + android:textSize="?attr/TextSizeBody" android:textColor="@color/primarytext" android:text="@string/conference_address" /> diff --git a/res/layout/message_received.xml b/res/layout/message_received.xml index f7ff44d5..d85a4f8d 100644 --- a/res/layout/message_received.xml +++ b/res/layout/message_received.xml @@ -44,7 +44,7 @@ android:autoLink="web" android:textColor="@color/primarytext" android:textIsSelectable="true" - android:textSize="14sp" /> + android:textSize="?attr/TextSizeBody" /> <Button android:id="@+id/download_button" @@ -62,8 +62,8 @@ <ImageView android:id="@+id/security_indicator" - android:layout_width="12sp" - android:layout_height="12sp" + android:layout_width="?attr/TextSizeInfo" + android:layout_height="?attr/TextSizeInfo" android:layout_gravity="center_vertical" android:layout_marginRight="6sp" android:layout_marginTop="2sp" @@ -78,7 +78,7 @@ android:gravity="center_vertical" android:text="@string/sending" android:textColor="@color/secondarytext" - android:textSize="12sp" /> + android:textSize="?attr/TextSizeInfo" /> </LinearLayout> </LinearLayout> </LinearLayout> diff --git a/res/layout/message_sent.xml b/res/layout/message_sent.xml index 11514019..9728dc56 100644 --- a/res/layout/message_sent.xml +++ b/res/layout/message_sent.xml @@ -44,7 +44,7 @@ android:autoLink="web" android:textColor="@color/primarytext" android:textIsSelectable="true" - android:textSize="14sp" /> + android:textSize="?attr/TextSizeBody" /> <LinearLayout android:layout_width="wrap_content" @@ -61,12 +61,12 @@ android:gravity="center_vertical" android:text="@string/sending" android:textColor="@color/secondarytext" - android:textSize="12sp" /> + android:textSize="?attr/TextSizeInfo" /> <ImageView android:id="@+id/security_indicator" - android:layout_width="12sp" - android:layout_height="12sp" + android:layout_width="?attr/TextSizeInfo" + android:layout_height="?attr/TextSizeInfo" android:layout_gravity="center_vertical" android:layout_marginLeft="6sp" android:layout_marginTop="2sp" diff --git a/res/values/attrs.xml b/res/values/attrs.xml new file mode 100644 index 00000000..793b5604 --- /dev/null +++ b/res/values/attrs.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <attr name="TextSizeInfo" format="dimension"/> + <attr name="TextSizeBody" format="dimension"/> + <attr name="TextSizeHeadline" format="dimension"/> +</resources> diff --git a/res/values/strings.xml b/res/values/strings.xml index 841620e2..75ddbbc4 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -108,6 +108,7 @@ <string name="pref_never_send_crash_summary">By sending in stack traces you are helping the ongoing development of Conversations</string> <string name="pref_confirm_messages">Confirm Messages</string> <string name="pref_confirm_messages_summary">Let your contact know when you have received and read a message</string> + <string name="pref_ui_options">UI Options</string> <string name="openpgp_error">OpenKeychain reported an error</string> <string name="error_decrypting_file">I/O Error decrypting file</string> <string name="accept">Accept</string> @@ -251,4 +252,6 @@ <string name="pref_dont_save_encrypted_summary">Warning: This could lead to message loss</string> <string name="pref_expert_options">Expert options</string> <string name="pref_expert_options_summary">Please be very careful with those</string> + <string name="pref_use_larger_font">Increase font size</string> + <string name="pref_use_larger_font_summary">Use larger font sizes across the entire app</string> </resources>
\ No newline at end of file diff --git a/res/values/themes.xml b/res/values/themes.xml index 97f1db8f..e2d4dcbe 100644 --- a/res/values/themes.xml +++ b/res/values/themes.xml @@ -5,6 +5,15 @@ <item name="android:actionBarStyle">@style/ConversationsActionBar</item> <item name="android:actionBarWidgetTheme">@style/ConversationsActionBarWidget</item> <item name="android:actionBarTabStyle">@style/ConversationsActionBarTabs</item> + <item name="TextSizeInfo">12sp</item> + <item name="TextSizeBody">14sp</item> + <item name="TextSizeHeadline">20sp</item> + </style> + + <style name="ConversationsTheme.LargerText" parent="ConversationsTheme"> + <item name="TextSizeInfo">14sp</item> + <item name="TextSizeBody">16sp</item> + <item name="TextSizeHeadline">22sp</item> </style> <style name="ConversationsActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse"> diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index 3d2f85c9..f0d64e39 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -62,6 +62,14 @@ android:summary="@string/pref_notification_grace_period_summary" android:title="@string/pref_notification_grace_period" /> </PreferenceCategory> + <PreferenceCategory + android:title="@string/pref_ui_options"> + <CheckBoxPreference + android:defaultValue="false" + android:key="use_larger_font" + android:title="@string/pref_use_larger_font" + android:summary="@string/pref_use_larger_font_summary"/> + </PreferenceCategory> <PreferenceCategory android:title="@string/pref_advanced_options" > <PreferenceScreen android:summary="@string/pref_expert_options_summary" diff --git a/src/eu/siacs/conversations/Config.java b/src/eu/siacs/conversations/Config.java index 6219b6b0..1725eca6 100644 --- a/src/eu/siacs/conversations/Config.java +++ b/src/eu/siacs/conversations/Config.java @@ -14,9 +14,9 @@ public final class Config { public static final int AVATAR_SIZE = 192; public static final Bitmap.CompressFormat AVATAR_FORMAT = Bitmap.CompressFormat.WEBP; - + public static final int MESSAGE_MERGE_WINDOW = 20; - + public static final boolean PARSE_EMOTICONS = false; private Config() { diff --git a/src/eu/siacs/conversations/crypto/OtrEngine.java b/src/eu/siacs/conversations/crypto/OtrEngine.java index 46dd714f..5dfd6fd6 100644 --- a/src/eu/siacs/conversations/crypto/OtrEngine.java +++ b/src/eu/siacs/conversations/crypto/OtrEngine.java @@ -174,7 +174,8 @@ public class OtrEngine implements OtrEngineHost { @Override public void messageFromAnotherInstanceReceived(SessionID id) { - Log.d(Config.LOGTAG,"unreadable message received from "+id.getAccountID()); + Log.d(Config.LOGTAG, + "unreadable message received from " + id.getAccountID()); } @Override diff --git a/src/eu/siacs/conversations/crypto/PgpEngine.java b/src/eu/siacs/conversations/crypto/PgpEngine.java index 2f678279..e7058a68 100644 --- a/src/eu/siacs/conversations/crypto/PgpEngine.java +++ b/src/eu/siacs/conversations/crypto/PgpEngine.java @@ -106,8 +106,8 @@ public class PgpEngine { outputFile.getAbsolutePath(), options); int imageHeight = options.outHeight; int imageWidth = options.outWidth; - message.setBody(Long.toString(outputFile.getSize()) + ',' - + imageWidth + ',' + imageHeight); + message.setBody(Long.toString(outputFile.getSize()) + + ',' + imageWidth + ',' + imageHeight); message.setEncryption(Message.ENCRYPTION_DECRYPTED); PgpEngine.this.mXmppConnectionService .updateMessage(message); @@ -301,7 +301,7 @@ public class PgpEngine { os.flush(); String[] lines = os.toString().split("\n"); boolean sig = false; - for(String line : lines) { + for (String line : lines) { if (sig) { if (line.contains("END PGP SIGNATURE")) { sig = false; diff --git a/src/eu/siacs/conversations/entities/Message.java b/src/eu/siacs/conversations/entities/Message.java index 5cbd68dd..ce496d27 100644 --- a/src/eu/siacs/conversations/entities/Message.java +++ b/src/eu/siacs/conversations/entities/Message.java @@ -149,9 +149,11 @@ public class Message extends AbstractEntity { public String getReadableBody(Context context) { if ((encryption == ENCRYPTION_PGP) && (type == TYPE_TEXT)) { - return context.getText(R.string.encrypted_message_received).toString(); + return context.getText(R.string.encrypted_message_received) + .toString(); } else if ((encryption == ENCRYPTION_OTR) && (type == TYPE_IMAGE)) { - return context.getText(R.string.encrypted_image_received).toString(); + return context.getText(R.string.encrypted_image_received) + .toString(); } else if (encryption == ENCRYPTION_DECRYPTION_FAILED) { return context.getText(R.string.decryption_failed).toString(); } else if (type == TYPE_IMAGE) { @@ -339,7 +341,7 @@ public class Message extends AbstractEntity { } return body.trim(); } - + public int getMergedStatus() { Message next = this.next(); if (this.mergable(next)) { @@ -348,7 +350,7 @@ public class Message extends AbstractEntity { return getStatus(); } } - + public long getMergedTimeSent() { Message next = this.next(); if (this.mergable(next)) { diff --git a/src/eu/siacs/conversations/entities/MucOptions.java b/src/eu/siacs/conversations/entities/MucOptions.java index 3988eae0..e9ab6908 100644 --- a/src/eu/siacs/conversations/entities/MucOptions.java +++ b/src/eu/siacs/conversations/entities/MucOptions.java @@ -158,8 +158,8 @@ public class MucOptions { } aboutToRename = false; } - if (conversation.getBookmark() != null && - conversation.getBookmark().isProvidePassword()) { + if (conversation.getBookmark() != null + && conversation.getBookmark().isProvidePassword()) { this.passwordChanged = false; } } else { @@ -194,8 +194,8 @@ public class MucOptions { this.error = ERROR_NICK_IN_USE; } } else if (error.hasChild("not-authorized")) { - if (conversation.getBookmark() != null && - conversation.getBookmark().isProvidePassword()) { + if (conversation.getBookmark() != null + && conversation.getBookmark().isProvidePassword()) { this.passwordChanged = true; } this.error = ERROR_PASSWORD_REQUIRED; @@ -323,17 +323,17 @@ public class MucOptions { } public String getPassword() { - if (conversation.getBookmark() != null && - conversation.getBookmark().getPassword() != null) { + if (conversation.getBookmark() != null + && conversation.getBookmark().getPassword() != null) { return conversation.getBookmark().getPassword(); } else { return this.password; } } - + public void setPassword(String password) { - if (conversation.getBookmark() != null && - conversation.getBookmark().isProvidePassword()) { + if (conversation.getBookmark() != null + && conversation.getBookmark().isProvidePassword()) { conversation.getBookmark().setPassword(password); } else { this.password = password; diff --git a/src/eu/siacs/conversations/parser/MessageParser.java b/src/eu/siacs/conversations/parser/MessageParser.java index ed846fe1..bd136a33 100644 --- a/src/eu/siacs/conversations/parser/MessageParser.java +++ b/src/eu/siacs/conversations/parser/MessageParser.java @@ -75,9 +75,8 @@ public class MessageParser extends AbstractParser implements } if (!conversation.hasValidOtrSession()) { if (properlyAddressed) { - conversation.startOtrSession( - mXmppConnectionService, - presence, false); + conversation.startOtrSession(mXmppConnectionService, presence, + false); } else { return null; } @@ -87,8 +86,7 @@ public class MessageParser extends AbstractParser implements if (!foreignPresence.equals(presence)) { conversation.endOtrIfNeeded(); if (properlyAddressed) { - conversation.startOtrSession( - mXmppConnectionService, + conversation.startOtrSession(mXmppConnectionService, presence, false); } else { return null; @@ -289,7 +287,8 @@ public class MessageParser extends AbstractParser implements if (!conversation.getMucOptions().online()) { if (x.hasChild("password")) { Element password = x.findChild("password"); - conversation.getMucOptions().setPassword(password.getContent()); + conversation.getMucOptions().setPassword( + password.getContent()); } mXmppConnectionService.joinMuc(conversation); mXmppConnectionService.updateConversationUi(); @@ -453,7 +452,8 @@ public class MessageParser extends AbstractParser implements Conversation conversation = message.getConversation(); conversation.getMessages().add(message); if (packet.getType() != MessagePacket.TYPE_ERROR) { - if (message.getEncryption() == Message.ENCRYPTION_NONE || mXmppConnectionService.saveEncryptedMessages()) { + if (message.getEncryption() == Message.ENCRYPTION_NONE + || mXmppConnectionService.saveEncryptedMessages()) { mXmppConnectionService.databaseBackend.createMessage(message); } } diff --git a/src/eu/siacs/conversations/parser/PresenceParser.java b/src/eu/siacs/conversations/parser/PresenceParser.java index 18c23060..05ffa67e 100644 --- a/src/eu/siacs/conversations/parser/PresenceParser.java +++ b/src/eu/siacs/conversations/parser/PresenceParser.java @@ -107,7 +107,8 @@ public class PresenceParser extends AbstractParser implements contact.setOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST); } } - Element nick = packet.findChild("nick", "http://jabber.org/protocol/nick"); + Element nick = packet.findChild("nick", + "http://jabber.org/protocol/nick"); if (nick != null) { contact.setPresenceName(nick.getContent()); } diff --git a/src/eu/siacs/conversations/persistance/DatabaseBackend.java b/src/eu/siacs/conversations/persistance/DatabaseBackend.java index 2a403fab..cda2f356 100644 --- a/src/eu/siacs/conversations/persistance/DatabaseBackend.java +++ b/src/eu/siacs/conversations/persistance/DatabaseBackend.java @@ -163,7 +163,8 @@ public class DatabaseBackend extends SQLiteOpenHelper { + "=?", selectionArgs, null, null, Message.TIME_SENT + " DESC", String.valueOf(limit)); } else { - String[] selectionArgs = { conversation.getUuid(), Long.toString(timestamp) }; + String[] selectionArgs = { conversation.getUuid(), + Long.toString(timestamp) }; cursor = db.query(Message.TABLENAME, null, Message.CONVERSATION + "=? and " + Message.TIME_SENT + "<?", selectionArgs, null, null, Message.TIME_SENT + " DESC", diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java index f2e93760..247f602b 100644 --- a/src/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/eu/siacs/conversations/services/XmppConnectionService.java @@ -585,7 +585,8 @@ public class XmppConnectionService extends Service { } if (saveInDb) { - if (message.getEncryption() == Message.ENCRYPTION_NONE || saveEncryptedMessages()) { + if (message.getEncryption() == Message.ENCRYPTION_NONE + || saveEncryptedMessages()) { databaseBackend.createMessage(message); } } @@ -1546,7 +1547,7 @@ public class XmppConnectionService extends Service { return PreferenceManager .getDefaultSharedPreferences(getApplicationContext()); } - + public boolean forceEncryption() { return getPreferences().getBoolean("force_encryption", false); } @@ -1554,7 +1555,7 @@ public class XmppConnectionService extends Service { public boolean confirmMessages() { return getPreferences().getBoolean("confirm_messages", true); } - + public boolean saveEncryptedMessages() { return !getPreferences().getBoolean("dont_save_encrypted", false); } diff --git a/src/eu/siacs/conversations/ui/ChooseContactActivity.java b/src/eu/siacs/conversations/ui/ChooseContactActivity.java index 449fc546..277d21d6 100644 --- a/src/eu/siacs/conversations/ui/ChooseContactActivity.java +++ b/src/eu/siacs/conversations/ui/ChooseContactActivity.java @@ -82,8 +82,7 @@ public class ChooseContactActivity extends XmppActivity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_choose_contact); mListView = (ListView) findViewById(R.id.choose_contact_list); - mContactsAdapter = new ListItemAdapter(getApplicationContext(), - contacts); + mContactsAdapter = new ListItemAdapter(this, contacts); mListView.setAdapter(mContactsAdapter); mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @@ -98,7 +97,7 @@ public class ChooseContactActivity extends XmppActivity { ListItem mListItem = contacts.get(position); data.putExtra("contact", mListItem.getJid()); String account = request.getStringExtra("account"); - if (account==null && mListItem instanceof Contact) { + if (account == null && mListItem instanceof Contact) { account = ((Contact) mListItem).getAccount().getJid(); } data.putExtra("account", account); diff --git a/src/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/eu/siacs/conversations/ui/ContactDetailsActivity.java index 17ea5f98..8de2ce80 100644 --- a/src/eu/siacs/conversations/ui/ContactDetailsActivity.java +++ b/src/eu/siacs/conversations/ui/ContactDetailsActivity.java @@ -325,16 +325,18 @@ public class ContactDetailsActivity extends XmppActivity { for (Iterator<String> iterator = contact.getOtrFingerprints() .iterator(); iterator.hasNext();) { final String otrFingerprint = iterator.next(); - View view = (View) inflater.inflate(R.layout.contact_key, keys,false); + View view = (View) inflater.inflate(R.layout.contact_key, keys, + false); TextView key = (TextView) view.findViewById(R.id.key); TextView keyType = (TextView) view.findViewById(R.id.key_type); - ImageButton remove = (ImageButton) view.findViewById(R.id.button_remove); + ImageButton remove = (ImageButton) view + .findViewById(R.id.button_remove); remove.setVisibility(View.VISIBLE); keyType.setText("OTR Fingerprint"); key.setText(otrFingerprint); keys.addView(view); remove.setOnClickListener(new OnClickListener() { - + @Override public void onClick(View v) { confirmToDeleteFingerprint(otrFingerprint); @@ -342,7 +344,8 @@ public class ContactDetailsActivity extends XmppActivity { }); } if (contact.getPgpKeyId() != 0) { - View view = (View) inflater.inflate(R.layout.contact_key, keys,false); + View view = (View) inflater.inflate(R.layout.contact_key, keys, + false); TextView key = (TextView) view.findViewById(R.id.key); TextView keyType = (TextView) view.findViewById(R.id.key_type); keyType.setText("PGP Key ID"); @@ -370,23 +373,25 @@ public class ContactDetailsActivity extends XmppActivity { keys.addView(view); } } - + protected void confirmToDeleteFingerprint(final String fingerprint) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.delete_fingerprint); builder.setMessage(R.string.sure_delete_fingerprint); builder.setNegativeButton(R.string.cancel, null); - builder.setPositiveButton(R.string.delete,new android.content.DialogInterface.OnClickListener() { + builder.setPositiveButton(R.string.delete, + new android.content.DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - if (contact.deleteOtrFingerprint(fingerprint)) { - populateView(); - xmppConnectionService.syncRosterToDisk(contact.getAccount()); - } - } - - }); + @Override + public void onClick(DialogInterface dialog, int which) { + if (contact.deleteOtrFingerprint(fingerprint)) { + populateView(); + xmppConnectionService.syncRosterToDisk(contact + .getAccount()); + } + } + + }); builder.create().show(); } diff --git a/src/eu/siacs/conversations/ui/ConversationActivity.java b/src/eu/siacs/conversations/ui/ConversationActivity.java index df0112ae..5eedda1c 100644 --- a/src/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/eu/siacs/conversations/ui/ConversationActivity.java @@ -324,7 +324,8 @@ public class ConversationActivity extends XmppActivity { } else { showInstallPgpDialog(); } - } else if (getSelectedConversation().getNextEncryption(forceEncryption()) == Message.ENCRYPTION_NONE) { + } else if (getSelectedConversation().getNextEncryption( + forceEncryption()) == Message.ENCRYPTION_NONE) { selectPresenceToAttachFile(attachmentChoice); } else { selectPresenceToAttachFile(attachmentChoice); @@ -440,7 +441,8 @@ public class ConversationActivity extends XmppActivity { 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); if (conversation.getMode() == Conversation.MODE_MULTI) { otr.setEnabled(false); } else { diff --git a/src/eu/siacs/conversations/ui/SettingsActivity.java b/src/eu/siacs/conversations/ui/SettingsActivity.java index c522e058..6b280719 100644 --- a/src/eu/siacs/conversations/ui/SettingsActivity.java +++ b/src/eu/siacs/conversations/ui/SettingsActivity.java @@ -2,6 +2,7 @@ package eu.siacs.conversations.ui; import java.util.Locale; +import eu.siacs.conversations.R; import eu.siacs.conversations.entities.Account; import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; diff --git a/src/eu/siacs/conversations/ui/StartConversationActivity.java b/src/eu/siacs/conversations/ui/StartConversationActivity.java index 6adada76..6287070c 100644 --- a/src/eu/siacs/conversations/ui/StartConversationActivity.java +++ b/src/eu/siacs/conversations/ui/StartConversationActivity.java @@ -191,8 +191,7 @@ public class StartConversationActivity extends XmppActivity { } }); - mConferenceAdapter = new ListItemAdapter(getApplicationContext(), - conferences); + mConferenceAdapter = new ListItemAdapter(this, conferences); mConferenceListFragment.setListAdapter(mConferenceAdapter); mConferenceListFragment.setContextMenu(R.menu.conference_context); mConferenceListFragment @@ -205,8 +204,7 @@ public class StartConversationActivity extends XmppActivity { } }); - mContactsAdapter = new ListItemAdapter(getApplicationContext(), - contacts); + mContactsAdapter = new ListItemAdapter(this, contacts); mContactsListFragment.setListAdapter(mContactsAdapter); mContactsListFragment.setContextMenu(R.menu.contact_context); mContactsListFragment diff --git a/src/eu/siacs/conversations/ui/XmppActivity.java b/src/eu/siacs/conversations/ui/XmppActivity.java index b7cce11d..f13c112a 100644 --- a/src/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/eu/siacs/conversations/ui/XmppActivity.java @@ -21,6 +21,7 @@ import android.app.AlertDialog.Builder; import android.content.ComponentName; import android.content.Context; import android.content.DialogInterface; +import android.content.SharedPreferences; import android.content.DialogInterface.OnClickListener; import android.content.IntentSender.SendIntentException; import android.content.res.Resources; @@ -33,6 +34,7 @@ import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.os.IBinder; +import android.preference.PreferenceManager; import android.text.InputType; import android.util.DisplayMetrics; import android.util.Log; @@ -183,6 +185,14 @@ public abstract class XmppActivity extends Activity { mSecondaryTextColor = getResources().getColor(R.color.secondarytext); mWarningTextColor = getResources().getColor(R.color.warningtext); mPrimaryColor = getResources().getColor(R.color.primary); + if (getPreferences().getBoolean("use_larger_font", false)) { + setTheme(R.style.ConversationsTheme_LargerText); + } + } + + protected SharedPreferences getPreferences() { + return PreferenceManager + .getDefaultSharedPreferences(getApplicationContext()); } public void switchToConversation(Conversation conversation) { @@ -309,26 +319,28 @@ public abstract class XmppActivity extends Activity { @Override public void onClick(DialogInterface dialog, int which) { if (xmppConnectionServiceBound) { - xmppConnectionService.sendPresencePacket(contact.getAccount(), - xmppConnectionService.getPresenceGenerator() - .requestPresenceUpdatesFrom(contact)); + xmppConnectionService.sendPresencePacket(contact + .getAccount(), xmppConnectionService + .getPresenceGenerator() + .requestPresenceUpdatesFrom(contact)); } } }); builder.create().show(); } - - private void warnMutalPresenceSubscription(final Conversation conversation,final OnPresenceSelected listener) { + + private void warnMutalPresenceSubscription(final Conversation conversation, + final OnPresenceSelected listener) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(conversation.getContact().getJid()); builder.setMessage(R.string.without_mutual_presence_updates); builder.setNegativeButton(R.string.cancel, null); builder.setPositiveButton(R.string.ignore, new OnClickListener() { - + @Override public void onClick(DialogInterface dialog, int which) { conversation.setNextPresence(null); - if (listener!=null) { + if (listener != null) { listener.onPresenceSelected(); } } @@ -388,8 +400,9 @@ public abstract class XmppActivity extends Activity { && !contact.getOption(Contact.Options.ASKING) && contact.getAccount().getStatus() == Account.STATUS_ONLINE) { showAskForPresenceDialog(contact); - } else if (!contact.getOption(Contact.Options.TO) || !contact.getOption(Contact.Options.FROM)) { - warnMutalPresenceSubscription(conversation,listener); + } else if (!contact.getOption(Contact.Options.TO) + || !contact.getOption(Contact.Options.FROM)) { + warnMutalPresenceSubscription(conversation, listener); } else { conversation.setNextPresence(null); listener.onPresenceSelected(); diff --git a/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java index 1abd208d..967042d8 100644 --- a/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java +++ b/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java @@ -462,7 +462,8 @@ public class MessageAdapter extends ArrayAdapter<Message> { @Override public void onClick(View v) { - Downloadable downloadable = item.getDownloadable(); + Downloadable downloadable = item + .getDownloadable(); if (downloadable != null) { downloadable.start(); } diff --git a/src/eu/siacs/conversations/utils/UIHelper.java b/src/eu/siacs/conversations/utils/UIHelper.java index 896bdb7d..54c370ef 100644 --- a/src/eu/siacs/conversations/utils/UIHelper.java +++ b/src/eu/siacs/conversations/utils/UIHelper.java @@ -215,8 +215,8 @@ public class UIHelper { List<User> members = conversation.getMucOptions().getUsers(); if (members.size() == 0) { return getUnknownContactPicture( - new String[] { conversation.getName() }, size, - bgColor, fgColor); + new String[] { conversation.getName() }, size, bgColor, + fgColor); } ArrayList<String> names = new ArrayList<String>(); names.add(conversation.getMucOptions().getActualNick()); @@ -548,35 +548,37 @@ public class UIHelper { private final static class EmoticonPattern { Pattern pattern; String replacement; + EmoticonPattern(String ascii, int unicode) { - this.pattern = Pattern.compile("(?<=(^|\\s))" + ascii + "(?=(\\s|$))"); - this.replacement = new String(new int[]{unicode, }, 0, 1); + this.pattern = Pattern.compile("(?<=(^|\\s))" + ascii + + "(?=(\\s|$))"); + this.replacement = new String(new int[] { unicode, }, 0, 1); } + String replaceAll(String body) { return pattern.matcher(body).replaceAll(replacement); } } private static final EmoticonPattern[] patterns = new EmoticonPattern[] { - new EmoticonPattern(":-?D", 0x1f600), - new EmoticonPattern("\\^\\^", 0x1f601), - new EmoticonPattern(":'D", 0x1f602), - new EmoticonPattern("\\]-?D", 0x1f608), - new EmoticonPattern(";-?\\)", 0x1f609), - new EmoticonPattern(":-?\\)", 0x1f60a), - new EmoticonPattern("[B8]-?\\)", 0x1f60e), - new EmoticonPattern(":-?\\|", 0x1f610), - new EmoticonPattern(":-?[/\\\\]", 0x1f615), - new EmoticonPattern(":-?\\*", 0x1f617), - new EmoticonPattern(":-?[Ppb]", 0x1f61b), - new EmoticonPattern(":-?\\(", 0x1f61e), - new EmoticonPattern(":-?[0Oo]", 0x1f62e), - new EmoticonPattern("\\\\o/", 0x1F631), - }; + new EmoticonPattern(":-?D", 0x1f600), + new EmoticonPattern("\\^\\^", 0x1f601), + new EmoticonPattern(":'D", 0x1f602), + new EmoticonPattern("\\]-?D", 0x1f608), + new EmoticonPattern(";-?\\)", 0x1f609), + new EmoticonPattern(":-?\\)", 0x1f60a), + new EmoticonPattern("[B8]-?\\)", 0x1f60e), + new EmoticonPattern(":-?\\|", 0x1f610), + new EmoticonPattern(":-?[/\\\\]", 0x1f615), + new EmoticonPattern(":-?\\*", 0x1f617), + new EmoticonPattern(":-?[Ppb]", 0x1f61b), + new EmoticonPattern(":-?\\(", 0x1f61e), + new EmoticonPattern(":-?[0Oo]", 0x1f62e), + new EmoticonPattern("\\\\o/", 0x1F631), }; public static String transformAsciiEmoticons(String body) { if (body != null) { - for (EmoticonPattern p: patterns) { + for (EmoticonPattern p : patterns) { body = p.replaceAll(body); } body = body.trim(); diff --git a/src/eu/siacs/conversations/xmpp/XmppConnection.java b/src/eu/siacs/conversations/xmpp/XmppConnection.java index 36920929..e7b25e26 100644 --- a/src/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/eu/siacs/conversations/xmpp/XmppConnection.java @@ -763,12 +763,15 @@ public class XmppConnection implements Runnable { }); } - private void processStreamError(Tag currentTag) throws XmlPullParserException, IOException { + private void processStreamError(Tag currentTag) + throws XmlPullParserException, IOException { Element streamError = tagReader.readElement(currentTag); - if (streamError!=null && streamError.hasChild("conflict")) { + if (streamError != null && streamError.hasChild("conflict")) { String resource = account.getResource().split("\\.")[0]; - account.setResource(resource+"."+nextRandomId()); - Log.d(Config.LOGTAG,account.getJid()+": switching resource due to conflict ("+account.getResource()+")"); + account.setResource(resource + "." + nextRandomId()); + Log.d(Config.LOGTAG, + account.getJid() + ": switching resource due to conflict (" + + account.getResource() + ")"); } } diff --git a/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java b/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java index e26fcad9..f42482e8 100644 --- a/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java +++ b/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java @@ -96,8 +96,8 @@ public class JingleConnection implements Downloadable { BitmapFactory.decodeFile(file.getAbsolutePath(), options); int imageHeight = options.outHeight; int imageWidth = options.outWidth; - message.setBody(Long.toString(file.getSize()) + ',' + imageWidth + ',' - + imageHeight); + message.setBody(Long.toString(file.getSize()) + ',' + + imageWidth + ',' + imageHeight); mXmppConnectionService.databaseBackend.createMessage(message); mXmppConnectionService.markMessage(message, Message.STATUS_RECEIVED); diff --git a/src/eu/siacs/conversations/xmpp/jingle/JingleInbandTransport.java b/src/eu/siacs/conversations/xmpp/jingle/JingleInbandTransport.java index cd87552b..c5498075 100644 --- a/src/eu/siacs/conversations/xmpp/jingle/JingleInbandTransport.java +++ b/src/eu/siacs/conversations/xmpp/jingle/JingleInbandTransport.java @@ -135,7 +135,8 @@ public class JingleInbandTransport extends JingleTransport { Element data = iq.addChild("data", "http://jabber.org/protocol/ibb"); data.setAttribute("seq", Integer.toString(this.seq)); - data.setAttribute("block-size", Integer.toString(this.blockSize)); + data.setAttribute("block-size", + Integer.toString(this.blockSize)); data.setAttribute("sid", this.sessionId); data.setContent(base64); this.account.getXmppConnection().sendIqPacket(iq, diff --git a/src/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java b/src/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java index 1a8ab9dd..63f5a507 100644 --- a/src/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java +++ b/src/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java @@ -58,9 +58,9 @@ public class JingleSocks5Transport extends JingleTransport { byte[] reply = new byte[2]; outputStream.write(login); inputStream.read(reply); - final String connect = Character.toString('\u0005') + '\u0001' + '\u0000' - + '\u0003' + '\u0028' + destination + '\u0000' - + '\u0000'; + final String connect = Character.toString('\u0005') + + '\u0001' + '\u0000' + '\u0003' + '\u0028' + + destination + '\u0000' + '\u0000'; if (Arrays.equals(reply, expectedReply)) { outputStream.write(connect.getBytes()); byte[] result = new byte[2]; |