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?> { - @Throws(JsonParseException::class) - override fun deserialize( - json: JsonElement, typeOfT: Type, - context: JsonDeserializationContext - ): Map? { - return read(json) as Map? - } - - fun read(`in`: JsonElement): Any? { - if (`in`.isJsonArray) { - val list: MutableList = ArrayList() - val arr = `in`.asJsonArray - for (anArr in arr) { - list.add(read(anArr)) - } - return list - } else if (`in`.isJsonObject) { - val map: MutableMap = HashMap() - val obj = `in`.asJsonObject - val entitySet = obj.entrySet() - for ((key, value) in entitySet) { - map[key] = read(value) - } - return map - } else if (`in`.isJsonPrimitive) { - val prim = `in`.asJsonPrimitive - if (prim.isBoolean) { - return prim.asBoolean - } else if (prim.isString) { - return prim.asString - } else if (prim.isNumber) { - val num = prim.asNumber - // here you can handle double int/long values - // and return any type you want - // this solution will transform 3.0 float to long values - return if (Math.ceil(num.toDouble()) == num.toLong().toDouble()) { - num.toLong() - } else { - num.toDouble() - } - } - } - return null - } -} \ No newline at end of file diff --git a/mifosng-android/src/main/java/com/mifos/utils/MifosDatePicker.kt b/mifosng-android/src/main/java/com/mifos/utils/MifosDatePicker.kt deleted file mode 100644 index 1df9e99e494..00000000000 --- a/mifosng-android/src/main/java/com/mifos/utils/MifosDatePicker.kt +++ /dev/null @@ -1,44 +0,0 @@ -package com.mifos.utils - -import com.google.android.material.datepicker.CalendarConstraints -import com.google.android.material.datepicker.DateValidatorPointBackward -import com.google.android.material.datepicker.DateValidatorPointForward -import com.google.android.material.datepicker.MaterialDatePicker -import java.text.SimpleDateFormat -import java.time.Instant -import java.util.Calendar -import java.util.Locale - -/* - created by Aditya Gupta on 02/08/2023 - */ - -enum class DatePickerConstrainType { - ONLY_FUTURE_DAYS, ONLY_PAST_DAYS, NONE -} - -fun getDatePickerDialog( - selectedInstant: Instant = Instant.now(), - constrainType: DatePickerConstrainType = DatePickerConstrainType.NONE, - onDatePick: (dateLong: Long) -> Unit = {}, -): MaterialDatePicker { - val constrainsBuilder = CalendarConstraints.Builder().apply { - when (constrainType) { - DatePickerConstrainType.ONLY_FUTURE_DAYS -> setValidator(DateValidatorPointForward.now()) - DatePickerConstrainType.ONLY_PAST_DAYS -> setValidator(DateValidatorPointBackward.now()) - DatePickerConstrainType.NONE -> {} - } - } - - val dialog = MaterialDatePicker.Builder.datePicker() - .setSelection(selectedInstant.toEpochMilli()) - .setCalendarConstraints(constrainsBuilder.build()) - .build() - dialog.addOnPositiveButtonClickListener { - onDatePick(it) - } - return dialog -} - -fun getTodayFormatted(): String = - SimpleDateFormat("dd MMMM yyyy", Locale.getDefault()).format(Calendar.getInstance().time) \ No newline at end of file diff --git a/mifosng-android/src/main/java/com/mifos/utils/MifosResponseHandler.kt b/mifosng-android/src/main/java/com/mifos/utils/MifosResponseHandler.kt index 0538d5a9c9e..374e4fa7867 100644 --- a/mifosng-android/src/main/java/com/mifos/utils/MifosResponseHandler.kt +++ b/mifosng-android/src/main/java/com/mifos/utils/MifosResponseHandler.kt @@ -1,14 +1,13 @@ package com.mifos.utils -import com.mifos.utils.PrefManager.userStatus - /** * Created by Rajan Maurya on 08/07/16. */ object MifosResponseHandler { - val response: String - get() = when (userStatus) { - false -> "created successfully" + fun getResponse(userStatus: Boolean): String { + return when (userStatus) { true -> "Saved into DB Successfully" + false -> "created successfully" } + } } \ No newline at end of file diff --git a/mifosng-android/src/main/java/com/mifos/utils/Network.kt b/mifosng-android/src/main/java/com/mifos/utils/Network.kt deleted file mode 100644 index f9f79e5e5e5..00000000000 --- a/mifosng-android/src/main/java/com/mifos/utils/Network.kt +++ /dev/null @@ -1,44 +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.content.Context -import android.net.ConnectivityManager - -object Network { - const val TYPE_WIFI = 1 - const val TYPE_MOBILE = 2 - const val TYPE_NOT_CONNECTED = 0 - private fun getConnectivityStatus(context: Context): Int { - val cm = context - .getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager - val activeNetwork = cm.activeNetworkInfo - if (null != activeNetwork) { - if (activeNetwork.type == ConnectivityManager.TYPE_WIFI) return TYPE_WIFI - if (activeNetwork.type == ConnectivityManager.TYPE_MOBILE) return TYPE_MOBILE - } - return TYPE_NOT_CONNECTED - } - - fun getConnectivityStatusString(context: Context): String? { - val conn = getConnectivityStatus(context) - var status: String? = null - if (conn == TYPE_WIFI) { - status = "Wifi enabled" - } else if (conn == TYPE_MOBILE) { - status = "Mobile data enabled" - } else if (conn == TYPE_NOT_CONNECTED) { - status = "Not connected to Internet" - } - return status - } - - @JvmStatic - fun isOnline(context: Context): Boolean { - val connectivityStatus = getConnectivityStatus(context) - return connectivityStatus == TYPE_WIFI || - connectivityStatus == TYPE_MOBILE - } -} \ No newline at end of file diff --git a/mifosng-android/src/main/java/com/mifos/utils/NetworkUtilsWrapper.kt b/mifosng-android/src/main/java/com/mifos/utils/NetworkUtilsWrapper.kt deleted file mode 100644 index 2f6537e307d..00000000000 --- a/mifosng-android/src/main/java/com/mifos/utils/NetworkUtilsWrapper.kt +++ /dev/null @@ -1,26 +0,0 @@ -package com.mifos.utils - -import android.content.Context -import android.net.ConnectivityManager -import android.net.NetworkCapabilities -import androidx.annotation.MainThread -import dagger.hilt.android.qualifiers.ApplicationContext -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class NetworkUtilsWrapper @Inject constructor( - @ApplicationContext private val context: Context -) { - - @MainThread - fun isNetworkConnected(): Boolean { - val connectivityManager = - context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager - val network = connectivityManager.activeNetwork ?: return false - val networkCapabilities = - connectivityManager.getNetworkCapabilities(network) ?: return false - - return networkCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET) - } -} \ No newline at end of file diff --git a/mifosng-android/src/main/java/com/mifos/utils/PrefManager.kt b/mifosng-android/src/main/java/com/mifos/utils/PrefManager.kt deleted file mode 100644 index c573d8edb2f..00000000000 --- a/mifosng-android/src/main/java/com/mifos/utils/PrefManager.kt +++ /dev/null @@ -1,56 +0,0 @@ -package com.mifos.utils - -import android.content.SharedPreferences -import android.preference.PreferenceManager -import com.mifos.application.App -import com.mifos.core.objects.user.User -import org.apache.fineract.client.models.PostAuthenticationResponse -import org.mifos.core.sharedpreference.Key -import org.mifos.core.sharedpreference.UserPreferences - -/** - * Created by Aditya Gupta on 19/08/23. - */ - -object PrefManager : UserPreferences() { - - private const val USER_DETAILS = "user_details" - private const val AUTH_USERNAME = "auth_username" - private const val AUTH_PASSWORD = "auth_password" - - override val preference: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(App.instance?.applicationContext) - - override fun getUser(): User { - return get(Key.Custom(USER_DETAILS)) - } - - override fun saveUser(user: User) { - put(Key.Custom(USER_DETAILS), user) - } - - // Created this to store userDetails - fun savePostAuthenticationResponse(user: PostAuthenticationResponse) { - put(Key.Custom(USER_DETAILS), user) - } - - var userStatus: Boolean - get() = get(Key.Custom(Constants.SERVICE_STATUS), false) - set(status) { - put(Key.Custom(Constants.SERVICE_STATUS), status) - } - - fun setPermissionDeniedStatus(permissionDeniedStatus: String, status: Boolean) { - put(Key.Custom(permissionDeniedStatus), status) - } - - fun getPermissionDeniedStatus(permissionDeniedStatus: String): Boolean { - return get(Key.Custom(permissionDeniedStatus), true) - } - - var usernamePassword: Pair - get() = Pair(get(Key.Custom(AUTH_USERNAME)), get(Key.Custom(AUTH_PASSWORD))) - set(value) { - put(Key.Custom(AUTH_USERNAME), value.first) - put(Key.Custom(AUTH_PASSWORD), value.second) - } -} \ No newline at end of file diff --git a/mifosng-android/src/main/java/com/mifos/utils/SafeUIBlockingUtility.kt b/mifosng-android/src/main/java/com/mifos/utils/SafeUIBlockingUtility.kt deleted file mode 100644 index 2018cab4804..00000000000 --- a/mifosng-android/src/main/java/com/mifos/utils/SafeUIBlockingUtility.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.utils - -import android.app.ProgressDialog -import android.content.Context -import android.util.Log -import android.widget.Toast - -/** - * @author ishankhanna - * Class To Block User Interface Safely for Asynchronous Network Calls - * and/or Heavy Operations - */ -class SafeUIBlockingUtility { - private var progressDialog: ProgressDialog - private var context: Context - - constructor(context: Context) { - this.context = context - progressDialog = ProgressDialog(context) - progressDialog.setMessage(utilityMessage) - progressDialog.setCancelable(false) - progressDialog.isIndeterminate = true - progressDialog.setTitle(utilityTitle) - progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER) - } - - constructor(context: Context, message: String?) { - this.context = context - progressDialog = ProgressDialog(context) - progressDialog.setMessage(message) - progressDialog.setCancelable(false) - progressDialog.isIndeterminate = true - progressDialog.setTitle(utilityTitle) - progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER) - } - - fun safelyBlockUI() { - progressDialog.show() - } - - fun safelyUnBlockUI() { - progressDialog.dismiss() - } - - fun safelyUnblockUIForFailure(tag: String?, message: String?) { - progressDialog.dismiss() - Toast.makeText(context, "Some Problem Executing Request", Toast.LENGTH_SHORT).show() - Log.i(tag, message!!) - } - - companion object { - var utilityTitle = "Working" - var utilityMessage = "Message" - } -} \ No newline at end of file diff --git a/mifosng-android/src/main/java/com/mifos/utils/SimpleCountingIdlingResource.kt b/mifosng-android/src/main/java/com/mifos/utils/SimpleCountingIdlingResource.kt deleted file mode 100644 index ec957a4534f..00000000000 --- a/mifosng-android/src/main/java/com/mifos/utils/SimpleCountingIdlingResource.kt +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 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 -import dagger.internal.Preconditions -import java.util.concurrent.atomic.AtomicInteger - -/** - * @author Rajan Maurya - * - * - * A simple counter implementation of [IdlingResource] that determines idleness by - * maintaining an internal counter. When the counter is 0 - it is considered to be idle, - * when it is - * non-zero it is not idle. This is very similar to the way a [ .Semaphore][java.util.concurrent] - * behaves. - * - * - * This class can then be used to wrap up operations that while in progress should block - * tests from - * accessing the UI. - */ -class SimpleCountingIdlingResource(resourceName: String) : IdlingResource { - private val mResourceName: String - private val counter = AtomicInteger(0) - - // written from main thread, read from any thread. - @Volatile - private var resourceCallback: IdlingResource.ResourceCallback? = null - - /** - * Creates a SimpleCountingIdlingResource - * - * @param resourceName the resource name this resource should report to Espresso. - */ - init { - mResourceName = Preconditions.checkNotNull(resourceName) - } - - override fun getName(): String { - return mResourceName - } - - override fun isIdleNow(): Boolean { - return counter.get() == 0 - } - - override fun registerIdleTransitionCallback(resourceCallback: IdlingResource.ResourceCallback) { - this.resourceCallback = resourceCallback - } - - /** - * Increments the count of in-flight transactions to the resource being monitored. - */ - fun increment() { - counter.getAndIncrement() - } - - /** - * Decrements the count of in-flight transactions to the resource being monitored. - * - * - * If this operation results in the counter falling below 0 - an exception is raised. - * - * @throws IllegalStateException if the counter is below 0. - */ - fun decrement() { - val counterVal = counter.decrementAndGet() - if (counterVal == 0 && null != resourceCallback) { - // we've gone from non-zero to zero. That means we're idle now! Tell espresso. - resourceCallback!!.onTransitionToIdle() - } - require(counterVal >= 0) { "Counter has been corrupted!" } - } -} \ No newline at end of file diff --git a/mifosng-android/src/main/java/com/mifos/utils/Tags.kt b/mifosng-android/src/main/java/com/mifos/utils/Tags.kt deleted file mode 100644 index f6e4ece7803..00000000000 --- a/mifosng-android/src/main/java/com/mifos/utils/Tags.kt +++ /dev/null @@ -1,12 +0,0 @@ -package com.mifos.utils - -/** - * Created by aksh on 27/7/18. - */ -object Tags { - const val OfflineSyncCenter = "syncCenterTag" - const val OfflineSyncClient = "syncClientTag" - const val OfflineSyncGroup = "syncGroupTag" - const val OfflineSyncSavingsAccount = "syncSavingsAccountTag" - const val OfflineSyncLoanRepayment = "syncLoanRepaymentAccountTag" -} \ No newline at end of file diff --git a/mifosng-android/src/main/java/com/mifos/utils/Utils.kt b/mifosng-android/src/main/java/com/mifos/utils/Utils.kt deleted file mode 100644 index 0d4cdc44a7e..00000000000 --- a/mifosng-android/src/main/java/com/mifos/utils/Utils.kt +++ /dev/null @@ -1,126 +0,0 @@ -package com.mifos.utils - -import android.content.Context -import android.graphics.drawable.ColorDrawable -import android.graphics.drawable.Drawable -import android.graphics.drawable.LayerDrawable -import androidx.core.content.ContextCompat -import com.mifos.core.objects.accounts.loan.LoanAccount -import com.mifos.core.objects.accounts.savings.SavingsAccount -import com.mifos.core.objects.client.Client -import com.mifos.mifosxdroid.R -import rx.Observable -import java.text.DateFormat -import java.util.Calendar -import java.util.TimeZone - -/** - * Created by Rajan Maurya on 18/08/16. - */ -object Utils { - val LOG_TAG = Utils::class.java.simpleName - - /** - * This Method transforming the PaymentTypeOption to String(PaymentTypeName). - * In Which Observable.from takes the List and flatmap the - * PaymentTypeOptions one by one. finally returns the List paymentTypeNames - * - * @param paymentTypeOptions List - * @return List - */ - fun getPaymentTypeOptions(paymentTypeOptions: List?): List { - val paymentOptions: MutableList = ArrayList() - Observable.from(paymentTypeOptions) - .flatMap { (_, name) -> Observable.just(name) } - .subscribe { s -> paymentOptions.add(s) } - return paymentOptions - } - - /** - * This Method filtering the List and if any PaymentTypeOption id is equal to - * the paymentId. and return the match PaymentType Name. - * - * @param paymentId Payment Type Id - * @param paymentTypeOptions PaymentTypeOptions - * @return PaymentType Name - */ - @JvmStatic - fun getPaymentTypeName( - paymentId: Int, - paymentTypeOptions: List? - ): String? { - val paymentTypeName = arrayOfNulls(1) - Observable.from(paymentTypeOptions) - .filter { (id) -> id == paymentId } - .subscribe { (_, name) -> paymentTypeName[0] = name } - return paymentTypeName[0] - } - - fun getActiveLoanAccounts(loanAccountList: List?): List { - val loanAccounts: MutableList = ArrayList() - Observable.from(loanAccountList) - .filter { loanAccount -> loanAccount.status?.active } - .subscribe { loanAccount -> loanAccounts.add(loanAccount) } - return loanAccounts - } - - fun getActiveSavingsAccounts(savingsAccounts: List?): List { - val accounts: MutableList = ArrayList() - Observable.from(savingsAccounts) - .filter { savingsAccount -> - savingsAccount.status?.active == true && - !savingsAccount.depositType!!.isRecurring - } - .subscribe { savingsAccount -> accounts.add(savingsAccount) } - return accounts - } - - fun getActiveClients(clients: List?): List { - val accounts: MutableList = ArrayList() - Observable.from(clients) - .filter { client -> client.active } - .subscribe { client -> accounts.add(client) } - return accounts - } - - fun getSyncableSavingsAccounts(savingsAccounts: List?): List { - val accounts: MutableList = ArrayList() - Observable.from(savingsAccounts) - .filter { savingsAccount -> - savingsAccount.depositType?.value == "Savings" && - savingsAccount.status?.active == true && - !savingsAccount.depositType!!.isRecurring - } - .subscribe { savingsAccount -> accounts.add(savingsAccount) } - return accounts - } - - /** - * This Method Converting the List of Activation Date to String. - * - * @param dateObj List of Date - * @return - */ - fun getStringOfDate(dateObj: List): String { - val calendar = Calendar.getInstance() - calendar.timeZone = TimeZone.getTimeZone("UTC") - calendar[Calendar.YEAR] = dateObj[0] - //in Calendar months are indexed from 0 to 11 - calendar[Calendar.MONTH] = dateObj[1] - 1 - calendar[Calendar.DAY_OF_MONTH] = dateObj[2] - val df = DateFormat.getDateInstance(DateFormat.MEDIUM) - return df.format(calendar.time) - } - - fun setCircularBackground( - colorId: Int, - context: Context? - ): LayerDrawable { - val color: Drawable = ColorDrawable(ContextCompat.getColor(context!!, colorId)) - val image = ContextCompat.getDrawable( - context, - R.drawable.circular_background - ) - return LayerDrawable(arrayOf(image, color)) - } -} \ No newline at end of file diff --git a/mifosng-android/src/main/java/com/mifos/utils/ValidationUtil.kt b/mifosng-android/src/main/java/com/mifos/utils/ValidationUtil.kt deleted file mode 100644 index 2a63101cc20..00000000000 --- a/mifosng-android/src/main/java/com/mifos/utils/ValidationUtil.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.utils - -import com.mifos.core.network.BaseUrl -import java.net.URL -import java.util.regex.Matcher -import java.util.regex.Pattern - -/** - * @author fomenkoo - */ -object ValidationUtil { - private const val DOMAIN_NAME_REGEX_PATTERN = "^[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*(\\" + - ".[A-Za-z]{2,})$" - private const val IP_ADDRESS_REGEX_PATTERN = "^(\\d|[1-9]\\d|1\\d\\d|2" + - "([0-4]\\d|5[0-5]))\\.(\\d|[1-9]\\d|1\\d\\d|2([0-4]\\d|5[0-5]))\\." + - "(\\d|[1-9]\\d|1\\d\\d|2([0-4]\\d|5[0-5]))\\.(\\d|[1-9]\\d|1\\d\\d|2([0-4]\\d|5[0-5])" + - ")$" - private const val NAME_REGEX_PATTERN = "^[\\p{Alpha} .'-]+$" - private val domainNamePattern = Pattern.compile(DOMAIN_NAME_REGEX_PATTERN) - private lateinit var domainNameMatcher: Matcher - private val ipAddressPattern = Pattern.compile(IP_ADDRESS_REGEX_PATTERN) - private lateinit var ipAddressMatcher: Matcher - - /** - * Removing protocol names and trailing slashes - * from the user entered domain name. - * - * @param url - * @return filteredString - */ - private fun sanitizeDomainNameInput(url: String): String { - var filteredUrl: String - filteredUrl = if (url.contains("https://")) { - //Strip https:// from the URL - url.replace("https://", "") - } else if (url.contains("http://")) { - //String http:// from the URL - url.replace("http://", "") - } else { - //String URL doesn't include protocol - url - } - if (filteredUrl.length > 0 && filteredUrl[filteredUrl.length - 1] == '/') filteredUrl = - filteredUrl.replace("/", "") - return filteredUrl - } - - fun getInstanceUrl(validDomain: String, port: Int?): String { - var validDomain = validDomain - validDomain = sanitizeDomainNameInput(validDomain) - return if (port != null) { - BaseUrl.PROTOCOL_HTTPS + validDomain + ":" + port + BaseUrl.API_PATH - } else { - BaseUrl.PROTOCOL_HTTPS + validDomain + BaseUrl.API_PATH - } - } - - fun isValidUrl(url: String?): Boolean { - return try { - URL(url) - true - } catch (e: Exception) { - false - } - } - - /** - * Validates Domain name entered by user - * against valid domain name patterns - * and also IP address patterns. - * - * @param hex - * @return true if pattern is valid - * and false otherwise - */ - fun isValidDomain(hex: String?): Boolean { - domainNameMatcher = domainNamePattern.matcher(hex) - ipAddressMatcher = ipAddressPattern.matcher(hex) - if (domainNameMatcher.matches()) return true - return ipAddressMatcher.matches() - //TODO MAKE SURE YOU UPDATE THE REGEX to check for ports in the URL - } - - /** - * Validates the Name of Client, Group, Center etc. - * - * @param string Name - * @return Boolean - */ - fun isNameValid(string: String): Boolean { - return string.matches(Regex(NAME_REGEX_PATTERN)) - } -} \ No newline at end of file diff --git a/mifosng-android/src/main/res/anim/fab_close.xml b/mifosng-android/src/main/res/anim/fab_close.xml deleted file mode 100644 index a8e450d484b..00000000000 --- a/mifosng-android/src/main/res/anim/fab_close.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - \ No newline at end of file diff --git a/mifosng-android/src/main/res/anim/fab_open.xml b/mifosng-android/src/main/res/anim/fab_open.xml deleted file mode 100644 index 0cc5ee30821..00000000000 --- a/mifosng-android/src/main/res/anim/fab_open.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - \ No newline at end of file diff --git a/mifosng-android/src/main/res/anim/rotate_backward.xml b/mifosng-android/src/main/res/anim/rotate_backward.xml deleted file mode 100644 index 9bbb510ba6c..00000000000 --- a/mifosng-android/src/main/res/anim/rotate_backward.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - \ No newline at end of file diff --git a/mifosng-android/src/main/res/anim/rotate_forward.xml b/mifosng-android/src/main/res/anim/rotate_forward.xml deleted file mode 100644 index c1173e870bc..00000000000 --- a/mifosng-android/src/main/res/anim/rotate_forward.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - \ No newline at end of file diff --git a/mifosng-android/src/main/res/drawable-hdpi/baseline_calendar_today_black_24.png b/mifosng-android/src/main/res/drawable-hdpi/baseline_calendar_today_black_24.png deleted file mode 100755 index f058ccdb66e..00000000000 Binary files a/mifosng-android/src/main/res/drawable-hdpi/baseline_calendar_today_black_24.png and /dev/null differ diff --git a/mifosng-android/src/main/res/drawable-hdpi/baseline_expand_more_black_18dp.png b/mifosng-android/src/main/res/drawable-hdpi/baseline_expand_more_black_18dp.png deleted file mode 100755 index b5b0a05c469..00000000000 Binary files a/mifosng-android/src/main/res/drawable-hdpi/baseline_expand_more_black_18dp.png and /dev/null differ diff --git a/mifosng-android/src/main/res/drawable-hdpi/baseline_keyboard_arrow_right_black_36.png b/mifosng-android/src/main/res/drawable-hdpi/baseline_keyboard_arrow_right_black_36.png deleted file mode 100755 index a77e2788453..00000000000 Binary files a/mifosng-android/src/main/res/drawable-hdpi/baseline_keyboard_arrow_right_black_36.png and /dev/null differ diff --git a/mifosng-android/src/main/res/drawable-hdpi/ic_content_import_export.png b/mifosng-android/src/main/res/drawable-hdpi/ic_content_import_export.png deleted file mode 100755 index 2cb850e3393..00000000000 Binary files a/mifosng-android/src/main/res/drawable-hdpi/ic_content_import_export.png and /dev/null differ diff --git a/mifosng-android/src/main/res/drawable-mdpi/ic_content_import_export.png b/mifosng-android/src/main/res/drawable-mdpi/ic_content_import_export.png deleted file mode 100755 index 923da5d7927..00000000000 Binary files a/mifosng-android/src/main/res/drawable-mdpi/ic_content_import_export.png and /dev/null differ diff --git a/mifosng-android/src/main/res/drawable-xhdpi/ic_backspace_48px.xml b/mifosng-android/src/main/res/drawable-xhdpi/ic_backspace_48px.xml deleted file mode 100644 index 7b8ee72bc33..00000000000 --- a/mifosng-android/src/main/res/drawable-xhdpi/ic_backspace_48px.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable-xhdpi/ic_content_import_export.png b/mifosng-android/src/main/res/drawable-xhdpi/ic_content_import_export.png deleted file mode 100755 index 70ddaec070b..00000000000 Binary files a/mifosng-android/src/main/res/drawable-xhdpi/ic_content_import_export.png and /dev/null differ diff --git a/mifosng-android/src/main/res/drawable-xhdpi/ic_visibility_48px.xml b/mifosng-android/src/main/res/drawable-xhdpi/ic_visibility_48px.xml deleted file mode 100644 index d70cc25b08c..00000000000 --- a/mifosng-android/src/main/res/drawable-xhdpi/ic_visibility_48px.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable-xxhdpi/ic_content_import_export.png b/mifosng-android/src/main/res/drawable-xxhdpi/ic_content_import_export.png deleted file mode 100755 index d2f1b0579bd..00000000000 Binary files a/mifosng-android/src/main/res/drawable-xxhdpi/ic_content_import_export.png and /dev/null differ diff --git a/mifosng-android/src/main/res/drawable/background.xml b/mifosng-android/src/main/res/drawable/background.xml deleted file mode 100644 index 137d02e7605..00000000000 --- a/mifosng-android/src/main/res/drawable/background.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/mifosng-android/src/main/res/drawable/badge_rounded_corner.xml b/mifosng-android/src/main/res/drawable/badge_rounded_corner.xml deleted file mode 100644 index 5142730f558..00000000000 --- a/mifosng-android/src/main/res/drawable/badge_rounded_corner.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/mifosng-android/src/main/res/drawable/baseline_arrow_drop_down_24.xml b/mifosng-android/src/main/res/drawable/baseline_arrow_drop_down_24.xml deleted file mode 100644 index c1c897af75a..00000000000 --- a/mifosng-android/src/main/res/drawable/baseline_arrow_drop_down_24.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/button_bg_rounded_corners.xml b/mifosng-android/src/main/res/drawable/button_bg_rounded_corners.xml deleted file mode 100644 index f39e2a2ef47..00000000000 --- a/mifosng-android/src/main/res/drawable/button_bg_rounded_corners.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/mifosng-android/src/main/res/drawable/card_blueborder.9.png b/mifosng-android/src/main/res/drawable/card_blueborder.9.png deleted file mode 100755 index a44658e63e1..00000000000 Binary files a/mifosng-android/src/main/res/drawable/card_blueborder.9.png and /dev/null differ diff --git a/mifosng-android/src/main/res/drawable/circular_background.xml b/mifosng-android/src/main/res/drawable/circular_background.xml deleted file mode 100644 index 1995a45454d..00000000000 --- a/mifosng-android/src/main/res/drawable/circular_background.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/mifosng-android/src/main/res/drawable/circular_bg_gray.xml b/mifosng-android/src/main/res/drawable/circular_bg_gray.xml deleted file mode 100644 index d160eada358..00000000000 --- a/mifosng-android/src/main/res/drawable/circular_bg_gray.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/mifosng-android/src/main/res/drawable/gradient_repayment.xml b/mifosng-android/src/main/res/drawable/gradient_repayment.xml deleted file mode 100644 index 829296fc51b..00000000000 --- a/mifosng-android/src/main/res/drawable/gradient_repayment.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/mifosng-android/src/main/res/drawable/gradient_spinner.xml b/mifosng-android/src/main/res/drawable/gradient_spinner.xml deleted file mode 100644 index faff0ab584c..00000000000 --- a/mifosng-android/src/main/res/drawable/gradient_spinner.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/mifosng-android/src/main/res/drawable/ic_account_circle_black_24dp.xml b/mifosng-android/src/main/res/drawable/ic_account_circle_black_24dp.xml deleted file mode 100644 index 23fd52e82a2..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_account_circle_black_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/ic_add_white_24dp.xml b/mifosng-android/src/main/res/drawable/ic_add_white_24dp.xml deleted file mode 100644 index b9b8eca8b90..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_add_white_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/ic_assignment_black_24dp.xml b/mifosng-android/src/main/res/drawable/ic_assignment_black_24dp.xml deleted file mode 100644 index a156f002f4d..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_assignment_black_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/ic_assignment_turned_in_black_24dp.xml b/mifosng-android/src/main/res/drawable/ic_assignment_turned_in_black_24dp.xml deleted file mode 100644 index 7ef6ee23a22..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_assignment_turned_in_black_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/ic_baseline_edit_24.xml b/mifosng-android/src/main/res/drawable/ic_baseline_edit_24.xml deleted file mode 100644 index 2844bafebe8..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_baseline_edit_24.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/ic_centers_24dp.xml b/mifosng-android/src/main/res/drawable/ic_centers_24dp.xml deleted file mode 100644 index f9caf974f7b..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_centers_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/ic_check_box_black_24dp.xml b/mifosng-android/src/main/res/drawable/ic_check_box_black_24dp.xml deleted file mode 100644 index 5e8e7701c10..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_check_box_black_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/ic_check_green_24dp.xml b/mifosng-android/src/main/res/drawable/ic_check_green_24dp.xml deleted file mode 100644 index 3fd38568b30..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_check_green_24dp.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/ic_clear_yellow_24dp.xml b/mifosng-android/src/main/res/drawable/ic_clear_yellow_24dp.xml deleted file mode 100644 index d906d7864b7..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_clear_yellow_24dp.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/ic_cloud_upload_black_24dp.xml b/mifosng-android/src/main/res/drawable/ic_cloud_upload_black_24dp.xml deleted file mode 100644 index 55dbbae85cc..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_cloud_upload_black_24dp.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/ic_dark_mode.xml b/mifosng-android/src/main/res/drawable/ic_dark_mode.xml deleted file mode 100644 index e5391167c40..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_dark_mode.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/ic_dashboard_black_24dp.xml b/mifosng-android/src/main/res/drawable/ic_dashboard_black_24dp.xml deleted file mode 100644 index 52342f43c9b..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_dashboard_black_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/ic_delete_red_24dp.xml b/mifosng-android/src/main/res/drawable/ic_delete_red_24dp.xml deleted file mode 100644 index bf6be2c28cd..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_delete_red_24dp.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/ic_done_all_24dp.xml b/mifosng-android/src/main/res/drawable/ic_done_all_24dp.xml deleted file mode 100644 index a831c7a02cd..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_done_all_24dp.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/ic_done_all_black_24dp.xml b/mifosng-android/src/main/res/drawable/ic_done_all_black_24dp.xml deleted file mode 100644 index 8f032656d5d..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_done_all_black_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/ic_error_black_24dp.xml b/mifosng-android/src/main/res/drawable/ic_error_black_24dp.xml deleted file mode 100644 index 5c5fefb034a..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_error_black_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/ic_event_black_24dp.xml b/mifosng-android/src/main/res/drawable/ic_event_black_24dp.xml deleted file mode 100644 index 36207f8018f..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_event_black_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/ic_filter_list_black_24dp.xml b/mifosng-android/src/main/res/drawable/ic_filter_list_black_24dp.xml deleted file mode 100644 index 50237424128..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_filter_list_black_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/ic_folder_black_24dp.xml b/mifosng-android/src/main/res/drawable/ic_folder_black_24dp.xml deleted file mode 100644 index 846a16841e0..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_folder_black_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/ic_indeterminate_check_box_blue_24dp.xml b/mifosng-android/src/main/res/drawable/ic_indeterminate_check_box_blue_24dp.xml deleted file mode 100644 index 778f4dc4014..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_indeterminate_check_box_blue_24dp.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/ic_lang.xml b/mifosng-android/src/main/res/drawable/ic_lang.xml deleted file mode 100644 index 79b414cd870..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_lang.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/ic_logout.xml b/mifosng-android/src/main/res/drawable/ic_logout.xml deleted file mode 100644 index ae800a6caeb..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_logout.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - \ No newline at end of file diff --git a/mifosng-android/src/main/res/drawable/ic_mail_outline_24dp.xml b/mifosng-android/src/main/res/drawable/ic_mail_outline_24dp.xml deleted file mode 100644 index 4f343ca9250..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_mail_outline_24dp.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/ic_more_vert_black_24dp.xml b/mifosng-android/src/main/res/drawable/ic_more_vert_black_24dp.xml deleted file mode 100644 index 83b13d90b1f..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_more_vert_black_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/ic_my_location_white_24dp.xml b/mifosng-android/src/main/res/drawable/ic_my_location_white_24dp.xml deleted file mode 100644 index 17a41bc87db..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_my_location_white_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/ic_passcode.xml b/mifosng-android/src/main/res/drawable/ic_passcode.xml deleted file mode 100644 index d6191026a48..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_passcode.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/ic_person_black_24dp.xml b/mifosng-android/src/main/res/drawable/ic_person_black_24dp.xml deleted file mode 100644 index 4d29365929c..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_person_black_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/ic_report_item.xml b/mifosng-android/src/main/res/drawable/ic_report_item.xml deleted file mode 100644 index 38c4f7a1656..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_report_item.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - \ No newline at end of file diff --git a/mifosng-android/src/main/res/drawable/ic_restore_24dp.xml b/mifosng-android/src/main/res/drawable/ic_restore_24dp.xml deleted file mode 100644 index b83b014de97..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_restore_24dp.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/ic_search_black_24dp.xml b/mifosng-android/src/main/res/drawable/ic_search_black_24dp.xml deleted file mode 100644 index 41d21ed8471..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_search_black_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/ic_settings.xml b/mifosng-android/src/main/res/drawable/ic_settings.xml deleted file mode 100644 index 52cbda601e1..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_settings.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - \ No newline at end of file diff --git a/mifosng-android/src/main/res/drawable/ic_source_code.xml b/mifosng-android/src/main/res/drawable/ic_source_code.xml deleted file mode 100644 index f3ec2111057..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_source_code.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - \ No newline at end of file diff --git a/mifosng-android/src/main/res/drawable/ic_stop_white_24dp.xml b/mifosng-android/src/main/res/drawable/ic_stop_white_24dp.xml deleted file mode 100644 index c5b211a7776..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_stop_white_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/ic_supervisor_account_24dp.xml b/mifosng-android/src/main/res/drawable/ic_supervisor_account_24dp.xml deleted file mode 100644 index 9bb443956a6..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_supervisor_account_24dp.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/drawable/ic_website.xml b/mifosng-android/src/main/res/drawable/ic_website.xml deleted file mode 100644 index c388cb8e8d3..00000000000 --- a/mifosng-android/src/main/res/drawable/ic_website.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - \ No newline at end of file diff --git a/mifosng-android/src/main/res/drawable/login_button_rounded.xml b/mifosng-android/src/main/res/drawable/login_button_rounded.xml deleted file mode 100644 index a5984cfc6d8..00000000000 --- a/mifosng-android/src/main/res/drawable/login_button_rounded.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/mifosng-android/src/main/res/drawable/round_outline_bg.xml b/mifosng-android/src/main/res/drawable/round_outline_bg.xml deleted file mode 100644 index 65a32a0a901..00000000000 --- a/mifosng-android/src/main/res/drawable/round_outline_bg.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/mifosng-android/src/main/res/drawable/rounded_background.xml b/mifosng-android/src/main/res/drawable/rounded_background.xml deleted file mode 100755 index 86b510f2978..00000000000 --- a/mifosng-android/src/main/res/drawable/rounded_background.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - diff --git a/mifosng-android/src/main/res/drawable/table_row_round_bg.xml b/mifosng-android/src/main/res/drawable/table_row_round_bg.xml deleted file mode 100644 index c3923a0b734..00000000000 --- a/mifosng-android/src/main/res/drawable/table_row_round_bg.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - \ No newline at end of file diff --git a/mifosng-android/src/main/res/drawable/triangle_bottom.xml b/mifosng-android/src/main/res/drawable/triangle_bottom.xml deleted file mode 100644 index b5e5de1a134..00000000000 --- a/mifosng-android/src/main/res/drawable/triangle_bottom.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - \ No newline at end of file diff --git a/mifosng-android/src/main/res/layout/activity_global_container_layout.xml b/mifosng-android/src/main/res/layout/activity_global_container_layout.xml deleted file mode 100755 index 94405b8c195..00000000000 --- a/mifosng-android/src/main/res/layout/activity_global_container_layout.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - diff --git a/mifosng-android/src/main/res/layout/activity_home.xml b/mifosng-android/src/main/res/layout/activity_home.xml deleted file mode 100644 index 107e1e4e610..00000000000 --- a/mifosng-android/src/main/res/layout/activity_home.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/mifosng-android/src/main/res/layout/activity_pinpoint_location.xml b/mifosng-android/src/main/res/layout/activity_pinpoint_location.xml deleted file mode 100644 index 7308c1f184c..00000000000 --- a/mifosng-android/src/main/res/layout/activity_pinpoint_location.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/mifosng-android/src/main/res/layout/activity_survey_question.xml b/mifosng-android/src/main/res/layout/activity_survey_question.xml deleted file mode 100755 index ad36382769b..00000000000 --- a/mifosng-android/src/main/res/layout/activity_survey_question.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - -