Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve UI of accounts screen #115

Open
wants to merge 1 commit into
base: redesign
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package org.mifos.mobile.cn.ui.mifos.accounts

import android.os.Bundle
import android.util.Log
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.github.therajanmaurya.sweeterror.SweetUIErrorHandler
import kotlinx.android.synthetic.main.fragment_accounts.*
import kotlinx.android.synthetic.main.layout_exception_handler.*
import org.mifos.mobile.cn.R
import org.mifos.mobile.cn.data.models.accounts.deposit.DepositAccount
import org.mifos.mobile.cn.data.models.accounts.loan.LoanAccount
Expand All @@ -19,7 +18,6 @@ import org.mifos.mobile.cn.ui.base.MifosBaseFragment
import org.mifos.mobile.cn.ui.utils.ConstantKeys
import org.mifos.mobile.cn.ui.utils.Network
import javax.inject.Inject
import kotlinx.android.synthetic.main.layout_sweet_exception_handler.*
import org.mifos.mobile.cn.data.models.CheckboxStatus
import org.mifos.mobile.cn.ui.base.OnItemClickListener
import org.mifos.mobile.cn.ui.mifos.customerDepositDetails.CustomerDepositDetailsFragment
Expand Down Expand Up @@ -115,8 +113,6 @@ class AccountsFragment : MifosBaseFragment(), AccountsContract.View, OnItemClick
layoutManager.orientation = LinearLayoutManager.VERTICAL
rv_accounts.layoutManager = layoutManager
rv_accounts.setHasFixedSize(true)
rv_accounts.addItemDecoration(DividerItemDecoration(activity,
layoutManager.orientation))
btn_try_again.setOnClickListener { retry() }

