From d3beb7ca3f892135f2875ab01d86a9ac131076f6 Mon Sep 17 00:00:00 2001
From: m2049r <30435443+m2049r@users.noreply.github.com>
Date: Fri, 3 Nov 2017 10:14:19 +0100
Subject: [PATCH] exchange & toolbar layout (#111)

---
 app/build.gradle                              |   4 +-
 .../com/m2049r/xmrwallet/WalletFragment.java  |   2 +-
 .../res/drawable/backgound_spinner_gray.xml   |  12 ++
 app/src/main/res/layout/activity_login.xml    |   2 +-
 app/src/main/res/layout/activity_wallet.xml   |   2 +-
 app/src/main/res/layout/fragment_receive.xml  |   8 +-
 app/src/main/res/layout/fragment_send.xml     |  13 +-
 app/src/main/res/layout/fragment_wallet.xml   |   2 +-
 ...m_spinner.xml => item_spinner_balance.xml} |   0
 app/src/main/res/layout/view_exchange.xml     | 145 ++++++++++--------
 app/src/main/res/layout/view_toolbar.xml      |   3 +-
 app/src/main/res/values/styles.xml            |  16 +-
 12 files changed, 122 insertions(+), 87 deletions(-)
 create mode 100644 app/src/main/res/drawable/backgound_spinner_gray.xml
 rename app/src/main/res/layout/{item_spinner.xml => item_spinner_balance.xml} (100%)

