Преглед изворни кода

Improvements in sections and entries.

Styles have been defined for sections and entries, so they look more like they do en the website and more uniform and clean. For the home section, all of them have been styled, and their margins and padding have been set. For some dinamically loaded entries, margins are applied programmatically, and the values have been established in the GM class. Some of those changes have produced diferent results in other sections of the app that will have to be reviewed.
seavenois пре 9 година
родитељ
комит
1e516137f3

+ 5 - 0
app/src/main/java/com/ivalentin/margolariak/GM.java

@@ -420,6 +420,11 @@ final class GM {
 	static final int IMG_THUMB = 180;
 	static final int IMG_VIEW = 800;
 
+	/**
+	 *Programaticall loaded rows needs their margin to also be set programatically
+	 */
+	static final int ENTRY_MARGIN = 8;
+
 	/**
 	 * Gets the language code for sql queries.
 	 * Only three values can be returned: es, eu, en.

+ 3 - 3
app/src/main/java/com/ivalentin/margolariak/HomeLayout.java

@@ -650,7 +650,7 @@ public class HomeLayout extends Fragment implements LocationListener {
 
 			//Set margins
 			LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
-			layoutParams.setMargins(10, 10, 10, 25);
+			layoutParams.setMargins(GM.ENTRY_MARGIN, GM.ENTRY_MARGIN, GM.ENTRY_MARGIN, GM.ENTRY_MARGIN);
 			entry.setLayoutParams(layoutParams);
 
 			//Set title
@@ -790,7 +790,7 @@ public class HomeLayout extends Fragment implements LocationListener {
 
 				//Set margins
 				LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
-				layoutParams.setMargins(10, 10, 10, 25);
+				layoutParams.setMargins(GM.ENTRY_MARGIN, GM.ENTRY_MARGIN, GM.ENTRY_MARGIN, GM.ENTRY_MARGIN);
 				entry.setLayoutParams(layoutParams);
 
 				//Set title
@@ -920,7 +920,7 @@ public class HomeLayout extends Fragment implements LocationListener {
 
 			//Set margins
 			LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
-			layoutParams.setMargins(10, 10, 10, 25);
+			layoutParams.setMargins(GM.ENTRY_MARGIN, GM.ENTRY_MARGIN, GM.ENTRY_MARGIN, GM.ENTRY_MARGIN);
 			entry.setLayoutParams(layoutParams);
 
 			//Set title

+ 9 - 1
app/src/main/res/drawable/entry.xml

@@ -4,6 +4,14 @@
     <stroke
         android:width="1dp"
         android:color="@color/entry_border" />
-    <solid android:color="@color/entry_background" />
+
+    <solid
+        android:color="@color/entry_background" />
+
+    <corners
+        android:bottomRightRadius="4dp"
+        android:bottomLeftRadius="4dp"
+        android:topLeftRadius="4dp"
+        android:topRightRadius="4dp"/>
 
 </shape>

+ 16 - 0
app/src/main/res/drawable/section_title.xml

@@ -0,0 +1,16 @@
+<shape
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle" >
+
+    <stroke
+        android:width="1dp"
+        android:color="@color/section_border" />
+
+    <solid
+        android:color="@color/section_title_background" />
+
+    <corners
+        android:topLeftRadius="8dp"
+        android:topRightRadius="8dp"/>
+
+</shape>

+ 119 - 85
app/src/main/res/layout/fragment_layout_home.xml

@@ -13,23 +13,27 @@
     
 	    <LinearLayout
 			android:id="@+id/ll_home_section_location"
-			android:layout_width="fill_parent"
+			android:layout_width="match_parent"
 			android:layout_height="wrap_content"
 			android:orientation="vertical"
 			android:background="@drawable/section"
-			android:visibility="gone"
-			android:layout_marginLeft="0dp"
-			android:layout_marginTop="2dp"
-			android:layout_marginRight="0dp"
-			android:layout_marginBottom="4dp"
-			android:paddingTop="5dp">
+			android:layout_margin="10dp"
+			android:visibility="gone">
 
 			<TextView
-				android:layout_width="wrap_content"
+				android:layout_width="match_parent"
 				android:layout_height="wrap_content"
 				android:text="@string/home_section_location"
 				android:textAppearance="?android:attr/textAppearanceLarge"
 				android:textStyle="bold"
+				tools:layout_width="match_parent"
+				android:background="@drawable/section_title"
+				android:paddingBottom="4dp"
+				android:paddingEnd="10dp"
+				android:paddingLeft="20dp"
+				android:paddingRight="10dp"
+				android:paddingStart="20dp"
+				android:paddingTop="4dp"
 				android:textColor="@color/section_title"/>
 
 			<LinearLayout
@@ -39,7 +43,7 @@
 				android:orientation="vertical"
 				android:background="@drawable/entry"
 				android:padding="7dp"
-				android:layout_margin="3dp">
+				android:layout_margin="8dp">
 
 				<TextView
 					android:layout_width="wrap_content"
@@ -81,24 +85,26 @@
 		<LinearLayout
 			android:orientation="vertical"
 			android:layout_width="match_parent"
-			android:layout_height="match_parent"
+			android:layout_height="wrap_content"
 			android:background="@drawable/section"
 			android:id="@+id/ll_home_section_lablanca"
-			android:visibility="gone"
-			android:layout_marginLeft="0dp"
-			android:layout_marginTop="2dp"
-			android:layout_marginRight="0dp"
-			android:layout_marginBottom="4dp"
-			android:paddingTop="5dp">
+			android:layout_margin="10dp"
+			android:visibility="gone">
 
 			<TextView
-				android:layout_width="wrap_content"
+				android:layout_width="match_parent"
 				android:layout_height="wrap_content"
 				android:textAppearance="?android:attr/textAppearanceLarge"
 				android:text="@string/lablanca_title"
-				android:id="@+id/textView4"
 				android:textStyle="bold"
-				android:textColor="@color/section_title"/>
+				android:textColor="@color/section_title"
+				android:paddingBottom="4dp"
+				android:paddingEnd="10dp"
+				android:paddingLeft="20dp"
+				android:paddingRight="10dp"
+				android:paddingStart="20dp"
+				android:paddingTop="4dp"
+				android:background="@drawable/section_title"/>
 
 			<LinearLayout
 				android:orientation="horizontal"
@@ -106,7 +112,7 @@
 				android:layout_height="match_parent"
 				android:background="@drawable/entry"
 				android:padding="7dp"
-				android:layout_margin="3dp">
+				android:layout_margin="8dp">
 
 				<ImageView
 					android:layout_width="wrap_content"
@@ -137,20 +143,23 @@
 			android:layout_height="wrap_content"
 			android:orientation="vertical"
 			android:background="@drawable/section"
-			android:visibility="gone"
-			android:layout_marginLeft="0dp"
-			android:layout_marginRight="0dp"
-			android:layout_marginTop="2dp"
-			android:layout_marginBottom="4dp"
-			android:paddingTop="5dp">
+			android:layout_margin="10dp"
+			android:visibility="gone">
 
 			<TextView
-				android:layout_width="wrap_content"
+				android:layout_width="match_parent"
 				android:layout_height="wrap_content"
 				android:text="@string/home_section_gmschedule"
 				android:textAppearance="?android:attr/textAppearanceLarge"
-				android:layout_marginBottom="10dp"
 				android:textStyle="bold"
+				tools:layout_width="match_parent"
+				android:background="@drawable/section_title"
+				android:paddingBottom="4dp"
+				android:paddingEnd="10dp"
+				android:paddingLeft="20dp"
+				android:paddingRight="10dp"
+				android:paddingStart="20dp"
+				android:paddingTop="4dp"
 				android:textColor="@color/section_title"/>
 
 			<LinearLayout
@@ -160,7 +169,7 @@
 				android:background="@drawable/entry"
 				android:id="@+id/ll_home_section_gmschedule_now_content"
 				android:padding="7dp"
-				android:layout_margin="3dp">
+				android:layout_margin="8dp">
 
 				<TextView
 					android:layout_width="wrap_content"
@@ -187,7 +196,7 @@
 				android:background="@drawable/entry"
 				android:id="@+id/ll_home_section_gmschedule_later_content"
 				android:padding="7dp"
-				android:layout_margin="3dp">
+				android:layout_margin="8dp">
 
 				<TextView
 					android:layout_width="wrap_content"
@@ -215,20 +224,23 @@
 			android:layout_height="wrap_content"
 			android:orientation="vertical"
 			android:background="@drawable/section"
-			android:visibility="gone"
-			android:layout_marginLeft="0dp"
-			android:layout_marginTop="2dp"
-			android:layout_marginRight="0dp"
-			android:layout_marginBottom="4dp"
-			android:paddingTop="5dp">
+			android:layout_margin="10dp"
+			android:visibility="gone">
 
 			<TextView
-				android:layout_width="wrap_content"
+				android:layout_width="match_parent"
 				android:layout_height="wrap_content"
 				android:text="@string/home_section_cityschedule"
 				android:textAppearance="?android:attr/textAppearanceLarge"
-				android:layout_marginBottom="10dp"
 				android:textStyle="bold"
+				tools:layout_width="match_parent"
+				android:background="@drawable/section_title"
+				android:paddingBottom="4dp"
+				android:paddingEnd="10dp"
+				android:paddingLeft="20dp"
+				android:paddingRight="10dp"
+				android:paddingStart="20dp"
+				android:paddingTop="4dp"
 				android:textColor="@color/section_title"/>
 
 			<LinearLayout
@@ -238,7 +250,7 @@
 				android:background="@drawable/entry"
 				android:id="@+id/ll_home_section_cityschedule_now_content"
 				android:padding="7dp"
-				android:layout_margin="3dp">
+				android:layout_margin="8dp">
 
 				<TextView
                     android:layout_width="wrap_content"
@@ -265,7 +277,7 @@
 				android:background="@drawable/entry"
 				android:id="@+id/ll_home_section_cityschedule_later_content"
 				android:padding="7dp"
-				android:layout_margin="3dp">
+				android:layout_margin="8dp">
 
 				<TextView
 					android:layout_width="wrap_content"
@@ -293,26 +305,30 @@
 			android:layout_height="wrap_content"
 			android:orientation="vertical"
 			android:background="@drawable/section"
-			android:visibility="gone"
-			android:layout_marginLeft="0dp"
-			android:layout_marginTop="2dp"
-			android:layout_marginRight="0dp"
-			android:layout_marginBottom="4dp"
-			android:paddingTop="5dp">
+			android:layout_margin="10dp"
+			android:visibility="gone">
 
 			<TextView
-				android:layout_width="wrap_content"
+				android:layout_width="match_parent"
 				android:layout_height="wrap_content"
 				android:text="@string/home_section_around"
 				android:textAppearance="?android:attr/textAppearanceLarge"
 				android:textStyle="bold"
+				tools:layout_width="match_parent"
+				android:background="@drawable/section_title"
+				android:paddingBottom="4dp"
+				android:paddingEnd="10dp"
+				android:paddingLeft="20dp"
+				android:paddingRight="10dp"
+				android:paddingStart="20dp"
+				android:paddingTop="4dp"
 				android:textColor="@color/section_title"/>
 
 			<LinearLayout
 				android:id="@+id/ll_home_section_around_content"
 				android:layout_width="match_parent"
 				android:layout_height="wrap_content"
-				android:layout_margin="3dp"
+				android:layout_margin="8dp"
 				android:orientation="vertical"
 				android:background="@drawable/entry"
 				>
@@ -327,26 +343,30 @@
 			android:layout_height="wrap_content"
 			android:orientation="vertical"
 			android:background="@drawable/section"
-			android:visibility="gone"
-			android:layout_marginLeft="0dp"
-			android:layout_marginTop="2dp"
-			android:layout_marginRight="0dp"
-			android:layout_marginBottom="4dp"
-			android:paddingTop="5dp">
+			android:layout_margin="10dp"
+			android:visibility="gone">
 
 			<TextView
-				android:layout_width="wrap_content"
+				android:layout_width="match_parent"
 				android:layout_height="wrap_content"
 				android:text="@string/home_section_activities_future"
 				android:textAppearance="?android:attr/textAppearanceLarge"
 				android:textStyle="bold"
+				tools:layout_width="match_parent"
+				android:background="@drawable/section_title"
+				android:paddingBottom="4dp"
+				android:paddingEnd="10dp"
+				android:paddingLeft="20dp"
+				android:paddingRight="10dp"
+				android:paddingStart="20dp"
+				android:paddingTop="4dp"
 				android:textColor="@color/section_title"/>
 
 			<LinearLayout
 				android:id="@+id/ll_home_section_activities_future_content"
 				android:layout_width="match_parent"
 				android:layout_height="wrap_content"
-				android:layout_margin="3dp"
+				android:layout_margin="8dp"
 				android:orientation="vertical">
 
 			</LinearLayout>
@@ -359,25 +379,28 @@
 			android:layout_height="wrap_content"
 			android:orientation="vertical"
 			android:background="@drawable/section"
-			android:layout_marginLeft="0dp"
-			android:layout_marginTop="2dp"
-			android:layout_marginRight="0dp"
-			android:layout_marginBottom="4dp"
-			android:paddingTop="5dp">
+			android:layout_margin="10dp">
 
 			<TextView
-				android:layout_width="wrap_content"
+				android:layout_width="match_parent"
 				android:layout_height="wrap_content"
 				android:text="@string/home_section_blog"
 				android:textAppearance="?android:attr/textAppearanceLarge"
 				android:textStyle="bold"
+				tools:layout_width="match_parent"
+				android:background="@drawable/section_title"
+				android:paddingBottom="4dp"
+				android:paddingEnd="10dp"
+				android:paddingLeft="20dp"
+				android:paddingRight="10dp"
+				android:paddingStart="20dp"
+				android:paddingTop="4dp"
 				android:textColor="@color/section_title"/>
 
 			<LinearLayout
 				android:id="@+id/ll_home_section_blog_content"
 				android:layout_width="match_parent"
 				android:layout_height="wrap_content"
-				android:layout_margin="3dp"
 				android:orientation="vertical"
 				>
 
@@ -391,25 +414,29 @@
 			android:layout_height="wrap_content"
 			android:orientation="vertical"
 			android:background="@drawable/section"
-			android:layout_marginLeft="0dp"
-			android:layout_marginTop="2dp"
-			android:layout_marginRight="0dp"
-			android:layout_marginBottom="4dp"
-			android:paddingTop="5dp">
+			android:layout_margin="10dp">
 
 			<TextView
-				android:layout_width="wrap_content"
+				android:layout_width="match_parent"
 				android:layout_height="wrap_content"
 				android:text="@string/home_section_gallery"
 				android:textAppearance="?android:attr/textAppearanceLarge"
 				android:textStyle="bold"
+				tools:layout_width="match_parent"
+				android:background="@drawable/section_title"
+				android:paddingBottom="4dp"
+				android:paddingEnd="10dp"
+				android:paddingLeft="20dp"
+				android:paddingRight="10dp"
+				android:paddingStart="20dp"
+				android:paddingTop="4dp"
 				android:textColor="@color/section_title"/>
 
 			<LinearLayout
 				android:id="@+id/ll_home_section_gallery_content"
 				android:layout_width="match_parent"
 				android:layout_height="wrap_content"
-				android:layout_margin="3dp"
+				android:layout_margin="8dp"
 				android:orientation="vertical"
 				android:background="@drawable/entry"
 				android:padding="7dp">
@@ -544,26 +571,29 @@
 			android:layout_height="wrap_content"
 			android:orientation="vertical"
 			android:background="@drawable/section"
-			android:visibility="gone"
-			android:layout_marginLeft="0dp"
-			android:layout_marginTop="2dp"
-			android:layout_marginRight="0dp"
-			android:layout_marginBottom="4dp"
-			android:paddingTop="5dp">
+			android:layout_margin="10dp"
+			android:visibility="gone">
 
 			<TextView
-				android:layout_width="wrap_content"
+				android:layout_width="match_parent"
 				android:layout_height="wrap_content"
 				android:text="@string/home_section_activities_past"
 				android:textAppearance="?android:attr/textAppearanceLarge"
 				android:textStyle="bold"
+				tools:layout_width="match_parent"
+				android:background="@drawable/section_title"
+				android:paddingBottom="4dp"
+				android:paddingEnd="10dp"
+				android:paddingLeft="20dp"
+				android:paddingRight="10dp"
+				android:paddingStart="20dp"
+				android:paddingTop="4dp"
 				android:textColor="@color/section_title"/>
 
 			<LinearLayout
 				android:id="@+id/ll_home_section_activities_past_content"
 				android:layout_width="match_parent"
 				android:layout_height="wrap_content"
-				android:layout_margin="3dp"
 				android:orientation="vertical">
 
 			</LinearLayout>
@@ -576,25 +606,29 @@
 			android:layout_height="wrap_content"
 			android:orientation="vertical"
 			android:background="@drawable/section"
-			android:layout_marginLeft="0dp"
-			android:layout_marginTop="2dp"
-			android:layout_marginRight="0dp"
-			android:layout_marginBottom="4dp"
-			android:paddingTop="5dp">
+			android:layout_margin="10dp">
 
 			<TextView
-				android:layout_width="wrap_content"
+				android:layout_width="match_parent"
 				android:layout_height="wrap_content"
 				android:text="@string/home_section_social"
 				android:textAppearance="?android:attr/textAppearanceLarge"
 				android:textStyle="bold"
+				tools:layout_width="match_parent"
+				android:background="@drawable/section_title"
+				android:paddingBottom="4dp"
+				android:paddingEnd="10dp"
+				android:paddingLeft="20dp"
+				android:paddingRight="10dp"
+				android:paddingStart="20dp"
+				android:paddingTop="4dp"
 				android:textColor="@color/section_title"/>
 
 			<LinearLayout
 				android:id="@+id/ll_home_section_social_content"
 				android:layout_width="match_parent"
 				android:layout_height="wrap_content"
-				android:layout_margin="3dp"
+				android:layout_margin="8dp"
 				android:orientation="vertical"
 				android:background="@drawable/entry"
 				android:padding="7dp">

+ 5 - 4
app/src/main/res/layout/row_home_activities.xml

@@ -1,9 +1,10 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:orientation="vertical" android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:background="@drawable/entry"
-    android:padding="4dp">
+              android:orientation="vertical" android:layout_width="match_parent"
+              android:layout_height="wrap_content"
+              android:background="@drawable/entry"
+              android:padding="7dp"
+              android:layout_margin="8dp">
 
     <TextView
         android:layout_width="wrap_content"

+ 5 - 4
app/src/main/res/layout/row_home_blog.xml

@@ -1,9 +1,10 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:orientation="vertical" android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:background="@drawable/entry"
-    android:padding="4dp">
+              android:orientation="vertical" android:layout_width="match_parent"
+              android:layout_height="wrap_content"
+              android:background="@drawable/entry"
+              android:padding="7dp"
+              android:layout_margin="8dp">
 
     <TextView
         android:layout_width="match_parent"

+ 2 - 3
app/src/main/res/layout/row_home_schedule.xml

@@ -4,9 +4,8 @@
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:orientation="vertical"
-    android:paddingStart="15dp"
-    android:paddingEnd="15dp"
-    android:paddingTop="5dp">
+    android:layout_margin="8dp"
+    android:padding="7dp">
 
     <TextView
         android:id="@+id/tv_row_home_schedule_id"

+ 2 - 1
app/src/main/res/values/color.xml

@@ -12,8 +12,9 @@
     <color name="section_background">#98c8ff</color>
     <color name="section_border">#000011</color>
     <color name="section_title">#ffffff</color>
+    <color name="section_title_background">#0078ff</color>
     <color name="entry_background">#ffffff</color>
-    <color name="entry_border">#d8f3f5</color>
+    <color name="entry_border">#6D6990</color>
     <color name="entry_title">#41786e</color>
     
     <!--Color for the menu entries-->