Skip to content

Commit

Permalink
Merge pull request openMF#133 from ashwinkey04/swiperefresh
Browse files Browse the repository at this point in the history
Add functionality to SwipeRefreshLayout
  • Loading branch information
abhijitramesh authored Jun 11, 2020
2 parents fe4caf6 + 926273f commit a37095f
Showing 1 changed file with 23 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.content.Intent

import android.os.Bundle
import android.view.*
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import kotlinx.android.synthetic.main.fragment_dashboard.*
import org.mifos.mobile.cn.data.models.customer.Customer
import org.mifos.mobile.cn.R
Expand All @@ -18,10 +19,11 @@ import org.mifos.mobile.cn.ui.mifos.recentTransactions.RecentTransactionsFragmen
import org.mifos.mobile.cn.ui.utils.ConstantKeys


class DashboardFragment : MifosBaseFragment(), View.OnClickListener {
class DashboardFragment : MifosBaseFragment(), View.OnClickListener, SwipeRefreshLayout.OnRefreshListener {

private lateinit var rootView: View
private lateinit var customer: Customer

companion object {

fun newInstance(): DashboardFragment {
Expand All @@ -47,13 +49,19 @@ class DashboardFragment : MifosBaseFragment(), View.OnClickListener {
ll_accounts.setOnClickListener(this)
ll_account_overview.setOnClickListener(this)
ll_recent_transactions.setOnClickListener(this)
swipe_home_container.setOnRefreshListener(this)
}

override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
inflater.inflate(R.menu.menu_main, menu)
super.onCreateOptionsMenu(menu, inflater)
}

override fun onResume() {
super.onResume()
this.onCreate(null)
}

override fun onClick(view: View) {

when (view.id) {
Expand Down Expand Up @@ -81,18 +89,25 @@ class DashboardFragment : MifosBaseFragment(), View.OnClickListener {
private fun openAccount() {
(activity as MifosBaseActivity)
.replaceFragment(CustomerAccountFragment.newInstance(AccountType.DEPOSIT),
true, R.id.container)
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 showCustomerDetails() {
val intent = Intent(activity, CustomerDetailsActivity::class.java)
intent.putExtra(ConstantKeys.CUSTOMER_IDENTIFIER, "customer_identifier")
startActivity(intent)


}
private fun showRecentTransactions(){

private fun showRecentTransactions() {
(activity as MifosBaseActivity)
.replaceFragment(RecentTransactionsFragment.Companion.newInstance(),
true,R.id.container)
true, R.id.container)
}

override fun onRefresh() {
this.onResume()
swipe_home_container.isRefreshing = false
}
}

0 comments on commit a37095f

Please sign in to comment.