Prechádzať zdrojové kódy

Minor changes in the app header.

seavenois 9 rokov pred
rodič
commit
cf01330993

+ 15 - 9
app/src/main/java/com/ivalentin/margolariak/MainActivity.java

@@ -19,6 +19,7 @@ import android.graphics.drawable.Drawable;
 import android.net.Uri;
 import android.os.Bundle;
 import android.support.v7.app.AppCompatActivity;
+import android.util.DisplayMetrics;
 import android.util.Log;
 import android.view.Gravity;
 import android.view.KeyEvent;
@@ -147,11 +148,16 @@ public class MainActivity extends Activity {
 		String title = "";
 		Bundle bundle = new Bundle();
 
+		//Get measures in dp
+		DisplayMetrics metrics = getResources().getDisplayMetrics();
+		int dp7 = (int) (8 * ((float)metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT));
+		int dp3 = (int) (4 * ((float)metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT));
+
 		//Reset all tabs to it's original state
 		for (int i = 0; i < 6; i++) {
 			menuText[i].setTypeface(null, Typeface.NORMAL);
 			menuImage[i].requestLayout();
-			menuImage[i].getLayoutParams().height = 2;
+			menuImage[i].getLayoutParams().height = dp3;
 		}
 
 		switch (section) {
@@ -159,14 +165,14 @@ public class MainActivity extends Activity {
 				fragment = new HomeLayout();
 				title = getString(R.string.menu_home);
 				menuText[0].setTypeface(null, Typeface.BOLD);
-				menuImage[0].getLayoutParams().height = 8;
+				menuImage[0].getLayoutParams().height = dp7;
 				break;
 
 			case GM.SECTION.LOCATION:
 				fragment = new LocationLayout();
 				title = getString(R.string.menu_location);
 				menuText[1].setTypeface(null, Typeface.BOLD);
-				menuImage[1].getLayoutParams().height = 8;
+				menuImage[1].getLayoutParams().height = dp7;
 				break;
 
 			case GM.SECTION.LABLANCA:
@@ -179,7 +185,7 @@ public class MainActivity extends Activity {
 				}
 				title = getString(R.string.menu_lablanca);
 				menuText[2].setTypeface(null, Typeface.BOLD);
-				menuImage[2].getLayoutParams().height = 8;
+				menuImage[2].getLayoutParams().height = dp7;
 				break;
 
 			case GM.SECTION.SCHEDULE:
@@ -188,7 +194,7 @@ public class MainActivity extends Activity {
 				fragment.setArguments(bundle);
 				title = getString(R.string.menu_lablanca_schedule);
 				menuText[2].setTypeface(null, Typeface.BOLD);
-				menuImage[2].getLayoutParams().height = 8;
+				menuImage[2].getLayoutParams().height = dp7;
 				break;
 
 			case GM.SECTION.GM_SCHEDULE:
@@ -197,28 +203,28 @@ public class MainActivity extends Activity {
 				fragment.setArguments(bundle);
 				title = getString(R.string.menu_lablanca_gm_schedule);
 				menuText[2].setTypeface(null, Typeface.BOLD);
-				menuImage[2].getLayoutParams().height = 8;
+				menuImage[2].getLayoutParams().height = dp7;
 				break;
 
 			case GM.SECTION.ACTIVITIES:
 				fragment = new ActivityLayout();
 				title = getString(R.string.menu_activities);
 				menuText[3].setTypeface(null, Typeface.BOLD);
-				menuImage[3].getLayoutParams().height = 8;
+				menuImage[3].getLayoutParams().height = dp7;
 				break;
 
 			case GM.SECTION.BLOG:
 				fragment = new BlogLayout();
 				title = getString(R.string.menu_blog);
 				menuText[4].setTypeface(null, Typeface.BOLD);
-				menuImage[4].getLayoutParams().height = 8;
+				menuImage[4].getLayoutParams().height = dp7;
 				break;
 
 			case GM.SECTION.GALLERY:
 				fragment = new GalleryLayout();
 				title = getString(R.string.menu_blog);
 				menuText[5].setTypeface(null, Typeface.BOLD);
-				menuImage[5].getLayoutParams().height = 8;
+				menuImage[5].getLayoutParams().height = dp7;
 				break;
 		}
 

+ 24 - 21
app/src/main/res/layout/activity_main.xml

@@ -18,22 +18,23 @@
 
 		<ImageView
 			android:contentDescription="@string/app_name"
-			android:layout_width="40dp"
-			android:layout_height="40dp"
 			android:id="@+id/iv_logo"
 			android:src="@drawable/ic_launcher"
 			android:adjustViewBounds="true"
 			android:layout_weight=".2"
+			android:padding="1dp"
+			android:layout_height="wrap_content"
+			android:layout_width="wrap_content"
 			android:maxHeight="45dp"
 			android:maxWidth="45dp"
-			android:padding="1dp"/>
+			android:layout_gravity="center_vertical"/>
 
 		<!-- Layout with the app title and current section -->
 
 		<LinearLayout
 			android:layout_width="wrap_content"
 			android:layout_height="wrap_content"
-			android:layout_gravity="center"
+			android:layout_gravity="center_vertical|center"
 			android:layout_weight=".8"
 			android:gravity="center"
 			android:orientation="vertical" >
@@ -63,7 +64,7 @@
 		</LinearLayout>
 
 		<ImageButton
-			android:layout_width="40dp"
+			android:layout_width="wrap_content"
 			android:layout_height="match_parent"
 			android:src="@drawable/ic_expand"
 			android:contentDescription="@string/tutorial_menu"
@@ -71,7 +72,9 @@
 			android:layout_weight=".2"
 			android:id="@+id/bt_menu"
 			app:srcCompat="@drawable/ic_expand"
-			android:background="#00000000"/>
+			android:background="#00000000"
+			android:adjustViewBounds="false"
+			android:cropToPadding="false"/>
 
 		<ProgressBar
 			android:id="@+id/pb_sync"
@@ -88,11 +91,11 @@
 
 	<HorizontalScrollView
 		android:layout_width="wrap_content"
-		android:layout_height="50dp"
+		android:layout_height="55dp"
 		android:id="@+id/sv_menu"
 		android:scrollIndicators="none"
 		android:requiresFadingEdge="horizontal"
-		android:fadingEdgeLength="125dp"
+		android:fadingEdgeLength="80dp"
 		android:background="@color/background_menu"
 		tools:ignore="UnusedAttribute">
 
@@ -100,7 +103,7 @@
 			android:orientation="horizontal"
 			android:layout_width="wrap_content"
 			android:layout_height="match_parent"
-			>
+			android:layout_marginBottom="1dp">
 
 			<RelativeLayout
 				android:orientation="vertical"
@@ -124,7 +127,6 @@
 
 				<ImageView
 					android:layout_width="match_parent"
-					android:layout_height="8dp"
 					android:id="@+id/iv_menu_home"
 					android:background="@color/menu_selected"
 					android:alpha="1"
@@ -134,7 +136,8 @@
 					android:layout_alignParentLeft="false"
 					android:layout_alignParentRight="false"
 					android:layout_alignParentBottom="true"
-					tools:ignore="ContentDescription"/>
+					tools:ignore="ContentDescription"
+					android:layout_height="7dp"/>
 			</RelativeLayout>
 
 			<RelativeLayout
@@ -158,7 +161,6 @@
 
 				<ImageView
 					android:layout_width="match_parent"
-					android:layout_height="2dp"
 					android:id="@+id/iv_menu_location"
 					android:background="@color/menu_selected"
 					android:alpha="1"
@@ -168,7 +170,8 @@
 					android:layout_alignParentLeft="false"
 					android:layout_alignParentRight="false"
 					android:layout_alignParentBottom="true"
-					tools:ignore="ContentDescription"/>
+					tools:ignore="ContentDescription"
+					android:layout_height="3dp"/>
 			</RelativeLayout>
 
 			<RelativeLayout
@@ -192,7 +195,6 @@
 
 				<ImageView
 					android:layout_width="match_parent"
-					android:layout_height="2dp"
 					android:id="@+id/iv_menu_lablanca"
 					android:background="@color/menu_selected"
 					android:alpha="1"
@@ -202,7 +204,8 @@
 					android:layout_alignParentLeft="false"
 					android:layout_alignParentRight="false"
 					android:layout_alignParentBottom="true"
-					tools:ignore="ContentDescription"/>
+					tools:ignore="ContentDescription"
+					android:layout_height="3dp"/>
 			</RelativeLayout>
 
 			<RelativeLayout
@@ -226,7 +229,6 @@
 
 				<ImageView
 					android:layout_width="match_parent"
-					android:layout_height="2dp"
 					android:id="@+id/iv_menu_activities"
 					android:background="@color/menu_selected"
 					android:alpha="1"
@@ -236,7 +238,8 @@
 					android:layout_alignParentLeft="false"
 					android:layout_alignParentRight="false"
 					android:layout_alignParentBottom="true"
-					tools:ignore="ContentDescription"/>
+					tools:ignore="ContentDescription"
+					android:layout_height="3dp"/>
 			</RelativeLayout>
 
 			<RelativeLayout
@@ -260,7 +263,6 @@
 
 				<ImageView
 					android:layout_width="match_parent"
-					android:layout_height="2dp"
 					android:id="@+id/iv_menu_blog"
 					android:background="@color/menu_selected"
 					android:alpha="1"
@@ -270,7 +272,8 @@
 					android:layout_alignParentLeft="false"
 					android:layout_alignParentRight="false"
 					android:layout_alignParentBottom="true"
-					tools:ignore="ContentDescription"/>
+					tools:ignore="ContentDescription"
+					android:layout_height="3dp"/>
 			</RelativeLayout>
 
 			<RelativeLayout
@@ -294,7 +297,6 @@
 
 				<ImageView
 					android:layout_width="match_parent"
-					android:layout_height="2dp"
 					android:id="@+id/iv_menu_gallery"
 					android:background="@color/menu_selected"
 					android:alpha="1"
@@ -304,7 +306,8 @@
 					android:layout_alignParentLeft="false"
 					android:layout_alignParentRight="false"
 					android:layout_alignParentBottom="true"
-					tools:ignore="ContentDescription"/>
+					tools:ignore="ContentDescription"
+					android:layout_height="3dp"/>
 			</RelativeLayout>
 
 		</LinearLayout>

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

@@ -16,20 +16,21 @@
 
         <ImageView
             android:contentDescription="@string/app_name"
-            android:layout_width="40dp"
-            android:layout_height="40dp"
+            android:layout_width="wrap_content"
+            android:layout_height="match_parent"
             android:id="@+id/iv_logo"
             android:src="@drawable/ic_launcher"
             android:adjustViewBounds="true"
             android:layout_weight=".2"
             android:maxHeight="45dp"
             android:maxWidth="45dp"
-            android:padding="1dp"/>
+            android:padding="1dp"
+            android:layout_gravity="center_vertical"/>
 
         <LinearLayout
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_gravity="center"
+            android:layout_gravity="center_vertical|center"
             android:layout_weight=".8"
             android:gravity="center"
             android:orientation="vertical" >