diff --git a/app/build.gradle b/app/build.gradle
index ed1e82fb..c4f08848 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -8,8 +8,8 @@ android {
         applicationId "com.m2049r.xmrwallet"
         minSdkVersion 21
         targetSdkVersion 25
-        versionCode 31
-        versionName "1.1.3-alpha"
+        versionCode 33
+        versionName "1.1.5-alpha"
         testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
         externalNativeBuild {
             cmake {
diff --git a/app/src/main/java/com/m2049r/xmrwallet/WalletFragment.java b/app/src/main/java/com/m2049r/xmrwallet/WalletFragment.java
index d72b3c37..ffa34e5e 100644
--- a/app/src/main/java/com/m2049r/xmrwallet/WalletFragment.java
+++ b/app/src/main/java/com/m2049r/xmrwallet/WalletFragment.java
@@ -96,7 +96,7 @@ public class WalletFragment extends Fragment
         ivSynced = (ImageView) view.findViewById(R.id.ivSynced);
 
         sCurrency = (Spinner) view.findViewById(R.id.sCurrency);
-        sCurrency.setAdapter(ArrayAdapter.createFromResource(getContext(), R.array.currency, R.layout.item_spinner));
+        sCurrency.setAdapter(ArrayAdapter.createFromResource(getContext(), R.array.currency, R.layout.item_spinner_balance));
 
         bSend = (Button) view.findViewById(R.id.bSend);
         bReceive = (Button) view.findViewById(R.id.bReceive);
diff --git a/app/src/main/res/drawable/backgound_spinner_gray.xml b/app/src/main/res/drawable/backgound_spinner_gray.xml
new file mode 100644
index 00000000..0af81c0a
--- /dev/null
+++ b/app/src/main/res/drawable/backgound_spinner_gray.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <padding
+        android:bottom="8dp"
+        android:left="8dp"
+        android:right="8dp"
+        android:top="8dp" />
+    <stroke
+        android:width="2dp"
+        android:color="@color/moneroGray" />
+</shape>
diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml
index 7b155697..7bd10529 100644
--- a/app/src/main/res/layout/activity_login.xml
+++ b/app/src/main/res/layout/activity_login.xml
@@ -10,7 +10,7 @@
         android:id="@+id/toolbar"
         style="@style/ToolBarStyle.Event"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"
+        android:layout_height="?attr/actionBarSize"
         android:background="@drawable/backgound_toolbar_mainnet"
         android:minHeight="?attr/actionBarSize" />
 
diff --git a/app/src/main/res/layout/activity_wallet.xml b/app/src/main/res/layout/activity_wallet.xml
index 7b155697..7bd10529 100644
--- a/app/src/main/res/layout/activity_wallet.xml
+++ b/app/src/main/res/layout/activity_wallet.xml
@@ -10,7 +10,7 @@
         android:id="@+id/toolbar"
         style="@style/ToolBarStyle.Event"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"
+        android:layout_height="?attr/actionBarSize"
         android:background="@drawable/backgound_toolbar_mainnet"
         android:minHeight="?attr/actionBarSize" />
 
diff --git a/app/src/main/res/layout/fragment_receive.xml b/app/src/main/res/layout/fragment_receive.xml
index f884df63..36a9fb95 100644
--- a/app/src/main/res/layout/fragment_receive.xml
+++ b/app/src/main/res/layout/fragment_receive.xml
@@ -50,13 +50,15 @@
         android:id="@+id/evAmount"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_marginTop="16sp" />
+        android:layout_marginBottom="16sp"
+        android:layout_marginTop="16sp"
+        android:orientation="vertical"
+        android:paddingEnd="56dp"
+        android:paddingStart="56dp" />
 
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_marginBottom="4sp"
-        android:layout_marginTop="8sp"
         android:orientation="horizontal"
         android:weightSum="10">
 
diff --git a/app/src/main/res/layout/fragment_send.xml b/app/src/main/res/layout/fragment_send.xml
index 6572261d..392c0930 100644
--- a/app/src/main/res/layout/fragment_send.xml
+++ b/app/src/main/res/layout/fragment_send.xml
@@ -20,7 +20,6 @@
         <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_marginBottom="4sp"
             android:layout_marginTop="4sp"
             android:orientation="horizontal"
             android:weightSum="10">
@@ -59,14 +58,16 @@
             android:id="@+id/evAmount"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_marginBottom="4sp"
-            android:layout_marginTop="4sp" />
+            android:layout_marginBottom="16sp"
+            android:layout_marginTop="16sp"
+            android:orientation="vertical"
+            android:paddingEnd="56dp"
+            android:paddingStart="56dp" />
 
         <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginBottom="4sp"
-            android:layout_marginTop="4sp"
             android:orientation="horizontal"
             android:weightSum="10">
 
@@ -109,7 +110,7 @@
             android:orientation="horizontal">
 
             <TextView
-                style="@style/MoneroLabel.Caps.Stealth.Small"
+                style="@style/MoneroLabel.Caps.Gray.Small"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_gravity="center|end"
@@ -119,6 +120,7 @@
 
             <Spinner
                 android:id="@+id/sMixin"
+                style="@style/MoneroSpinnerGray"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_marginEnd="8sp"
@@ -128,6 +130,7 @@
 
             <Spinner
                 android:id="@+id/sPriority"
+                style="@style/MoneroSpinnerGray"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_weight="1"
diff --git a/app/src/main/res/layout/fragment_wallet.xml b/app/src/main/res/layout/fragment_wallet.xml
index c200ded9..fcdd0ded 100644
--- a/app/src/main/res/layout/fragment_wallet.xml
+++ b/app/src/main/res/layout/fragment_wallet.xml
@@ -61,7 +61,7 @@
                 android:paddingEnd="4dp"
                 android:paddingStart="4dp"
                 android:paddingTop="0dp"
-                tools:listitem="@layout/item_spinner" />
+                tools:listitem="@layout/item_spinner_balance" />
         </LinearLayout>
 
         <TextView
diff --git a/app/src/main/res/layout/item_spinner.xml b/app/src/main/res/layout/item_spinner_balance.xml
similarity index 100%
rename from app/src/main/res/layout/item_spinner.xml
rename to app/src/main/res/layout/item_spinner_balance.xml
diff --git a/app/src/main/res/layout/view_exchange.xml b/app/src/main/res/layout/view_exchange.xml
index a8cf6cd9..d5d20e82 100644
--- a/app/src/main/res/layout/view_exchange.xml
+++ b/app/src/main/res/layout/view_exchange.xml
@@ -3,84 +3,97 @@
     xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools">
 
-    <com.m2049r.xmrwallet.layout.CTextInputLayout
-        android:id="@+id/etAmount"
-        android:layout_width="0dp"
+    <LinearLayout
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_weight="3"
-        app:counterEnabled="false"
-        app:errorEnabled="true">
+        android:layout_marginStart="4dp"
+        android:orientation="horizontal">
 
-        <android.support.design.widget.TextInputEditText
-            style="@style/MoneroEdit"
+        <Spinner
+            android:id="@+id/sCurrencyA"
+            android:layout_width="56sp"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:entries="@array/currency"
+            android:gravity="center"
+            android:textAlignment="center" />
+
+        <com.m2049r.xmrwallet.layout.CTextInputLayout
+            android:id="@+id/etAmount"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:gravity="end"
-            android:hint="@string/receive_amount_hint"
-            android:imeOptions="actionDone"
-            android:inputType="numberDecimal"
+            android:layout_marginStart="16dp"
+            app:counterEnabled="false"
+            app:errorEnabled="true">
+
+            <android.support.design.widget.TextInputEditText
+                style="@style/MoneroEdit"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:gravity="start"
+                android:hint="@string/receive_amount_hint"
+                android:imeOptions="actionDone"
+                android:inputType="numberDecimal"
+                tools:text="87.00000" />
+
+        </com.m2049r.xmrwallet.layout.CTextInputLayout>
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="4dp"
+        android:orientation="horizontal">
+
+        <Spinner
+            android:id="@+id/sCurrencyB"
+            style="@style/MoneroSpinnerGray"
+            android:layout_width="56sp"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:entries="@array/currency"
+            android:gravity="center"
+            android:paddingBottom="8dp"
+            android:paddingTop="8dp"
+            android:textAlignment="center" />
+
+        <TextView
+            android:id="@+id/tvAmountB"
+            style="@style/MoneroText"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center|start"
+            android:layout_marginStart="16dp"
+            android:layout_weight="3"
+            android:padding="4dp"
+            android:singleLine="true"
+            android:text="--"
             tools:text="87.00000" />
 
-    </com.m2049r.xmrwallet.layout.CTextInputLayout>
-
-    <Spinner
-        android:id="@+id/sCurrencyA"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center"
-        android:layout_marginStart="4dp"
-        android:entries="@array/currency"
-        android:gravity="center"
-        android:paddingBottom="8dp"
-        android:paddingTop="8dp"
-        android:textAlignment="center" />
-
-    <FrameLayout
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center"
-        android:layout_marginEnd="0sp"
-        android:layout_marginStart="8sp">
-
-        <ImageView
-            android:id="@+id/evExchange"
+        <FrameLayout
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_gravity="center"
-            android:src="@drawable/ic_traffic" />
+            android:layout_marginEnd="0sp"
+            android:layout_marginStart="8sp">
 
-        <ProgressBar
-            android:id="@+id/pbExchange"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_gravity="center"
-            android:indeterminate="true"
-            android:visibility="invisible" />
-    </FrameLayout>
+            <ImageView
+                android:id="@+id/evExchange"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="center"
+                android:src="@drawable/ic_traffic" />
 
-    <TextView
-        android:id="@+id/tvAmountB"
-        style="@style/MoneroText"
-        android:layout_width="0sp"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center|end"
-        android:layout_weight="3"
-        android:singleLine="true"
-        android:text="--"
-        android:textAlignment="textEnd"
-        tools:text="87.00000" />
+            <ProgressBar
+                android:id="@+id/pbExchange"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="center"
+                android:indeterminate="true"
+                android:visibility="invisible" />
+        </FrameLayout>
 
-    <Spinner
-        android:id="@+id/sCurrencyB"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center"
-        android:layout_marginStart="4dp"
-        android:entries="@array/currency"
-        android:gravity="center"
-        android:paddingBottom="8dp"
-        android:paddingTop="8dp"
-        android:textAlignment="center" />
+    </LinearLayout>
 
 </merge>
 
diff --git a/app/src/main/res/layout/view_toolbar.xml b/app/src/main/res/layout/view_toolbar.xml
index e37e1a61..698d2bbb 100644
--- a/app/src/main/res/layout/view_toolbar.xml
+++ b/app/src/main/res/layout/view_toolbar.xml
@@ -20,7 +20,7 @@
             android:layout_width="wrap_content"
             android:layout_height="match_parent"
             android:layout_gravity="center"
-            android:layout_marginTop="-4dp"
+            android:layout_marginTop="-8dp"
             android:src="@drawable/ic_logo_horizontol_xmrujo"
             android:visibility="visible" />
 
@@ -46,7 +46,6 @@
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_gravity="center"
-                android:layout_marginTop="-4dp"
                 android:visibility="invisible"
                 tools:text="monerujo" />
         </LinearLayout>
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 5f2e6582..37638cad 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -56,11 +56,7 @@
         <item name="android:textColor">@color/moneroGray</item>
     </style>
 
-    <style name="MoneroLabel.Caps.Stealth">
-        <item name="android:textColor">@color/moneroFab</item>
-    </style>
-
-    <style name="MoneroLabel.Caps.Stealth.Small">
+    <style name="MoneroLabel.Caps.Gray.Small">
         <item name="android:textSize">12sp</item>
     </style>
 
@@ -249,6 +245,16 @@
     </style>
 
 
+    <style name="MoneroTextAppearanceSpinnerItemGray" parent="android:TextAppearance.Widget.TextView.SpinnerItem">
+        <item name="android:textColor">@color/moneroGray</item>
+    </style>
 
+    <style name="MoneroSpinnerGray" parent="@style/Widget.AppCompat.Spinner">
+        <item name="android:background">@drawable/backgound_spinner_gray</item>
+    </style>
+
+    <style name="MoneroSpinnerItemGray" parent="android:Widget.TextView.SpinnerItem">
+        <item name="android:textAppearance">@style/MoneroTextAppearanceSpinnerItemGray</item>
+    </style>
 
 </resources>