diff --git a/core/data/src/main/assets/banks.json b/core/data/src/main/assets/banks.json index d6ca08728..4c2b5d41a 100644 --- a/core/data/src/main/assets/banks.json +++ b/core/data/src/main/assets/banks.json @@ -1,114 +1,112 @@ -{ - "banks": [ - "Aditya Birla Payments Bank", - "Airtel Payments Bank", - "Allahabad Bank", - "Andhra Bank", - "Axis Bank", - "Bank Of Baroda", - "Bank Of India", - "Bank of Maharashtra", - "Canara Bank", - "Catholic Syrian Bank", - "Centralᅠ Bank of india", - "City Union Bank", - "DBS Digi Bank", - "DCB Bank", - "Dena Bank", - "Equitas Small Finance Bank", - "Federal Bank", - "FINO Payments Bank", - "HDFC", - "HSBC", - "ICICI Bank", - "IDBI Bank", - "IDFC", - "Indian Bank", - "Indian Overseas Bank", - "IndusInd Bank", - "Jammu & Kashmir Bank", - "Janta Sahakari Bank Pune", - "Karnataka Bank", - "Karur Vysaya Bank", - "Kotak Mahindra Bank", - "Oriental Bank of Commerce", - "Paytm Payments Bank", - "Punjab and Sind Bank", - "Punjab National Bank", - "South Indian Bank", - "Standard Chartered", - "State Bank Of India", - "Syndicate Bank", - "The Lakshmi Vilas Bank Limited", - "The Ratnakar Bank Limited", - "The Thane Janta Sahakari Bank Ltd(TJSB)", - "UCO Bank", - "Union Bank of India", - "United Bank of India", - "Vijaya Bank", - "Yes Bank", - "Bandhan Bank", - "Corporation Bank", - "G P Parsik Bank", - "Kallappanna Awade Ichalkaranji Janata Sahakari Bank Ltd.", - "Rajkot Nagari Sahakari Bank Ltd", - "Thane Bharat Sahakari Bank", - "The Mehsana Urban Co-Operative Bank", - "The Saraswat Co-Operative Bank", - "Allahabad UP Gramin Bank", - "Andhra Pragathi Grameena Bank", - "Andhra Pragathi Grameena Vikas Bank", - "Apna Sahakari Bank", - "Assam Gramin Vikas Bank", - "Baroda Gujarat Gramin Bank", - "Baroda Rajasthan Kshetriya Gramin Bank", - "Bassein Catholic Coop Bank", - "Bihar Gramin Bank", - "Chaitanya Godavari Grameena Bank", - "Chhattisgarh Rajya Gramin Bank", - "Citibank ", - "Dena Gujarat Gramin Bank", - "Dombivali Nagrik Sahakari Bank", - "Jalgaon Janata Sahkari Bank", - "Jio Payment bank", - "Karnataka vikas Gramin Bank", - "Kashi Gomti Samyut Gramin Bank", - "Kaveri Grameen Bank", - "Kerala Gramin Bank", - "Langpi Dehangi Rural Bank", - "Maharashtra Gramin Bank", - "Malwa Gramin Bank", - "Manipur Rural Bank", - "Meghalaya Rural Bank", - "Mizoram Rural Bank", - "Pragathi Krishna Gramin Bank", - "Prathama Bank", - "Punjab and Maharastra Co. bank", - "Purvanchal gramin Bank", - "Rajasthan Marudhara Gramin Bank", - "Saurashtra Gramin Bankᅠ", - "Tamilnad Mercantile Bank", - "Telangana Grameena Bank", - "The Gujarat State Co-operative Bank Limited", - "The Hasti Co-operative Bank Ltd", - "The Kalyan Janta Sahkari Bank", - "The Mahanagar Co-Op. Bank Ltd", - "The SVC Co-Operative Bank Ltd", - "The Vishweshwar Sahakari Bank Ltd", - "Theᅠ Cosmos Co-Operative Bank LTD", - "Tripura Gramin Bank", - "Uttarakhand Gramin Bank", - "Vananchal Gramin Bank", - "Vasai Vikas Co-op Bank Ltd", - "A. P Mahesh Bank", - "Baroda Uttar Pradesh Gramin Bank", - "dhanalaxmi bank", - "NKGSB Co-op Bank Ltd.", - "Samruddhi Co-op bank ltd", - "The Surat People Cooperative bank", - "The Sutex Cooperative Bank", - "The Urban Cooperative Bank Ltd Dharangaon", - "The Varachha Co-op Bank Ltd", - "Ujjivan Small Finance Bank" - ] -} \ No newline at end of file +[ + "Aditya Birla Payments Bank", + "Airtel Payments Bank", + "Allahabad Bank", + "Andhra Bank", + "Axis Bank", + "Bank Of Baroda", + "Bank Of India", + "Bank of Maharashtra", + "Canara Bank", + "Catholic Syrian Bank", + "Centralᅠ Bank of india", + "City Union Bank", + "DBS Digi Bank", + "DCB Bank", + "Dena Bank", + "Equitas Small Finance Bank", + "Federal Bank", + "FINO Payments Bank", + "HDFC", + "HSBC", + "ICICI Bank", + "IDBI Bank", + "IDFC", + "Indian Bank", + "Indian Overseas Bank", + "IndusInd Bank", + "Jammu & Kashmir Bank", + "Janta Sahakari Bank Pune", + "Karnataka Bank", + "Karur Vysaya Bank", + "Kotak Mahindra Bank", + "Oriental Bank of Commerce", + "Paytm Payments Bank", + "Punjab and Sind Bank", + "Punjab National Bank", + "South Indian Bank", + "Standard Chartered", + "State Bank Of India", + "Syndicate Bank", + "The Lakshmi Vilas Bank Limited", + "The Ratnakar Bank Limited", + "The Thane Janta Sahakari Bank Ltd(TJSB)", + "UCO Bank", + "Union Bank of India", + "United Bank of India", + "Vijaya Bank", + "Yes Bank", + "Bandhan Bank", + "Corporation Bank", + "G P Parsik Bank", + "Kallappanna Awade Ichalkaranji Janata Sahakari Bank Ltd.", + "Rajkot Nagari Sahakari Bank Ltd", + "Thane Bharat Sahakari Bank", + "The Mehsana Urban Co-Operative Bank", + "The Saraswat Co-Operative Bank", + "Allahabad UP Gramin Bank", + "Andhra Pragathi Grameena Bank", + "Andhra Pragathi Grameena Vikas Bank", + "Apna Sahakari Bank", + "Assam Gramin Vikas Bank", + "Baroda Gujarat Gramin Bank", + "Baroda Rajasthan Kshetriya Gramin Bank", + "Bassein Catholic Coop Bank", + "Bihar Gramin Bank", + "Chaitanya Godavari Grameena Bank", + "Chhattisgarh Rajya Gramin Bank", + "Citibank ", + "Dena Gujarat Gramin Bank", + "Dombivali Nagrik Sahakari Bank", + "Jalgaon Janata Sahkari Bank", + "Jio Payment bank", + "Karnataka vikas Gramin Bank", + "Kashi Gomti Samyut Gramin Bank", + "Kaveri Grameen Bank", + "Kerala Gramin Bank", + "Langpi Dehangi Rural Bank", + "Maharashtra Gramin Bank", + "Malwa Gramin Bank", + "Manipur Rural Bank", + "Meghalaya Rural Bank", + "Mizoram Rural Bank", + "Pragathi Krishna Gramin Bank", + "Prathama Bank", + "Punjab and Maharastra Co. bank", + "Purvanchal gramin Bank", + "Rajasthan Marudhara Gramin Bank", + "Saurashtra Gramin Bankᅠ", + "Tamilnad Mercantile Bank", + "Telangana Grameena Bank", + "The Gujarat State Co-operative Bank Limited", + "The Hasti Co-operative Bank Ltd", + "The Kalyan Janta Sahkari Bank", + "The Mahanagar Co-Op. Bank Ltd", + "The SVC Co-Operative Bank Ltd", + "The Vishweshwar Sahakari Bank Ltd", + "Theᅠ Cosmos Co-Operative Bank LTD", + "Tripura Gramin Bank", + "Uttarakhand Gramin Bank", + "Vananchal Gramin Bank", + "Vasai Vikas Co-op Bank Ltd", + "A. P Mahesh Bank", + "Baroda Uttar Pradesh Gramin Bank", + "dhanalaxmi bank", + "NKGSB Co-op Bank Ltd.", + "Samruddhi Co-op bank ltd", + "The Surat People Cooperative bank", + "The Sutex Cooperative Bank", + "The Urban Cooperative Bank Ltd Dharangaon", + "The Varachha Co-op Bank Ltd", + "Ujjivan Small Finance Bank" +] diff --git a/core/designsystem/src/main/kotlin/org/mifos/mobilewallet/mifospay/designsystem/theme/Color.kt b/core/designsystem/src/main/kotlin/org/mifos/mobilewallet/mifospay/designsystem/theme/Color.kt index 568f8632e..f84299eef 100644 --- a/core/designsystem/src/main/kotlin/org/mifos/mobilewallet/mifospay/designsystem/theme/Color.kt +++ b/core/designsystem/src/main/kotlin/org/mifos/mobilewallet/mifospay/designsystem/theme/Color.kt @@ -74,4 +74,6 @@ val red = Color(0xFFCD0000) val mifosText = Color(0xFF212121) val chipSelectedColor = Color(0xFF00BFFF) val creditTextColor = Color(0xFF009688) -val debitTextColor = Color(0xFFF10606) \ No newline at end of file +val debitTextColor = Color(0xFFF10606) +val greyBackgroundColor = Color(0xFFF7F7F7) +val primaryDarkBlue = Color(0xFF303F9F) \ No newline at end of file diff --git a/core/network/src/main/assets/banks.json b/core/network/src/main/assets/banks.json index d6ca08728..4c2b5d41a 100644 --- a/core/network/src/main/assets/banks.json +++ b/core/network/src/main/assets/banks.json @@ -1,114 +1,112 @@ -{ - "banks": [ - "Aditya Birla Payments Bank", - "Airtel Payments Bank", - "Allahabad Bank", - "Andhra Bank", - "Axis Bank", - "Bank Of Baroda", - "Bank Of India", - "Bank of Maharashtra", - "Canara Bank", - "Catholic Syrian Bank", - "Centralᅠ Bank of india", - "City Union Bank", - "DBS Digi Bank", - "DCB Bank", - "Dena Bank", - "Equitas Small Finance Bank", - "Federal Bank", - "FINO Payments Bank", - "HDFC", - "HSBC", - "ICICI Bank", - "IDBI Bank", - "IDFC", - "Indian Bank", - "Indian Overseas Bank", - "IndusInd Bank", - "Jammu & Kashmir Bank", - "Janta Sahakari Bank Pune", - "Karnataka Bank", - "Karur Vysaya Bank", - "Kotak Mahindra Bank", - "Oriental Bank of Commerce", - "Paytm Payments Bank", - "Punjab and Sind Bank", - "Punjab National Bank", - "South Indian Bank", - "Standard Chartered", - "State Bank Of India", - "Syndicate Bank", - "The Lakshmi Vilas Bank Limited", - "The Ratnakar Bank Limited", - "The Thane Janta Sahakari Bank Ltd(TJSB)", - "UCO Bank", - "Union Bank of India", - "United Bank of India", - "Vijaya Bank", - "Yes Bank", - "Bandhan Bank", - "Corporation Bank", - "G P Parsik Bank", - "Kallappanna Awade Ichalkaranji Janata Sahakari Bank Ltd.", - "Rajkot Nagari Sahakari Bank Ltd", - "Thane Bharat Sahakari Bank", - "The Mehsana Urban Co-Operative Bank", - "The Saraswat Co-Operative Bank", - "Allahabad UP Gramin Bank", - "Andhra Pragathi Grameena Bank", - "Andhra Pragathi Grameena Vikas Bank", - "Apna Sahakari Bank", - "Assam Gramin Vikas Bank", - "Baroda Gujarat Gramin Bank", - "Baroda Rajasthan Kshetriya Gramin Bank", - "Bassein Catholic Coop Bank", - "Bihar Gramin Bank", - "Chaitanya Godavari Grameena Bank", - "Chhattisgarh Rajya Gramin Bank", - "Citibank ", - "Dena Gujarat Gramin Bank", - "Dombivali Nagrik Sahakari Bank", - "Jalgaon Janata Sahkari Bank", - "Jio Payment bank", - "Karnataka vikas Gramin Bank", - "Kashi Gomti Samyut Gramin Bank", - "Kaveri Grameen Bank", - "Kerala Gramin Bank", - "Langpi Dehangi Rural Bank", - "Maharashtra Gramin Bank", - "Malwa Gramin Bank", - "Manipur Rural Bank", - "Meghalaya Rural Bank", - "Mizoram Rural Bank", - "Pragathi Krishna Gramin Bank", - "Prathama Bank", - "Punjab and Maharastra Co. bank", - "Purvanchal gramin Bank", - "Rajasthan Marudhara Gramin Bank", - "Saurashtra Gramin Bankᅠ", - "Tamilnad Mercantile Bank", - "Telangana Grameena Bank", - "The Gujarat State Co-operative Bank Limited", - "The Hasti Co-operative Bank Ltd", - "The Kalyan Janta Sahkari Bank", - "The Mahanagar Co-Op. Bank Ltd", - "The SVC Co-Operative Bank Ltd", - "The Vishweshwar Sahakari Bank Ltd", - "Theᅠ Cosmos Co-Operative Bank LTD", - "Tripura Gramin Bank", - "Uttarakhand Gramin Bank", - "Vananchal Gramin Bank", - "Vasai Vikas Co-op Bank Ltd", - "A. P Mahesh Bank", - "Baroda Uttar Pradesh Gramin Bank", - "dhanalaxmi bank", - "NKGSB Co-op Bank Ltd.", - "Samruddhi Co-op bank ltd", - "The Surat People Cooperative bank", - "The Sutex Cooperative Bank", - "The Urban Cooperative Bank Ltd Dharangaon", - "The Varachha Co-op Bank Ltd", - "Ujjivan Small Finance Bank" - ] -} \ No newline at end of file +[ + "Aditya Birla Payments Bank", + "Airtel Payments Bank", + "Allahabad Bank", + "Andhra Bank", + "Axis Bank", + "Bank Of Baroda", + "Bank Of India", + "Bank of Maharashtra", + "Canara Bank", + "Catholic Syrian Bank", + "Centralᅠ Bank of india", + "City Union Bank", + "DBS Digi Bank", + "DCB Bank", + "Dena Bank", + "Equitas Small Finance Bank", + "Federal Bank", + "FINO Payments Bank", + "HDFC", + "HSBC", + "ICICI Bank", + "IDBI Bank", + "IDFC", + "Indian Bank", + "Indian Overseas Bank", + "IndusInd Bank", + "Jammu & Kashmir Bank", + "Janta Sahakari Bank Pune", + "Karnataka Bank", + "Karur Vysaya Bank", + "Kotak Mahindra Bank", + "Oriental Bank of Commerce", + "Paytm Payments Bank", + "Punjab and Sind Bank", + "Punjab National Bank", + "South Indian Bank", + "Standard Chartered", + "State Bank Of India", + "Syndicate Bank", + "The Lakshmi Vilas Bank Limited", + "The Ratnakar Bank Limited", + "The Thane Janta Sahakari Bank Ltd(TJSB)", + "UCO Bank", + "Union Bank of India", + "United Bank of India", + "Vijaya Bank", + "Yes Bank", + "Bandhan Bank", + "Corporation Bank", + "G P Parsik Bank", + "Kallappanna Awade Ichalkaranji Janata Sahakari Bank Ltd.", + "Rajkot Nagari Sahakari Bank Ltd", + "Thane Bharat Sahakari Bank", + "The Mehsana Urban Co-Operative Bank", + "The Saraswat Co-Operative Bank", + "Allahabad UP Gramin Bank", + "Andhra Pragathi Grameena Bank", + "Andhra Pragathi Grameena Vikas Bank", + "Apna Sahakari Bank", + "Assam Gramin Vikas Bank", + "Baroda Gujarat Gramin Bank", + "Baroda Rajasthan Kshetriya Gramin Bank", + "Bassein Catholic Coop Bank", + "Bihar Gramin Bank", + "Chaitanya Godavari Grameena Bank", + "Chhattisgarh Rajya Gramin Bank", + "Citibank ", + "Dena Gujarat Gramin Bank", + "Dombivali Nagrik Sahakari Bank", + "Jalgaon Janata Sahkari Bank", + "Jio Payment bank", + "Karnataka vikas Gramin Bank", + "Kashi Gomti Samyut Gramin Bank", + "Kaveri Grameen Bank", + "Kerala Gramin Bank", + "Langpi Dehangi Rural Bank", + "Maharashtra Gramin Bank", + "Malwa Gramin Bank", + "Manipur Rural Bank", + "Meghalaya Rural Bank", + "Mizoram Rural Bank", + "Pragathi Krishna Gramin Bank", + "Prathama Bank", + "Punjab and Maharastra Co. bank", + "Purvanchal gramin Bank", + "Rajasthan Marudhara Gramin Bank", + "Saurashtra Gramin Bankᅠ", + "Tamilnad Mercantile Bank", + "Telangana Grameena Bank", + "The Gujarat State Co-operative Bank Limited", + "The Hasti Co-operative Bank Ltd", + "The Kalyan Janta Sahkari Bank", + "The Mahanagar Co-Op. Bank Ltd", + "The SVC Co-Operative Bank Ltd", + "The Vishweshwar Sahakari Bank Ltd", + "Theᅠ Cosmos Co-Operative Bank LTD", + "Tripura Gramin Bank", + "Uttarakhand Gramin Bank", + "Vananchal Gramin Bank", + "Vasai Vikas Co-op Bank Ltd", + "A. P Mahesh Bank", + "Baroda Uttar Pradesh Gramin Bank", + "dhanalaxmi bank", + "NKGSB Co-op Bank Ltd.", + "Samruddhi Co-op bank ltd", + "The Surat People Cooperative bank", + "The Sutex Cooperative Bank", + "The Urban Cooperative Bank Ltd Dharangaon", + "The Varachha Co-op Bank Ltd", + "Ujjivan Small Finance Bank" +] diff --git a/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/presenter/LinkBankAccountViewModel.kt b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/presenter/LinkBankAccountViewModel.kt new file mode 100644 index 000000000..ac2bee5f2 --- /dev/null +++ b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/presenter/LinkBankAccountViewModel.kt @@ -0,0 +1,116 @@ +package org.mifos.mobilewallet.mifospay.bank.presenter + +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import com.mifos.mobilewallet.model.domain.BankAccountDetails +import dagger.hilt.android.lifecycle.HiltViewModel +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.SharingStarted +import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.flow.combine +import kotlinx.coroutines.flow.map +import kotlinx.coroutines.flow.stateIn +import kotlinx.coroutines.flow.update +import kotlinx.coroutines.launch +import org.mifos.mobilewallet.core.repository.local.MifosLocalAssetRepository +import org.mifos.mobilewallet.mifospay.R +import org.mifos.mobilewallet.mifospay.bank.ui.LinkBankAccountActivity +import org.mifos.mobilewallet.mifospay.domain.model.Bank +import java.util.Random +import javax.inject.Inject + + +@HiltViewModel +class LinkBankAccountViewModel @Inject constructor( + val localAssetRepository: MifosLocalAssetRepository +) : ViewModel() { + + private val _searchQuery = MutableStateFlow("") + private val searchQuery: StateFlow = _searchQuery.asStateFlow() + + private val _bankState = MutableStateFlow(BankUiState.Loading) + val bankState = _bankState.asStateFlow() + + fun updateSearchQuery(query: String) { + _searchQuery.update { query } + } + + init { + getAllBanks() + } + + private fun getAllBanks() { + + val banksListFlow = localAssetRepository.getBanks() + + viewModelScope.launch { + val banksList = + banksListFlow.map { banks -> + banks.map { bank -> + Bank( + bank, + R.drawable.ic_bank, + 1 + ) + } + }.stateIn(viewModelScope) + + _bankState.value = + BankUiState.LoadedBankState( + popularBanks = getPopularBanks(), + allBanks = banksList.value + ) + } + } + + private fun getPopularBanks(): List { + return listOf( + Bank("RBL Bank", R.drawable.logo_rbl, 0), + Bank("SBI Bank", R.drawable.logo_sbi, 0), + Bank("PNB Bank", R.drawable.logo_pnb, 0), + Bank("HDFC Bank", R.drawable.logo_hdfc, 0), + Bank("ICICI Bank", R.drawable.logo_icici, 0), + Bank("AXIS Bank", R.drawable.logo_axis, 0) + ) + } + + val bankListUiState: StateFlow = combine( + localAssetRepository.getBanks(), + _searchQuery, + ::Pair + ).map { pair -> + val banks = pair.first + val allBanks = banks.map { Bank(it, R.drawable.ic_bank, 1) } + .filter { it.name.contains(pair.second, ignoreCase = true) } + + BankUiState.LoadedBankState(popularBanks = getPopularBanks(), allBanks = allBanks) + }.stateIn( + scope = viewModelScope, + started = SharingStarted.WhileSubscribed(5_000), + initialValue = BankUiState.LoadedBankState( + popularBanks = emptyList(), + allBanks = emptyList() + ), + ) + fun fetchBankAccountDetails(bankName: String?,activity:LinkBankAccountActivity) { + // TODO:: UPI API implement + activity.addBankAccount( + BankAccountDetails( + bankName, "Ankur Sharma", "New Delhi", + mRandom.nextInt().toString() + " ", "Savings" + ) + ) + } + companion object{ + private val mRandom = Random() + } +} + +sealed interface BankUiState { + data class LoadedBankState( + val popularBanks: List, + val allBanks: List + ) : BankUiState + data object Loading : BankUiState +} \ No newline at end of file diff --git a/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/ChooseSimDialog.kt b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/ChooseSimDialog.kt deleted file mode 100644 index 159c9ec4a..000000000 --- a/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/ChooseSimDialog.kt +++ /dev/null @@ -1,91 +0,0 @@ -package org.mifos.mobilewallet.mifospay.bank.ui - -import android.app.Dialog -import android.os.Bundle -import android.view.View -import android.widget.Button -import android.widget.TextView -import android.widget.Toast -import butterknife.BindView -import butterknife.ButterKnife -import butterknife.OnClick -import com.google.android.material.bottomsheet.BottomSheetBehavior -import com.google.android.material.bottomsheet.BottomSheetDialog -import com.google.android.material.bottomsheet.BottomSheetDialogFragment -import org.mifos.mobilewallet.mifospay.R - -/** - * Created by ankur on 09/July/2018 - */ -class ChooseSimDialog : BottomSheetDialogFragment() { - @JvmField - @BindView(R.id.tv_sim1) - var mTvSim1: TextView? = null - - @JvmField - @BindView(R.id.tv_sim2) - var mTvSim2: TextView? = null - - @JvmField - @BindView(R.id.btn_confirm) - var mBtnConfirm: Button? = null - private var mBottomSheetBehavior: BottomSheetBehavior<*>? = null - private var selectedSim = 0 - override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { - val dialog = super.onCreateDialog(savedInstanceState) as BottomSheetDialog - val view = View.inflate(context, R.layout.dialog_choose_sim_dialog, null) - dialog.setContentView(view) - mBottomSheetBehavior = BottomSheetBehavior.from(view.parent as View) - ButterKnife.bind(this, view) - return dialog - } - - override fun onStart() { - super.onStart() - mBottomSheetBehavior!!.state = BottomSheetBehavior.STATE_EXPANDED - } - - @OnClick(R.id.tv_sim1, R.id.tv_sim2) - fun onSimSelected(view: View) { - when (view.id) { - R.id.tv_sim1 -> { - selectedSim = 1 - mTvSim1!!.setCompoundDrawablesWithIntrinsicBounds( - null, - resources.getDrawable(R.drawable.sim_card_selected), null, null - ) - mTvSim2!!.setCompoundDrawablesWithIntrinsicBounds( - null, - resources.getDrawable(R.drawable.sim_card_unselected), null, null - ) - } - - R.id.tv_sim2 -> { - selectedSim = 2 - mTvSim2!!.setCompoundDrawablesWithIntrinsicBounds( - null, - resources.getDrawable(R.drawable.sim_card_selected), null, null - ) - mTvSim1!!.setCompoundDrawablesWithIntrinsicBounds( - null, - resources.getDrawable(R.drawable.sim_card_unselected), null, null - ) - } - } - } - - @OnClick(R.id.btn_confirm) - fun onConfirmClicked() { - dismiss() - if (activity is LinkBankAccountActivity - && (selectedSim == 1 || selectedSim == 2) - ) { - (activity as LinkBankAccountActivity?)!!.linkBankAccount(selectedSim) - } else { - Toast.makeText( - context, - getString(R.string.choose_a_sim), Toast.LENGTH_SHORT - ).show() - } - } -} \ No newline at end of file diff --git a/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/ChooseSimDialogSheet.kt b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/ChooseSimDialogSheet.kt new file mode 100644 index 000000000..f7a3f8014 --- /dev/null +++ b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/ChooseSimDialogSheet.kt @@ -0,0 +1,126 @@ +package org.mifos.mobilewallet.mifospay.bank.ui + +import androidx.compose.foundation.Image +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.shape.CircleShape +import androidx.compose.material.Button +import androidx.compose.material.Surface +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.painter.Painter +import androidx.compose.ui.layout.ContentScale +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import org.mifos.mobilewallet.mifospay.R +import org.mifos.mobilewallet.mifospay.designsystem.component.MifosBottomSheet +import org.mifos.mobilewallet.mifospay.theme.stylePrimaryBlueMedium24sp +import org.mifos.mobilewallet.mifospay.theme.stylePrimaryBlueSmall14sp + + +@Composable +fun ChooseSimDialogSheet( + onSimSelected: (Int) -> Unit +) { + MifosBottomSheet(content = { + ChooseSimDialogSheetContent(onSimSelected) + }, onDismiss = { + onSimSelected.invoke(0) + }) +} + +@Composable +fun ChooseSimDialogSheetContent(onSimSelected: (Int) -> Unit) { + var selectedSim by remember { mutableStateOf(0) } + + Column( + horizontalAlignment = Alignment.CenterHorizontally, + modifier = Modifier + .fillMaxSize() + .padding(8.dp) + ) { + Text( + text = stringResource(id = R.string.verify_mobile_number), + style = stylePrimaryBlueMedium24sp + ) + Spacer(modifier = Modifier.height(15.dp)) + Text( + text = stringResource(id = R.string.confirm_mobile_number_message), + style = stylePrimaryBlueSmall14sp + ) + Spacer(modifier = Modifier.height(16.dp)) + Text(text = stringResource(id = R.string.bank_account_mobile_verification_conditions)) + Spacer(modifier = Modifier.height(20.dp)) + Row( + modifier = Modifier.fillMaxWidth(), + horizontalArrangement = Arrangement.Center, + verticalAlignment = Alignment.CenterVertically + ) { + SimCard( + simNumber = 1, + isSelected = selectedSim == 1, + onSimSelected = { selectedSim = 1 }) + + Spacer(modifier = Modifier.width(24.dp)) + Text(text = stringResource(id = R.string.or)) + Spacer(modifier = Modifier.width(24.dp)) + SimCard( + simNumber = 2, + isSelected = selectedSim == 2, + onSimSelected = { selectedSim = 2 }) + } + Spacer(modifier = Modifier.height(24.dp)) + Text(text = stringResource(id = R.string.regular_charges_will_apply), color = Color.Black) + Spacer(modifier = Modifier.height(18.dp)) + Button( + onClick = { onSimSelected(selectedSim) }, + modifier = Modifier + .align(Alignment.CenterHorizontally) + .width(250.dp) + .clip(CircleShape) + ) { + Text(text = stringResource(id = R.string.confirm)) + } + } +} + +@Composable +fun SimCard( + simNumber: Int, isSelected: Boolean, onSimSelected: () -> Unit +) { + val drawable: Painter = + painterResource(id = if (isSelected) R.drawable.sim_card_selected else R.drawable.sim_card_unselected) + Image(painter = drawable, + contentDescription = "SIM Card $simNumber", + contentScale = ContentScale.Fit, + modifier = Modifier + .size(50.dp) + .clickable { onSimSelected() }) +} + +@Preview +@Composable +fun SimSelectionPreview() { + Surface(color = Color.White) { + ChooseSimDialogSheet(onSimSelected = {}) + } +} diff --git a/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/LinkBankAccountActivity.kt b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/LinkBankAccountActivity.kt index 048615985..6a288bf82 100644 --- a/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/LinkBankAccountActivity.kt +++ b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/LinkBankAccountActivity.kt @@ -3,225 +3,32 @@ package org.mifos.mobilewallet.mifospay.bank.ui import android.content.Intent import android.os.Bundle import android.os.Handler -import android.text.Editable -import android.text.TextWatcher -import android.view.View -import android.widget.EditText -import android.widget.TextView -import androidx.recyclerview.widget.DividerItemDecoration -import androidx.recyclerview.widget.GridLayoutManager -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView -import butterknife.BindView -import butterknife.ButterKnife -import dagger.hilt.android.AndroidEntryPoint -import org.json.JSONObject +import androidx.activity.compose.setContent +import androidx.appcompat.app.AppCompatActivity import com.mifos.mobilewallet.model.domain.BankAccountDetails -import org.mifos.mobilewallet.mifospay.R -import org.mifos.mobilewallet.mifospay.bank.BankContract -import org.mifos.mobilewallet.mifospay.bank.BankContract.LinkBankAccountView -import org.mifos.mobilewallet.mifospay.bank.adapters.OtherBankAdapter -import org.mifos.mobilewallet.mifospay.bank.adapters.PopularBankAdapter -import org.mifos.mobilewallet.mifospay.bank.presenter.LinkBankAccountPresenter -import org.mifos.mobilewallet.mifospay.base.BaseActivity -import org.mifos.mobilewallet.mifospay.domain.model.Bank +import dagger.hilt.android.AndroidEntryPoint import org.mifos.mobilewallet.mifospay.common.Constants -import org.mifos.mobilewallet.mifospay.utils.DebugUtil -import org.mifos.mobilewallet.mifospay.utils.FileUtils -import org.mifos.mobilewallet.mifospay.utils.RecyclerItemClickListener -import org.mifos.mobilewallet.mifospay.utils.RecyclerItemClickListener.SimpleOnItemClickListener -import org.mifos.mobilewallet.mifospay.utils.Utils.isBlank -import java.util.Locale -import javax.inject.Inject +import org.mifos.mobilewallet.mifospay.theme.MifosTheme @AndroidEntryPoint -class LinkBankAccountActivity : BaseActivity(), LinkBankAccountView { - @JvmField - @Inject - var mPresenter: LinkBankAccountPresenter? = null - var mLinkBankAccountPresenter: BankContract.LinkBankAccountPresenter? = null - - @JvmField - @BindView(R.id.et_search_bank) - var mEtSearchBank: EditText? = null - - @JvmField - @BindView(R.id.rv_popular_banks) - var mRvPopularBanks: RecyclerView? = null - - @JvmField - @BindView(R.id.rv_other_banks) - var mRvOtherBanks: RecyclerView? = null - - @JvmField - @BindView(R.id.popular_banks) - var mPopularBanks: TextView? = null - - @JvmField - @BindView(R.id.other_banks) - var mOtherBanks: TextView? = null - - @JvmField - @BindView(R.id.no_bank_found) - var mNoBankFound: TextView? = null - - @JvmField - @Inject - var mPopularBankAdapter: PopularBankAdapter? = null - - @JvmField - @Inject - var mOtherBankAdapter: OtherBankAdapter? = null - private var banksList: ArrayList? = null - private var popularBanks: ArrayList? = null - private var bankSelected: String? = null +class LinkBankAccountActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setContentView(R.layout.activity_link_bank_account) - ButterKnife.bind(this) - setToolbarTitle("Link Bank Account") - showColoredBackButton(R.drawable.ic_arrow_back_black_24dp) - mPresenter!!.attachView(this) - showProgressDialog(Constants.PLEASE_WAIT) - setupRecyclerview() - mRvOtherBanks!!.isNestedScrollingEnabled = false - setupAdapterData() - hideProgressDialog() - } - - private fun setupRecyclerview() { - val gridManager: LinearLayoutManager = GridLayoutManager(this, 3) - gridManager.orientation = GridLayoutManager.VERTICAL - mRvPopularBanks!!.layoutManager = gridManager - mRvPopularBanks!!.setHasFixedSize(true) - mPopularBankAdapter!!.setContext(this) - mRvPopularBanks!!.adapter = mPopularBankAdapter - val layoutManager = LinearLayoutManager(this) - layoutManager.orientation = LinearLayoutManager.VERTICAL - mRvOtherBanks!!.layoutManager = layoutManager - mRvOtherBanks!!.setHasFixedSize(true) - mOtherBankAdapter!!.setContext(this) - mRvOtherBanks!!.adapter = mOtherBankAdapter - mRvOtherBanks!!.addItemDecoration( - DividerItemDecoration( - this, - DividerItemDecoration.VERTICAL - ) - ) - mRvPopularBanks!!.addOnItemTouchListener( - RecyclerItemClickListener(this, - object : SimpleOnItemClickListener() { - override fun onItemClick(childView: View?, position: Int) { - val bank = mPopularBankAdapter!!.getBank(position) - bankSelected = bank.name - val chooseSimDialog = ChooseSimDialog() - chooseSimDialog.show(supportFragmentManager, "Choose Sim Dialog") - } - }) - ) - mRvOtherBanks!!.addOnItemTouchListener( - RecyclerItemClickListener(this, - object : SimpleOnItemClickListener() { - override fun onItemClick(childView: View?, position: Int) { - val bank = mOtherBankAdapter!!.getBank(position) - bankSelected = bank.name - val chooseSimDialog = ChooseSimDialog() - chooseSimDialog.show(supportFragmentManager, "Choose Sim Dialog") - } - }) - ) - mEtSearchBank!!.addTextChangedListener(object : TextWatcher { - override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {} - override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) { -// Log.d("qxz", "onTextChanged: " + s.toString()); -// mOtherBankAdapter.getFilter().filter(mEtSearchBank.getText().toString()); - filter(mEtSearchBank!!.text.toString().trim { it <= ' ' }) + setContent { + MifosTheme { + LinkBankAccountScreen(activity = this, onBackPress = {onBackPressed()}) } - - override fun afterTextChanged(s: Editable) {} - }) - } - - private fun filter(text: String) { - var filteredList: MutableList? = ArrayList() - if (text.isBlank()) { - mRvPopularBanks!!.visibility = View.VISIBLE - mPopularBanks!!.visibility = View.VISIBLE - filteredList = banksList - } else { - mRvPopularBanks!!.visibility = View.GONE - mPopularBanks!!.visibility = View.GONE - for (bank in banksList!!) { - if (bank.name.lowercase(Locale.getDefault()) - .contains(text.lowercase(Locale.getDefault())) - ) { - filteredList!!.add(bank) - } - } - } - mOtherBankAdapter!!.filterList(filteredList) - if (filteredList!!.isEmpty()) { - mNoBankFound!!.visibility = View.VISIBLE - mOtherBanks!!.visibility = View.GONE - } else { - mNoBankFound!!.visibility = View.GONE - mOtherBanks!!.visibility = View.GONE - } - } - - private fun setupAdapterData() { - val jsonObject: JSONObject - try { - jsonObject = FileUtils.readJson(this, "banks.json")!! - banksList = ArrayList() - for (i in 0 until jsonObject.getJSONArray("banks").length()) { - banksList!!.add( - Bank( - (jsonObject.getJSONArray("banks")[i] as String), - R.drawable.ic_bank, 1 - ) - ) - } - popularBanks = ArrayList() - popularBanks!!.add(Bank("RBL Bank", R.drawable.logo_rbl, 0)) - popularBanks!!.add(Bank("SBI Bank", R.drawable.logo_sbi, 0)) - popularBanks!!.add(Bank("PNB Bank", R.drawable.logo_pnb, 0)) - popularBanks!!.add(Bank("HDFC Bank", R.drawable.logo_hdfc, 0)) - popularBanks!!.add(Bank("ICICI Bank", R.drawable.logo_icici, 0)) - popularBanks!!.add(Bank("AXIS Bank", R.drawable.logo_axis, 0)) - DebugUtil.log(popularBanks!!, banksList!!) - mPopularBankAdapter!!.setData(popularBanks) - mOtherBankAdapter!!.setData(banksList) - } catch (e: Exception) { - e.message?.let { DebugUtil.log(it) } } } - fun linkBankAccount(selectedSim: Int) { - showProgressDialog(Constants.VERIFYING_MOBILE_NUMBER) - mLinkBankAccountPresenter!!.fetchBankAccountDetails(bankSelected) - } - - override fun addBankAccount(bankAccountDetails: BankAccountDetails?) { + fun addBankAccount(bankAccountDetails: BankAccountDetails?) { val handler = Handler() handler.postDelayed({ val intent = Intent() intent.putExtra(Constants.NEW_BANK_ACCOUNT, bankAccountDetails) setResult(RESULT_OK, intent) - hideProgressDialog() finish() }, 1500) } +} - override fun setPresenter(presenter: BankContract.LinkBankAccountPresenter?) { - mLinkBankAccountPresenter = presenter - } - - override fun onBackPressed() { - if (mEtSearchBank!!.text.length != 0) { - mEtSearchBank!!.text.clear() - } else { - super.onBackPressed() - } - } -} \ No newline at end of file diff --git a/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/LinkBankAccountScreen.kt b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/LinkBankAccountScreen.kt new file mode 100644 index 000000000..14270791c --- /dev/null +++ b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/ui/LinkBankAccountScreen.kt @@ -0,0 +1,347 @@ +package org.mifos.mobilewallet.mifospay.bank.ui + +import androidx.compose.foundation.Image +import androidx.compose.foundation.background +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.ExperimentalLayoutApi +import androidx.compose.foundation.layout.FlowColumn +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.lazy.grid.GridCells +import androidx.compose.foundation.lazy.grid.LazyVerticalGrid +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll +import androidx.compose.material.Divider +import androidx.compose.material.MaterialTheme +import androidx.compose.material.Text +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Search +import androidx.compose.material3.Icon +import androidx.compose.material3.Scaffold +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.shadow +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import androidx.hilt.navigation.compose.hiltViewModel +import androidx.lifecycle.compose.collectAsStateWithLifecycle +import org.mifos.mobilewallet.mifospay.R +import org.mifos.mobilewallet.mifospay.bank.presenter.BankUiState +import org.mifos.mobilewallet.mifospay.bank.presenter.LinkBankAccountViewModel +import org.mifos.mobilewallet.mifospay.designsystem.component.MfOverlayLoadingWheel +import org.mifos.mobilewallet.mifospay.designsystem.component.MifosOutlinedTextField +import org.mifos.mobilewallet.mifospay.designsystem.component.MifosTopBar +import org.mifos.mobilewallet.mifospay.designsystem.theme.greyBackgroundColor +import org.mifos.mobilewallet.mifospay.domain.model.Bank +import org.mifos.mobilewallet.mifospay.theme.MifosTheme + + +@Composable +fun LinkBankAccountScreen( + activity: LinkBankAccountActivity, + onBackPress: () -> Unit +) { + + val viewModel: LinkBankAccountViewModel = hiltViewModel() + var showSimBottomSheet by rememberSaveable { mutableStateOf(false) } + var bankSelected = "" + val bankUiState by viewModel.bankState.collectAsStateWithLifecycle() + val bankListUiState by viewModel.bankListUiState.collectAsStateWithLifecycle() + + Scaffold(topBar = { + MifosTopBar( + topBarTitle = R.string.link_bank_account, + backPress = onBackPress + ) + }) { + LinkBankAccountScreenContent( + padding = it, + bankUiState = bankUiState, + bankListUiState = bankListUiState, + updateSearchQuery = { search -> + viewModel.updateSearchQuery(search) + }, + onSelectBank = { bank -> + bankSelected = bank.name + showSimBottomSheet = true + } + ) + if (showSimBottomSheet) { + ChooseSimDialogSheet { selectedSim -> + if (selectedSim != 0) { + viewModel.fetchBankAccountDetails(bankName = bankSelected, activity = activity) + } + showSimBottomSheet = false + } + } + } +} + +@Composable +fun LinkBankAccountScreenContent( + padding: PaddingValues, + bankUiState: BankUiState, + bankListUiState: BankUiState, + updateSearchQuery: (String) -> Unit, + onSelectBank: (Bank) -> Unit +) { + + Box( + modifier = Modifier + .fillMaxSize() + .background(greyBackgroundColor) + ) { + when (bankUiState) { + BankUiState.Loading -> { + LoadingContent() + } + + is BankUiState.LoadedBankState -> { + LoadedContent( + popularBanks = (bankListUiState as BankUiState.LoadedBankState).popularBanks, + allBanks = (bankListUiState as BankUiState.LoadedBankState).allBanks, + updateSearchQuery, + onSelectBank + ) + } + } + } +} + +@Composable +fun LoadingContent() { + MfOverlayLoadingWheel( + contentDesc = stringResource(R.string.loading), + ) +} + +@Composable +fun LoadedContent( + popularBanks: List, + allBanks: List, + updateSearchQuery: (String) -> Unit, + onSelectBank: (Bank) -> Unit +) { + val search = rememberSaveable { mutableStateOf("") } + Column( + modifier = Modifier + .fillMaxSize() + .padding(top = 55.dp) + .verticalScroll(rememberScrollState()) + ) { + Box( + modifier = Modifier + .fillMaxWidth() + .background(Color.White) + ) { + MifosOutlinedTextField(modifier = Modifier + .fillMaxWidth() + .padding(8.dp), + value = search.value, + onValueChange = { + search.value = it + updateSearchQuery(it) + }, + label = R.string.search, + trailingIcon = { + Icon( + imageVector = Icons.Filled.Search, contentDescription = null + ) + }) + } + if (search.value.isBlank()) + Column { + Spacer(modifier = Modifier.height(20.dp)) + Text( + text = "Popular Banks", + style = TextStyle(Color.Black, fontWeight = FontWeight.Medium), + modifier = Modifier.padding(start = 10.dp) + ) + Spacer(modifier = Modifier.height(20.dp)) + BankGrid(banks = popularBanks, onSelectBank) + } + + if (allBanks.isNotEmpty()) + Column { + if (search.value.isBlank()) { + Spacer(modifier = Modifier.height(20.dp)) + Text( + text = "Other Banks", + style = TextStyle(Color.Black, fontWeight = FontWeight.Medium), + modifier = Modifier.padding(start = 10.dp) + ) + Spacer(modifier = Modifier.height(20.dp)) + } + BankList( + otherBanks = allBanks, + onSelectBank + ) + } + else + Box( + modifier = Modifier + .fillMaxWidth() + .padding(top = 15.dp), + contentAlignment = Alignment.Center + ) { + Text( + text = stringResource(id = R.string.no_bank_account), + style = MaterialTheme.typography.subtitle1 + ) + } + } +} + +@Composable +fun BankGrid(banks: List, onSelectBank: (Bank) -> Unit) { + Box( + modifier = Modifier + .fillMaxWidth() + .height(200.dp) + .background(Color.White) + .shadow(elevation = 2.dp) + ) { + LazyVerticalGrid(columns = GridCells.Fixed(3)) { + items(banks.size) { index -> + BankGridItem(bank = banks[index], onSelectBank) + } + } + } +} + +@Composable +fun BankGridItem(bank: Bank, onSelectBank: (Bank) -> Unit) { + Column( + horizontalAlignment = Alignment.CenterHorizontally, + modifier = Modifier + .padding(8.dp) + .height(80.dp) + .clickable { + onSelectBank(bank) + } + ) { + Image( + painter = painterResource(id = bank.image), + contentDescription = bank.name, + modifier = Modifier.weight(1f) + ) + Text( + text = bank.name, + style = MaterialTheme.typography.body1, + modifier = Modifier.padding(top = 4.dp) + ) + } +} + +@OptIn(ExperimentalLayoutApi::class) +@Composable +fun BankList(otherBanks: List, onSelectBank: (Bank) -> Unit) { + Box( + modifier = Modifier + .background(Color.White) + ) { + FlowColumn( + ) { + otherBanks.forEachIndexed { index, bank -> + BankListItem(bank = bank, onSelectBank) + Divider(modifier = Modifier.padding(horizontal = 16.dp)) + } + } + } +} + +@Composable +fun BankListItem(bank: Bank, onSelectBank: (Bank) -> Unit) { + Row( + horizontalArrangement = Arrangement.Start, + verticalAlignment = Alignment.CenterVertically, + modifier = Modifier + .padding(vertical = 8.dp, horizontal = 10.dp) + .fillMaxWidth() + .clickable { + onSelectBank(bank) + } + ) { + Image( + painter = painterResource(id = bank.image), + contentDescription = bank.name, + modifier = Modifier.size(30.dp) + ) + Spacer(modifier = Modifier.width(16.dp)) + Text(text = bank.name, style = TextStyle(fontSize = 14.sp)) + } +} + +@Preview(showSystemUi = true, device = "id:pixel_5") +@Composable +private fun LinkBankAccountScreenPreview() { + MifosTheme { + LinkBankAccountScreen(LinkBankAccountActivity()) {} + } +} + +@Preview +@Composable +private fun BankGridItemPreview() { + BankGridItem(bank = Bank("RBL Bank", R.drawable.logo_rbl, 0), onSelectBank = {}) +} + +@Preview +@Composable +private fun BankListItemPreview() { + BankListItem(bank = Bank("RBL Bank", R.drawable.ic_bank, 0), onSelectBank = {}) +} + +@Preview(showSystemUi = true, device = "id:pixel_5") +@Composable +private fun LoadingContentPreview() { + LoadingContent() +} + +@Preview(showSystemUi = true, device = "id:pixel_5") +@Composable +private fun LoadedContentPreview() { + + val popularBanks = ArrayList() + popularBanks.add(Bank("RBL Bank", R.drawable.logo_rbl, 0)) + popularBanks.add(Bank("SBI Bank", R.drawable.logo_sbi, 0)) + popularBanks.add(Bank("PNB Bank", R.drawable.logo_pnb, 0)) + popularBanks.add(Bank("HDFC Bank", R.drawable.logo_hdfc, 0)) + popularBanks.add(Bank("ICICI Bank", R.drawable.logo_icici, 0)) + popularBanks.add(Bank("AXIS Bank", R.drawable.logo_axis, 0)) + + val allBanks = ArrayList() + allBanks.add(Bank("HDFC Bank", R.drawable.ic_bank, 0)) + allBanks.add(Bank("ICICI Bank", R.drawable.ic_bank, 0)) + allBanks.add(Bank("AXIS Bank", R.drawable.ic_bank, 0)) + LoadedContent( + popularBanks = popularBanks, + allBanks = allBanks, + updateSearchQuery = {}, + onSelectBank = {}, + ) +} + + + diff --git a/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/theme/MifosTextStyle.kt b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/theme/MifosTextStyle.kt index 67b973e85..471ffcb21 100644 --- a/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/theme/MifosTextStyle.kt +++ b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/theme/MifosTextStyle.kt @@ -3,7 +3,9 @@ package org.mifos.mobilewallet.mifospay.theme import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.sp +import org.mifos.mobilewallet.mifospay.designsystem.theme.primaryDarkBlue val styleMedium16sp = TextStyle( fontSize = 16.sp, @@ -25,3 +27,18 @@ val styleMedium30sp = TextStyle( fontWeight = FontWeight.Medium, color = black, ) + +val stylePrimaryBlueMedium24sp = TextStyle( + fontSize = 24.sp, + fontFamily = FontFamily.SansSerif, + fontWeight = FontWeight.Medium, + color = primaryDarkBlue, +) + +val stylePrimaryBlueSmall14sp = TextStyle( + fontSize = 14.sp, + fontWeight = FontWeight.Normal, + textAlign = TextAlign.Center, + color = primaryDarkBlue, +) + diff --git a/mifospay/src/main/res/layout/dialog_choose_sim_dialog.xml b/mifospay/src/main/res/layout/dialog_choose_sim_dialog.xml deleted file mode 100644 index 640266b66..000000000 --- a/mifospay/src/main/res/layout/dialog_choose_sim_dialog.xml +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - -