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

feat: redesign dashboard UI #118

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,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 {
Expand All @@ -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)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ SwipeRefreshLayout.OnRefreshListener{
}

override fun showUserInterface() {
setToolbarTitle("Recent Transactions")
val layoutManager = LinearLayoutManager(activity)
layoutManager.orientation = RecyclerView.VERTICAL
rvRecentTransactions.layoutManager = layoutManager
Expand Down
Binary file added app/src/main/res/drawable/outline_button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions app/src/main/res/drawable/rounded_shape.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<shape

xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">

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

<corners
android:radius="@dimen/layout_padding_30dp">
</corners>

</shape>
75 changes: 75 additions & 0 deletions app/src/main/res/layout/content_fragment_dashboard.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/violet">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/layout_padding_20dp"
android:layout_marginRight="@dimen/layout_padding_20dp">

<ImageView
android:layout_width="@dimen/layout_width_25dp"
android:layout_height="@dimen/layout_height_25dp"
android:layout_alignParentRight="true"
app:srcCompat="@drawable/ic_notifications"/>

</RelativeLayout>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/total_balance"
android:textColor="@color/white"
android:textSize="@dimen/text_size_18sp"
android:layout_marginTop="@dimen/layout_padding_10dp"
android:layout_marginLeft="@dimen/layout_padding_30dp"
android:fontFamily="@font/productsans"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="@dimen/text_size_60sp"
android:text="@string/four_twenty_dollars"
android:textColor="@color/white"
android:layout_marginLeft="@dimen/layout_padding_30dp"
android:layout_marginTop="@dimen/layout_padding_10dp"
android:fontFamily="@font/airbnb_cereal_book"/>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="@dimen/layout_padding_30dp"
android:layout_marginLeft="@dimen/layout_padding_30dp">

<com.google.android.material.button.MaterialButton
android:theme="@style/Theme.MaterialComponents"
android:layout_width="wrap_content"
android:layout_height="@dimen/layout_padding_50dp"
style="@style/AppTheme.RoundedCornerMaterialButton"
android:backgroundTint="@color/white"
app:cornerRadius="@dimen/layout_corner_radius_50dp"
android:text="@string/send"
android:textColor="@color/violet"
android:textAllCaps="false"
android:fontFamily="@font/productsans"/>

<androidx.appcompat.widget.AppCompatButton
android:background="@drawable/outline_button"
android:layout_marginLeft="@dimen/layout_padding_50dp"
style="@style/AppTheme.RoundedCornerOutlinedMaterialButton"
android:layout_width="@dimen/layout_width_105dp"
android:layout_height="@dimen/layout_height_38dp"
app:cornerRadius="@dimen/layout_corner_radius_50dp"
android:text="@string/receive"
android:textColor="@color/white"
android:textAllCaps="false"
android:fontFamily="@font/productsans"/>

</LinearLayout>

</LinearLayout>
Loading