diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3b55dd7c9..6e0f99caa 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -621,10 +621,7 @@ android:name=".audio.AudioRecordActivity" android:label="录音" android:screenOrientation="portrait" /> - + - - @@ -706,9 +696,6 @@ - - - - diff --git a/app/src/main/java/com/yizhuan/erban/MainActivity.java b/app/src/main/java/com/yizhuan/erban/MainActivity.java index 55b6a620e..953fd6527 100644 --- a/app/src/main/java/com/yizhuan/erban/MainActivity.java +++ b/app/src/main/java/com/yizhuan/erban/MainActivity.java @@ -105,7 +105,6 @@ import com.yizhuan.erban.ui.widget.LevelUpDialog; import com.yizhuan.erban.ui.widget.LivingIconView; import com.yizhuan.erban.ui.widget.MainTabLayout; import com.yizhuan.erban.ui.widget.RecallDialog; -import com.yizhuan.erban.ui.widget.RedPacketDialog; import com.yizhuan.erban.utils.CleanLeakUtils; import com.yizhuan.erban.utils.PushMessageHandler; import com.yizhuan.xchat_android_core.Constants; @@ -708,14 +707,6 @@ public class MainActivity extends BaseMvpActivity mMainTabLayout.setMsgNum(unreadCount); } - @Subscribe(threadMode = ThreadMode.MAIN) - public void onReceiveNewPacket(final RedPacketInfoV2 redPacketInfo) { - CommonPref.instance(this).putBoolean("redPacketPoint", true); - if (redPacketInfo.isNeedAlert()) { - RedPacketDialog.start(this, redPacketInfo); - } - } - @Subscribe(threadMode = ThreadMode.MAIN) public void onReceiveLevelUpActivity(LevelUpEvent event) { LevelUpDialog.start(this, event.getLevelName(), true); diff --git a/app/src/main/java/com/yizhuan/erban/UIHelper.java b/app/src/main/java/com/yizhuan/erban/UIHelper.java index a686c628a..8937b7a73 100644 --- a/app/src/main/java/com/yizhuan/erban/UIHelper.java +++ b/app/src/main/java/com/yizhuan/erban/UIHelper.java @@ -6,6 +6,7 @@ import android.content.Context; import android.content.Intent; import android.net.Uri; import android.provider.Settings; + import androidx.fragment.app.Fragment; import com.yizhuan.erban.audio.AudioRecordActivity; @@ -17,7 +18,6 @@ import com.yizhuan.erban.ui.setting.SettingActivity; import com.yizhuan.erban.ui.user.UserInfoActivity; import com.yizhuan.erban.ui.user.UserInfoModifyActivity; import com.yizhuan.erban.ui.user.UserModifyPhotosActivity; -import com.yizhuan.erban.ui.wallet.JewelActivity; import com.yizhuan.erban.ui.webview.CommonWebViewActivity; import com.yizhuan.xchat_android_core.UriProvider; import com.yizhuan.xchat_android_core.statistic.StatisticManager; @@ -92,13 +92,6 @@ public class UIHelper { mActivity.startActivityForResult(intent, requestCode); } - //我的钱包 - public static void showWalletAct(Context mContext) { - Intent intent = new Intent(mContext, JewelActivity.class); - //intent.putExtra("userInfo",userInfo); - mContext.startActivity(intent); - } - //侧边栏===>帮助 public static void showUsinghelp(Context mContext) { CommonWebViewActivity.start(mContext, UriProvider.getHelp()); diff --git a/app/src/main/java/com/yizhuan/erban/avroom/redpackage/RedPackageSendDialog.kt b/app/src/main/java/com/yizhuan/erban/avroom/redpackage/RedPackageSendDialog.kt index 436a57c46..cef98893a 100644 --- a/app/src/main/java/com/yizhuan/erban/avroom/redpackage/RedPackageSendDialog.kt +++ b/app/src/main/java/com/yizhuan/erban/avroom/redpackage/RedPackageSendDialog.kt @@ -2,20 +2,19 @@ package com.yizhuan.erban.avroom.redpackage import android.annotation.SuppressLint -import android.content.Intent import android.graphics.Paint import android.text.Editable import android.text.TextWatcher import android.view.KeyEvent -import android.view.LayoutInflater import android.view.View import android.view.WindowManager import com.jungly.gridpasswordview.GridPasswordView +import com.yizhuan.erban.R import com.yizhuan.erban.base.BaseDialog import com.yizhuan.erban.common.widget.dialog.DialogManager import com.yizhuan.erban.databinding.DialogRedPackageSendBinding import com.yizhuan.erban.pay.password.GiveGoldPassWordFragment -import com.yizhuan.erban.ui.login.BinderPhoneActivity +import com.yizhuan.erban.ui.login.BindPhoneActivity import com.yizhuan.erban.ui.pay.ChargeActivity import com.yizhuan.erban.ui.setting.ModifyPwdActivity import com.yizhuan.erban.ui.webview.DialogWebViewActivity @@ -31,6 +30,7 @@ import com.yizhuan.xchat_android_core.statistic.StatisticManager import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol import com.yizhuan.xchat_android_core.user.UserModel import com.yizhuan.xchat_android_core.utils.toIntOrDef +import com.yizhuan.xchat_android_library.annatation.ActLayoutRes import com.yizhuan.xchat_android_library.utils.CommonUtils import com.yizhuan.xchat_android_library.utils.SingleToastUtil import com.yizhuan.xchat_android_library.utils.codec.DESUtils @@ -38,6 +38,7 @@ import org.greenrobot.eventbus.EventBus import org.greenrobot.eventbus.Subscribe import org.greenrobot.eventbus.ThreadMode +@ActLayoutRes(R.layout.dialog_red_package_send) class RedPackageSendDialog : BaseDialog(), GridPasswordView.OnPasswordChangedListener, TextWatcher { private var passWordFragment: GiveGoldPassWordFragment? = null @@ -126,7 +127,7 @@ class RedPackageSendDialog : BaseDialog(), GridPass binding.ivSend.setOnClickListener { UserModel.get().cacheLoginUserInfo?.let { if (!it.isBindPhone) { - startActivity(Intent(context, BinderPhoneActivity::class.java)) + BindPhoneActivity.start(context) return@setOnClickListener } else if (!it.isBindPaymentPwd) { ModifyPwdActivity.start(context, ModifyPwdActivity.PAY_PWD) diff --git a/app/src/main/java/com/yizhuan/erban/home/fragment/MeFragment.java b/app/src/main/java/com/yizhuan/erban/home/fragment/MeFragment.java index 73c59628f..e54af59b6 100644 --- a/app/src/main/java/com/yizhuan/erban/home/fragment/MeFragment.java +++ b/app/src/main/java/com/yizhuan/erban/home/fragment/MeFragment.java @@ -296,11 +296,6 @@ public class MeFragment extends BaseMvpFragment 0 - && etSmsCode.getText() != null && etSmsCode.getText().length() > 0) { - btnBinderRquest.setEnabled(true); - } else { - btnBinderRquest.setEnabled(false); - } - } - }; - - etAlipayAccount.addTextChangedListener(textWatcher); - etSmsCode.addTextChangedListener(textWatcher); - - tvSkip.setOnClickListener(this); - } - - private void bindPhone() { - getDialogManager().showProgressDialog(BinderPhoneActivity.this, "正在绑定请稍后..."); - AuthModel.get().bindPhone( - etAlipayAccount.getText().toString(), - etSmsCode.getText().toString() - ) - .compose(bindUntilEvent(ActivityEvent.DESTROY)) - .subscribe(new SingleObserver() { - @Override - public void onSubscribe(Disposable d) { - - } - - @Override - public void onSuccess(UserInfo s) { - getDialogManager().dismissDialog(); - toast("绑定手机号成功"); - finish(); - } - - @Override - public void onError(Throwable e) { - getDialogManager().dismissDialog(); - toast(e.getMessage()); - } - }); - - } - - private void getCode() { - String phoneNumber = etAlipayAccount.getText().toString().trim(); - Number parse = null; - try { - parse = NumberFormat.getIntegerInstance().parse(phoneNumber); - } catch (Exception e) { - Log.e("bind phone", e.getMessage(), e); - } - if (parse == null || parse.intValue() == 0 || phoneNumber.length() != 11) { -// Toast.makeText(BasicConfig.INSTANCE.getAppContext(), "请输入正确的手机号码", Toast.LENGTH_SHORT).show(); - SingleToastUtil.showToastShort("请输入正确的手机号码"); - return; - } - startCountDownTimer(); - - CodeModel.get().sendCode(phoneNumber, CodeType.BIND_PHONE) - .compose(bindToLifecycle()) - .subscribe(new SingleObserver() { - @Override - public void onSubscribe(Disposable d) { - - } - - @Override - public void onSuccess(String s) { - toast(s); - } - - @Override - public void onError(Throwable e) { - toast(e.getMessage()); - } - }); - - } - - @Override - public void onClick(View v) { - - switch (v.getId()) { - case R.id.btn_get_code: - getCode(); - break; - - case R.id.btn_binder_request: - bindPhone(); - break; - case R.id.tv_skip: - StatisticManager.Instance().onEvent(StatisticsProtocol.Event.LOGIN_BINDING_PHONE_SKIP, "绑定手机-跳过"); - finish(); - break; - default: - break; - } - - } - - @Override - public void close() { - setResult(RESULT_OK); - finish(); - } - - private void startCountDownTimer() { - stopCountDownTimer(); - timer = new CodeDownTimer(btnGetCode, 60000, 1000); - timer.start(); - } - - private void stopCountDownTimer() { - if (timer != null) { - timer.cancel(); - timer = null; - } - } - -} diff --git a/app/src/main/java/com/yizhuan/erban/ui/setting/SettingActivity.java b/app/src/main/java/com/yizhuan/erban/ui/setting/SettingActivity.java index 2eb12890f..aeb140422 100644 --- a/app/src/main/java/com/yizhuan/erban/ui/setting/SettingActivity.java +++ b/app/src/main/java/com/yizhuan/erban/ui/setting/SettingActivity.java @@ -22,7 +22,7 @@ import com.yizhuan.erban.base.BaseActivity; import com.yizhuan.erban.common.widget.dialog.DialogManager; import com.yizhuan.erban.databinding.ActivitySettingBinding; import com.yizhuan.erban.ui.im.avtivity.BlackListManageActivity; -import com.yizhuan.erban.ui.login.BinderPhoneActivity; +import com.yizhuan.erban.ui.login.BindPhoneActivity; import com.yizhuan.erban.ui.login.ShowBindPhoneActivity; import com.yizhuan.erban.ui.login.helper.LogoutHelper; import com.yizhuan.erban.ui.user.AboutActivity; @@ -36,6 +36,7 @@ import com.yizhuan.xchat_android_core.user.bean.UserInfo; import com.yizhuan.xchat_android_core.utils.SharedPreferenceUtils; import com.yizhuan.xchat_android_core.withdraw.WithdrawModel; import com.yizhuan.xchat_android_core.withdraw.bean.WithdrawInfo; +import com.yizhuan.xchat_android_library.utils.SingleToastUtil; import com.yizhuan.xchat_android_library.utils.config.BasicConfig; import com.yizhuan.xchat_android_library.utils.file.JXFileUtils; @@ -144,7 +145,7 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene @Override public void onError(Throwable e) { getDialogManager().dismissDialog(); - startActivity(new Intent(SettingActivity.this, BinderPhoneActivity.class)); + SingleToastUtil.showToast(e.getMessage()); } }); break; @@ -160,7 +161,7 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene intent.putExtras(mBundle); startActivity(intent); } else { - startActivity(new Intent(this, BinderPhoneActivity.class)); + BindPhoneActivity.start(context); } break; case R.id.rly_contact_us: @@ -193,7 +194,7 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene if (UserModel.get().getCacheLoginUserInfo().isBindPhone()) { ModifyPwdActivity.start(this, ModifyPwdActivity.PAY_PWD); } else { - startActivity(new Intent(this, BinderPhoneActivity.class)); + BindPhoneActivity.start(context); } break; case R.id.btn_login_out://退出登录 diff --git a/app/src/main/java/com/yizhuan/erban/ui/wallet/JewelActivity.java b/app/src/main/java/com/yizhuan/erban/ui/wallet/JewelActivity.java deleted file mode 100644 index d2bc6b7db..000000000 --- a/app/src/main/java/com/yizhuan/erban/ui/wallet/JewelActivity.java +++ /dev/null @@ -1,243 +0,0 @@ -package com.yizhuan.erban.ui.wallet; - -import android.annotation.SuppressLint; -import android.app.Activity; -import android.content.Intent; -import android.os.Bundle; -import android.view.View; -import android.widget.Button; -import android.widget.LinearLayout; -import android.widget.TextView; - -import com.netease.nim.uikit.StatusBarUtil; -import com.trello.rxlifecycle3.android.ActivityEvent; -import com.trello.rxlifecycle3.android.FragmentEvent; -import com.yizhuan.erban.R; -import com.yizhuan.erban.base.BaseActivity; -import com.yizhuan.erban.base.TitleBar; -import com.yizhuan.erban.bills.activities.BillGiftExpendActivity; -import com.yizhuan.erban.bills.activities.BillGiftInComeActivity; -import com.yizhuan.erban.bills.activities.BillGiftIncomeGroupActivity; -import com.yizhuan.erban.bills.activities.ChargeBillsActivity; -import com.yizhuan.erban.ui.login.BinderPhoneActivity; -import com.yizhuan.erban.ui.setting.ModifyPwdActivity; -import com.yizhuan.erban.ui.withdraw.WithdrawActivity; -import com.yizhuan.xchat_android_core.auth.AuthModel; -import com.yizhuan.xchat_android_core.pay.PayModel; -import com.yizhuan.xchat_android_core.pay.bean.WalletInfo; -import com.yizhuan.xchat_android_core.pay.event.GetWalletInfoEvent; -import com.yizhuan.xchat_android_core.pay.event.UpdateWalletInfoEvent; -import com.yizhuan.xchat_android_core.statistic.StatisticManager; -import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol; -import com.yizhuan.xchat_android_core.user.UserModel; -import com.yizhuan.xchat_android_core.withdraw.bean.ExchangerInfo; -import com.yizhuan.xchat_android_core.withdraw.event.ExchangeInfoEvent; -import com.yizhuan.xchat_android_library.utils.FormatUtils; - -import org.greenrobot.eventbus.EventBus; -import org.greenrobot.eventbus.Subscribe; -import org.greenrobot.eventbus.ThreadMode; - -import io.reactivex.SingleObserver; -import io.reactivex.disposables.Disposable; - -public class JewelActivity extends BaseActivity { - - TextView tvDiamondNum; - LinearLayout llGiftIncome; - LinearLayout llGiftRecord; -// TextView tvGiftExpend; - TextView tvJewelExchange; - TextView tvJewelTiXian; - boolean isRequest; - private final int BINDCODE = 100; - private final int BINDCODE_GOLD = 200; - private boolean isBindPhone; - - public void onCreate(Bundle savedInstanceState){ - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_jewel); - EventBus.getDefault().register(this); - initTitleBar("礼物收入"); - initViews(); - initData(); - } - - @Override - public void onDestroy() { - super.onDestroy(); - EventBus.getDefault().unregister(this); - } - - @Override - protected boolean needSteepStateBar() { - return true; - } - - @Override - protected void setStatusBar() { - super.setStatusBar(); - StatusBarUtil.transparencyBar(this); - StatusBarUtil.StatusBarLightMode(this); - } - - @Override - public void initTitleBar(String title) { - mTitleBar = findViewById(R.id.title_bar); - if (mTitleBar != null) { - mTitleBar.setTitle(title); - mTitleBar.setImmersive(true); - mTitleBar.setTitleColor(getResources().getColor(R.color.color_333333)); - mTitleBar.setLeftImageResource(R.drawable.arrow_left); - mTitleBar.setBackgroundColor(getResources().getColor(R.color.transparent)); - mTitleBar.setLeftClickListener(v -> finish()); - } - } - - private void initViews(){ - tvDiamondNum = findViewById(R.id.tv_diamon_num); - llGiftIncome = findViewById(R.id.ll_gift_income); - llGiftRecord = findViewById(R.id.ll_gift_record); -// tvGiftExpend = findViewById(R.id.tv_gift_expend); - tvJewelExchange = findViewById(R.id.tv_jewel_exchange); - tvJewelTiXian = findViewById(R.id.tv_jewel_tixian); - - llGiftIncome.setOnClickListener(v -> { -// startActivity(new Intent(JewelActivity.this, BillGiftInComeActivity.class)); -// startActivity(new Intent(JewelActivity.this, BillGiftIncomeGroupActivity.class)); - BillGiftIncomeGroupActivity.startActivity(JewelActivity.this, BillGiftIncomeGroupActivity.TYPE_BILL_INCOME); - }); - - llGiftRecord.setOnClickListener(v -> { - BillGiftIncomeGroupActivity.startActivity(JewelActivity.this, BillGiftIncomeGroupActivity.TYPE_BILL_OUTPUT); - }); -// tvGiftExpend.setOnClickListener(v -> { -//// startActivity(new Intent(JewelActivity.this, BillGiftExpendActivity.class)); -// BillGiftIncomeGroupActivity.startActivity(JewelActivity.this, BillGiftIncomeGroupActivity.TYPE_BILL_OUTPUT); -// }); - tvJewelExchange.setOnClickListener(v -> { - if (UserModel.get().getCacheLoginUserInfo() == null) { - return; - } - if (UserModel.get().getCacheLoginUserInfo().isBindPhone() && UserModel.get().getCacheLoginUserInfo().isBindPaymentPwd()){ - startActivity(new Intent(JewelActivity.this, ExchangeGoldActivity.class)); - }else { - if (UserModel.get().getCacheLoginUserInfo().isBindPhone() || isBindPhone){ - ModifyPwdActivity.start(JewelActivity.this,ModifyPwdActivity.FOGERT_PAY_PWD); - }else { - startActivityForResult(new Intent(JewelActivity.this, BinderPhoneActivity.class),BINDCODE_GOLD); - } - } - - StatisticManager.Instance().onEvent(context, - StatisticsProtocol.Event.EVENT_EXCHANGE_CLICK, - "我的礼物/我的钻石 兑换钻石", - null); - }); - tvJewelTiXian.setOnClickListener(v -> { - isRequest = true; - AuthModel.get().isBindPhone() - .compose(bindUntilEvent(ActivityEvent.DESTROY)) - .subscribe(new SingleObserver() { - @Override - public void onSubscribe(Disposable d) { - - } - - @Override - public void onSuccess(String s) { - onIsPhone(); - } - - @Override - public void onError(Throwable e) { - onIsphoneFail(e.getMessage()); - } - }); - tvJewelTiXian.setClickable(false); - - StatisticManager.Instance().onEvent(context, - StatisticsProtocol.Event.EVENT_ACCOUNT_WITHDRAW_CLICK, - "提现按钮", - null); - }); - } - - public void onIsPhone() { - if (UserModel.get().getCacheLoginUserInfo() == null) { - return; - } - tvJewelTiXian.setClickable(true); - if (!isRequest) { - return; - } - isRequest = false; - if (UserModel.get().getCacheLoginUserInfo().isBindPhone() && UserModel.get().getCacheLoginUserInfo().isBindPaymentPwd()) { - startActivity(new Intent(this, WithdrawActivity.class)); - }else { - ModifyPwdActivity.start(this, ModifyPwdActivity.FOGERT_PAY_PWD); - } - // startActivity(new Intent(getContext(), WithdrawActivity.class)); - } - - public void onIsphoneFail(String error) { - tvJewelTiXian.setClickable(true); - if (!isRequest) { - return; - } - isRequest = false; - startActivityForResult(new Intent(this, BinderPhoneActivity.class), BINDCODE); - } - - @Override - public void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - if (requestCode == BINDCODE && resultCode== Activity.RESULT_OK){ - startActivity(new Intent(this, WithdrawActivity.class)); - }else if (requestCode == BINDCODE_GOLD && resultCode== Activity.RESULT_OK){ - isBindPhone=true; - ModifyPwdActivity.start(this,ModifyPwdActivity.FOGERT_PAY_PWD); - } - } - - @Subscribe(threadMode = ThreadMode.MAIN) - public void onRequestExchange(ExchangeInfoEvent event) { - ExchangerInfo exchangerInfo = event.getData(); - if (exchangerInfo != null) { - setDiamondNum(exchangerInfo.diamondNum); - } - } - - @SuppressLint("CheckResult") - public void initData() { - WalletInfo walletInfo = PayModel.get().getCurrentWalletInfo(); - if (walletInfo != null) { - setDiamondNum(walletInfo.diamonds); - } - PayModel.get().getWalletInfo(AuthModel.get().getCurrentUid()) - .subscribe(info -> { - if (info != null) { - setDiamondNum(info.diamonds); - } - }); - } - - @Subscribe(threadMode = ThreadMode.MAIN) - public void onGetWalletInfo(GetWalletInfoEvent event) { - WalletInfo walletInfo = PayModel.get().getCurrentWalletInfo(); - if (walletInfo != null) { - setDiamondNum(walletInfo.diamonds); - } - } - - @Subscribe(threadMode = ThreadMode.MAIN) - public void onWalletInfoUpdate(UpdateWalletInfoEvent event) { - WalletInfo walletInfo = PayModel.get().getCurrentWalletInfo(); - if (walletInfo != null) - setDiamondNum(walletInfo.diamonds); - } - - private void setDiamondNum(double diamondNum) { - tvDiamondNum.setText(FormatUtils.formatBigDecimal(diamondNum)); - } -} diff --git a/app/src/main/java/com/yizhuan/erban/ui/wallet/JewelFragment.java b/app/src/main/java/com/yizhuan/erban/ui/wallet/JewelFragment.java deleted file mode 100644 index f2e69a269..000000000 --- a/app/src/main/java/com/yizhuan/erban/ui/wallet/JewelFragment.java +++ /dev/null @@ -1,186 +0,0 @@ -package com.yizhuan.erban.ui.wallet; - -import android.annotation.SuppressLint; -import android.app.Activity; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.Nullable; -import android.widget.Button; -import android.widget.TextView; - -import com.trello.rxlifecycle3.android.FragmentEvent; -import com.yizhuan.erban.R; -import com.yizhuan.erban.base.BaseFragment; -import com.yizhuan.erban.ui.login.BinderPhoneActivity; -import com.yizhuan.erban.ui.setting.ModifyPwdActivity; -import com.yizhuan.erban.ui.withdraw.WithdrawActivity; -import com.yizhuan.xchat_android_core.auth.AuthModel; -import com.yizhuan.xchat_android_core.pay.PayModel; -import com.yizhuan.xchat_android_core.pay.bean.WalletInfo; -import com.yizhuan.xchat_android_core.pay.event.GetWalletInfoEvent; -import com.yizhuan.xchat_android_core.pay.event.UpdateWalletInfoEvent; -import com.yizhuan.xchat_android_core.user.UserModel; -import com.yizhuan.xchat_android_core.withdraw.bean.ExchangerInfo; -import com.yizhuan.xchat_android_core.withdraw.event.ExchangeInfoEvent; -import com.yizhuan.xchat_android_library.utils.FormatUtils; - -import org.greenrobot.eventbus.EventBus; -import org.greenrobot.eventbus.Subscribe; -import org.greenrobot.eventbus.ThreadMode; - -import io.reactivex.SingleObserver; -import io.reactivex.disposables.Disposable; - -/** - * 我的钱包--钻石界面 - * - * @author Administrator - * @date 2017/7/3 - */ -public class JewelFragment extends BaseFragment { - TextView tvDiamondNum; - Button mButton; - Button mExchangeButton; - boolean isRequest; - private final int BINDCODE = 100; - private final int BINDCODE_GOLD=200; - private boolean isBindPhone; - - @Override - public int getRootLayoutId() { - return R.layout.wallet_fragment_jewel; - } - - @Override - public void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - EventBus.getDefault().register(this); - } - - @Override - public void onDestroy() { - super.onDestroy(); - EventBus.getDefault().unregister(this); - } - - @Override - public void onFindViews() { - tvDiamondNum = (TextView) mView.findViewById(R.id.tv_diamondNum); - mButton = (Button) mView.findViewById(R.id.wallet_jewel_tixian); - mExchangeButton = (Button) mView.findViewById(R.id.wallet_jewel_exchange); - } - - @Override - public void onSetListener() { - mButton.setOnClickListener(v -> { - isRequest = true; - AuthModel.get().isBindPhone() - .compose(bindUntilEvent(FragmentEvent.DESTROY)) - .subscribe(new SingleObserver() { - @Override - public void onSubscribe(Disposable d) { - - } - - @Override - public void onSuccess(String s) { - onIsPhone(); - } - - @Override - public void onError(Throwable e) { - onIsphoneFail(e.getMessage()); - } - }); - mButton.setClickable(false); - }); - mExchangeButton.setOnClickListener(v -> { - if (UserModel.get().getCacheLoginUserInfo().isBindPhone() && UserModel.get().getCacheLoginUserInfo().isBindPaymentPwd()){ - startActivity(new Intent(getActivity(), ExchangeGoldActivity.class)); - }else { - if (UserModel.get().getCacheLoginUserInfo().isBindPhone() || isBindPhone){ - ModifyPwdActivity.start(getActivity(),ModifyPwdActivity.FOGERT_PAY_PWD); - }else { - startActivityForResult(new Intent(getActivity(), BinderPhoneActivity.class),BINDCODE_GOLD); - } - } - // ExchangeGoldActivity.start(getContext()); - }); - } - - public void onIsPhone() { - mButton.setClickable(true); - if (!isRequest) { - return; - } - isRequest = false; - if (UserModel.get().getCacheLoginUserInfo().isBindPhone() && UserModel.get().getCacheLoginUserInfo().isBindPaymentPwd()) { - startActivity(new Intent(getActivity(), WithdrawActivity.class)); - }else { - ModifyPwdActivity.start(getActivity(),ModifyPwdActivity.FOGERT_PAY_PWD); - } - // startActivity(new Intent(getContext(), WithdrawActivity.class)); - } - - public void onIsphoneFail(String error) { - mButton.setClickable(true); - if (!isRequest) { - return; - } - isRequest = false; - startActivityForResult(new Intent(getContext(), BinderPhoneActivity.class), BINDCODE); - } - - @Override - public void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - if (requestCode == BINDCODE && resultCode== Activity.RESULT_OK){ - startActivity(new Intent(getActivity(), WithdrawActivity.class)); - }else if (requestCode == BINDCODE_GOLD && resultCode== Activity.RESULT_OK){ - isBindPhone=true; - ModifyPwdActivity.start(getActivity(),ModifyPwdActivity.FOGERT_PAY_PWD); - } - } - - @Subscribe(threadMode = ThreadMode.MAIN) - public void onRequestExchange(ExchangeInfoEvent event) { - ExchangerInfo exchangerInfo = event.getData(); - if (exchangerInfo != null) { - setDiamondNum(exchangerInfo.diamondNum); - } - } - - @SuppressLint("CheckResult") - @Override - public void initiate() { - WalletInfo walletInfo = PayModel.get().getCurrentWalletInfo(); - if (walletInfo != null) { - setDiamondNum(walletInfo.diamonds); - } - PayModel.get().getWalletInfo(AuthModel.get().getCurrentUid()) - .subscribe(info -> { - if (info != null) { - setDiamondNum(info.diamonds); - } - }); - } - - @Subscribe(threadMode = ThreadMode.MAIN) - public void onGetWalletInfo(GetWalletInfoEvent event) { - WalletInfo walletInfo = PayModel.get().getCurrentWalletInfo(); - if (walletInfo != null) { - setDiamondNum(walletInfo.diamonds); - } - } - - @Subscribe(threadMode = ThreadMode.MAIN) - public void onWalletInfoUpdate(UpdateWalletInfoEvent event) { - WalletInfo walletInfo = PayModel.get().getCurrentWalletInfo(); - if (walletInfo != null) - setDiamondNum(walletInfo.diamonds); - } - - private void setDiamondNum(double diamondNum) { - tvDiamondNum.setText(FormatUtils.formatBigDecimal(diamondNum)); - } -} diff --git a/app/src/main/java/com/yizhuan/erban/ui/wallet/RedBagActivity.java b/app/src/main/java/com/yizhuan/erban/ui/wallet/RedBagActivity.java deleted file mode 100644 index bf0edc0a4..000000000 --- a/app/src/main/java/com/yizhuan/erban/ui/wallet/RedBagActivity.java +++ /dev/null @@ -1,272 +0,0 @@ -package com.yizhuan.erban.ui.wallet; - -import android.content.Intent; -import android.os.Bundle; -import android.text.TextUtils; -import android.view.View; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.RelativeLayout; -import android.widget.TextView; - -import com.netease.nim.uikit.StatusBarUtil; -import com.trello.rxlifecycle3.android.ActivityEvent; -import com.trello.rxlifecycle3.android.FragmentEvent; -import com.yizhuan.erban.R; -import com.yizhuan.erban.base.BaseActivity; -import com.yizhuan.erban.base.TitleBar; -import com.yizhuan.erban.bills.activities.RedBagBillsActivity; -import com.yizhuan.erban.bills.activities.TotalBillsActivity; -import com.yizhuan.erban.ui.login.BinderPhoneActivity; -import com.yizhuan.erban.ui.setting.ModifyPwdActivity; -import com.yizhuan.erban.ui.webview.CommonWebViewActivity; -import com.yizhuan.erban.ui.widget.marqueeview.MarqueeView; -import com.yizhuan.xchat_android_core.UriProvider; -import com.yizhuan.xchat_android_core.auth.AuthModel; -import com.yizhuan.xchat_android_core.redPacket.RedPacketModel; -import com.yizhuan.xchat_android_core.redPacket.bean.RedDrawListInfo; -import com.yizhuan.xchat_android_core.redPacket.bean.RedPacketInfo; -import com.yizhuan.xchat_android_core.redPacket.event.GetRedInfoEvent; -import com.yizhuan.xchat_android_core.user.UserModel; -import com.yizhuan.xchat_android_core.utils.net.BeanObserver; - -import org.greenrobot.eventbus.EventBus; -import org.greenrobot.eventbus.Subscribe; -import org.greenrobot.eventbus.ThreadMode; - -import java.util.ArrayList; -import java.util.List; - -import io.reactivex.SingleObserver; -import io.reactivex.disposables.Disposable; - -public class RedBagActivity extends BaseActivity implements View.OnClickListener { - - private MarqueeView marqueeView; - private TextView redMoeny; - private TextView sharePeoples; - private TextView shareBonus; - private TextView redRank; - private TextView redRule; - private TextView redMethod; - private LinearLayout llSharePeople; - private LinearLayout llShareBonus; - private TextView tvWithdraw; - private boolean isRequest; - - private RedPacketInfo redPacketInfo; - - public void onCreate(Bundle savedInstanceState){ - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_red_bag); - EventBus.getDefault().register(this); - initTitleBar("我的红包奖励"); - initViews(); - initData(); - } - - @Override - public void onDestroy() { - super.onDestroy(); - EventBus.getDefault().unregister(this); - } - - @Override - protected boolean needSteepStateBar() { - return true; - } - - @Override - protected void setStatusBar() { - super.setStatusBar(); - StatusBarUtil.transparencyBar(this); - StatusBarUtil.StatusBarLightMode(this); - } - - @Override - public void initTitleBar(String title) { - mTitleBar = findViewById(R.id.title_bar); - if (mTitleBar != null) { - mTitleBar.setTitle(title); - mTitleBar.setImmersive(true); - mTitleBar.setTitleColor(getResources().getColor(R.color.white)); - mTitleBar.setLeftImageResource(R.drawable.arrow_left_white); - mTitleBar.setBackgroundColor(getResources().getColor(R.color.transparent)); - mTitleBar.setLeftClickListener(v -> finish()); - } - mTitleBar.setActionTextColor(getResources().getColor(R.color.white)); - mTitleBar.addAction(new TitleBar.TextAction("红包纪录") { - @Override - public void performAction(View view) { - startActivity(new Intent(RedBagActivity.this, RedBagBillsActivity.class)); - } - }); - } - - private void initViews(){ - marqueeView = findViewById(R.id.marqueeView); - redMoeny = findViewById(R.id.tv_red_money); - sharePeoples = findViewById(R.id.tv_share_count); - shareBonus = findViewById(R.id.tv_share); - - redRank = findViewById(R.id.tv_red_rank); - redRule = findViewById(R.id.tv_red_rule); - redMethod = findViewById(R.id.tv_red_method); - llSharePeople = findViewById(R.id.ll_people); - llShareBonus = findViewById(R.id.ll_share_bonus); - tvWithdraw = findViewById(R.id.tv_withdraw); - - redRank.setOnClickListener(this); - redRule.setOnClickListener(this); - redMethod.setOnClickListener(this); - llSharePeople.setOnClickListener(this); - llShareBonus.setOnClickListener(this); - tvWithdraw.setOnClickListener(this); - } - - private void initData(){ - loadData(); - } - - private void loadData() { - RedPacketModel.get().getRedPacketInfo().subscribe(); - RedPacketModel.get().getRedDrawList().subscribe(new BeanObserver>() { - @Override - public void onErrorMsg(String error) { - showDefaultData(); - } - - @Override - public void onSuccess(List redDrawListInfos) { - onGetRedDrawList(redDrawListInfos); - } - }); - } - - @Subscribe(threadMode = ThreadMode.MAIN) - public void onGetRedInfo(GetRedInfoEvent event) { - if (event.isFailed()) { - toast(event.getError()); - return; - } - redPacketInfo = event.getData(); - if (redPacketInfo != null) { - redMoeny.setText(String.valueOf(redPacketInfo.getPacketNum())); - sharePeoples.setText(String.valueOf(redPacketInfo.getRegisterCout() + "人")); - shareBonus.setText(String.valueOf(redPacketInfo.getChargeBonus() + "元")); - } - } - - - private void onGetRedDrawList(List redDrawListInfos) { - if (redDrawListInfos != null && redDrawListInfos.size() > 0) { - List info = new ArrayList<>(); - for (int i=0; i info = new ArrayList<>(); - info.add("article一分钟前提现了200"); - info.add("木马一分钟前提现了200"); - info.add("此乳胸险一分钟前提现了100"); - info.add("xiaoshihou一分钟前提现了100"); - info.add("夜袭寡妇一分钟前提现了200"); - info.add("玮哥一分钟前提现了200"); - info.add("xiaoSeSe一分钟前提现了400"); - info.add("一生懵逼一分钟前提现了600"); - info.add("小可爱一分钟前提现了100"); - info.add("ai人一分钟前提现了200"); - info.add("大叔一分钟前提现了400"); - info.add("小凳子一分钟前提现了800"); - info.add("小逍遥一分钟前提现了300"); - info.add("清新一分钟前提现了100"); - info.add("荔枝一分钟前提现了200"); - info.add("小明哥哥一分钟前提现了100"); - info.add("薇薇一分钟前提现了300"); - info.add("红高粱一分钟前提现了400"); - marqueeView.startWithList(info); - } - - @Override - public void onClick(View v) { - String url = null; - switch (v.getId()) { - case R.id.tv_red_rank: - url = UriProvider.IM_SERVER_URL + "/yinyou/modules/bonus/rankList.html" + "?uid=" + AuthModel.get().getCurrentUid(); - break; - case R.id.tv_red_rule: - url = UriProvider.IM_SERVER_URL + "/yinyou/modules/bonus/fight.html" + "?uid=" + AuthModel.get().getCurrentUid(); - break; - case R.id.tv_red_method: - url = UriProvider.IM_SERVER_URL + "/yinyou/modules/bonus/secret.html" + "?uid=" + AuthModel.get().getCurrentUid(); - break; - case R.id.ll_people: - url = UriProvider.IM_SERVER_URL + "/yinyou/modules/bonus/invitation.html" + "?uid=" + AuthModel.get().getCurrentUid(); - break; - case R.id.ll_share_bonus: - url = UriProvider.IM_SERVER_URL + "/yinyou/modules/bonus/revenue.html" + "?uid=" + AuthModel.get().getCurrentUid(); - break; - case R.id.tv_withdraw: -// if (redPacketInfo == null || redPacketInfo.getPacketNum() < 100) { -// toast("红包金额满100才可提现"); -// } else { - isRequest = true; - AuthModel.get().isBindPhone() - .compose(bindUntilEvent(ActivityEvent.DESTROY)) - .subscribe(new SingleObserver() { - @Override - public void onSubscribe(Disposable d) { - - } - - @Override - public void onSuccess(String s) { - onIsPhone(); - } - - @Override - public void onError(Throwable e) { - onIsphoneFail(e.getMessage()); - } - }); -// } - break; - } - if (!TextUtils.isEmpty(url)) - openWebView(url); - } - - private void openWebView(String url) { - if (TextUtils.isEmpty(url)) return; - Intent intent = new Intent(this, CommonWebViewActivity.class); - intent.putExtra("url", url); - startActivity(intent); - } - - public void onIsPhone() { - if (!isRequest) { - return; - } - isRequest = false; - if (UserModel.get().getCacheLoginUserInfo().isBindPaymentPwd()){ - startActivity(new Intent(this, RedPacketWithdrawActivity.class)); - }else { - ModifyPwdActivity.start(this,ModifyPwdActivity.FOGERT_PAY_PWD); - } - } - - public void onIsphoneFail(String error) { - if (!isRequest) { - return; - } - isRequest = false; - startActivity(new Intent(this, BinderPhoneActivity.class)); - } -} diff --git a/app/src/main/java/com/yizhuan/erban/ui/wallet/RedBagFragment.java b/app/src/main/java/com/yizhuan/erban/ui/wallet/RedBagFragment.java deleted file mode 100644 index 0c47c1a57..000000000 --- a/app/src/main/java/com/yizhuan/erban/ui/wallet/RedBagFragment.java +++ /dev/null @@ -1,247 +0,0 @@ -package com.yizhuan.erban.ui.wallet; - -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.Nullable; -import android.text.TextUtils; -import android.view.View; -import android.widget.ImageView; -import android.widget.RelativeLayout; -import android.widget.TextView; - -import com.trello.rxlifecycle3.android.FragmentEvent; -import com.yizhuan.erban.R; -import com.yizhuan.erban.base.BaseFragment; -import com.yizhuan.erban.ui.login.BinderPhoneActivity; -import com.yizhuan.erban.ui.setting.ModifyPwdActivity; -import com.yizhuan.erban.ui.webview.CommonWebViewActivity; -import com.yizhuan.erban.ui.widget.marqueeview.MarqueeView; -import com.yizhuan.xchat_android_core.UriProvider; -import com.yizhuan.xchat_android_core.auth.AuthModel; -import com.yizhuan.xchat_android_core.redPacket.RedPacketModel; -import com.yizhuan.xchat_android_core.redPacket.bean.RedDrawListInfo; -import com.yizhuan.xchat_android_core.redPacket.bean.RedPacketInfo; -import com.yizhuan.xchat_android_core.redPacket.event.GetRedInfoEvent; -import com.yizhuan.xchat_android_core.user.UserModel; -import com.yizhuan.xchat_android_core.utils.net.BeanObserver; - -import org.greenrobot.eventbus.EventBus; -import org.greenrobot.eventbus.Subscribe; -import org.greenrobot.eventbus.ThreadMode; - -import java.util.ArrayList; -import java.util.List; - -import io.reactivex.SingleObserver; -import io.reactivex.disposables.Disposable; - -/** - * 我的钱包---红包 - * Created by ${Seven} on 2017/9/18. - */ -public class RedBagFragment extends BaseFragment implements View.OnClickListener { - private MarqueeView marqueeView; - private TextView redMoeny; - private TextView sharePeoples; - private TextView shareBonus; - private RelativeLayout redRank; - private RelativeLayout redRule; - private RelativeLayout redMethod; - private RelativeLayout rlySharePeople; - private RelativeLayout rlyShareBonus; - private ImageView unWithdraw; - private ImageView withdraw; - private boolean isRequest; - - @Override - public void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - EventBus.getDefault().register(this); - } - - @Override - public void onDestroy() { - super.onDestroy(); - EventBus.getDefault().unregister(this); - } - - @Override - public void onFindViews() { - marqueeView = (MarqueeView) mView.findViewById(R.id.marqueeView); - redMoeny = (TextView) mView.findViewById(R.id.tv_red_money); - sharePeoples = (TextView) mView.findViewById(R.id.tv_share_count); - shareBonus = (TextView) mView.findViewById(R.id.tv_share); - - redRank = (RelativeLayout) mView.findViewById(R.id.rly_red_rank); - redRule = (RelativeLayout) mView.findViewById(R.id.rly_red_rule); - redMethod = (RelativeLayout) mView.findViewById(R.id.rly_red_method); - rlySharePeople = (RelativeLayout) mView.findViewById(R.id.rly_people); - rlyShareBonus = (RelativeLayout) mView.findViewById(R.id.rly_share_bonus); - unWithdraw = (ImageView) mView.findViewById(R.id.img_un_withdraw); - withdraw = (ImageView) mView.findViewById(R.id.img_withdraw); - - } - - @Override - public void onSetListener() { - redRank.setOnClickListener(this); - redRule.setOnClickListener(this); - redMethod.setOnClickListener(this); - rlySharePeople.setOnClickListener(this); - rlyShareBonus.setOnClickListener(this); - withdraw.setOnClickListener(this); - } - - @Override - public void initiate() { - loadData(); - } - - private void loadData() { - RedPacketModel.get().getRedPacketInfo().subscribe(); - RedPacketModel.get().getRedDrawList().subscribe(new BeanObserver>() { - @Override - public void onErrorMsg(String error) { - showDefaultData(); - } - - @Override - public void onSuccess(List redDrawListInfos) { - onGetRedDrawList(redDrawListInfos); - } - }); - } - - @Subscribe(threadMode = ThreadMode.MAIN) - public void onGetRedInfo(GetRedInfoEvent event) { - if (event.isFailed()) { - toast(event.getError()); - return; - } - RedPacketInfo redPacketInfo = event.getData(); - if (redPacketInfo != null) { - if (redPacketInfo.getPacketNum() >= 100) { - unWithdraw.setVisibility(View.GONE); - withdraw.setVisibility(View.VISIBLE); - } - redMoeny.setText(String.valueOf(redPacketInfo.getPacketNum())); - sharePeoples.setText(String.valueOf(redPacketInfo.getRegisterCout())); - shareBonus.setText(String.valueOf(redPacketInfo.getChargeBonus())); - } - } - - - private void onGetRedDrawList(List redDrawListInfos) { - if (redDrawListInfos != null && redDrawListInfos.size() > 0) { - List info = new ArrayList<>(); - for (int i=0; i info = new ArrayList<>(); - info.add("article一分钟前提现了200"); - info.add("木马一分钟前提现了200"); - info.add("此乳胸险一分钟前提现了100"); - info.add("xiaoshihou一分钟前提现了100"); - info.add("夜袭寡妇一分钟前提现了200"); - info.add("玮哥一分钟前提现了200"); - info.add("xiaoSeSe一分钟前提现了400"); - info.add("一生懵逼一分钟前提现了600"); - info.add("小可爱一分钟前提现了100"); - info.add("ai人一分钟前提现了200"); - info.add("大叔一分钟前提现了400"); - info.add("小凳子一分钟前提现了800"); - info.add("小逍遥一分钟前提现了300"); - info.add("清新一分钟前提现了100"); - info.add("荔枝一分钟前提现了200"); - info.add("小明哥哥一分钟前提现了100"); - info.add("薇薇一分钟前提现了300"); - info.add("红高粱一分钟前提现了400"); - marqueeView.startWithList(info); - } - - @Override - public int getRootLayoutId() { - return R.layout.wallet_fragment_redbag; - } - - - @Override - public void onClick(View v) { - String url = null; - switch (v.getId()) { - case R.id.rly_red_rank: - url = UriProvider.IM_SERVER_URL + "/yinyou/modules/bonus/rankList.html" + "?uid=" + AuthModel.get().getCurrentUid(); - break; - case R.id.rly_red_rule: - url = UriProvider.IM_SERVER_URL + "/yinyou/modules/bonus/fight.html" + "?uid=" + AuthModel.get().getCurrentUid(); - break; - case R.id.rly_red_method: - url = UriProvider.IM_SERVER_URL + "/yinyou/modules/bonus/secret.html" + "?uid=" + AuthModel.get().getCurrentUid(); - break; - case R.id.rly_people: - url = UriProvider.IM_SERVER_URL + "/yinyou/modules/bonus/invitation.html" + "?uid=" + AuthModel.get().getCurrentUid(); - break; - case R.id.rly_share_bonus: - url = UriProvider.IM_SERVER_URL + "/yinyou/modules/bonus/revenue.html" + "?uid=" + AuthModel.get().getCurrentUid(); - break; - case R.id.img_withdraw: - isRequest = true; - AuthModel.get().isBindPhone() - .compose(bindUntilEvent(FragmentEvent.DESTROY)) - .subscribe(new SingleObserver() { - @Override - public void onSubscribe(Disposable d) { - - } - - @Override - public void onSuccess(String s) { - onIsPhone(); - } - - @Override - public void onError(Throwable e) { - onIsphoneFail(e.getMessage()); - } - }); - break; - } - if (!TextUtils.isEmpty(url)) - openWebView(url); - } - - private void openWebView(String url) { - if (TextUtils.isEmpty(url)) return; - Intent intent = new Intent(getContext(), CommonWebViewActivity.class); - intent.putExtra("url", url); - startActivity(intent); - } - - public void onIsPhone() { - if (!isRequest) { - return; - } - isRequest = false; - if (UserModel.get().getCacheLoginUserInfo().isBindPaymentPwd()){ - startActivity(new Intent(getActivity(), RedPacketWithdrawActivity.class)); - }else { - ModifyPwdActivity.start(getActivity(),ModifyPwdActivity.FOGERT_PAY_PWD); - } - } - - public void onIsphoneFail(String error) { - if (!isRequest) { - return; - } - isRequest = false; - startActivity(new Intent(getContext(), BinderPhoneActivity.class)); - } -} diff --git a/app/src/main/java/com/yizhuan/erban/ui/wallet/RedPacketWithdrawActivity.java b/app/src/main/java/com/yizhuan/erban/ui/wallet/RedPacketWithdrawActivity.java deleted file mode 100644 index cb0d9f673..000000000 --- a/app/src/main/java/com/yizhuan/erban/ui/wallet/RedPacketWithdrawActivity.java +++ /dev/null @@ -1,320 +0,0 @@ -package com.yizhuan.erban.ui.wallet; - -import android.content.Intent; -import android.os.Bundle; -import androidx.recyclerview.widget.GridLayoutManager; -import androidx.recyclerview.widget.RecyclerView; -import android.text.TextUtils; -import android.view.View; -import android.widget.Button; -import android.widget.RelativeLayout; -import android.widget.TextView; - -import com.chad.library.adapter.base.BaseQuickAdapter; -import com.yizhuan.erban.R; -import com.yizhuan.erban.base.BaseActivity; -import com.yizhuan.erban.common.widget.dialog.DialogManager; -import com.yizhuan.erban.ui.wallet.adapter.WithdrawRedListAdapter; -import com.yizhuan.erban.ui.widget.password.PassWordFragment; -import com.yizhuan.erban.ui.withdraw.BinderAlipayActivity; -import com.yizhuan.xchat_android_core.auth.AuthModel; -import com.yizhuan.xchat_android_core.initial.bean.TaxInfo; -import com.yizhuan.xchat_android_core.redPacket.RedPacketModel; -import com.yizhuan.xchat_android_core.redPacket.bean.RedPacketInfo; -import com.yizhuan.xchat_android_core.redPacket.bean.WithdrawRedListInfo; -import com.yizhuan.xchat_android_core.redPacket.bean.WithdrawRedSucceedInfo; -import com.yizhuan.xchat_android_core.redPacket.event.GetRedInfoEvent; -import com.yizhuan.xchat_android_core.utils.net.BeanObserver; -import com.yizhuan.xchat_android_core.withdraw.WithdrawModel; -import com.yizhuan.xchat_android_core.withdraw.bean.RefreshInfo; -import com.yizhuan.xchat_android_core.withdraw.bean.WithdrawInfo; -import com.yizhuan.xchat_android_library.utils.ListUtils; - -import org.greenrobot.eventbus.EventBus; -import org.greenrobot.eventbus.Subscribe; -import org.greenrobot.eventbus.ThreadMode; - -import java.util.List; - -import io.reactivex.SingleObserver; -import io.reactivex.disposables.Disposable; - -/** - * 红包提现 - */ -public class RedPacketWithdrawActivity extends BaseActivity implements View.OnClickListener { - - private TextView redNum; - private RelativeLayout binder; - private RelativeLayout binderSucceed; - private TextView zxcAccount; - private TextView alipayName; - private RecyclerView recyclerView; - private Button btnWithdraw; - private Button unBtnWithdraw; - private WithdrawInfo mWithdrawInfo; - private WithdrawRedListAdapter mRedListAdapter; - private WithdrawRedListInfo mSelectRedInfo; - - private TextView tvTip; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_red_packet_withdraw); - EventBus.getDefault().register(this); - initTitleBar(getString(R.string.red_packet_withdraw)); - initView(); - initData(); - setListener(); - } - - private void initView() { - redNum = (TextView) findViewById(R.id.tv_red_num); - binder = (RelativeLayout) findViewById(R.id.rly_binder); - binderSucceed = (RelativeLayout) findViewById(R.id.rly_binder_succeed); - zxcAccount = (TextView) findViewById(R.id.tv_user_zhifubao); - alipayName = (TextView) findViewById(R.id.tv_user_zhifubao_name); - recyclerView = (RecyclerView) findViewById(R.id.recyclerView); - btnWithdraw = (Button) findViewById(R.id.btn_withdraw); - unBtnWithdraw = (Button) findViewById(R.id.btn_withdraw_un); - tvTip = (TextView) findViewById(R.id.tv_tip); - } - - - private void initData() { - recyclerView.setLayoutManager(new GridLayoutManager(this, 3)); - mRedListAdapter = new WithdrawRedListAdapter(); - recyclerView.setAdapter(mRedListAdapter); - mRedListAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() { - @Override - public void onItemClick(BaseQuickAdapter baseQuickAdapter, View view, int position) { - List list = mRedListAdapter.getData(); - if (ListUtils.isListEmpty(list)) return; - mSelectRedInfo = list.get(position); - int size = list.size(); - for (int i = 0; i < size; i++) { - list.get(i).isSelected = position == i; - } - mRedListAdapter.notifyDataSetChanged(); - redPackWithdraw(); - } - }); - loadAlipayInfo(); - loadingData(); - loadingListData(); - - //显示提示 - TaxInfo texInfo = WithdrawModel.get().getTaxInfo(); - if (null != texInfo){ - tvTip.setVisibility(View.VISIBLE); - tvTip.setText(texInfo.getTips()); - }else { - tvTip.setVisibility(View.GONE); - } - } - - private void loadAlipayInfo() { - WithdrawModel.get().getWithdrawUserInfo( - AuthModel.get().getCurrentUid() - ) - .subscribe(new SingleObserver() { - @Override - public void onSubscribe(Disposable d) { - - } - - @Override - public void onSuccess(WithdrawInfo withdrawInfo) { - onGetWithdrawUserInfo(withdrawInfo); - } - - @Override - public void onError(Throwable e) { - - } - }); - } - - public void onGetWithdrawUserInfo(WithdrawInfo withdrawInfo) { - if (withdrawInfo != null) { - mWithdrawInfo = withdrawInfo; - if (TextUtils.isEmpty(withdrawInfo.zxcAccount) || withdrawInfo.zxcAccount.equals("null")) { - binder.setVisibility(View.VISIBLE); - binderSucceed.setVisibility(View.GONE); - } else { - binder.setVisibility(View.GONE); - binderSucceed.setVisibility(View.VISIBLE); - zxcAccount.setText(withdrawInfo.zxcAccount); - alipayName.setText(withdrawInfo.zxcAccountName); - } - } - } - - private void loadingListData() { - RedPacketModel.get().getRedList().subscribe(new BeanObserver>() { - @Override - public void onErrorMsg(String error) { - toast(error); - } - - @Override - public void onSuccess(List withdrawRedListInfos) { - onGetRedList(withdrawRedListInfos); - } - }); - } - - private void onGetRedList(List withdrawRedListInfos) { - if (!withdrawRedListInfos.isEmpty()) { - mRedListAdapter.setNewData(withdrawRedListInfos); - } - } - - private void loadingData() { - RedPacketModel.get().getRedPacketInfo().subscribe(); - } - - private RedPacketInfo redPacketInfos; - - @Subscribe(threadMode = ThreadMode.MAIN) - public void onGetRedInfo(GetRedInfoEvent event) { - if (event.isFailed()) { - toast(event.getError()); - return; - } - RedPacketInfo redPacketInfo = event.getData(); - if (null != redPacketInfo) { - redPacketInfos = redPacketInfo; - redNum.setText(String.valueOf(redPacketInfo.getPacketNum())); - } - } - - private void setListener() { - binder.setOnClickListener(this); - binderSucceed.setOnClickListener(this); - } - - private Intent intent; - private Bundle mBundle; - - @Override - public void onClick(View v) { - switch (v.getId()) { - //未绑定支付宝时可点---绑定支付宝账号 - case R.id.rly_binder: - intent = new Intent(getApplicationContext(), BinderAlipayActivity.class); - mBundle = new Bundle(); - mBundle.putSerializable("withdrawInfo", mWithdrawInfo); - intent.putExtras(mBundle); - startActivity(intent); - break; - //绑定成功支付宝后可点---更改支付宝账号 - case R.id.rly_binder_succeed: - intent = new Intent(getApplicationContext(), BinderAlipayActivity.class); - mBundle = new Bundle(); - mBundle.putSerializable("withdrawInfo", mWithdrawInfo); - intent.putExtras(mBundle); - startActivity(intent); - break; - } - } - - //eventbus监听绑定支付宝页面是否绑定成功,然后刷新红包提现页面 - @Subscribe(threadMode = ThreadMode.MAIN) - public void refreshEvent(RefreshInfo refreshInfo) { - loadAlipayInfo(); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - EventBus.getDefault().unregister(this); - } - - private void redPackWithdraw() { - if (mSelectRedInfo == null) { - toast("兑换失败"); - return; - } - if (isWithdraw()) { - btnWithdraw.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - //有账号才能提现 - if (!isAlipayValid()) { - toast(R.string.bind_your_alipay); - return; - } - //发起兑换 - getDialogManager().showOkCancelDialog( - getString(R.string.withdraw_dialog_notice, - mSelectRedInfo.getPacketNum(), mSelectRedInfo.getPacketNum()), - true, new DialogManager.OkCancelDialogListener() { - @Override - public void onCancel() { - getDialogManager().dismissDialog(); - } - - @Override - public void onOk() { - getDialogManager().dismissDialog(); - PassWordFragment.newInstace(0).show(getSupportFragmentManager()); - } - }); - } - }); - } - } - - public void commit(String pwd) { - RedPacketModel.get().getRedWithdraw( - AuthModel.get().getCurrentUid(), - mSelectRedInfo.getPacketId(), DESAndBase64(pwd)) - .subscribe(new BeanObserver() { - @Override - public void onErrorMsg(String error) { - toast(error); - } - - @Override - public void onSuccess(WithdrawRedSucceedInfo info) { - onGetWithdraw(info); - } - }); - - } - - public boolean isWithdraw() { - if (!(mWithdrawInfo != null && mWithdrawInfo.isNotBoundPhone)) { - if (mSelectRedInfo != null) { - //用户的钻石余额 > 选中金额的钻石数时 - if (redPacketInfos.getPacketNum() >= mSelectRedInfo.getPacketNum()) { - unBtnWithdraw.setVisibility(View.GONE); - btnWithdraw.setVisibility(View.VISIBLE); - return true; - } else { - unBtnWithdraw.setVisibility(View.VISIBLE); - btnWithdraw.setVisibility(View.GONE); - return true; - } - } - } else { - return false; - } - //如果选中position不为空的时候 - return false; - } - - private boolean isAlipayValid() { - return mWithdrawInfo != null && !TextUtils.isEmpty(mWithdrawInfo.zxcAccount); - } - - private void onGetWithdraw(WithdrawRedSucceedInfo succeedInfo) { - toast("兑换成功"); - if (null != succeedInfo) { - redNum.setText(String.valueOf(succeedInfo.getPacketNum())); - } - } - -} diff --git a/app/src/main/java/com/yizhuan/erban/ui/wallet/WalletActivity.java b/app/src/main/java/com/yizhuan/erban/ui/wallet/WalletActivity.java deleted file mode 100644 index 3a02f8966..000000000 --- a/app/src/main/java/com/yizhuan/erban/ui/wallet/WalletActivity.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.yizhuan.erban.ui.wallet; - -import android.content.Context; -import android.content.Intent; -import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentManager; -import android.view.View; - -import com.yizhuan.erban.R; -import com.yizhuan.erban.base.BaseBindingActivity; -import com.yizhuan.erban.base.TitleBar; -import com.yizhuan.erban.databinding.ActivityWalletBinding; -import com.yizhuan.erban.home.adapter.CommonMagicIndicatorAdapter; -import com.yizhuan.erban.bills.activities.TotalBillsActivity; -import com.yizhuan.erban.ui.widget.magicindicator.MagicIndicator; -import com.yizhuan.erban.ui.widget.magicindicator.ViewPagerHelper; -import com.yizhuan.erban.ui.widget.magicindicator.buildins.commonnavigator.CommonNavigator; -import com.yizhuan.xchat_android_core.Constants; -import com.yizhuan.xchat_android_core.home.bean.TabInfo; -import com.yizhuan.xchat_android_library.annatation.ActLayoutRes; - -import java.util.ArrayList; -import java.util.List; - -/** - * 我的钱包页面 - * - * @author Administrator - * @date 2017/7/1 - */ - -@ActLayoutRes(R.layout.activity_wallet) -public class WalletActivity extends BaseBindingActivity implements CommonMagicIndicatorAdapter.OnItemSelectListener { - - private ArrayList fragmentArrayList; - private FragmentManager fragmentManager; - public Context context; - private int mPosition; - - public static void start(Context context, int position) { - Intent intent = new Intent(context, WalletActivity.class); - intent.putExtra(Constants.KEY_POSITION, position); - context.startActivity(intent); - } - - @Override - protected void init() { - initTitleBar(getString(R.string.menu_my_wallet)); - initFragment(); - initViewPager(); - } - - @Override - public void initTitleBar(String title) { - mTitleBar = mBinding.titleBar; - if (mTitleBar != null) { - mTitleBar.setTitle(title); - mTitleBar.setImmersive(false); - mTitleBar.setTitleColor(getResources().getColor(R.color.back_font)); - mTitleBar.setLeftImageResource(R.drawable.arrow_left); - mTitleBar.setLeftClickListener(v -> finish()); - } - mTitleBar.setActionTextColor(getResources().getColor(R.color.text_tertiary)); - mTitleBar.addAction(new TitleBar.TextAction("账单") { - @Override - public void performAction(View view) { - startActivity(new Intent(WalletActivity.this, TotalBillsActivity.class)); - } - }); - } - - - private void initViewPager() { - mBinding.vPager.setAdapter(new WalletFragmentPagerAdapter(fragmentManager, fragmentArrayList)); - initMagicIndicator2(); - mBinding.vPager.setOffscreenPageLimit(3); - - mPosition = getIntent().getIntExtra(Constants.KEY_POSITION, 0); - mBinding.vPager.setCurrentItem(mPosition); - } - - private void initMagicIndicator2() { - List tabInfoList = new ArrayList<>(3); - tabInfoList.add(new TabInfo(1, getString(R.string.gift_expend_gold))); - tabInfoList.add(new TabInfo(2, getString(R.string.gift_income_gold))); - tabInfoList.add(new TabInfo(3, getString(R.string.red_package))); - final MagicIndicator magicIndicator = (MagicIndicator) findViewById(R.id.magic_indicator2); - CommonNavigator commonNavigator = new CommonNavigator(this); - commonNavigator.setAdjustMode(true); - CommonMagicIndicatorAdapter walletAdapter = new CommonMagicIndicatorAdapter(this, tabInfoList, 0); - walletAdapter.setOnItemSelectListener(this); - commonNavigator.setAdapter(walletAdapter); - magicIndicator.setNavigator(commonNavigator); - ViewPagerHelper.bind(magicIndicator, mBinding.vPager); - } - - @Override - public void onItemSelect(int position) { - mBinding.vPager.setCurrentItem(position); - } - - private void initFragment() { - fragmentArrayList = new ArrayList<>(); - fragmentArrayList.add(new WalletGoldFragment()); - fragmentArrayList.add(new JewelFragment()); - fragmentArrayList.add(new RedBagFragment()); - fragmentManager = getSupportFragmentManager(); - } -} diff --git a/app/src/main/java/com/yizhuan/erban/ui/wallet/WalletFragmentPagerAdapter.java b/app/src/main/java/com/yizhuan/erban/ui/wallet/WalletFragmentPagerAdapter.java deleted file mode 100644 index c51d06c7d..000000000 --- a/app/src/main/java/com/yizhuan/erban/ui/wallet/WalletFragmentPagerAdapter.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.yizhuan.erban.ui.wallet; - -import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentManager; -import androidx.fragment.app.FragmentPagerAdapter; -import android.view.ViewGroup; - -import java.util.ArrayList; - - -class WalletFragmentPagerAdapter extends FragmentPagerAdapter { - private ArrayList fragmentsList; - - WalletFragmentPagerAdapter(FragmentManager fm, ArrayList fragmentsList) { - super(fm); - this.fragmentsList = fragmentsList; - } - - @Override - public Fragment getItem(int position) { - return fragmentsList.get(position); - } - - @Override - public int getCount() { - return fragmentsList.size(); - } - - - @Override - public void destroyItem(ViewGroup container, int position, Object object) { - super.destroyItem(container, position, object); - } - -} diff --git a/app/src/main/java/com/yizhuan/erban/ui/wallet/WalletGoldActivity.java b/app/src/main/java/com/yizhuan/erban/ui/wallet/WalletGoldActivity.java deleted file mode 100644 index 3de7c701f..000000000 --- a/app/src/main/java/com/yizhuan/erban/ui/wallet/WalletGoldActivity.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.yizhuan.erban.ui.wallet; - -import android.annotation.SuppressLint; -import android.app.Activity; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.Nullable; -import android.view.View; - -import com.netease.nim.uikit.StatusBarUtil; -import com.trello.rxlifecycle3.android.ActivityEvent; -import com.yizhuan.erban.R; -import com.yizhuan.erban.base.BaseBindingActivity; -import com.yizhuan.erban.databinding.ActivityWalletGoldBinding; -import com.yizhuan.erban.ui.login.BinderPhoneActivity; -import com.yizhuan.erban.ui.pay.ChargeActivity; -import com.yizhuan.erban.ui.setting.ModifyPwdActivity; -import com.yizhuan.erban.ui.wallet.sendgold.SendGoldActivity; -import com.yizhuan.erban.ui.webview.CommonWebViewActivity; -import com.yizhuan.xchat_android_core.UriProvider; -import com.yizhuan.xchat_android_core.auth.AuthModel; -import com.yizhuan.xchat_android_core.pay.PayModel; -import com.yizhuan.xchat_android_core.pay.bean.WalletInfo; -import com.yizhuan.xchat_android_core.pay.event.GetWalletInfoEvent; -import com.yizhuan.xchat_android_core.pay.event.UpdateWalletInfoEvent; -import com.yizhuan.xchat_android_core.statistic.StatisticManager; -import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol; -import com.yizhuan.xchat_android_core.user.UserModel; -import com.yizhuan.xchat_android_library.annatation.ActLayoutRes; - -import org.greenrobot.eventbus.EventBus; -import org.greenrobot.eventbus.Subscribe; -import org.greenrobot.eventbus.ThreadMode; - -import io.reactivex.SingleObserver; -import io.reactivex.disposables.Disposable; - -@ActLayoutRes(R.layout.activity_wallet_gold) -public class WalletGoldActivity extends BaseBindingActivity { - - private final int BINDCODE_GOLD = 200; - private boolean isBindPhone; - - @Override - public void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - EventBus.getDefault().register(this); - initTitleBar("我的钻石"); - } - - @Override - public void onDestroy() { - super.onDestroy(); - EventBus.getDefault().unregister(this); - } - - @Override - protected boolean needSteepStateBar() { - return true; - } - - @Override - protected void setStatusBar() { - super.setStatusBar(); - StatusBarUtil.transparencyBar(this); - StatusBarUtil.StatusBarLightMode(this); - } - - @Override - public void initTitleBar(String title) { - mTitleBar = mBinding.titleBar; - if (mTitleBar != null) { - mTitleBar.setTitle(title); - mTitleBar.setImmersive(true); - mTitleBar.setTitleColor(getResources().getColor(R.color.color_333333)); - mTitleBar.setLeftImageResource(R.drawable.arrow_left); - mTitleBar.setBackgroundColor(getResources().getColor(R.color.transparent)); - mTitleBar.setLeftClickListener(v -> finish()); - } - } - - @Override - protected void init() { - mBinding.btnWallGoldGive.setVisibility(View.GONE); - WalletInfo walletInfo = PayModel.get().getCurrentWalletInfo(); - if (walletInfo != null) { - mBinding.setWalletInfo(walletInfo); - mBinding.executePendingBindings(); - } - loadDiamondNum(); - mBinding.setClick(this); - } - - @Subscribe(threadMode = ThreadMode.MAIN) - public void onWalletInfoUpdate(UpdateWalletInfoEvent event) { - WalletInfo walletInfo = PayModel.get().getCurrentWalletInfo(); - if (walletInfo != null) - mBinding.setWalletInfo(walletInfo); - } - - @Subscribe(threadMode = ThreadMode.MAIN) - public void onGetWalletInfo(GetWalletInfoEvent event) { - WalletInfo walletInfo = PayModel.get().getCurrentWalletInfo(); - if (walletInfo != null) { - mBinding.setWalletInfo(walletInfo); - mBinding.btnWallGoldGive.setVisibility( - walletInfo.isSendGold() ? View.VISIBLE : View.GONE); - } - } - - @SuppressLint("CheckResult") - private void loadDiamondNum() { - PayModel.get().getWalletInfo(AuthModel.get().getCurrentUid()).subscribe(); - } - - @Override - public void onClick(View v) { - super.onClick(v); - switch (v.getId()) { - case R.id.btn_wall_gold_charge: - startActivity(new Intent(this, ChargeActivity.class)); - - StatisticManager.Instance().onEvent(context, - StatisticsProtocol.Event.EVENT_RECHARGE_CLICK, - "钻石充值", - null); - break; - - case R.id.btn_wall_gold_give: - SendGoldActivity.start(context); - break; - - case R.id.iv_gold_question: - CommonWebViewActivity.start(WalletGoldActivity.this, UriProvider.IM_SERVER_URL + "modules/nobles/faq.html?quesIndex=4"); - break; - - case R.id.tv_goto_change_gold: - AuthModel.get().isBindPhone() - .compose(bindUntilEvent(ActivityEvent.DESTROY)) - .subscribe(new SingleObserver() { - @Override - public void onSubscribe(Disposable d) { - - } - - @Override - public void onSuccess(String s) { - onBindPhone(); - } - - @Override - public void onError(Throwable e) { - onNoBindPhone(e.getMessage()); - } - }); - - break; - } - } - - @Override - public void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - if (requestCode == BINDCODE_GOLD && resultCode == Activity.RESULT_OK) { - isBindPhone = true; - ModifyPwdActivity.start(this, ModifyPwdActivity.FOGERT_PAY_PWD); - } - - } - - public void onBindPhone() { - mBinding.btnWallGoldCharge.setEnabled(true); - if (UserModel.get().getCacheLoginUserInfo() == null) { - return; - } - if (UserModel.get().getCacheLoginUserInfo().isBindPhone() && UserModel.get().getCacheLoginUserInfo().isBindPaymentPwd()) { - ExchangeGoldActivity.start(WalletGoldActivity.this); - } else { - ModifyPwdActivity.start(this, ModifyPwdActivity.FOGERT_PAY_PWD); - } - } - - public void onNoBindPhone(String error) { - mBinding.btnWallGoldCharge.setEnabled(true); - startActivityForResult(new Intent(this, BinderPhoneActivity.class), BINDCODE_GOLD); - } - -} diff --git a/app/src/main/java/com/yizhuan/erban/ui/wallet/WalletGoldFragment.java b/app/src/main/java/com/yizhuan/erban/ui/wallet/WalletGoldFragment.java deleted file mode 100644 index b99217aa3..000000000 --- a/app/src/main/java/com/yizhuan/erban/ui/wallet/WalletGoldFragment.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.yizhuan.erban.ui.wallet; - -import android.annotation.SuppressLint; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.Nullable; - -import com.yizhuan.erban.R; -import com.yizhuan.erban.base.BaseBindingFragment; -import com.yizhuan.erban.databinding.FragmentWalletGoldBinding; -import com.yizhuan.erban.ui.pay.ChargeActivity; -import com.yizhuan.erban.ui.webview.CommonWebViewActivity; -import com.yizhuan.xchat_android_core.UriProvider; -import com.yizhuan.xchat_android_core.auth.AuthModel; -import com.yizhuan.xchat_android_core.pay.PayModel; -import com.yizhuan.xchat_android_core.pay.bean.WalletInfo; -import com.yizhuan.xchat_android_core.pay.event.GetWalletInfoEvent; -import com.yizhuan.xchat_android_core.pay.event.UpdateWalletInfoEvent; -import com.yizhuan.xchat_android_library.annatation.ActLayoutRes; - -import org.greenrobot.eventbus.EventBus; -import org.greenrobot.eventbus.Subscribe; -import org.greenrobot.eventbus.ThreadMode; - - -/** - * 钻石页面 - * - * @author Administrator - * @date 2017/7/3 - */ - -@ActLayoutRes(R.layout.fragment_wallet_gold) -public class WalletGoldFragment extends BaseBindingFragment { - - @Override - public void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - EventBus.getDefault().register(this); - } - - @Override - public void onDestroy() { - super.onDestroy(); - EventBus.getDefault().unregister(this); - } - - @Override - public void initiate() { - WalletInfo walletInfo = PayModel.get().getCurrentWalletInfo(); - if (walletInfo != null) { - mBinding.setWalletInfo(walletInfo); - mBinding.executePendingBindings(); - } - loadDiamondNum(); - - mBinding.btnWallGoldCharge.setOnClickListener( - v -> startActivity(new Intent(getContext(), ChargeActivity.class))); - mBinding.ivWalletQuestion.setOnClickListener(v -> - CommonWebViewActivity.start(mContext, UriProvider.IM_SERVER_URL + "modules/nobles/faq.html?quesIndex=4")); - - } - - @Subscribe(threadMode = ThreadMode.MAIN) - public void onWalletInfoUpdate(UpdateWalletInfoEvent event) { - WalletInfo walletInfo = PayModel.get().getCurrentWalletInfo(); - if (walletInfo != null) - mBinding.setWalletInfo(walletInfo); - } - - @Subscribe(threadMode = ThreadMode.MAIN) - public void onGetWalletInfo(GetWalletInfoEvent event) { - WalletInfo walletInfo = PayModel.get().getCurrentWalletInfo(); - if (walletInfo != null) { - mBinding.setWalletInfo(walletInfo); - } - } - - @SuppressLint("CheckResult") - private void loadDiamondNum() { - PayModel.get().getWalletInfo(AuthModel.get().getCurrentUid()); - } - -} diff --git a/app/src/main/java/com/yizhuan/erban/ui/widget/RedPacketDialog.java b/app/src/main/java/com/yizhuan/erban/ui/widget/RedPacketDialog.java deleted file mode 100644 index bb4546580..000000000 --- a/app/src/main/java/com/yizhuan/erban/ui/widget/RedPacketDialog.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.yizhuan.erban.ui.widget; - -import android.animation.Animator; -import android.animation.AnimatorListenerAdapter; -import android.animation.ObjectAnimator; -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import android.view.View; -import android.view.Window; -import android.view.WindowManager; -import android.view.animation.AccelerateInterpolator; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.RelativeLayout; -import android.widget.TextView; - -import com.yizhuan.erban.R; -import com.yizhuan.erban.base.BaseActivity; -import com.yizhuan.erban.ui.wallet.RedBagActivity; -import com.yizhuan.erban.ui.wallet.WalletActivity; -import com.yizhuan.xchat_android_core.redPacket.bean.RedPacketInfoV2; - -/** - * @author chenran - * @date 2017/10/4 - */ - -public class RedPacketDialog extends BaseActivity implements View.OnClickListener{ - - private ImageView openRed; - private ImageView imgClose; - private ImageView checkDetail; - private TextView redMoney; - private TextView source; - private RelativeLayout openRedPacket; - private LinearLayout checkRedPacket; - private RedPacketInfoV2 redPacketInfo; - - private ObjectAnimator mObjectAnimator; - - public static void start(Context context, RedPacketInfoV2 redPacketInfoV2) { - Intent intent = new Intent(context, RedPacketDialog.class); - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - intent.putExtra("redPacketInfo", redPacketInfoV2); - context.startActivity(intent); - } - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - requestWindowFeature(Window.FEATURE_NO_TITLE); - getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); - setContentView(R.layout.red_packet_dialog); - redPacketInfo = (RedPacketInfoV2) getIntent().getSerializableExtra("redPacketInfo"); - initView(); - setListener(); - } - - private void setListener() { - imgClose.setOnClickListener(this); - openRed.setOnClickListener(this); - checkDetail.setOnClickListener(this); - } - - private void initView() { - openRedPacket = (RelativeLayout) findViewById(R.id.open_red_packet); - checkRedPacket = findViewById(R.id.check_red_packet); - openRed = (ImageView) findViewById(R.id.img_open); - imgClose = (ImageView) findViewById(R.id.img_close); - redMoney = (TextView) findViewById(R.id.tv_red_money); - checkDetail = (ImageView) findViewById(R.id.tv_look); - source = (TextView) findViewById(R.id.source); - - source.setText("收到" + redPacketInfo.getPacketName() + "红包"); - redMoney.setText(String.valueOf(redPacketInfo.getPacketNum())); - } - - @Override - public void onClick(View v) { - switch (v.getId()) { - case R.id.img_open: - startRedPacketAnim(v); - break; - case R.id.img_close: - finish(); - break; - case R.id.tv_look: - startActivity(new Intent(context, RedBagActivity.class)); - finish(); - break; - default: - } - } - - private void startRedPacketAnim(View v) { - v.setOnClickListener(null); - mObjectAnimator = ObjectAnimator.ofFloat(v, "rotationX", 0, 360, 720, 1080, 1540, 1900); - mObjectAnimator.setDuration(1000); - mObjectAnimator.setInterpolator(new AccelerateInterpolator()); - mObjectAnimator.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationEnd(Animator animation) { - super.onAnimationEnd(animation); - openRedPacket.setVisibility(View.INVISIBLE); - checkRedPacket.setVisibility(View.VISIBLE); - } - }); - mObjectAnimator.start(); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - if (mObjectAnimator != null) { - if (mObjectAnimator.isRunning()) { - mObjectAnimator.cancel(); - } - mObjectAnimator = null; - } - } -} diff --git a/app/src/main/java/com/yizhuan/erban/ui/widget/password/PassWordFragment.java b/app/src/main/java/com/yizhuan/erban/ui/widget/password/PassWordFragment.java index 0416f0020..1a180c0e9 100644 --- a/app/src/main/java/com/yizhuan/erban/ui/widget/password/PassWordFragment.java +++ b/app/src/main/java/com/yizhuan/erban/ui/widget/password/PassWordFragment.java @@ -20,7 +20,6 @@ import com.netease.nim.uikit.common.util.log.LogUtil; import com.yizhuan.erban.R; import com.yizhuan.erban.ui.setting.VerifyPhoneActivity; import com.yizhuan.erban.ui.wallet.ExchangeGoldActivity; -import com.yizhuan.erban.ui.wallet.RedPacketWithdrawActivity; import com.yizhuan.erban.ui.withdraw.WithdrawActivity; import com.yizhuan.xchat_android_library.utils.codec.DESUtils; @@ -43,7 +42,6 @@ public class PassWordFragment extends DialogFragment { private boolean isFullScreen; private ExchangeGoldActivity goldActivity; private WithdrawActivity withdrawActivity; - private RedPacketWithdrawActivity redPacketWithdrawActivity; private long value; private int hammerNum; /**用于标识密码类型*/ @@ -85,8 +83,6 @@ public class PassWordFragment extends DialogFragment { goldActivity = (ExchangeGoldActivity) activity; } else if (activity instanceof WithdrawActivity) { withdrawActivity = (WithdrawActivity) activity; - } else if (activity instanceof RedPacketWithdrawActivity) { - redPacketWithdrawActivity = (RedPacketWithdrawActivity) activity; } } @@ -167,8 +163,6 @@ public class PassWordFragment extends DialogFragment { goldActivity.commit(value, hammerNum, mPassword.getPassword()); } else if (withdrawActivity != null) { withdrawActivity.commit(mPassword.getPassword()); - } else if (redPacketWithdrawActivity != null) { - redPacketWithdrawActivity.commit(mPassword.getPassword()); } try { EventBus.getDefault().post(new PasswordEvent().setType(type) diff --git a/app/src/main/res/layout/activity_binder_phone.xml b/app/src/main/res/layout/activity_binder_phone.xml deleted file mode 100644 index 1e6e7d5a1..000000000 --- a/app/src/main/res/layout/activity_binder_phone.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - -