Эх сурвалжийг харах

optimize layout by making use of a more efficient layout and compound drawable

AndyScherzinger 7 жил өмнө
parent
commit
810570cf49

+ 17 - 24
src/main/res/layout/info_box.xml

@@ -2,7 +2,7 @@
 <!--
   Nextcloud Android client application
 
-  Copyright (C) 2017 Andy Scherzinger
+  Copyright (C) 2018 Andy Scherzinger
 
   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
@@ -17,37 +17,30 @@
   You should have received a copy of the GNU Affero General Public
   License along with this program.  If not, see <http://www.gnu.org/licenses/>.
 -->
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                android:id="@+id/info_box"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_gravity="center_horizontal|bottom"
-                android:background="@color/filelist_icon_backgorund"
-                android:gravity="center"
-                android:padding="@dimen/standard_half_padding"
-                android:visibility="gone">
-
-    <ImageView
-        android:id="@+id/info_box_icon"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_centerInParent="true"
-        android:src="@drawable/ic_information_outline"/>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:id="@+id/info_box"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:layout_gravity="center_horizontal|bottom"
+    android:background="@color/filelist_icon_backgorund"
+    android:gravity="center"
+    android:padding="@dimen/standard_half_padding"
+    android:visibility="visible">
 
     <TextView
         android:id="@+id/info_box_message"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
+        android:drawableLeft="@drawable/ic_information_outline"
+        android:drawablePadding="@dimen/standard_half_padding"
+        android:drawableStart="@drawable/ic_information_outline"
         android:gravity="center"
-        android:layout_toEndOf="@+id/info_box_icon"
-        android:layout_toRightOf="@id/info_box_icon"
         android:paddingEnd="@dimen/standard_half_margin"
         android:paddingLeft="@dimen/standard_half_padding"
         android:paddingRight="@dimen/standard_half_padding"
         android:paddingStart="@dimen/standard_half_margin"
-        android:paddingTop="@dimen/zero"
-        android:paddingBottom="@dimen/zero"
-        android:text="@string/offline_mode"
-        android:textColor="@color/standard_gray"/>
+        android:textColor="@color/standard_gray"
+        tools:text="@string/offline_mode" />
 
-</RelativeLayout>
+</LinearLayout>