package com.kx.bottomdialogzhifubaowechat;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
private ImageView mIvWeichatSelect;
private ImageView mIvAliSelect;
private static final int PAY_TYPE_WECHAT = 0; //微信支付,默认支付方式
private static final int PAY_TYPE_ALIBABA = 1; //支付宝支付
private int payType = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewById(R.id.bt).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
pay();
}
});
}
private void pay() {
View dialogView = getLayoutInflater().inflate(R.layout.dialog_pay_type, null);
//微信支付的选择
mIvWeichatSelect = dialogView.findViewById(R.id.iv_buy_weichat_select);
//支付宝的选择
mIvAliSelect = dialogView.findViewById(R.id.iv_buy_alipay_select);
PayBottomDialog dialog = new PayBottomDialog(MainActivity.this, dialogView, new int[]{R.id.ll_pay_weichat, R.id.ll_pay_ali, R.id.tv_confirm, R.id.tv_cancel});
dialog.bottmShow();
dialog.setOnBottomItemClickListener(new PayBottomDialog.OnBottomItemClickListener() {
@Override
public void onBottomItemClick(PayBottomDialog dialog, View view) {
switch (view.getId()) {
case R.id.ll_pay_weichat: //微信支付
showToast("微信支付");
if (PAY_TYPE_WECHAT != payType) {
mIvWeichatSelect.setImageDrawable(getResources().getDrawable(R.mipmap.paytype_select));
mIvAliSelect.setImageDrawable(getResources().getDrawable(R.mipmap.paytype_unselect));
payType = PAY_TYPE_WECHAT;
}
break;
case R.id.ll_pay_ali: //支付宝支付
showToast("支付宝支付");
if (PAY_TYPE_ALIBABA != payType) {
mIvWeichatSelect.setImageDrawable(getResources().getDrawable(R.mipmap.paytype_unselect));
mIvAliSelect.setImageDrawable(getResources().getDrawable(R.mipmap.paytype_select));
payType = PAY_TYPE_ALIBABA;
}
break;
case R.id.tv_confirm: //确认支付
//TODO 支付
showToast("确认支付");
//重置
payType = PAY_TYPE_WECHAT;
dialog.cancel();
break;
case R.id.tv_cancel: //取消支付
showToast("取消支付");
//重置
payType = PAY_TYPE_WECHAT;
dialog.cancel();
break;
}
}
});
}
private void showToast(String s){
Toast.makeText(this, s, Toast.LENGTH_SHORT).show();
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
BottomDialogzhifubaoWechat.zip (94个子文件)
BottomDialogzhifubaoWechat
gradlew 5KB
settings.gradle 16B
.idea
libraries
com_android_support_support_annotations_27_1_1_jar.xml 607B
com_android_support_support_fragment_26_1_0.xml 699B
com_android_support_constraint_constraint_layout_solver_1_1_3_jar.xml 424B
org_hamcrest_hamcrest_integration_1_3_jar.xml 576B
com_android_support_constraint_constraint_layout_1_1_3.xml 499B
android_arch_lifecycle_runtime_1_0_0.xml 655B
com_android_support_test_monitor_1_0_2.xml 659B
com_android_support_test_espresso_espresso_idling_resource_3_0_2.xml 762B
com_google_code_findbugs_jsr305_2_0_1_jar.xml 358B
com_android_support_support_compat_26_1_0.xml 689B
com_squareup_javawriter_2_1_1_jar.xml 536B
android_arch_core_common_1_0_0_jar.xml 531B
com_android_support_animated_vector_drawable_26_1_0.xml 739B
com_android_support_test_runner_1_0_2.xml 654B
com_android_support_support_vector_drawable_26_1_0.xml 734B
javax_inject_javax_inject_1_jar.xml 526B
org_hamcrest_hamcrest_core_1_3_jar.xml 541B
android_arch_lifecycle_common_1_0_0_jar.xml 546B
com_android_support_support_media_compat_26_1_0.xml 719B
com_android_support_support_annotations_26_1_0_jar.xml 606B
org_hamcrest_hamcrest_library_1_3_jar.xml 555B
com_android_support_support_core_utils_26_1_0.xml 709B
com_android_support_appcompat_v7_26_1_0.xml 679B
net_sf_kxml_kxml2_2_3_0_jar.xml 285B
com_android_support_test_espresso_espresso_core_3_0_2.xml 707B
com_android_support_support_core_ui_26_1_0.xml 694B
junit_junit_4_12_jar.xml 485B
com_android_support_support_v4_26_1_0.xml 669B
runConfigurations.xml 564B
misc.xml 2KB
workspace.xml 173KB
gradle.xml 626B
encodings.xml 200B
modules.xml 389B
gradle
wrapper
gradle-wrapper.properties 236B
gradle-wrapper.jar 52KB
.gradle
buildOutputCleanup
cache.properties.lock 2B
cache.properties 51B
built.bin 0B
4.1
fileChanges
last-build.bin 1B
taskHistory
taskHistory.lock 17B
fileSnapshots.bin 2.14MB
taskHistory.bin 66KB
javaCompile
javaCompile.lock 17B
classAnalysis.bin 781KB
jarAnalysis.bin 318KB
taskJars.bin 20KB
taskHistory.bin 151KB
fileContent
fileContent.lock 17B
fileHashes
fileHashes.bin 227KB
resourceHashesCache.bin 19KB
fileHashes.lock 17B
local.properties 460B
gradlew.bat 2KB
gradle.properties 747B
.gitignore 127B
app
src
androidTest
java
com
kx
bottomdialogzhifubaowechat
ExampleInstrumentedTest.java 793B
test
java
com
kx
bottomdialogzhifubaowechat
ExampleUnitTest.java 427B
main
AndroidManifest.xml 751B
res
mipmap-hdpi
ic_launcher.png 3KB
ic_launcher_round.png 5KB
mipmap-xxxhdpi
ic_launcher.png 9KB
ic_launcher_round.png 15KB
mipmap-xhdpi
ic_launcher.png 4KB
ali_pay_icon.png 7KB
ic_launcher_round.png 7KB
paytype_select.png 7KB
paytype_unselect.png 6KB
wechat_pay_icon.png 8KB
mipmap-anydpi-v26
ic_launcher.xml 274B
ic_launcher_round.xml 274B
mipmap-mdpi
ic_launcher.png 2KB
ic_launcher_round.png 3KB
drawable
ic_launcher_background.xml 6KB
layout
dialog_pay_type.xml 8KB
activity_main.xml 669B
anim
dialog_bottom_exit.xml 245B
dialog_bottom_enter.xml 247B
drawable-v24
ic_launcher_foreground.xml 2KB
values
colors.xml 2KB
strings.xml 92B
styles.xml 1KB
mipmap-xxhdpi
ic_launcher.png 6KB
ic_launcher_round.png 10KB
java
com
kx
bottomdialogzhifubaowechat
PayBottomDialog.java 2KB
MainActivity.java 3KB
libs
app.iml 12KB
.gitignore 8B
build.gradle 966B
proguard-rules.pro 772B
BottomDialogzhifubaoWechat.iml 880B
build.gradle 573B
共 94 条
- 1
资源评论
KX興
- 粉丝: 2425
- 资源: 18
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 上市公司-股票性质数据-工具变量(民企、国企、央企)2003-2022年.dta
- 上市公司-股票性质数据-工具变量(民企、国企、央企)2003-2022年.xlsx
- Reeds+Shepp曲线算法讲解和实现.pdf
- 毕业设计基于SpringBoot+MyBatisPlus+MySQL+Vue的外卖配送信息系统源代码+数据库
- 词向量(Word Embeddings)是自然语言处理(NLP)领域的一种重要技术.txt
- Surfer,线性函数
- MyBatis 的动态 SQL 是其核心特性之一.txt
- 时代的sdddsddsddsd
- 基于哈希链表的简单人员信息管理系统
- 其他类别JdonFramework开源框架 v5.1 Build20071025-jdonframework-5.1.rar
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功