Create new Balances layout with the send and receive buttons at the top and the user balances at the bottom per Ken's design.

This commit is contained in:
Severiano Jaramillo 2018-12-13 10:16:57 -06:00
parent 2619541e16
commit 6e25dd7589
5 changed files with 143 additions and 52 deletions

View file

@ -29,6 +29,7 @@
<activity
android:name=".activities.MainActivity"
android:theme="@style/Theme.Bitsy.NoActionBar"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan"/>
<activity
android:name=".activities.SettingsActivity"

View file

@ -6,6 +6,7 @@ import android.preference.PreferenceManager
import android.view.*
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
@ -53,7 +54,8 @@ class BalancesFragment : Fragment() {
val balancesAdapter = BalancesAdapter(context!!)
rvBalances.adapter = balancesAdapter
rvBalances.layoutManager = GridLayoutManager(context, 2)
rvBalances.layoutManager = LinearLayoutManager(context!!)
rvBalances.addItemDecoration(DividerItemDecoration(context!!, DividerItemDecoration.VERTICAL))
mBalanceDetailViewModel.getAll().observe(this, Observer<List<BalanceDetail>> { balancesDetails ->
balancesAdapter.replaceAll(balancesDetails)

View file

@ -1,9 +1,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M20.54,5.23l-1.39,-1.68C18.88,3.21 18.47,3 18,3H6c-0.47,0 -0.88,0.21 -1.16,0.55L3.46,5.23C3.17,5.57 3,6.02 3,6.5V19c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2V6.5c0,-0.48 -0.17,-0.93 -0.46,-1.27zM12,17.5L6.5,12H10v-2h4v2h3.5L12,17.5zM5.12,5l0.81,-1h12l0.94,1H5.12z"/>
</vector>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="90"
android:toDegrees="90"
android:pivotX="50%"
android:pivotY="50%"
android:drawable="@drawable/ic_send">
</rotate>

View file

@ -1,9 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M20.55,5.22l-1.39,-1.68C18.88,3.21 18.47,3 18,3H6c-0.47,0 -0.88,0.21 -1.15,0.55L3.46,5.22C3.17,5.57 3,6.01 3,6.5V19c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2V6.5c0,-0.49 -0.17,-0.93 -0.45,-1.28zM12,9.5l5.5,5.5H14v2h-4v-2H6.5L12,9.5zM5.12,5l0.82,-1h12l0.93,1H5.12z"/>
<vector android:height="24dp"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FFF" android:pathData="M12,8V4l8,8 -8,8v-4H4V8z"/>
</vector>

View file

@ -1,40 +1,134 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_marginBottom="@dimen/activity_vertical_margin"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:orientation="vertical"
tools:context=".fragments.BalancesFragment">
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".fragments.MerchantsFragment">
android:layout_height="0dp"
android:layout_weight="1"
android:elevation="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:orientation="vertical">
<TextView
android:id="@+id/tvAccountName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="seventest-5"
android:textAppearance="@style/TextAppearance.Bitsy.Headline6"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_same_topic"
android:text="@string/title_balances"
android:textAppearance="@style/TextAppearance.Bitsy.Subtitle1"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvBalances"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:listitem="@layout/item_balance"
tools:itemCount="3"/>
android:layout_height="match_parent">
</LinearLayout>
<androidx.constraintlayout.widget.Guideline
android:id="@+id/firstVerticalGuideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.45"/>
</ScrollView>
<androidx.constraintlayout.widget.Guideline
android:id="@+id/secondVerticalGuideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.55"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fabReceiveTransaction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:fabSize="auto"
app:fabCustomSize="120dp"
app:maxImageSize="70dp"
android:backgroundTint="@color/colorReceive"
android:src="@drawable/ic_receive"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/firstVerticalGuideline"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fabSendTransactionCamera"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:fabSize="mini"
app:maxImageSize="18dp"
android:src="@drawable/ic_camera"
android:backgroundTint="@color/colorSend"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/firstVerticalGuideline"
app:layout_constraintEnd_toStartOf="@id/secondVerticalGuideline"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fabSendTransaction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:fabSize="auto"
app:fabCustomSize="120dp"
app:maxImageSize="70dp"
android:backgroundTint="@color/colorSend"
android:src="@drawable/ic_send"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/secondVerticalGuideline"
app:layout_constraintEnd_toEndOf="parent"/>
<View
android:layout_width="0dp"
android:layout_height="1dp"
android:background="@color/gray"
app:layout_constraintTop_toTopOf="@id/fabSendTransactionCamera"
app:layout_constraintBottom_toBottomOf="@id/fabSendTransactionCamera"
app:layout_constraintStart_toEndOf="@id/fabSendTransactionCamera"
app:layout_constraintEnd_toStartOf="@id/fabSendTransaction"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_weight="2"
android:elevation="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/tvAccountName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_same_topic"
android:layout_marginStart="@dimen/spacing_same_topic"
tools:text="seventest-5"
android:textAppearance="@style/TextAppearance.Bitsy.Headline6"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_same_topic"
android:layout_marginStart="@dimen/spacing_same_topic"
android:text="@string/title_balances"
android:textAppearance="@style/TextAppearance.Bitsy.Subtitle1"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvBalances"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingStart="@dimen/spacing_same_topic"
android:paddingEnd="@dimen/spacing_same_topic"
tools:listitem="@layout/item_balance"
tools:itemCount="3"/>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</LinearLayout>