From aaf5fa816b1809f2026fec5b82816f80b552b04c Mon Sep 17 00:00:00 2001 From: Alex Palaistras Date: Sun, 9 Dec 2018 21:32:42 +0000 Subject: [PATCH] Reduce `minSdkVersion` to 16, fix issues reported by lint This further reduces the minimum API level to 16, which should encompass most users stuck on older versions of Android (mainly BlackBerry OS and Jolla users). Several issues reported by code analysis were fixed, mainly around issues with layouts. --- build.gradle | 2 +- .../siacs/conversations/utils/Resolver.java | 4 ++- src/main/res/layout/activity_muc_details.xml | 36 +++++++++++++------ .../res/layout/activity_share_location.xml | 3 +- .../res/layout/activity_show_location.xml | 3 +- src/main/res/layout/fragment_conversation.xml | 33 ++++++++++++----- src/main/res/layout/media_preview.xml | 3 +- src/main/res/layout/message_sent.xml | 3 +- 8 files changed, 61 insertions(+), 26 deletions(-) diff --git a/build.gradle b/build.gradle index 908fece82..2f30c289f 100644 --- a/build.gradle +++ b/build.gradle @@ -73,7 +73,7 @@ android { compileSdkVersion 28 defaultConfig { - minSdkVersion 18 + minSdkVersion 16 targetSdkVersion 28 versionCode 307 versionName "2.3.9" diff --git a/src/main/java/eu/siacs/conversations/utils/Resolver.java b/src/main/java/eu/siacs/conversations/utils/Resolver.java index 680299a28..96ce63c90 100644 --- a/src/main/java/eu/siacs/conversations/utils/Resolver.java +++ b/src/main/java/eu/siacs/conversations/utils/Resolver.java @@ -65,7 +65,9 @@ public class Resolver { final Field useHardcodedDnsServers = DNSClient.class.getDeclaredField("useHardcodedDnsServers"); useHardcodedDnsServers.setAccessible(true); useHardcodedDnsServers.setBoolean(dnsClient, false); - } catch (NoSuchFieldException | IllegalAccessException e) { + } catch (NoSuchFieldException e) { + Log.e(Config.LOGTAG, "Unable to disable hardcoded DNS servers", e); + } catch (IllegalAccessException e) { Log.e(Config.LOGTAG, "Unable to disable hardcoded DNS servers", e); } } diff --git a/src/main/res/layout/activity_muc_details.xml b/src/main/res/layout/activity_muc_details.xml index 7ab0894ce..1258c4db0 100644 --- a/src/main/res/layout/activity_muc_details.xml +++ b/src/main/res/layout/activity_muc_details.xml @@ -48,14 +48,17 @@ android:layout_height="@dimen/avatar_on_details_screen_size" android:layout_alignParentStart="true" app:riv_corner_radius="2dp" - android:layout_marginEnd="@dimen/avatar_item_distance"/> + android:layout_marginEnd="@dimen/avatar_item_distance" + android:layout_alignParentLeft="true" + android:layout_marginRight="@dimen/avatar_item_distance" /> + android:orientation="vertical" + android:layout_toRightOf="@+id/your_photo"> + android:orientation="vertical" + android:layout_alignParentLeft="true" + android:layout_toLeftOf="@+id/edit_muc_name_button"> + android:visibility="gone" + android:layout_alignParentLeft="true" + android:layout_toLeftOf="@+id/edit_muc_name_button"> + android:src="?attr/icon_edit_body" + android:layout_alignParentRight="true" /> @@ -151,7 +159,8 @@ android:layout_toStartOf="@+id/change_conference_button" android:text="@string/private_conference" android:textAppearance="@style/TextAppearance.Conversations.Body1" - /> + android:layout_alignParentLeft="true" + android:layout_toLeftOf="@+id/change_conference_button" /> + android:src="?attr/icon_settings" + android:layout_alignParentRight="true" /> + android:textAppearance="@style/TextAppearance.Conversations.Body1" + android:paddingLeft="4dp" /> @@ -302,7 +313,8 @@ android:alpha="?attr/icon_alpha" android:background="?attr/selectableItemBackgroundBorderless" android:padding="@dimen/image_button_padding" - android:src="?attr/icon_edit_body"/> + android:src="?attr/icon_edit_body" + android:layout_alignParentRight="true" /> + android:layout_alignParentLeft="true" + android:layout_toLeftOf="@+id/notification_status_button" /> + android:src="?attr/icon_notifications" + android:layout_alignParentRight="true" /> + android:src="?attr/icon_gps_fixed" + android:layout_alignParentRight="true" /> + app:tint="@color/white" + android:layout_alignParentRight="true" /> \ No newline at end of file diff --git a/src/main/res/layout/fragment_conversation.xml b/src/main/res/layout/fragment_conversation.xml index 5a9048db7..9bd97c045 100644 --- a/src/main/res/layout/fragment_conversation.xml +++ b/src/main/res/layout/fragment_conversation.xml @@ -21,7 +21,8 @@ android:listSelector="@android:color/transparent" android:stackFromBottom="true" android:transcriptMode="normal" - tools:listitem="@layout/message_sent"> + tools:listitem="@layout/message_sent" + android:layout_alignParentLeft="true"> + app:useCompatPadding="true" + android:layout_alignParentRight="true" /> + app:backgroundColor="?attr/unread_count" + android:layout_alignRight="@+id/scroll_to_bottom_button" + tools:ignore="RtlCompat" + android:layout_marginRight="8dp" /> + android:background="?attr/color_background_primary" + android:layout_alignParentLeft="true"> + android:requiresFadingEdge="horizontal" + android:layout_alignParentLeft="true" + android:layout_toLeftOf="@+id/textSendButton"> @@ -89,7 +97,9 @@ android:paddingBottom="12dp" android:paddingLeft="8dp" android:paddingRight="8dp" - android:paddingTop="12dp"> + android:paddingTop="12dp" + android:layout_alignParentLeft="true" + android:layout_toLeftOf="@+id/textSendButton"> @@ -102,7 +112,8 @@ android:layout_centerVertical="true" android:background="?attr/color_background_primary" android:contentDescription="@string/send_message" - android:src="?attr/ic_send_text_offline"/> + android:src="?attr/ic_send_text_offline" + android:layout_alignParentRight="true" /> + android:textAppearance="@style/TextAppearance.Conversations.Body1.OnDark" + android:layout_alignParentLeft="true" + android:paddingLeft="24dp" + android:layout_toLeftOf="@+id/snackbar_action" /> + android:textStyle="bold" + android:layout_alignParentRight="true" /> diff --git a/src/main/res/layout/media_preview.xml b/src/main/res/layout/media_preview.xml index 07da56f4e..2262467aa 100644 --- a/src/main/res/layout/media_preview.xml +++ b/src/main/res/layout/media_preview.xml @@ -19,6 +19,7 @@ android:layout_alignParentTop="true" android:alpha="?attr/delete_icon_alpha" android:background="?attr/selectableItemBackgroundBorderless" - android:src="?attr/icon_cancel"/> + android:src="?attr/icon_cancel" + android:layout_alignParentRight="true" /> diff --git a/src/main/res/layout/message_sent.xml b/src/main/res/layout/message_sent.xml index d6a387c62..29ac6fc65 100644 --- a/src/main/res/layout/message_sent.xml +++ b/src/main/res/layout/message_sent.xml @@ -17,7 +17,8 @@ android:layout_alignParentEnd="true" android:layout_alignParentBottom="true" android:layout_width="wrap_content" - android:layout_height="wrap_content"> + android:layout_height="wrap_content" + android:layout_alignParentRight="true">