-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
45 changed files
with
3,340 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
RxDemo/src/main/java/com/tamsiree/rxdemo/activity/ActivityDemoData.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.tamsiree.rxdemo.activity | ||
|
||
import android.os.Bundle | ||
import com.tamsiree.rxdemo.R | ||
import com.tamsiree.rxdemo.fragment.FragmentDemoDataBankCard | ||
import com.tamsiree.rxdemo.fragment.FragmentDemoDataPersonInfo | ||
import com.tamsiree.rxui.activity.ActivityBase | ||
import com.tamsiree.rxui.adapter.AdapterFVP | ||
import com.tamsiree.rxui.model.ModelFVP | ||
import kotlinx.android.synthetic.main.activity_demo_data.* | ||
import java.util.* | ||
|
||
class ActivityDemoData : ActivityBase() { | ||
|
||
private val modelFVPList: MutableList<ModelFVP> = ArrayList() | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_demo_data) | ||
} | ||
|
||
override fun initView() { | ||
rxTitle.setLeftFinish(mContext) | ||
|
||
if (modelFVPList.isEmpty()) { | ||
modelFVPList.add(ModelFVP("银行卡", FragmentDemoDataBankCard.newInstance())) | ||
modelFVPList.add(ModelFVP("个人信息", FragmentDemoDataPersonInfo.newInstance())) | ||
} | ||
|
||
viewPager.adapter = AdapterFVP(supportFragmentManager, modelFVPList) | ||
tabLayout.setViewPager(viewPager) | ||
|
||
} | ||
|
||
override fun initData() { | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
135 changes: 135 additions & 0 deletions
135
RxDemo/src/main/java/com/tamsiree/rxdemo/fragment/FragmentDemoDataBankCard.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
package com.tamsiree.rxdemo.fragment | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import com.tamsiree.rxdemo.R | ||
import com.tamsiree.rxkit.RxDataTool | ||
import com.tamsiree.rxkit.demodata.bank.BankCardNumberGenerator | ||
import com.tamsiree.rxkit.demodata.bank.BankCardNumberValidator | ||
import com.tamsiree.rxkit.demodata.bank.BankCardTypeEnum | ||
import com.tamsiree.rxkit.demodata.bank.BankNameEnum | ||
import com.tamsiree.rxkit.view.RxToast | ||
import com.tamsiree.rxui.fragment.FragmentLazy | ||
import kotlinx.android.synthetic.main.fragment_demo_data_bank_card.* | ||
|
||
class FragmentDemoDataBankCard : FragmentLazy() { | ||
|
||
override fun inflateView(layoutInflater: LayoutInflater, viewGroup: ViewGroup?, savedInstanceState: Bundle?): View { | ||
val view = layoutInflater.inflate(R.layout.fragment_demo_data_bank_card, viewGroup, false) | ||
return view | ||
} | ||
|
||
override fun initView() { | ||
|
||
} | ||
|
||
override fun initData() { | ||
checkboxFormatCard.setOnCheckedChangeListener { buttonView, isChecked -> | ||
val value0 = tvBankCardNumber0.text.toString() | ||
val value = tvBankCardNumber.text.toString() | ||
val value1 = tvBankCardNumberICBC.text.toString() | ||
val value2 = tvBankCardNumberICBC1.text.toString() | ||
val value3 = tvBankCardNumber1.text.toString() | ||
if (isChecked) { | ||
if (!RxDataTool.isContainSpace(value)) { | ||
tvBankCardNumber.text = RxDataTool.formatCard(value) | ||
} | ||
if (!RxDataTool.isContainSpace(value)) { | ||
tvBankCardNumber0.text = RxDataTool.formatCard(value0) | ||
} | ||
if (!RxDataTool.isContainSpace(value1)) { | ||
tvBankCardNumberICBC.text = RxDataTool.formatCard(value1) | ||
} | ||
if (!RxDataTool.isContainSpace(value2)) { | ||
tvBankCardNumberICBC1.text = RxDataTool.formatCard(value2) | ||
} | ||
if (!RxDataTool.isContainSpace(value3)) { | ||
tvBankCardNumber1.text = RxDataTool.formatCard(value3) | ||
} | ||
} else { | ||
tvBankCardNumber0.text = RxDataTool.cleanSpace(value0) | ||
tvBankCardNumber.text = RxDataTool.cleanSpace(value) | ||
tvBankCardNumberICBC.text = RxDataTool.cleanSpace(value1) | ||
tvBankCardNumberICBC1.text = RxDataTool.cleanSpace(value2) | ||
tvBankCardNumber1.text = RxDataTool.cleanSpace(value3) | ||
} | ||
} | ||
|
||
btnBankCardNumber0.setOnClickListener { | ||
//银行 | ||
val bankCardNo: String = BankCardNumberGenerator.instance.generate() | ||
if (checkboxFormatCard.isChecked) { | ||
tvBankCardNumber0.text = RxDataTool.formatCard(bankCardNo) | ||
} else { | ||
tvBankCardNumber0.text = bankCardNo | ||
} | ||
} | ||
|
||
btnBankCardNumber.setOnClickListener { | ||
//华润银行 | ||
val bankCardNo: String = BankCardNumberGenerator.generate(BankNameEnum.CR, null) | ||
if (checkboxFormatCard.isChecked) { | ||
tvBankCardNumber.text = RxDataTool.formatCard(bankCardNo) | ||
} else { | ||
tvBankCardNumber.text = bankCardNo | ||
} | ||
} | ||
|
||
|
||
|
||
btnBankCardNumberICBC.setOnClickListener { | ||
//中国工商银行 信用卡/贷记卡 | ||
val bankCardNo: String = BankCardNumberGenerator.generate(BankNameEnum.ICBC, BankCardTypeEnum.CREDIT) | ||
if (checkboxFormatCard.isChecked) { | ||
tvBankCardNumberICBC.text = RxDataTool.formatCard(bankCardNo) | ||
} else { | ||
tvBankCardNumberICBC.text = bankCardNo | ||
} | ||
} | ||
|
||
btnBankCardNumberICBC1.setOnClickListener { | ||
//中国工商银行 借记卡/储蓄卡 | ||
val bankCardNo: String = BankCardNumberGenerator.generate(BankNameEnum.ICBC, BankCardTypeEnum.DEBIT) | ||
if (checkboxFormatCard.isChecked) { | ||
tvBankCardNumberICBC1.text = RxDataTool.formatCard(bankCardNo) | ||
} else { | ||
tvBankCardNumberICBC1.text = bankCardNo | ||
} | ||
} | ||
|
||
btnBankCardNumber1.setOnClickListener { | ||
val prefix = edBankCardNumber1.text.toString() | ||
if (edBankCardNumber1.text.length == 6 && RxDataTool.isInteger(edBankCardNumber1.text.toString())) { | ||
//根据给定前六位生成卡号 | ||
val bankCardNo: String = BankCardNumberGenerator.generateByPrefix(prefix.toInt()) | ||
if (checkboxFormatCard.isChecked) { | ||
tvBankCardNumber1.text = RxDataTool.formatCard(bankCardNo) | ||
} else { | ||
tvBankCardNumber1.text = bankCardNo | ||
} | ||
} else { | ||
RxToast.error("银行卡前缀格式输入有误") | ||
} | ||
} | ||
|
||
btnBankCardNumberV.setOnClickListener { | ||
val value = edBankCardNumberV.text.toString() | ||
|
||
if (BankCardNumberValidator.validate(value)) { | ||
tvBankCardNumberV.text = "合法" | ||
} else { | ||
tvBankCardNumberV.text = "不合法" | ||
} | ||
} | ||
} | ||
|
||
companion object { | ||
fun newInstance(): FragmentDemoDataBankCard { | ||
return FragmentDemoDataBankCard() | ||
} | ||
} | ||
|
||
|
||
} |
97 changes: 97 additions & 0 deletions
97
RxDemo/src/main/java/com/tamsiree/rxdemo/fragment/FragmentDemoDataPersonInfo.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
package com.tamsiree.rxdemo.fragment | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import com.tamsiree.rxdemo.R | ||
import com.tamsiree.rxkit.demodata.* | ||
import com.tamsiree.rxui.fragment.FragmentLazy | ||
import com.tamsiree.rxui.model.ModelFVP | ||
import kotlinx.android.synthetic.main.fragment_demo_data_person_info.* | ||
import java.util.* | ||
|
||
class FragmentDemoDataPersonInfo : FragmentLazy() { | ||
|
||
private val modelFVPList: MutableList<ModelFVP> = ArrayList() | ||
|
||
override fun inflateView(layoutInflater: LayoutInflater, viewGroup: ViewGroup?, savedInstanceState: Bundle?): View { | ||
val view = layoutInflater.inflate(R.layout.fragment_demo_data_person_info, viewGroup, false) | ||
return view | ||
} | ||
|
||
override fun initView() { | ||
btnName.setOnClickListener { | ||
//生成常见姓名 | ||
val name: String = ChineseNameGenerator.instance.generate() | ||
tvName.text = name | ||
} | ||
|
||
btnName1.setOnClickListener { | ||
//生成带有生僻名字部分的姓名 | ||
val name: String = ChineseNameGenerator.instance.generateOdd() | ||
tvName1.text = name | ||
} | ||
btnEnglishName.setOnClickListener { | ||
//生成英文名 | ||
val name: String = EnglishNameGenerator.instance.generate() | ||
tvEnglishName.text = name | ||
} | ||
|
||
btnAddress.setOnClickListener { | ||
//生成地址 | ||
val address: String = ChineseAddressGenerator.instance.generate() | ||
tvAddress.text = address | ||
} | ||
|
||
btnIDOffice.setOnClickListener { | ||
//生成签发机关 | ||
val idOffice: String = ChineseIDCardNumberGenerator.generateIssueOrg() | ||
tvIDOffice.text = idOffice | ||
} | ||
btnIDDate.setOnClickListener { | ||
//生成有效期限 | ||
val idOffice: String = ChineseIDCardNumberGenerator.generateValidPeriod() | ||
tvIDDate.text = idOffice | ||
} | ||
|
||
btnID1.setOnClickListener { | ||
//生成身份证 | ||
val id: String = ChineseIDCardNumberGenerator.instance.generate() | ||
tvID.text = id | ||
|
||
if (id[id.length - 2].toInt() % 2 == 0) { | ||
tvGender.text = "女" | ||
} else { | ||
tvGender.text = "男" | ||
} | ||
} | ||
|
||
btnMobile.setOnClickListener { | ||
//生成手机号码 | ||
val mobile: String = ChineseMobileNumberGenerator.instance.generate() | ||
tvMobile.text = mobile | ||
} | ||
|
||
btnMobileFake.setOnClickListener { | ||
//生成虚假手机号码 | ||
val mobile: String = ChineseMobileNumberGenerator.instance.generateFake() | ||
tvMobileFake.text = mobile | ||
} | ||
btnEmail.setOnClickListener { | ||
//生成虚假手机号码 | ||
val email: String = EmailAddressGenerator.instance.generate() | ||
tvEmail.text = email | ||
} | ||
} | ||
|
||
override fun initData() { | ||
|
||
} | ||
|
||
companion object { | ||
fun newInstance(): FragmentDemoDataPersonInfo { | ||
return FragmentDemoDataPersonInfo() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.