diff --git a/mifosng-android/src/main/AndroidManifest.xml b/mifosng-android/src/main/AndroidManifest.xml
index b237dc6294e..0175bcfacca 100755
--- a/mifosng-android/src/main/AndroidManifest.xml
+++ b/mifosng-android/src/main/AndroidManifest.xml
@@ -3,14 +3,6 @@
xmlns:tools="http://schemas.android.com/tools">
-
-
-
-
-
-
-
-
@@ -25,7 +17,7 @@
android:label="@string/app_name"
android:supportsRtl="true"
android:windowSoftInputMode="adjustResize"
- android:theme="@style/MaterialAppTheme">
+ android:theme="@style/Theme.AndroidClientTheme">
-
-
-
-
-
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/application/App.kt b/mifosng-android/src/main/java/com/mifos/application/App.kt
index 2c1fd54a6e2..80f744ea72f 100644
--- a/mifosng-android/src/main/java/com/mifos/application/App.kt
+++ b/mifosng-android/src/main/java/com/mifos/application/App.kt
@@ -14,7 +14,7 @@ import com.evernote.android.job.JobManager
import com.facebook.stetho.Stetho
import com.joanzapata.iconify.Iconify
import com.joanzapata.iconify.fonts.MaterialModule
-import com.mifos.utils.LanguageHelper.onAttach
+import com.mifos.core.common.utils.LanguageHelper.onAttach
import com.mifos.utils.ThemeHelper
import com.raizlabs.android.dbflow.config.FlowConfig
import com.raizlabs.android.dbflow.config.FlowManager
@@ -27,13 +27,8 @@ import dagger.hilt.android.HiltAndroidApp
class App : MultiDexApplication() {
override fun onCreate() {
super.onCreate()
- val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this)
- val themePref = sharedPreferences.getString("dark_mode", ThemeHelper.DEFAULT_MODE)
- if (themePref != null) {
- ThemeHelper.applyTheme(themePref)
- }
+
instance = this
- Iconify.with(MaterialModule())
// JobManager.create(this).addJobCreator(OfflineJobCreator())
//Initializing the DBFlow and SQL Cipher Encryption
FlowManager.init(FlowConfig.Builder(this).build())
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/activity/home/HomeActivity.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/activity/home/HomeActivity.kt
deleted file mode 100644
index b2b8eebde50..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/activity/home/HomeActivity.kt
+++ /dev/null
@@ -1,206 +0,0 @@
-package com.mifos.mifosxdroid.activity.home
-
-import android.os.Bundle
-import android.view.Menu
-import android.view.MenuItem
-import android.view.View
-import android.widget.Toast
-import androidx.activity.OnBackPressedCallback
-import androidx.annotation.VisibleForTesting
-import androidx.appcompat.app.ActionBarDrawerToggle
-import androidx.appcompat.widget.SwitchCompat
-import androidx.core.view.GravityCompat
-import androidx.navigation.findNavController
-import androidx.navigation.ui.AppBarConfiguration
-import androidx.navigation.ui.setupWithNavController
-import androidx.test.espresso.IdlingResource
-import com.google.android.material.navigation.NavigationView
-import com.mifos.mifosxdroid.R
-import com.mifos.mifosxdroid.core.MifosBaseActivity
-import com.mifos.mifosxdroid.databinding.ActivityHomeBinding
-import com.mifos.mifosxdroid.databinding.ViewNavDrawerHeaderBinding
-import com.mifos.utils.Constants
-import com.mifos.utils.EspressoIdlingResource
-import com.mifos.utils.PrefManager
-import dagger.hilt.android.AndroidEntryPoint
-
-/**
- * Created by shashankpriyadarshi on 19/06/20.
- */
-@AndroidEntryPoint
-open class HomeActivity : MifosBaseActivity(), NavigationView.OnNavigationItemSelectedListener {
-
- private lateinit var binding: ActivityHomeBinding
- private lateinit var navHeaderBinding: ViewNavDrawerHeaderBinding
-
- private lateinit var menu: Menu
- private lateinit var userStatusToggle: SwitchCompat
- private var doubleBackToExitPressedOnce = false
- private lateinit var appBarConfiguration: AppBarConfiguration
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- binding = ActivityHomeBinding.inflate(layoutInflater)
- setContentView(binding.root)
- setSupportActionBar(toolbar)
- appBarConfiguration = AppBarConfiguration.Builder()
- .setDrawerLayout(binding.drawer)
- .build()
-
- setupNavigationBar()
-
- onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) {
- override fun handleOnBackPressed() {
- if (binding.drawer.isDrawerOpen(GravityCompat.START)) {
- binding.drawer.closeDrawer(GravityCompat.START)
- } else if (binding.navView.selectedItemId == R.id.navigation_dashboard) {
- doubleBackToExit()
- }
- supportFragmentManager.popBackStackImmediate()
- }
- })
- }
-
- override fun onStart() {
- super.onStart()
- binding.navView.setupWithNavController(binding.navHostFragment.findNavController())
- }
-
- override fun onNavigationItemSelected(item: MenuItem): Boolean {
- // ignore the current selected item
- /*if (item.isChecked()) {
- mDrawerLayout.closeDrawer(Gravity.LEFT);
- return false;
- }*/
- clearFragmentBackStack()
- when (item.itemId) {
-
- R.id.individual_collection_sheet -> {
- val bundle = Bundle()
- bundle.putString(Constants.COLLECTION_TYPE, Constants.EXTRA_COLLECTION_INDIVIDUAL)
-// findNavController(R.id.nav_host_fragment).navigate(
-// R.id.generateCollectionSheetActivity,
-// bundle
-// )
- }
-
- R.id.collection_sheet -> {
- val bundle = Bundle()
- bundle.putString(
- Constants.COLLECTION_TYPE,
- Constants.EXTRA_COLLECTION_COLLECTION
- )
-// findNavController(R.id.nav_host_fragment).navigate(
-// R.id.generateCollectionSheetActivity,
-// bundle
-// )
- }
-
- R.id.item_settings -> {
- findNavController(R.id.nav_host_fragment).navigate(R.id.settingsActivity)
- }
-
- R.id.runreport -> {
-// findNavController(R.id.nav_host_fragment).navigate(R.id.runReportsActivity)
- }
- }
- binding.drawer.closeDrawer(GravityCompat.START)
- return false
- }
-
- /**
- * This SwitchCompat Toggle Handling the User Status.
- * Setting the User Status to Offline or Online
- */
- private fun setupUserStatusToggle(headerView: View) {
- navHeaderBinding = ViewNavDrawerHeaderBinding.bind(headerView)
- userStatusToggle = navHeaderBinding.userStatusToggle
-
- if (PrefManager.userStatus == Constants.USER_OFFLINE) {
- userStatusToggle.isChecked = true
- }
- userStatusToggle.setOnClickListener {
- if (PrefManager.userStatus == Constants.USER_OFFLINE) {
- PrefManager.userStatus = Constants.USER_ONLINE
- userStatusToggle.isChecked = false
- } else {
- PrefManager.userStatus = Constants.USER_OFFLINE
- userStatusToggle.isChecked = true
- }
- }
- }
-
- /**
- * downloads the logged in user's username
- * sets dummy profile picture as no profile picture attribute available
- */
- private fun loadClientDetails() {
- // download logged in user
- val loggedInUser = PrefManager.getUser()
- navHeaderBinding.tvUserName.text = loggedInUser.username
- navHeaderBinding.ivUserPicture.setImageResource(R.drawable.ic_dp_placeholder)
- }
-
- @get:VisibleForTesting
- val countingIdlingResource: IdlingResource
- get() = EspressoIdlingResource.idlingResource
-
- private fun setupNavigationBar() {
-// mNavigationHeader = binding.navigationView.getHeaderView(0)
- binding.navigationView.getHeaderView(0)?.let { setupUserStatusToggle(it) }
-
-
- binding.navigationView.setNavigationItemSelectedListener(this as NavigationView.OnNavigationItemSelectedListener)
-
- // setup drawer layout and sync to toolbar
- val actionBarDrawerToggle: ActionBarDrawerToggle = object : ActionBarDrawerToggle(
- this,
- binding.drawer, toolbar, R.string.open_drawer, R.string.close_drawer
- ) {
-
- override fun onDrawerOpened(drawerView: View) {
- super.onDrawerOpened(drawerView)
- setUserStatus(userStatusToggle)
- hideKeyboard(binding.drawer)
- }
-
- override fun onDrawerSlide(drawerView: View, slideOffset: Float) {
- if (slideOffset != 0f) super.onDrawerSlide(drawerView, slideOffset)
- }
- }
- binding.drawer.addDrawerListener(actionBarDrawerToggle)
- actionBarDrawerToggle.syncState()
-
- // make an API call to fetch logged in client's details
- loadClientDetails()
- }
-
- override fun onCreateOptionsMenu(menu: Menu): Boolean {
- this.menu = menu
- menuInflater.inflate(R.menu.menu_main, menu)
- return super.onCreateOptionsMenu(menu)
- }
-
- override fun onOptionsItemSelected(item: MenuItem): Boolean {
- if (item.itemId == R.id.logout) {
- logout()
- }
- return super.onOptionsItemSelected(item)
- }
-
- private fun doubleBackToExit() {
-
- if (doubleBackToExitPressedOnce) {
- finish()
- } else {
- doubleBackToExitPressedOnce = true
- Toast.makeText(
- this@HomeActivity,
- R.string.back_again,
- Toast.LENGTH_SHORT
- ).show()
- // Reset the flag after a short delay
- window.decorView.postDelayed({ doubleBackToExitPressedOnce = false }, 2000)
- }
- }
-}
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/activity/login/LoginActivity.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/activity/login/LoginActivity.kt
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/activity/setting/SettingsActivity.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/activity/setting/SettingsActivity.kt
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/activity/setting/SettingsFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/activity/setting/SettingsFragment.kt
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/ChargeNameListAdapter.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/ChargeNameListAdapter.kt
deleted file mode 100644
index ba296d32afb..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/ChargeNameListAdapter.kt
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.mifos.mifosxdroid.adapters
-
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import android.widget.TextView
-import androidx.recyclerview.widget.RecyclerView
-import com.mifos.core.objects.client.Charges
-import com.mifos.mifosxdroid.R
-
-
-class ChargeNameListAdapter(
- var pageItems: List,
- var clientId: Int
-) : RecyclerView.Adapter() {
-
- fun getItem(position: Int) = pageItems[position]
-
-
- override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
- val viewHolder = ViewHolder(
- LayoutInflater.from(parent.context)
- .inflate(R.layout.row_charge_name, parent, false)
- )
- return viewHolder
- }
-
- override fun onBindViewHolder(holder: ViewHolder, position: Int) {
- holder.tv_charger_id.text = pageItems[position].chargeId.toString()
- holder.tv_charge_Name.text = pageItems[position].name
- holder.tv_charge_amount.text = pageItems[position].amount.toString()
- holder.tv_charge_duedate.text = pageItems[position].formattedDueDate
- }
-
- override fun getItemId(i: Int) = 0L
-
- override fun getItemCount() = pageItems.size
-
-
- class ViewHolder(v: View) : RecyclerView.ViewHolder(v) {
- val tv_charger_id: TextView = v.findViewById(R.id.tv_charger_id)
- val tv_charge_Name: TextView = v.findViewById(R.id.tv_chargeName)
- val tv_charge_amount: TextView = v.findViewById(R.id.tv_charge_amount)
- val tv_charge_duedate: TextView = v.findViewById(R.id.tv_charge_duedate)
- }
-}
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/FragmentAdapter.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/FragmentAdapter.kt
deleted file mode 100644
index 8577bd551a8..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/FragmentAdapter.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * This project is licensed under the open source MPL V2.
- * See https://github.com/openMF/android-client/blob/master/LICENSE.md
- */
-package com.mifos.mifosxdroid.adapters
-
-import androidx.fragment.app.Fragment
-import androidx.fragment.app.FragmentManager
-import androidx.fragment.app.FragmentPagerAdapter
-
-/**
- * Created by ishankhanna on 11/03/14.
- */
-class FragmentAdapter(fm: FragmentManager?, var fragmentList: List) :
- FragmentPagerAdapter(
- fm!!
- ) {
- override fun getItem(position: Int): Fragment {
- return fragmentList[position]
- }
-
- override fun getCount(): Int {
- return fragmentList.size
- }
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/IdentifierListAdapter.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/IdentifierListAdapter.kt
deleted file mode 100644
index 032426f7d24..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/IdentifierListAdapter.kt
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * This project is licensed under the open source MPL V2.
- * See https://github.com/openMF/android-client/blob/master/LICENSE.md
- */
-package com.mifos.mifosxdroid.adapters
-
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import androidx.recyclerview.widget.RecyclerView
-import com.mifos.application.App.Companion.context
-import com.mifos.core.objects.noncore.Identifier
-import com.mifos.mifosxdroid.R
-import com.mifos.mifosxdroid.databinding.RowIdentifierListBinding
-import javax.inject.Inject
-
-/**
- * Created by ishankhanna on 03/07/14.
- */
-class IdentifierListAdapter @Inject constructor() :
- RecyclerView.Adapter() {
- private var identifiers: List
- private var identifierOptionsListener: IdentifierOptionsListener? = null
-
- init {
- identifiers = ArrayList()
- }
-
- override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
- val view = LayoutInflater.from(parent.context)
- .inflate(R.layout.row_identifier_list, parent, false)
- return ViewHolder(
- RowIdentifierListBinding.inflate(
- LayoutInflater.from(parent.context),
- parent,
- false
- )
- )
- }
-
- override fun onBindViewHolder(holder: ViewHolder, position: Int) {
- val identifier = identifiers[position]
- holder.binding.tvIdentifierId.text = identifier.documentKey.toString()
- var description = identifier.description
- if (description == null) {
- description = "-"
- }
- holder.binding.tvIdentifierDescription.text = description
- holder.binding.tvIdentifierType.text = identifier.documentType?.name
- val color: Int = if (identifier.status?.contains("inactive") == true) {
- context!!.getColor(R.color.red_light)
- } else {
- context!!.getColor(R.color.green_light)
- }
- holder.binding.vStatus.setBackgroundColor(color)
- }
-
- fun setIdentifiers(identifiers: List) {
- this.identifiers = identifiers
- notifyDataSetChanged()
- }
-
- fun setIdentifierOptionsListener(identifierOptionsListener: IdentifierOptionsListener?) {
- this.identifierOptionsListener = identifierOptionsListener
- }
-
- override fun getItemId(i: Int): Long {
- return 0
- }
-
- override fun getItemCount(): Int {
- return identifiers.size
- }
-
- inner class ViewHolder(val binding: RowIdentifierListBinding) :
- RecyclerView.ViewHolder(binding.root), View.OnClickListener {
- init {
- binding.ivIdentifierOptions.setOnClickListener(this)
- }
-
- override fun onClick(v: View) {
- identifierOptionsListener?.onClickIdentifierOptions(adapterPosition, v)
- }
- }
-
- interface IdentifierOptionsListener {
- fun onClickIdentifierOptions(position: Int, view: View)
- }
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/LoanAccountsListAdapter.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/LoanAccountsListAdapter.kt
deleted file mode 100644
index 29961545f54..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/LoanAccountsListAdapter.kt
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * This project is licensed under the open source MPL V2.
- * See https://github.com/openMF/android-client/blob/master/LICENSE.md
- */
-package com.mifos.mifosxdroid.adapters
-
-import android.content.Context
-import android.text.TextUtils
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import android.widget.BaseAdapter
-import androidx.core.content.ContextCompat
-import com.mifos.core.objects.accounts.loan.LoanAccount
-import com.mifos.mifosxdroid.R
-import com.mifos.mifosxdroid.databinding.RowAccountItemBinding
-
-/**
- * Created by ishankhanna on 01/03/14.
- */
-class LoanAccountsListAdapter(
- private val context: Context,
- private val loanAccountList: List
-) : BaseAdapter() {
-
- private val layoutInflater: LayoutInflater = LayoutInflater.from(context)
-
- override fun getCount(): Int {
- return loanAccountList.size
- }
-
- override fun getItem(i: Int): LoanAccount {
- return loanAccountList[i]
- }
-
- override fun getItemId(i: Int): Long {
- return 0
- }
-
- override fun getView(i: Int, view: View?, viewGroup: ViewGroup): View {
- val binding: RowAccountItemBinding
- val convertView: View
- if (view == null) {
- binding = RowAccountItemBinding.inflate(layoutInflater, viewGroup, false)
- convertView = binding.root
- convertView.tag = binding
- } else {
- binding = view.tag as RowAccountItemBinding
- convertView = view
- }
-
- val loanAccount = loanAccountList[i]
-
- if (loanAccount.status?.active == true) {
- binding.viewStatusIndicator.setBackgroundColor(
- ContextCompat.getColor(context, R.color.loan_status_disbursed)
- )
- } else if (loanAccount.status?.waitingForDisbursal == true) {
- binding.viewStatusIndicator.setBackgroundColor(
- ContextCompat.getColor(context, R.color.status_approved)
- )
- } else if (loanAccount.status?.pendingApproval == true) {
- binding.viewStatusIndicator.setBackgroundColor(
- ContextCompat.getColor(
- context,
- R.color.status_submitted_and_pending_approval
- )
- )
- } else if (loanAccount.status?.active == true && loanAccount.inArrears == true) {
- binding.viewStatusIndicator.setBackgroundColor(
- ContextCompat.getColor(context, R.color.red)
- )
- } else {
- binding.viewStatusIndicator.setBackgroundColor(
- ContextCompat.getColor(context, R.color.status_closed)
- )
- }
-
- // TODO: Change getProductName to Loan Amount Due
- binding.tvAmount.text = loanAccount.productName
- binding.tvAmount.ellipsize = TextUtils.TruncateAt.END
- binding.tvAccountNumber.text = loanAccount.accountNo
-
- return convertView
- }
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/LoanListAdapter.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/LoanListAdapter.kt
deleted file mode 100644
index e112b32ac29..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/LoanListAdapter.kt
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * This project is licensed under the open source MPL V2.
- * See https://github.com/openMF/android-client/blob/master/LICENSE.md
- */
-package com.mifos.mifosxdroid.adapters
-
-import android.content.Context
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import android.widget.BaseAdapter
-import com.mifos.core.objects.db.Loan
-import com.mifos.mifosxdroid.databinding.RowLoanListItemBinding
-
-class LoanListAdapter(context: Context?, listLoans: List) : BaseAdapter() {
- private val layoutInflater: LayoutInflater
- private val listLoans: List
-
- init {
- layoutInflater = LayoutInflater.from(context)
- this.listLoans = listLoans
- }
-
- override fun getCount(): Int {
- return listLoans.size
- }
-
- override fun getItem(i: Int): Loan {
- return listLoans[i]
- }
-
- override fun getItemId(i: Int): Long {
- return 0
- }
-
- override fun getView(i: Int, view: View?, viewGroup: ViewGroup): View {
- val binding: RowLoanListItemBinding
- val convertView: View
- if (view == null) {
- binding = RowLoanListItemBinding.inflate(layoutInflater, viewGroup, false)
- convertView = binding.root
- convertView.tag = binding
- } else {
- binding = view.tag as RowLoanListItemBinding
- convertView = view
- }
- val loan = listLoans[i]
- binding.tvLoanAccountId.text = loan.loanId.toString()
- return convertView
- }
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/LoanRepaymentScheduleAdapter.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/LoanRepaymentScheduleAdapter.kt
deleted file mode 100644
index 6a93a331602..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/LoanRepaymentScheduleAdapter.kt
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * This project is licensed under the open source MPL V2.
- * See https://github.com/openMF/android-client/blob/master/LICENSE.md
- */
-package com.mifos.mifosxdroid.adapters
-
-import android.content.Context
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import android.widget.BaseAdapter
-import androidx.core.content.ContextCompat
-import com.mifos.core.objects.accounts.loan.Period
-import com.mifos.mifosxdroid.R
-import com.mifos.mifosxdroid.databinding.RowLoanRepaymentScheduleBinding
-import com.mifos.utils.DateHelper.getDateAsString
-
-/**
- * Created by ishankhanna on 19/06/14.
- */
-class LoanRepaymentScheduleAdapter(
- private val context: Context,
- private val periodList: List
-) : BaseAdapter() {
-
- override fun getCount(): Int {
- return periodList.size
- }
-
- override fun getItem(i: Int): Any? {
- return null
- }
-
- override fun getItemId(i: Int): Long {
- return 0
- }
-
- override fun getView(i: Int, view: View?, viewGroup: ViewGroup): View {
- val viewHolder: ReusableViewHolder
- val binding: RowLoanRepaymentScheduleBinding
-
- if (view == null) {
- binding = RowLoanRepaymentScheduleBinding.inflate(
- LayoutInflater.from(context),
- viewGroup,
- false
- )
- viewHolder = ReusableViewHolder(binding)
- binding.root.tag = viewHolder
- } else {
- binding = RowLoanRepaymentScheduleBinding.bind(view)
- viewHolder = view.tag as ReusableViewHolder
- }
-
- val period = periodList[i]
- viewHolder.binding.tvRepaymentDueDate.text = period.dueDate?.let { getDateAsString(it) }
- viewHolder.binding.tvRepaymentAmountDue.text = period.totalDueForPeriod.toString()
- viewHolder.binding.tvRepaymentAmountPaid.text = period.totalPaidForPeriod.toString()
-
- when {
- period.complete != null && period.complete!! -> {
- viewHolder.binding.viewStatusIndicator.setBackgroundColor(
- ContextCompat.getColor(
- context,
- R.color.light_green
- )
- )
- }
-
- period.totalOverdue != null && period.totalOverdue!! > 0 -> {
- viewHolder.binding.viewStatusIndicator.setBackgroundColor(
- ContextCompat.getColor(
- context,
- R.color.light_red
- )
- )
- }
-
- else -> {
- viewHolder.binding.viewStatusIndicator.setBackgroundColor(
- ContextCompat.getColor(
- context,
- R.color.light_blue
- )
- )
- }
- }
-
- return binding.root
- }
-
- class ReusableViewHolder(val binding: RowLoanRepaymentScheduleBinding)
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/LoanTransactionAdapter.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/LoanTransactionAdapter.kt
deleted file mode 100644
index 2108b6fe145..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/LoanTransactionAdapter.kt
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * This project is licensed under the open source MPL V2.
- * See https://github.com/openMF/android-client/blob/master/LICENSE.md
- */
-package com.mifos.mifosxdroid.adapters
-
-import android.content.Context
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import android.widget.BaseExpandableListAdapter
-import com.joanzapata.iconify.fonts.MaterialIcons
-import com.mifos.core.objects.accounts.loan.Transaction
-import com.mifos.core.objects.accounts.loan.Type
-import com.mifos.mifosxdroid.databinding.RowLoanTransactionItemBinding
-import com.mifos.mifosxdroid.databinding.RowLoanTransactionItemDetailBinding
-import com.mifos.utils.DateHelper.getDateAsString
-
-/**
- * Created by ishankhanna on 21/06/14.
- */
-class LoanTransactionAdapter(
- private val context: Context,
- private val transactionList: List
-) : BaseExpandableListAdapter() {
- private val layoutInflater: LayoutInflater = LayoutInflater.from(context)
- private val parents: MutableList = ArrayList()
- private val children: MutableList = ArrayList()
-
- init {
- for (transaction in transactionList) {
- val parent = transaction.type?.let {
- transaction.amount?.let { it1 ->
- Parent(
- transaction.date,
- it,
- it1
- )
- }
- }
- val child = transaction.id?.let {
- transaction.officeName?.let { it1 ->
- transaction.principalPortion?.let { it2 ->
- transaction.interestPortion?.let { it3 ->
- transaction.feeChargesPortion?.let { it4 ->
- transaction.penaltyChargesPortion?.let { it5 ->
- Child(
- it,
- it1,
- it2,
- it3,
- it4,
- it5
- )
- }
- }
- }
- }
- }
- }
- if (parent != null) {
- parents.add(parent)
- }
- if (child != null) {
- children.add(child)
- }
- }
- }
-
- override fun getGroupCount(): Int {
- return transactionList.size
- }
-
- override fun getChildrenCount(groupPosition: Int): Int {
- return 1
- }
-
- override fun getGroup(groupPosition: Int): Parent {
- return parents[groupPosition]
- }
-
- override fun getChild(groupPosition: Int, childPosition: Int): Child {
- return children[childPosition]
- }
-
- override fun getGroupId(groupPosition: Int): Long {
- return 0
- }
-
- override fun getChildId(groupPosition: Int, childPosition: Int): Long {
- return 0
- }
-
- override fun hasStableIds(): Boolean {
- return false
- }
-
- override fun getGroupView(
- groupPosition: Int,
- isExpanded: Boolean,
- convertView: View?,
- parent: ViewGroup
- ): View {
- val binding: RowLoanTransactionItemBinding
- val view: View
-
- if (convertView == null) {
- binding = RowLoanTransactionItemBinding.inflate(layoutInflater, parent, false)
- view = binding.root
- view.tag = binding
- } else {
- binding = convertView.tag as RowLoanTransactionItemBinding
- view = convertView
- }
-
- val contractedIconValue = MaterialIcons.md_add_circle_outline
- val expandedIconValue = MaterialIcons.md_remove_circle_outline
-
- if (!isExpanded) {
- binding.tvArrow.text = contractedIconValue.character().toString()
- } else {
- binding.tvArrow.text = expandedIconValue.character().toString()
- }
-
- binding.tvTransactionDate.text = getDateAsString(parents[groupPosition].date)
- binding.tvTransactionType.text = parents[groupPosition].type.value
- binding.tvTransactionAmount.text = parents[groupPosition].amount.toString()
-
- return view
- }
-
- override fun getChildView(
- groupPosition: Int,
- childPosition: Int,
- isLastChild: Boolean,
- convertView: View?,
- parent: ViewGroup
- ): View {
- val binding: RowLoanTransactionItemDetailBinding
- val view: View
-
- if (convertView == null) {
- binding = RowLoanTransactionItemDetailBinding.inflate(layoutInflater, parent, false)
- view = binding.root
- view.tag = binding
- } else {
- binding = convertView.tag as RowLoanTransactionItemDetailBinding
- view = convertView
- }
-
- binding.tvTransactionId.text = children[groupPosition].id.toString()
- binding.tvOfficeName.text = children[groupPosition].officeName
- binding.tvPrincipal.text = children[groupPosition].principalPortion.toString()
- binding.tvInterest.text = children[groupPosition].interestPortion.toString()
- binding.tvFees.text = children[groupPosition].feeChargesPortion.toString()
- binding.tvPenalties.text = children[groupPosition].penaltyChargesPortion.toString()
-
- return view
- }
-
- override fun isChildSelectable(groupPosition: Int, childPosition: Int): Boolean {
- return true
- }
-
- data class Parent(
- val date: List,
- val type: Type,
- val amount: Double
- )
-
- data class Child(
- val id: Int,
- val officeName: String,
- val principalPortion: Double,
- val interestPortion: Double,
- val feeChargesPortion: Double,
- val penaltyChargesPortion: Double
- )
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/PinpointClientAdapter.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/PinpointClientAdapter.kt
deleted file mode 100644
index ce2be2ca513..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/PinpointClientAdapter.kt
+++ /dev/null
@@ -1,125 +0,0 @@
-package com.mifos.mifosxdroid.adapters
-
-import android.content.Context
-import android.view.LayoutInflater
-import android.view.ViewGroup
-import androidx.recyclerview.widget.RecyclerView
-import com.google.android.gms.maps.CameraUpdateFactory
-import com.google.android.gms.maps.GoogleMap
-import com.google.android.gms.maps.MapsInitializer
-import com.google.android.gms.maps.OnMapReadyCallback
-import com.google.android.gms.maps.model.LatLng
-import com.google.android.gms.maps.model.MarkerOptions
-import com.mifos.core.objects.client.ClientAddressResponse
-import com.mifos.mifosxdroid.databinding.ItemPinpointLocationBinding
-import javax.inject.Inject
-
-/**
- * Created by Rajan Maurya on 16/01/17.
- */
-class PinpointClientAdapter @Inject constructor() :
- RecyclerView.Adapter() {
- private var addressResponses: List
- private var context: Context? = null
- private var itemClick: OnItemClick? = null
-
- init {
- addressResponses = ArrayList()
- }
-
- override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
- return ViewHolder(
- ItemPinpointLocationBinding.inflate(
- LayoutInflater.from(parent.context),
- parent,
- false
- )
- )
- }
-
- override fun onBindViewHolder(holder: ViewHolder, position: Int) {
- val addressResponse = addressResponses[position]
- holder.binding.tvAddress.text = addressResponse.placeAddress
- holder.binding.mvClientLocation.tag = addressResponse
-
- // Ensure the map has been initialised by the on map ready callback in ViewHolder.
- // If it is not ready yet, it will be initialised with the NamedLocation set as its tag
- // when the callback is received.
- setMapLocation(holder.map, addressResponse)
- holder.binding.cardView.setOnLongClickListener {
- itemClick!!.onItemLongClick(holder.adapterPosition)
- false
- }
- }
-
- fun setContext(context: Context?) {
- this.context = context
- }
-
- fun setAddress(addressResponses: List) {
- this.addressResponses = addressResponses
- notifyDataSetChanged()
- }
-
- fun getItem(position: Int): ClientAddressResponse {
- return addressResponses[position]
- }
-
- fun setItemClick(itemClick: OnItemClick?) {
- this.itemClick = itemClick
- }
-
- override fun getItemId(i: Int): Long {
- return 0
- }
-
- override fun getItemCount(): Int {
- return addressResponses.size
- }
-
- override fun onViewRecycled(holder: ViewHolder) {
- // Cleanup MapView here
- holder.map.clear()
- holder.map.mapType = GoogleMap.MAP_TYPE_NONE
- }
-
- private fun setMapLocation(map: GoogleMap?, location: ClientAddressResponse) {
- // Add a marker for this item and set the camera
- val latLng = location.latitude?.let { location.longitude?.let { it1 -> LatLng(it, it1) } }
- latLng?.let { CameraUpdateFactory.newLatLngZoom(it, 13f) }?.let { map!!.moveCamera(it) }
- latLng?.let { MarkerOptions().position(it) }?.let { map?.addMarker(it) }
- // Set the map type back to normal.
- map?.mapType = GoogleMap.MAP_TYPE_NORMAL
- }
-
- inner class ViewHolder(val binding: ItemPinpointLocationBinding) :
- RecyclerView.ViewHolder(binding.root), OnMapReadyCallback {
- lateinit var map: GoogleMap
-
- init {
- initializeMapView()
- }
-
- override fun onMapReady(googleMap: GoogleMap) {
- context?.let { MapsInitializer.initialize(it) }
- map = googleMap
- val data = binding.mvClientLocation.tag as ClientAddressResponse
- setMapLocation(map, data)
- }
-
- /**
- * Initialises the MapView by calling its lifecycle methods.
- */
- private fun initializeMapView() {
- // Initialise the MapView
- binding.mvClientLocation.onCreate(null)
- binding.mvClientLocation.onResume()
- // Set the map ready callback to receive the GoogleMap object
- binding.mvClientLocation.getMapAsync(this)
- }
- }
-
- interface OnItemClick {
- fun onItemLongClick(position: Int)
- }
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/SurveyListAdapter.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/SurveyListAdapter.kt
deleted file mode 100644
index dd45b9769e4..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/SurveyListAdapter.kt
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * This project is licensed under the open source MPL V2.
- * See https://github.com/openMF/android-client/blob/master/LICENSE.md
- */
-package com.mifos.mifosxdroid.adapters
-
-import android.content.Context
-import android.content.res.Resources
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import android.widget.BaseAdapter
-import com.mifos.core.objects.survey.Survey
-import com.mifos.mifosxdroid.databinding.RowSurveysListItemBinding
-
-/**
- * Created by Nasim Banu on 27,January,2016.
- */
-class SurveyListAdapter(context: Context, listSurvey: List) : BaseAdapter() {
- private val layoutInflater: LayoutInflater
- private val listSurvey: List
- private val resources: Resources
-
- init {
- layoutInflater = LayoutInflater.from(context)
- this.listSurvey = listSurvey
- resources = context.resources
- }
-
- override fun getCount(): Int {
- return listSurvey.size
- }
-
- override fun getItem(i: Int): Survey {
- return listSurvey[i]
- }
-
- override fun getItemId(i: Int): Long {
- return 0
- }
-
- override fun getView(i: Int, view: View?, viewGroup: ViewGroup): View {
- val binding: RowSurveysListItemBinding
- val convertView: View
- if (view == null) {
- binding = RowSurveysListItemBinding.inflate(layoutInflater, viewGroup, false)
- convertView = binding.root
- convertView.tag = binding
- } else {
- binding = view.tag as RowSurveysListItemBinding
- convertView = view
- }
- val survey = listSurvey[i]
- binding.tvSurveyName.text = survey.name
- binding.tvDescription.text = survey.description
- binding.ivSyncStatus.visibility = if (survey.isSync) View.VISIBLE else View.INVISIBLE
- return convertView
- }
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/SurveyPagerAdapter.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/SurveyPagerAdapter.kt
deleted file mode 100644
index bc38fae51fa..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/SurveyPagerAdapter.kt
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * This project is licensed under the open source MPL V2.
- * See https://github.com/openMF/android-client/blob/master/LICENSE.md
- */
-package com.mifos.mifosxdroid.adapters
-
-import androidx.fragment.app.Fragment
-import androidx.fragment.app.FragmentManager
-import androidx.fragment.app.FragmentStatePagerAdapter
-
-/**
- * Created by Nasim Banu on 28,January,2016.
- */
-class SurveyPagerAdapter(fm: FragmentManager?, private val fragments: List) :
- FragmentStatePagerAdapter(
- fm!!
- ) {
- var currentPage = 0
-
- override fun getItem(position: Int): Fragment {
- return fragments[position]
- }
-
- override fun getCount(): Int {
- return fragments.size
- }
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/components/Navigation.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/components/Navigation.kt
index 7d5bcc52bd4..97cf63b330d 100644
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/components/Navigation.kt
+++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/components/Navigation.kt
@@ -211,7 +211,7 @@ fun Navigation(
clientCreated = { client, userStatus ->
navController.popBackStack()
navController.popBackStack()
- Toast.makeText(context, context.resources.getString(R.string.client) + MifosResponseHandler.response, Toast.LENGTH_LONG).show()
+ Toast.makeText(context, context.resources.getString(R.string.client) + MifosResponseHandler.getResponse(userStatus), Toast.LENGTH_LONG).show()
if (userStatus == Constants.USER_ONLINE){
client.clientId?.let { navController.navigateClientDetailsScreen(it) }
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/BaseActivityCallback.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/BaseActivityCallback.kt
deleted file mode 100644
index 8071b8eeec9..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/BaseActivityCallback.kt
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * This project is licensed under the open source MPL V2.
- * See https://github.com/openMF/android-client/blob/master/LICENSE.md
- */
-package com.mifos.mifosxdroid.core
-
-import androidx.appcompat.widget.SwitchCompat
-
-/**
- * @author fomenkoo
- */
-interface BaseActivityCallback {
- fun showProgress(message: String)
- fun setToolbarTitle(title: String)
- fun setUserStatus(userStatus: SwitchCompat)
- fun hideProgress()
- fun logout()
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/EndlessRecyclerOnScrollListener.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/EndlessRecyclerOnScrollListener.kt
deleted file mode 100644
index c3cec0bebcc..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/EndlessRecyclerOnScrollListener.kt
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.mifos.mifosxdroid.core
-
-import androidx.recyclerview.widget.LinearLayoutManager
-import androidx.recyclerview.widget.RecyclerView
-
-/**
- * Created by rajanmaurya on 16/4/2016.
- */
-abstract class EndlessRecyclerOnScrollListener(private val mLinearLayoutManager: LinearLayoutManager) :
- RecyclerView.OnScrollListener() {
- private var firstVisibleItem = 0
- private var visibleItemCount = 0
- private var totalItemCount = 0
- private var previousTotal = 0 // The total number of items in the dataset after the last load
- private var loading = true // True if we are still waiting for the last set of data to
-
- // load.
- private val visibleThreshold = 1 // The minimum amount of items to have below your current
-
- // scroll position before loading more.
- private var currentPage = 1
- override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
- super.onScrolled(recyclerView, dx, dy)
- visibleItemCount = recyclerView.childCount
- totalItemCount = mLinearLayoutManager.itemCount
-
- // If user refreshed a layout
- if (previousTotal > totalItemCount) {
- previousTotal = 0
- }
- firstVisibleItem = mLinearLayoutManager.findFirstVisibleItemPosition()
- if (loading && totalItemCount > previousTotal + 1) {
- loading = false
- previousTotal = totalItemCount
- }
- if (!loading && totalItemCount - visibleItemCount <= firstVisibleItem + visibleThreshold) {
- // End has been reached
- currentPage++
- onLoadMore(currentPage)
- loading = true
- }
- }
-
- abstract fun onLoadMore(current_page: Int)
-
- companion object {
- val TAG = EndlessRecyclerOnScrollListener::class.java.simpleName
- }
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/EndlessRecyclerViewScrollListener.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/EndlessRecyclerViewScrollListener.kt
deleted file mode 100644
index 5fc3421f991..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/EndlessRecyclerViewScrollListener.kt
+++ /dev/null
@@ -1,108 +0,0 @@
-package com.mifos.mifosxdroid.core
-
-import androidx.recyclerview.widget.GridLayoutManager
-import androidx.recyclerview.widget.LinearLayoutManager
-import androidx.recyclerview.widget.RecyclerView
-import androidx.recyclerview.widget.StaggeredGridLayoutManager
-
-/**
- * Created by rajanmaurya on 09/09/2016
- */
-abstract class EndlessRecyclerViewScrollListener : RecyclerView.OnScrollListener {
- // The minimum amount of items to have below your current scroll position
- // before loading more.
- private var visibleThreshold = 5
-
- // The current offset index of data you have loaded
- private var currentPage = 0
-
- // The total number of items in the dataset after the last load
- private var previousTotalItemCount = 0
-
- // True if we are still waiting for the last set of data to load.
- private var loading = true
-
- // Sets the starting page index
- private val startingPageIndex = 0
- var mLayoutManager: RecyclerView.LayoutManager
-
- constructor(layoutManager: LinearLayoutManager) {
- mLayoutManager = layoutManager
- }
-
- constructor(layoutManager: GridLayoutManager) {
- mLayoutManager = layoutManager
- visibleThreshold *= layoutManager.spanCount
- }
-
- constructor(layoutManager: StaggeredGridLayoutManager) {
- mLayoutManager = layoutManager
- visibleThreshold *= layoutManager.spanCount
- }
-
- private fun getLastVisibleItem(lastVisibleItemPositions: IntArray): Int {
- var maxSize = 0
- for (i in lastVisibleItemPositions.indices) {
- if (i == 0) {
- maxSize = lastVisibleItemPositions[i]
- } else if (lastVisibleItemPositions[i] > maxSize) {
- maxSize = lastVisibleItemPositions[i]
- }
- }
- return maxSize
- }
-
- // This happens many times a second during a scroll, so be wary of the code you place here.
- // We are given a few useful parameters to help us work out if we need to load some more data,
- // but first we check if we are waiting for the previous load to finish.
- override fun onScrolled(view: RecyclerView, dx: Int, dy: Int) {
- var lastVisibleItemPosition = 0
- val totalItemCount = mLayoutManager.itemCount
- when (mLayoutManager) {
- is StaggeredGridLayoutManager -> {
- val lastVisibleItemPositions = (mLayoutManager as StaggeredGridLayoutManager)
- .findLastVisibleItemPositions(null)
- // get maximum element within the list
- lastVisibleItemPosition = getLastVisibleItem(lastVisibleItemPositions)
- }
-
- is LinearLayoutManager -> {
- lastVisibleItemPosition = (mLayoutManager as LinearLayoutManager)
- .findLastVisibleItemPosition()
- }
-
- is GridLayoutManager -> {
- lastVisibleItemPosition = (mLayoutManager as GridLayoutManager)
- .findLastVisibleItemPosition()
- }
- }
-
- // If the total item count is zero and the previous isn't, assume the
- // list is invalidated and should be reset back to initial state
- if (totalItemCount < previousTotalItemCount) {
- currentPage = startingPageIndex
- previousTotalItemCount = totalItemCount
- loading = totalItemCount == 0
- }
- // If it’s still loading, we check to see if the dataset count has
- // changed, if so we conclude it has finished loading and update the current page
- // number and total item count.
- if (loading && totalItemCount > previousTotalItemCount) {
- loading = false
- previousTotalItemCount = totalItemCount
- }
-
- // If it isn’t currently loading, we check to see if we have breached
- // the visibleThreshold and need to reload more data.
- // If we do need to reload some more data, we execute onLoadMore to fetch the data.
- // threshold should reflect how many total columns there are too
- if (!loading && lastVisibleItemPosition + visibleThreshold > totalItemCount) {
- currentPage++
- onLoadMore(currentPage, totalItemCount)
- loading = true
- }
- }
-
- // Defines the process for actually loading more data based on page
- abstract fun onLoadMore(page: Int, totalItemsCount: Int)
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/MaterialDialog.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/MaterialDialog.kt
deleted file mode 100644
index 4a0461b4e25..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/MaterialDialog.kt
+++ /dev/null
@@ -1,178 +0,0 @@
-package com.mifos.mifosxdroid.core
-
-import android.content.Context
-import android.content.DialogInterface
-import androidx.annotation.StringRes
-import com.google.android.material.dialog.MaterialAlertDialogBuilder
-import com.mifos.mifosxdroid.R
-
-/**
- * This Class is the Material Dialog Builder Class
- * Created by Rajan Maurya on 03/08/16.
- */
-class MaterialDialog {
- class Builder {
- private var mMaterialDialogBuilder: MaterialAlertDialogBuilder? = null
-
- //This is the Default Builder Initialization with Material Style
- fun init(context: Context?): Builder {
- mMaterialDialogBuilder =
- context?.let { MaterialAlertDialogBuilder(it, R.style.MaterialAlertDialogStyle) }
- return this
- }
-
- //This method set the custom Material Style
- fun init(context: Context?, theme: Int): Builder {
- mMaterialDialogBuilder = context?.let { MaterialAlertDialogBuilder(it, theme) }
- return this
- }
-
- //This method set the String Title
- fun setTitle(title: String?): Builder {
- mMaterialDialogBuilder?.setTitle(title)
- return this
- }
-
- //This Method set the String Resources to Title
- fun setTitle(@StringRes title: Int): Builder {
- mMaterialDialogBuilder?.setTitle(title)
- return this
- }
-
- //This Method set the String Message
- fun setMessage(message: String?): Builder {
- mMaterialDialogBuilder?.setMessage(message)
- return this
- }
-
- //This Method set the String Resources message
- fun setMessage(@StringRes message: Int): Builder {
- mMaterialDialogBuilder?.setMessage(message)
- return this
- }
-
- //This Method set String Test to the Positive Button and set the Onclick null
- fun setPositiveButton(positiveText: String?): Builder {
- mMaterialDialogBuilder?.setPositiveButton(positiveText, null)
- return this
- }
-
- //This Method Set the String Resources Text To Positive Button
- fun setPositiveButton(@StringRes positiveText: Int): Builder {
- mMaterialDialogBuilder?.setPositiveButton(positiveText, null)
- return this
- }
-
- //This Method set the String Text to Positive Button and set the OnClick Event to it
- fun setPositiveButton(
- positiveText: String?,
- listener: DialogInterface.OnClickListener?
- ): Builder {
- mMaterialDialogBuilder?.setPositiveButton(positiveText, listener)
- return this
- }
-
- //This method set the String Resources text To Positive button and set the Onclick Event
- fun setPositiveButton(
- @StringRes positiveText: Int,
- listener: DialogInterface.OnClickListener?
- ): Builder {
- mMaterialDialogBuilder?.setPositiveButton(positiveText, listener)
- return this
- }
-
- //This Method the String Text to Negative Button and Set the onclick event to null
- fun setNegativeButton(negativeText: String?): Builder {
- mMaterialDialogBuilder?.setNegativeButton(negativeText, null)
- return this
- }
-
- //This Method set the String Resources Text to Negative button
- // and set the onclick event to null
- fun setNegativeButton(@StringRes negativeText: Int): Builder {
- mMaterialDialogBuilder?.setNegativeButton(negativeText, null)
- return this
- }
-
- //This Method set String Text to Negative Button and
- //Set the Onclick event
- fun setNegativeButton(
- negativeText: String?,
- listener: DialogInterface.OnClickListener?
- ): Builder {
- mMaterialDialogBuilder?.setNegativeButton(negativeText, listener)
- return this
- }
-
- //This method set String Resources Text to Negative Button and set Onclick Event
- fun setNegativeButton(
- @StringRes negativeText: Int,
- listener: DialogInterface.OnClickListener?
- ): Builder {
- mMaterialDialogBuilder?.setNegativeButton(negativeText, listener)
- return this
- }
-
- //This Method the String Text to Neutral Button and Set the onclick event to null
- fun setNeutralButton(neutralText: String?): Builder {
- mMaterialDialogBuilder?.setNeutralButton(neutralText, null)
- return this
- }
-
- //This Method set the String Resources Text to Neutral button
- // and set the onclick event to null
- fun setNeutralButton(@StringRes neutralText: Int): Builder {
- mMaterialDialogBuilder?.setNeutralButton(neutralText, null)
- return this
- }
-
- //This Method set String Text to Neutral Button and
- //Set the Onclick event
- fun setNeutralButton(
- neutralText: String?,
- listener: DialogInterface.OnClickListener?
- ): Builder {
- mMaterialDialogBuilder?.setNeutralButton(neutralText, listener)
- return this
- }
-
- //This method set String Resources Text to Neutral Button and set Onclick Event
- fun setNeutralButton(
- @StringRes neutralText: Int,
- listener: DialogInterface.OnClickListener?
- ): Builder {
- mMaterialDialogBuilder?.setNeutralButton(neutralText, listener)
- return this
- }
-
- fun setCancelable(cancelable: Boolean?): Builder {
- mMaterialDialogBuilder?.setCancelable(cancelable!!)
- return this
- }
-
- fun setItems(items: Int, listener: DialogInterface.OnClickListener?): Builder {
- mMaterialDialogBuilder?.setItems(items, listener)
- return this
- }
-
- fun setItems(
- items: Array,
- listener: DialogInterface.OnClickListener?
- ): Builder {
- mMaterialDialogBuilder?.setItems(items, listener)
- return this
- }
-
- //This Method Create the Final Material Dialog
- fun createMaterialDialog(): Builder {
- mMaterialDialogBuilder?.create()
- return this
- }
-
- //This Method Show the Dialog
- fun show(): Builder {
- mMaterialDialogBuilder?.show()
- return this
- }
- }
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/MifosBaseActivity.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/MifosBaseActivity.kt
deleted file mode 100644
index b19ac341bd9..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/MifosBaseActivity.kt
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * This project is licensed under the open source MPL V2.
- * See https://github.com/openMF/android-client/blob/master/LICENSE.md
- */
-package com.mifos.mifosxdroid.core
-
-import android.app.ProgressDialog
-import android.content.Context
-import android.content.Intent
-import android.view.MenuItem
-import android.view.View
-import android.view.inputmethod.InputMethodManager
-import android.widget.Toast
-import androidx.appcompat.app.AppCompatActivity
-import androidx.appcompat.widget.SwitchCompat
-import androidx.appcompat.widget.Toolbar
-import androidx.fragment.app.Fragment
-import androidx.fragment.app.FragmentManager
-import com.mifos.mifosxdroid.AndroidClientActivity
-import com.mifos.mifosxdroid.R
-import com.mifos.utils.Constants
-import com.mifos.utils.LanguageHelper
-import com.mifos.utils.PrefManager
-
-/**
- * @author fomenkoo
- */
-open class MifosBaseActivity : BaseActivityCallback, AppCompatActivity() {
- var toolbar: Toolbar? = null
- private var progress: ProgressDialog? = null
- override fun setContentView(layoutResID: Int) {
- super.setContentView(layoutResID)
- toolbar = findViewById(R.id.toolbar)
- if (toolbar != null) {
- setSupportActionBar(toolbar)
- }
- }
-
- override fun setContentView(view: View) {
- super.setContentView(view)
- toolbar = findViewById(R.id.toolbar)
- if (toolbar != null) {
- setSupportActionBar(toolbar)
- }
- }
-
- private fun setActionBarTitle(title: String?) {
- if (supportActionBar != null && getTitle() != null) {
- setTitle(title)
- }
- }
-
- override fun attachBaseContext(base: Context) {
- super.attachBaseContext(LanguageHelper.onAttach(base))
- }
-
- protected fun showBackButton() {
- if (supportActionBar != null) {
- supportActionBar?.setHomeButtonEnabled(true)
- supportActionBar?.setDisplayHomeAsUpEnabled(true)
- }
- }
-
- protected fun setActionBarTitle(title: Int) {
- setActionBarTitle(resources.getString(title))
- }
-
- override fun onOptionsItemSelected(item: MenuItem): Boolean {
- return when (item.itemId) {
- android.R.id.home -> {
- onBackPressed()
- true
- }
-
- else -> super.onOptionsItemSelected(item)
- }
- }
-
- override fun showProgress(message: String) {
- if (progress == null) {
- progress = ProgressDialog(this, ProgressDialog.STYLE_SPINNER)
- progress?.setCancelable(false)
- }
- progress?.setMessage(message)
- progress?.show()
- }
-
- override fun setToolbarTitle(title: String) {
- setActionBarTitle(title)
- }
-
- override fun setUserStatus(userStatus: SwitchCompat) {
- if (PrefManager.userStatus == Constants.USER_ONLINE) {
- userStatus.isChecked = false
- } else if (PrefManager.userStatus == Constants.USER_OFFLINE) {
- userStatus.isChecked = true
- }
- }
-
- override fun hideProgress() {
- if (progress != null && progress?.isShowing == true) progress?.dismiss()
- }
-
- fun hideKeyboard(view: View) {
- val inputMethodManager = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
- inputMethodManager.hideSoftInputFromWindow(view.windowToken, 0)
- }
-
- override fun logout() {
- MaterialDialog.Builder().init(this@MifosBaseActivity)
- .setMessage(R.string.dialog_logout)
- .setPositiveButton(
- getString(R.string.logout)
- ) { dialog, which ->
- PrefManager.clear()
- startActivity(
- Intent(
- this@MifosBaseActivity,
- AndroidClientActivity::class.java
- )
- )
- Toast.makeText(
- this@MifosBaseActivity,
- R.string.logout_successfully,
- Toast.LENGTH_SHORT
- ).show()
- finish()
- }
- .setNegativeButton(getString(R.string.cancel))
- .createMaterialDialog()
- .show()
- }
-
- fun replaceFragment(fragment: Fragment, addToBackStack: Boolean, containerId: Int) {
- invalidateOptionsMenu()
- val backStateName = fragment.javaClass.name
- val fragmentPopped = supportFragmentManager.popBackStackImmediate(
- backStateName,
- 0
- )
- if (!fragmentPopped && supportFragmentManager.findFragmentByTag(backStateName) ==
- null
- ) {
- val transaction = supportFragmentManager.beginTransaction()
- transaction.replace(containerId, fragment, backStateName)
- if (addToBackStack) {
- transaction.addToBackStack(backStateName)
- }
- transaction.commit()
- }
- }
-
- fun clearFragmentBackStack() {
- val fm = supportFragmentManager
- val backStackCount = supportFragmentManager.backStackEntryCount
- for (i in 0 until backStackCount) {
- val backStackId = supportFragmentManager.getBackStackEntryAt(i).id
- fm.popBackStack(backStackId, FragmentManager.POP_BACK_STACK_INCLUSIVE)
- }
- }
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/MifosBaseFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/MifosBaseFragment.kt
deleted file mode 100644
index d19a32d9d36..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/MifosBaseFragment.kt
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * This project is licensed under the open source MPL V2.
- * See https://github.com/openMF/android-client/blob/master/LICENSE.md
- */
-package com.mifos.mifosxdroid.core
-
-import android.app.Activity
-import android.content.Context
-import android.os.Bundle
-import android.view.View
-import android.view.inputmethod.InputMethodManager
-import androidx.appcompat.widget.Toolbar
-import androidx.fragment.app.Fragment
-import com.mifos.mifosxdroid.R
-import com.mifos.utils.LanguageHelper
-import com.mifos.utils.Network
-
-/**
- * @author fomenkoo
- */
-open class MifosBaseFragment() : Fragment() {
- private var callback: BaseActivityCallback? = null
- private var activity: Activity? = null
- private var inputManager: InputMethodManager? = null
- private var mMifosProgressBarHandler: MifosProgressBarHandler? = null
- override fun onAttach(context: Context) {
- super.onAttach(LanguageHelper.onAttach(context))
- val activity = if (context is Activity) context else null
- this.activity = activity
- callback = try {
- activity as BaseActivityCallback?
- } catch (e: ClassCastException) {
- throw ClassCastException(
- activity.toString() + " must implement " +
- "BaseActivityCallback"
- )
- }
- }
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- inputManager =
- requireActivity().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
- mMifosProgressBarHandler = MifosProgressBarHandler(requireActivity())
- }
-
- fun showAlertDialog(title: String?, message: String?) {
- MaterialDialog.Builder().init(getActivity())
- .setTitle(title)
- .setMessage(message)
- .setCancelable(false)
- .setPositiveButton(getStringMessage(R.string.dialog_action_ok)) { dialog, id -> dialog.dismiss() }
- .createMaterialDialog()
- .show()
- }
-
- val toolbar: Toolbar?
- get() = (getActivity() as MifosBaseActivity).toolbar
-
- protected fun showMifosProgressDialog(message: String = "Working...") {
- if (callback != null) callback?.showProgress(message)
- }
-
- protected fun hideMifosProgressDialog() {
- if (callback != null) callback?.hideProgress()
- }
-
- protected fun logout() {
- callback?.logout()
- }
-
- protected fun setToolbarTitle(title: String) {
- callback?.setToolbarTitle(title)
- }
-
- fun hideKeyboard(view: View) {
- inputManager?.hideSoftInputFromWindow(
- view.windowToken,
- InputMethodManager.RESULT_UNCHANGED_SHOWN
- )
- }
-
- protected fun showMifosProgressBar() {
- mMifosProgressBarHandler?.show()
- }
-
- protected fun hideMifosProgressBar() {
- mMifosProgressBarHandler?.hide()
- }
-
- protected fun getStringMessage(message: Int): String {
- return resources.getString(message)
- }
-
- protected val isOnline: Boolean
- get() = Network.isOnline(requireContext())
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/MifosProgressBarHandler.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/MifosProgressBarHandler.kt
deleted file mode 100644
index 5ab09568ba1..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/MifosProgressBarHandler.kt
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.mifos.mifosxdroid.core
-
-import android.R
-import android.app.Activity
-import android.view.Gravity
-import android.view.View
-import android.view.ViewGroup
-import android.widget.ProgressBar
-import android.widget.RelativeLayout
-import androidx.fragment.app.FragmentActivity
-
-/**
- * @author Rajan Maurya
- */
-class MifosProgressBarHandler(private val mContext: FragmentActivity) {
- private val mProgressBar: ProgressBar
-
- init {
- val layout = (mContext as Activity).findViewById(R.id.content).rootView as ViewGroup
- mProgressBar = ProgressBar(mContext, null, R.attr.progressBarStyleInverse)
- mProgressBar.isIndeterminate = true
- val params = RelativeLayout.LayoutParams(
- RelativeLayout.LayoutParams.MATCH_PARENT,
- RelativeLayout.LayoutParams.MATCH_PARENT
- )
- val rl = RelativeLayout(mContext)
- rl.gravity = Gravity.CENTER
- rl.addView(mProgressBar)
- layout.addView(rl, params)
- hide()
- }
-
- fun show() {
- mProgressBar.visibility = View.VISIBLE
- }
-
- fun hide() {
- mProgressBar.visibility = View.INVISIBLE
- }
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/ProgressableDialogFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/ProgressableDialogFragment.kt
deleted file mode 100644
index f56cbaf4fcc..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/ProgressableDialogFragment.kt
+++ /dev/null
@@ -1,61 +0,0 @@
-package com.mifos.mifosxdroid.core
-
-import android.content.Context
-import android.os.Bundle
-import android.util.Log
-import android.view.View
-import android.view.inputmethod.InputMethodManager
-import android.widget.ViewFlipper
-import androidx.fragment.app.DialogFragment
-import com.mifos.mifosxdroid.R
-
-/**
- * A [DialogFragment] that provides progress viewing functionality
- * with a ViewFlipper.
- */
-open class ProgressableDialogFragment : DialogFragment() {
- private var viewFlipper: ViewFlipper? = null
- override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
- super.onViewCreated(view, savedInstanceState)
- viewFlipper = view.findViewById(R.id.view_flipper)
- if (viewFlipper == null) {
- throw NullPointerException(
- "Are you sure your Fragment has a ViewFlipper with id " +
- "\"view_flipper\"?"
- )
- }
- }
-
- /**
- * Switches the [ViewFlipper] either to the [ProgressBar] or to the content.
- *
- * @param show true to show [ProgressBar], false for content.
- */
- fun showProgress(show: Boolean) {
- try {
- val childToFlipTo = if (show) VIEW_FLIPPER_PROGRESS else VIEW_FLIPPER_CONTENT
- if (viewFlipper?.displayedChild != childToFlipTo) {
- viewFlipper?.displayedChild = childToFlipTo
- }
- } catch (e: NullPointerException) {
- Log.w(
- javaClass.simpleName, "Couldn't show/hide progress bar. Are you sure your" +
- " Fragment contains a ViewFlipper with ID \"view_flipper\"?"
- )
- }
- }
-
- fun hideKeyboard(view: View) {
- val inputManager = requireActivity()
- .getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
- inputManager.hideSoftInputFromWindow(
- view.windowToken,
- InputMethodManager.RESULT_UNCHANGED_SHOWN
- )
- }
-
- companion object {
- const val VIEW_FLIPPER_PROGRESS = 0
- const val VIEW_FLIPPER_CONTENT = 1
- }
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/ProgressableFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/ProgressableFragment.kt
deleted file mode 100644
index dc4324f772d..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/ProgressableFragment.kt
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.mifos.mifosxdroid.core
-
-import android.os.Bundle
-import android.util.Log
-import android.view.View
-import android.widget.ViewFlipper
-import com.mifos.mifosxdroid.R
-
-/**
- * A [MifosBaseFragment] that provides progress viewing functionality with a ViewFlipper.
- */
-open class ProgressableFragment : MifosBaseFragment() {
- private var viewFlipper: ViewFlipper? = null
- override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
- super.onViewCreated(view, savedInstanceState)
- viewFlipper = view.findViewById(R.id.view_flipper)
- if (viewFlipper == null) {
- throw NullPointerException(
- "Are you sure your Fragment has a ViewFlipper with id " +
- "\"view_flipper\"?"
- )
- }
- }
-
- /**
- * Switches the [ViewFlipper] either to the [ProgressBar] or to the content.
- *
- * @param show true to show [ProgressBar], false for content.
- */
- fun showProgress(show: Boolean) {
- try {
- val childToFlipTo = if (show) VIEW_FLIPPER_PROGRESS else VIEW_FLIPPER_CONTENT
- if (viewFlipper!!.displayedChild != childToFlipTo) {
- viewFlipper!!.displayedChild = childToFlipTo
- }
- } catch (e: NullPointerException) {
- Log.w(
- javaClass.simpleName, "Couldn't show/hide progress bar. Are you sure your" +
- " Fragment contains a ViewFlipper with ID \"view_flipper\"?"
- )
- }
- }
-
- companion object {
- const val VIEW_FLIPPER_PROGRESS = 0
- const val VIEW_FLIPPER_CONTENT = 1
- }
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/SelectableAdapter.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/SelectableAdapter.kt
deleted file mode 100644
index 976a0c4fa53..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/SelectableAdapter.kt
+++ /dev/null
@@ -1,68 +0,0 @@
-package com.mifos.mifosxdroid.core
-
-import android.util.SparseBooleanArray
-import androidx.recyclerview.widget.RecyclerView
-
-abstract class SelectableAdapter : RecyclerView.Adapter() {
- private val selectedItems: SparseBooleanArray = SparseBooleanArray()
-
- /**
- * Indicates if the item at position position is selected
- *
- * @param position Position of the item to check
- * @return true if the item is selected, false otherwise
- */
- fun isSelected(position: Int): Boolean {
- return getSelectedItems().contains(position)
- }
-
- /**
- * Toggle the selection status of the item at a given position
- *
- * @param position Position of the item to toggle the selection status for
- */
- fun toggleSelection(position: Int) {
- if (selectedItems[position, false]) {
- selectedItems.delete(position)
- } else {
- selectedItems.put(position, true)
- }
- notifyItemChanged(position)
- }
-
- /**
- * Clear the selection status for all items
- */
- fun clearSelection() {
- val selection = getSelectedItems()
- selectedItems.clear()
- for (i in selection) {
- notifyItemChanged(i)
- }
- }
-
- /**
- * Count the selected items
- *
- * @return Selected items count
- */
- val selectedItemCount: Int
- get() = selectedItems.size()
-
- /**
- * Indicates the list of selected items
- *
- * @return List of selected items ids
- */
- fun getSelectedItems(): List {
- val items: MutableList = ArrayList(selectedItems.size())
- for (i in 0 until selectedItems.size()) {
- items.add(selectedItems.keyAt(i))
- }
- return items
- }
-
- companion object {
- private val LOG_TAG = SelectableAdapter::class.java.simpleName
- }
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/adapters/MifosBaseListAdapter.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/adapters/MifosBaseListAdapter.kt
deleted file mode 100644
index 635d2e82f9e..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/adapters/MifosBaseListAdapter.kt
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * This project is licensed under the open source MPL V2.
- * See https://github.com/openMF/android-client/blob/master/LICENSE.md
- */
-package com.mifos.mifosxdroid.core.adapters
-
-import android.content.Context
-import android.content.res.Resources
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import android.widget.BaseAdapter
-import android.widget.ListView
-import java.util.Collections
-
-/**
- * @author fomenkoo
- */
-abstract class MifosBaseListAdapter(
- /**
- * Returns the context associated with this array adapter. The context is used
- * to create views from the resource passed to the constructor.
- *
- * @return The Context associated with this adapter.
- */
- val context: Context, private var list: MutableList?, private val layoutId: Int
-) : BaseAdapter() {
- private val mLock = Any()
-
- /**
- * Handler for button elements in listview
- */
- var buttonListener = View.OnClickListener { v ->
- val listView = v.parent as ListView
- val position = listView.getPositionForView(v)
- listView.performItemClick(
- listView.getChildAt(position), position, listView
- .getItemIdAtPosition(position)
- )
- }
- var inflater: LayoutInflater? = null
- get() {
- if (field == null) {
- field = LayoutInflater.from(context)
- }
- return field
- }
- private set
-
- override fun getView(position: Int, convertView: View, parent: ViewGroup): View? {
- return layout
- }
-
- /**
- * Adds the specified object at the end of the array.
- *
- * @param object The object to add at the end of the array.
- */
- fun add(`object`: T) {
- synchronized(mLock) { list?.add(`object`) }
- notifyDataSetChanged()
- }
-
- /**
- * Adds the specified Collection at the end of the array.
- *
- * @param collection The Collection to add at the end of the array.
- */
- fun addAll(collection: Collection?) {
- synchronized(mLock) {
- if (collection != null) {
- list?.addAll(collection)
- }
- }
- notifyDataSetChanged()
- }
-
- /**
- * Adds the specified items at the end of the array.
- *
- * @param items The items to add at the end of the array.
- */
- fun addAll(vararg items: T) {
- synchronized(mLock) { Collections.addAll(list, *items) }
- notifyDataSetChanged()
- }
-
- /**
- * Inserts the specified object at the specified index in the array.
- *
- * @param object The object to insert into the array.
- * @param index The index at which the object must be inserted.
- */
- fun insert(`object`: T, index: Int) {
- synchronized(mLock) { list?.add(index, `object`) }
- notifyDataSetChanged()
- }
-
- /**
- * Removes the specified object from the array.
- *
- * @param object The object to remove.
- */
- fun remove(`object`: T) {
- synchronized(mLock) { list?.remove(`object`) }
- notifyDataSetChanged()
- }
-
- /**
- * Remove all elements from the list.
- */
- fun clear() {
- synchronized(mLock) { list?.clear() }
- notifyDataSetChanged()
- }
-
- /**
- * Sorts the content of this adapter using the specified comparator.
- *
- * @param comparator The comparator used to sort the objects contained
- * in this adapter.
- */
- fun sort(comparator: Comparator?) {
- synchronized(mLock) { Collections.sort(list, comparator) }
- notifyDataSetChanged()
- }
-
- /**
- * {@inheritDoc}
- */
- override fun getCount(): Int {
- return list?.size ?: 0
- }
-
- /**
- * {@inheritDoc}
- */
- override fun getItem(position: Int): T? {
- return list?.getOrNull(position)
- }
-
- /**
- * Returns the position of the specified item in the array.
- *
- * @param item The item to retrieve the position of.
- * @return The position of the specified item.
- */
- fun getPosition(item: T): Int {
- return list?.indexOf(item) ?: -1
- }
-
- /**
- * {@inheritDoc}
- */
- override fun getItemId(position: Int): Long {
- return position.toLong()
- }
-
- val resources: Resources
- get() = context.resources
-
- fun getList(): List? {
- return list
- }
-
- fun setList(list: MutableList?) {
- synchronized(mLock) { this.list = list }
- notifyDataSetChanged()
- }
-
- val layout: View?
- get() = inflater?.inflate(layoutId, null)
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/util/Toaster.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/util/Toaster.kt
deleted file mode 100644
index fe36556b2fe..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/util/Toaster.kt
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * This project is licensed under the open source MPL V2.
- * See https://github.com/openMF/android-client/blob/master/LICENSE.md
- */
-package com.mifos.mifosxdroid.core.util
-
-import android.view.View
-import android.widget.TextView
-import com.google.android.material.R
-import com.google.android.material.snackbar.Snackbar
-import com.mifos.application.App
-
-/**
- * @author fomenkoo
- */
-object Toaster {
- const val INDEFINITE = Snackbar.LENGTH_INDEFINITE
- const val LONG = Snackbar.LENGTH_LONG
- const val SHORT = Snackbar.LENGTH_SHORT
-
- @JvmStatic
- fun show(view: View?, text: String?, duration: Int) {
- if (view != null && text != null) {
- val snackbar = Snackbar.make(view, text, duration)
- val sbView = snackbar.view
- val textView = sbView.findViewById(R.id.snackbar_text)
- textView.textSize = 12f
- snackbar.setAction("OK") { snackbar.dismiss() }
- snackbar.show()
- }
- }
-
- @JvmStatic
- fun show(view: View?, res: Int, duration: Int) {
- show(view, App.context?.resources?.getString(res), duration)
- }
-
- @JvmStatic
- fun show(view: View?, string: String?) {
- show(view, string, Snackbar.LENGTH_LONG)
- }
-
- @JvmStatic
- fun show(view: View?, res: Int) {
- show(view, App.context?.resources?.getString(res))
- }
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/chargedialog/OnChargeCreateListener.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/chargedialog/OnChargeCreateListener.kt
deleted file mode 100644
index 734ff237ae1..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/chargedialog/OnChargeCreateListener.kt
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.mifos.mifosxdroid.dialogfragments.chargedialog
-
-import com.mifos.core.objects.client.Charges
-
-/**
- * Created by Tarun on 13-08-17.
- */
-interface OnChargeCreateListener {
- fun onChargeCreatedSuccess(charge: Charges)
- fun onChargeCreatedFailure(errorMessage: String)
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/checkertaskfilterdialog/CheckerTaskFilterDialogFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/checkertaskfilterdialog/CheckerTaskFilterDialogFragment.kt
deleted file mode 100644
index d6716ec3de0..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/checkertaskfilterdialog/CheckerTaskFilterDialogFragment.kt
+++ /dev/null
@@ -1,212 +0,0 @@
-package com.mifos.mifosxdroid.dialogfragments.checkertaskfilterdialog
-
-/*
-import android.content.Context
-import android.os.Bundle
-import android.util.Log
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import android.widget.AdapterView
-import android.widget.ArrayAdapter
-import androidx.fragment.app.DialogFragment
-import androidx.lifecycle.Observer
-import androidx.lifecycle.ViewModelProviders
-import com.mifos.mifosxdroid.R
-import com.mifos.mifosxdroid.databinding.DialogFragmentCheckerTaskFilterBinding
-import com.mifos.feature.checker_inbox_task.checker_inbox_dialog.CheckerInboxViewModel
-import com.mifos.feature.checker_inbox_task.dialog.CheckerInboxViewModelFactory
-import com.mifos.mifosxdroid.uihelpers.MFDatePicker
-import com.mifos.utils.FragmentConstants
-import dagger.hilt.android.AndroidEntryPoint
-import java.sql.Timestamp
-import java.text.SimpleDateFormat
-import javax.inject.Inject
-
-@AndroidEntryPoint
-class CheckerTaskFilterDialogFragment : DialogFragment(), MFDatePicker.OnDatePickListener,
- AdapterView.OnItemSelectedListener {
-
- private lateinit var binding: DialogFragmentCheckerTaskFilterBinding
-
- private lateinit var mOnInputSelected: OnInputSelected
-
- private lateinit var datePickerFromDate: DialogFragment
- private lateinit var datePickerToDate: DialogFragment
- private lateinit var mCurrentDateView: View
- private lateinit var selectedAction: String
- private lateinit var selectedEntity: String
-
- private lateinit var actionOptionsList: MutableList
- private lateinit var entityOptionsList: MutableList
- private lateinit var actionOptionsAdapter: ArrayAdapter
- private lateinit var entityOptionsAdapter: ArrayAdapter
-
- private lateinit var fromDate: String
- private lateinit var toDate: String
-
- private val ALL = "ALL"
- private val TO_TIME = "23:59:59"
-
- @Inject
- lateinit var factory: CheckerInboxViewModelFactory
- private lateinit var viewModel: CheckerInboxViewModel
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- actionOptionsList = mutableListOf()
- entityOptionsList = mutableListOf()
- actionOptionsList.add(ALL)
- entityOptionsList.add(ALL)
- fromDate = ""
- selectedAction = ALL
- selectedEntity = ALL
- datePickerFromDate = MFDatePicker.newInsance(this)
- datePickerToDate = MFDatePicker.newInsance(this)
- }
-
- override fun onCreateView(
- inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
- ): View {
- binding = DialogFragmentCheckerTaskFilterBinding.inflate(inflater, container, false)
- return binding.root
- }
-
- override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
- super.onViewCreated(view, savedInstanceState)
- binding.spAction.onItemSelectedListener = this
- binding.spEntity.onItemSelectedListener = this
- setOnClickListeners()
- binding.tvFromDate.text = getString(R.string.select_from_date)
- toDate = "${MFDatePicker.datePickedAsString} $TO_TIME"
- binding.tvToDate.text = toDate.substringBefore(" ")
- }
-
- private fun setOnClickListeners() {
- binding.tvFromDate.setOnClickListener {
- activity?.supportFragmentManager?.let { it1 ->
- datePickerFromDate.show(
- it1,
- FragmentConstants.DFRAG_DATE_PICKER
- )
- }
- mCurrentDateView = binding.tvFromDate
- }
-
- binding.tvToDate.setOnClickListener {
- activity?.supportFragmentManager?.let { it1 ->
- datePickerToDate.show(
- it1,
- FragmentConstants.DFRAG_DATE_PICKER
- )
- }
- mCurrentDateView = binding.tvToDate
- }
-
- binding.btnApplyFilter.setOnClickListener {
- val resourceId = binding.etResourceId.text.toString().trim()
- var fromDateTimeStamp: Timestamp? = null
- if (fromDate.isNotEmpty()) {
- fromDateTimeStamp = Timestamp(
- SimpleDateFormat("dd-MM-yyyy").parse(fromDate).time
- )
- }
- val toDateTimeStamp = Timestamp(
- SimpleDateFormat("dd-MM-yyyy HH:mm:ss").parse(toDate).time
- )
- mOnInputSelected.sendInput(
- fromDateTimeStamp, toDateTimeStamp,
- selectedAction, selectedEntity, resourceId
- )
- dialog?.dismiss()
- }
-
- binding.btnClearFilter.setOnClickListener {
- mOnInputSelected.sendInput(
- null, null,
- selectedAction, selectedEntity, ""
- )
- dialog?.dismiss()
- }
- }
-
-
- override fun onActivityCreated(savedInstanceState: Bundle?) {
- super.onActivityCreated(savedInstanceState)
-
- viewModel = ViewModelProviders.of(this, factory)[CheckerInboxViewModel::class.java]
-
- viewModel.getSearchTemplate().observe(this, Observer {
- val checkerInboxSearchTemplate = it
- actionOptionsList.addAll(checkerInboxSearchTemplate.actionNames)
- entityOptionsList.addAll(checkerInboxSearchTemplate.entityNames)
-
- actionOptionsAdapter = ArrayAdapter(
- requireActivity(),
- android.R.layout.simple_spinner_item, actionOptionsList
- )
- actionOptionsAdapter.setDropDownViewResource(
- android.R.layout.simple_spinner_dropdown_item
- )
-
- entityOptionsAdapter = ArrayAdapter(
- requireActivity(),
- android.R.layout.simple_spinner_item, entityOptionsList
- )
- entityOptionsAdapter.setDropDownViewResource(
- android.R.layout.simple_spinner_dropdown_item
- )
-
- binding.spAction.adapter = actionOptionsAdapter
- binding.spEntity.adapter = entityOptionsAdapter
-
- selectedAction = checkerInboxSearchTemplate.actionNames[0]
- selectedEntity = checkerInboxSearchTemplate.entityNames[0]
- }
- )
- }
-
- override fun onAttach(context: Context) {
- super.onAttach(context)
- try {
- mOnInputSelected = targetFragment as OnInputSelected
- } catch (e: ClassCastException) {
- Log.e("TaskFilterDialog", e.message.toString())
- }
- }
-
- override fun onNothingSelected(p0: AdapterView<*>?) {
- }
-
- override fun onItemSelected(p0: AdapterView<*>?, p1: View?, p2: Int, p3: Long) {
- when (p0?.id) {
- R.id.sp_action -> {
- selectedAction = p0.getItemAtPosition(p2) as String
- }
-
- R.id.sp_entity -> {
- selectedEntity = p0.getItemAtPosition(p2) as String
- }
- }
- }
-
- interface OnInputSelected {
- fun sendInput(
- fromDate: Timestamp?, toDate: Timestamp?, action: String = "",
- entity: String = "", resourceId: String = ""
- )
- }
-
- override fun onDatePicked(date: String?) {
- if (mCurrentDateView === binding.tvFromDate) {
- if (date != null) {
- fromDate = date
- }
- binding.tvFromDate.text = fromDate
- } else if (mCurrentDateView === binding.tvToDate) {
- toDate = "$date $TO_TIME"
- binding.tvToDate.text = toDate.substringBefore(" ")
- }
- }
-}
-*/
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/syncsurveysdialog/SyncSurveysDialogFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/syncsurveysdialog/SyncSurveysDialogFragment.kt
deleted file mode 100644
index ca13b4e9d75..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/syncsurveysdialog/SyncSurveysDialogFragment.kt
+++ /dev/null
@@ -1,248 +0,0 @@
-package com.mifos.mifosxdroid.dialogfragments.syncsurveysdialog
-
-/*
-import android.os.Bundle
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import android.widget.Toast
-import androidx.fragment.app.DialogFragment
-import androidx.lifecycle.ViewModelProvider
-import com.mifos.core.objects.survey.Survey
-import com.mifos.mifosxdroid.R
-import com.mifos.mifosxdroid.core.util.Toaster.show
-import com.mifos.mifosxdroid.databinding.DialogFragmentSyncSurveysBinding
-import com.mifos.utils.Constants
-import com.mifos.utils.Network.isOnline
-import com.mifos.utils.PrefManager.userStatus
-import dagger.hilt.android.AndroidEntryPoint
-
-@AndroidEntryPoint
-class SyncSurveysDialogFragment : DialogFragment() {
-
- private lateinit var binding: DialogFragmentSyncSurveysBinding
-
- private lateinit var viewModel: SyncSurveysDialogViewModel
-
- private var mSurveyList: List? = null
- override fun onCreate(savedInstanceState: Bundle?) {
- mSurveyList = ArrayList()
- super.onCreate(savedInstanceState)
- }
-
- override fun onCreateView(
- inflater: LayoutInflater,
- container: ViewGroup?,
- savedInstanceState: Bundle?
- ): View {
- binding = DialogFragmentSyncSurveysBinding.inflate(inflater, container, false)
- viewModel = ViewModelProvider(this)[SyncSurveysDialogViewModel::class.java]
- //Start Syncing Surveys
- if (isOnline && userStatus == Constants.USER_ONLINE) {
- viewModel.loadSurveyList()
- } else {
- showNetworkIsNotAvailable()
- fragmentManager?.popBackStack()
- }
-
- viewModel.syncSurveysDialogUiState.observe(viewLifecycleOwner) {
- when (it) {
- is SyncSurveysDialogUiState.DismissDialog -> hideDialog()
- is SyncSurveysDialogUiState.SetQuestionSyncProgressBarMax -> {
- showProgressbar(false)
- setQuestionSyncProgressBarMax(it.total)
- }
-
- is SyncSurveysDialogUiState.SetResponseSyncProgressBarMax -> {
- showProgressbar(false)
- setResponseSyncProgressBarMax(it.total)
- }
-
- is SyncSurveysDialogUiState.ShowError -> {
- showProgressbar(false)
- showError(it.message)
- }
-
- is SyncSurveysDialogUiState.ShowNetworkIsNotAvailable -> {
- showProgressbar(false)
- showNetworkIsNotAvailable()
- }
-
- is SyncSurveysDialogUiState.ShowProgressbar -> showProgressbar(true)
- is SyncSurveysDialogUiState.ShowSurveysSyncSuccessfully -> {
- showProgressbar(false)
- showSurveysSyncSuccessfully()
- }
-
- is SyncSurveysDialogUiState.ShowSyncedFailedSurveys -> {
- showProgressbar(false)
- showSyncedFailedSurveys(it.failedCount)
- }
-
- is SyncSurveysDialogUiState.ShowSyncingSurvey -> {
- showProgressbar(false)
- showSyncingSurvey(it.surveyName)
- }
-
- is SyncSurveysDialogUiState.ShowUI -> {
- showProgressbar(false)
- showUI()
- }
-
- is SyncSurveysDialogUiState.UpdateQuestionSyncProgressBar -> {
- showProgressbar(false)
- updateQuestionSyncProgressBar(it.index)
- }
-
- is SyncSurveysDialogUiState.UpdateResponseSyncProgressBar -> {
- showProgressbar(false)
- updateResponseSyncProgressBar(it.index)
- }
-
- is SyncSurveysDialogUiState.UpdateSingleSyncSurveyProgressBar -> {
- showProgressbar(false)
- updateSingleSyncSurveyProgressBar(it.index)
- }
-
- is SyncSurveysDialogUiState.UpdateSurveyList -> {
- showProgressbar(false)
- updateSurveyList(it.surveys)
- }
-
- is SyncSurveysDialogUiState.UpdateTotalSyncSurveyProgressBarAndCount -> {
- showProgressbar(false)
- updateTotalSyncSurveyProgressBarAndCount(it.total)
- }
-
- SyncSurveysDialogUiState.Initial -> Unit
- }
- }
-
- return binding.root
- }
-
- override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
- super.onViewCreated(view, savedInstanceState)
-
- binding.btnCancel.setOnClickListener {
- onClickCancelButton()
- }
-
- binding.btnHide.setOnClickListener {
- onClickHideButton()
- }
- }
-
- private fun onClickCancelButton() {
- dismissDialog()
- }
-
- private fun onClickHideButton() {
- if (binding.btnHide.text == resources.getString(R.string.dialog_action_ok)) {
- dismissDialog()
- } else {
- hideDialog()
- }
- }
-
- private fun updateSurveyList(surveyList: List) {
- mSurveyList = surveyList
- }
-
- private fun showUI() {
- binding.pbTotalSyncSurvey.max = mSurveyList!!.size
- val totalSurveys = mSurveyList!!.size.toString() + resources.getString(R.string.space) +
- resources.getString(R.string.surveys)
- binding.tvTotalSurveys.text = totalSurveys
- binding.tvSyncFailed.text = 0.toString()
- }
-
- private fun showSyncingSurvey(surveyName: String?) {
- binding.tvSyncingSurvey.text = surveyName
- binding.tvSurveyName.text = surveyName
- }
-
- private fun showSyncedFailedSurveys(failedCount: Int) {
- binding.tvSyncFailed.text = failedCount.toString()
- }
-
- private fun setQuestionSyncProgressBarMax(count: Int) {
- binding.pbSyncQuestion.max = count
- }
-
- private fun setResponseSyncProgressBarMax(count: Int) {
- binding.pbSyncResponse.max = count
- }
-
- private fun updateSingleSyncSurveyProgressBar(count: Int) {
- binding.pbSyncSurvey.progress = count
- }
-
- private fun updateQuestionSyncProgressBar(i: Int) {
- binding.pbSyncQuestion.progress = i
- }
-
- private fun updateResponseSyncProgressBar(i: Int) {
- binding.pbSyncResponse.progress = i
- }
-
- private fun updateTotalSyncSurveyProgressBarAndCount(count: Int) {
- binding.pbTotalSyncSurvey.progress = count
- val totalSyncCount = resources
- .getString(R.string.space) + count + resources
- .getString(R.string.slash) + mSurveyList!!.size
- binding.tvTotalProgress.text = totalSyncCount
- }
-
- private var maxSingleSyncSurveyProgressBar: Int
- get() = binding.pbSyncSurvey.max
- set(total) {
- binding.pbSyncSurvey.max = total
- }
-
- private fun showNetworkIsNotAvailable() {
- Toast.makeText(
- activity,
- resources.getString(R.string.error_network_not_available),
- Toast.LENGTH_SHORT
- ).show()
- }
-
- private fun showSurveysSyncSuccessfully() {
- binding.btnCancel.visibility = View.INVISIBLE
- dismissDialog()
- Toast.makeText(activity, R.string.sync_success, Toast.LENGTH_SHORT).show()
- }
-
- private val isOnline: Boolean
- get() = activity?.let { isOnline(it) } == true
-
- private fun dismissDialog() {
- dialog?.dismiss()
- }
-
- private fun showDialog() {
- dialog?.show()
- }
-
- private fun hideDialog() {
- dialog?.hide()
- }
-
- private fun showError(s: String) {
- show(binding.root, s)
- }
-
- private fun showProgressbar(b: Boolean) {}
-
- companion object {
- val LOG_TAG = SyncSurveysDialogFragment::class.java.simpleName
- fun newInstance(): SyncSurveysDialogFragment {
- val syncSurveysDialogFragment = SyncSurveysDialogFragment()
- val args = Bundle()
- syncSurveysDialogFragment.arguments = args
- return syncSurveysDialogFragment
- }
- }
-}
- */
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/module/ApplicationModule.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/module/ApplicationModule.kt
deleted file mode 100644
index ed414912e82..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/module/ApplicationModule.kt
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.mifos.mifosxdroid.injection.module
-
-import android.content.Context
-import com.mifos.utils.NetworkUtilsWrapper
-import dagger.Module
-import dagger.Provides
-import dagger.hilt.InstallIn
-import dagger.hilt.android.qualifiers.ApplicationContext
-import dagger.hilt.components.SingletonComponent
-import javax.inject.Singleton
-
-
-/**
- * @author Rajan Maurya
- * Provide application-level dependencies.
- */
-@Module
-@InstallIn(SingletonComponent::class)
-class ApplicationModule {
-
- @Provides
- @Singleton
- fun provideNetworkUtilsWrapper(@ApplicationContext context: Context): NetworkUtilsWrapper {
- return NetworkUtilsWrapper(context)
- }
-
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/module/RepositoryModule.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/module/RepositoryModule.kt
index 4e8ecf40e02..3e332ea1c34 100644
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/module/RepositoryModule.kt
+++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/module/RepositoryModule.kt
@@ -1,5 +1,6 @@
package com.mifos.mifosxdroid.injection.module
+import com.mifos.core.data.repository.CenterListRepository
import com.mifos.core.data.repository.CreateNewClientRepository
import com.mifos.core.data.repository.DocumentDialogRepository
import com.mifos.core.data.repository.NoteRepository
@@ -17,6 +18,7 @@ import com.mifos.core.data.repository.SyncGroupPayloadsRepository
import com.mifos.core.data.repository.SyncGroupsDialogRepository
import com.mifos.core.data.repository.SyncLoanRepaymentTransactionRepository
import com.mifos.core.data.repository.SyncSavingsAccountTransactionRepository
+import com.mifos.core.data.repositoryImp.CenterListRepositoryImp
import com.mifos.core.data.repositoryImp.CreateNewClientRepositoryImp
import com.mifos.core.data.repositoryImp.DocumentDialogRepositoryImp
import com.mifos.core.data.repositoryImp.NoteRepositoryImp
@@ -46,8 +48,6 @@ import com.mifos.core.network.datamanager.DataManagerStaff
import com.mifos.core.network.datamanager.DataManagerSurveys
import com.mifos.feature.settings.syncSurvey.SyncSurveysDialogRepository
import com.mifos.feature.settings.syncSurvey.SyncSurveysDialogRepositoryImp
-import com.mifos.mifosxdroid.online.centerlist.CenterListRepository
-import com.mifos.mifosxdroid.online.centerlist.CenterListRepositoryImp
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
@@ -61,12 +61,6 @@ import dagger.hilt.components.SingletonComponent
@InstallIn(SingletonComponent::class)
class RepositoryModule {
-
- @Provides
- fun providesCenterListRepository(dataManagerCenter: DataManagerCenter): CenterListRepository {
- return CenterListRepositoryImp(dataManagerCenter)
- }
-
@Provides
fun providesSavingsAccountSummaryRepository(dataManagerSavings: DataManagerSavings): SavingsAccountSummaryRepository {
return SavingsAccountSummaryRepositoryImp(dataManagerSavings)
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/CentersActivity.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/CentersActivity.kt
deleted file mode 100755
index e69de29bb2d..00000000000
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/centerdetails/CenterDetailsFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/centerdetails/CenterDetailsFragment.kt
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/centerlist/CenterListRepository.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/centerlist/CenterListRepository.kt
deleted file mode 100644
index e0c9448df7d..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/centerlist/CenterListRepository.kt
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.mifos.mifosxdroid.online.centerlist
-
-import com.mifos.core.objects.client.Page
-import com.mifos.core.objects.group.Center
-import com.mifos.core.objects.group.CenterWithAssociations
-import rx.Observable
-
-/**
- * Created by Aditya Gupta on 06/08/23.
- */
-interface CenterListRepository {
-
- fun getCenters(paged: Boolean, offset: Int, limit: Int): Observable>
-
- suspend fun getCentersGroupAndMeeting(id: Int): CenterWithAssociations
-
- fun allDatabaseCenters(): Observable>
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/centerlist/CenterListRepositoryImp.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/centerlist/CenterListRepositoryImp.kt
deleted file mode 100644
index 2d757b565b1..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/centerlist/CenterListRepositoryImp.kt
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.mifos.mifosxdroid.online.centerlist
-
-import com.mifos.core.network.datamanager.DataManagerCenter
-import com.mifos.core.objects.client.Page
-import com.mifos.core.objects.group.Center
-import com.mifos.core.objects.group.CenterWithAssociations
-import rx.Observable
-import javax.inject.Inject
-
-/**
- * Created by Aditya Gupta on 06/08/23.
- */
-class CenterListRepositoryImp @Inject constructor(private val dataManagerCenter: DataManagerCenter) :
- CenterListRepository {
-
- override fun getCenters(paged: Boolean, offset: Int, limit: Int): Observable> {
- return dataManagerCenter.getCenters(paged, offset, limit)
- }
-
- override suspend fun getCentersGroupAndMeeting(id: Int): CenterWithAssociations {
- return dataManagerCenter.getCentersGroupAndMeeting(id)
- }
-
- override fun allDatabaseCenters(): Observable> {
- return dataManagerCenter.allDatabaseCenters
- }
-
-
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/centerlist/CenterListUiState.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/centerlist/CenterListUiState.kt
deleted file mode 100644
index 4aa53ee2acf..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/centerlist/CenterListUiState.kt
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.mifos.mifosxdroid.online.centerlist
-
-import com.mifos.core.objects.group.Center
-import com.mifos.core.objects.group.CenterWithAssociations
-
-/**
- * Created by Aditya Gupta on 06/08/23.
- */
-sealed class CenterListUiState {
-
- data class ShowProgressbar(val state: Boolean) : CenterListUiState()
-
- data class ShowMessage(val message: Int) : CenterListUiState()
-
- object ShowFetchingError : CenterListUiState()
-
- object UnregisterSwipeAndScrollListener : CenterListUiState()
-
- data class ShowEmptyCenters(val message: Int) : CenterListUiState()
-
- data class ShowMoreCenters(val centers: List
) : CenterListUiState()
-
- data class ShowCenters(val centers: List
) : CenterListUiState()
-
- data class ShowCentersGroupAndMeeting(
- val centerWithAssociations: CenterWithAssociations?,
- val id: Int
- ) : CenterListUiState()
-
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/centerlist/CenterListViewModel.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/centerlist/CenterListViewModel.kt
deleted file mode 100644
index fbdcc39efa9..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/centerlist/CenterListViewModel.kt
+++ /dev/null
@@ -1,168 +0,0 @@
-package com.mifos.mifosxdroid.online.centerlist
-
-import androidx.lifecycle.LiveData
-import androidx.lifecycle.MutableLiveData
-import androidx.lifecycle.ViewModel
-import androidx.lifecycle.viewModelScope
-import com.mifos.core.objects.client.Page
-import com.mifos.core.objects.group.Center
-import com.mifos.mifosxdroid.R
-import dagger.hilt.android.lifecycle.HiltViewModel
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.launch
-import rx.Subscriber
-import rx.android.schedulers.AndroidSchedulers
-import rx.schedulers.Schedulers
-import javax.inject.Inject
-
-/**
- * Created by Aditya Gupta on 06/08/23.
- */
-@HiltViewModel
-class CenterListViewModel @Inject constructor(private val repository: CenterListRepository) :
- ViewModel() {
-
- private val _centerListUiState = MutableLiveData()
- val centerListUiState: LiveData
- get() = _centerListUiState
-
- private var mDbCenterList: List
= ArrayList()
- private var mSyncCenterList: List
= ArrayList()
- private val limit = 100
- private var loadmore = false
- private var mRestApiCenterSyncStatus = false
- private var mDatabaseCenterSyncStatus = false
-
- /**
- * This Method for loading the first 100 centers.
- *
- * @param loadmore
- * @param offset
- */
- fun loadCenters(loadmore: Boolean, offset: Int) {
- this.loadmore = loadmore
- loadCenters(true, offset, limit)
- }
-
- /**
- * This Method For showing Center List in UI.
- *
- * @param centers
- */
- fun showCenters(centers: List
) {
- if (loadmore) {
- _centerListUiState.value = CenterListUiState.ShowMoreCenters(centers)
- } else {
- _centerListUiState.value = CenterListUiState.ShowCenters(centers)
- }
- }
-
- /**
- * Setting CenterSync Status True when mRestApiCenterSyncStatus && mDatabaseCenterSyncStatus
- * are true.
- */
- fun setAlreadyCenterSyncStatus() {
- if (mRestApiCenterSyncStatus && mDatabaseCenterSyncStatus) {
- showCenters(checkCenterAlreadySyncedOrNot(mSyncCenterList))
- }
- }
-
- /**
- * @param paged True Enabling the Pagination of the API
- * @param offset Value given from which position Center List will be fetched.
- * @param limit Number of Centers to fetch.
- */
- private fun loadCenters(paged: Boolean, offset: Int, limit: Int) {
- _centerListUiState.value = CenterListUiState.ShowProgressbar(true)
- repository.getCenters(paged, offset, limit)
- .observeOn(AndroidSchedulers.mainThread())
- .subscribeOn(Schedulers.io())
- .subscribe(object : Subscriber>() {
- override fun onCompleted() {}
- override fun onError(e: Throwable) {
- if (loadmore) {
- _centerListUiState.value =
- CenterListUiState.ShowMessage(R.string.failed_to_fetch_centers)
- } else {
- _centerListUiState.value = CenterListUiState.ShowFetchingError
- }
- }
-
- override fun onNext(centerPage: Page
) {
- mSyncCenterList = centerPage.pageItems
- if (mSyncCenterList.isEmpty() && !loadmore) {
- _centerListUiState.value =
- CenterListUiState.ShowEmptyCenters(R.string.center)
- _centerListUiState.value =
- CenterListUiState.UnregisterSwipeAndScrollListener
- } else if (mSyncCenterList.isEmpty() && loadmore) {
- _centerListUiState.value =
- CenterListUiState.ShowMessage(R.string.no_more_centers_available)
- } else {
- showCenters(mSyncCenterList)
- mRestApiCenterSyncStatus = true
- setAlreadyCenterSyncStatus()
- }
- }
- })
- }
-
- fun loadCentersGroupAndMeeting(id: Int) = viewModelScope.launch(Dispatchers.IO) {
- _centerListUiState.value = CenterListUiState.ShowProgressbar(true)
- try {
- val centerWithAssociations = repository.getCentersGroupAndMeeting(id)
- _centerListUiState.value =
- CenterListUiState.ShowCentersGroupAndMeeting(centerWithAssociations, id)
- } catch (exception: Exception) {
- _centerListUiState.value =
- CenterListUiState.ShowMessage(R.string.failed_to_fetch_Group_and_meeting)
- }
- }
-
- /**
- * This Method Loading the Center From Database. It request Observable to DataManagerCenter
- * and DataManagerCenter Request to DatabaseHelperCenter to load the Center List Page from the
- * Center_Table and As the Center List Page is loaded DataManagerCenter gives the Center List
- * Page after getting response from DatabaseHelperCenter
- */
- fun loadDatabaseCenters() {
- repository.allDatabaseCenters()
- .observeOn(AndroidSchedulers.mainThread())
- .subscribeOn(Schedulers.io())
- .subscribe(object : Subscriber>() {
- override fun onCompleted() {}
- override fun onError(e: Throwable) {
- _centerListUiState.value =
- CenterListUiState.ShowMessage(R.string.failed_to_load_db_centers)
- }
-
- override fun onNext(centerPage: Page
) {
- mDatabaseCenterSyncStatus = true
- mDbCenterList = centerPage.pageItems
- setAlreadyCenterSyncStatus()
- }
- })
- }
-
- /**
- * This Method Filtering the Centers Loaded from Server is already sync or not. If yes the
- * put the center.setSync(true) and view will show those centers as sync already to user
- *
- * @param
- * @return Page
-
*/
- private fun checkCenterAlreadySyncedOrNot(centers: List
): List
{
- if (mDbCenterList.isNotEmpty()) {
- for (dbCenter in mDbCenterList) {
- for (syncCenter in centers) {
- if (dbCenter.id == syncCenter.id) {
- syncCenter.sync = true
- break
- }
- }
- }
- }
- return centers
- }
-
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/checkerinbox/CheckerInboxPendingTasksActivity.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/checkerinbox/CheckerInboxPendingTasksActivity.kt
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loanaccount/LoanAccountFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loanaccount/LoanAccountFragment.kt
deleted file mode 100644
index dab99e2d06b..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loanaccount/LoanAccountFragment.kt
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * This project is licensed under the open source MPL V2.
- * See https://github.com/openMF/android-client/blob/master/LICENSE.md
- */
-package com.mifos.mifosxdroid.online.loanaccount
-
-import android.os.Bundle
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import androidx.appcompat.app.AppCompatActivity
-import androidx.compose.ui.platform.ComposeView
-import androidx.fragment.app.Fragment
-import androidx.navigation.findNavController
-import com.mifos.core.data.LoansPayload
-import com.mifos.core.objects.noncore.DataTable
-import com.mifos.feature.loan.loanAccount.LoanAccountScreen
-import dagger.hilt.android.AndroidEntryPoint
-
-/**
- * Created by nellyk on 1/22/2016.
- *
- *
- * Use this Fragment to Create and/or Update loan
- */
-@AndroidEntryPoint
-class LoanAccountFragment : Fragment() {
-
-// private val arg: LoanAccountFragmentArgs by navArgs()
- private var clientId = 0
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
-// clientId = arg.clientId
- }
-
- override fun onCreateView(
- inflater: LayoutInflater,
- container: ViewGroup?,
- savedInstanceState: Bundle?
- ): View {
- return ComposeView(requireActivity()).apply {
- setContent {
- LoanAccountScreen(
-// clientId = clientId,
- onBackPressed = {
- findNavController().popBackStack()
- }, dataTable = { dataTables, loansPayload ->
- dataTables(dataTables, loansPayload)
- }
- )
- }
- }
- }
-
- override fun onResume() {
- super.onResume()
- (requireActivity() as AppCompatActivity).supportActionBar?.hide()
- }
-
- override fun onStop() {
- super.onStop()
- (requireActivity() as AppCompatActivity).supportActionBar?.show()
- }
-
- private fun dataTables(dataTables: List, loansPayload: LoansPayload) {
-// val fragment = DataTableListFragment.newInstance(
-// dataTables,
-// loansPayload, Constants.CLIENT_LOAN
-// )
-// val fragmentTransaction = requireActivity().supportFragmentManager
-// .beginTransaction()
-// fragmentTransaction.addToBackStack(FragmentConstants.DATA_TABLE_LIST)
-// fragmentTransaction.replace(R.id.container, fragment).commit()
- }
-
-// private fun submit() {
-// val loansPayload = LoansPayload()
-// loansPayload.allowPartialPeriodInterestCalcualtion = binding.cbCalculateinterest
-// .isChecked
-// loansPayload.amortizationType = amortizationTypeId
-// loansPayload.clientId = clientId
-// loansPayload.dateFormat = "dd MMMM yyyy"
-// loansPayload.expectedDisbursementDate = disbursementDate
-// loansPayload.interestCalculationPeriodType = interestCalculationPeriodTypeId
-// loansPayload.loanType = "individual"
-// loansPayload.locale = "en"
-// loansPayload.numberOfRepayments =
-// binding.etNumberofrepayments.editableText.toString().toInt()
-// loansPayload.principal = binding.etPrincipal.editableText.toString().toDouble()
-// loansPayload.productId = productId
-// loansPayload.repaymentEvery = binding.etRepaidevery.editableText.toString().toInt()
-// loansPayload.submittedOnDate = submissionDate
-// loansPayload.loanPurposeId = loanPurposeId
-// loansPayload.loanTermFrequency = binding.etLoanterm.editableText.toString().toInt()
-// loansPayload.loanTermFrequencyType = loanTermFrequency
-//
-// //loanTermFrequencyType and repaymentFrequencyType should be the same.
-// loansPayload.repaymentFrequencyType = loanTermFrequency
-// loansPayload.repaymentFrequencyDayOfWeekType =
-// if (repaymentFrequencyDayOfWeek != null) repaymentFrequencyDayOfWeek else null
-// loansPayload.repaymentFrequencyNthDayType =
-// if (repaymentFrequencyNthDayType != null) repaymentFrequencyNthDayType else null
-// loansPayload.transactionProcessingStrategyId = transactionProcessingStrategyId
-// loansPayload.fundId = fundId
-// loansPayload.interestType = interestTypeId
-// loansPayload.loanOfficerId = loanOfficerId
-// loansPayload.linkAccountId = linkAccountId
-// interestRatePerPeriod =
-// binding.etNominalInterestRate.editableText.toString().toDouble()
-// loansPayload.interestRatePerPeriod = interestRatePerPeriod
-// if (hasDataTables) {
-// val fragment = DataTableListFragment.newInstance(
-// mLoanTemplate.dataTables,
-// loansPayload, Constants.CLIENT_LOAN
-// )
-// val fragmentTransaction = requireActivity().supportFragmentManager
-// .beginTransaction()
-// fragmentTransaction.addToBackStack(FragmentConstants.DATA_TABLE_LIST)
-// fragmentTransaction.replace(R.id.container, fragment).commit()
-// } else {
-// initiateLoanCreation(loansPayload)
-// }
-// }
-
-
-// override fun onItemSelected(parent: AdapterView<*>, view: View, position: Int, id: Long) {
-// when (parent.id) {
-// R.id.sp_lproduct -> {
-// productId = mLoanProducts[position].id
-// inflateLoanPurposeSpinner()
-// }
-//
-// R.id.sp_loan_purpose -> loanPurposeId = mLoanTemplate.loanPurposeOptions[position].id
-// R.id.sp_amortization -> amortizationTypeId =
-// mLoanTemplate.amortizationTypeOptions[position].id
-//
-// R.id.sp_interestcalculationperiod -> interestCalculationPeriodTypeId = mLoanTemplate
-// .interestCalculationPeriodTypeOptions[position].id
-//
-// R.id.sp_repaymentstrategy -> transactionProcessingStrategyId = mLoanTemplate
-// .transactionProcessingStrategyOptions[position].id
-//
-// R.id.sp_payment_periods -> {
-// loanTermFrequency = mLoanTemplate.termFrequencyTypeOptions[position]
-// .id
-// loanTermFrequency?.let { binding.spLoanTermPeriods.setSelection(it) }
-// if (loanTermFrequency == 2) {
-// // Show and inflate Nth day and week spinners
-// showHideRepaidMonthSpinners(View.VISIBLE)
-// inflateRepaidMonthSpinners()
-// } else {
-// showHideRepaidMonthSpinners(View.GONE)
-// }
-// }
-//
-// R.id.sp_loan_term_periods -> {
-// loanTermFrequency = mLoanTemplate.termFrequencyTypeOptions[position]
-// .id
-// loanTermFrequency?.let { binding.spPaymentPeriods.setSelection(it) }
-// if (loanTermFrequency == 2) {
-// // Show and inflate Nth day and week spinners
-// showHideRepaidMonthSpinners(View.VISIBLE)
-// inflateRepaidMonthSpinners()
-// } else {
-// showHideRepaidMonthSpinners(View.GONE)
-// }
-// }
-//
-// R.id.sp_repayment_freq_nth_day -> repaymentFrequencyNthDayType =
-// if (mListRepaymentFrequencyNthDayTypeOptions[position]
-// == resources.getString(R.string.select_week_hint)
-// ) {
-// null
-// } else {
-// mLoanTemplate
-// .repaymentFrequencyNthDayTypeOptions[position].id
-// }
-//
-// R.id.sp_repayment_freq_day_of_week -> repaymentFrequencyDayOfWeek =
-// if (mListRepaymentFrequencyDayOfWeekTypeOptions[position]
-// == resources.getString(R.string.select_day_hint)
-// ) {
-// null
-// } else {
-// mLoanTemplate
-// .repaymentFrequencyDaysOfWeekTypeOptions[position].id
-// }
-//
-// R.id.sp_fund -> fundId = mLoanTemplate.fundOptions[position].id
-// R.id.sp_loan_officer -> loanOfficerId = mLoanTemplate.loanOfficerOptions[position].id
-// R.id.sp_interest_type -> interestTypeId = mLoanTemplate.interestTypeOptions[position].id
-// R.id.sp_linking_options -> linkAccountId = if (mListAccountLinkingOptions[position]
-// == resources.getString(R.string.select_linkage_account_hint)
-// ) {
-// null
-// } else {
-// mLoanTemplate.accountLinkingOptions[position].id
-// }
-// }
-// }
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/surveysubmit/SurveySubmitFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/surveysubmit/SurveySubmitFragment.kt
deleted file mode 100755
index 67642cfb605..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/surveysubmit/SurveySubmitFragment.kt
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * This project is licensed under the open source MPL V2.
- * See https://github.com/openMF/android-client/blob/master/LICENSE.md
- */
-package com.mifos.mifosxdroid.online.surveysubmit
-
-/*
-import android.app.Activity
-import android.content.Context
-import android.os.Bundle
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import android.widget.Toast
-import androidx.lifecycle.ViewModelProvider
-import com.mifos.core.objects.survey.Scorecard
-import com.mifos.mifosxdroid.R
-import com.mifos.mifosxdroid.core.MifosBaseFragment
-import com.mifos.mifosxdroid.databinding.FragmentSurveyLastBinding
-import com.mifos.mifosxdroid.online.surveyquestion.Communicator
-import com.mifos.mifosxdroid.online.surveyquestion.SurveyQuestionActivity
-import dagger.hilt.android.AndroidEntryPoint
-
-/**
- * Created by Nasim Banu on 28,January,2016.
- */
-@AndroidEntryPoint
-class SurveySubmitFragment : MifosBaseFragment(), Communicator {
-
- private lateinit var binding: FragmentSurveyLastBinding
-
- private lateinit var viewModel: SurveySubmitViewModel
-
- private var mDetachFragment: DisableSwipe? = null
- private var mScorecard: Scorecard? = null
- private var mSurveyId = 0
-
- override fun onCreateView(
- inflater: LayoutInflater, container: ViewGroup?,
- savedInstanceState: Bundle?
- ): View {
- binding = FragmentSurveyLastBinding.inflate(inflater, container, false)
- viewModel = ViewModelProvider(this)[SurveySubmitViewModel::class.java]
-
- viewModel.surveySubmitUiState.observe(viewLifecycleOwner) {
- when (it) {
- is SurveySubmitUiState.ShowError -> {
- showProgressbar(false)
- showError(it.message)
- }
-
- is SurveySubmitUiState.ShowProgressbar -> showProgressbar(true)
-
- is SurveySubmitUiState.ShowSurveySubmittedSuccessfully -> {
- showProgressbar(false)
- showSurveySubmittedSuccessfully(it.scorecard)
- }
- }
- }
-
- return binding.root
- }
-
- override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
- super.onViewCreated(view, savedInstanceState)
-
- binding.btnSubmit.setOnClickListener {
- submitScore()
- }
- }
-
- override fun passScoreCardData(scorecard: Scorecard, surveyId: Int) {
- mScorecard = scorecard
- mSurveyId = surveyId
- if (isAdded) {
- val submitText = resources.getString(R.string.attempt_question) +
- mScorecard?.scorecardValues?.size
- binding.surveySubmitTextView.text = submitText
- binding.btnSubmit.text = resources.getString(R.string.submit_survey)
- }
- }
-
- private fun submitScore() {
- if ((mScorecard?.scorecardValues?.size ?: 0) >= 1) {
- mDetachFragment?.disableSwipe()
- binding.btnSubmit.text = resources.getString(R.string.submitting_surveys)
- binding.btnSubmit.isEnabled = false
- binding.btnSubmit.visibility = View.GONE
- viewModel.submitSurvey(mSurveyId, mScorecard)
- } else {
- Toast.makeText(
- context, resources
- .getString(R.string.please_attempt_atleast_one_question), Toast.LENGTH_SHORT
- )
- .show()
- }
- }
-
- private fun showSurveySubmittedSuccessfully(scorecard: Scorecard?) {
- Toast.makeText(
- context, resources.getString(R.string.scorecard_created_successfully),
- Toast.LENGTH_LONG
- ).show()
- binding.surveySubmitTextView.text =
- resources.getString(R.string.survey_successfully_submitted)
- binding.btnSubmit.visibility = View.GONE
- }
-
- private fun showError(errorMessage: String) {
- Toast.makeText(context, errorMessage, Toast.LENGTH_LONG).show()
- binding.surveySubmitTextView.text = resources.getString(R.string.error_submitting_survey)
- binding.btnSubmit.visibility = View.GONE
- }
-
- private fun showProgressbar(b: Boolean) {
- if (b) {
- showMifosProgressBar()
- } else {
- hideMifosProgressBar()
- }
- }
-
- override fun onAttach(context: Context) {
- super.onAttach(context)
- (context as SurveyQuestionActivity).fragmentCommunicator = this
- val activity = context as Activity
- mDetachFragment = try {
- activity as DisableSwipe
- } catch (e: ClassCastException) {
- throw ClassCastException(
- activity.toString()
- + " must implement OnAnswerSelectedListener"
- )
- }
- }
-
- interface DisableSwipe {
- fun disableSwipe()
- }
-
- companion object {
- @JvmStatic
- fun newInstance(): SurveySubmitFragment {
- val fragment = SurveySubmitFragment()
- val bundle = Bundle()
- fragment.arguments = bundle
- return fragment
- }
- }
-}
- */
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/uihelpers/MFDatePicker.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/uihelpers/MFDatePicker.kt
deleted file mode 100644
index cc83a09147e..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/uihelpers/MFDatePicker.kt
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * This project is licensed under the open source MPL V2.
- * See https://github.com/openMF/android-client/blob/master/LICENSE.md
- */
-package com.mifos.mifosxdroid.uihelpers
-
-import android.app.DatePickerDialog
-import android.app.DatePickerDialog.OnDateSetListener
-import android.app.Dialog
-import android.os.Bundle
-import android.text.format.DateFormat
-import android.widget.DatePicker
-import androidx.fragment.app.DialogFragment
-import androidx.fragment.app.Fragment
-import com.mifos.mifosxdroid.R
-import java.util.Calendar
-import java.util.Date
-
-/**
- * Created by ishankhanna on 30/06/14.
- */
-class MFDatePicker : DialogFragment(), OnDateSetListener {
- var onDatePickListener: OnDatePickListener? = null
- override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
- val dialog = DatePickerDialog(
- requireActivity(),
- R.style.MaterialDatePickerTheme,
- this, calendar!![Calendar.YEAR],
- calendar!![Calendar.MONTH],
- calendar!![Calendar.DAY_OF_MONTH]
- )
- dialog.datePicker.minDate = Date().time
- return dialog
- }
-
- override fun onDateSet(datePicker: DatePicker, year: Int, month: Int, day: Int) {
- val calendar = Calendar.getInstance()
- calendar[year, month] = day
- val date = calendar.time
- onDatePickListener!!.onDatePicked(DateFormat.format("dd-MM-yyyy", date).toString())
- }
-
- fun setCustomOnDatePickListener(onDatePickListener: OnDatePickListener?) {
- this.onDatePickListener = onDatePickListener
- }
-
- interface OnDatePickListener {
- fun onDatePicked(date: String?)
- }
-
- companion object {
- const val TAG = "MFDatePicker"
- var datePickedAsString: String? = null
- var calendar: Calendar? = null
-
- init {
- calendar = Calendar.getInstance()
- datePickedAsString = DateFormat.format("dd-MM-yyyy", calendar?.time).toString()
- }
-
- @JvmStatic
- fun newInsance(fragment: Fragment?): MFDatePicker {
- val mfDatePicker = MFDatePicker()
- mfDatePicker.onDatePickListener = fragment as OnDatePickListener?
- return mfDatePicker
- }
- }
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/views/CircularImageView.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/views/CircularImageView.kt
deleted file mode 100644
index 31a688486aa..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/views/CircularImageView.kt
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * This project is licensed under the open source MPL V2.
- * See https://github.com/openMF/android-client/blob/master/LICENSE.md
- */
-package com.mifos.mifosxdroid.views
-
-import android.content.Context
-import android.graphics.Bitmap
-import android.graphics.BitmapShader
-import android.graphics.Canvas
-import android.graphics.Color
-import android.graphics.Paint
-import android.graphics.Shader
-import android.graphics.drawable.BitmapDrawable
-import android.graphics.drawable.Drawable
-import android.util.AttributeSet
-import androidx.appcompat.widget.AppCompatImageView
-import com.mifos.mifosxdroid.R
-
-
-/**
- * @author fomenkoo
- */
-class CircularImageView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
- AppCompatImageView(context, attrs) {
- private var borderWidth = width
- private var canvasSize = width
- private var image: Bitmap? = null
- private val paint: Paint = Paint()
- private val paintBorder: Paint?
-
- init {
-
- // init paint
- paint.isAntiAlias = true
- paintBorder = Paint()
- paintBorder.isAntiAlias = true
-
- // load the styled attributes and set their properties
- val attributes = context.obtainStyledAttributes(attrs, R.styleable.CircularImageView)
- if (attributes.getBoolean(R.styleable.CircularImageView_border, true)) {
- val defaultBorderSize =
- (4 * getContext().resources.displayMetrics.density + 0.5f).toInt()
- setBorderWidth(
- attributes.getDimensionPixelOffset(
- R.styleable.CircularImageView_border_width,
- defaultBorderSize
- )
- )
- setBorderColor(
- attributes.getColor(
- R.styleable.CircularImageView_border_color,
- Color.WHITE
- )
- )
- }
- if (attributes.getBoolean(R.styleable.CircularImageView_shadow, false)) addShadow()
- }
-
- private fun setBorderWidth(borderWidth: Int) {
- this.borderWidth = borderWidth
- requestLayout()
- this.invalidate()
- }
-
- private fun setBorderColor(borderColor: Int) {
- if (paintBorder != null) paintBorder.color = borderColor
- this.invalidate()
- }
-
- private fun addShadow() {
- setLayerType(LAYER_TYPE_SOFTWARE, paintBorder)
- paintBorder!!.setShadowLayer(4.0f, 0.0f, 2.0f, Color.BLACK)
- }
-
- public override fun onDraw(canvas: Canvas) {
- // load the bitmap
- image = drawableToBitmap(drawable)
-
- // init shader
- if (image != null) {
- canvasSize = width
- if (height < canvasSize) canvasSize = height
- val shader = BitmapShader(
- Bitmap.createScaledBitmap(
- image!!, canvasSize,
- canvasSize, false
- ), Shader.TileMode.CLAMP, Shader.TileMode.CLAMP
- )
- paint.shader = shader
-
- // circleCenter is the x or y of the view's center
- // radius is the radius in pixels of the cirle to be drawn
- // paint contains the shader that will texture the shape
- val circleCenter = (canvasSize - (borderWidth * 2)) / 2
- canvas.drawCircle(
- (circleCenter + borderWidth).toFloat(),
- (circleCenter + borderWidth).toFloat(),
- ((canvasSize - (borderWidth * 2)) / 2) + borderWidth - 4.0f,
- paintBorder!!
- )
- canvas.drawCircle(
- (circleCenter + borderWidth).toFloat(),
- (circleCenter + borderWidth).toFloat(),
- ((canvasSize - (borderWidth * 2)) / 2) - 4.0f,
- paint
- )
- }
- }
-
- override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
- val width = measureWidth(widthMeasureSpec)
- val height = measureHeight(heightMeasureSpec)
- setMeasuredDimension(width, height)
- }
-
- private fun measureWidth(measureSpec: Int): Int {
- var result = 0
- val specMode = MeasureSpec.getMode(measureSpec)
- val specSize = MeasureSpec.getSize(measureSpec)
- result = when (specMode) {
- MeasureSpec.EXACTLY -> {
- // The parent has determined an exact size for the child.
- specSize
- }
-
- MeasureSpec.AT_MOST -> {
- // The child can be as large as it wants up to the specified size.
- specSize
- }
-
- else -> {
- // The parent has not imposed any constraint on the child.
- canvasSize
- }
- }
- return result
- }
-
- private fun measureHeight(measureSpecHeight: Int): Int {
- var result = 0
- val specMode = MeasureSpec.getMode(measureSpecHeight)
- val specSize = MeasureSpec.getSize(measureSpecHeight)
- result = when (specMode) {
- MeasureSpec.EXACTLY -> {
- // We were told how big to be
- specSize
- }
-
- MeasureSpec.AT_MOST -> {
- // The child can be as large as it wants up to the specified size.
- specSize
- }
-
- else -> {
- // Measure the text (beware: ascent is a negative number)
- canvasSize
- }
- }
- return result + 2
- }
-
- private fun drawableToBitmap(drawable: Drawable?): Bitmap? {
- if (drawable == null) {
- return null
- } else if (drawable is BitmapDrawable) {
- return drawable.bitmap
- }
- val bitmap: Bitmap = if (drawable.intrinsicWidth > 0 && drawable
- .intrinsicHeight > 0
- ) {
- Bitmap.createBitmap(
- drawable.intrinsicWidth, drawable
- .intrinsicHeight, Bitmap.Config.ARGB_8888
- )
- } else {
- Bitmap.createBitmap(20, 20, Bitmap.Config.ARGB_8888)
- }
- val bitmapScaled = Bitmap.createScaledBitmap(
- bitmap, bitmap.height / 5, bitmap
- .height / 5, true
- )
- val canvas = Canvas(bitmapScaled)
- drawable.setBounds(0, 0, canvas.width, canvas.height)
- drawable.draw(canvas)
- return bitmapScaled
- }
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/views/CustomSpinner.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/views/CustomSpinner.kt
deleted file mode 100644
index 1fb18eb3ad0..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/views/CustomSpinner.kt
+++ /dev/null
@@ -1,96 +0,0 @@
-package com.mifos.mifosxdroid.views
-
-import android.content.Context
-import android.content.res.Resources.Theme
-import android.util.AttributeSet
-import android.widget.Spinner
-import androidx.appcompat.widget.AppCompatSpinner
-
-class CustomSpinner : AppCompatSpinner {
- interface OnSpinnerEventsListener {
- /**
- * Callback triggered when the spinner was opened.
- */
- fun onSpinnerOpened(spinner: Spinner, isItemListLarge: Boolean)
-
- /**
- * Callback triggered when the spinner was closed.
- */
- fun onSpinnerClosed(spinner: Spinner)
- }
-
- private var mListener: OnSpinnerEventsListener? = null
- private var mOpenInitiated = false
- override fun performClick(): Boolean {
- // register that the Spinner was opened so we have a status
- // indicator for when the container holding this Spinner may lose focus
- mOpenInitiated = true
- if (mListener != null) {
- if (super.getAdapter().count >= 10) {
- mListener!!.onSpinnerOpened(this, true)
- return true
- } else {
- mListener!!.onSpinnerOpened(this, false)
- }
- }
- return super.performClick()
- }
-
- override fun onWindowFocusChanged(hasFocus: Boolean) {
- if (hasBeenOpened() && hasFocus) {
- performClosedEvent()
- }
- }
-
- /**
- * Register the listener which will listen for events.
- */
- fun setSpinnerEventsListener(
- onSpinnerEventsListener: OnSpinnerEventsListener?
- ) {
- mListener = onSpinnerEventsListener
- }
-
- /**
- * Propagate the closed Spinner event to the listener from outside if needed.
- */
- private fun performClosedEvent() {
- mOpenInitiated = false
- if (mListener != null) {
- mListener!!.onSpinnerClosed(this)
- }
- }
-
- /**
- * A boolean flag indicating that the Spinner triggered an open event.
- *
- * @return true for opened Spinner
- */
- private fun hasBeenOpened(): Boolean {
- return mOpenInitiated
- }
-
- constructor(context: Context) : super(context) {}
- constructor(context: Context, mode: Int) : super(context, mode) {}
- constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {}
- constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
- context,
- attrs,
- defStyleAttr
- ) {
- }
-
- constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int, mode: Int) : super(
- context,
- attrs,
- defStyleAttr,
- mode
- ) {
- }
-
- constructor(
- context: Context, attrs: AttributeSet?,
- defStyleAttr: Int, mode: Int, popupTheme: Theme?
- ) : super(context, attrs, defStyleAttr, mode, popupTheme) {
- }
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/views/Font.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/views/Font.kt
deleted file mode 100644
index 1f5d0db0773..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/views/Font.kt
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * This project is licensed under the open source MPL V2.
- * See https://github.com/openMF/android-client/blob/master/LICENSE.md
- */
-package com.mifos.mifosxdroid.views
-
-import android.graphics.Typeface
-import com.mifos.application.App
-import com.mifos.application.App.Companion.instance
-import java.io.File
-
-/**
- * @author fomenkoo
- */
-enum class Font(pathToFont: String, val fontName: String) {
- ROBOTO_LIGHT("fonts", "Roboto-Light.ttf"), ROBOTO_MEDIUM(
- "fonts",
- "Roboto-Regular.ttf"
- ),
- ROBOTO_BOLD("fonts", "Roboto-Bold.ttf");
-
- var typeface: Typeface?
-
- init {
- typeface = App.typefaceManager[fontName.hashCode()]
- if (typeface == null) {
- typeface = Typeface.createFromAsset(
- instance!!.assets,
- pathToFont + File.separator + fontName
- )
- App.typefaceManager[fontName.hashCode()] = typeface
- }
- }
-
- companion object {
- @JvmStatic
- fun getFont(typeface: Int): Font {
- return values()[typeface]
- }
- }
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/views/FontTextView.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/views/FontTextView.kt
deleted file mode 100644
index f9644ca0655..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/views/FontTextView.kt
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * This project is licensed under the open source MPL V2.
- * See https://github.com/openMF/android-client/blob/master/LICENSE.md
- */
-package com.mifos.mifosxdroid.views
-
-import android.content.Context
-import android.util.AttributeSet
-import androidx.appcompat.widget.AppCompatTextView
-import com.mifos.mifosxdroid.R
-import com.mifos.mifosxdroid.views.Font.Companion.getFont
-
-/**
- * @author fomenkoo
- */
-class FontTextView : AppCompatTextView {
- constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(
- context,
- attrs,
- defStyle
- ) {
- parseAttributes(context, attrs)
- }
-
- constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
- parseAttributes(context, attrs)
- }
-
- constructor(context: Context) : super(context) {}
-
- private fun parseAttributes(context: Context, attrs: AttributeSet) {
- if (!isInEditMode) {
- val values = context.obtainStyledAttributes(attrs, R.styleable.CustomFont)
- val typeface = values.getInt(
- R.styleable.CustomFont_typeface, Font.ROBOTO_MEDIUM
- .ordinal
- )
- val font = getFont(typeface)
- setTypeface(font.typeface)
- }
- }
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/views/SignatureView.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/views/SignatureView.kt
deleted file mode 100644
index cc6f08445cd..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/views/SignatureView.kt
+++ /dev/null
@@ -1,136 +0,0 @@
-package com.mifos.mifosxdroid.views
-
-import android.content.Context
-import android.graphics.Bitmap
-import android.graphics.Canvas
-import android.graphics.Color
-import android.graphics.Paint
-import android.os.Environment
-import android.util.AttributeSet
-import android.util.TypedValue
-import android.view.MotionEvent
-import android.view.View
-import com.mifos.mifosxdroid.R
-import java.io.File
-import java.io.FileNotFoundException
-import java.io.FileOutputStream
-
-/**
- * Created by Tarun on 28-06-2017.
- */
-class SignatureView(context: Context, attrs: AttributeSet?) : View(context, attrs) {
- private val LOG_TAG: String = javaClass.simpleName
- private val signPaint: Paint
- private val mXCoordinateList: ArrayList
- private val mYCoordinateList: ArrayList
- private var mOnSignatureSaveListener: OnSignatureSaveListener? = null
- private val mContext: Context
-
- init {
- mContext = context
- isDrawingCacheEnabled = true
- val r = resources
- val strokeSize = TypedValue.applyDimension(
- TypedValue.COMPLEX_UNIT_DIP, 5f,
- r.displayMetrics
- ).toInt()
- signPaint = Paint()
- signPaint.color = Color.BLACK
- signPaint.strokeWidth = strokeSize.toFloat()
- signPaint.isAntiAlias = true
- mXCoordinateList = ArrayList()
- mYCoordinateList = ArrayList()
- }
-
- override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
- super.onMeasure(widthMeasureSpec, heightMeasureSpec)
- }
-
- override fun onDraw(canvas: Canvas) {
- super.onDraw(canvas)
- canvas.drawColor(Color.WHITE)
- if (mXCoordinateList.size > 2) {
- for (i in 1 until mXCoordinateList.size) {
- if (!(mXCoordinateList[i - 1].toDouble() == -1.0 || mXCoordinateList[i] == -1f)) {
- canvas.drawLine(
- mXCoordinateList[i - 1], mYCoordinateList[i - 1],
- mXCoordinateList[i], mYCoordinateList[i], signPaint
- )
- }
- }
- }
- }
-
- override fun onTouchEvent(event: MotionEvent): Boolean {
- super.onTouchEvent(event)
- when (event.action) {
- MotionEvent.ACTION_DOWN -> {
- mXCoordinateList.add(event.x)
- mYCoordinateList.add(event.y)
- }
-
- MotionEvent.ACTION_UP -> {
- mXCoordinateList.add(-1.0.toFloat())
- mYCoordinateList.add(-1.0.toFloat())
- }
-
- MotionEvent.ACTION_MOVE -> {
- mXCoordinateList.add(event.x)
- mYCoordinateList.add(event.y)
- invalidate()
- }
- }
- return true
- }
-
- interface OnSignatureSaveListener {
- fun onSignSavedError(errorMsg: String)
- fun onSignSavedSuccess(absoluteFilePath: String)
- }
-
- fun setOnSignatureSaveListener(listener: OnSignatureSaveListener?) {
- mOnSignatureSaveListener = listener
- }
-
- fun saveSignature(id: Int) {
- val path = Environment.getExternalStorageDirectory().toString() +
- mContext.resources.getString(R.string.signature_image_directory)
- val signatureStorageDirectory = File(path)
- val signatureFile: File
- if (!signatureStorageDirectory.exists()) {
- val makeRequiredDirectories = signatureStorageDirectory.mkdirs()
- if (!makeRequiredDirectories) {
- mOnSignatureSaveListener?.onSignSavedError(mContext.resources.getString(R.string.sign_dir_not_created_msg))
- return
- }
- }
- try {
- val signatureBitmap = drawingCache
- signatureFile = File(signatureStorageDirectory.path, "$id.jpeg")
- signatureBitmap.compress(
- Bitmap.CompressFormat.JPEG, 100,
- FileOutputStream(signatureFile)
- )
- } catch (e: FileNotFoundException) {
- if (mOnSignatureSaveListener != null) {
- e.message?.let { mOnSignatureSaveListener?.onSignSavedError(it) }
- }
- return
- }
- if (mOnSignatureSaveListener != null) {
- mOnSignatureSaveListener?.onSignSavedSuccess(signatureFile.absolutePath)
- }
- }
-
- fun clear() {
- mXCoordinateList.clear()
- mYCoordinateList.clear()
- destroyDrawingCache()
- invalidate()
- }
-
- val xCoordinateSize: Int
- get() = mXCoordinateList.size
- val yCoordinateSize: Int
- get() = mYCoordinateList.size
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/views/scrollview/CustomScrollView.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/views/scrollview/CustomScrollView.kt
deleted file mode 100644
index 17a62a5e6e1..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/views/scrollview/CustomScrollView.kt
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.mifos.mifosxdroid.views.scrollview
-
-import android.content.Context
-import android.util.AttributeSet
-import android.widget.ScrollView
-
-class CustomScrollView : ScrollView {
- private var scrollChangeListener: ScrollChangeListener? = null
- override fun onScrollChanged(l: Int, t: Int, oldl: Int, oldt: Int) {
- super.onScrollChanged(l, t, oldl, oldt)
- if (scrollChangeListener != null) {
- scrollChangeListener!!.onScrollChanged(l, t, oldl, oldt)
- }
- }
-
- fun setScrollChangeListener(scrollChangeListener: ScrollChangeListener?) {
- this.scrollChangeListener = scrollChangeListener
- }
-
- constructor(context: Context?) : super(context) {}
- constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) {}
- constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(
- context,
- attrs,
- defStyleAttr
- ) {
- }
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/views/scrollview/ScrollChangeListener.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/views/scrollview/ScrollChangeListener.kt
deleted file mode 100644
index 27fa996e69d..00000000000
--- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/views/scrollview/ScrollChangeListener.kt
+++ /dev/null
@@ -1,5 +0,0 @@
-package com.mifos.mifosxdroid.views.scrollview
-
-interface ScrollChangeListener {
- fun onScrollChanged(x: Int, y: Int, oldx: Int, oldy: Int)
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/utils/AndroidVersionUtil.kt b/mifosng-android/src/main/java/com/mifos/utils/AndroidVersionUtil.kt
deleted file mode 100644
index d5719e3922a..00000000000
--- a/mifosng-android/src/main/java/com/mifos/utils/AndroidVersionUtil.kt
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.mifos.utils
-
-import android.os.Build
-
-/**
- *
- * Created by Rajan Maurya on 04/09/16.
- */
-object AndroidVersionUtil {
- val apiVersion: Int
- get() = Build.VERSION.SDK_INT
-
- @JvmStatic
- fun isApiVersionGreaterOrEqual(thisVersion: Int): Boolean {
- return Build.VERSION.SDK_INT >= thisVersion
- }
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/utils/CheckSelfPermissionAndRequest.kt b/mifosng-android/src/main/java/com/mifos/utils/CheckSelfPermissionAndRequest.kt
deleted file mode 100644
index 87986cc7c1f..00000000000
--- a/mifosng-android/src/main/java/com/mifos/utils/CheckSelfPermissionAndRequest.kt
+++ /dev/null
@@ -1,159 +0,0 @@
-package com.mifos.utils
-
-import android.annotation.TargetApi
-import android.content.Context
-import android.content.Intent
-import android.content.pm.PackageManager
-import android.net.Uri
-import android.os.Build
-import android.provider.Settings
-import android.widget.Toast
-import androidx.appcompat.app.AppCompatActivity
-import androidx.core.app.ActivityCompat
-import androidx.core.content.ContextCompat
-import com.mifos.mifosxdroid.R
-import com.mifos.mifosxdroid.core.MaterialDialog
-
-/**
- * This Class is the Generic Class to Request the Dangerous permissions that are not granted
- * during the installation of the app, that are only granted on RunTime.
- *
- *
- * Here is the Dangerous permissions List that are granted during RunTime only.
- * https://developer.android.com/guide/topics/security/permissions.html#normal-dangerous
- *
- *
- * Created by Rajan Maurya on 04/09/16.
- */
-object CheckSelfPermissionAndRequest {
- /**
- * This Method Check the Permission is granted or not to the App. If the Permission granted,
- * returns true and If not permission denied then returns false.
- *
- * @param context Context
- * @param permission Manifest.permission...Permission...
- * @return Boolean True or False.
- */
- @JvmStatic
- fun checkSelfPermission(context: Context?, permission: String?): Boolean {
- return ContextCompat.checkSelfPermission(context!!, permission!!) ==
- PackageManager.PERMISSION_GRANTED
- }
-
- /**
- * This Method is requesting to device to grant the permission. When App is trying to
- * request the device to grant the permission, then their is Three cases.
- * 1. First case Device Prompt the Permission Dialog to user and user accepted or denied the
- * Permission.
- * 2. Second case will come, if user will denied the permission, after onclick dialog denied
- * button and next time App ask for permission, It will show a Material Dialog and there
- * will be a message to tell the user that you have denied the permission before, So do
- * you want to give this permission to app or not, If yes then click on Re-Try dialog button
- * and if not then click on Dialog button "I'M Sure", to not to give this permission to the
- * app.
- *
- *
- * And as user will click on "Re-Try" dialog button, he will be prompt with the with
- * permission dialog with "[-] never ask again" and have two options first one to click on
- * denied button again and put Un check the never ask check box. In this case, user will
- * prompt with permission dialog with "[-] never ask again" in the loop, whenever app ask
- * for that permission.
- *
- *
- * and If user will click on "[_/] never ask again" check box then permission dialog with
- * that permission will not prompt to the user.
- * 3. Third case will came. when user have denied to accept permission with never ask again.
- * then user will prompt with dialog and message that you have denied this permission with
- * never ask again. but this is necessary permission to this app feature. and to grant
- * this permission please click on dialog app settings button and give the permission to
- * work with this feature.
- *
- * @param activity AppCompatActivity
- * @param permission Manifest.permission...Permission...
- * @param permissionRequestCode Permission Request Code.
- * @param dialogMessageRetry Dialog Message Retry
- * @param messageNeverAskAgain Dialog Message Never Ask Again
- * @param permissionDeniedStatus Permission Denied Status
- */
- @JvmStatic
- @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
- fun requestPermission(
- activity: AppCompatActivity,
- permission: String,
- permissionRequestCode: Int,
- dialogMessageRetry: String?,
- messageNeverAskAgain: String?,
- permissionDeniedStatus: String
- ) {
- // Should we show an explanation?
- if (ActivityCompat.shouldShowRequestPermissionRationale(activity, permission)) {
-
- // Show an explanation to the user *asynchronously* -- don't block
- // this thread waiting for the user's response! After the user
- // sees the explanation, try again to request the permission.
- MaterialDialog.Builder().init(activity)
- .setTitle(R.string.permission_denied)
- .setMessage(dialogMessageRetry)
- .setPositiveButton(R.string.dialog_action_i_am_sure)
- .setNegativeButton(
- R.string.dialog_action_re_try
- ) { dialog, which ->
- ActivityCompat.requestPermissions(
- activity, arrayOf(permission),
- permissionRequestCode
- )
- }
- .createMaterialDialog()
- .show()
- } else {
-
- //Requesting Permission, first time to the device.
- if (com.mifos.utils.PrefManager.getPermissionDeniedStatus(
- permissionDeniedStatus
- )
- ) {
- com.mifos.utils.PrefManager.setPermissionDeniedStatus(
- permissionDeniedStatus,
- false
- )
- ActivityCompat.requestPermissions(
- activity, arrayOf(permission),
- permissionRequestCode
- )
- } else {
- //Requesting Permission, more the one time and opening the setting to change
- // the Permission in App Settings.
- MaterialDialog.Builder().init(activity)
- .setMessage(messageNeverAskAgain)
- .setNegativeButton(R.string.dialog_action_cancel)
- .setPositiveButton(
- R.string.dialog_action_app_settings
- ) { dialog, which -> //Making the Intent to grant the permission
- val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
- val uri = Uri.fromParts(
- activity.resources.getString(
- R.string.package_name
- ), activity.packageName, null
- )
- intent.data = uri
- val pm = activity.packageManager
- if (intent.resolveActivity(pm) != null) {
- activity.startActivityForResult(
- intent,
- com.mifos.utils.Constants.REQUEST_PERMISSION_SETTING
- )
- } else {
- Toast.makeText(
- activity,
- activity.getString(
- R.string.msg_setting_activity_not_found
- ), Toast.LENGTH_LONG
- ).show()
- }
- }
- .createMaterialDialog()
- .show()
- }
- }
- }
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/utils/Constants.kt b/mifosng-android/src/main/java/com/mifos/utils/Constants.kt
deleted file mode 100644
index 002f25705c1..00000000000
--- a/mifosng-android/src/main/java/com/mifos/utils/Constants.kt
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * This project is licensed under the open source MPL V2.
- * See https://github.com/openMF/android-client/blob/master/LICENSE.md
- */
-package com.mifos.utils
-
-/**
- * Created by satya on 13/04/14.
- */
-object Constants {
- //Search Entities
- const val SEARCH_ENTITY_CLIENT = "CLIENT"
- const val SEARCH_ENTITY_GROUP = "GROUP"
- const val SEARCH_ENTITY_LOAN = "LOAN"
- const val SEARCH_ENTITY_SAVING = "SAVING"
- const val SEARCH_ENTITY_CENTER = "CENTER"
- const val CLIENT_NAME = "clientName"
- const val CLIENT_ID = "clientId"
- const val ID = "id"
- const val CLIENT = "Client"
- const val CENTER_ID = "centerId"
- const val GROUP_ID = "groupId"
- const val GROUP_NAME = "groupName"
- const val GROUPS = "groups"
- const val GROUP_ACCOUNT = "isGroupAccount"
- const val CENTER = "center"
- const val STOP_TRACKING = "stop_tracking"
- const val SERVICE_STATUS = "service_status"
-
- //This needs to be 8 bits because validateRequestPermissionsRequestCode
- // in FragmentActivity requires requestCode to be of 8 bits, meaning the range is from 0 to 255.
- const val REQUEST_PERMISSION_SETTING = 254
-
- /**
- * User Logged In Status
- * 0 for Online and 1 for Offline
- */
- const val USER_ONLINE = false
- const val USER_OFFLINE = true
-
- /**
- * Constant to identify whether Simple Collection Sheet fragment has to be opened
- * or the Individual Collection Sheet.
- */
- const val COLLECTION_TYPE = "collection_type"
- const val EXTRA_COLLECTION_INDIVIDUAL = "individual"
- const val EXTRA_COLLECTION_COLLECTION = "collection"
-
- /**
- * Constants related to RunReports
- */
-
- const val HAS_SETTING_CHANGED = "hasSettingsChanged"
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/utils/DateHelper.kt b/mifosng-android/src/main/java/com/mifos/utils/DateHelper.kt
deleted file mode 100644
index ff331a35c69..00000000000
--- a/mifosng-android/src/main/java/com/mifos/utils/DateHelper.kt
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * This project is licensed under the open source MPL V2.
- * See https://github.com/openMF/android-client/blob/master/LICENSE.md
- */
-package com.mifos.utils
-
-import java.text.DateFormat
-import java.text.SimpleDateFormat
-import java.util.Calendar
-import java.util.Date
-import java.util.Locale
-
-/**
- * Created by ishankhanna on 30/05/14.
- *
- * This is a helper class that will be used to convert List Type Dates
- * from MifosX into Simple Strings or Date Formats
- */
-object DateHelper {
- const val DATE_FORMAT_VALUE = "dd MMM yyyy"
- const val DATE_TIME_FORMAT_VALUE = "dd MMMM yyyy HH:mm"
- const val TIME_FORMAT_VALUE = "HH:mm a"
-
- /**
- * @return current date formatted as day - month - year where month is a number from 1 to 12
- * (ex: 13 - 4 - 2014)
- */
- val currentDateAsString: String
- get() {
- val calendar = Calendar.getInstance()
- val year = calendar[Calendar.YEAR]
- val month = calendar[Calendar.MONTH]
- val day = calendar[Calendar.DAY_OF_MONTH]
- return day.toString() + " - " + (month + 1) + " - " + year
- }
-
- /**
- * @return current date as [year-month-day] where month is a number from 1 to 12 (ex: [2014,
- * 4, 14])
- */
- val currentDateAsListOfIntegers: List
- get() {
- val date: MutableList = ArrayList()
- val calendar = Calendar.getInstance()
- date.add(calendar[Calendar.YEAR])
- date.add(calendar[Calendar.MONTH] + 1)
- date.add(calendar[Calendar.DAY_OF_MONTH])
- return date
- }
-
- /**
- * @param date formatted as day-month-year where month is an integer from 1 to 12
- * @return replaces month with a string like Jan or Feb..etc
- */
- @JvmStatic
- fun getDateAsStringUsedForCollectionSheetPayload(date: String?): String {
- val builder = StringBuilder()
- if (date != null) {
- val splittedDate = date.split("-".toRegex()).dropLastWhile { it.isEmpty() }
- .toTypedArray()
- val month = splittedDate[1].toInt()
- builder.append(splittedDate[0])
- builder.append('-')
- builder.append(getMonthName(month))
- builder.append('-')
- builder.append(splittedDate[2])
- }
- return builder.toString()
- //Return as dd-mmm-yyyy
- }
-
- /**
- * @param date formatted as day-month-year where month is an integer from 1 to 12 (ex:
- * 14-4-2016)
- * @return replaces month with a string like Jan or Feb...etc (ex: 14-Apr-2016)
- */
- fun getDateAsStringUsedForDateofBirth(date: String?): String {
- val builder = StringBuilder()
- if (date != null) {
- val splittedDate = date.split("-".toRegex()).dropLastWhile { it.isEmpty() }
- .toTypedArray()
- val month = splittedDate[1].toInt()
- builder.append(splittedDate[0])
- builder.append('-')
- builder.append(getMonthName(month))
- builder.append('-')
- builder.append(splittedDate[2])
- }
- return builder.toString()
- //Return as dd-mmm-yyyy
- }
-
- /**
- * @return current date formatted as day month year where month is from 1 to 12 (ex 14 4 2016)
- */
- val currentDateAsDateFormat: String
- get() {
- val calendar = Calendar.getInstance()
- val year = calendar[Calendar.YEAR]
- val month = calendar[Calendar.MONTH]
- val day = calendar[Calendar.DAY_OF_MONTH]
- return day.toString() + " " + (month + 1) + " " + year
- }
-
- /**
- * @return current date formatted as dd MMMM yyyy (ex: 14 April 2016)
- */
- val currentDateAsNewDateFormat: String
- get() {
- val calendar = Calendar.getInstance()
- val simpleDateFormat = SimpleDateFormat("dd MMMM yyyy")
- val year = calendar[Calendar.YEAR]
- val month = calendar[Calendar.MONTH]
- val day = calendar[Calendar.DAY_OF_MONTH]
- var date = day.toString() + " - " + (month + 1) + " - " + year
- date = simpleDateFormat.format(calendar.time)
- return date
- }
-
- /**
- * This method returns the String of date and time. Just need to pass the format in which you
- * want. Example Pass the format "dd MMMM yyyy HH:mm" and you will get the date and time in
- * this format "24 January 2017 18:32".
- *
- * @param format Format of Date and Time
- * @return String of Date and Time
- */
- @JvmStatic
- fun getCurrentDateTime(format: String?): String {
- val dateFormat: DateFormat = SimpleDateFormat(format, Locale.ENGLISH)
- return dateFormat.format(Date())
- }
-
- /**
- * the result string uses the list given in a reverse order ([x, y, z] results in "z y x")
- *
- * @param integersOfDate [year-month-day] (ex [2016, 4, 14])
- * @return date in the format day month year (ex 14 Apr 2016)
- */
- @JvmStatic
- fun getDateAsString(integersOfDate: List): String {
- val stringBuilder = StringBuilder()
- stringBuilder.append(integersOfDate[2])
- .append(' ')
- .append(getMonthName(integersOfDate[1]))
- .append(' ')
- .append(integersOfDate[0])
- return stringBuilder.toString()
- }
-
- /**
- * @param date1 a list of 3 numbers [year, month, day] (Ex [2016, 4, 14])
- * @param date2 a list of 3 numbers [year, month, day] (Ex [2016, 3, 21])
- * @return zero if both date1 and date2 are equal, positive int if date1 > date2
- * and negative int if date1 < date2
- */
- fun dateComparator(date1: List, date2: List): Int {
-
- /*
- * Each List contains 3 items
- * index 0 = Year
- * index 1 = Month
- * index 2 = Day
- *
- * Format is YYYY - MM - DD
- */
-
- //comparing years
- return if (date1[0] == date2[0]) {
-
- //now that years are equal lets compare months
- if (date1[1] == date2[1]) {
-
- //now that months are also equal lets compare days
- if (date1[2] == date2[2]) {
- 0
- } else if (date1[2] > date2[2]) {
- 1
- } else {
- -1
- }
- } else if (date1[1] > date2[1]) {
- 1
- } else {
- -1
- }
- } else if (date1[0] > date2[0]) {
- 1
- } else {
- -1
- }
- }
-
- /**
- * @param month an integer from 1 to 12
- * @return string representation of the month like Jan or Feb..etc
- */
- @JvmStatic
- fun getMonthName(month: Int): String {
- var monthName = ""
- when (month) {
- 1 -> monthName = "Jan"
- 2 -> monthName = "Feb"
- 3 -> monthName = "Mar"
- 4 -> monthName = "Apr"
- 5 -> monthName = "May"
- 6 -> monthName = "Jun"
- 7 -> monthName = "Jul"
- 8 -> monthName = "Aug"
- 9 -> monthName = "Sep"
- 10 -> monthName = "Oct"
- 11 -> monthName = "Nov"
- 12 -> monthName = "Dec"
- }
- return monthName
- }
-
- /**
- * ex: date = 11,4,2016 separator = , result = [11, 4, 2016]
- *
- * @param date string with tokken seperated by a seperator
- * @param separator the strings that separates the tokkens to be parsed
- */
- fun getDateList(date: String, separator: String): List {
- val splittedDate = date.split(separator.toRegex()).dropLastWhile { it.isEmpty() }
- .toTypedArray()
- val dateList: MutableList = ArrayList()
- for (i in 0..2) {
- dateList.add(splittedDate[i].toInt())
- }
- return dateList
- }
-
- /**
- * Method to convert a given date in dd MMM YYYY format to [dd, mm, yyyy] format.
- *
- * @param date Date String. e.g. "20 Aug 2017"
- * @return List of Integers. e.g. [20, 08, 2017]
- */
- fun convertDateAsListOfInteger(date: String): List {
- val splitDate = date.split(" ".toRegex()).dropLastWhile { it.isEmpty() }
- .toTypedArray()
- val dateList: MutableList = ArrayList()
- dateList.add(splitDate[0].toInt())
- dateList.add(getMonthNumberFromName(splitDate[1]))
- dateList.add(splitDate[2].toInt())
- return dateList
- }
-
- /**
- * Method to convert a date in dd MMM YYYY format to [yyyy, mm, dd] format.
- *
- * @param date Date String; e.g. "20 Aug 2017"
- * @return List of Integers in reverse order; e.g. [2017, 08, 20]
- */
- fun convertDateAsReverseInteger(date: String): List {
- val splitDate = date.split(" ".toRegex()).dropLastWhile { it.isEmpty() }
- .toTypedArray()
- val dateList: MutableList = ArrayList()
- dateList.add(splitDate[2].toInt())
- dateList.add(getMonthNumberFromName(splitDate[1]))
- dateList.add(splitDate[0].toInt())
- return dateList
- }
-
- fun getMonthNumberFromName(month: String?): Int {
- return when (month) {
- "Jan" -> 1
- "Feb" -> 2
- "Mar" -> 3
- "Apr" -> 4
- "May" -> 5
- "Jun" -> 6
- "Jul" -> 7
- "Aug" -> 8
- "Sep" -> 9
- "Oct" -> 10
- "Nov" -> 11
- "Dec" -> 12
- else -> -1
- }
- }
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/utils/EspressoIdlingResource.kt b/mifosng-android/src/main/java/com/mifos/utils/EspressoIdlingResource.kt
deleted file mode 100644
index beaf0562ea2..00000000000
--- a/mifosng-android/src/main/java/com/mifos/utils/EspressoIdlingResource.kt
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2015, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.mifos.utils
-
-import androidx.test.espresso.IdlingResource
-
-/**
- * @author Rajan Maurya
- * Contains a static reference to [IdlingResource].
- */
-object EspressoIdlingResource {
- private const val RESOURCE = "GLOBAL"
- private val mCountingIdlingResource = SimpleCountingIdlingResource(RESOURCE)
- fun increment() {
- mCountingIdlingResource.increment()
- }
-
- fun decrement() {
- mCountingIdlingResource.decrement()
- }
-
- val idlingResource: IdlingResource
- get() = mCountingIdlingResource
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/utils/FileUtils.kt b/mifosng-android/src/main/java/com/mifos/utils/FileUtils.kt
deleted file mode 100644
index 679967e4fd0..00000000000
--- a/mifosng-android/src/main/java/com/mifos/utils/FileUtils.kt
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * This project is licensed under the open source MPL V2.
- * See https://github.com/openMF/android-client/blob/master/LICENSE.md
- */
-package com.mifos.utils
-
-import android.annotation.TargetApi
-import android.content.ContentUris
-import android.content.Context
-import android.database.Cursor
-import android.net.Uri
-import android.os.Build
-import android.os.Environment
-import android.provider.DocumentsContract
-import android.provider.MediaStore
-import android.util.Log
-import android.webkit.MimeTypeMap
-import com.mifos.utils.AndroidVersionUtil.isApiVersionGreaterOrEqual
-import java.io.File
-import java.io.FileOutputStream
-import java.io.InputStream
-import java.io.OutputStream
-
-/**
- * Created by ishankhanna on 03/07/14.
- */
-object FileUtils {
- val LOG_TAG = FileUtils::class.java.simpleName
- fun getPathReal(context: Context, uri: Uri): String? {
- return if (isApiVersionGreaterOrEqual(Build.VERSION_CODES.KITKAT)) {
- getPathRealOnKitkatAboveVersion(context, uri)
- } else {
- getPathOnKitkatBelowVersion(context, uri)
- }
- }
-
- private fun getPathOnKitkatBelowVersion(context: Context, uri: Uri): String? {
- if ("content".equals(uri.scheme, ignoreCase = true)) {
- val projection = arrayOf("_data")
- var cursor: Cursor? = null
- try {
- cursor = context.contentResolver.query(uri, projection, null, null, null)
- val column_index = cursor!!.getColumnIndexOrThrow("_data")
- if (cursor.moveToFirst()) {
- return cursor.getString(column_index)
- }
- } catch (e: Exception) {
- // Eat it
- }
- } else if ("file".equals(uri.scheme, ignoreCase = true)) {
- return uri.path
- }
- return null
- }
-
- @TargetApi(Build.VERSION_CODES.KITKAT)
- fun getPathRealOnKitkatAboveVersion(context: Context, uri: Uri): String? {
- val isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT
-
- // DocumentProvider
- if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) {
- // ExternalStorageProvider
- if (isExternalStorageDocument(uri)) {
- val docId = DocumentsContract.getDocumentId(uri)
- val split = docId.split(":".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
- val type = split[0]
- if ("primary".equals(type, ignoreCase = true)) {
- return Environment.getExternalStorageDirectory().toString() + "/" + split[1]
- }
- // TODO handle non-primary volumes
-
- // DownloadsProvider
- } else if (isDownloadsDocument(uri)) {
- val id = DocumentsContract.getDocumentId(uri)
- val contentUri = ContentUris.withAppendedId(
- Uri.parse("content://downloads/public_downloads"), id.toLong()
- )
- return getDataColumn(context, contentUri, null, null)
-
- // MediaProvider
- } else if (isMediaDocument(uri)) {
- val docId = DocumentsContract.getDocumentId(uri)
- val split = docId.split(":".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
- val type = split[0]
- var contentUri: Uri? = null
- if ("image" == type) {
- contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI
- } else if ("video" == type) {
- contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI
- } else if ("audio" == type) {
- contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI
- }
- val selection = "_id=?"
- val selectionArgs = arrayOf(
- split[1]
- )
- return getDataColumn(context, contentUri, selection, selectionArgs)
- }
-
- // MediaStore (and general)
- } else if ("content".equals(uri.scheme, ignoreCase = true)) {
-
- // Return the remote address
- return if (isGooglePhotosUri(uri)) uri.lastPathSegment else getDataColumn(
- context,
- uri,
- null,
- null
- )
-
- // File
- } else if ("file".equals(uri.scheme, ignoreCase = true)) {
- return uri.path
- }
- return null
- }
-
- fun getDataColumn(
- context: Context, uri: Uri?, selection: String?,
- selectionArgs: Array?
- ): String? {
- var cursor: Cursor? = null
- val column = "_data"
- val projection = arrayOf(
- column
- )
- try {
- cursor = context.contentResolver.query(
- uri!!, projection, selection, selectionArgs,
- null
- )
- if (cursor != null && cursor.moveToFirst()) {
- val index = cursor.getColumnIndexOrThrow(column)
- return cursor.getString(index)
- }
- } finally {
- cursor?.close()
- }
- return null
- }
-
- /**
- * @param uri The Uri to check.
- * @return Whether the Uri authority is ExternalStorageProvider.
- */
- fun isExternalStorageDocument(uri: Uri): Boolean {
- return "com.android.externalstorage.documents" == uri.authority
- }
-
- /**
- * @param uri The Uri to check.
- * @return Whether the Uri authority is DownloadsProvider.
- */
- fun isDownloadsDocument(uri: Uri): Boolean {
- return "com.android.providers.downloads.documents" == uri.authority
- }
-
- /**
- * @param uri The Uri to check.
- * @return Whether the Uri authority is MediaProvider.
- */
- fun isMediaDocument(uri: Uri): Boolean {
- return "com.android.providers.media.documents" == uri.authority
- }
-
- /**
- * @param uri The Uri to check.
- * @return Whether the Uri authority is Google Photos.
- */
- fun isGooglePhotosUri(uri: Uri): Boolean {
- return "com.google.android.apps.photos.content" == uri.authority
- }
-
- /**
- * This Method for getting File Mime Type
- *
- * @param filePath Path of the file
- * @return String Mime Type
- */
- fun getMimeType(filePath: String?): String? {
- var type: String? = null
- val extension = MimeTypeMap.getFileExtensionFromUrl(filePath)
- if (extension != null) {
- type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension)
- }
- return type
- }
-
- /**
- * This Method for writing InputStream into File.
- *
- * @param in InputStream
- * @param file File
- */
- fun writeInputStreamDataToFile(`in`: InputStream, file: File?) {
- try {
- val out: OutputStream = FileOutputStream(file)
- val buf = ByteArray(1024)
- var len: Int
- while (`in`.read(buf).also { len = it } > 0) {
- out.write(buf, 0, len)
- }
- out.close()
- `in`.close()
- } catch (e: Exception) {
- Log.d(LOG_TAG, e.localizedMessage)
- }
- }
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/utils/FragmentConstants.kt b/mifosng-android/src/main/java/com/mifos/utils/FragmentConstants.kt
deleted file mode 100644
index a2ed6f33526..00000000000
--- a/mifosng-android/src/main/java/com/mifos/utils/FragmentConstants.kt
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * This project is licensed under the open source MPL V2.
- * See https://github.com/openMF/android-client/blob/master/LICENSE.md
- */
-package com.mifos.utils
-
-/**
- * Created by ishankhanna on 22/05/14.
- */
-object FragmentConstants {
- const val FRAG_DOCUMENT_LIST = "Document List Fragment"
- const val FRAG_GROUP_SYNC = "Groups Sync"
- const val FRAG_CLIENT_SYNC = "Clients Sync"
- const val FRAG_SURVEYS_SYNC = "Surveys Sync"
- const val FRAG_CHARGE_LIST = "Charge List Fragment"
- const val FRAG_CLIENT_DETAILS = "Client Details Fragment"
- const val FRAG_CLIENT_IDENTIFIER = "Client Identifier Fragment"
- const val FRAG_GROUP_DETAILS = "Group Details Fragment"
- const val FRAG_LOAN_ACCOUNT_SUMMARY = "Loan Account Summary Fragment"
- const val FRAG_SAVINGS_ACCOUNT_SUMMARY = "Savings Account Summary Fragment"
- const val FRAG_CENTER_LIST = "Centers List Fragment"
- const val FRAG_CENTER_DETAIL = "Center Details"
- const val FRAG_GROUP_LIST = "Group List Fragment"
- const val DFRAG_DATE_PICKER = "Date Picker"
- const val FRAG_CREATE_NEW_CLIENT = "Create new client fragment"
- const val FRAG_CLIENT_SEARCH = "Client Search Fragment"
- const val DFRAG_DATATABLE_ENTRY_FORM = "Data_Table_Entry_Form"
- const val FRAG_DATA_TABLE = "Data Table Fragment"
- const val DATA_TABLE_LIST = "Associated Datatables"
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/utils/ImageLoaderUtils.kt b/mifosng-android/src/main/java/com/mifos/utils/ImageLoaderUtils.kt
deleted file mode 100644
index a67c77e2b30..00000000000
--- a/mifosng-android/src/main/java/com/mifos/utils/ImageLoaderUtils.kt
+++ /dev/null
@@ -1,51 +0,0 @@
-package com.mifos.utils
-
-import android.content.Context
-import android.graphics.Bitmap
-import android.widget.ImageView
-import com.bumptech.glide.Glide
-import com.bumptech.glide.load.model.GlideUrl
-import com.bumptech.glide.load.model.LazyHeaders
-import com.bumptech.glide.request.target.BitmapImageViewTarget
-import com.bumptech.glide.signature.ObjectKey
-import com.mifos.core.network.MifosInterceptor
-import com.mifos.mifosxdroid.R
-
-/**
- * Created by Rajan Maurya on 05/02/17.
- */
-object ImageLoaderUtils {
- private fun buildImageUrl(clientId: Int): String {
- return (PrefManager.getInstanceUrl()
- + "clients/"
- + clientId
- + "/images?maxHeight=120&maxWidth=120")
- }
-
- private fun buildGlideUrl(clientId: Int): GlideUrl {
- return GlideUrl(
- buildImageUrl(clientId), LazyHeaders.Builder()
- .addHeader(MifosInterceptor.HEADER_TENANT, PrefManager.getTenant())
- .addHeader(MifosInterceptor.HEADER_AUTH, PrefManager.getToken())
- .addHeader("Accept", "application/octet-stream")
- .build()
- )
- }
-
- fun loadImage(context: Context, clientId: Int, imageView: ImageView) {
- Glide.with(context)
- .asBitmap()
- .load(buildGlideUrl(clientId))
- .placeholder(R.drawable.ic_dp_placeholder)
- .error(R.drawable.ic_dp_placeholder)
- .signature(ObjectKey(System.currentTimeMillis()))
- .into(object : BitmapImageViewTarget(imageView) {
- override fun setResource(result: Bitmap?) {
- // check a valid bitmap is downloaded
- if (result?.width == 0) return
- // set to image view
- imageView.setImageBitmap(result)
- }
- })
- }
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/utils/ItemOffsetDecoration.kt b/mifosng-android/src/main/java/com/mifos/utils/ItemOffsetDecoration.kt
deleted file mode 100644
index f2392bb5c20..00000000000
--- a/mifosng-android/src/main/java/com/mifos/utils/ItemOffsetDecoration.kt
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.mifos.utils
-
-import android.content.Context
-import android.graphics.Rect
-import android.view.View
-import androidx.annotation.DimenRes
-import androidx.recyclerview.widget.RecyclerView
-import androidx.recyclerview.widget.RecyclerView.ItemDecoration
-
-/**
- * @author Rajan Maurya
- */
-class ItemOffsetDecoration(private val mItemOffset: Int) : ItemDecoration() {
- constructor(
- context: Context,
- @DimenRes itemOffsetId: Int
- ) : this(context.resources.getDimensionPixelSize(itemOffsetId)) {
- }
-
- override fun getItemOffsets(
- outRect: Rect, view: View, parent: RecyclerView,
- state: RecyclerView.State
- ) {
- super.getItemOffsets(outRect, view, parent, state)
- outRect[mItemOffset, mItemOffset, mItemOffset] = mItemOffset
- }
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/utils/JsonDateSerializer.kt b/mifosng-android/src/main/java/com/mifos/utils/JsonDateSerializer.kt
deleted file mode 100644
index 9ff5569ef7f..00000000000
--- a/mifosng-android/src/main/java/com/mifos/utils/JsonDateSerializer.kt
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * This project is licensed under the open source MPL V2.
- * See https://github.com/openMF/android-client/blob/master/LICENSE.md
- */
-package com.mifos.utils
-
-import com.google.gson.JsonElement
-import com.google.gson.JsonPrimitive
-import com.google.gson.JsonSerializationContext
-import com.google.gson.JsonSerializer
-import java.lang.reflect.Type
-import java.text.SimpleDateFormat
-import java.util.Date
-
-/**
- * Created by Rajan Maurya on 28,March,2016.
- */
-class JsonDateSerializer : JsonSerializer {
- override fun serialize(
- src: Date?,
- typeOfSrc: Type,
- context: JsonSerializationContext
- ): JsonElement {
- val output = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
- val formattedTime = output.format(src)
- return JsonPrimitive(formattedTime)
- }
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/utils/LanguageHelper.kt b/mifosng-android/src/main/java/com/mifos/utils/LanguageHelper.kt
deleted file mode 100644
index 33283368a8b..00000000000
--- a/mifosng-android/src/main/java/com/mifos/utils/LanguageHelper.kt
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.mifos.utils
-
-import android.annotation.TargetApi
-import android.content.Context
-import android.os.Build
-import android.preference.PreferenceManager
-import com.mifos.mifosxdroid.R
-import java.util.Locale
-
-/**
- * Created by shashankpriyadarshi on 20/06/20.
- */
-object LanguageHelper {
- fun
- onAttach(context: Context): Context {
- val lang = getPersistedData(context, Locale.getDefault().language)
- return setLocale(context, lang)
- }
-
- fun onAttach(context: Context, defaultLanguage: String): Context {
- val lang = getPersistedData(context, defaultLanguage)
- return setLocale(context, lang)
- }
-
- fun setLocale(context: Context, language: String?): Context {
- return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
- updateResources(context, language)
- } else updateResourcesLegacy(
- context,
- language
- )
- }
-
- private fun getPersistedData(context: Context, defaultLanguage: String): String? {
- val preferences = PreferenceManager.getDefaultSharedPreferences(context)
- return preferences.getString(context.getString(R.string.language_type), defaultLanguage)
- }
-
- private fun updateResources(context: Context, language: String?): Context {
- val locale = language?.lowercase(Locale.getDefault())?.let { Locale(it) }
- if (locale != null) {
- Locale.setDefault(locale)
- }
- val resources = context.resources
- val configuration = resources.configuration
- configuration.setLocale(locale)
- configuration.setLayoutDirection(locale)
- resources.updateConfiguration(configuration, resources.displayMetrics)
- return context.createConfigurationContext(configuration)
- }
-
- private fun updateResourcesLegacy(context: Context, language: String?): Context {
- val locale = Locale(language)
- Locale.setDefault(locale)
- val resources = context.resources
- val configuration = resources.configuration
- configuration.locale = locale
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
- configuration.setLayoutDirection(locale)
- }
- resources.updateConfiguration(configuration, resources.displayMetrics)
- return context
- }
-}
\ No newline at end of file
diff --git a/mifosng-android/src/main/java/com/mifos/utils/MapDeserializer.kt b/mifosng-android/src/main/java/com/mifos/utils/MapDeserializer.kt
deleted file mode 100644
index 193fc478624..00000000000
--- a/mifosng-android/src/main/java/com/mifos/utils/MapDeserializer.kt
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.mifos.utils
-
-import com.google.gson.JsonDeserializationContext
-import com.google.gson.JsonDeserializer
-import com.google.gson.JsonElement
-import com.google.gson.JsonParseException
-import java.lang.reflect.Type
-
-class MapDeserializer : JsonDeserializer