diff --git a/app/src/main/kotlin/org/mifos/mobile/cn/ui/mifos/dashboard/DashboardFragment.kt b/app/src/main/kotlin/org/mifos/mobile/cn/ui/mifos/dashboard/DashboardFragment.kt index 977343ff..38a430e4 100644 --- a/app/src/main/kotlin/org/mifos/mobile/cn/ui/mifos/dashboard/DashboardFragment.kt +++ b/app/src/main/kotlin/org/mifos/mobile/cn/ui/mifos/dashboard/DashboardFragment.kt @@ -1,27 +1,21 @@ package org.mifos.mobile.cn.ui.mifos.dashboard -import android.content.Intent - import android.os.Bundle import android.view.* +import com.google.android.material.bottomsheet.BottomSheetBehavior import kotlinx.android.synthetic.main.fragment_dashboard.* import org.mifos.mobile.cn.data.models.customer.Customer import org.mifos.mobile.cn.R -import org.mifos.mobile.cn.enums.AccountType -import org.mifos.mobile.cn.ui.base.MifosBaseActivity import org.mifos.mobile.cn.ui.base.MifosBaseFragment -import org.mifos.mobile.cn.ui.mifos.customerAccounts.CustomerAccountFragment -import org.mifos.mobile.cn.ui.mifos.customerDetails.CustomerDetailsActivity -import org.mifos.mobile.cn.ui.mifos.loanApplication.loanActivity.LoanApplicationActivity import org.mifos.mobile.cn.ui.mifos.recentTransactions.RecentTransactionsFragment -import org.mifos.mobile.cn.ui.utils.ConstantKeys class DashboardFragment : MifosBaseFragment(), View.OnClickListener { private lateinit var rootView: View private lateinit var customer: Customer + private lateinit var sheetBehavior: BottomSheetBehavior<*> companion object { fun newInstance(): DashboardFragment { @@ -32,67 +26,51 @@ class DashboardFragment : MifosBaseFragment(), View.OnClickListener { } } - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { rootView = inflater.inflate(R.layout.fragment_dashboard, container, false) setHasOptionsMenu(true) setToolbarTitle(getString(R.string.home)) + val ft = childFragmentManager.beginTransaction() + val rt = RecentTransactionsFragment() + ft.replace(R.id.fl_recentTransactions, rt) + ft.addToBackStack(null) + ft.commit() return rootView } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - ll_apply_for_loan.setOnClickListener(this) - ll_accounts.setOnClickListener(this) - ll_account_overview.setOnClickListener(this) - ll_recent_transactions.setOnClickListener(this) - } + sheetBehavior = BottomSheetBehavior.from(rt_bottom_sheet) + sheetBehavior.setBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() { + override fun onStateChanged(bottomSheet: View, newState: Int) { + // React to state change + when (newState) { + BottomSheetBehavior.STATE_HIDDEN -> { + } + BottomSheetBehavior.STATE_EXPANDED -> { + } + BottomSheetBehavior.STATE_COLLAPSED -> { + } + BottomSheetBehavior.STATE_HALF_EXPANDED -> { + } + BottomSheetBehavior.STATE_DRAGGING -> { + } + BottomSheetBehavior.STATE_SETTLING -> { + } + } + } - override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { - inflater.inflate(R.menu.menu_main, menu) - super.onCreateOptionsMenu(menu, inflater) + override fun onSlide(bottomSheet: View, slideOffset: Float) { + // React to dragging events + } + }) } override fun onClick(view: View) { when (view.id) { - R.id.ll_apply_for_loan -> { - applyForLoan() - } - R.id.ll_accounts -> { - openAccount() - } - R.id.ll_account_overview -> { - showCustomerDetails() - } - R.id.ll_recent_transactions -> { - showRecentTransactions() - } } } - private fun applyForLoan() { - val intent = Intent(activity, LoanApplicationActivity::class.java) - intent.putExtra(ConstantKeys.CUSTOMER_IDENTIFIER, "customer_identifier") - startActivity(intent) - } - - private fun openAccount() { - (activity as MifosBaseActivity) - .replaceFragment(CustomerAccountFragment.newInstance(AccountType.DEPOSIT), - true, R.id.container) - } - private fun showCustomerDetails(){ - val intent = Intent(activity,CustomerDetailsActivity::class.java) - intent.putExtra(ConstantKeys.CUSTOMER_IDENTIFIER,"customer_identifier") - startActivity(intent) - - - } - private fun showRecentTransactions(){ - (activity as MifosBaseActivity) - .replaceFragment(RecentTransactionsFragment.Companion.newInstance(), - true,R.id.container) - } -} \ No newline at end of file +} diff --git a/app/src/main/kotlin/org/mifos/mobile/cn/ui/mifos/recentTransactions/RecentTransactionsFragment.kt b/app/src/main/kotlin/org/mifos/mobile/cn/ui/mifos/recentTransactions/RecentTransactionsFragment.kt index 743a3db2..981e9fb9 100644 --- a/app/src/main/kotlin/org/mifos/mobile/cn/ui/mifos/recentTransactions/RecentTransactionsFragment.kt +++ b/app/src/main/kotlin/org/mifos/mobile/cn/ui/mifos/recentTransactions/RecentTransactionsFragment.kt @@ -62,7 +62,6 @@ SwipeRefreshLayout.OnRefreshListener{ } override fun showUserInterface() { - setToolbarTitle("Recent Transactions") val layoutManager = LinearLayoutManager(activity) layoutManager.orientation = RecyclerView.VERTICAL rvRecentTransactions.layoutManager = layoutManager diff --git a/app/src/main/res/drawable/outline_button.png b/app/src/main/res/drawable/outline_button.png new file mode 100644 index 00000000..958105dc Binary files /dev/null and b/app/src/main/res/drawable/outline_button.png differ diff --git a/app/src/main/res/drawable/rounded_shape.xml b/app/src/main/res/drawable/rounded_shape.xml new file mode 100644 index 00000000..77fa991b --- /dev/null +++ b/app/src/main/res/drawable/rounded_shape.xml @@ -0,0 +1,14 @@ + + + + + + + + + diff --git a/app/src/main/res/layout/content_fragment_dashboard.xml b/app/src/main/res/layout/content_fragment_dashboard.xml new file mode 100644 index 00000000..148f7fb9 --- /dev/null +++ b/app/src/main/res/layout/content_fragment_dashboard.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/fragment_dashboard.xml b/app/src/main/res/layout/fragment_dashboard.xml index f3fd880e..3531dd34 100644 --- a/app/src/main/res/layout/fragment_dashboard.xml +++ b/app/src/main/res/layout/fragment_dashboard.xml @@ -1,573 +1,126 @@ - - - - - + + + + + + + android:layout_height="match_parent" + android:layout_alignParentBottom="true" + app:cardCornerRadius="@dimen/layout_corner_radius_50dp" + android:layout_marginBottom="@dimen/layout_padding_negative_50dp" + android:backgroundTint="@color/offwhite"> + android:layout_marginLeft="@dimen/layout_padding_30dp" + android:layout_marginRight="@dimen/layout_padding_30dp" + android:layout_marginTop="@dimen/layout_padding_30dp" > - - - - - - - - - + android:layout_height="wrap_content" + android:text="@string/recent_transactions" + android:textSize="@dimen/text_size_25sp" + android:fontFamily="@font/airbnb_cereal_book" + android:textStyle="bold"/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:orientation="horizontal" + android:layout_marginTop="@dimen/layout_padding_10dp"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:layout_height="wrap_content"> - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - + android:layout_height="wrap_content"> - - - - - - - - - - - - - - - - - - - - - - - - - - - + style="@style/AppTheme.RoundedCornerMaterialButton" + app:cornerRadius="@dimen/layout_corner_radius_50dp" + android:text="@string/third_party" + android:textAllCaps="false" + android:backgroundTint="@color/white" + android:textColor="@color/violet" + android:layout_centerInParent="true" + android:fontFamily="@font/productsans"/> + + + + - - - + style="@style/AppTheme.RoundedCornerMaterialButton" + app:cornerRadius="@dimen/layout_corner_radius_50dp" + android:text="@string/self" + android:textAllCaps="false" + android:backgroundTint="@color/white" + android:textColor="@color/violet" + android:layout_centerInParent="true" + android:fontFamily="@font/productsans"/> - - - - - - - - - + - - - - - - - - - - - - - + - + - + - + diff --git a/app/src/main/res/layout/item_recent_transactions.xml b/app/src/main/res/layout/item_recent_transactions.xml index ae5d32af..efaece13 100644 --- a/app/src/main/res/layout/item_recent_transactions.xml +++ b/app/src/main/res/layout/item_recent_transactions.xml @@ -9,35 +9,33 @@ android:foreground="?android:attr/selectableItemBackground" android:orientation="vertical"> - - - + android:layout_height="@dimen/layout_padding_75dp" + android:orientation="horizontal" + app:cardCornerRadius="@dimen/layout_corner_radius_10dp" + android:layout_marginBottom="@dimen/layout_padding_10dp"> + android:paddingTop="@dimen/layout_padding_16dp" + android:paddingLeft="@dimen/layout_padding_24dp" + android:paddingStart="@dimen/layout_padding_24dp" + android:paddingRight="@dimen/layout_padding_24dp" + android:paddingEnd="@dimen/layout_padding_24dp"> + tools:text="CREDIT" + android:textSize="@dimen/text_size_20sp" + android:fontFamily="@font/productsans"/> + tools:text="2018-06-13T09:37:11.508Z" + android:visibility="gone"/> + tools:text="Message 0" + android:fontFamily="@font/productsans"/> - - + - + android:textSize="@dimen/text_size_30sp" + tools:text="@string/four_twenty_dollars" + android:layout_alignParentRight="true" + android:layout_marginRight="@dimen/layout_padding_24dp" + android:textStyle="bold" + android:textColor="@color/violet" + android:layout_centerInParent="true" + android:fontFamily="@font/airbnb_cereal_book"/> + + + android:paddingTop="@dimen/layout_padding_24dp" + android:visibility="gone"> - - - + - \ No newline at end of file + diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml index de968d86..a7f53ddc 100644 --- a/app/src/main/res/menu/menu_main.xml +++ b/app/src/main/res/menu/menu_main.xml @@ -2,8 +2,4 @@ - - \ No newline at end of file + diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index bf778ce8..8c21cca0 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -1,5 +1,7 @@ + -50dp + 0dp 2dp 4dp 8dp @@ -8,11 +10,13 @@ 10dp 15dp 16dp + 20dp 24dp 30dp 50dp 64dp 75dp + 16dp 16dp @@ -28,6 +32,9 @@ 16sp 18sp 20sp + 25sp + 30sp + 60sp 24sp 20sp @@ -49,4 +56,15 @@ 1dp 48dp + + 10dp + 50dp + + 25dp + 105dp + + 25dp + 38dp + 350dp + 450dp \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index fd45a34e..f55719b1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -34,6 +34,13 @@ Home Are you sure you want to logout? Cancel + Total Balance + $420 + Send + Receive + All + Third Party + Self diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 2e27cfe8..6200081f 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -68,5 +68,11 @@ @dimen/layout_padding_7dp + +