From aab55535811a9baf45858c53b0a96b1d27081236 Mon Sep 17 00:00:00 2001 From: Aditya Gupta Date: Fri, 4 Aug 2023 01:19:17 +0530 Subject: [PATCH] Migration from dagger2 to hilt --- build.gradle | 3 + mifosng-android/build.gradle | 11 +- mifosng-android/src/main/AndroidManifest.xml | 8 - .../src/main/java/com/mifos/App.kt | 18 +-- .../com/mifos/mifosxdroid/AboutActivity.kt | 2 + .../mifos/mifosxdroid/ClientListActivity.kt | 18 --- .../mifos/mifosxdroid/GroupListActivity.kt | 18 --- .../com/mifos/mifosxdroid/HomeActivity.kt | 2 + .../pathtracking/PathTrackingActivity.kt | 3 +- .../pathtracking/PathTrackingService.kt | 4 +- .../pinpointclient/PinpointClientActivity.kt | 9 +- ...IndividualCollectionSheetDetailsAdapter.kt | 2 +- .../mifosxdroid/core/MifosBaseActivity.kt | 15 -- .../chargedialog/ChargeDialogFragment.kt | 4 +- .../CheckerTaskFilterDialogFragment.kt | 15 +- .../CollectionSheetDialogFragment.kt | 4 +- .../DataTableRowDialogFragment.kt | 7 +- .../documentdialog/DocumentDialogFragment.kt | 4 +- .../IdentifierDialogFragment.kt | 4 +- .../LoanChargeDialogFragment.kt | 4 +- .../SyncCentersDialogFragment.kt | 2 - .../SyncClientsDialogFragment.kt | 4 +- .../SyncGroupsDialogFragment.kt | 4 +- .../SyncSurveysDialogFragment.kt | 4 +- .../mifosxdroid/injection/ActivityContext.kt | 12 -- .../injection/ApplicationContext.kt | 12 -- .../mifosxdroid/injection/PerActivity.kt | 15 -- .../injection/component/ActivityComponent.kt | 152 ------------------ .../component/ApplicationComponent.kt | 88 ---------- .../injection/module/ActivityModule.kt | 24 --- .../injection/module/ApplicationModule.kt | 19 +-- .../mifos/mifosxdroid/login/LoginActivity.kt | 3 +- .../OfflineDashboardFragment.kt | 4 +- .../SyncCenterPayloadsFragment.kt | 4 +- .../SyncClientPayloadsFragment.kt | 4 +- .../SyncGroupPayloadsFragment.kt | 6 +- .../SyncLoanRepaymentTransactionFragment.kt | 4 +- .../SyncSavingsAccountTransactionFragment.kt | 4 +- .../offlinejobs/OfflineSyncCenter.kt | 2 - .../offlinejobs/OfflineSyncClient.kt | 2 - .../offlinejobs/OfflineSyncGroup.kt | 2 - .../offlinejobs/OfflineSyncLoanRepayment.kt | 8 +- .../offlinejobs/OfflineSyncSavingsAccount.kt | 2 - .../mifosxdroid/online/CentersActivity.kt | 2 + .../mifosxdroid/online/ClientActivity.kt | 15 +- .../online/GenerateCollectionSheetActivity.kt | 2 + .../mifosxdroid/online/GroupsActivity.kt | 2 + .../mifosxdroid/online/RunReportsActivity.kt | 2 + .../online/activate/ActivateFragment.kt | 4 +- .../centerdetails/CenterDetailsFragment.kt | 9 +- .../online/centerlist/CenterListFragment.kt | 3 +- .../checkerinbox/CheckerInboxFragment.kt | 8 +- .../CheckerInboxPendingTasksActivity.kt | 2 + .../checkerinbox/CheckerInboxTasksFragment.kt | 8 +- .../clientcharge/ClientChargeFragment.kt | 7 +- .../clientdetails/ClientDetailsFragment.kt | 5 +- .../ClientIdentifiersFragment.kt | 6 +- .../online/clientlist/ClientListFragment.kt | 12 +- .../CollectionSheetFragment.kt | 4 +- .../NewIndividualCollectionSheetFragment.kt | 4 +- ...ndividualCollectionSheetDetailsFragment.kt | 8 +- .../PaymentDetailsFragment.kt | 7 +- .../CreateNewCenterFragment.kt | 8 +- .../CreateNewClientFragment.kt | 4 +- .../createnewgroup/CreateNewGroupFragment.kt | 17 +- .../online/datatable/DataTableFragment.kt | 14 +- .../datatabledata/DataTableDataFragment.kt | 6 +- .../DataTableListFragment.kt | 13 +- .../documentlist/DocumentListFragment.kt | 6 +- .../GenerateCollectionSheetFragment.kt | 4 +- .../GenerateCollectionSheetPresenter.kt | 2 +- .../groupdetails/GroupDetailsFragment.kt | 3 +- .../online/grouplist/GroupListFragment.kt | 14 +- .../GroupLoanAccountFragment.kt | 32 ++-- .../online/groupslist/GroupsListFragment.kt | 4 +- .../online/loanaccount/LoanAccountFragment.kt | 8 +- .../LoanAccountApproval.kt | 9 +- .../LoanAccountDisbursementFragment.kt | 7 +- .../LoanAccountSummaryFragment.kt | 5 +- .../online/loancharge/LoanChargeFragment.kt | 7 +- .../loanrepayment/LoanRepaymentFragment.kt | 8 +- .../LoanRepaymentScheduleFragment.kt | 3 +- .../LoanTransactionsFragment.kt | 6 +- .../mifosxdroid/online/note/NoteFragment.kt | 7 +- .../runreports/report/ReportFragment.kt | 8 +- .../reportcategory/ReportCategoryFragment.kt | 8 +- .../reportdetail/ReportDetailFragment.kt | 7 +- .../SavingsAccountSummaryFragment.kt | 4 +- .../SavingsAccountTransactionFragment.kt | 8 +- .../savingsaccount/SavingsAccountFragment.kt | 10 +- .../SavingsAccountActivateFragment.kt | 7 +- .../SavingsAccountApprovalFragment.kt | 12 +- .../online/search/SearchFragment.kt | 4 +- .../online/sign/SignatureFragment.kt | 7 +- .../online/surveylist/SurveyListFragment.kt | 7 +- .../surveysubmit/SurveySubmitFragment.kt | 7 +- .../mifos/objects/accounts/savings/Charge.kt | 2 +- .../accounts/savings/ChargeCalculationType.kt | 2 +- .../accounts/savings/ChargeTimeType.kt | 2 +- 99 files changed, 249 insertions(+), 679 deletions(-) delete mode 100644 mifosng-android/src/main/java/com/mifos/mifosxdroid/ClientListActivity.kt delete mode 100644 mifosng-android/src/main/java/com/mifos/mifosxdroid/GroupListActivity.kt delete mode 100644 mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/ActivityContext.kt delete mode 100644 mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/ApplicationContext.kt delete mode 100644 mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/PerActivity.kt delete mode 100644 mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/component/ActivityComponent.kt delete mode 100644 mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/component/ApplicationComponent.kt delete mode 100644 mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/module/ActivityModule.kt diff --git a/build.gradle b/build.gradle index 7de19df4092..afd961e0e0b 100644 --- a/build.gradle +++ b/build.gradle @@ -120,4 +120,7 @@ ext { //navigation components version navigationComponentsVersion = '2.6.0' + + // hiltVersion + hiltVersion = '2.44' } \ No newline at end of file diff --git a/mifosng-android/build.gradle b/mifosng-android/build.gradle index 5fb4c190df3..213e562155c 100755 --- a/mifosng-android/build.gradle +++ b/mifosng-android/build.gradle @@ -21,6 +21,7 @@ buildscript { classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version" classpath "com.github.spotbugs.snom:spotbugs-gradle-plugin:5.0.14" classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.6.0" + classpath 'com.google.dagger:hilt-android-gradle-plugin:2.44' } } @@ -41,6 +42,7 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' apply plugin: 'kotlin-parcelize' apply plugin: 'androidx.navigation.safeargs.kotlin' +apply plugin: 'com.google.dagger.hilt.android' android { compileSdkVersion rootProject.ext.compileSdkVersion @@ -190,11 +192,6 @@ dependencies { implementation "com.google.maps.android:android-maps-utils:$rootProject.mapUtilsServicesVersion" implementation "androidx.test.espresso:espresso-idling-resource:$rootProject.espressoidlingVersion" - //Dagger dependencies - implementation "com.google.dagger:dagger:$rootProject.daggerVersion" - compileOnly "javax.annotation:jsr250-api:$rootProject.jsrVersion" //Required by Dagger2 - kapt "com.google.dagger:dagger-compiler:$rootProject.daggerVersion" - //LifeCycle implementation "androidx.lifecycle:lifecycle-runtime-ktx:$rootProject.lifecycleVersion" implementation "androidx.lifecycle:lifecycle-extensions:$rootProject.lifecycleExtensionsVersion" @@ -279,6 +276,10 @@ dependencies { implementation "androidx.navigation:navigation-fragment-ktx:$rootProject.navigationComponentsVersion" implementation "androidx.navigation:navigation-ui-ktx:$rootProject.navigationComponentsVersion" + // Hilt dependency + implementation "com.google.dagger:hilt-android:$rootProject.hiltVersion" + kapt "com.google.dagger:hilt-android-compiler:$rootProject.hiltVersion" + } /* All direct/transitive dependencies shared between your test and production APKs need to be diff --git a/mifosng-android/src/main/AndroidManifest.xml b/mifosng-android/src/main/AndroidManifest.xml index 53feb6090e4..6db524e1da8 100755 --- a/mifosng-android/src/main/AndroidManifest.xml +++ b/mifosng-android/src/main/AndroidManifest.xml @@ -103,14 +103,6 @@ android:name="android.support.PARENT_ACTIVITY" android:value=".HomeActivity" /> - - = ArrayList() override fun onItemLongClick(position: Int) { apptableId = addresses[position].clientId @@ -84,7 +86,6 @@ class PinpointClientActivity : MifosBaseActivity(), PinPointClientMvpView, OnRef override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - activityComponent?.inject(this) binding = ActivityPinpointLocationBinding.inflate(layoutInflater) setContentView(binding.root) pinPointClientPresenter?.attachView(this) diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/IndividualCollectionSheetDetailsAdapter.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/IndividualCollectionSheetDetailsAdapter.kt index 7e8fa39e2dc..0b222eec57f 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/IndividualCollectionSheetDetailsAdapter.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/IndividualCollectionSheetDetailsAdapter.kt @@ -10,11 +10,11 @@ import androidx.recyclerview.widget.RecyclerView import com.mifos.api.model.BulkRepaymentTransactions import com.mifos.mifosxdroid.R import com.mifos.mifosxdroid.databinding.ItemIndividualCollectionSheetBinding -import com.mifos.mifosxdroid.injection.ActivityContext import com.mifos.mifosxdroid.online.collectionsheetindividualdetails.OnRetrieveSheetItemData import com.mifos.objects.accounts.loan.PaymentTypeOptions import com.mifos.objects.collectionsheet.LoanAndClientName import com.mifos.utils.ImageLoaderUtils +import dagger.hilt.android.qualifiers.ActivityContext import java.util.Locale import javax.inject.Inject 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 index 7d46b9fcab1..58da5ddd3c5 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/MifosBaseActivity.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/core/MifosBaseActivity.kt @@ -18,9 +18,6 @@ import androidx.fragment.app.FragmentManager import com.mifos.App import com.mifos.mifosxdroid.R import com.mifos.mifosxdroid.SplashScreenActivity -import com.mifos.mifosxdroid.injection.component.ActivityComponent -import com.mifos.mifosxdroid.injection.component.DaggerActivityComponent -import com.mifos.mifosxdroid.injection.module.ActivityModule import com.mifos.mifosxdroid.passcode.PassCodeActivity import com.mifos.mobile.passcode.BasePassCodeActivity import com.mifos.utils.Constants @@ -33,7 +30,6 @@ import com.mifos.utils.PrefManager.clearPrefs */ open class MifosBaseActivity : BasePassCodeActivity(), BaseActivityCallback { var toolbar: Toolbar? = null - private var mActivityComponent: ActivityComponent? = null private var progress: ProgressDialog? = null override fun setContentView(layoutResID: Int) { super.setContentView(layoutResID) @@ -51,17 +47,6 @@ open class MifosBaseActivity : BasePassCodeActivity(), BaseActivityCallback { } } - val activityComponent: ActivityComponent? - get() { - if (mActivityComponent == null) { - mActivityComponent = DaggerActivityComponent.builder() - .activityModule(ActivityModule(this)) - .applicationComponent(App.get(this).component) - .build() - } - return mActivityComponent - } - private fun setActionBarTitle(title: String?) { if (supportActionBar != null && getTitle() != null) { setTitle(title) diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/chargedialog/ChargeDialogFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/chargedialog/ChargeDialogFragment.kt index 605cc94ac3a..d473cf16e52 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/chargedialog/ChargeDialogFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/chargedialog/ChargeDialogFragment.kt @@ -14,7 +14,6 @@ import android.widget.AdapterView.OnItemSelectedListener import android.widget.ArrayAdapter import androidx.fragment.app.DialogFragment import com.mifos.mifosxdroid.R -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.ProgressableDialogFragment import com.mifos.mifosxdroid.core.util.Toaster.show import com.mifos.mifosxdroid.databinding.DialogFragmentChargeBinding @@ -28,6 +27,7 @@ import com.mifos.services.data.ChargesPayload import com.mifos.utils.Constants import com.mifos.utils.DateHelper import com.mifos.utils.FragmentConstants +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** @@ -36,6 +36,7 @@ import javax.inject.Inject * * Use this Dialog Fragment to Create and/or Update charges */ +@AndroidEntryPoint class ChargeDialogFragment : ProgressableDialogFragment(), OnDatePickListener, ChargeDialogMvpView, OnItemSelectedListener { val LOG_TAG = javaClass.simpleName @@ -58,7 +59,6 @@ class ChargeDialogFragment : ProgressableDialogFragment(), OnDatePickListener, C private var createdCharge: Charges? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) if (arguments != null) clientId = requireArguments().getInt(Constants.CLIENT_ID) } 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 index 442293b494e..8fab842181d 100644 --- 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 @@ -1,27 +1,28 @@ package com.mifos.mifosxdroid.dialogfragments.checkertaskfilterdialog -import androidx.lifecycle.Observer -import androidx.lifecycle.ViewModelProviders 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.* +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.core.MifosBaseActivity import com.mifos.mifosxdroid.databinding.DialogFragmentCheckerTaskFilterBinding import com.mifos.mifosxdroid.online.checkerinbox.CheckerInboxViewModel import com.mifos.mifosxdroid.online.checkerinbox.CheckerInboxViewModelFactory import com.mifos.mifosxdroid.uihelpers.MFDatePicker import com.mifos.utils.FragmentConstants -import java.lang.ClassCastException +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 { @@ -61,14 +62,12 @@ class CheckerTaskFilterDialogFragment : DialogFragment(), MFDatePicker.OnDatePic selectedEntity = ALL datePickerFromDate = MFDatePicker.newInsance(this) datePickerToDate = MFDatePicker.newInsance(this) - - (activity as MifosBaseActivity).activityComponent?.inject(this) } override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View { - binding = DialogFragmentCheckerTaskFilterBinding.inflate(inflater,container,false) + binding = DialogFragmentCheckerTaskFilterBinding.inflate(inflater, container, false) return binding.root } diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/collectionsheetdialog/CollectionSheetDialogFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/collectionsheetdialog/CollectionSheetDialogFragment.kt index a0bfd3beed8..395ec4f2dcc 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/collectionsheetdialog/CollectionSheetDialogFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/collectionsheetdialog/CollectionSheetDialogFragment.kt @@ -5,14 +5,15 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import com.google.android.material.bottomsheet.BottomSheetDialogFragment -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.databinding.FragmentCollectionSheetDialogBinding import com.mifos.mifosxdroid.online.collectionsheetindividual.NewIndividualCollectionSheetFragment import com.mifos.utils.Constants +import dagger.hilt.android.AndroidEntryPoint /** * Created by aksh on 2/7/18. */ +@AndroidEntryPoint class CollectionSheetDialogFragment : BottomSheetDialogFragment() { private lateinit var binding: FragmentCollectionSheetDialogBinding @@ -20,7 +21,6 @@ class CollectionSheetDialogFragment : BottomSheetDialogFragment() { private var date: String? = null private var members = 0 override fun onCreate(savedInstanceState: Bundle?) { - (activity as MifosBaseActivity).activityComponent?.inject(this) date = requireArguments().getString(Constants.REPAYMENT_DATE) members = requireArguments().getInt(Constants.MEMBERS) super.onCreate(savedInstanceState) diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/datatablerowdialog/DataTableRowDialogFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/datatablerowdialog/DataTableRowDialogFragment.kt index 022c954487a..e12b17a827a 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/datatablerowdialog/DataTableRowDialogFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/datatablerowdialog/DataTableRowDialogFragment.kt @@ -17,7 +17,6 @@ import androidx.fragment.app.DialogFragment import com.mifos.api.GenericResponse import com.mifos.exceptions.RequiredFieldException import com.mifos.mifosxdroid.R -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.databinding.DialogFragmentAddEntryToDatatableBinding import com.mifos.mifosxdroid.formwidgets.FormEditText import com.mifos.mifosxdroid.formwidgets.FormNumericEditText @@ -27,11 +26,13 @@ import com.mifos.mifosxdroid.formwidgets.FormWidget import com.mifos.objects.noncore.DataTable import com.mifos.utils.Constants import com.mifos.utils.SafeUIBlockingUtility +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** * Created by ishankhanna on 01/08/14. */ +@AndroidEntryPoint class DataTableRowDialogFragment : DialogFragment(), DataTableRowDialogMvpView { private lateinit var binding: DialogFragmentAddEntryToDatatableBinding @@ -45,10 +46,6 @@ class DataTableRowDialogFragment : DialogFragment(), DataTableRowDialogMvpView { private var entityId = 0 private var safeUIBlockingUtility: SafeUIBlockingUtility? = null private val listFormWidgets: MutableList = ArrayList() - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) - } override fun onCreateView( inflater: LayoutInflater, diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/documentdialog/DocumentDialogFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/documentdialog/DocumentDialogFragment.kt index 8a898c25fe0..8159c109d76 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/documentdialog/DocumentDialogFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/documentdialog/DocumentDialogFragment.kt @@ -7,7 +7,6 @@ package com.mifos.mifosxdroid.dialogfragments.documentdialog import android.Manifest import android.annotation.TargetApi import android.app.Activity -import android.app.Dialog import android.content.Intent import android.content.pm.PackageManager import android.net.Uri @@ -30,6 +29,7 @@ import com.mifos.utils.CheckSelfPermissionAndRequest import com.mifos.utils.Constants import com.mifos.utils.FileUtils import com.mifos.utils.SafeUIBlockingUtility +import dagger.hilt.android.AndroidEntryPoint import java.io.File import javax.inject.Inject @@ -39,6 +39,7 @@ import javax.inject.Inject * * Use this Dialog Fragment to Create and/or Update Documents */ +@AndroidEntryPoint class DocumentDialogFragment : DialogFragment(), DocumentDialogMvpView { private lateinit var binding: DialogFragmentDocumentBinding @@ -60,7 +61,6 @@ class DocumentDialogFragment : DialogFragment(), DocumentDialogMvpView { private var uri: Uri? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) safeUIBlockingUtility = SafeUIBlockingUtility( requireContext(), getString(R.string.document_dialog_fragment_loading_message) diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/identifierdialog/IdentifierDialogFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/identifierdialog/IdentifierDialogFragment.kt index 21dc4a1a9ae..f3246b12c6c 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/identifierdialog/IdentifierDialogFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/identifierdialog/IdentifierDialogFragment.kt @@ -9,7 +9,6 @@ import android.widget.AdapterView.OnItemSelectedListener import android.widget.ArrayAdapter import android.widget.Toast import com.mifos.mifosxdroid.R -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.ProgressableDialogFragment import com.mifos.mifosxdroid.databinding.DialogFragmentIdentifierBinding import com.mifos.objects.noncore.DocumentType @@ -18,11 +17,13 @@ import com.mifos.objects.noncore.IdentifierCreationResponse import com.mifos.objects.noncore.IdentifierPayload import com.mifos.objects.noncore.IdentifierTemplate import com.mifos.utils.Constants +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** * Created by Rajan Maurya on 01/10/16. */ +@AndroidEntryPoint class IdentifierDialogFragment : ProgressableDialogFragment(), IdentifierDialogMvpView, OnItemSelectedListener { @@ -45,7 +46,6 @@ class IdentifierDialogFragment : ProgressableDialogFragment(), IdentifierDialogM private var mIdentifierStatusAdapter: ArrayAdapter? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity?)!!.activityComponent!!.inject(this) if (arguments != null) { clientId = requireArguments().getInt(Constants.CLIENT_ID) } diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/loanchargedialog/LoanChargeDialogFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/loanchargedialog/LoanChargeDialogFragment.kt index 99adfa256f9..346d78b066a 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/loanchargedialog/LoanChargeDialogFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/loanchargedialog/LoanChargeDialogFragment.kt @@ -16,7 +16,6 @@ import android.widget.ArrayAdapter import android.widget.Toast import androidx.fragment.app.DialogFragment import com.mifos.mifosxdroid.R -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.ProgressableDialogFragment import com.mifos.mifosxdroid.core.util.Toaster.show import com.mifos.mifosxdroid.databinding.DialogFragmentChargeBinding @@ -30,6 +29,7 @@ import com.mifos.services.data.ChargesPayload import com.mifos.utils.Constants import com.mifos.utils.DateHelper import com.mifos.utils.FragmentConstants +import dagger.hilt.android.AndroidEntryPoint import okhttp3.ResponseBody import org.json.JSONObject import java.io.BufferedReader @@ -42,6 +42,7 @@ import javax.inject.Inject * * Use this Dialog Fragment to Create and/or Update charges */ +@AndroidEntryPoint class LoanChargeDialogFragment : ProgressableDialogFragment(), OnDatePickListener, LoanChargeDialogMvpView { @@ -63,7 +64,6 @@ class LoanChargeDialogFragment : ProgressableDialogFragment(), OnDatePickListene private var onChargeCreateListener: OnChargeCreateListener? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) if (arguments != null) loanAccountNumber = requireArguments().getInt(Constants.LOAN_ACCOUNT_NUMBER) } diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/synccenterdialog/SyncCentersDialogFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/synccenterdialog/SyncCentersDialogFragment.kt index 7be757bacc1..68aca14314a 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/synccenterdialog/SyncCentersDialogFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/synccenterdialog/SyncCentersDialogFragment.kt @@ -8,7 +8,6 @@ import android.view.ViewGroup import android.widget.Toast import androidx.fragment.app.DialogFragment import com.mifos.mifosxdroid.R -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.util.Toaster.show import com.mifos.mifosxdroid.databinding.DialogFragmentSyncCentersBinding import com.mifos.objects.group.Center @@ -25,7 +24,6 @@ class SyncCentersDialogFragment : DialogFragment(), SyncCenterDialogMvpView { lateinit var syncCentersDialogPresenter: SyncCenterDialogPresenter private lateinit var mCenterList: List
override fun onCreate(savedInstanceState: Bundle?) { - (activity as MifosBaseActivity).activityComponent?.inject(this) if (arguments != null) { mCenterList = requireArguments().getParcelableArrayList(Constants.CENTER) ?: ArrayList() } diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/syncclientsdialog/SyncClientsDialogFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/syncclientsdialog/SyncClientsDialogFragment.kt index 92254bed2ee..0e37b4a9482 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/syncclientsdialog/SyncClientsDialogFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/syncclientsdialog/SyncClientsDialogFragment.kt @@ -8,18 +8,19 @@ import android.view.ViewGroup import android.widget.Toast import androidx.fragment.app.DialogFragment import com.mifos.mifosxdroid.R -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.util.Toaster.show import com.mifos.mifosxdroid.databinding.DialogFragmentSyncClientsBinding import com.mifos.objects.client.Client import com.mifos.utils.Constants import com.mifos.utils.Network.isOnline import com.mifos.utils.PrefManager.userStatus +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** * Created by Rajan Maurya on 08/08/16. */ +@AndroidEntryPoint class SyncClientsDialogFragment : DialogFragment(), SyncClientsDialogMvpView { private lateinit var binding: DialogFragmentSyncClientsBinding @@ -28,7 +29,6 @@ class SyncClientsDialogFragment : DialogFragment(), SyncClientsDialogMvpView { lateinit var mSyncClientsDialogPresenter: SyncClientsDialogPresenter private var mClientList: List? = null override fun onCreate(savedInstanceState: Bundle?) { - (activity as MifosBaseActivity).activityComponent?.inject(this) if (arguments != null) { mClientList = requireArguments().getParcelableArrayList(Constants.CLIENT) } diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/syncgroupsdialog/SyncGroupsDialogFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/syncgroupsdialog/SyncGroupsDialogFragment.kt index 1672911004c..921ed34c141 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/syncgroupsdialog/SyncGroupsDialogFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/syncgroupsdialog/SyncGroupsDialogFragment.kt @@ -8,18 +8,19 @@ import android.view.ViewGroup import android.widget.Toast import androidx.fragment.app.DialogFragment import com.mifos.mifosxdroid.R -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.util.Toaster.show import com.mifos.mifosxdroid.databinding.DialogFragmentSyncGroupsBinding import com.mifos.objects.group.Group import com.mifos.utils.Constants import com.mifos.utils.Network.isOnline import com.mifos.utils.PrefManager.userStatus +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** * Created by Rajan Maurya on 11/09/16. */ +@AndroidEntryPoint class SyncGroupsDialogFragment : DialogFragment(), SyncGroupsDialogMvpView { private lateinit var binding: DialogFragmentSyncGroupsBinding @@ -28,7 +29,6 @@ class SyncGroupsDialogFragment : DialogFragment(), SyncGroupsDialogMvpView { lateinit var syncGroupsDialogPresenter: SyncGroupsDialogPresenter private var groups: List? = null override fun onCreate(savedInstanceState: Bundle?) { - (activity as MifosBaseActivity).activityComponent?.inject(this) if (arguments != null) { groups = requireArguments().getParcelableArrayList(Constants.GROUPS) } 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 index 40560a0cd14..4c949d6acce 100644 --- 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 @@ -7,15 +7,16 @@ import android.view.ViewGroup import android.widget.Toast import androidx.fragment.app.DialogFragment import com.mifos.mifosxdroid.R -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.util.Toaster.show import com.mifos.mifosxdroid.databinding.DialogFragmentSyncSurveysBinding import com.mifos.objects.survey.Survey import com.mifos.utils.Constants import com.mifos.utils.Network.isOnline import com.mifos.utils.PrefManager.userStatus +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject +@AndroidEntryPoint class SyncSurveysDialogFragment : DialogFragment(), SyncSurveysDialogMvpView { private lateinit var binding: DialogFragmentSyncSurveysBinding @@ -24,7 +25,6 @@ class SyncSurveysDialogFragment : DialogFragment(), SyncSurveysDialogMvpView { lateinit var mSyncSurveysDialogPresenter: SyncSurveysDialogPresenter private var mSurveyList: List? = null override fun onCreate(savedInstanceState: Bundle?) { - (activity as MifosBaseActivity).activityComponent!!.inject(this) mSurveyList = ArrayList() super.onCreate(savedInstanceState) } diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/ActivityContext.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/ActivityContext.kt deleted file mode 100644 index a7ad5f9cb46..00000000000 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/ActivityContext.kt +++ /dev/null @@ -1,12 +0,0 @@ -package com.mifos.mifosxdroid.injection - -import java.lang.annotation.Retention -import java.lang.annotation.RetentionPolicy -import javax.inject.Qualifier - -/** - * @author Rajan Maurya - */ -@Qualifier -@Retention(RetentionPolicy.RUNTIME) -annotation class ActivityContext \ No newline at end of file diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/ApplicationContext.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/ApplicationContext.kt deleted file mode 100644 index 29502155843..00000000000 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/ApplicationContext.kt +++ /dev/null @@ -1,12 +0,0 @@ -package com.mifos.mifosxdroid.injection - -import java.lang.annotation.Retention -import java.lang.annotation.RetentionPolicy -import javax.inject.Qualifier - -/** - * @author Rajan Maurya - */ -@Qualifier -@Retention(RetentionPolicy.RUNTIME) -annotation class ApplicationContext \ No newline at end of file diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/PerActivity.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/PerActivity.kt deleted file mode 100644 index 44e279a2413..00000000000 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/PerActivity.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.mifos.mifosxdroid.injection - -import java.lang.annotation.Retention -import java.lang.annotation.RetentionPolicy -import javax.inject.Scope - -/** - * @author Rajan Maurya - * A scoping annotation to permit objects whose lifetime should - * conform to the life of the Activity to be memorised in the - * correct component. - */ -@Scope -@Retention(RetentionPolicy.RUNTIME) -annotation class PerActivity \ No newline at end of file diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/component/ActivityComponent.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/component/ActivityComponent.kt deleted file mode 100644 index 5ec9cfb3b1b..00000000000 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/component/ActivityComponent.kt +++ /dev/null @@ -1,152 +0,0 @@ -package com.mifos.mifosxdroid.injection.component - -import com.mifos.mifosxdroid.activity.pathtracking.PathTrackingActivity -import com.mifos.mifosxdroid.activity.pinpointclient.PinpointClientActivity -import com.mifos.mifosxdroid.dialogfragments.chargedialog.ChargeDialogFragment -import com.mifos.mifosxdroid.dialogfragments.checkertaskfilterdialog.CheckerTaskFilterDialogFragment -import com.mifos.mifosxdroid.dialogfragments.collectionsheetdialog.CollectionSheetDialogFragment -import com.mifos.mifosxdroid.dialogfragments.datatablerowdialog.DataTableRowDialogFragment -import com.mifos.mifosxdroid.dialogfragments.documentdialog.DocumentDialogFragment -import com.mifos.mifosxdroid.dialogfragments.identifierdialog.IdentifierDialogFragment -import com.mifos.mifosxdroid.dialogfragments.loanchargedialog.LoanChargeDialogFragment -import com.mifos.mifosxdroid.dialogfragments.synccenterdialog.SyncCentersDialogFragment -import com.mifos.mifosxdroid.dialogfragments.syncclientsdialog.SyncClientsDialogFragment -import com.mifos.mifosxdroid.dialogfragments.syncgroupsdialog.SyncGroupsDialogFragment -import com.mifos.mifosxdroid.dialogfragments.syncsurveysdialog.SyncSurveysDialogFragment -import com.mifos.mifosxdroid.injection.PerActivity -import com.mifos.mifosxdroid.injection.module.ActivityModule -import com.mifos.mifosxdroid.login.LoginActivity -import com.mifos.mifosxdroid.offline.offlinedashbarod.OfflineDashboardFragment -import com.mifos.mifosxdroid.offline.synccenterpayloads.SyncCenterPayloadsFragment -import com.mifos.mifosxdroid.offline.syncclientpayloads.SyncClientPayloadsFragment -import com.mifos.mifosxdroid.offline.syncgrouppayloads.SyncGroupPayloadsFragment -import com.mifos.mifosxdroid.offline.syncloanrepaymenttransacition.SyncLoanRepaymentTransactionFragment -import com.mifos.mifosxdroid.offline.syncsavingsaccounttransaction.SyncSavingsAccountTransactionFragment -import com.mifos.mifosxdroid.online.activate.ActivateFragment -import com.mifos.mifosxdroid.online.centerdetails.CenterDetailsFragment -import com.mifos.mifosxdroid.online.centerlist.CenterListFragment -import com.mifos.mifosxdroid.online.checkerinbox.CheckerInboxFragment -import com.mifos.mifosxdroid.online.checkerinbox.CheckerInboxPendingTasksActivity -import com.mifos.mifosxdroid.online.checkerinbox.CheckerInboxTasksFragment -import com.mifos.mifosxdroid.online.clientcharge.ClientChargeFragment -import com.mifos.mifosxdroid.online.clientdetails.ClientDetailsFragment -import com.mifos.mifosxdroid.online.clientidentifiers.ClientIdentifiersFragment -import com.mifos.mifosxdroid.online.clientlist.ClientListFragment -import com.mifos.mifosxdroid.online.collectionsheet.CollectionSheetFragment -import com.mifos.mifosxdroid.online.collectionsheetindividual.IndividualCollectionSheetFragment -import com.mifos.mifosxdroid.online.collectionsheetindividual.NewIndividualCollectionSheetFragment -import com.mifos.mifosxdroid.online.collectionsheetindividualdetails.IndividualCollectionSheetDetailsFragment -import com.mifos.mifosxdroid.online.collectionsheetindividualdetails.PaymentDetailsFragment -import com.mifos.mifosxdroid.online.createnewcenter.CreateNewCenterFragment -import com.mifos.mifosxdroid.online.createnewclient.CreateNewClientFragment -import com.mifos.mifosxdroid.online.createnewgroup.CreateNewGroupFragment -import com.mifos.mifosxdroid.online.datatable.DataTableFragment -import com.mifos.mifosxdroid.online.datatabledata.DataTableDataFragment -import com.mifos.mifosxdroid.online.datatablelistfragment.DataTableListFragment -import com.mifos.mifosxdroid.online.documentlist.DocumentListFragment -import com.mifos.mifosxdroid.online.generatecollectionsheet.GenerateCollectionSheetFragment -import com.mifos.mifosxdroid.online.groupdetails.GroupDetailsFragment -import com.mifos.mifosxdroid.online.grouplist.GroupListFragment -import com.mifos.mifosxdroid.online.grouploanaccount.GroupLoanAccountFragment -import com.mifos.mifosxdroid.online.groupslist.GroupsListFragment -import com.mifos.mifosxdroid.online.loanaccount.LoanAccountFragment -import com.mifos.mifosxdroid.online.loanaccountapproval.LoanAccountApproval -import com.mifos.mifosxdroid.online.loanaccountdisbursement.LoanAccountDisbursementFragment -import com.mifos.mifosxdroid.online.loanaccountsummary.LoanAccountSummaryFragment -import com.mifos.mifosxdroid.online.loancharge.LoanChargeFragment -import com.mifos.mifosxdroid.online.loanrepayment.LoanRepaymentFragment -import com.mifos.mifosxdroid.online.loanrepaymentschedule.LoanRepaymentScheduleFragment -import com.mifos.mifosxdroid.online.loantransactions.LoanTransactionsFragment -import com.mifos.mifosxdroid.online.note.NoteFragment -import com.mifos.mifosxdroid.online.runreports.report.ReportFragment -import com.mifos.mifosxdroid.online.runreports.reportcategory.ReportCategoryFragment -import com.mifos.mifosxdroid.online.runreports.reportdetail.ReportDetailFragment -import com.mifos.mifosxdroid.online.savingaccountsummary.SavingsAccountSummaryFragment -import com.mifos.mifosxdroid.online.savingaccounttransaction.SavingsAccountTransactionFragment -import com.mifos.mifosxdroid.online.savingsaccount.SavingsAccountFragment -import com.mifos.mifosxdroid.online.savingsaccountactivate.SavingsAccountActivateFragment -import com.mifos.mifosxdroid.online.savingsaccountapproval.SavingsAccountApprovalFragment -import com.mifos.mifosxdroid.online.search.SearchFragment -import com.mifos.mifosxdroid.online.sign.SignatureFragment -import com.mifos.mifosxdroid.online.surveylist.SurveyListFragment -import com.mifos.mifosxdroid.online.surveysubmit.SurveySubmitFragment -import com.mifos.mifosxdroid.passcode.PassCodeActivity -import dagger.Component - -/** - * @author Rajan Maurya - * This component inject dependencies to all Activities across the application - */ -@PerActivity -@Component(dependencies = [ApplicationComponent::class], modules = [ActivityModule::class]) -interface ActivityComponent { - fun inject(loginActivity: LoginActivity) - fun inject(passCodeActivity: PassCodeActivity) - fun inject(centerListFragment: CenterListFragment) - fun inject(clientChargeFragment: ClientChargeFragment) - fun inject(clientListFragment: ClientListFragment) - fun inject(clientIdentifiersFragment: ClientIdentifiersFragment) - fun inject(clientSearchFragment: SearchFragment) - fun inject(documentListFragment: DocumentListFragment) - fun inject(groupListFragment: GroupListFragment) - fun inject(generateCollectionSheetFragment: GenerateCollectionSheetFragment) - fun inject(createNewCenterFragment: CreateNewCenterFragment) - fun inject(createNewGroupFragment: CreateNewGroupFragment) - fun inject(createNewClientFragment: CreateNewClientFragment) - fun inject(dataTableDataFragment: DataTableDataFragment) - fun inject(groupDetailsFragment: GroupDetailsFragment) - fun inject(clientDetailsFragment: ClientDetailsFragment) - fun inject(loanAccountSummaryFragment: LoanAccountSummaryFragment) - fun inject(savingsAccountSummaryFragment: SavingsAccountSummaryFragment) - fun inject(loanChargeFragment: LoanChargeFragment) - fun inject(savingsAccountTransactionFragment: SavingsAccountTransactionFragment) - fun inject(collectionSheetFragment: CollectionSheetFragment) - fun inject(groupsListFragment: GroupsListFragment) - fun inject(loanTransactionsFragment: LoanTransactionsFragment) - fun inject(savingsAccountFragment: SavingsAccountFragment) - fun inject(loanRepaymentFragment: LoanRepaymentFragment) - fun inject(groupLoanAccountFragment: GroupLoanAccountFragment) - fun inject(loanAccountFragment: LoanAccountFragment) - fun inject(loanRepaymentScheduleFragment: LoanRepaymentScheduleFragment) - fun inject(surveyListFragment: SurveyListFragment) - fun inject(surveySubmitFragment: SurveySubmitFragment) - fun inject(pinpointClientActivity: PinpointClientActivity) - fun inject(chargeDialogFragment: ChargeDialogFragment) - fun inject(dataTableRowDialogFragment: DataTableRowDialogFragment) - fun inject(dataTableListFragment: DataTableListFragment) - fun inject(documentDialogFragment: DocumentDialogFragment) - fun inject(loanAccountApproval: LoanAccountApproval) - fun inject(loanAccountDisbursement: LoanAccountDisbursementFragment) - fun inject(loanChargeDialogFragment: LoanChargeDialogFragment) - fun inject(savingsAccountApproval: SavingsAccountApprovalFragment) - fun inject(syncPayloadsFragment: SyncClientPayloadsFragment) - fun inject(syncGroupPayloadsFragment: SyncGroupPayloadsFragment) - fun inject(syncCenterPayloadsFragment: SyncCenterPayloadsFragment) - fun inject(offlineDashboardFragment: OfflineDashboardFragment) - fun inject(syncLoanRepaymentTransactionFragment: SyncLoanRepaymentTransactionFragment) - fun inject(syncClientsDialogFragment: SyncClientsDialogFragment) - fun inject(syncSavingsAccountTransactionFragment: SyncSavingsAccountTransactionFragment) - fun inject(syncGroupsDialogFragment: SyncGroupsDialogFragment) - fun inject(syncCentersDialogFragment: SyncCentersDialogFragment) - fun inject(syncSurveysDialogFragment: SyncSurveysDialogFragment) - fun inject(identifierDialogFragment: IdentifierDialogFragment) - fun inject(pathTrackingActivity: PathTrackingActivity) - fun inject(centerDetailsFragment: CenterDetailsFragment) - fun inject(activateClientFragment: ActivateFragment) - fun inject(dataTableFragment: DataTableFragment) - fun inject(noteFragment: NoteFragment) - fun inject(savingsAccountActivateFragment: SavingsAccountActivateFragment) - fun inject(signatureFragment: SignatureFragment) - fun inject(individualCollectionSheetFragment: IndividualCollectionSheetFragment) - fun inject(individualCollectionSheetFragment: NewIndividualCollectionSheetFragment) - fun inject(individualCollectionSheetDetailsFragment: IndividualCollectionSheetDetailsFragment) - fun inject(reportCategoryFragment: ReportCategoryFragment) - fun inject(reportDetailFragment: ReportDetailFragment) - fun inject(clientReportFragment: ReportFragment) - fun inject(collectionSheetDialogFragment: CollectionSheetDialogFragment) - fun inject(paymentDetailsFragment: PaymentDetailsFragment) - fun inject(checkerInboxActivity: CheckerInboxPendingTasksActivity) - fun inject(checkerInboxTasksFragment: CheckerInboxTasksFragment) - fun inject(checkerInboxFragment: CheckerInboxFragment) - fun inject(checkerTaskFilterDialogFragment: CheckerTaskFilterDialogFragment) -} \ No newline at end of file diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/component/ApplicationComponent.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/component/ApplicationComponent.kt deleted file mode 100644 index 9d79446043c..00000000000 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/component/ApplicationComponent.kt +++ /dev/null @@ -1,88 +0,0 @@ -package com.mifos.mifosxdroid.injection.component - -import android.app.Application -import android.content.Context -import com.mifos.api.DataManager -import com.mifos.api.datamanager.DataManagerAuth -import com.mifos.api.datamanager.DataManagerCenter -import com.mifos.api.datamanager.DataManagerCharge -import com.mifos.api.datamanager.DataManagerClient -import com.mifos.api.datamanager.DataManagerCollectionSheet -import com.mifos.api.datamanager.DataManagerDataTable -import com.mifos.api.datamanager.DataManagerDocument -import com.mifos.api.datamanager.DataManagerGroups -import com.mifos.api.datamanager.DataManagerLoan -import com.mifos.api.datamanager.DataManagerNote -import com.mifos.api.datamanager.DataManagerOffices -import com.mifos.api.datamanager.DataManagerRunReport -import com.mifos.api.datamanager.DataManagerSavings -import com.mifos.api.datamanager.DataManagerSearch -import com.mifos.api.datamanager.DataManagerStaff -import com.mifos.api.datamanager.DataManagerSurveys -import com.mifos.api.local.databasehelper.DatabaseHelperCenter -import com.mifos.api.local.databasehelper.DatabaseHelperCharge -import com.mifos.api.local.databasehelper.DatabaseHelperClient -import com.mifos.api.local.databasehelper.DatabaseHelperDataTable -import com.mifos.api.local.databasehelper.DatabaseHelperGroups -import com.mifos.api.local.databasehelper.DatabaseHelperLoan -import com.mifos.api.local.databasehelper.DatabaseHelperNote -import com.mifos.api.local.databasehelper.DatabaseHelperOffices -import com.mifos.api.local.databasehelper.DatabaseHelperSavings -import com.mifos.api.local.databasehelper.DatabaseHelperStaff -import com.mifos.api.local.databasehelper.DatabaseHelperSurveys -import com.mifos.mifosxdroid.activity.pathtracking.PathTrackingService -import com.mifos.mifosxdroid.injection.ApplicationContext -import com.mifos.mifosxdroid.injection.module.ApplicationModule -import com.mifos.mifosxdroid.offlinejobs.OfflineSyncCenter -import com.mifos.mifosxdroid.offlinejobs.OfflineSyncClient -import com.mifos.mifosxdroid.offlinejobs.OfflineSyncGroup -import com.mifos.mifosxdroid.offlinejobs.OfflineSyncLoanRepayment -import com.mifos.mifosxdroid.offlinejobs.OfflineSyncSavingsAccount -import dagger.Component -import javax.inject.Singleton - -/** - * @author Rajan Maurya - */ -@Singleton -@Component(modules = [ApplicationModule::class]) -interface ApplicationComponent { - fun inject(pathTrackingService: PathTrackingService) - - @ApplicationContext - fun context(): Context - fun application(): Application - fun dataManager(): DataManager - fun dataManagerClient(): DataManagerClient - fun dataManagerGroups(): DataManagerGroups - fun dataManagerCenters(): DataManagerCenter - fun dataManagerDataTable(): DataManagerDataTable - fun dataManagerCharge(): DataManagerCharge - fun dataManagerOffices(): DataManagerOffices - fun dataManagerStaff(): DataManagerStaff - fun dataManagerLoan(): DataManagerLoan - fun dataManagerSavings(): DataManagerSavings - fun dataManagerSurveys(): DataManagerSurveys - fun dataManagerDocument(): DataManagerDocument - fun dataManagerSearch(): DataManagerSearch - fun dataManagerRunReport(): DataManagerRunReport - fun dataManagerAuth(): DataManagerAuth - fun dataManagerNote(): DataManagerNote - fun dataManagerCollectionSheet(): DataManagerCollectionSheet - fun databaseHelperClient(): DatabaseHelperClient - fun databaseHelperCenter(): DatabaseHelperCenter - fun databaseHelperGroup(): DatabaseHelperGroups - fun databaseHelperDataTable(): DatabaseHelperDataTable - fun databaseHelperCharge(): DatabaseHelperCharge - fun databaseHelperOffices(): DatabaseHelperOffices - fun databaseHelperStaff(): DatabaseHelperStaff - fun databaseHelperLoan(): DatabaseHelperLoan - fun databaseHelperSavings(): DatabaseHelperSavings - fun databaseHelperSurveys(): DatabaseHelperSurveys - fun databaseHelperNote(): DatabaseHelperNote - fun inject(offlineSyncCenter: OfflineSyncCenter) - fun inject(offlineSyncClient: OfflineSyncClient) - fun inject(offlineSyncGroup: OfflineSyncGroup) - fun inject(offlineSyncLoanRepayment: OfflineSyncLoanRepayment) - fun inject(offlineSyncSavingsAccount: OfflineSyncSavingsAccount) -} \ No newline at end of file diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/module/ActivityModule.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/module/ActivityModule.kt deleted file mode 100644 index 87b14289ec7..00000000000 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/injection/module/ActivityModule.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.mifos.mifosxdroid.injection.module - -import android.app.Activity -import android.content.Context -import com.mifos.mifosxdroid.injection.ActivityContext -import dagger.Module -import dagger.Provides - -/** - * @author Rajan Maurya - */ -@Module -class ActivityModule(private val mActivity: Activity) { - @Provides - fun provideActivity(): Activity { - return mActivity - } - - @Provides - @ActivityContext - fun providesContext(): Context { - return mActivity - } -} \ 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 index 14efe539211..ff83349b57e 100644 --- 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 @@ -1,11 +1,10 @@ package com.mifos.mifosxdroid.injection.module -import android.app.Application -import android.content.Context import com.mifos.api.BaseApiManager -import com.mifos.mifosxdroid.injection.ApplicationContext import dagger.Module import dagger.Provides +import dagger.hilt.InstallIn +import dagger.hilt.components.SingletonComponent import javax.inject.Singleton /** @@ -13,21 +12,13 @@ import javax.inject.Singleton * Provide application-level dependencies. */ @Module -class ApplicationModule(protected val mApplication: Application) { - @Provides - fun provideApplication(): Application { - return mApplication - } - - @Provides - @ApplicationContext - fun provideContext(): Context { - return mApplication - } +@InstallIn(SingletonComponent::class) +class ApplicationModule { @Provides @Singleton fun provideBaseApiManager(): BaseApiManager { return BaseApiManager() } + } \ No newline at end of file diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/login/LoginActivity.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/login/LoginActivity.kt index 634d12e941f..4922cb3d412 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/login/LoginActivity.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/login/LoginActivity.kt @@ -35,11 +35,13 @@ import com.mifos.utils.PrefManager.saveUser import com.mifos.utils.PrefManager.tenant import com.mifos.utils.PrefManager.userId import com.mifos.utils.ValidationUtil +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** * Created by ishankhanna on 08/02/14. */ +@AndroidEntryPoint class LoginActivity : MifosBaseActivity(), LoginMvpView { private lateinit var binding: ActivityLoginBinding @@ -78,7 +80,6 @@ class LoginActivity : MifosBaseActivity(), LoginMvpView { public override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - activityComponent?.inject(this) binding = ActivityLoginBinding.inflate(layoutInflater) title = null setContentView(binding.root) diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/offline/offlinedashbarod/OfflineDashboardFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/offline/offlinedashbarod/OfflineDashboardFragment.kt index 22a67ec8dc8..9aadfc9f545 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/offline/offlinedashbarod/OfflineDashboardFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/offline/offlinedashbarod/OfflineDashboardFragment.kt @@ -10,7 +10,6 @@ import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.LinearLayoutManager import com.mifos.mifosxdroid.R import com.mifos.mifosxdroid.adapters.OfflineDashboardAdapter -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.core.util.Toaster.show import com.mifos.mifosxdroid.databinding.FragmentOfflineDashboardBinding @@ -25,6 +24,7 @@ import com.mifos.objects.client.ClientPayload import com.mifos.objects.group.GroupPayload import com.mifos.services.data.CenterPayload import com.mifos.utils.ItemOffsetDecoration +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** @@ -48,6 +48,7 @@ import javax.inject.Inject * * Created by Rajan Maurya on 20/07/16. */ +@AndroidEntryPoint class OfflineDashboardFragment : MifosBaseFragment(), OfflineDashboardMvpView { private lateinit var binding: FragmentOfflineDashboardBinding @@ -74,7 +75,6 @@ class OfflineDashboardFragment : MifosBaseFragment(), OfflineDashboardMvpView { ): View { binding = FragmentOfflineDashboardBinding.inflate(inflater, container, false) setToolbarTitle(requireActivity().resources.getString(R.string.offline)) - (activity as MifosBaseActivity?)?.activityComponent?.inject(this) mOfflineDashboardPresenter?.attachView(this) val mLayoutManager: LinearLayoutManager = GridLayoutManager(activity, GRID_COUNT) mLayoutManager.orientation = LinearLayoutManager.VERTICAL diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/offline/synccenterpayloads/SyncCenterPayloadsFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/offline/synccenterpayloads/SyncCenterPayloadsFragment.kt index a4ff0dbfecc..dac9ed3d21f 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/offline/synccenterpayloads/SyncCenterPayloadsFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/offline/synccenterpayloads/SyncCenterPayloadsFragment.kt @@ -13,15 +13,16 @@ import androidx.recyclerview.widget.LinearLayoutManager import com.mifos.mifosxdroid.R import com.mifos.mifosxdroid.adapters.SyncCenterPayloadAdapter import com.mifos.mifosxdroid.core.MaterialDialog -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.core.util.Toaster.show import com.mifos.mifosxdroid.databinding.FragmentSyncpayloadBinding import com.mifos.services.data.CenterPayload import com.mifos.utils.Constants import com.mifos.utils.PrefManager.userStatus +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject +@AndroidEntryPoint class SyncCenterPayloadsFragment : MifosBaseFragment(), SyncCenterPayloadsMvpView, DialogInterface.OnClickListener { @@ -40,7 +41,6 @@ class SyncCenterPayloadsFragment : MifosBaseFragment(), SyncCenterPayloadsMvpVie var mCenterSyncIndex = 0 override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent!!.inject(this) centerPayloads = ArrayList() setHasOptionsMenu(true) } diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/offline/syncclientpayloads/SyncClientPayloadsFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/offline/syncclientpayloads/SyncClientPayloadsFragment.kt index 8643990dc39..1ae21bbac99 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/offline/syncclientpayloads/SyncClientPayloadsFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/offline/syncclientpayloads/SyncClientPayloadsFragment.kt @@ -13,13 +13,13 @@ import androidx.recyclerview.widget.LinearLayoutManager import com.mifos.mifosxdroid.R import com.mifos.mifosxdroid.adapters.SyncPayloadsAdapter import com.mifos.mifosxdroid.core.MaterialDialog -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.core.util.Toaster.show import com.mifos.mifosxdroid.databinding.FragmentSyncpayloadBinding import com.mifos.objects.client.ClientPayload import com.mifos.utils.Constants import com.mifos.utils.PrefManager.userStatus +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** @@ -29,6 +29,7 @@ import javax.inject.Inject * * Created by Rajan Maurya on 08/07/16. */ +@AndroidEntryPoint class SyncClientPayloadsFragment : MifosBaseFragment(), SyncClientPayloadsMvpView, DialogInterface.OnClickListener { val LOG_TAG = javaClass.simpleName @@ -42,7 +43,6 @@ class SyncClientPayloadsFragment : MifosBaseFragment(), SyncClientPayloadsMvpVie var mClientSyncIndex = 0 override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) clientPayloads = ArrayList() setHasOptionsMenu(true) } diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/offline/syncgrouppayloads/SyncGroupPayloadsFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/offline/syncgrouppayloads/SyncGroupPayloadsFragment.kt index 7f63cc5d7e1..3df77039873 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/offline/syncgrouppayloads/SyncGroupPayloadsFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/offline/syncgrouppayloads/SyncGroupPayloadsFragment.kt @@ -13,18 +13,19 @@ import androidx.recyclerview.widget.LinearLayoutManager import com.mifos.mifosxdroid.R import com.mifos.mifosxdroid.adapters.SyncGroupPayloadAdapter import com.mifos.mifosxdroid.core.MaterialDialog -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.core.util.Toaster.show import com.mifos.mifosxdroid.databinding.FragmentSyncpayloadBinding import com.mifos.objects.group.GroupPayload import com.mifos.utils.Constants import com.mifos.utils.PrefManager.userStatus +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** * Created by Rajan Maurya on 19/07/16. */ +@AndroidEntryPoint class SyncGroupPayloadsFragment : MifosBaseFragment(), SyncGroupPayloadsMvpView, DialogInterface.OnClickListener { @@ -43,7 +44,6 @@ class SyncGroupPayloadsFragment : MifosBaseFragment(), SyncGroupPayloadsMvpView, var mClientSyncIndex = 0 override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) groupPayloads = ArrayList() setHasOptionsMenu(true) } @@ -145,7 +145,7 @@ class SyncGroupPayloadsFragment : MifosBaseFragment(), SyncGroupPayloadsMvpView, * * @param groupPayload */ - override fun showGroups(groupPayload:List) { + override fun showGroups(groupPayload: List) { groupPayloads = groupPayload as MutableList if (groupPayload.isEmpty()) { binding.llError.visibility = View.VISIBLE diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/offline/syncloanrepaymenttransacition/SyncLoanRepaymentTransactionFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/offline/syncloanrepaymenttransacition/SyncLoanRepaymentTransactionFragment.kt index 7ca44f04ea1..3a0b95ba372 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/offline/syncloanrepaymenttransacition/SyncLoanRepaymentTransactionFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/offline/syncloanrepaymenttransacition/SyncLoanRepaymentTransactionFragment.kt @@ -13,7 +13,6 @@ import androidx.recyclerview.widget.LinearLayoutManager import com.mifos.mifosxdroid.R import com.mifos.mifosxdroid.adapters.SyncLoanRepaymentAdapter import com.mifos.mifosxdroid.core.MaterialDialog -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.core.util.Toaster.show import com.mifos.mifosxdroid.databinding.FragmentSyncpayloadBinding @@ -21,11 +20,13 @@ import com.mifos.objects.PaymentTypeOption import com.mifos.objects.accounts.loan.LoanRepaymentRequest import com.mifos.utils.Constants import com.mifos.utils.PrefManager.userStatus +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** * Created by Rajan Maurya on 28/07/16. */ +@AndroidEntryPoint class SyncLoanRepaymentTransactionFragment : MifosBaseFragment(), SyncLoanRepaymentTransactionMvpView, DialogInterface.OnClickListener { @@ -43,7 +44,6 @@ class SyncLoanRepaymentTransactionFragment : MifosBaseFragment(), private var mClientSyncIndex = 0 override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) mLoanRepaymentRequests = ArrayList() setHasOptionsMenu(true) } diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/offline/syncsavingsaccounttransaction/SyncSavingsAccountTransactionFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/offline/syncsavingsaccounttransaction/SyncSavingsAccountTransactionFragment.kt index 205b7216802..bb79cb549b5 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/offline/syncsavingsaccounttransaction/SyncSavingsAccountTransactionFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/offline/syncsavingsaccounttransaction/SyncSavingsAccountTransactionFragment.kt @@ -13,7 +13,6 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout.OnRefreshListener import com.mifos.mifosxdroid.R import com.mifos.mifosxdroid.adapters.SyncSavingsAccountTransactionAdapter import com.mifos.mifosxdroid.core.MaterialDialog -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.core.util.Toaster.show import com.mifos.mifosxdroid.databinding.FragmentSyncpayloadBinding @@ -22,11 +21,13 @@ import com.mifos.objects.accounts.savings.SavingsAccountTransactionRequest import com.mifos.utils.Constants import com.mifos.utils.Network.isOnline import com.mifos.utils.PrefManager.userStatus +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** * Created by Rajan Maurya on 19/08/16. */ +@AndroidEntryPoint class SyncSavingsAccountTransactionFragment : MifosBaseFragment(), SyncSavingsAccountTransactionMvpView, OnRefreshListener, DialogInterface.OnClickListener { @@ -42,7 +43,6 @@ class SyncSavingsAccountTransactionFragment : MifosBaseFragment(), var mSyncSavingsAccountTransactionAdapter: SyncSavingsAccountTransactionAdapter? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) setHasOptionsMenu(true) } diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/offlinejobs/OfflineSyncCenter.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/offlinejobs/OfflineSyncCenter.kt index 525e3c597c8..4be66229901 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/offlinejobs/OfflineSyncCenter.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/offlinejobs/OfflineSyncCenter.kt @@ -2,7 +2,6 @@ package com.mifos.mifosxdroid.offlinejobs import com.evernote.android.job.Job import com.evernote.android.job.JobRequest -import com.mifos.App import com.mifos.api.datamanager.DataManagerCenter import com.mifos.objects.response.SaveResponse import com.mifos.services.data.CenterPayload @@ -30,7 +29,6 @@ class OfflineSyncCenter : Job() { override fun onRunJob(params: Params): Result { mSubscriptions = CompositeSubscription() centerPayloads = ArrayList() - App[context].component!!.inject(this) return if (userStatus == 0) { loadDatabaseCenterPayload() Result.SUCCESS diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/offlinejobs/OfflineSyncClient.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/offlinejobs/OfflineSyncClient.kt index 6a15e58150a..4fbe90f97a4 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/offlinejobs/OfflineSyncClient.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/offlinejobs/OfflineSyncClient.kt @@ -2,7 +2,6 @@ package com.mifos.mifosxdroid.offlinejobs import com.evernote.android.job.Job import com.evernote.android.job.JobRequest -import com.mifos.App import com.mifos.api.datamanager.DataManagerClient import com.mifos.objects.client.Client import com.mifos.objects.client.ClientPayload @@ -28,7 +27,6 @@ class OfflineSyncClient : Job() { private var mClientSyncIndex = 0 override fun onRunJob(params: Params): Result { mSubscriptions = CompositeSubscription() - App[context].component?.inject(this) return if (userStatus == 0) { loadDatabaseClientPayload() Result.SUCCESS diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/offlinejobs/OfflineSyncGroup.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/offlinejobs/OfflineSyncGroup.kt index 371faefae12..ca94c6d0bb5 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/offlinejobs/OfflineSyncGroup.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/offlinejobs/OfflineSyncGroup.kt @@ -2,7 +2,6 @@ package com.mifos.mifosxdroid.offlinejobs import com.evernote.android.job.Job import com.evernote.android.job.JobRequest -import com.mifos.App import com.mifos.api.datamanager.DataManagerGroups import com.mifos.objects.group.GroupPayload import com.mifos.objects.response.SaveResponse @@ -28,7 +27,6 @@ class OfflineSyncGroup : Job() { private var mClientSyncIndex = 0 override fun onRunJob(params: Params): Result { mSubscriptions = CompositeSubscription() - App[context].component?.inject(this) return if (userStatus == 0) { loadDatabaseGroupPayload() Result.SUCCESS diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/offlinejobs/OfflineSyncLoanRepayment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/offlinejobs/OfflineSyncLoanRepayment.kt index 898cd781593..7e85ac4ed5e 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/offlinejobs/OfflineSyncLoanRepayment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/offlinejobs/OfflineSyncLoanRepayment.kt @@ -2,7 +2,6 @@ package com.mifos.mifosxdroid.offlinejobs import com.evernote.android.job.Job import com.evernote.android.job.JobRequest -import com.mifos.App import com.mifos.api.datamanager.DataManagerLoan import com.mifos.objects.accounts.loan.LoanRepaymentRequest import com.mifos.objects.accounts.loan.LoanRepaymentResponse @@ -28,7 +27,6 @@ class OfflineSyncLoanRepayment : Job() { private var mClientSyncIndex = 0 override fun onRunJob(params: Params): Result { mSubscriptions = CompositeSubscription() - App[context].component?.inject(this) return if (userStatus == 0) { loadDatabaseLoanRepaymentTransactions() Result.SUCCESS @@ -124,10 +122,10 @@ class OfflineSyncLoanRepayment : Job() { fun showPaymentSubmittedSuccessfully() { mLoanRepaymentRequests[mClientSyncIndex].loanId?.let { - deleteAndUpdateLoanRepayments( - it + deleteAndUpdateLoanRepayments( + it ) - } + } } private fun deleteAndUpdateLoanRepayments(loanId: Int) { diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/offlinejobs/OfflineSyncSavingsAccount.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/offlinejobs/OfflineSyncSavingsAccount.kt index 956764f1bfc..1d4fa0a72c1 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/offlinejobs/OfflineSyncSavingsAccount.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/offlinejobs/OfflineSyncSavingsAccount.kt @@ -2,7 +2,6 @@ package com.mifos.mifosxdroid.offlinejobs import com.evernote.android.job.Job import com.evernote.android.job.JobRequest -import com.mifos.App import com.mifos.api.datamanager.DataManagerLoan import com.mifos.api.datamanager.DataManagerSavings import com.mifos.objects.accounts.savings.SavingsAccountTransactionRequest @@ -33,7 +32,6 @@ class OfflineSyncSavingsAccount : Job() { override fun onRunJob(params: Params): Result { mSubscriptions = CompositeSubscription() mSavingsAccountTransactionRequests = ArrayList() - App[context].component!!.inject(this) return if (userStatus == 0) { loadDatabaseSavingsAccountTransactions() Result.SUCCESS 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 index f2abe699a68..6590f53dc2a 100755 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/CentersActivity.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/CentersActivity.kt @@ -15,7 +15,9 @@ import com.mifos.mifosxdroid.online.grouplist.GroupListFragment import com.mifos.mifosxdroid.online.savingsaccount.SavingsAccountFragment import com.mifos.objects.client.Client import com.mifos.utils.Constants +import dagger.hilt.android.AndroidEntryPoint +@AndroidEntryPoint class CentersActivity : MifosBaseActivity(){ private val args: CentersActivityArgs by navArgs() diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/ClientActivity.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/ClientActivity.kt index 8098dc53280..312a8122ac8 100755 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/ClientActivity.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/ClientActivity.kt @@ -13,24 +13,18 @@ import com.google.gson.Gson import com.mifos.mifosxdroid.R import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.databinding.ActivityToolbarContainerBinding -import com.mifos.mifosxdroid.online.loanaccountsummary.LoanAccountSummaryFragment -import com.mifos.mifosxdroid.online.loanrepayment.LoanRepaymentFragment -import com.mifos.mifosxdroid.online.loanrepaymentschedule.LoanRepaymentScheduleFragment -import com.mifos.mifosxdroid.online.loantransactions.LoanTransactionsFragment -import com.mifos.mifosxdroid.online.savingaccountsummary.SavingsAccountSummaryFragment -import com.mifos.mifosxdroid.online.savingaccounttransaction.SavingsAccountTransactionFragment import com.mifos.mifosxdroid.online.surveylist.SurveyListFragment -import com.mifos.objects.accounts.loan.LoanWithAssociations import com.mifos.objects.accounts.savings.DepositType -import com.mifos.objects.accounts.savings.SavingsAccountWithAssociations import com.mifos.objects.survey.Survey import com.mifos.utils.Constants +import dagger.hilt.android.AndroidEntryPoint +@AndroidEntryPoint class ClientActivity : MifosBaseActivity(), SurveyListFragment.OnFragmentInteractionListener { private lateinit var binding: ActivityToolbarContainerBinding - private lateinit var navHostFragment : NavHostFragment + private lateinit var navHostFragment: NavHostFragment private var clientId: Int? = null private var loanAccountNumber: Int? = null private var savingsAccountNumber: Int? = null @@ -42,7 +36,8 @@ class ClientActivity : MifosBaseActivity(), binding = ActivityToolbarContainerBinding.inflate(layoutInflater) setContentView(binding.root) showBackButton() - navHostFragment = supportFragmentManager.findFragmentById(R.id.container_nav_host_fragment) as NavHostFragment + navHostFragment = + supportFragmentManager.findFragmentById(R.id.container_nav_host_fragment) as NavHostFragment clientId = args.client.clientId loanAccountNumber = args.client.loanAccountNumber savingsAccountNumber = args.client.savingsAccountNumber diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/GenerateCollectionSheetActivity.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/GenerateCollectionSheetActivity.kt index 25ee8b30bba..6489c254512 100755 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/GenerateCollectionSheetActivity.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/GenerateCollectionSheetActivity.kt @@ -13,7 +13,9 @@ import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.databinding.ActivityToolbarContainerBinding import com.mifos.mifosxdroid.online.collectionsheetindividualdetails.PaymentDetailsFragment.OnPayloadSelectedListener import com.mifos.utils.Constants +import dagger.hilt.android.AndroidEntryPoint +@AndroidEntryPoint class GenerateCollectionSheetActivity : MifosBaseActivity(), OnPayloadSelectedListener { private lateinit var binding: ActivityToolbarContainerBinding diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/GroupsActivity.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/GroupsActivity.kt index 07c447a9094..fafff87d554 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/GroupsActivity.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/GroupsActivity.kt @@ -6,10 +6,12 @@ import androidx.navigation.navArgs import com.mifos.mifosxdroid.R import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.utils.Constants +import dagger.hilt.android.AndroidEntryPoint /** * Created by nellyk on 2/27/2016. */ +@AndroidEntryPoint class GroupsActivity : MifosBaseActivity() { private val args: GroupsActivityArgs by navArgs() diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/RunReportsActivity.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/RunReportsActivity.kt index 597e89ba70d..068115c6505 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/RunReportsActivity.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/RunReportsActivity.kt @@ -16,10 +16,12 @@ import com.mifos.mifosxdroid.online.runreports.report.ReportFragment import com.mifos.mifosxdroid.online.runreports.reportcategory.ReportCategoryFragment import com.mifos.mifosxdroid.online.runreports.reportdetail.ReportDetailFragment import com.mifos.utils.Constants +import dagger.hilt.android.AndroidEntryPoint /** * Created by Tarun on 02-08-17. */ +@AndroidEntryPoint class RunReportsActivity : MifosBaseActivity(), OnItemSelectedListener { private var intent: Intent? = null private var spinner: Spinner? = null diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/activate/ActivateFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/activate/ActivateFragment.kt index 49006f1f23a..a2140b86d85 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/activate/ActivateFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/activate/ActivateFragment.kt @@ -7,7 +7,6 @@ import android.view.ViewGroup import android.widget.Toast import androidx.navigation.fragment.navArgs import com.mifos.mifosxdroid.R -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.core.util.Toaster import com.mifos.mifosxdroid.core.util.Toaster.show @@ -18,6 +17,7 @@ import com.mifos.utils.DatePickerConstrainType import com.mifos.utils.FragmentConstants import com.mifos.utils.getDatePickerDialog import com.mifos.utils.getTodayFormatted +import dagger.hilt.android.AndroidEntryPoint import java.text.SimpleDateFormat import java.time.Instant import java.util.Locale @@ -26,6 +26,7 @@ import javax.inject.Inject /** * Created by Rajan Maurya on 09/02/17. */ +@AndroidEntryPoint class ActivateFragment : MifosBaseFragment(), ActivateMvpView { private lateinit var binding: FragmentActivateClientBinding @@ -46,7 +47,6 @@ class ActivateFragment : MifosBaseFragment(), ActivateMvpView { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) id = arg.clientId activateType = arg.activationType } 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 index ced48fe3f6d..c48bd695992 100644 --- 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 @@ -9,7 +9,6 @@ import android.view.View import android.view.ViewGroup import androidx.navigation.fragment.findNavController import com.mifos.mifosxdroid.R -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.core.util.Toaster import com.mifos.mifosxdroid.databinding.FragmentCenterDetailsBinding @@ -17,11 +16,13 @@ import com.mifos.objects.group.CenterInfo import com.mifos.objects.group.CenterWithAssociations import com.mifos.utils.Constants import com.mifos.utils.Utils +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** * Created by Rajan Maurya on 05/02/17. */ +@AndroidEntryPoint class CenterDetailsFragment : MifosBaseFragment(), CenterDetailsMvpView { private lateinit var binding: FragmentCenterDetailsBinding @@ -33,7 +34,6 @@ class CenterDetailsFragment : MifosBaseFragment(), CenterDetailsMvpView { // private var listener: OnFragmentInteractionListener? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) if (arguments != null) { centerId = requireArguments().getInt(Constants.CENTER_ID) } @@ -174,8 +174,9 @@ class CenterDetailsFragment : MifosBaseFragment(), CenterDetailsMvpView { findNavController().navigate(action) } - private fun loadGroupsOfCenter(centerId: Int){ - val action = CenterDetailsFragmentDirections.actionCenterDetailsFragmentToGroupListFragment(centerId) + private fun loadGroupsOfCenter(centerId: Int) { + val action = + CenterDetailsFragmentDirections.actionCenterDetailsFragmentToGroupListFragment(centerId) findNavController().navigate(action) } diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/centerlist/CenterListFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/centerlist/CenterListFragment.kt index c4856d8ecff..0671e4f3349 100755 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/centerlist/CenterListFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/centerlist/CenterListFragment.kt @@ -30,6 +30,7 @@ import com.mifos.mifosxdroid.uihelpers.MFDatePicker import com.mifos.objects.group.Center import com.mifos.objects.group.CenterWithAssociations import com.mifos.utils.FragmentConstants +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** @@ -39,6 +40,7 @@ import javax.inject.Inject * CenterListFragment Fetching and Showing CenterList in RecyclerView from * >demo.openmf.org/fineract-provider/api/v1/centers?paged=true&offset=0&limit=100> */ +@AndroidEntryPoint class CenterListFragment : MifosBaseFragment(), CenterListMvpView, OnRefreshListener { private lateinit var binding: FragmentCentersListBinding @@ -69,7 +71,6 @@ class CenterListFragment : MifosBaseFragment(), CenterListMvpView, OnRefreshList savedInstanceState: Bundle? ): View { binding = FragmentCentersListBinding.inflate(inflater, container, false) - (activity as MifosBaseActivity).activityComponent?.inject(this) mCenterListPresenter.attachView(this) //Showing User Interface. diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/checkerinbox/CheckerInboxFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/checkerinbox/CheckerInboxFragment.kt index a46c2d70951..f4cc0e84c7e 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/checkerinbox/CheckerInboxFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/checkerinbox/CheckerInboxFragment.kt @@ -15,16 +15,17 @@ import androidx.recyclerview.widget.LinearLayoutManager import com.mifos.mifosxdroid.R import com.mifos.mifosxdroid.adapters.CheckerTaskListAdapter import com.mifos.mifosxdroid.core.MaterialDialog -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.databinding.CheckerInboxFragmentBinding import com.mifos.mifosxdroid.dialogfragments.checkertaskfilterdialog.CheckerTaskFilterDialogFragment import com.mifos.objects.CheckerTask import com.mifos.utils.Constants +import dagger.hilt.android.AndroidEntryPoint import java.sql.Timestamp import java.util.Locale import javax.inject.Inject +@AndroidEntryPoint class CheckerInboxFragment : MifosBaseFragment(), TextWatcher, CheckerTaskFilterDialogFragment.OnInputSelected, CheckerTaskListAdapter.OnItemClickListener, @@ -72,11 +73,6 @@ class CheckerInboxFragment : MifosBaseFragment(), TextWatcher, private var adapterPosition: Int = -1 var inBadgeProcessingMode = false - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) - } - override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? 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 index 9099e247d3c..d3c9bc5183b 100644 --- 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 @@ -4,7 +4,9 @@ import android.os.Bundle import androidx.navigation.fragment.NavHostFragment import com.mifos.mifosxdroid.R import com.mifos.mifosxdroid.core.MifosBaseActivity +import dagger.hilt.android.AndroidEntryPoint +@AndroidEntryPoint class CheckerInboxPendingTasksActivity : MifosBaseActivity() { override fun onCreate(savedInstanceState: Bundle?) { diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/checkerinbox/CheckerInboxTasksFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/checkerinbox/CheckerInboxTasksFragment.kt index 66c06ce2a84..192dca92c29 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/checkerinbox/CheckerInboxTasksFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/checkerinbox/CheckerInboxTasksFragment.kt @@ -9,14 +9,15 @@ import androidx.lifecycle.ViewModelProviders import androidx.navigation.fragment.findNavController import androidx.swiperefreshlayout.widget.SwipeRefreshLayout import com.mifos.mifosxdroid.R -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.core.util.Toaster import com.mifos.mifosxdroid.databinding.CheckerInboxTasksFragmentBinding import com.mifos.objects.CheckerTask import com.mifos.objects.checkerinboxandtasks.RescheduleLoansTask +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject +@AndroidEntryPoint class CheckerInboxTasksFragment : MifosBaseFragment(), SwipeRefreshLayout.OnRefreshListener { private lateinit var binding: CheckerInboxTasksFragmentBinding @@ -35,11 +36,6 @@ class CheckerInboxTasksFragment : MifosBaseFragment(), SwipeRefreshLayout.OnRefr private lateinit var viewModel: CheckerInboxTasksViewModel private lateinit var swipeRefreshLayout: SwipeRefreshLayout - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) - } - override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/clientcharge/ClientChargeFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/clientcharge/ClientChargeFragment.kt index 897a0a214ae..f2e6af08aa4 100755 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/clientcharge/ClientChargeFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/clientcharge/ClientChargeFragment.kt @@ -16,7 +16,6 @@ import androidx.recyclerview.widget.LinearLayoutManager import com.mifos.mifosxdroid.R import com.mifos.mifosxdroid.adapters.ChargeNameListAdapter import com.mifos.mifosxdroid.core.EndlessRecyclerOnScrollListener -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.core.util.Toaster import com.mifos.mifosxdroid.databinding.FragmentChargeListBinding @@ -24,18 +23,19 @@ import com.mifos.mifosxdroid.dialogfragments.chargedialog.ChargeDialogFragment import com.mifos.mifosxdroid.dialogfragments.chargedialog.OnChargeCreateListener import com.mifos.objects.client.Charges import com.mifos.objects.client.Page -import com.mifos.utils.Constants import com.mifos.utils.FragmentConstants +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** * Created by nellyk on 1/22/2016. */ +@AndroidEntryPoint class ClientChargeFragment : MifosBaseFragment(), ClientChargeMvpView, OnChargeCreateListener { private lateinit var binding: FragmentChargeListBinding - private val arg : ClientChargeFragmentArgs by navArgs() + private val arg: ClientChargeFragmentArgs by navArgs() private lateinit var chargesList: List @@ -47,7 +47,6 @@ class ClientChargeFragment : MifosBaseFragment(), ClientChargeMvpView, OnChargeC private val limit = 10 override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) clientId = arg.clientId setChargesList(arg.chargesList.toMutableList()) } diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/clientdetails/ClientDetailsFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/clientdetails/ClientDetailsFragment.kt index c90b53b1f29..1a6ed681bfa 100755 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/clientdetails/ClientDetailsFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/clientdetails/ClientDetailsFragment.kt @@ -37,7 +37,6 @@ import com.joanzapata.iconify.widget.IconTextView import com.mifos.mifosxdroid.R import com.mifos.mifosxdroid.adapters.LoanAccountsListAdapter import com.mifos.mifosxdroid.adapters.SavingsAccountsListAdapter -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.core.util.Toaster import com.mifos.mifosxdroid.databinding.FragmentClientDetailsBinding @@ -48,12 +47,13 @@ import com.mifos.objects.client.Client import com.mifos.utils.Constants import com.mifos.utils.ImageLoaderUtils import com.mifos.utils.Utils +import dagger.hilt.android.AndroidEntryPoint import okhttp3.ResponseBody import java.io.File import java.io.FileOutputStream import javax.inject.Inject - +@AndroidEntryPoint class ClientDetailsFragment : MifosBaseFragment(), ClientDetailsMvpView { private lateinit var binding: FragmentClientDetailsBinding @@ -73,7 +73,6 @@ class ClientDetailsFragment : MifosBaseFragment(), ClientDetailsMvpView { private var isClientActive = false override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) if (arguments != null) { clientId = requireArguments().getInt(Constants.CLIENT_ID) } diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/clientidentifiers/ClientIdentifiersFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/clientidentifiers/ClientIdentifiersFragment.kt index f3a55c7160e..1dd99dbc4da 100755 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/clientidentifiers/ClientIdentifiersFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/clientidentifiers/ClientIdentifiersFragment.kt @@ -19,7 +19,6 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout.OnRefreshListener import com.mifos.mifosxdroid.R import com.mifos.mifosxdroid.adapters.IdentifierListAdapter import com.mifos.mifosxdroid.adapters.IdentifierListAdapter.IdentifierOptionsListener -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.core.util.Toaster import com.mifos.mifosxdroid.databinding.FragmentClientIdentifiersBinding @@ -29,13 +28,15 @@ import com.mifos.mifosxdroid.online.documentlist.DocumentListFragment import com.mifos.objects.noncore.Identifier import com.mifos.utils.Constants import com.mifos.utils.FragmentConstants +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject +@AndroidEntryPoint class ClientIdentifiersFragment : MifosBaseFragment(), ClientIdentifiersMvpView, IdentifierOptionsListener, OnRefreshListener, ClientIdentifierCreationListener { private lateinit var binding: FragmentClientIdentifiersBinding - private val arg : ClientIdentifiersFragmentArgs by navArgs() + private val arg: ClientIdentifiersFragmentArgs by navArgs() @Inject lateinit var mClientIdentifiersPresenter: ClientIdentifiersPresenter @@ -48,7 +49,6 @@ class ClientIdentifiersFragment : MifosBaseFragment(), ClientIdentifiersMvpView, private var mLayoutManager: LinearLayoutManager? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) clientId = arg.clientId setHasOptionsMenu(true) } diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/clientlist/ClientListFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/clientlist/ClientListFragment.kt index 5e472f69324..114294c5214 100755 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/clientlist/ClientListFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/clientlist/ClientListFragment.kt @@ -5,7 +5,6 @@ package com.mifos.mifosxdroid.online.clientlist import android.os.Bundle -import android.os.Parcelable import android.view.LayoutInflater import android.view.Menu import android.view.MenuItem @@ -29,9 +28,8 @@ import com.mifos.mifosxdroid.databinding.FragmentClientBinding import com.mifos.mifosxdroid.dialogfragments.syncclientsdialog.SyncClientsDialogFragment import com.mifos.objects.client.Client import com.mifos.objects.navigation.ClientArgs -import com.mifos.objects.navigation.ClientListArgs -import com.mifos.utils.Constants import com.mifos.utils.FragmentConstants +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** @@ -58,6 +56,7 @@ import javax.inject.Inject * boolean isParentFragment) {...} * and unregister the ScrollListener and SwipeLayout. */ +@AndroidEntryPoint class ClientListFragment : MifosBaseFragment(), ClientListMvpView, OnRefreshListener { private lateinit var binding: FragmentClientBinding @@ -69,14 +68,14 @@ class ClientListFragment : MifosBaseFragment(), ClientListMvpView, OnRefreshList if (actionMode != null) { toggleSelection(position) } else { - if(!isParentFragment){ + if (!isParentFragment) { val action = ClientListFragmentDirections.actionClientListFragmentToClientActivity( ClientArgs(clientId = clientList[position].id) ) findNavController().navigate(action) clickedPosition = position - } else{ + } else { val action = ClientListFragmentDirections.actionClientListFragmentToClientActivity( ClientArgs(clientId = clientList[position].id) @@ -115,7 +114,7 @@ class ClientListFragment : MifosBaseFragment(), ClientListMvpView, OnRefreshList clientList = ArrayList() selectedClients = ArrayList() actionModeCallback = ActionModeCallback() - if(arguments != null){ + if (arguments != null) { clientList = arg.clientListArgs.clientsList isParentFragment = arg.clientListArgs.isParentFragment } @@ -128,7 +127,6 @@ class ClientListFragment : MifosBaseFragment(), ClientListMvpView, OnRefreshList savedInstanceState: Bundle? ): View { binding = FragmentClientBinding.inflate(inflater, container, false) - (activity as MifosBaseActivity).activityComponent?.inject(this) if (!isParentFragment) (activity as HomeActivity).supportActionBar?.title = getString(R.string.clients) mClientListPresenter.attachView(this) diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/collectionsheet/CollectionSheetFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/collectionsheet/CollectionSheetFragment.kt index fad28bb1379..8f9820186ad 100755 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/collectionsheet/CollectionSheetFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/collectionsheet/CollectionSheetFragment.kt @@ -15,12 +15,12 @@ import com.mifos.api.model.CollectionSheetPayload import com.mifos.api.model.Payload import com.mifos.mifosxdroid.R import com.mifos.mifosxdroid.adapters.CollectionListAdapter -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.databinding.FragmentCollectionSheetBinding import com.mifos.objects.db.CollectionSheet import com.mifos.objects.response.SaveResponse import com.mifos.utils.Constants +import dagger.hilt.android.AndroidEntryPoint import retrofit2.adapter.rxjava.HttpException import java.util.* import javax.inject.Inject @@ -30,6 +30,7 @@ import javax.inject.Inject * Use the [CollectionSheetFragment.newInstance] factory method to * create an instance of this fragment. */ +@AndroidEntryPoint class CollectionSheetFragment : MifosBaseFragment(), CollectionSheetMvpView { val LOG_TAG = javaClass.simpleName @@ -50,7 +51,6 @@ class CollectionSheetFragment : MifosBaseFragment(), CollectionSheetMvpView { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) if (arguments != null) { centerId = requireArguments().getInt(Constants.CENTER_ID) dateOfCollection = requireArguments().getString(Constants.DATE_OF_COLLECTION) diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/collectionsheetindividual/NewIndividualCollectionSheetFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/collectionsheetindividual/NewIndividualCollectionSheetFragment.kt index 919e00e0600..7b2c68df922 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/collectionsheetindividual/NewIndividualCollectionSheetFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/collectionsheetindividual/NewIndividualCollectionSheetFragment.kt @@ -7,7 +7,6 @@ import android.view.ViewGroup import androidx.navigation.fragment.findNavController import com.mifos.api.model.RequestCollectionSheetPayload import com.mifos.mifosxdroid.R -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.core.util.Toaster import com.mifos.mifosxdroid.databinding.FragmentNewCollectionSheetBinding @@ -20,6 +19,7 @@ import com.mifos.utils.DatePickerConstrainType import com.mifos.utils.FragmentConstants import com.mifos.utils.getDatePickerDialog import com.mifos.utils.getTodayFormatted +import dagger.hilt.android.AndroidEntryPoint import java.text.SimpleDateFormat import java.time.Instant import java.util.Locale @@ -29,6 +29,7 @@ import javax.inject.Inject /** * Created by aksh on 18/6/18. */ +@AndroidEntryPoint class NewIndividualCollectionSheetFragment : MifosBaseFragment(), IndividualCollectionSheetMvpView, View.OnClickListener { @@ -60,7 +61,6 @@ class NewIndividualCollectionSheetFragment : MifosBaseFragment(), IndividualColl override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) if (savedInstanceState != null) { sheet = savedInstanceState[Constants.EXTRA_COLLECTION_INDIVIDUAL] as IndividualCollectionSheet diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/collectionsheetindividualdetails/IndividualCollectionSheetDetailsFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/collectionsheetindividualdetails/IndividualCollectionSheetDetailsFragment.kt index cb7ba978680..f3a168c3d81 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/collectionsheetindividualdetails/IndividualCollectionSheetDetailsFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/collectionsheetindividualdetails/IndividualCollectionSheetDetailsFragment.kt @@ -15,7 +15,6 @@ import com.mifos.api.model.IndividualCollectionSheetPayload import com.mifos.mifosxdroid.R import com.mifos.mifosxdroid.adapters.IndividualCollectionSheetDetailsAdapter import com.mifos.mifosxdroid.adapters.IndividualCollectionSheetDetailsAdapter.ListAdapterListener -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.core.util.Toaster import com.mifos.mifosxdroid.databinding.IndividualCollectionsSheetDetailsBinding @@ -23,16 +22,18 @@ import com.mifos.mifosxdroid.online.GenerateCollectionSheetActivity import com.mifos.objects.collectionsheet.IndividualCollectionSheet import com.mifos.objects.collectionsheet.LoanAndClientName import com.mifos.utils.Constants +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** * Created by aksh on 20/6/18. */ +@AndroidEntryPoint class IndividualCollectionSheetDetailsFragment : MifosBaseFragment(), IndividualCollectionSheetDetailsMvpView, OnRetrieveSheetItemData, ListAdapterListener { private lateinit var binding: IndividualCollectionsSheetDetailsBinding - private val arg : IndividualCollectionSheetDetailsFragmentArgs by navArgs() + private val arg: IndividualCollectionSheetDetailsFragmentArgs by navArgs() @Inject lateinit var presenter: IndividualCollectionSheetDetailsPresenter @@ -46,7 +47,6 @@ class IndividualCollectionSheetDetailsFragment : MifosBaseFragment(), private var transactionDate: String? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) if (savedInstanceState != null) { sheet = savedInstanceState[Constants.EXTRA_COLLECTION_INDIVIDUAL] as IndividualCollectionSheet @@ -155,7 +155,7 @@ class IndividualCollectionSheetDetailsFragment : MifosBaseFragment(), current, it2, clientId - ) + ) } } } diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/collectionsheetindividualdetails/PaymentDetailsFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/collectionsheetindividualdetails/PaymentDetailsFragment.kt index 3fd0ca96c4a..903c541b409 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/collectionsheetindividualdetails/PaymentDetailsFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/collectionsheetindividualdetails/PaymentDetailsFragment.kt @@ -12,22 +12,22 @@ import androidx.navigation.fragment.navArgs import com.mifos.api.model.BulkRepaymentTransactions import com.mifos.api.model.IndividualCollectionSheetPayload import com.mifos.mifosxdroid.R -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.databinding.AddPaymentDetailBinding import com.mifos.objects.accounts.loan.PaymentTypeOptions import com.mifos.objects.collectionsheet.LoanAndClientName -import com.mifos.utils.Constants import com.mifos.utils.ImageLoaderUtils +import dagger.hilt.android.AndroidEntryPoint import java.util.Locale /** * Created by aksh on 21/6/18. */ +@AndroidEntryPoint class PaymentDetailsFragment : MifosBaseFragment(), View.OnClickListener, OnItemSelectedListener { private lateinit var binding: AddPaymentDetailBinding - private val arg : PaymentDetailsFragmentArgs by navArgs() + private val arg: PaymentDetailsFragmentArgs by navArgs() var paymentTypeList: List? = null var paymentTypeOptionsList: List? = null @@ -51,7 +51,6 @@ class PaymentDetailsFragment : MifosBaseFragment(), View.OnClickListener, OnItem override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) position = arg.position loanAndClientNameItem = arg.loanAndClientName paymentTypeList = arg.paymentTypeList.toList() diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/createnewcenter/CreateNewCenterFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/createnewcenter/CreateNewCenterFragment.kt index 1d866781b6c..578936f4100 100755 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/createnewcenter/CreateNewCenterFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/createnewcenter/CreateNewCenterFragment.kt @@ -14,7 +14,6 @@ import com.mifos.exceptions.InvalidTextInputException import com.mifos.exceptions.RequiredFieldException import com.mifos.exceptions.ShortOfLengthException import com.mifos.mifosxdroid.R -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.databinding.FragmentCreateNewCenterBinding import com.mifos.objects.organisation.Office @@ -26,6 +25,7 @@ import com.mifos.utils.MifosResponseHandler import com.mifos.utils.ValidationUtil import com.mifos.utils.getDatePickerDialog import com.mifos.utils.getTodayFormatted +import dagger.hilt.android.AndroidEntryPoint import java.text.SimpleDateFormat import java.time.Instant import java.util.Locale @@ -34,6 +34,7 @@ import javax.inject.Inject /** * Created by nellyk on 1/22/2016. */ +@AndroidEntryPoint class CreateNewCenterFragment : MifosBaseFragment(), CreateNewCenterMvpView { private lateinit var binding: FragmentCreateNewCenterBinding @@ -55,11 +56,6 @@ class CreateNewCenterFragment : MifosBaseFragment(), CreateNewCenterMvpView { } } - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) - } - override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/createnewclient/CreateNewClientFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/createnewclient/CreateNewClientFragment.kt index 88dc427ec99..996a6c0fa21 100755 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/createnewclient/CreateNewClientFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/createnewclient/CreateNewClientFragment.kt @@ -25,7 +25,6 @@ import androidx.appcompat.widget.PopupMenu import com.mifos.exceptions.InvalidTextInputException import com.mifos.exceptions.RequiredFieldException import com.mifos.mifosxdroid.R -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.ProgressableFragment import com.mifos.mifosxdroid.core.util.Toaster import com.mifos.mifosxdroid.databinding.FragmentCreateNewClientBinding @@ -40,12 +39,14 @@ import com.mifos.utils.FragmentConstants import com.mifos.utils.ValidationUtil import com.mifos.utils.getDatePickerDialog import com.mifos.utils.getTodayFormatted +import dagger.hilt.android.AndroidEntryPoint import java.io.File import java.text.SimpleDateFormat import java.time.Instant import java.util.Locale import javax.inject.Inject +@AndroidEntryPoint class CreateNewClientFragment : ProgressableFragment(), CreateNewClientMvpView { private lateinit var binding: FragmentCreateNewClientBinding @@ -101,7 +102,6 @@ class CreateNewClientFragment : ProgressableFragment(), CreateNewClientMvpView { savedInstanceState: Bundle? ): View { binding = FragmentCreateNewClientBinding.inflate(inflater, container, false) - (activity as MifosBaseActivity).activityComponent?.inject(this) createNewClientPresenter.attachView(this) showUserInterface() createNewClientPresenter.loadClientTemplate() diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/createnewgroup/CreateNewGroupFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/createnewgroup/CreateNewGroupFragment.kt index 95eedb25f81..c723ccd9f22 100755 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/createnewgroup/CreateNewGroupFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/createnewgroup/CreateNewGroupFragment.kt @@ -10,27 +10,19 @@ import android.text.TextUtils import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.AdapterView -import android.widget.AdapterView.OnItemSelectedListener -import android.widget.ArrayAdapter import android.widget.Toast -import androidx.fragment.app.DialogFragment import com.mifos.exceptions.InvalidTextInputException import com.mifos.exceptions.RequiredFieldException import com.mifos.exceptions.ShortOfLengthException import com.mifos.mifosxdroid.R -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.ProgressableFragment import com.mifos.mifosxdroid.core.util.Toaster import com.mifos.mifosxdroid.databinding.FragmentCreateNewGroupBinding import com.mifos.mifosxdroid.online.GroupsActivity -import com.mifos.mifosxdroid.uihelpers.MFDatePicker -import com.mifos.mifosxdroid.uihelpers.MFDatePicker.OnDatePickListener import com.mifos.objects.group.GroupPayload import com.mifos.objects.organisation.Office import com.mifos.objects.response.SaveResponse import com.mifos.utils.Constants -import com.mifos.utils.DateHelper import com.mifos.utils.DatePickerConstrainType import com.mifos.utils.FragmentConstants import com.mifos.utils.MifosResponseHandler @@ -39,6 +31,7 @@ import com.mifos.utils.PrefManager import com.mifos.utils.ValidationUtil import com.mifos.utils.getDatePickerDialog import com.mifos.utils.getTodayFormatted +import dagger.hilt.android.AndroidEntryPoint import java.text.SimpleDateFormat import java.time.Instant import java.util.Locale @@ -48,6 +41,7 @@ import javax.inject.Inject * Created by nellyk on 1/22/2016. */ //TODO Show Image and Text after successful or Failed during creation of Group and //TODO A button to Continue or Finish the GroupCreation. +@AndroidEntryPoint class CreateNewGroupFragment : ProgressableFragment(), CreateNewGroupMvpView { private lateinit var binding: FragmentCreateNewGroupBinding @@ -55,7 +49,7 @@ class CreateNewGroupFragment : ProgressableFragment(), CreateNewGroupMvpView { @Inject lateinit var mCreateNewGroupPresenter: CreateNewGroupPresenter private var activationDateString: String? = null - var officeId : Int? = 0 + var officeId: Int? = 0 var result = true private var dateofsubmissionstring: String? = null private val mListOffices: MutableList = ArrayList() @@ -80,11 +74,6 @@ class CreateNewGroupFragment : ProgressableFragment(), CreateNewGroupMvpView { } } - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) - } - override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/datatable/DataTableFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/datatable/DataTableFragment.kt index 187cae931c4..3a2034ac538 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/datatable/DataTableFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/datatable/DataTableFragment.kt @@ -10,23 +10,22 @@ import androidx.recyclerview.widget.LinearLayoutManager import androidx.swiperefreshlayout.widget.SwipeRefreshLayout.OnRefreshListener import com.mifos.mifosxdroid.R import com.mifos.mifosxdroid.adapters.DataTableAdapter -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.core.util.Toaster import com.mifos.mifosxdroid.databinding.FragmentDatatablesBinding -import com.mifos.mifosxdroid.online.datatabledata.DataTableDataFragment import com.mifos.objects.noncore.DataTable import com.mifos.utils.Constants -import com.mifos.utils.FragmentConstants +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** * Created by Rajan Maurya on 12/02/17. */ +@AndroidEntryPoint class DataTableFragment : MifosBaseFragment(), DataTableMvpView, OnRefreshListener { private lateinit var binding: FragmentDatatablesBinding - private val arg : DataTableFragmentArgs by navArgs() + private val arg: DataTableFragmentArgs by navArgs() @Inject lateinit var dataTablePresenter: DataTablePresenter @@ -34,7 +33,11 @@ class DataTableFragment : MifosBaseFragment(), DataTableMvpView, OnRefreshListen private val dataTableAdapter by lazy { DataTableAdapter( onDateTableClick = { dataTable -> - val action = DataTableFragmentDirections.actionDataTableFragmentToDataTableDataFragment(dataTable,entityId) + val action = + DataTableFragmentDirections.actionDataTableFragmentToDataTableDataFragment( + dataTable, + entityId + ) findNavController().navigate(action) } ) @@ -55,7 +58,6 @@ class DataTableFragment : MifosBaseFragment(), DataTableMvpView, OnRefreshListen container: ViewGroup?, savedInstanceState: Bundle? ): View { - (activity as MifosBaseActivity).activityComponent?.inject(this) binding = FragmentDatatablesBinding.inflate(inflater, container, false) dataTablePresenter.attachView(this) showUserInterface() diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/datatabledata/DataTableDataFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/datatabledata/DataTableDataFragment.kt index 0ef488387c3..e1b3fa0f6d9 100755 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/datatabledata/DataTableDataFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/datatabledata/DataTableDataFragment.kt @@ -19,7 +19,6 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout.OnRefreshListener import com.google.gson.JsonArray import com.mifos.mifosxdroid.R import com.mifos.mifosxdroid.core.MaterialDialog -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.core.util.Toaster import com.mifos.mifosxdroid.databinding.FragmentDatatableBinding @@ -29,13 +28,15 @@ import com.mifos.utils.Constants import com.mifos.utils.DataTableUIBuilder import com.mifos.utils.DataTableUIBuilder.DataTableActionListener import com.mifos.utils.FragmentConstants +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject +@AndroidEntryPoint class DataTableDataFragment : MifosBaseFragment(), DataTableActionListener, DataTableDataMvpView, OnRefreshListener { private lateinit var binding: FragmentDatatableBinding - private val arg : DataTableDataFragmentArgs by navArgs() + private val arg: DataTableDataFragmentArgs by navArgs() @Inject lateinit var mDataTableDataPresenter: DataTableDataPresenter @@ -43,7 +44,6 @@ class DataTableDataFragment : MifosBaseFragment(), DataTableActionListener, Data private var entityId = 0 override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) dataTable = arg.dataTable entityId = arg.entityId setHasOptionsMenu(true) diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/datatablelistfragment/DataTableListFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/datatablelistfragment/DataTableListFragment.kt index e9aab2b8b82..fc45d75fd47 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/datatablelistfragment/DataTableListFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/datatablelistfragment/DataTableListFragment.kt @@ -16,7 +16,6 @@ import android.widget.Toast import androidx.fragment.app.Fragment import com.mifos.exceptions.RequiredFieldException import com.mifos.mifosxdroid.R -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.util.Toaster import com.mifos.mifosxdroid.databinding.DialogFragmentAddEntryToDatatableBinding import com.mifos.mifosxdroid.formwidgets.* @@ -31,6 +30,7 @@ import com.mifos.utils.Constants import com.mifos.utils.MifosResponseHandler import com.mifos.utils.PrefManager import com.mifos.utils.SafeUIBlockingUtility +import dagger.hilt.android.AndroidEntryPoint import java.util.* import javax.inject.Inject @@ -45,6 +45,7 @@ import javax.inject.Inject * 2. it shows all the datatables (from datatable array) unlike in the other fragments which show * a single datatable. */ +@AndroidEntryPoint class DataTableListFragment : Fragment(), DataTableListMvpView { private lateinit var binding: DialogFragmentAddEntryToDatatableBinding @@ -61,10 +62,6 @@ class DataTableListFragment : Fragment(), DataTableListMvpView { private var requestType = 0 private var safeUIBlockingUtility: SafeUIBlockingUtility? = null private val listFormWidgets: MutableList> = ArrayList() - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) - } override fun onCreateView( inflater: LayoutInflater, @@ -109,12 +106,14 @@ class DataTableListFragment : Fragment(), DataTableListMvpView { formWidgets.add(formEditText) binding.llDataTableEntryForm.addView(formEditText.view) } else if (columnHeader.columnDisplayType == FormWidget.SCHEMA_KEY_INT) { - val formNumericEditText = FormNumericEditText(activity, columnHeader.dataTableColumnName) + val formNumericEditText = + FormNumericEditText(activity, columnHeader.dataTableColumnName) formNumericEditText.returnType = FormWidget.SCHEMA_KEY_INT formWidgets.add(formNumericEditText) binding.llDataTableEntryForm.addView(formNumericEditText.view) } else if (columnHeader.columnDisplayType == FormWidget.SCHEMA_KEY_DECIMAL) { - val formNumericEditText = FormNumericEditText(activity, columnHeader.dataTableColumnName) + val formNumericEditText = + FormNumericEditText(activity, columnHeader.dataTableColumnName) formNumericEditText.returnType = FormWidget.SCHEMA_KEY_DECIMAL formWidgets.add(formNumericEditText) binding.llDataTableEntryForm.addView(formNumericEditText.view) diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/documentlist/DocumentListFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/documentlist/DocumentListFragment.kt index d3cf70a2a48..cd15879a68a 100755 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/documentlist/DocumentListFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/documentlist/DocumentListFragment.kt @@ -10,7 +10,6 @@ import android.content.pm.PackageManager import android.net.Uri import android.os.Bundle import android.os.Environment -import android.util.Log import android.view.LayoutInflater import android.view.Menu import android.view.MenuItem @@ -33,14 +32,16 @@ import com.mifos.utils.CheckSelfPermissionAndRequest import com.mifos.utils.Constants import com.mifos.utils.FileUtils import com.mifos.utils.FragmentConstants +import dagger.hilt.android.AndroidEntryPoint import okhttp3.ResponseBody import java.io.File import javax.inject.Inject +@AndroidEntryPoint class DocumentListFragment : MifosBaseFragment(), DocumentListMvpView, OnRefreshListener { private lateinit var binding: FragmentDocumentListBinding - private val arg : DocumentListFragmentArgs by navArgs() + private val arg: DocumentListFragmentArgs by navArgs() @Inject lateinit var mDocumentListPresenter: DocumentListPresenter @@ -61,7 +62,6 @@ class DocumentListFragment : MifosBaseFragment(), DocumentListMvpView, OnRefresh override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) mDocumentList = ArrayList() entityId = arg.entiyId entityType = arg.entityType diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/generatecollectionsheet/GenerateCollectionSheetFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/generatecollectionsheet/GenerateCollectionSheetFragment.kt index 415a7e04a5d..cba92817d4f 100755 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/generatecollectionsheet/GenerateCollectionSheetFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/generatecollectionsheet/GenerateCollectionSheetFragment.kt @@ -20,7 +20,6 @@ import android.widget.TextView import com.mifos.api.model.BulkRepaymentTransactions import com.mifos.api.model.ClientsAttendance import com.mifos.mifosxdroid.R -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.core.util.Toaster import com.mifos.mifosxdroid.databinding.FragmentGenerateCollectionSheetBinding @@ -40,11 +39,13 @@ import com.mifos.utils.DatePickerConstrainType import com.mifos.utils.FragmentConstants import com.mifos.utils.getDatePickerDialog import com.mifos.utils.getTodayFormatted +import dagger.hilt.android.AndroidEntryPoint import java.text.SimpleDateFormat import java.time.Instant import java.util.Locale import javax.inject.Inject +@AndroidEntryPoint class GenerateCollectionSheetFragment : MifosBaseFragment(), GenerateCollectionSheetMvpView, View.OnClickListener { @@ -87,7 +88,6 @@ class GenerateCollectionSheetFragment : MifosBaseFragment(), GenerateCollectionS private var calendarId: Int? = -1 override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) setHasOptionsMenu(true) } diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/generatecollectionsheet/GenerateCollectionSheetPresenter.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/generatecollectionsheet/GenerateCollectionSheetPresenter.kt index 95d6dce4848..846468f9486 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/generatecollectionsheet/GenerateCollectionSheetPresenter.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/generatecollectionsheet/GenerateCollectionSheetPresenter.kt @@ -6,7 +6,6 @@ import com.mifos.api.GenericResponse import com.mifos.api.datamanager.DataManagerCollectionSheet import com.mifos.mifosxdroid.R import com.mifos.mifosxdroid.base.BasePresenter -import com.mifos.mifosxdroid.injection.ActivityContext import com.mifos.objects.PaymentTypeOption import com.mifos.objects.collectionsheet.AttendanceTypeOption import com.mifos.objects.collectionsheet.CenterDetail @@ -20,6 +19,7 @@ import com.mifos.objects.group.Group import com.mifos.objects.organisation.Office import com.mifos.objects.organisation.Staff import com.mifos.utils.MFErrorParser +import dagger.hilt.android.qualifiers.ActivityContext import rx.Observable import rx.Subscriber import rx.android.schedulers.AndroidSchedulers diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/groupdetails/GroupDetailsFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/groupdetails/GroupDetailsFragment.kt index c03ec1c45fc..6ddb83ce9d6 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/groupdetails/GroupDetailsFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/groupdetails/GroupDetailsFragment.kt @@ -30,11 +30,13 @@ import com.mifos.objects.group.Group import com.mifos.objects.navigation.ClientListArgs import com.mifos.utils.Constants import com.mifos.utils.Utils +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** * Created by nellyk on 2/27/2016. */ +@AndroidEntryPoint class GroupDetailsFragment : MifosBaseFragment(), GroupDetailsMvpView { private lateinit var binding: FragmentGroupDetailsBinding @@ -45,7 +47,6 @@ class GroupDetailsFragment : MifosBaseFragment(), GroupDetailsMvpView { private var accountAccordion: AccountAccordion? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) if (arguments != null) { groupId = requireArguments().getInt(Constants.GROUP_ID) } diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/grouplist/GroupListFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/grouplist/GroupListFragment.kt index e911d13ebde..c4852a15c28 100755 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/grouplist/GroupListFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/grouplist/GroupListFragment.kt @@ -4,10 +4,7 @@ */ package com.mifos.mifosxdroid.online.grouplist -import android.app.Activity import android.os.Bundle -import android.os.Parcelable -import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -17,23 +14,21 @@ import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.navArgs import com.mifos.mifosxdroid.R import com.mifos.mifosxdroid.adapters.GroupListAdapter -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.ProgressableFragment import com.mifos.mifosxdroid.databinding.FragmentGroupListBinding -import com.mifos.mifosxdroid.online.groupdetails.GroupDetailsFragmentDirections import com.mifos.objects.client.Client import com.mifos.objects.group.CenterWithAssociations import com.mifos.objects.group.GroupWithAssociations import com.mifos.objects.navigation.ClientListArgs -import com.mifos.utils.Constants -import java.util.ArrayList +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject +@AndroidEntryPoint class GroupListFragment : ProgressableFragment(), GroupListMvpView, AdapterView.OnItemClickListener { private lateinit var binding: FragmentGroupListBinding - private val arg : GroupListFragmentArgs by navArgs() + private val arg: GroupListFragmentArgs by navArgs() @Inject lateinit var mGroupListPresenter: GroupListPresenter @@ -50,7 +45,6 @@ class GroupListFragment : ProgressableFragment(), GroupListMvpView, override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) centerId = arg.centerId } @@ -112,7 +106,7 @@ class GroupListFragment : ProgressableFragment(), GroupListMvpView, mGroupListPresenter.detachView() } - private fun loadClientsOfGroup(clientList: List){ + private fun loadClientsOfGroup(clientList: List) { val action = GroupListFragmentDirections.actionGroupListFragmentToClientListFragment( ClientListArgs(clientList, true) ) diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/grouploanaccount/GroupLoanAccountFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/grouploanaccount/GroupLoanAccountFragment.kt index 07e68c44b36..2286f91f132 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/grouploanaccount/GroupLoanAccountFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/grouploanaccount/GroupLoanAccountFragment.kt @@ -15,7 +15,6 @@ import android.widget.Toast import androidx.fragment.app.DialogFragment import androidx.navigation.fragment.navArgs import com.mifos.mifosxdroid.R -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.ProgressableDialogFragment import com.mifos.mifosxdroid.core.util.Toaster import com.mifos.mifosxdroid.databinding.FragmentAddLoanBinding @@ -27,9 +26,9 @@ import com.mifos.objects.templates.loans.GroupLoanTemplate import com.mifos.objects.templates.loans.RepaymentFrequencyDaysOfWeekTypeOptions import com.mifos.objects.templates.loans.RepaymentFrequencyNthDayTypeOptions import com.mifos.services.data.GroupLoanPayload -import com.mifos.utils.Constants import com.mifos.utils.DateHelper import com.mifos.utils.FragmentConstants +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** @@ -38,11 +37,12 @@ import javax.inject.Inject * * Use this Fragment to Create and/or Update loan */ +@AndroidEntryPoint class GroupLoanAccountFragment : ProgressableDialogFragment(), OnDatePickListener, GroupLoanAccountMvpView, OnItemSelectedListener { private lateinit var binding: FragmentAddLoanBinding - private val arg : GroupLoanAccountFragmentArgs by navArgs() + private val arg: GroupLoanAccountFragmentArgs by navArgs() @Inject lateinit var mGroupLoanAccountPresenter: GroupLoanAccountPresenter @@ -50,19 +50,19 @@ class GroupLoanAccountFragment : ProgressableDialogFragment(), OnDatePickListene var disbursementDate: String? = null private val mListener: OnDialogFragmentInteractionListener? = null private var mfDatePicker: DialogFragment? = null - private var productId : Int? = 0 + private var productId: Int? = 0 private var groupId = 0 - private var loanPurposeId : Int? =null - private var loanTermFrequency : Int? = null - private var loanTermFrequencyType : Int ? = null + private var loanPurposeId: Int? = null + private var loanTermFrequency: Int? = null + private var loanTermFrequencyType: Int? = null private var termFrequency: Int? = null private var repaymentEvery: Int? = null - private var transactionProcessingStrategyId : Int? = null - private var amortizationTypeId : Int ? = null - private var interestCalculationPeriodTypeId : Int? =null - private var fundId: Int ? = null - private var loanOfficerId : Int ? = null - private var interestTypeMethodId : Int ? = null + private var transactionProcessingStrategyId: Int? = null + private var amortizationTypeId: Int? = null + private var interestCalculationPeriodTypeId: Int? = null + private var fundId: Int? = null + private var loanOfficerId: Int? = null + private var interestTypeMethodId: Int? = null private var repaymentFrequencyNthDayType: Int? = null private var repaymentFrequencyDayOfWeek: Int? = null private var interestRatePerPeriod: Double? = null @@ -97,11 +97,11 @@ class GroupLoanAccountFragment : ProgressableDialogFragment(), OnDatePickListene private var mGroupLoanTemplate: GroupLoanTemplate? = null private var mLoanProducts: List? = null var mRepaymentFrequencyNthDayTypeOptions: List? = null - var mRepaymentFrequencyDaysOfWeekTypeOptions: List? = null + var mRepaymentFrequencyDaysOfWeekTypeOptions: List? = + null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) groupId = arg.groupId } @@ -482,7 +482,7 @@ class GroupLoanAccountFragment : ProgressableDialogFragment(), OnDatePickListene } if (mGroupLoanTemplate?.fundId != null) { fundId = mGroupLoanTemplate?.fundId - binding.spFund.setSelection(mGroupLoanTemplate?.fundId?:0) + binding.spFund.setSelection(mGroupLoanTemplate?.fundId ?: 0) } } diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/groupslist/GroupsListFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/groupslist/GroupsListFragment.kt index acb3282eb21..899544f8bf7 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/groupslist/GroupsListFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/groupslist/GroupsListFragment.kt @@ -4,7 +4,6 @@ */ package com.mifos.mifosxdroid.online.groupslist -import android.content.Intent import android.os.Bundle import android.os.Parcelable import android.view.* @@ -26,6 +25,7 @@ import com.mifos.mifosxdroid.dialogfragments.syncgroupsdialog.SyncGroupsDialogFr import com.mifos.objects.group.Group import com.mifos.utils.Constants import com.mifos.utils.FragmentConstants +import dagger.hilt.android.AndroidEntryPoint import java.util.* import javax.inject.Inject @@ -54,6 +54,7 @@ import javax.inject.Inject * boolean isParentFragment) {...} * and unregister the ScrollListener and SwipeLayout. */ +@AndroidEntryPoint class GroupsListFragment : MifosBaseFragment(), GroupsListMvpView, OnRefreshListener { private lateinit var binding: FragmentGroupsBinding @@ -100,7 +101,6 @@ class GroupsListFragment : MifosBaseFragment(), GroupsListMvpView, OnRefreshList override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) mGroupList = ArrayList() selectedGroups = ArrayList() actionModeCallback = ActionModeCallback() 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 index d6ca881c83f..a5e486faf3d 100644 --- 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 @@ -15,7 +15,6 @@ import android.widget.Toast import androidx.fragment.app.DialogFragment import androidx.navigation.fragment.navArgs import com.mifos.mifosxdroid.R -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.ProgressableDialogFragment import com.mifos.mifosxdroid.core.util.Toaster import com.mifos.mifosxdroid.databinding.FragmentAddLoanBinding @@ -31,6 +30,7 @@ import com.mifos.services.data.LoansPayload import com.mifos.utils.Constants import com.mifos.utils.DateHelper import com.mifos.utils.FragmentConstants +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** @@ -39,11 +39,12 @@ import javax.inject.Inject * * Use this Fragment to Create and/or Update loan */ +@AndroidEntryPoint class LoanAccountFragment : ProgressableDialogFragment(), OnDatePickListener, LoanAccountMvpView, OnItemSelectedListener { private lateinit var binding: FragmentAddLoanBinding - private val arg : LoanAccountFragmentArgs by navArgs() + private val arg: LoanAccountFragmentArgs by navArgs() @Inject lateinit var mLoanAccountPresenter: LoanAccountPresenter @@ -51,7 +52,7 @@ class LoanAccountFragment : ProgressableDialogFragment(), OnDatePickListener, Lo var disbursementDate: String? = null private var hasDataTables = false private var mfDatePicker: DialogFragment? = null - private var productId : Int? = 0 + private var productId: Int? = 0 private var clientId = 0 private var loanPurposeId: Int? = null private var loanTermFrequency: Int? = null @@ -114,7 +115,6 @@ class LoanAccountFragment : ProgressableDialogFragment(), OnDatePickListener, Lo ): View { activity?.actionBar?.setDisplayHomeAsUpEnabled(true) binding = FragmentAddLoanBinding.inflate(inflater, container, false) - (activity as MifosBaseActivity).activityComponent?.inject(this) mLoanAccountPresenter.attachView(this) inflateSubmissionDate() inflateDisbursementDate() diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loanaccountapproval/LoanAccountApproval.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loanaccountapproval/LoanAccountApproval.kt index 45c9180ca20..7b17accd72f 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loanaccountapproval/LoanAccountApproval.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loanaccountapproval/LoanAccountApproval.kt @@ -14,25 +14,25 @@ import androidx.navigation.fragment.navArgs import com.mifos.api.GenericResponse import com.mifos.exceptions.RequiredFieldException import com.mifos.mifosxdroid.R -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.databinding.DialogFragmentApproveLoanBinding import com.mifos.mifosxdroid.uihelpers.MFDatePicker import com.mifos.mifosxdroid.uihelpers.MFDatePicker.OnDatePickListener import com.mifos.objects.accounts.loan.LoanApproval import com.mifos.objects.accounts.loan.LoanWithAssociations -import com.mifos.utils.Constants import com.mifos.utils.DateHelper import com.mifos.utils.FragmentConstants +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** * @author nellyk */ +@AndroidEntryPoint class LoanAccountApproval : MifosBaseFragment(), OnDatePickListener, LoanAccountApprovalMvpView { private lateinit var binding: DialogFragmentApproveLoanBinding - private val arg : LoanAccountApprovalArgs by navArgs() + private val arg: LoanAccountApprovalArgs by navArgs() @Inject lateinit var mLoanAccountApprovalPresenter: LoanAccountApprovalPresenter @@ -45,7 +45,6 @@ class LoanAccountApproval : MifosBaseFragment(), OnDatePickListener, LoanAccount private var loanWithAssociations: LoanWithAssociations? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) loanAccountNumber = arg.loanAccountNumber loanWithAssociations = arg.loanWithAssociations setHasOptionsMenu(true) @@ -137,7 +136,7 @@ class LoanAccountApproval : MifosBaseFragment(), OnDatePickListener, LoanAccount ?.timeline!!.expectedDisbursementDate?.let { DateHelper.getDateAsString( it - ) + ) } disbursementDate = binding.tvExpectedDisbursementDates.text.toString() showApprovalDate() diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loanaccountdisbursement/LoanAccountDisbursementFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loanaccountdisbursement/LoanAccountDisbursementFragment.kt index d0123b24bad..f2be53a3d38 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loanaccountdisbursement/LoanAccountDisbursementFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loanaccountdisbursement/LoanAccountDisbursementFragment.kt @@ -17,7 +17,6 @@ import androidx.navigation.fragment.navArgs import com.mifos.api.GenericResponse import com.mifos.exceptions.RequiredFieldException import com.mifos.mifosxdroid.R -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.core.util.Toaster import com.mifos.mifosxdroid.databinding.DialogFragmentDisburseLoanBinding @@ -25,20 +24,21 @@ import com.mifos.mifosxdroid.uihelpers.MFDatePicker import com.mifos.mifosxdroid.uihelpers.MFDatePicker.OnDatePickListener import com.mifos.objects.accounts.loan.LoanDisbursement import com.mifos.objects.templates.loans.LoanTransactionTemplate -import com.mifos.utils.Constants import com.mifos.utils.DateHelper import com.mifos.utils.FragmentConstants import com.mifos.utils.Network +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** * Created by nellyk on 1/22/2016. */ +@AndroidEntryPoint class LoanAccountDisbursementFragment : MifosBaseFragment(), OnDatePickListener, LoanAccountDisbursementMvpView, OnItemSelectedListener { private lateinit var binding: DialogFragmentDisburseLoanBinding - private val arg : LoanAccountDisbursementFragmentArgs by navArgs() + private val arg: LoanAccountDisbursementFragmentArgs by navArgs() @Inject lateinit var loanAccountDisbursementPresenter: LoanAccountDisbursementPresenter @@ -51,7 +51,6 @@ class LoanAccountDisbursementFragment : MifosBaseFragment(), OnDatePickListener, private var loanTransactionTemplate: LoanTransactionTemplate? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) loanAccountNumber = arg.loanAccountNumber paymentTypeOptions = ArrayList() setHasOptionsMenu(true) diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loanaccountsummary/LoanAccountSummaryFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loanaccountsummary/LoanAccountSummaryFragment.kt index 045b5eafc82..3672e54fa05 100755 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loanaccountsummary/LoanAccountSummaryFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loanaccountsummary/LoanAccountSummaryFragment.kt @@ -16,18 +16,19 @@ import androidx.core.content.ContextCompat import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.navArgs import com.mifos.mifosxdroid.R -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.ProgressableFragment import com.mifos.mifosxdroid.databinding.FragmentLoanAccountSummaryBinding import com.mifos.objects.accounts.loan.LoanWithAssociations import com.mifos.objects.client.Charges import com.mifos.utils.Constants import com.mifos.utils.DateHelper +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** * Created by ishankhanna on 09/05/14. */ +@AndroidEntryPoint class LoanAccountSummaryFragment : ProgressableFragment(), LoanAccountSummaryMvpView { private lateinit var binding: FragmentLoanAccountSummaryBinding @@ -58,8 +59,6 @@ class LoanAccountSummaryFragment : ProgressableFragment(), LoanAccountSummaryMvp ): View { binding = FragmentLoanAccountSummaryBinding.inflate(inflater, container, false) - //Injecting Presenter - (activity as MifosBaseActivity).activityComponent?.inject(this) mLoanAccountSummaryPresenter.attachView(this) inflateLoanAccountSummary() return binding.root diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loancharge/LoanChargeFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loancharge/LoanChargeFragment.kt index fc3824bbb29..47c76e5643e 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loancharge/LoanChargeFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loancharge/LoanChargeFragment.kt @@ -15,24 +15,24 @@ import androidx.recyclerview.widget.LinearLayoutManager import com.mifos.mifosxdroid.R import com.mifos.mifosxdroid.adapters.ChargeNameListAdapter import com.mifos.mifosxdroid.core.EndlessRecyclerOnScrollListener -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.core.util.Toaster import com.mifos.mifosxdroid.databinding.FragmentChargeListBinding import com.mifos.mifosxdroid.dialogfragments.chargedialog.OnChargeCreateListener import com.mifos.mifosxdroid.dialogfragments.loanchargedialog.LoanChargeDialogFragment import com.mifos.objects.client.Charges -import com.mifos.utils.Constants import com.mifos.utils.FragmentConstants +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** * Created by nellyk on 1/22/2016. */ +@AndroidEntryPoint class LoanChargeFragment : MifosBaseFragment(), LoanChargeMvpView, OnChargeCreateListener { private lateinit var binding: FragmentChargeListBinding - private val arg : LoanChargeFragmentArgs by navArgs() + private val arg: LoanChargeFragmentArgs by navArgs() @Inject lateinit var mLoanChargePresenter: LoanChargePresenter @@ -41,7 +41,6 @@ class LoanChargeFragment : MifosBaseFragment(), LoanChargeMvpView, OnChargeCreat private var loanAccountNumber = 0 override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) loanAccountNumber = arg.loanAccountNumber setChargesList(arg.chargesList.toMutableList()) } diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loanrepayment/LoanRepaymentFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loanrepayment/LoanRepaymentFragment.kt index 95b26d7db23..c91ddbbd8a7 100755 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loanrepayment/LoanRepaymentFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loanrepayment/LoanRepaymentFragment.kt @@ -21,7 +21,6 @@ import com.google.gson.Gson import com.jakewharton.fliptables.FlipTable import com.mifos.mifosxdroid.R import com.mifos.mifosxdroid.core.MaterialDialog -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.core.util.Toaster import com.mifos.mifosxdroid.databinding.FragmentLoanRepaymentBinding @@ -34,14 +33,16 @@ import com.mifos.objects.templates.loans.LoanRepaymentTemplate import com.mifos.utils.Constants import com.mifos.utils.FragmentConstants import com.mifos.utils.Utils +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject +@AndroidEntryPoint class LoanRepaymentFragment : MifosBaseFragment(), OnDatePickListener, LoanRepaymentMvpView, DialogInterface.OnClickListener { private lateinit var binding: FragmentLoanRepaymentBinding val LOG_TAG = javaClass.simpleName - private val arg : LoanRepaymentFragmentArgs by navArgs() + private val arg: LoanRepaymentFragmentArgs by navArgs() @Inject lateinit var mLoanRepaymentPresenter: LoanRepaymentPresenter @@ -52,11 +53,10 @@ class LoanRepaymentFragment : MifosBaseFragment(), OnDatePickListener, LoanRepay private var loanAccountNumber: String? = null private var loanProductName: String? = null private var amountInArrears: Double? = null - private var paymentTypeOptionId : Int ? = null + private var paymentTypeOptionId: Int? = null private var mfDatePicker: DialogFragment? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) clientName = arg.loanWithAssociations.clientName loanAccountNumber = arg.loanWithAssociations.accountNo loanId = arg.loanWithAssociations.id.toString() diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loanrepaymentschedule/LoanRepaymentScheduleFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loanrepaymentschedule/LoanRepaymentScheduleFragment.kt index 97ab7472780..73966e040c2 100755 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loanrepaymentschedule/LoanRepaymentScheduleFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loanrepaymentschedule/LoanRepaymentScheduleFragment.kt @@ -19,8 +19,10 @@ import com.mifos.mifosxdroid.databinding.FragmentLoanRepaymentScheduleBinding import com.mifos.objects.accounts.loan.LoanWithAssociations import com.mifos.objects.accounts.loan.RepaymentSchedule import com.mifos.utils.Constants +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject +@AndroidEntryPoint class LoanRepaymentScheduleFragment : ProgressableFragment(), LoanRepaymentScheduleMvpView { private lateinit var binding: FragmentLoanRepaymentScheduleBinding @@ -31,7 +33,6 @@ class LoanRepaymentScheduleFragment : ProgressableFragment(), LoanRepaymentSched private var loanAccountNumber = 0 override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) loanAccountNumber = arg.loanId setHasOptionsMenu(false) } diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loantransactions/LoanTransactionsFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loantransactions/LoanTransactionsFragment.kt index 154c059d047..f1591a27abb 100755 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loantransactions/LoanTransactionsFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/loantransactions/LoanTransactionsFragment.kt @@ -12,18 +12,19 @@ import android.view.View import android.view.ViewGroup import androidx.navigation.fragment.navArgs import com.mifos.mifosxdroid.adapters.LoanTransactionAdapter -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.core.util.Toaster import com.mifos.mifosxdroid.databinding.FragmentLoanTransactionsBinding import com.mifos.objects.accounts.loan.LoanWithAssociations import com.mifos.utils.Constants +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject +@AndroidEntryPoint class LoanTransactionsFragment : MifosBaseFragment(), LoanTransactionsMvpView { private lateinit var binding: FragmentLoanTransactionsBinding - private val arg : LoanTransactionsFragmentArgs by navArgs() + private val arg: LoanTransactionsFragmentArgs by navArgs() @Inject lateinit var mLoanTransactionsPresenter: LoanTransactionsPresenter @@ -31,7 +32,6 @@ class LoanTransactionsFragment : MifosBaseFragment(), LoanTransactionsMvpView { private var loanAccountNumber = 0 override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) loanAccountNumber = arg.loanId setHasOptionsMenu(false) } diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/note/NoteFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/note/NoteFragment.kt index 3c77154d1e9..4855f5cd534 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/note/NoteFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/note/NoteFragment.kt @@ -9,22 +9,22 @@ import androidx.recyclerview.widget.LinearLayoutManager import androidx.swiperefreshlayout.widget.SwipeRefreshLayout.OnRefreshListener import com.mifos.mifosxdroid.R import com.mifos.mifosxdroid.adapters.NoteAdapter -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.core.util.Toaster import com.mifos.mifosxdroid.databinding.FragmentNotesBinding import com.mifos.objects.noncore.Note import com.mifos.utils.Constants -import java.util.ArrayList +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** * Created by rahul on 4/3/17. */ +@AndroidEntryPoint class NoteFragment : MifosBaseFragment(), NoteMvpView, OnRefreshListener { private lateinit var binding: FragmentNotesBinding - private val arg : NoteFragmentArgs by navArgs() + private val arg: NoteFragmentArgs by navArgs() @Inject lateinit var notePresenter: NotePresenter @@ -37,7 +37,6 @@ class NoteFragment : MifosBaseFragment(), NoteMvpView, OnRefreshListener { private var notes: List = ArrayList() override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) entityId = arg.entiyId entityType = arg.entityType } diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/runreports/report/ReportFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/runreports/report/ReportFragment.kt index 668d4848ea4..6516d1328bc 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/runreports/report/ReportFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/runreports/report/ReportFragment.kt @@ -28,6 +28,7 @@ import com.mifos.mifosxdroid.views.scrollview.ScrollChangeListener import com.mifos.objects.runreports.FullParameterListResponse import com.mifos.utils.CheckSelfPermissionAndRequest import com.mifos.utils.Constants +import dagger.hilt.android.AndroidEntryPoint import java.io.File import java.io.FileWriter import java.io.IOException @@ -37,20 +38,17 @@ import javax.inject.Inject /** * Created by Tarun on 05-08-17. */ +@AndroidEntryPoint class ReportFragment : MifosBaseFragment(), ReportMvpView, ScrollChangeListener { private lateinit var binding: FragmentClientReportBinding - private val arg : ReportFragmentArgs by navArgs() + private val arg: ReportFragmentArgs by navArgs() @Inject lateinit var presenter: ReportPresenter private var report: FullParameterListResponse? = null private var page = 0 private var bottom = 0 - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) - } override fun onCreateView( inflater: LayoutInflater, diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/runreports/reportcategory/ReportCategoryFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/runreports/reportcategory/ReportCategoryFragment.kt index 1d7f58b727e..f8676cee6f4 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/runreports/reportcategory/ReportCategoryFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/runreports/reportcategory/ReportCategoryFragment.kt @@ -11,17 +11,18 @@ import android.view.ViewGroup import androidx.navigation.fragment.findNavController import androidx.recyclerview.widget.LinearLayoutManager import com.mifos.mifosxdroid.adapters.ClientReportAdapter -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.core.util.Toaster.show import com.mifos.mifosxdroid.databinding.FragmentRunreportBinding import com.mifos.objects.runreports.client.ClientReportTypeItem import com.mifos.utils.Constants +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** * Created by Tarun on 02-08-17. */ +@AndroidEntryPoint class ReportCategoryFragment : MifosBaseFragment(), ReportCategoryMvpView { private lateinit var binding: FragmentRunreportBinding @@ -51,11 +52,6 @@ class ReportCategoryFragment : MifosBaseFragment(), ReportCategoryMvpView { requireActivity().unregisterReceiver(broadCastNewMessage) } - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) - } - override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/runreports/reportdetail/ReportDetailFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/runreports/reportdetail/ReportDetailFragment.kt index 5dbdf64f0eb..e250ce52560 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/runreports/reportdetail/ReportDetailFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/runreports/reportdetail/ReportDetailFragment.kt @@ -19,7 +19,6 @@ import androidx.fragment.app.DialogFragment import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.navArgs import com.mifos.mifosxdroid.R -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.core.util.Toaster.show import com.mifos.mifosxdroid.databinding.FragmentClientReportDetailsBinding @@ -29,6 +28,7 @@ import com.mifos.objects.runreports.FullParameterListResponse import com.mifos.objects.runreports.client.ClientReportTypeItem import com.mifos.utils.Constants import com.mifos.utils.FragmentConstants +import dagger.hilt.android.AndroidEntryPoint import java.text.ParseException import java.text.SimpleDateFormat import java.util.Date @@ -37,6 +37,7 @@ import javax.inject.Inject /** * Created by Tarun on 04-08-17. */ +@AndroidEntryPoint class ReportDetailFragment : MifosBaseFragment(), ReportDetailMvpView, OnDatePickListener { private lateinit var binding: FragmentClientReportDetailsBinding @@ -60,10 +61,6 @@ class ReportDetailFragment : MifosBaseFragment(), ReportDetailMvpView, OnDatePic private var dateField: String? = null var datePicker: DialogFragment? = null private var tvField: EditText? = null - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) - } override fun onCreateView( inflater: LayoutInflater, diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/savingaccountsummary/SavingsAccountSummaryFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/savingaccountsummary/SavingsAccountSummaryFragment.kt index 0c218ac3d93..2c8aed249cb 100755 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/savingaccountsummary/SavingsAccountSummaryFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/savingaccountsummary/SavingsAccountSummaryFragment.kt @@ -21,7 +21,6 @@ import androidx.navigation.fragment.navArgs import com.mifos.api.GenericResponse import com.mifos.mifosxdroid.R import com.mifos.mifosxdroid.adapters.SavingsAccountTransactionsListAdapter -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.ProgressableFragment import com.mifos.mifosxdroid.databinding.FragmentSavingsAccountSummaryBinding import com.mifos.objects.accounts.savings.DepositType @@ -30,9 +29,11 @@ import com.mifos.objects.accounts.savings.SavingsAccountWithAssociations import com.mifos.objects.accounts.savings.Status import com.mifos.objects.accounts.savings.Transaction import com.mifos.utils.Constants +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject import kotlin.properties.Delegates +@AndroidEntryPoint class SavingsAccountSummaryFragment : ProgressableFragment(), SavingsAccountSummaryMvpView { private lateinit var binding: FragmentSavingsAccountSummaryBinding @@ -77,7 +78,6 @@ class SavingsAccountSummaryFragment : ProgressableFragment(), SavingsAccountSumm savedInstanceState: Bundle? ): View { binding = FragmentSavingsAccountSummaryBinding.inflate(inflater, container, false) - (activity as MifosBaseActivity).activityComponent?.inject(this) mSavingAccountSummaryPresenter.attachView(this) mSavingAccountSummaryPresenter .loadSavingAccount(savingsAccountType?.endpoint, savingsAccountNumber) diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/savingaccounttransaction/SavingsAccountTransactionFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/savingaccounttransaction/SavingsAccountTransactionFragment.kt index 43dc5316470..c6e6ee05c14 100755 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/savingaccounttransaction/SavingsAccountTransactionFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/savingaccounttransaction/SavingsAccountTransactionFragment.kt @@ -20,7 +20,6 @@ import com.jakewharton.fliptables.FlipTable import com.mifos.exceptions.RequiredFieldException import com.mifos.mifosxdroid.R import com.mifos.mifosxdroid.core.MaterialDialog -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.ProgressableFragment import com.mifos.mifosxdroid.core.util.Toaster import com.mifos.mifosxdroid.databinding.FragmentSavingsAccountTransactionBinding @@ -36,20 +35,22 @@ import com.mifos.utils.FragmentConstants import com.mifos.utils.Network import com.mifos.utils.PrefManager import com.mifos.utils.Utils +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject +@AndroidEntryPoint class SavingsAccountTransactionFragment : ProgressableFragment(), OnDatePickListener, SavingsAccountTransactionMvpView { private lateinit var binding: FragmentSavingsAccountTransactionBinding - private val arg : SavingsAccountTransactionFragmentArgs by navArgs() + private val arg: SavingsAccountTransactionFragmentArgs by navArgs() val LOG_TAG = javaClass.simpleName @Inject lateinit var mSavingAccountTransactionPresenter: SavingsAccountTransactionPresenter private var savingsAccountNumber: String? = null - private var savingsAccountId : Int? = null + private var savingsAccountId: Int? = null private var savingsAccountType: DepositType? = null private var transactionType //Defines if the Transaction is a Deposit to an Account : String? = null @@ -62,7 +63,6 @@ class SavingsAccountTransactionFragment : ProgressableFragment(), OnDatePickList private var mfDatePicker: DialogFragment? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) savingsAccountId = arg.savingsAccountWithAssociations.accountNo savingsAccountId = arg.savingsAccountWithAssociations.id transactionType = arg.transactionType diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/savingsaccount/SavingsAccountFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/savingsaccount/SavingsAccountFragment.kt index f7c6fbed731..7acd35c5177 100755 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/savingsaccount/SavingsAccountFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/savingsaccount/SavingsAccountFragment.kt @@ -15,7 +15,6 @@ import android.widget.Toast import androidx.fragment.app.DialogFragment import androidx.navigation.fragment.navArgs import com.mifos.mifosxdroid.R -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.ProgressableDialogFragment import com.mifos.mifosxdroid.core.util.Toaster import com.mifos.mifosxdroid.databinding.FragmentAddSavingsAccountBinding @@ -29,6 +28,7 @@ import com.mifos.utils.Constants import com.mifos.utils.DateHelper import com.mifos.utils.FragmentConstants import com.mifos.utils.Network +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** @@ -37,18 +37,19 @@ import javax.inject.Inject * * Use this Dialog Fragment to Create and/or Update charges */ +@AndroidEntryPoint class SavingsAccountFragment : ProgressableDialogFragment(), OnDatePickListener, SavingsAccountMvpView, OnItemSelectedListener { private lateinit var binding: FragmentAddSavingsAccountBinding - private val arg : SavingsAccountFragmentArgs by navArgs() + private val arg: SavingsAccountFragmentArgs by navArgs() @Inject lateinit var mSavingsAccountPresenter: SavingsAccountPresenter private var mfDatePicker: DialogFragment? = null - private var productId :Int? = 0 + private var productId: Int? = 0 private var clientId = 0 - private var fieldOfficerId : Int? = 0 + private var fieldOfficerId: Int? = 0 private var groupId = 0 private var submission_date: String? = null var mFieldOfficerNames: MutableList = ArrayList() @@ -60,7 +61,6 @@ class SavingsAccountFragment : ProgressableDialogFragment(), OnDatePickListener, private var isGroupAccount = false override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) isGroupAccount = arg.isGroupAccount clientId = arg.id groupId = arg.id diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/savingsaccountactivate/SavingsAccountActivateFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/savingsaccountactivate/SavingsAccountActivateFragment.kt index 97c6dc55619..fc6d217b9c1 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/savingsaccountactivate/SavingsAccountActivateFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/savingsaccountactivate/SavingsAccountActivateFragment.kt @@ -13,17 +13,16 @@ import androidx.fragment.app.DialogFragment import androidx.navigation.fragment.navArgs import com.mifos.api.GenericResponse import com.mifos.mifosxdroid.R -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.core.util.Toaster import com.mifos.mifosxdroid.databinding.DialogFragmentApproveSavingsBinding import com.mifos.mifosxdroid.uihelpers.MFDatePicker import com.mifos.mifosxdroid.uihelpers.MFDatePicker.OnDatePickListener import com.mifos.objects.accounts.savings.DepositType -import com.mifos.utils.Constants import com.mifos.utils.DateHelper import com.mifos.utils.FragmentConstants import com.mifos.utils.SafeUIBlockingUtility +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** @@ -31,11 +30,12 @@ import javax.inject.Inject * Fragment to allow user to select a date for account approval. * It uses the same layout as Savings Account Approve Fragment. */ +@AndroidEntryPoint class SavingsAccountActivateFragment : MifosBaseFragment(), OnDatePickListener, SavingsAccountActivateMvpView { private lateinit var binding: DialogFragmentApproveSavingsBinding - private val arg : SavingsAccountActivateFragmentArgs by navArgs() + private val arg: SavingsAccountActivateFragmentArgs by navArgs() @Inject lateinit var mSavingsAccountActivatePresenter: SavingsAccountActivatePresenter @@ -46,7 +46,6 @@ class SavingsAccountActivateFragment : MifosBaseFragment(), OnDatePickListener, private var safeUIBlockingUtility: SafeUIBlockingUtility? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) savingsAccountNumber = arg.savingsAccountNumber savingsAccountType = arg.type setHasOptionsMenu(true) diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/savingsaccountapproval/SavingsAccountApprovalFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/savingsaccountapproval/SavingsAccountApprovalFragment.kt index 8e1e7230331..254f2b82804 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/savingsaccountapproval/SavingsAccountApprovalFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/savingsaccountapproval/SavingsAccountApprovalFragment.kt @@ -13,24 +13,29 @@ import androidx.fragment.app.DialogFragment import androidx.navigation.fragment.navArgs import com.mifos.api.GenericResponse import com.mifos.mifosxdroid.R -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.databinding.DialogFragmentApproveSavingsBinding import com.mifos.mifosxdroid.uihelpers.MFDatePicker import com.mifos.mifosxdroid.uihelpers.MFDatePicker.OnDatePickListener import com.mifos.objects.accounts.loan.SavingsApproval import com.mifos.objects.accounts.savings.DepositType -import com.mifos.utils.* +import com.mifos.utils.Constants +import com.mifos.utils.DateHelper +import com.mifos.utils.FragmentConstants +import com.mifos.utils.Network +import com.mifos.utils.SafeUIBlockingUtility +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** * @author nellyk */ +@AndroidEntryPoint class SavingsAccountApprovalFragment : MifosBaseFragment(), OnDatePickListener, SavingsAccountApprovalMvpView { private lateinit var binding: DialogFragmentApproveSavingsBinding - private val arg : SavingsAccountApprovalFragmentArgs by navArgs() + private val arg: SavingsAccountApprovalFragmentArgs by navArgs() @Inject lateinit var mSavingsAccountApprovalPresenter: SavingsAccountApprovalPresenter @@ -41,7 +46,6 @@ class SavingsAccountApprovalFragment : MifosBaseFragment(), OnDatePickListener, private var safeUIBlockingUtility: SafeUIBlockingUtility? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) savingsAccountNumber = arg.savingsAccountNumber savingsAccountType = arg.type setHasOptionsMenu(true) diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/search/SearchFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/search/SearchFragment.kt index b6643a00c5e..7f2689acb65 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/search/SearchFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/search/SearchFragment.kt @@ -20,7 +20,6 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.mifos.mifosxdroid.HomeActivity import com.mifos.mifosxdroid.R import com.mifos.mifosxdroid.adapters.SearchAdapter -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.core.util.Toaster.show import com.mifos.mifosxdroid.databinding.FragmentClientSearchBinding @@ -28,11 +27,13 @@ import com.mifos.objects.SearchedEntity import com.mifos.objects.navigation.ClientArgs import com.mifos.utils.Constants import com.mifos.utils.EspressoIdlingResource +import dagger.hilt.android.AndroidEntryPoint import uk.co.deanwild.materialshowcaseview.MaterialShowcaseSequence import uk.co.deanwild.materialshowcaseview.ShowcaseConfig import javax.inject.Inject +@AndroidEntryPoint class SearchFragment : MifosBaseFragment(), SearchMvpView { private lateinit var binding: FragmentClientSearchBinding @@ -58,7 +59,6 @@ class SearchFragment : MifosBaseFragment(), SearchMvpView { private var checkedFilter = 0 override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) searchedEntities = ArrayList() fabOpen = AnimationUtils.loadAnimation(context, R.anim.fab_open) fabClose = AnimationUtils.loadAnimation(context, R.anim.fab_close) diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/sign/SignatureFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/sign/SignatureFragment.kt index 77110831277..512c5d1ca0f 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/sign/SignatureFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/sign/SignatureFragment.kt @@ -27,18 +27,20 @@ import com.mifos.utils.CheckSelfPermissionAndRequest import com.mifos.utils.Constants import com.mifos.utils.FileUtils import com.mifos.utils.SafeUIBlockingUtility +import dagger.hilt.android.AndroidEntryPoint import java.io.File import javax.inject.Inject /** * Created by Tarun on 28-06-2017. */ +@AndroidEntryPoint class SignatureFragment : MifosBaseFragment(), SignatureMvpView, BottomNavigationView.OnNavigationItemSelectedListener, OnSignatureSaveListener { private lateinit var binding: FragmentSignBinding - private val arg : SignatureFragmentArgs by navArgs() - + private val arg: SignatureFragmentArgs by navArgs() + @Inject lateinit var mSignaturePresenter: SignaturePresenter private var mClientId: Int? = null @@ -46,7 +48,6 @@ class SignatureFragment : MifosBaseFragment(), SignatureMvpView, private var safeUIBlockingUtility: SafeUIBlockingUtility? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) safeUIBlockingUtility = SafeUIBlockingUtility( requireContext(), getString(R.string.signature_fragment_loading_message) diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/surveylist/SurveyListFragment.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/surveylist/SurveyListFragment.kt index 470b8e3a113..f038eb9b755 100755 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/surveylist/SurveyListFragment.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/surveylist/SurveyListFragment.kt @@ -15,12 +15,11 @@ import android.widget.AdapterView import androidx.navigation.fragment.navArgs import com.mifos.mifosxdroid.R import com.mifos.mifosxdroid.adapters.SurveyListAdapter -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.ProgressableFragment import com.mifos.mifosxdroid.core.util.Toaster import com.mifos.mifosxdroid.databinding.FragmentSurveyListBinding import com.mifos.objects.survey.Survey -import com.mifos.utils.Constants +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** @@ -30,10 +29,11 @@ import javax.inject.Inject * * Created by Nasim Banu on 27,January,2016. */ +@AndroidEntryPoint class SurveyListFragment : ProgressableFragment(), SurveyListMvpView { private lateinit var binding: FragmentSurveyListBinding - private val arg : SurveyListFragmentArgs by navArgs() + private val arg: SurveyListFragmentArgs by navArgs() @Inject lateinit var mSurveyListPresenter: SurveyListPresenter @@ -41,7 +41,6 @@ class SurveyListFragment : ProgressableFragment(), SurveyListMvpView { private var clientId = 0 override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) clientId = arg.clientId } 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 index 40e32a5df8a..7a71ade24e8 100755 --- 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 @@ -12,17 +12,18 @@ import android.view.View import android.view.ViewGroup import android.widget.Toast import com.mifos.mifosxdroid.R -import com.mifos.mifosxdroid.core.MifosBaseActivity import com.mifos.mifosxdroid.core.MifosBaseFragment import com.mifos.mifosxdroid.databinding.FragmentSurveyLastBinding import com.mifos.mifosxdroid.online.Communicator import com.mifos.mifosxdroid.online.SurveyQuestionActivity import com.mifos.objects.survey.Scorecard +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject /** * Created by Nasim Banu on 28,January,2016. */ +@AndroidEntryPoint class SurveySubmitFragment : MifosBaseFragment(), Communicator, SurveySubmitMvpView { private lateinit var binding: FragmentSurveyLastBinding @@ -32,10 +33,6 @@ class SurveySubmitFragment : MifosBaseFragment(), Communicator, SurveySubmitMvpV private var mDetachFragment: DisableSwipe? = null private var mScorecard: Scorecard? = null private var mSurveyId = 0 - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - (activity as MifosBaseActivity).activityComponent?.inject(this) - } override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, diff --git a/mifosng-android/src/main/java/com/mifos/objects/accounts/savings/Charge.kt b/mifosng-android/src/main/java/com/mifos/objects/accounts/savings/Charge.kt index 1b1dae09655..c4b789a4e30 100644 --- a/mifosng-android/src/main/java/com/mifos/objects/accounts/savings/Charge.kt +++ b/mifosng-android/src/main/java/com/mifos/objects/accounts/savings/Charge.kt @@ -6,7 +6,7 @@ package com.mifos.objects.accounts.savings import android.os.Parcelable import kotlinx.parcelize.Parcelize -import javax.annotation.Generated +import javax.annotation.processing.Generated @Parcelize @Generated("org.jsonschema2pojo") diff --git a/mifosng-android/src/main/java/com/mifos/objects/accounts/savings/ChargeCalculationType.kt b/mifosng-android/src/main/java/com/mifos/objects/accounts/savings/ChargeCalculationType.kt index 6f8f16a6134..84aac1d46e3 100644 --- a/mifosng-android/src/main/java/com/mifos/objects/accounts/savings/ChargeCalculationType.kt +++ b/mifosng-android/src/main/java/com/mifos/objects/accounts/savings/ChargeCalculationType.kt @@ -6,7 +6,7 @@ package com.mifos.objects.accounts.savings import android.os.Parcelable import kotlinx.parcelize.Parcelize -import javax.annotation.Generated +import javax.annotation.processing.Generated @Parcelize @Generated("org.jsonschema2pojo") diff --git a/mifosng-android/src/main/java/com/mifos/objects/accounts/savings/ChargeTimeType.kt b/mifosng-android/src/main/java/com/mifos/objects/accounts/savings/ChargeTimeType.kt index 312094bafc6..9da37cb94a1 100644 --- a/mifosng-android/src/main/java/com/mifos/objects/accounts/savings/ChargeTimeType.kt +++ b/mifosng-android/src/main/java/com/mifos/objects/accounts/savings/ChargeTimeType.kt @@ -6,7 +6,7 @@ package com.mifos.objects.accounts.savings import android.os.Parcelable import kotlinx.parcelize.Parcelize -import javax.annotation.Generated +import javax.annotation.processing.Generated @Parcelize @Generated("org.jsonschema2pojo")