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.
This commit is contained in:
Alex Palaistras 2018-12-09 21:32:42 +00:00
parent 08529041a5
commit aaf5fa816b
8 changed files with 61 additions and 26 deletions

View File

@ -73,7 +73,7 @@ android {
compileSdkVersion 28 compileSdkVersion 28
defaultConfig { defaultConfig {
minSdkVersion 18 minSdkVersion 16
targetSdkVersion 28 targetSdkVersion 28
versionCode 307 versionCode 307
versionName "2.3.9" versionName "2.3.9"

View File

@ -65,7 +65,9 @@ public class Resolver {
final Field useHardcodedDnsServers = DNSClient.class.getDeclaredField("useHardcodedDnsServers"); final Field useHardcodedDnsServers = DNSClient.class.getDeclaredField("useHardcodedDnsServers");
useHardcodedDnsServers.setAccessible(true); useHardcodedDnsServers.setAccessible(true);
useHardcodedDnsServers.setBoolean(dnsClient, false); 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); Log.e(Config.LOGTAG, "Unable to disable hardcoded DNS servers", e);
} }
} }

View File

@ -48,14 +48,17 @@
android:layout_height="@dimen/avatar_on_details_screen_size" android:layout_height="@dimen/avatar_on_details_screen_size"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
app:riv_corner_radius="2dp" 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" />
<LinearLayout <LinearLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_toEndOf="@+id/your_photo" android:layout_toEndOf="@+id/your_photo"
android:orientation="vertical"> android:orientation="vertical"
android:layout_toRightOf="@+id/your_photo">
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -67,7 +70,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_toStartOf="@+id/edit_muc_name_button" android:layout_toStartOf="@+id/edit_muc_name_button"
android:orientation="vertical"> android:orientation="vertical"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/edit_muc_name_button">
<TextView <TextView
android:id="@+id/muc_title" android:id="@+id/muc_title"
@ -91,7 +96,9 @@
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_toStartOf="@+id/edit_muc_name_button" android:layout_toStartOf="@+id/edit_muc_name_button"
android:orientation="vertical" android:orientation="vertical"
android:visibility="gone"> android:visibility="gone"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/edit_muc_name_button">
<android.support.design.widget.TextInputLayout <android.support.design.widget.TextInputLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -132,7 +139,8 @@
android:alpha="?attr/icon_alpha" android:alpha="?attr/icon_alpha"
android:background="?attr/selectableItemBackgroundBorderless" android:background="?attr/selectableItemBackgroundBorderless"
android:padding="@dimen/image_button_padding" android:padding="@dimen/image_button_padding"
android:src="?attr/icon_edit_body"/> android:src="?attr/icon_edit_body"
android:layout_alignParentRight="true" />
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
@ -151,7 +159,8 @@
android:layout_toStartOf="@+id/change_conference_button" android:layout_toStartOf="@+id/change_conference_button"
android:text="@string/private_conference" android:text="@string/private_conference"
android:textAppearance="@style/TextAppearance.Conversations.Body1" android:textAppearance="@style/TextAppearance.Conversations.Body1"
/> android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/change_conference_button" />
<ImageButton <ImageButton
android:id="@+id/change_conference_button" android:id="@+id/change_conference_button"
@ -164,7 +173,8 @@
android:alpha="?attr/icon_alpha" android:alpha="?attr/icon_alpha"
android:background="?attr/selectableItemBackgroundBorderless" android:background="?attr/selectableItemBackgroundBorderless"
android:padding="@dimen/image_button_padding" android:padding="@dimen/image_button_padding"
android:src="?attr/icon_settings"/> android:src="?attr/icon_settings"
android:layout_alignParentRight="true" />
</RelativeLayout> </RelativeLayout>
<TableLayout <TableLayout
@ -193,7 +203,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="end" android:layout_gravity="end"
android:paddingStart="4dp" android:paddingStart="4dp"
android:textAppearance="@style/TextAppearance.Conversations.Body1"/> android:textAppearance="@style/TextAppearance.Conversations.Body1"
android:paddingLeft="4dp" />
</TableRow> </TableRow>
</TableLayout> </TableLayout>
@ -302,7 +313,8 @@
android:alpha="?attr/icon_alpha" android:alpha="?attr/icon_alpha"
android:background="?attr/selectableItemBackgroundBorderless" android:background="?attr/selectableItemBackgroundBorderless"
android:padding="@dimen/image_button_padding" android:padding="@dimen/image_button_padding"
android:src="?attr/icon_edit_body"/> android:src="?attr/icon_edit_body"
android:layout_alignParentRight="true" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
@ -318,7 +330,8 @@
android:layout_toStartOf="@+id/notification_status_button" android:layout_toStartOf="@+id/notification_status_button"
android:text="@string/notify_on_all_messages" android:text="@string/notify_on_all_messages"
android:textAppearance="@style/TextAppearance.Conversations.Body1" android:textAppearance="@style/TextAppearance.Conversations.Body1"
/> android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/notification_status_button" />
<ImageButton <ImageButton
android:id="@+id/notification_status_button" android:id="@+id/notification_status_button"
@ -331,7 +344,8 @@
android:alpha="?attr/icon_alpha" android:alpha="?attr/icon_alpha"
android:background="?attr/selectableItemBackgroundBorderless" android:background="?attr/selectableItemBackgroundBorderless"
android:padding="@dimen/image_button_padding" android:padding="@dimen/image_button_padding"
android:src="?attr/icon_notifications"/> android:src="?attr/icon_notifications"
android:layout_alignParentRight="true" />
</RelativeLayout> </RelativeLayout>
<TextView <TextView

View File

@ -29,7 +29,8 @@
android:layout_margin="16dp" android:layout_margin="16dp"
app:backgroundTint="?colorPrimary" app:backgroundTint="?colorPrimary"
android:contentDescription="@string/action_unfix_from_location" android:contentDescription="@string/action_unfix_from_location"
android:src="?attr/icon_gps_fixed"/> android:src="?attr/icon_gps_fixed"
android:layout_alignParentRight="true" />
<org.osmdroid.views.MapView <org.osmdroid.views.MapView

View File

@ -28,6 +28,7 @@
android:contentDescription="@string/action_unfix_from_location" android:contentDescription="@string/action_unfix_from_location"
android:src="?attr/icon_directions" android:src="?attr/icon_directions"
app:backgroundTint="?colorPrimary" app:backgroundTint="?colorPrimary"
app:tint="@color/white"/> app:tint="@color/white"
android:layout_alignParentRight="true" />
</RelativeLayout> </RelativeLayout>
</layout> </layout>

View File

@ -21,7 +21,8 @@
android:listSelector="@android:color/transparent" android:listSelector="@android:color/transparent"
android:stackFromBottom="true" android:stackFromBottom="true"
android:transcriptMode="normal" android:transcriptMode="normal"
tools:listitem="@layout/message_sent"> tools:listitem="@layout/message_sent"
android:layout_alignParentLeft="true">
</ListView> </ListView>
<android.support.design.widget.FloatingActionButton <android.support.design.widget.FloatingActionButton
@ -35,7 +36,8 @@
android:src="?attr/icon_scroll_down" android:src="?attr/icon_scroll_down"
app:fabSize="mini" app:fabSize="mini"
android:visibility="gone" android:visibility="gone"
app:useCompatPadding="true"/> app:useCompatPadding="true"
android:layout_alignParentRight="true" />
<eu.siacs.conversations.ui.widget.UnreadCountCustomView <eu.siacs.conversations.ui.widget.UnreadCountCustomView
android:id="@+id/unread_count_custom_view" android:id="@+id/unread_count_custom_view"
@ -47,7 +49,10 @@
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:elevation="8dp" android:elevation="8dp"
android:visibility="gone" android:visibility="gone"
app:backgroundColor="?attr/unread_count" /> app:backgroundColor="?attr/unread_count"
android:layout_alignRight="@+id/scroll_to_bottom_button"
tools:ignore="RtlCompat"
android:layout_marginRight="8dp" />
<RelativeLayout <RelativeLayout
android:id="@+id/textsend" android:id="@+id/textsend"
@ -55,7 +60,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:background="?attr/color_background_primary"> android:background="?attr/color_background_primary"
android:layout_alignParentLeft="true">
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView
android:visibility="gone" android:visibility="gone"
@ -68,7 +74,9 @@
android:orientation="horizontal" android:orientation="horizontal"
app:layoutManager="android.support.v7.widget.LinearLayoutManager" app:layoutManager="android.support.v7.widget.LinearLayoutManager"
android:paddingTop="8dp" android:paddingTop="8dp"
android:requiresFadingEdge="horizontal"> android:requiresFadingEdge="horizontal"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/textSendButton">
</android.support.v7.widget.RecyclerView> </android.support.v7.widget.RecyclerView>
@ -89,7 +97,9 @@
android:paddingBottom="12dp" android:paddingBottom="12dp"
android:paddingLeft="8dp" android:paddingLeft="8dp"
android:paddingRight="8dp" android:paddingRight="8dp"
android:paddingTop="12dp"> android:paddingTop="12dp"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/textSendButton">
<requestFocus/> <requestFocus/>
</eu.siacs.conversations.ui.widget.EditMessage> </eu.siacs.conversations.ui.widget.EditMessage>
@ -102,7 +112,8 @@
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:background="?attr/color_background_primary" android:background="?attr/color_background_primary"
android:contentDescription="@string/send_message" android:contentDescription="@string/send_message"
android:src="?attr/ic_send_text_offline"/> android:src="?attr/ic_send_text_offline"
android:layout_alignParentRight="true" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
@ -125,7 +136,10 @@
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toStartOf="@+id/snackbar_action" android:layout_toStartOf="@+id/snackbar_action"
android:paddingStart="24dp" android:paddingStart="24dp"
android:textAppearance="@style/TextAppearance.Conversations.Body1.OnDark"/> android:textAppearance="@style/TextAppearance.Conversations.Body1.OnDark"
android:layout_alignParentLeft="true"
android:paddingLeft="24dp"
android:layout_toLeftOf="@+id/snackbar_action" />
<TextView <TextView
android:id="@+id/snackbar_action" android:id="@+id/snackbar_action"
@ -139,7 +153,8 @@
android:paddingTop="16dp" android:paddingTop="16dp"
android:textAllCaps="true" android:textAllCaps="true"
android:textAppearance="@style/TextAppearance.Conversations.Body1.OnDark" android:textAppearance="@style/TextAppearance.Conversations.Body1.OnDark"
android:textStyle="bold"/> android:textStyle="bold"
android:layout_alignParentRight="true" />
</RelativeLayout> </RelativeLayout>
</RelativeLayout> </RelativeLayout>

View File

@ -19,6 +19,7 @@
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:alpha="?attr/delete_icon_alpha" android:alpha="?attr/delete_icon_alpha"
android:background="?attr/selectableItemBackgroundBorderless" android:background="?attr/selectableItemBackgroundBorderless"
android:src="?attr/icon_cancel"/> android:src="?attr/icon_cancel"
android:layout_alignParentRight="true" />
</RelativeLayout> </RelativeLayout>
</layout> </layout>

View File

@ -17,7 +17,8 @@
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:layout_alignParentRight="true">
<com.makeramen.roundedimageview.RoundedImageView <com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/message_photo" android:id="@+id/message_photo"
android:layout_width="48dp" android:layout_width="48dp"