when (accountType) {
Expand Down Expand Up @@ -265,4 +261,4 @@ class AccountsFragment : MifosBaseFragment(), AccountsContract.View, OnItemClick
override fun hideProgress() {
hideProgressBar()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org.mifos.mobile.cn.ui.mifos.customerAccounts

import android.app.SearchManager
import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.viewpager.widget.ViewPager
import androidx.appcompat.widget.SearchView
Expand All @@ -19,6 +20,7 @@ import org.mifos.mobile.cn.ui.mifos.accounts.AccountsContract
import org.mifos.mobile.cn.ui.mifos.accounts.AccountsFragment
import org.mifos.mobile.cn.ui.mifos.accounts.AccountsPresenter
import org.mifos.mobile.cn.ui.mifos.accountsFilter.AccountsFilterBottomSheet
import org.mifos.mobile.cn.ui.mifos.loanApplication.loanActivity.LoanApplicationActivity
import org.mifos.mobile.cn.ui.utils.ConstantKeys
import org.mifos.mobile.cn.ui.utils.StatusUtils
import javax.inject.Inject
Expand Down Expand Up @@ -93,6 +95,13 @@ class CustomerAccountFragment : MifosBaseFragment(), AccountsContract.View {
AccountType.LOAN -> viewpager.currentItem = 1
}

deposit_toggle_btn.setOnClickListener {
viewpager.currentItem = 0
}
loan_toggle_btn.setOnClickListener {
viewpager.currentItem = 1
}

tabs.setupWithViewPager(viewpager)
viewpager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
override fun onPageScrolled(position: Int, positionOffset: Float,
Expand Down Expand Up @@ -157,12 +166,19 @@ class CustomerAccountFragment : MifosBaseFragment(), AccountsContract.View {
override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) {
inflater?.inflate(R.menu.menu_account, menu)
if (viewpager.currentItem == 1) {
loan_toggle_focus_btn.visibility = View.VISIBLE
deposit_toggle_focus_btn.visibility = View.GONE
iv_apply_for_loan.visibility = View.VISIBLE
applyForLoan()
menu?.findItem(R.id.menu_filter_loan)?.isVisible = true
menu?.findItem(R.id.menu_filter_deposit)?.isVisible = false
menu?.findItem(R.id.menu_search_loan)?.isVisible = true
menu?.findItem(R.id.menu_search_deposit)?.isVisible = false
initSearch(menu!!, AccountType.LOAN)
} else if (viewpager.currentItem == 0) {
deposit_toggle_focus_btn.visibility = View.VISIBLE
loan_toggle_focus_btn.visibility = View.GONE
iv_apply_for_loan.visibility = View.GONE
menu?.findItem(R.id.menu_filter_loan)?.isVisible = false
menu?.findItem(R.id.menu_filter_deposit)?.isVisible = true
menu?.findItem(R.id.menu_search_deposit)?.isVisible = true
Expand All @@ -173,6 +189,14 @@ class CustomerAccountFragment : MifosBaseFragment(), AccountsContract.View {

}

private fun applyForLoan() {
iv_apply_for_loan.setOnClickListener(View.OnClickListener {
val intent = Intent(activity, LoanApplicationActivity::class.java)
intent.putExtra(ConstantKeys.CUSTOMER_IDENTIFIER, "customer_identifier")
startActivity(intent)
})
}

override fun onOptionsItemSelected(item: MenuItem?): Boolean {
when (item?.itemId) {
R.id.menu_filter_loan -> showFilterDialog(AccountType.LOAN)
Expand Down Expand Up @@ -267,4 +291,4 @@ class CustomerAccountFragment : MifosBaseFragment(), AccountsContract.View {
(activity as MifosBaseActivity).setToolbarElevation()
}

}
}
Binary file added app/src/main/res/drawable/more_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions app/src/main/res/drawable/rounded_shape.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<shape
laxyapahuja marked this conversation as resolved.
Show resolved Hide resolved
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">

<solid
android:color="@color/white">
</solid>

<corners
android:radius="30dp">
</corners>

</shape>
3 changes: 2 additions & 1 deletion app/src/main/res/layout/fragment_accounts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@android:color/white"
android:layout_height="match_parent"
android:layout_width="match_parent">

Expand Down Expand Up @@ -30,7 +29,9 @@
layout="@layout/layout_sweet_exception_handler"
android:id="@+id/layout_error"
android:visibility="gone"/>

</LinearLayout>

</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

</androidx.coordinatorlayout.widget.CoordinatorLayout>
205 changes: 177 additions & 28 deletions app/src/main/res/layout/fragment_client_accounts.xml
Original file line number Diff line number Diff line change
@@ -1,38 +1,187 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:background="@color/violet">

<com.google.android.material.appbar.AppBarLayout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
android:layout_height="@dimen/layout_padding_100dp">

<com.google.android.material.tabs.TabLayout
android:id="@+id/tabs"
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabGravity="fill"
app:tabIndicatorColor="@color/white"
app:tabMode="fixed"/>
</com.google.android.material.appbar.AppBarLayout>
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/layout_padding_30dp"
android:fontFamily="@font/airbnb_cereal_book"
android:text="@string/accounts"
android:textColor="@color/white"
android:textSize="30sp"
android:textStyle="bold" />

<androidx.viewpager.widget.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
<ImageView
android:id="@+id/iv_apply_for_loan"
android:layout_width="@dimen/layout_padding_30dp"
android:layout_height="@dimen/layout_padding_30dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/layout_padding_30dp"
android:src="@drawable/more_icon"
android:visibility="gone" />

</RelativeLayout>

<com.google.android.material.floatingactionbutton.FloatingActionButton
android:layout_width="wrap_content"
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="@dimen/margin_16dp"
android:clickable="true"
android:visibility="gone"
android:id="@+id/fab_create_loan"
app:layout_behavior="org.mifos.mobile.cn.ui.utils.ScrollFabBehaviour"
app:srcCompat="@drawable/ic_add_white_24dp"/>

</androidx.coordinatorlayout.widget.CoordinatorLayout>
android:layout_marginTop="@dimen/layout_padding_100dp"
android:layout_marginBottom="@dimen/layout_padding_n40dp"
android:backgroundTint="@color/offwhite"
app:cardCornerRadius="@dimen/layout_dimen_40dp">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/layout_padding_25dp"
android:orientation="horizontal">

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true">

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="@dimen/layout_padding_12dp">

<com.google.android.material.button.MaterialButton
android:id="@+id/deposit_toggle_btn"
style="@style/AppTheme.RoundedCornerMaterialButton"
android:layout_width="@dimen/layout_padding_130dp"
android:layout_height="wrap_content"
android:backgroundTint="@color/white"
android:fontFamily="@font/productsans"
android:text="@string/deposit"
android:textAllCaps="false"
android:textColor="@color/foreground_text_btn"
android:textSize="@dimen/text_size_16sp"
app:cornerRadius="@dimen/layout_padding_50dp" />

</LinearLayout>

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/layout_padding_12dp">

<com.google.android.material.button.MaterialButton
android:id="@+id/loan_toggle_btn"
style="@style/AppTheme.RoundedCornerMaterialButton"
android:layout_width="@dimen/layout_padding_130dp"
android:layout_height="wrap_content"
android:backgroundTint="@color/white"
android:fontFamily="@font/productsans"
android:text="@string/loan"
android:textAllCaps="false"
android:textColor="@color/foreground_text_btn"
android:textSize="@dimen/text_size_16sp"
app:cornerRadius="@dimen/layout_padding_50dp" />

</LinearLayout>

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true">

<RelativeLayout
android:layout_width="@dimen/layout_padding_0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingRight="@dimen/layout_padding_12dp">

<com.google.android.material.button.MaterialButton
android:id="@+id/deposit_toggle_focus_btn"
style="@style/AppTheme.RoundedCornerMaterialButton"
android:layout_width="@dimen/layout_padding_130dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:backgroundTint="@color/violet"
android:fontFamily="@font/productsans"
android:text="@string/deposit"
android:textAllCaps="false"
android:textColor="@color/white"
android:textSize="@dimen/text_size_16sp"
app:cornerRadius="@dimen/layout_padding_50dp" />

</RelativeLayout>

<RelativeLayout
android:layout_width="@dimen/layout_padding_0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingLeft="@dimen/layout_padding_12dp">

<com.google.android.material.button.MaterialButton
android:id="@+id/loan_toggle_focus_btn"
style="@style/AppTheme.RoundedCornerMaterialButton"
android:layout_width="@dimen/layout_padding_130dp"
android:layout_height="wrap_content"
android:backgroundTint="@color/violet"
android:fontFamily="@font/productsans"
android:text="@string/loan"
android:textAllCaps="false"
android:textColor="@color/white"
android:textSize="@dimen/text_size_16sp"
android:visibility="gone"
app:cornerRadius="@dimen/layout_padding_50dp" />

</RelativeLayout>

</LinearLayout>

</RelativeLayout>

<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/layout_padding_50dp"
android:backgroundTint="@color/white"
android:visibility="gone">

<com.google.android.material.tabs.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabGravity="fill"
app:tabIndicatorColor="@color/white"
app:tabMode="fixed" />

</com.google.android.material.appbar.AppBarLayout>

<androidx.viewpager.widget.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/layout_padding_100dp"
android:backgroundTint="@color/offwhite"
android:padding="@dimen/layout_padding_10dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />

<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab_create_loan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="@dimen/margin_16dp"
android:clickable="true"
android:visibility="gone"
app:layout_behavior="org.mifos.mobile.cn.ui.utils.ScrollFabBehaviour"
app:srcCompat="@drawable/ic_add_white_24dp" />

</com.google.android.material.card.MaterialCardView>

</androidx.coordinatorlayout.widget.CoordinatorLayout>
3 changes: 1 addition & 2 deletions app/src/main/res/layout/fragment_view_scan_card.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
android:layout_height="match_parent"
android:layout_width="match_parent"
android:scaleType="fitCenter"
android:visibility="visible"
/>
android:visibility="visible" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>
Loading