new accounts icon, new page for more
Auto Tag on Version Change / check-version (push) Successful in 2s
Auto Tag on Version Change / check-version (push) Successful in 2s
This commit is contained in:
@@ -94,8 +94,9 @@ class HomeActivity : AppCompatActivity() {
|
||||
when (item.itemId) {
|
||||
R.id.nav_dashboard -> { show(DashboardFragment()); true }
|
||||
R.id.nav_accounts -> { show(AccountsFragment()); true }
|
||||
R.id.nav_contacts -> { show(ContactsFragment()); true }
|
||||
R.id.nav_transfer -> { show(TransferFragment()); true }
|
||||
R.id.nav_more -> { showMoreSheet(); false }
|
||||
R.id.nav_more -> { show(MoreFragment()); true }
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
@@ -104,16 +105,7 @@ class HomeActivity : AppCompatActivity() {
|
||||
|
||||
binding.navigationView.setNavigationItemSelectedListener { item ->
|
||||
binding.drawerLayout.closeDrawers()
|
||||
when (item.itemId) {
|
||||
R.id.nav_dashboard -> show(DashboardFragment())
|
||||
R.id.nav_accounts -> show(AccountsFragment())
|
||||
R.id.nav_contacts -> show(ContactsFragment())
|
||||
R.id.nav_transfer_history -> show(TransferHistoryFragment())
|
||||
R.id.nav_finances -> show(FinancingFragment())
|
||||
R.id.nav_otp -> show(OtpFragment())
|
||||
R.id.nav_settings -> show(SettingsFragment())
|
||||
else -> Toast.makeText(this, R.string.work_in_progress, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
navigateTo(item.itemId)
|
||||
true
|
||||
}
|
||||
|
||||
@@ -205,19 +197,18 @@ class HomeActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun showMoreSheet() {
|
||||
val sheet = NavMoreSheetFragment()
|
||||
sheet.onNavigate = { itemId ->
|
||||
when (itemId) {
|
||||
R.id.nav_contacts -> show(ContactsFragment())
|
||||
R.id.nav_transfer_history -> show(TransferHistoryFragment())
|
||||
R.id.nav_finances -> show(FinancingFragment())
|
||||
R.id.nav_otp -> show(OtpFragment())
|
||||
R.id.nav_settings -> show(SettingsFragment())
|
||||
else -> Toast.makeText(this, R.string.work_in_progress, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
fun navigateTo(itemId: Int) {
|
||||
when (itemId) {
|
||||
R.id.nav_dashboard -> show(DashboardFragment())
|
||||
R.id.nav_accounts -> show(AccountsFragment())
|
||||
R.id.nav_contacts -> show(ContactsFragment())
|
||||
R.id.nav_transfer -> show(TransferFragment())
|
||||
R.id.nav_transfer_history -> show(TransferHistoryFragment())
|
||||
R.id.nav_finances -> show(FinancingFragment())
|
||||
R.id.nav_otp -> show(OtpFragment())
|
||||
R.id.nav_settings -> show(SettingsFragment())
|
||||
else -> Toast.makeText(this, R.string.work_in_progress, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
sheet.show(supportFragmentManager, "nav_more")
|
||||
}
|
||||
|
||||
fun setRefreshing(visible: Boolean) {
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package sh.sar.basedbank.ui.home
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.fragment.app.Fragment
|
||||
import sh.sar.basedbank.R
|
||||
|
||||
class MoreFragment : Fragment() {
|
||||
|
||||
private data class NavItem(val id: Int, @DrawableRes val icon: Int, @StringRes val title: Int)
|
||||
|
||||
private val items = listOf(
|
||||
NavItem(R.id.nav_activities, R.drawable.ic_nav_activities, R.string.nav_activities),
|
||||
NavItem(R.id.nav_transfer_history, R.drawable.ic_nav_transfer_history, R.string.nav_transfer_history),
|
||||
NavItem(R.id.nav_finances, R.drawable.ic_nav_finances, R.string.nav_finances),
|
||||
NavItem(R.id.nav_card_settings, R.drawable.ic_nav_card, R.string.nav_card_settings),
|
||||
NavItem(R.id.nav_otp, R.drawable.ic_nav_otp, R.string.nav_otp),
|
||||
NavItem(R.id.nav_settings, R.drawable.ic_nav_settings, R.string.nav_settings),
|
||||
)
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View =
|
||||
inflater.inflate(R.layout.fragment_more, container, false)
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
val list = view.findViewById<LinearLayout>(R.id.moreList)
|
||||
val inflater = LayoutInflater.from(requireContext())
|
||||
for (item in items) {
|
||||
val row = inflater.inflate(R.layout.item_more_nav, list, false)
|
||||
row.findViewById<ImageView>(R.id.ivIcon).setImageResource(item.icon)
|
||||
row.findViewById<TextView>(R.id.tvLabel).setText(item.title)
|
||||
row.setOnClickListener { (requireActivity() as HomeActivity).navigateTo(item.id) }
|
||||
list.addView(row)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
requireActivity().title = getString(R.string.nav_more)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user