diff --git a/app/build.gradle b/app/build.gradle index 4afbf90d4..c9164092d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,7 +9,7 @@ apply from: '../config/quality/quality.gradle' android { compileSdkVersion rootProject.ext.compileSdkVersion - + defaultConfig { applicationId "org.mifos.mobile" minSdkVersion rootProject.ext.minSdkVersion @@ -118,7 +118,7 @@ dependencies { //Dagger dependencies kapt "com.google.dagger:dagger-compiler:$rootProject.daggerVersion" implementation "com.google.dagger:dagger:$rootProject.daggerVersion" - compileOnly 'javax.annotation:jsr250-api:1.0' + compileOnly 'javax.annotation:jsr250-api:1.0' compileOnly 'com.github.pengrad:jdk9-deps:1.0' //Required by Dagger2 //Butter Knife @@ -165,9 +165,11 @@ dependencies { androidTestImplementation "androidx.test.espresso:espresso-core:$rootProject.espressoVersion" androidTestImplementation "androidx.test:runner:$rootProject.runnerVersion" androidTestImplementation "androidx.test:rules:$rootProject.rulesVersion" - + implementation 'com.github.rahul-gill.mifos-ui-library:uihouse:alpha-2.1' coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5' + //showcase view + implementation 'com.github.mreram:showcaseview:1.4.1' } apply plugin: 'com.google.gms.google-services' diff --git a/app/src/main/java/org/mifos/mobile/ui/fragments/HomeOldFragment.kt b/app/src/main/java/org/mifos/mobile/ui/fragments/HomeOldFragment.kt index c34fda97b..4445cabe8 100644 --- a/app/src/main/java/org/mifos/mobile/ui/fragments/HomeOldFragment.kt +++ b/app/src/main/java/org/mifos/mobile/ui/fragments/HomeOldFragment.kt @@ -1,4 +1,3 @@ - package org.mifos.mobile.ui.fragments import android.animation.LayoutTransition @@ -24,6 +23,7 @@ import butterknife.ButterKnife import butterknife.OnClick import com.google.android.material.badge.BadgeDrawable import com.google.android.material.badge.BadgeUtils +import com.google.android.material.card.MaterialCardView import com.google.android.material.imageview.ShapeableImageView import kotlinx.android.synthetic.main.fragment_home_old.* import org.mifos.mobile.R @@ -41,6 +41,10 @@ import org.mifos.mobile.ui.fragments.base.BaseFragment import org.mifos.mobile.ui.getThemeAttributeColor import org.mifos.mobile.ui.views.HomeOldView import org.mifos.mobile.utils.* +import smartdevelop.ir.eram.showcaseviewlib.GuideView +import smartdevelop.ir.eram.showcaseviewlib.config.DismissType +import smartdevelop.ir.eram.showcaseviewlib.config.Gravity +import smartdevelop.ir.eram.showcaseviewlib.config.PointerType import javax.inject.Inject /** @@ -60,7 +64,6 @@ class HomeOldFragment : BaseFragment(), HomeOldView, OnRefreshListener { var llAccountDetail: LinearLayout? = null - @kotlin.jvm.JvmField @BindView(R.id.iv_circular_user_image) var ivCircularUserImage: ShapeableImageView? = null @@ -81,6 +84,14 @@ class HomeOldFragment : BaseFragment(), HomeOldView, OnRefreshListener { @Inject var presenter: HomeOldPresenter? = null + @kotlin.jvm.JvmField + @BindView(R.id.ll_contact_us) + var llContactUs: LinearLayout? = null + + @kotlin.jvm.JvmField + @BindView(R.id.ll_account_overview) + var llAccountOverview: MaterialCardView? = null + @kotlin.jvm.JvmField @Inject var preferencesHelper: PreferencesHelper? = null @@ -93,10 +104,12 @@ class HomeOldFragment : BaseFragment(), HomeOldView, OnRefreshListener { private var isDetailVisible: Boolean? = false private var isReceiverRegistered = false private var tvNotificationCount: TextView? = null + private var mGuideView: GuideView? = null + private var builder: GuideView.Builder? = null override fun onCreateView( - inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? ): View? { rootView = inflater.inflate(R.layout.fragment_home_old, container, false) (activity as HomeActivity?)?.activityComponent?.inject(this) @@ -104,15 +117,25 @@ class HomeOldFragment : BaseFragment(), HomeOldView, OnRefreshListener { clientId = preferencesHelper?.clientId presenter?.attachView(this) setHasOptionsMenu(true) - slHomeContainer?.setColorSchemeResources(R.color.blue_light, R.color.green_light, R.color.orange_light, R.color.red_light) + slHomeContainer?.setColorSchemeResources( + R.color.blue_light, + R.color.green_light, + R.color.orange_light, + R.color.red_light + ) slHomeContainer?.setOnRefreshListener(this) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { llContainer?.layoutTransition - ?.enableTransitionType(LayoutTransition.CHANGING) + ?.enableTransitionType(LayoutTransition.CHANGING) } if (savedInstanceState == null) { loadClientData() } + + if (PreferencesHelper(context).getBoolean(Constants.SHOW_CASE, true) == true) { + showcaseView() + PreferencesHelper(context).putBoolean(Constants.SHOW_CASE, false) + } setToolbarTitle(getString(R.string.home)) showUserInterface() return rootView @@ -130,7 +153,14 @@ class HomeOldFragment : BaseFragment(), HomeOldView, OnRefreshListener { val count = menuItem.actionView tvNotificationCount = count.findViewById(R.id.tv_notification_indicator) presenter?.unreadNotificationsCount - count.setOnClickListener { startActivity(Intent(context, NotificationActivity::class.java)) } + count.setOnClickListener { + startActivity( + Intent( + context, + NotificationActivity::class.java + ) + ) + } super.onCreateOptionsMenu(menu, inflater) } @@ -141,15 +171,18 @@ class HomeOldFragment : BaseFragment(), HomeOldView, OnRefreshListener { } override fun onPause() { - LocalBroadcastManager.getInstance(requireActivity()).unregisterReceiver(notificationReceiver) + LocalBroadcastManager.getInstance(requireActivity()) + .unregisterReceiver(notificationReceiver) isReceiverRegistered = false super.onPause() } private fun registerReceiver() { if (!isReceiverRegistered) { - LocalBroadcastManager.getInstance(requireActivity()).registerReceiver(notificationReceiver, - IntentFilter(Constants.NOTIFY_HOME_FRAGMENT)) + LocalBroadcastManager.getInstance(requireActivity()).registerReceiver( + notificationReceiver, + IntentFilter(Constants.NOTIFY_HOME_FRAGMENT) + ) isReceiverRegistered = true } } @@ -192,7 +225,8 @@ class HomeOldFragment : BaseFragment(), HomeOldView, OnRefreshListener { */ fun openAccount(accountType: AccountType?) { (activity as BaseActivity?)?.replaceFragment( - ClientAccountsFragment.newInstance(accountType), true, R.id.container) + ClientAccountsFragment.newInstance(accountType), true, R.id.container + ) } /** @@ -255,15 +289,18 @@ class HomeOldFragment : BaseFragment(), HomeOldView, OnRefreshListener { ivCircularUserImage?.setImageBitmap(bitmap) } else { val userName = preferencesHelper?.clientName.let { savedName -> - if(savedName.isNullOrBlank()) getString(R.string.app_name) + if (savedName.isNullOrBlank()) getString(R.string.app_name) else savedName } val drawable = TextDrawable.builder() - .beginConfig() - .toUpperCase() - .endConfig() - .buildRound(userName.substring(0, 1),requireContext().getThemeAttributeColor(R.attr.colorPrimary)) + .beginConfig() + .toUpperCase() + .endConfig() + .buildRound( + userName.substring(0, 1), + requireContext().getThemeAttributeColor(R.attr.colorPrimary) + ) ivCircularUserImage?.setImageDrawable(drawable) } } @@ -330,22 +367,25 @@ class HomeOldFragment : BaseFragment(), HomeOldView, OnRefreshListener { */ @OnClick(R.id.ll_transfer) fun transferClicked() { - val transferTypes = arrayOf(getString(R.string.transfer), getString(R.string.third_party_transfer)) + val transferTypes = + arrayOf(getString(R.string.transfer), getString(R.string.third_party_transfer)) MaterialDialog.Builder().init(activity) - .setTitle(R.string.choose_transfer_type) - .setItems(transferTypes, - DialogInterface.OnClickListener { _, which -> - if (which == 0) { - (activity as HomeActivity?)?.replaceFragment( - SavingsMakeTransferFragment.newInstance(1, ""), true, - R.id.container) - } else { - (activity as HomeActivity?)?.replaceFragment( - ThirdPartyTransferFragment.newInstance(), true, R.id.container) - } - }) - .createMaterialDialog() - .show() + .setTitle(R.string.choose_transfer_type) + .setItems(transferTypes, + DialogInterface.OnClickListener { _, which -> + if (which == 0) { + (activity as HomeActivity?)?.replaceFragment( + SavingsMakeTransferFragment.newInstance(1, ""), true, + R.id.container + ) + } else { + (activity as HomeActivity?)?.replaceFragment( + ThirdPartyTransferFragment.newInstance(), true, R.id.container + ) + } + }) + .createMaterialDialog() + .show() } /** @@ -353,8 +393,12 @@ class HomeOldFragment : BaseFragment(), HomeOldView, OnRefreshListener { */ @OnClick(R.id.ll_charges) fun chargesClicked() { - (activity as HomeActivity?)?.replaceFragment(ClientChargeFragment.newInstance(clientId, - ChargeType.CLIENT), true, R.id.container) + (activity as HomeActivity?)?.replaceFragment( + ClientChargeFragment.newInstance( + clientId, + ChargeType.CLIENT + ), true, R.id.container + ) } /** @@ -371,7 +415,11 @@ class HomeOldFragment : BaseFragment(), HomeOldView, OnRefreshListener { */ @OnClick(R.id.ll_beneficiaries) fun beneficiaries() { - (activity as HomeActivity?)?.replaceFragment(BeneficiaryListFragment.newInstance(), true, R.id.container) + (activity as HomeActivity?)?.replaceFragment( + BeneficiaryListFragment.newInstance(), + true, + R.id.container + ) } @OnClick(R.id.ll_surveys) @@ -420,4 +468,33 @@ class HomeOldFragment : BaseFragment(), HomeOldView, OnRefreshListener { return HomeOldFragment() } } + + private fun showcaseView() { + + builder = GuideView.Builder(requireContext()) + .setContentText(getString(R.string.show_case_user_details)) + .setGravity(Gravity.center) + .setDismissType(DismissType.anywhere) + .setPointerType(PointerType.circle) + .setTargetView(ivCircularUserImage) + .setGuideListener { view: View -> + when (view.id) { + R.id.iv_circular_user_image -> { + builder!!.setTargetView(llAccountOverview) + .setContentText(getString(R.string.show_case_amount_loan)).build() + } + R.id.ll_account_overview -> { + builder!!.setTargetView(llContactUs) + .setContentText(getString(R.string.show_case_contact_us)).build() + } + R.id.ll_contact_us -> return@setGuideListener + } + mGuideView = builder!!.build() + mGuideView!!.show() + } + + mGuideView = builder!!.build() + mGuideView!!.show() + + } } \ No newline at end of file diff --git a/app/src/main/java/org/mifos/mobile/utils/Constants.kt b/app/src/main/java/org/mifos/mobile/utils/Constants.kt index 80ed9b826..947615650 100644 --- a/app/src/main/java/org/mifos/mobile/utils/Constants.kt +++ b/app/src/main/java/org/mifos/mobile/utils/Constants.kt @@ -67,4 +67,5 @@ object Constants { const val LOAN_REPAYMENT = "loan_repayment" const val CURR_PASSWORD = "currentPassword" const val IS_TO_UPDATE_PASS_CODE = "updatePassCode" + const val SHOW_CASE = "show_case" } \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_home_old.xml b/app/src/main/res/layout/fragment_home_old.xml index 0360f46f5..ca36e418c 100644 --- a/app/src/main/res/layout/fragment_home_old.xml +++ b/app/src/main/res/layout/fragment_home_old.xml @@ -1,57 +1,57 @@ - + android:layout_width="match_parent" + android:layout_height="match_parent"> + android:layout_width="match_parent" + android:layout_height="match_parent"> + android:padding="@dimen/Mifos.DesignSystem.Spacing.CardInnerPaddingLarger"> + app:shapeAppearance="@dimen/Mifos.DesignSystem.Size.CircularUserImageSize" + tools:src="@drawable/ic_person_black_24dp" /> + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="center" + tools:text="Hello, you guys" /> @@ -63,44 +63,49 @@ + android:layout_marginBottom="@dimen/Mifos.DesignSystem.Spacing.marginWords" + android:text="@string/accounts_overview" /> + android:layout_marginVertical="@dimen/Mifos.DesignSystem.Spacing.marginWords" /> + + android:text="@string/total_saving" /> + + android:layout_weight="1" /> + + android:textColor="@color/deposit_green" + android:visibility="gone" + tools:text="$ 1000" /> + + android:visibility="visible" /> + + android:layout_marginTop="@dimen/Mifos.DesignSystem.Spacing.marginBetweenItemsSmall" + android:orientation="horizontal"> + + + + android:textColor="@color/red" + android:visibility="gone" /> + + android:textColor="@color/red" + android:visibility="visible" /> + + android:useDefaultMargins="true"> @@ -200,30 +210,30 @@ @@ -232,30 +242,30 @@ @@ -263,30 +273,30 @@ @@ -295,30 +305,30 @@ @@ -327,30 +337,30 @@ @@ -359,40 +369,42 @@ + + android:text="@string/need_help" /> + android:text="@string/help_line_number" /> + android:text="@string/contact_email" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ae7bbdcb4..d46f2022b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -641,4 +641,9 @@ App Info + + Click here to access User Details + Here you can view the total amount of savings and loans you have + Reach out to us using below credentials +