@@ -5,6 +5,7 @@ import android.content.Intent
5
5
6
6
import android.os.Bundle
7
7
import android.view.*
8
+ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
8
9
import kotlinx.android.synthetic.main.fragment_dashboard.*
9
10
import org.mifos.mobile.cn.data.models.customer.Customer
10
11
import org.mifos.mobile.cn.R
@@ -18,10 +19,11 @@ import org.mifos.mobile.cn.ui.mifos.recentTransactions.RecentTransactionsFragmen
18
19
import org.mifos.mobile.cn.ui.utils.ConstantKeys
19
20
20
21
21
- class DashboardFragment : MifosBaseFragment (), View.OnClickListener {
22
+ class DashboardFragment : MifosBaseFragment (), View.OnClickListener, SwipeRefreshLayout.OnRefreshListener {
22
23
23
24
private lateinit var rootView: View
24
25
private lateinit var customer: Customer
26
+
25
27
companion object {
26
28
27
29
fun newInstance (): DashboardFragment {
@@ -47,13 +49,19 @@ class DashboardFragment : MifosBaseFragment(), View.OnClickListener {
47
49
ll_accounts.setOnClickListener(this )
48
50
ll_account_overview.setOnClickListener(this )
49
51
ll_recent_transactions.setOnClickListener(this )
52
+ swipe_home_container.setOnRefreshListener(this )
50
53
}
51
54
52
55
override fun onCreateOptionsMenu (menu : Menu , inflater : MenuInflater ) {
53
56
inflater.inflate(R .menu.menu_main, menu)
54
57
super .onCreateOptionsMenu(menu, inflater)
55
58
}
56
59
60
+ override fun onResume () {
61
+ super .onResume()
62
+ this .onCreate(null )
63
+ }
64
+
57
65
override fun onClick (view : View ) {
58
66
59
67
when (view.id) {
@@ -81,18 +89,25 @@ class DashboardFragment : MifosBaseFragment(), View.OnClickListener {
81
89
private fun openAccount () {
82
90
(activity as MifosBaseActivity )
83
91
.replaceFragment(CustomerAccountFragment .newInstance(AccountType .DEPOSIT ),
84
- true , R .id.container)
92
+ true , R .id.container)
85
93
}
86
- private fun showCustomerDetails (){
87
- val intent = Intent (activity,CustomerDetailsActivity ::class .java)
88
- intent.putExtra(ConstantKeys .CUSTOMER_IDENTIFIER ," customer_identifier" )
89
- startActivity(intent)
94
+
95
+ private fun showCustomerDetails () {
96
+ val intent = Intent (activity, CustomerDetailsActivity ::class .java)
97
+ intent.putExtra(ConstantKeys .CUSTOMER_IDENTIFIER , " customer_identifier" )
98
+ startActivity(intent)
90
99
91
100
92
101
}
93
- private fun showRecentTransactions (){
102
+
103
+ private fun showRecentTransactions () {
94
104
(activity as MifosBaseActivity )
95
105
.replaceFragment(RecentTransactionsFragment .Companion .newInstance(),
96
- true ,R .id.container)
106
+ true , R .id.container)
107
+ }
108
+
109
+ override fun onRefresh () {
110
+ this .onResume()
111
+ swipe_home_container.isRefreshing = false
97
112
}
98
113
}
0 commit comments