diff --git a/feature/search/src/main/java/com/mifos/feature/search/navigation/SearchNavigation.kt b/feature/search/src/main/java/com/mifos/feature/search/navigation/SearchNavigation.kt index 1f4051c0611..e5270c920a5 100644 --- a/feature/search/src/main/java/com/mifos/feature/search/navigation/SearchNavigation.kt +++ b/feature/search/src/main/java/com/mifos/feature/search/navigation/SearchNavigation.kt @@ -86,7 +86,3 @@ fun NavGraphBuilder.searchRoute( ) } } - -fun NavController.navigateSearchScreen() { - navigate(SearchScreens.SearchScreen.route) -} \ No newline at end of file diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/SearchAdapter.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/SearchAdapter.kt deleted file mode 100644 index d98f76d7bdb..00000000000 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/adapters/SearchAdapter.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.mifos.mifosxdroid.adapters - - -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.ImageView -import android.widget.TextView -import androidx.recyclerview.widget.RecyclerView -import com.amulyakhare.textdrawable.TextDrawable -import com.amulyakhare.textdrawable.TextDrawable.IBuilder -import com.amulyakhare.textdrawable.util.ColorGenerator -import com.mifos.core.objects.SearchedEntity -import com.mifos.mifosxdroid.R - - -class SearchAdapter( - val onSearchItemClick: (SearchedEntity) -> Unit -) : RecyclerView.Adapter() { - private val mColorGenerator = ColorGenerator.MATERIAL - private var mDrawableBuilder: IBuilder = TextDrawable.builder().round() - private var searchedResults: List = ArrayList() - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { - val viewHolder = ViewHolder( - LayoutInflater.from(parent.context) - .inflate(R.layout.list_item_client, parent, false) - ) - viewHolder.itemView.setOnClickListener { - if (viewHolder.adapterPosition != RecyclerView.NO_POSITION) - onSearchItemClick(searchedResults[viewHolder.adapterPosition]) - } - return viewHolder - } - - override fun onBindViewHolder(holder: ViewHolder, position: Int) { - val searchedEntity = searchedResults[position] - holder.tvName.text = searchedEntity.description - if (!searchedEntity.entityName.isNullOrBlank()) { - val drawable = mDrawableBuilder.build( - searchedEntity.entityType?.get(0).toString(), - mColorGenerator.getColor(searchedEntity.entityType) - ) - holder.ivIcon.setImageDrawable(drawable) - } - } - - override fun getItemCount() = searchedResults.size - - - fun setSearchResults(searchedResults: List) { - this.searchedResults = searchedResults - notifyDataSetChanged() - } - - class ViewHolder(v: View) : RecyclerView.ViewHolder(v) { - val ivIcon: ImageView = v.findViewById(R.id.tv_icon) - val tvName: TextView = v.findViewById(R.id.tv_name) - } -} diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/searchdialog/SearchDialog.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/searchdialog/SearchDialog.kt deleted file mode 100644 index 3f3ba95e2eb..00000000000 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/dialogfragments/searchdialog/SearchDialog.kt +++ /dev/null @@ -1,79 +0,0 @@ -package com.mifos.mifosxdroid.dialogfragments.searchdialog - -import android.R -import android.app.Dialog -import android.content.Context -import android.text.Editable -import android.text.TextWatcher -import android.view.View -import android.view.ViewGroup -import android.widget.AdapterView -import android.widget.ArrayAdapter -import android.widget.EditText -import android.widget.ListView -import java.util.Locale - -class SearchDialog( - context: Context, private val mainList: ArrayList, - private val clickListener: AdapterView.OnItemClickListener -) : Dialog(context) { - private lateinit var filterList: ArrayList - private var editText: EditText? = null - private var listView: ListView? = null - private var adapter: ArrayAdapter? = null - - init { - setUp() - } - - private fun setUp() { - filterList = ArrayList() - filterList.addAll(mainList) - setContentView(0) - adapter = ArrayAdapter( - context, R.layout.simple_list_item_1, - R.id.text1, filterList - ) - listView = findViewById(com.mifos.mifosxdroid.R.id.lv_items) - editText = findViewById(com.mifos.mifosxdroid.R.id.et_drop_down_search) - editText?.addTextChangedListener(object : TextWatcher { - override fun beforeTextChanged(charSequence: CharSequence, start: Int, count: Int, after: Int) {} - override fun onTextChanged(charSequence: CharSequence, start: Int, before: Int, count: Int) {} - override fun afterTextChanged(editable: Editable) { - filterList.clear() - val text = editable.toString().lowercase(Locale.getDefault()) - for (s in mainList) { - if (s.lowercase(Locale.getDefault()).contains(text)) { - filterList.add(s) - } - } - adapter?.notifyDataSetChanged() - } - }) - listView?.onItemClickListener = AdapterView.OnItemClickListener { adapterView, view, i, l -> - for (pos in mainList.indices) { - if (mainList[pos] == filterList[i]) { - clickListener.onItemClick(adapterView, view, pos, l) - } - } - dismiss() - } - listView?.adapter = adapter - } - - override fun setContentView(layoutResID: Int) { - var layoutResID = layoutResID - layoutResID = com.mifos.mifosxdroid.R.layout.search_list_dialog_layout - super.setContentView(layoutResID) - } - - @Deprecated("") - override fun setContentView(view: View) { - super.setContentView(view) - } - - @Deprecated("") - override fun addContentView(view: View, params: ViewGroup.LayoutParams?) { - super.addContentView(view, params) - } -} \ No newline at end of file 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 deleted file mode 100644 index f5f610b461a..00000000000 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/search/SearchFragment.kt +++ /dev/null @@ -1,97 +0,0 @@ -/* - * This project is licensed under the open source MPL V2. - * See https://github.com/openMF/android-client/blob/master/LICENSE.md - */ -package com.mifos.mifosxdroid.online.search - -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import androidx.compose.ui.platform.ComposeView -import androidx.compose.ui.platform.ViewCompositionStrategy -import androidx.navigation.fragment.findNavController -import com.mifos.core.objects.SearchedEntity -import com.mifos.core.objects.navigation.ClientArgs -import com.mifos.core.ui.components.FabType -import com.mifos.feature.search.SearchScreenRoute -import com.mifos.mifosxdroid.R -import com.mifos.mifosxdroid.activity.home.HomeActivity -import com.mifos.mifosxdroid.core.MifosBaseFragment -import com.mifos.utils.Constants -import dagger.hilt.android.AndroidEntryPoint - -@AndroidEntryPoint -class SearchFragment : MifosBaseFragment() { - - override fun onCreateView( - inflater: LayoutInflater, - container: ViewGroup?, - savedInstanceState: Bundle? - ): View { - (activity as HomeActivity).supportActionBar?.title = getString(R.string.dashboard) - return ComposeView(requireContext()).apply { - setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed) - setContent { - SearchScreenRoute( - onFabClick = { fabType -> - onFabClick(fabType) - }, - onSearchOptionClick = { - onSearchOptionClick(it) - } - ) - } - } - } - - private fun onFabClick(fabType: FabType) { - when (fabType) { - FabType.CLIENT -> { - findNavController().navigate(R.id.action_navigation_dashboard_to_createNewClientFragment) - } - FabType.CENTER -> { - findNavController().navigate(R.id.action_navigation_dashboard_to_createNewCenterFragment) - } - FabType.GROUP -> { - } - } - } - - private fun onSearchOptionClick(searchedEntity: SearchedEntity) { - when (searchedEntity.entityType) { - Constants.SEARCH_ENTITY_LOAN -> { - val action = SearchFragmentDirections.actionNavigationDashboardToClientActivity( - ClientArgs(clientId = searchedEntity.entityId) - ) - findNavController().navigate(action) - } - - Constants.SEARCH_ENTITY_CLIENT -> { - val action = SearchFragmentDirections.actionNavigationDashboardToClientActivity( - ClientArgs(clientId = searchedEntity.entityId) - ) - findNavController().navigate(action) - } - - Constants.SEARCH_ENTITY_GROUP -> { - - } - - Constants.SEARCH_ENTITY_SAVING -> { - val action = SearchFragmentDirections.actionNavigationDashboardToClientActivity( - ClientArgs(savingsAccountNumber = searchedEntity.entityId) - ) - findNavController().navigate(action) - } - - Constants.SEARCH_ENTITY_CENTER -> { - val action = - SearchFragmentDirections.actionNavigationDashboardToCentersActivity( - searchedEntity.entityId - ) - findNavController().navigate(action) - } - } - } -} \ No newline at end of file diff --git a/mifosng-android/src/main/res/layout/activity_client_search.xml b/mifosng-android/src/main/res/layout/activity_client_search.xml deleted file mode 100755 index 23f838e44c4..00000000000 --- a/mifosng-android/src/main/res/layout/activity_client_search.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/mifosng-android/src/main/res/layout/fragment_client_search.xml b/mifosng-android/src/main/res/layout/fragment_client_search.xml deleted file mode 100755 index 0c334dcc7e0..00000000000 --- a/mifosng-android/src/main/res/layout/fragment_client_search.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - - -