From 38da5a8269e62add2945d75f87817276b135ef9d Mon Sep 17 00:00:00 2001 From: kmanikanta335 <118070186+kmanikanta335@users.noreply.github.com> Date: Sun, 5 Nov 2023 23:12:46 +0530 Subject: [PATCH 1/2] feature:error layout --- .../groupdetails/GroupDetailsFragment.kt | 30 ++++++++++++++++++- .../res/layout/fragment_group_details.xml | 8 ++++- .../src/main/res/values-ca/strings.xml | 1 + .../src/main/res/values-en/strings.xml | 1 + .../src/main/res/values-es/strings.xml | 1 + .../src/main/res/values-fr/strings.xml | 1 + .../src/main/res/values-hi/strings.xml | 1 + .../src/main/res/values-kn/strings.xml | 1 + .../src/main/res/values-sw/strings.xml | 1 + .../src/main/res/values-zh/strings.xml | 1 + .../src/main/res/values/strings.xml | 2 ++ 11 files changed, 46 insertions(+), 2 deletions(-) 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 2710e9a784f..dd5de6fdaa0 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 @@ -10,12 +10,15 @@ import android.view.MenuItem import android.view.View import android.view.ViewGroup import android.widget.AdapterView +import android.widget.Button import android.widget.ListAdapter import android.widget.ListView import android.widget.TextView import android.widget.Toast import androidx.lifecycle.ViewModelProvider import androidx.navigation.fragment.findNavController +import androidx.recyclerview.widget.LinearLayoutManager +import com.github.therajanmaurya.sweeterror.SweetUIErrorHandler import com.joanzapata.iconify.fonts.MaterialIcons import com.joanzapata.iconify.widget.IconTextView import com.mifos.mifosxdroid.R @@ -45,6 +48,7 @@ class GroupDetailsFragment : MifosBaseFragment() { private lateinit var binding: FragmentGroupDetailsBinding private lateinit var viewModel: GroupDetailsViewModel + private var sweetUIErrorHandler: SweetUIErrorHandler? = null private var groupId = 0 private var accountAccordion: AccountAccordion? = null @@ -65,11 +69,14 @@ class GroupDetailsFragment : MifosBaseFragment() { viewModel = ViewModelProvider(this)[GroupDetailsViewModel::class.java] viewModel.loadGroupDetailsAndAccounts(groupId) + showUserInterface() + viewModel.groupDetailsUiState.observe(viewLifecycleOwner) { when (it) { is GroupDetailsUiState.ShowFetchingError -> { showProgressbar(false) - showFetchingError(it.message) + // showFetchingError(it.message) + showErrorLayout() } is GroupDetailsUiState.ShowGroup -> { @@ -100,8 +107,29 @@ class GroupDetailsFragment : MifosBaseFragment() { binding.btnActivateGroup.setOnClickListener { onClickActivateGroup() } + binding.layoutError.findViewById