|
|
@ -7,6 +7,7 @@ import android.os.Handler |
|
|
|
import android.text.Html |
|
|
|
import android.view.View |
|
|
|
import android.view.ViewGroupOverlay |
|
|
|
import android.widget.ImageView |
|
|
|
import android.widget.TextView |
|
|
|
import androidx.annotation.LayoutRes |
|
|
|
import androidx.appcompat.app.AppCompatActivity |
|
|
@ -74,6 +75,8 @@ import com.remit.jmecustomer.features.trustdock.view.TrustDockActivity |
|
|
|
import com.remit.jmecustomer.features.userprofile.view.ProfileFragment |
|
|
|
import com.remit.jmecustomer.features.walletstatement.view.WalletStatementV2Activity |
|
|
|
import com.remit.jmecustomer.features.withdraw.view.WithdrawActivity |
|
|
|
import com.remit.jmecustomer.utils.Constants |
|
|
|
import com.remit.jmecustomer.utils.Utils |
|
|
|
|
|
|
|
|
|
|
|
class HomeActivityV3 : BaseActivity(), HomeParentViewContractV2, |
|
|
@ -141,14 +144,36 @@ class HomeActivityV3 : BaseActivity(), HomeParentViewContractV2, |
|
|
|
|
|
|
|
binding.vpDashboard.adapter = pagerAdapter |
|
|
|
|
|
|
|
// Add tabs with icons |
|
|
|
|
|
|
|
val tab1: TabLayout.Tab = |
|
|
|
binding.tabLayout.newTab().setIcon(R.drawable.ic_home_selected).setText(getString(R.string.home_text)) |
|
|
|
binding.tabLayout.newTab().setCustomView(R.layout.custom_tab_layout2) |
|
|
|
val tab2: TabLayout.Tab = |
|
|
|
binding.tabLayout.newTab().setIcon(R.drawable.ic_transfers_unselected) |
|
|
|
.setText(getString(R.string.receiver_text)) |
|
|
|
binding.tabLayout.newTab().setCustomView(R.layout.custom_tab_layout2) |
|
|
|
val tab3: TabLayout.Tab = |
|
|
|
binding.tabLayout.newTab().setIcon(R.drawable.profile_unselected).setText(getString(R.string.profile_text)) |
|
|
|
binding.tabLayout.newTab().setCustomView(R.layout.custom_tab_layout2) |
|
|
|
|
|
|
|
|
|
|
|
// Set icons for each tab |
|
|
|
tab1.customView?.findViewById<ImageView>(R.id.tab_icon) |
|
|
|
?.setImageResource(R.drawable.ic_home_selected) |
|
|
|
tab2.customView?.findViewById<ImageView>(R.id.tab_icon) |
|
|
|
?.setImageResource(R.drawable.ic_transfers_unselected) |
|
|
|
tab3.customView?.findViewById<ImageView>(R.id.tab_icon) |
|
|
|
?.setImageResource(R.drawable.profile_unselected) |
|
|
|
|
|
|
|
// Set texts for each tab |
|
|
|
tab1.customView?.findViewById<TextView>(R.id.tab_text)?.text = getString(R.string.home_text) |
|
|
|
tab2.customView?.findViewById<TextView>(R.id.tab_text)?.text = |
|
|
|
getString(R.string.receiver_text) |
|
|
|
tab3.customView?.findViewById<TextView>(R.id.tab_text)?.text = |
|
|
|
getString(R.string.profile_text) |
|
|
|
|
|
|
|
tab1.customView?.findViewById<TextView>(R.id.tab_text) |
|
|
|
?.setTextColor(getColor(R.color.light_blue)) |
|
|
|
tab2.customView?.findViewById<TextView>(R.id.tab_text) |
|
|
|
?.setTextColor(getColor(R.color.black_opacity_87)) |
|
|
|
tab3.customView?.findViewById<TextView>(R.id.tab_text) |
|
|
|
?.setTextColor(getColor(R.color.black_opacity_87)) |
|
|
|
|
|
|
|
|
|
|
|
// Add tabs to the TabLayout |
|
|
@ -158,7 +183,10 @@ class HomeActivityV3 : BaseActivity(), HomeParentViewContractV2, |
|
|
|
|
|
|
|
if (isTransactionComplete) { |
|
|
|
resetTabs() |
|
|
|
binding.tabLayout.getTabAt(1)?.setIcon(R.drawable.ic_transfers_selected) |
|
|
|
tab2.customView?.findViewById<ImageView>(R.id.tab_icon) |
|
|
|
?.setImageResource(R.drawable.ic_transfers_selected) |
|
|
|
tab2.customView?.findViewById<TextView>(R.id.tab_text) |
|
|
|
?.setTextColor(getColor(R.color.light_blue)) |
|
|
|
binding.vpDashboard.currentItem = 1 |
|
|
|
binding.tabLayout.selectTab(binding.tabLayout.getTabAt(1)) |
|
|
|
} |
|
|
@ -172,6 +200,9 @@ class HomeActivityV3 : BaseActivity(), HomeParentViewContractV2, |
|
|
|
} |
|
|
|
|
|
|
|
override fun onPageSelected(position: Int) { |
|
|
|
if (position == 0) { |
|
|
|
Constants.ENTERED_SENDING_AMOUNT = "" |
|
|
|
} |
|
|
|
if (viewModel?.notificationViewActive == true) { |
|
|
|
if (position == 1) { |
|
|
|
return |
|
|
@ -207,17 +238,26 @@ class HomeActivityV3 : BaseActivity(), HomeParentViewContractV2, |
|
|
|
when (tab.position) { |
|
|
|
0 -> { |
|
|
|
resetTabs() |
|
|
|
tab.setIcon(R.drawable.ic_home_selected) |
|
|
|
tab.customView?.findViewById<ImageView>(R.id.tab_icon) |
|
|
|
?.setImageResource(R.drawable.ic_home_selected) |
|
|
|
tab.customView?.findViewById<TextView>(R.id.tab_text) |
|
|
|
?.setTextColor(getColor(R.color.light_blue)) |
|
|
|
binding.vpDashboard.currentItem = 0 |
|
|
|
} |
|
|
|
1 -> { |
|
|
|
resetTabs() |
|
|
|
tab.setIcon(R.drawable.ic_transfers_selected) |
|
|
|
tab.customView?.findViewById<ImageView>(R.id.tab_icon) |
|
|
|
?.setImageResource(R.drawable.ic_transfers_selected) |
|
|
|
tab.customView?.findViewById<TextView>(R.id.tab_text) |
|
|
|
?.setTextColor(getColor(R.color.light_blue)) |
|
|
|
binding.vpDashboard.currentItem = 1 |
|
|
|
} |
|
|
|
2 -> { |
|
|
|
resetTabs() |
|
|
|
tab.setIcon(R.drawable.profile_selected) |
|
|
|
tab.customView?.findViewById<ImageView>(R.id.tab_icon) |
|
|
|
?.setImageResource(R.drawable.profile_selected) |
|
|
|
tab.customView?.findViewById<TextView>(R.id.tab_text) |
|
|
|
?.setTextColor(getColor(R.color.light_blue)) |
|
|
|
binding.vpDashboard.currentItem = 2 |
|
|
|
} |
|
|
|
|
|
|
@ -247,10 +287,19 @@ class HomeActivityV3 : BaseActivity(), HomeParentViewContractV2, |
|
|
|
} |
|
|
|
|
|
|
|
fun resetTabs() { |
|
|
|
binding.tabLayout.getTabAt(0)?.setIcon(R.drawable.ic_home_unselected) |
|
|
|
binding.tabLayout.getTabAt(1)?.setIcon(R.drawable.ic_transfers_unselected) |
|
|
|
binding.tabLayout.getTabAt(2)?.setIcon(R.drawable.profile_unselected) |
|
|
|
binding.tabLayout.getTabAt(3)?.setIcon(R.drawable.ic_msg) |
|
|
|
binding.tabLayout.getTabAt(0)?.customView?.findViewById<ImageView>(R.id.tab_icon) |
|
|
|
?.setImageResource(R.drawable.ic_home_unselected) |
|
|
|
binding.tabLayout.getTabAt(1)?.customView?.findViewById<ImageView>(R.id.tab_icon) |
|
|
|
?.setImageResource(R.drawable.ic_transfers_unselected) |
|
|
|
binding.tabLayout.getTabAt(2)?.customView?.findViewById<ImageView>(R.id.tab_icon) |
|
|
|
?.setImageResource(R.drawable.profile_unselected) |
|
|
|
|
|
|
|
binding.tabLayout.getTabAt(0)?.customView?.findViewById<TextView>(R.id.tab_text) |
|
|
|
?.setTextColor(getColor(R.color.black_opacity_87)) |
|
|
|
binding.tabLayout.getTabAt(1)?.customView?.findViewById<TextView>(R.id.tab_text) |
|
|
|
?.setTextColor(getColor(R.color.black_opacity_87)) |
|
|
|
binding.tabLayout.getTabAt(2)?.customView?.findViewById<TextView>(R.id.tab_text) |
|
|
|
?.setTextColor(getColor(R.color.black_opacity_87)) |
|
|
|
} |
|
|
|
|
|
|
|
override fun getContext(): AppCompatActivity { |
|
|
|