420版本
This commit is contained in:
@@ -11,6 +11,7 @@ import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -29,6 +30,7 @@ import cn.shangyu.gdxzExpert.pulltorefreshview.PullToRefreshListView;
|
||||
import cn.shangyu.gdxzExpert.utils.CommonUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.GsonTools;
|
||||
import cn.shangyu.gdxzExpert.utils.LogUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.MyUserIconUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.SharePrefUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.StringUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.ToastUtil;
|
||||
@@ -116,13 +118,18 @@ public class CoollectCourseActivity extends BaseActivity implements
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
|
||||
// TODO Auto-generated method stub
|
||||
Intent intent = new Intent(mActivity, CourseUrlDetailActivity.class);
|
||||
intent.putExtra("url", DataList.get(arg2-1).path);
|
||||
Log.d("gdxzfile ","url1 "+DataList.get(arg2-1).path);
|
||||
intent.putExtra("uuid", DataList.get(arg2-1).other_uuid);
|
||||
intent.putExtra("title", DataList.get(arg2-1).title);
|
||||
intent.putExtra("collect", "collect");
|
||||
this.startActivityForResult(intent, 201);
|
||||
// Intent intent = new Intent(mActivity, CourseUrlDetailActivity.class);
|
||||
// intent.putExtra("url", DataList.get(arg2-1).path);
|
||||
// Log.d("gdxzfile ","url1 "+DataList.get(arg2-1).path);
|
||||
// intent.putExtra("uuid", DataList.get(arg2-1).other_uuid);
|
||||
// intent.putExtra("title", DataList.get(arg2-1).title);
|
||||
// intent.putExtra("collect", "collect");
|
||||
// this.startActivityForResult(intent, 201);
|
||||
com.alibaba.fastjson.JSONObject pageParams = new JSONObject();
|
||||
pageParams.put("src", DataList.get(arg2-1).path);
|
||||
pageParams.put("uuid", DataList.get(arg2-1).other_uuid);
|
||||
pageParams.put("from", "collect");
|
||||
MyUserIconUtil.showUniMp(mActivity, "/pages_app/pptDetail/pptDetail", pageParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -275,9 +275,6 @@ public class MainActivity extends BaseActivity implements
|
||||
|
||||
private static Handler handler;
|
||||
|
||||
//自动触发打开 uniapp mp 开关
|
||||
private boolean auto_show_unimp = true;
|
||||
|
||||
// 全屏Loading覆盖层
|
||||
private View fullScreenLoadingView;
|
||||
|
||||
@@ -472,7 +469,7 @@ public class MainActivity extends BaseActivity implements
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
MyUserIconUtil.showUniMp(MainActivity.this, "/pages_app/patientVideo/patientVideo");
|
||||
MyUserIconUtil.showUniMp(MainActivity.this, "/pages_app/patientVideo/patientVideo", null);
|
||||
// startActivity(new Intent(ct,PatientVideoActivity.class));
|
||||
}
|
||||
});
|
||||
@@ -590,6 +587,11 @@ public class MainActivity extends BaseActivity implements
|
||||
sendJsonPostParamtoNetSignMD5(getShowMagazine,param,666,this);
|
||||
}
|
||||
|
||||
private void getAccessToken(){
|
||||
Map<String, String> param = new HashMap<>();
|
||||
sendJsonPostParamtoNetSignMD5(getAccessToken, param, ACCESS_TOKEN,this);
|
||||
}
|
||||
|
||||
private void registerSystemObserver(boolean register) {
|
||||
NIMClient.getService(MsgServiceObserve.class).observeCustomNotification(
|
||||
customNotificationObserver, register);
|
||||
@@ -864,12 +866,7 @@ public class MainActivity extends BaseActivity implements
|
||||
sendJsonPostParamtoNetSignMD5(Url.getIsAccount,map,GETISACCOUNT,this);
|
||||
sendJsonPostParamtoNetSignMD5(Url.getGray,map,222,this);
|
||||
sendJsonPostParamtoNetSignMD5(Url.checkUser,map,333,this);
|
||||
|
||||
String access_token = SharePrefUtil.getString(MainActivity.this, "access_token", "");
|
||||
if(StringUtil.isEmpty(access_token)){
|
||||
Map<String, String> param = new HashMap<>();
|
||||
sendJsonPostParamtoNetSignMD5(getAccessToken, param, ACCESS_TOKEN,this);
|
||||
}
|
||||
// sendJsonPostParamtoNetSignMD5(getAccessToken, param, ACCESS_TOKEN,this);
|
||||
}
|
||||
|
||||
private void getGray() {
|
||||
@@ -1182,7 +1179,8 @@ public class MainActivity extends BaseActivity implements
|
||||
|
||||
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
||||
|
||||
auto_show_unimp = true;
|
||||
BaseApplication.auto_show_unimp = true;
|
||||
|
||||
/** 改变文字的颜色 */
|
||||
if (badgeSysMsg != null) {
|
||||
badgeSysMsg.hide();
|
||||
@@ -1355,6 +1353,7 @@ public class MainActivity extends BaseActivity implements
|
||||
|
||||
showUniMp(true);
|
||||
|
||||
|
||||
} else if (checkedId == R.id.tab_rbn_my) {
|
||||
mToolbar.setBackgroundColor(getResources().getColor(R.color.top_bg));
|
||||
mToolbar.getBackground().setAlpha(255);
|
||||
@@ -1383,10 +1382,8 @@ public class MainActivity extends BaseActivity implements
|
||||
// iv_yindao1.setBackgroundResource(R.drawable.yindao3);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
current_tab_id = checkedId;
|
||||
|
||||
}
|
||||
|
||||
OnCheckedChangeListener mKPCheckListener = new OnCheckedChangeListener() {
|
||||
@@ -1422,8 +1419,7 @@ public class MainActivity extends BaseActivity implements
|
||||
sendJsonPostParamtoNetSignMD5(getAccessToken, param, ACCESS_TOKEN,this);
|
||||
}
|
||||
|
||||
MyUserIconUtil.showUniMp(MainActivity.this, "/pages/live/live");
|
||||
|
||||
MyUserIconUtil.showUniMp(MainActivity.this, "/pages/live/live", null);
|
||||
if(showLoading) {
|
||||
hideFullScreenLoading();
|
||||
}
|
||||
@@ -2075,11 +2071,26 @@ public class MainActivity extends BaseActivity implements
|
||||
protected void onResume() {
|
||||
|
||||
LogUtil.i("onResume: ", current_tab_id+"");
|
||||
if(current_tab_id == R.id.tab_rbn_donation && auto_show_unimp){
|
||||
showUniMp(true);
|
||||
if(current_tab_id == R.id.tab_rbn_donation && BaseApplication.auto_show_unimp){
|
||||
long current_timestmp = System.currentTimeMillis();
|
||||
//防止无限循环打开
|
||||
if(current_timestmp - BaseApplication.auto_show_unimp_timestamp > 1.5 * 1000){
|
||||
BaseApplication.auto_show_unimp_timestamp = current_timestmp;
|
||||
showUniMp(true);
|
||||
}else{
|
||||
//触发错误次数
|
||||
BaseApplication.auto_show_unimp_error_times ++;
|
||||
//错误次数大于5,则关闭小程序
|
||||
if(BaseApplication.auto_show_unimp_error_times > 5){
|
||||
MyUserIconUtil.closeUniMP();
|
||||
BaseApplication.auto_show_unimp_error_times = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.onResume();
|
||||
ShowMagazine();
|
||||
getAccessToken();
|
||||
if(!needshowGuideView()&&order>0)
|
||||
{
|
||||
getGroup();
|
||||
@@ -2089,14 +2100,11 @@ public class MainActivity extends BaseActivity implements
|
||||
boolean fullExit = ECPreferences.getSharedPreferences().getBoolean(
|
||||
ECPreferenceSettings.SETTINGS_FULLY_EXIT.getId(), false);
|
||||
if (fullExit) {
|
||||
|
||||
|
||||
// 1登入系统 2退出系统 3专家客户端在手机前台运行 4.专家客户端在手机后台运行
|
||||
BaseActivity.foreBack(mMainActivity, 2);
|
||||
finish();
|
||||
android.os.Process.killProcess(android.os.Process.myPid());
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
String account = getAutoRegistAccount();
|
||||
@@ -2117,7 +2125,6 @@ public class MainActivity extends BaseActivity implements
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 统计未读消息
|
||||
@@ -2661,6 +2668,7 @@ public class MainActivity extends BaseActivity implements
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCallBackFromThread(String resultJson, int resultCode) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
@@ -114,14 +114,18 @@ public class MyDownLoadsActivity extends BaseActivity{
|
||||
mRl_2.setVisibility(View.VISIBLE);
|
||||
mRl_3.setVisibility(View.VISIBLE);
|
||||
mRl_4.setVisibility(View.VISIBLE);
|
||||
mRl_5.setVisibility(View.VISIBLE);
|
||||
mV_line1.setVisibility(View.VISIBLE);
|
||||
mV_line2.setVisibility(View.VISIBLE);
|
||||
mV_line3.setVisibility(View.VISIBLE);
|
||||
mV_line4.setVisibility(View.VISIBLE);
|
||||
mV_line5.setVisibility(View.VISIBLE);
|
||||
|
||||
mTv_title1.setText("诊疗指南");
|
||||
mTv_title2.setText("期刊杂志");
|
||||
mTv_title3.setText("课件文档");
|
||||
mTv_title4.setText("诊疗指南(新)");
|
||||
mTv_title5.setText("课件文档(新)");
|
||||
if(SharePrefUtil.getBoolean(this, Constant.ShowMagazine,true))
|
||||
{
|
||||
}
|
||||
@@ -210,13 +214,14 @@ public class MyDownLoadsActivity extends BaseActivity{
|
||||
} else if (id == R.id.rl_4) {
|
||||
if (isDownLoad) {
|
||||
//跳到uniapp 的缓存页面
|
||||
MyUserIconUtil.showUniMp(MyDownLoadsActivity.this, "/pages_app/zhinanDownload/zhinanDownload");
|
||||
MyUserIconUtil.showUniMp(MyDownLoadsActivity.this, "/pages_app/zhinanDownload/zhinanDownload", null);
|
||||
} else {
|
||||
startActivity(new Intent(mActivity, CoollectVideoActivity.class).putExtra("name",mTv_title4.getText().toString()));
|
||||
}
|
||||
} else if (id == R.id.rl_5) {
|
||||
if (isDownLoad) {
|
||||
|
||||
//跳到uniapp 的缓存页面
|
||||
MyUserIconUtil.showUniMp(MyDownLoadsActivity.this, "/pages_app/pptDownload/pptDownload", null);
|
||||
} else {
|
||||
startActivity(new Intent(mActivity, CoollectCourseActivity.class));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package cn.shangyu.gdxzExpert.activity;
|
||||
|
||||
import cn.shangyu.gdxzExpert.application.BaseApplication;
|
||||
import cn.shangyu.gdxzExpert.utils.MyUserIconUtil;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
@@ -28,6 +31,7 @@ public class PublicConsultationActivity extends BaseActivity implements RadioGro
|
||||
public void setTitle() {
|
||||
top_title.setText("公益咨询");
|
||||
top_back_layout.setVisibility(View.VISIBLE);
|
||||
top_back_layout.setOnClickListener(this);
|
||||
top_right_text.setVisibility(View.GONE);
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
@@ -35,6 +39,11 @@ public class PublicConsultationActivity extends BaseActivity implements RadioGro
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateSuccessedView() {
|
||||
ImmersionBar.with(this).keyboardEnable(true).statusBarDarkFont(true).titleBar(mToolbar).init();
|
||||
@@ -52,7 +61,12 @@ public class PublicConsultationActivity extends BaseActivity implements RadioGro
|
||||
rg_question = (RadioGroup) view.findViewById(R.id.rg_question);
|
||||
rb_question1 = (RadioButton) view.findViewById(R.id.rb_question1);
|
||||
rb_question2 = (RadioButton) view.findViewById(R.id.rb_question2);
|
||||
rg_question.setOnCheckedChangeListener(this);
|
||||
|
||||
//uniapp 使用
|
||||
rb_question1.setOnClickListener(this);
|
||||
rb_question2.setOnClickListener(this);
|
||||
//原生使用
|
||||
// rg_question.setOnCheckedChangeListener(this);
|
||||
OneToOne();
|
||||
return view;
|
||||
}
|
||||
@@ -80,11 +94,6 @@ public class PublicConsultationActivity extends BaseActivity implements RadioGro
|
||||
return LoadingPage.ResultState.STATE_SUCCESSED;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void processClick(View v) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
||||
switch (checkedId) {
|
||||
@@ -115,9 +124,41 @@ public class PublicConsultationActivity extends BaseActivity implements RadioGro
|
||||
{
|
||||
rb_question1.setTextColor(getResources().getColor(R.color.tab_text_nor));
|
||||
}
|
||||
|
||||
MoreToOne();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
processClick(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void processClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
switch (v.getId()) {
|
||||
case R.id.top_back_layout:
|
||||
finish();
|
||||
break;
|
||||
case R.id.rb_question1:
|
||||
OneToOne();
|
||||
rb_question1.setBackgroundColor(getResources().getColor(R.color.doctor_theme));
|
||||
rb_question1.setTextColor(getResources().getColor(R.color.white));
|
||||
rb_question2.setBackgroundColor(getResources().getColor(R.color.white));
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
rb_question2.setTextColor(getResources().getColor(R.color.c333333));
|
||||
}
|
||||
else
|
||||
{
|
||||
rb_question2.setTextColor(getResources().getColor(R.color.tab_text_nor));
|
||||
}
|
||||
break;
|
||||
case R.id.rb_question2:
|
||||
MyUserIconUtil.showUniMp(this, "/pages_app/consult/consult", null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,647 @@
|
||||
package cn.shangyu.gdxzExpert.activity;
|
||||
|
||||
import static cn.shangyu.gdxzExpert.utils.Constant.uniapp_mp_appid;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog.Builder;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
import com.pingplusplus.android.Pingpp;
|
||||
import com.tencent.mm.opensdk.modelpay.PayReq;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.application.BaseApplication;
|
||||
import cn.shangyu.gdxzExpert.base.BaseActivity;
|
||||
import cn.shangyu.gdxzExpert.bean.PayWechatBean;
|
||||
import cn.shangyu.gdxzExpert.http.OnCallBackFromNet;
|
||||
import cn.shangyu.gdxzExpert.utils.Constant;
|
||||
import cn.shangyu.gdxzExpert.utils.GsonTools;
|
||||
import cn.shangyu.gdxzExpert.utils.LogUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.OneClickUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.SharePrefUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.StringUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.ToastUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
import cn.shangyu.gdxzExpert.widget.ECAlertDialog;
|
||||
import cn.shangyu.gdxzExpert.widget.LoadingPage.ResultState;
|
||||
import io.dcloud.feature.sdk.Interface.IUniMP;
|
||||
|
||||
public class UniappPayCourseActivity extends BaseActivity implements OnCallBackFromNet,
|
||||
OnCheckedChangeListener {
|
||||
private Intent getintent;
|
||||
private View view;
|
||||
private Button mBt_pay;
|
||||
private UniappPayCourseActivity mActivity;
|
||||
private CheckBox mCb_balance, mCb_zhifubao, mCb_weixin, mCb_yinlian;
|
||||
private LinearLayout mLl_balance, mLl_zhifubao, mLl_weixin, mLl_yinlian;
|
||||
private String CHANNEL_ZHIFUBAO = "alipay";
|
||||
private String CHANNEL_WEIXIN = "wx";
|
||||
private String CHANNEL_YINLAN = "upacp";
|
||||
|
||||
private String payChannel = "0";
|
||||
private String pay_money;
|
||||
private String order_id;
|
||||
private TextView mTv_pay_money, mTv_pay_yue, mTv_monet_enough;
|
||||
private String uuid;
|
||||
private double pay;
|
||||
private boolean NoMoney = false;
|
||||
// private boolean isDetail = false;
|
||||
private boolean paySUCCESS = false;
|
||||
private TextView mTv_pay_name,mTv_pay_type;
|
||||
@Override
|
||||
public void setTitle() {
|
||||
// TODO Auto-generated method stub
|
||||
top_title.setText("课件在线支付");
|
||||
pay_money = getIntent().getStringExtra("money");
|
||||
order_id = getIntent().getStringExtra("order_id");
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateSuccessedView() {
|
||||
// TODO Auto-generated method stub
|
||||
mActivity = this;
|
||||
ImmersionBar.with(this).keyboardEnable(true).statusBarDarkFont(true).titleBar(mToolbar).init();
|
||||
view = UIUtils.inflate(R.layout.uniapp_activity_pay);
|
||||
top_back_layout = (RelativeLayout) findViewById(R.id.top_back_layout);
|
||||
mBt_pay = (Button) view.findViewById(R.id.bt_pay);
|
||||
mCb_balance = (CheckBox) view.findViewById(R.id.cb_pay_balance);
|
||||
mCb_zhifubao = (CheckBox) view.findViewById(R.id.cb_pay_zhifubao);
|
||||
mCb_weixin = (CheckBox) view.findViewById(R.id.cb_pay_weixin);
|
||||
mCb_yinlian = (CheckBox) view.findViewById(R.id.cb_pay_yinlian);
|
||||
mLl_balance = (LinearLayout) view.findViewById(R.id.ll_pay_balance);
|
||||
mLl_zhifubao = (LinearLayout) view.findViewById(R.id.ll_pay_zhifubao);
|
||||
mLl_weixin = (LinearLayout) view.findViewById(R.id.ll_pay_weixin);
|
||||
mLl_yinlian = (LinearLayout) view.findViewById(R.id.ll_pay_yinlian);
|
||||
mTv_pay_money = (TextView) view.findViewById(R.id.tv_pay_money);
|
||||
mTv_monet_enough = (TextView) view.findViewById(R.id.tv_money_enough);
|
||||
mTv_pay_yue = (TextView) view.findViewById(R.id.tv_yue);
|
||||
uuid = SharePrefUtil.getString(mActivity, "uuid", "");
|
||||
mTv_pay_name=(TextView) view.findViewById(R.id.pay_name);
|
||||
mTv_pay_type=(TextView) view.findViewById(R.id.pay_type);
|
||||
mTv_pay_type.setText("课件");
|
||||
initIntent();
|
||||
initListener();
|
||||
getUserResult();
|
||||
return view;
|
||||
}
|
||||
|
||||
private void initIntent() {
|
||||
// TODO Auto-generated method stub
|
||||
pay_money = getIntent().getStringExtra("money");
|
||||
order_id = getIntent().getStringExtra("order_id");
|
||||
String providername = getIntent().getStringExtra("providername");
|
||||
mTv_pay_name.setText("下载"+providername+"医生的");
|
||||
pay = Double.parseDouble(pay_money);
|
||||
mTv_pay_money.setText( (pay / 100) + "元");
|
||||
}
|
||||
|
||||
private void initListener() {
|
||||
// TODO Auto-generated method stub
|
||||
mBt_pay.setOnClickListener(this);
|
||||
mCb_balance.setOnCheckedChangeListener(this);
|
||||
mCb_zhifubao.setOnCheckedChangeListener(this);
|
||||
mCb_weixin.setOnCheckedChangeListener(this);
|
||||
mCb_yinlian.setOnCheckedChangeListener(this);
|
||||
mLl_balance.setOnClickListener(this);
|
||||
mLl_weixin.setOnClickListener(this);
|
||||
mLl_yinlian.setOnClickListener(this);
|
||||
mLl_zhifubao.setOnClickListener(this);
|
||||
top_back_layout.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
|
||||
// TODO Auto-generated method stub
|
||||
// AGP 8.0+ R.id 不再是 final 常量,不能用于 switch,改用 if-else
|
||||
int buttonId = buttonView.getId();
|
||||
if (buttonId == R.id.cb_pay_balance) {
|
||||
|
||||
if (isChecked) {
|
||||
payChannel = "balance";
|
||||
mCb_zhifubao.setChecked(false);
|
||||
mCb_weixin.setChecked(false);
|
||||
mCb_yinlian.setChecked(false);
|
||||
if (NoMoney) {
|
||||
payChannel = "0";
|
||||
}
|
||||
}else
|
||||
{
|
||||
payChannel = "0";
|
||||
if(mCb_weixin.isChecked())
|
||||
{
|
||||
payChannel = CHANNEL_WEIXIN;
|
||||
}
|
||||
|
||||
}
|
||||
if (NoMoney) {
|
||||
ToastUtil.showMessage("余额不足");
|
||||
mCb_balance.setChecked(false);
|
||||
}
|
||||
} else if (buttonId == R.id.cb_pay_zhifubao) {
|
||||
if (isChecked) {
|
||||
payChannel = CHANNEL_ZHIFUBAO;
|
||||
mCb_balance.setChecked(false);
|
||||
mCb_weixin.setChecked(false);
|
||||
mCb_yinlian.setChecked(false);
|
||||
}
|
||||
} else if (buttonId == R.id.cb_pay_weixin) {
|
||||
if (isChecked) {
|
||||
payChannel = CHANNEL_WEIXIN;
|
||||
mCb_balance.setChecked(false);
|
||||
mCb_zhifubao.setChecked(false);
|
||||
mCb_yinlian.setChecked(false);
|
||||
}else
|
||||
{
|
||||
payChannel = "0";
|
||||
if(mCb_balance.isChecked())
|
||||
{
|
||||
payChannel = "balance";
|
||||
}
|
||||
}
|
||||
} else if (buttonId == R.id.cb_pay_yinlian) {
|
||||
if (isChecked) {
|
||||
payChannel = CHANNEL_YINLAN;
|
||||
mCb_balance.setChecked(false);
|
||||
mCb_zhifubao.setChecked(false);
|
||||
mCb_weixin.setChecked(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultState onLoad() {
|
||||
// TODO Auto-generated method stub
|
||||
return ResultState.STATE_SUCCESSED;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void processClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
// AGP 8.0+ R.id 不再是 final 常量,不能用于 switch,改用 if-else
|
||||
int id = v.getId();
|
||||
if (id == R.id.bt_pay) {
|
||||
Log.d("WXEntryActivity",payChannel+" payChannel");
|
||||
if (!payChannel.equals("0")) {
|
||||
if(OneClickUtil.isFastDoubleClick(R.id.bt_pay,1500))
|
||||
{
|
||||
|
||||
return;
|
||||
}
|
||||
if (payChannel.equals("balance")) {
|
||||
sendMessageDialog();
|
||||
} else {
|
||||
getPayChargeResult("");
|
||||
}
|
||||
|
||||
} else {
|
||||
ToastUtil.showMessage("请选择支付方式");
|
||||
}
|
||||
} else if (id == R.id.ll_pay_balance) {
|
||||
payChannel = "balance";
|
||||
mCb_balance.setChecked(true);
|
||||
mCb_zhifubao.setChecked(false);
|
||||
mCb_weixin.setChecked(false);
|
||||
mCb_yinlian.setChecked(false);
|
||||
|
||||
if (NoMoney) {
|
||||
ToastUtil.showMessage("余额不足");
|
||||
mCb_balance.setChecked(false);
|
||||
}
|
||||
} else if (id == R.id.ll_pay_zhifubao) {
|
||||
|
||||
payChannel = CHANNEL_ZHIFUBAO;
|
||||
mCb_balance.setChecked(false);
|
||||
mCb_zhifubao.setChecked(true);
|
||||
mCb_weixin.setChecked(false);
|
||||
mCb_yinlian.setChecked(false);
|
||||
} else if (id == R.id.ll_pay_weixin) {
|
||||
|
||||
payChannel = CHANNEL_WEIXIN;
|
||||
mCb_balance.setChecked(false);
|
||||
mCb_zhifubao.setChecked(false);
|
||||
mCb_weixin.setChecked(true);
|
||||
mCb_yinlian.setChecked(false);
|
||||
} else if (id == R.id.ll_pay_yinlian) {
|
||||
|
||||
payChannel = CHANNEL_YINLAN;
|
||||
mCb_balance.setChecked(false);
|
||||
mCb_zhifubao.setChecked(false);
|
||||
mCb_weixin.setChecked(false);
|
||||
mCb_yinlian.setChecked(true);
|
||||
}else if(id == R.id.top_back_layout){
|
||||
IUniMP uniapp_MP_cash = BaseApplication.getUniMPCaches().get(uniapp_mp_appid);
|
||||
if(uniapp_MP_cash != null && uniapp_MP_cash.isRunning()){
|
||||
uniapp_MP_cash.showUniMP();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final int GET_CREATE_ORDER_RESULT = 101;
|
||||
public static final int GET_USER_DATA_RESULT = 201;
|
||||
public static final int GET_PAYR_SUCCESS_RESULT = 301;
|
||||
|
||||
// public void getPayResult() {
|
||||
// String uuid = SharePrefUtil.getString(ct, Constant.USERID, "");
|
||||
// Map<String, String> param = new HashMap<String, String>();
|
||||
// param.put("uid", uuid);
|
||||
// param.put("amount", 1 + "");
|
||||
// param.put("subject", "dasdkljh");
|
||||
// param.put("body", "asdasd");
|
||||
// sendParamtoNet(Url.getCreateOrder, param, GET_CREATE_ORDER_RESULT,
|
||||
// mActivity, true);
|
||||
// }
|
||||
|
||||
public void getPayChargeResult(String password) {
|
||||
Map<String, String> param = new HashMap<String, String>();
|
||||
// param.put("amount", pay_money);
|
||||
param.put("trade_no", order_id);
|
||||
// param.put("expert_uuid", uuid);
|
||||
if (payChannel.equals("balance")) {
|
||||
param.put("pwd", password);
|
||||
}
|
||||
param.put("channel", payChannel);
|
||||
if (CHANNEL_YINLAN.equals(payChannel)){
|
||||
ToastUtil.showMessage("暂不支持");
|
||||
}else {
|
||||
sendJsonPostParamtoNetSignMD5(Url.getPayGanDanFileOrder, param, GET_CREATE_ORDER_RESULT, this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void getUserResult() {
|
||||
Map<String, String> param = new HashMap<String, String>();
|
||||
// param.put("user_uuid", uuid);
|
||||
|
||||
sendJsonPostParamtoNetSignMD5(Url.getRetrieveUser, param, GET_USER_DATA_RESULT,
|
||||
this);
|
||||
}
|
||||
|
||||
// 完成订单
|
||||
public void getPaySucceedResult() {
|
||||
Map<String, String> param = new HashMap<String, String>();
|
||||
param.put("order_id", order_id);
|
||||
sendParamtoNet(Url.getPayGanDanFileOrderSucceed, param,
|
||||
GET_PAYR_SUCCESS_RESULT, mActivity, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCallbackFromThread(String resultJson) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCallBackFromThread(String resultJson, int resultCode) {
|
||||
// TODO Auto-generated method stub
|
||||
Log.d("WXEntryActivity",resultCode+" "+resultJson);
|
||||
switch (resultCode) {
|
||||
case 102:
|
||||
try {
|
||||
JSONObject jsonObject=new JSONObject(resultJson);
|
||||
if("200".equals(jsonObject.getString("code")))
|
||||
{
|
||||
if("SUCCESS".equals(jsonObject.getJSONObject("data").getString("tradeState")))
|
||||
{
|
||||
Constant.WePayed=true;
|
||||
aaa();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
break;
|
||||
case GET_USER_DATA_RESULT:
|
||||
// System.out.println("resultJson++ 余额 === "+resultJson);
|
||||
// RetrieveUser bean = GsonTools.fromGsonToBean(resultJson,
|
||||
// RetrieveUser.class);
|
||||
// double yue = Double.parseDouble(bean.getAvailableBalance());
|
||||
double yue = 0.0;
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject(resultJson);
|
||||
if (!"200".equals(jsonObject.getString("code"))) {
|
||||
ToastUtil.showMessage(jsonObject.getString("msg"));
|
||||
return;
|
||||
}
|
||||
yue = jsonObject.getDouble("data");
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
mTv_pay_yue.setText("余额支付¥" + String.format("%.2f", yue / 100));
|
||||
if (pay > yue) {
|
||||
NoMoney = true;
|
||||
mTv_monet_enough.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mTv_monet_enough.setVisibility(View.INVISIBLE);
|
||||
|
||||
}
|
||||
|
||||
// if (bean.code != null && bean.code.equals("1")) {
|
||||
// ToastUtil.showMessage(bean.message);
|
||||
// return;
|
||||
// }
|
||||
break;
|
||||
case GET_CREATE_ORDER_RESULT:
|
||||
if(payChannel.equals("balance"))
|
||||
{
|
||||
try {
|
||||
JSONObject jsonObject=new JSONObject(resultJson);
|
||||
if("200".equals(jsonObject.getString("code")))
|
||||
{
|
||||
Constant.WePayed=true;
|
||||
aaa();
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ToastUtil.showToast(jsonObject.getString("msg"));
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
PayWechatBean payBean= GsonTools.fromGsonToBean(resultJson,
|
||||
PayWechatBean.class);
|
||||
if(payBean!=null&&"200".equals(payBean.getCode()))
|
||||
{
|
||||
PayReq request = new PayReq();
|
||||
request.appId = payBean.getData().getAppid();
|
||||
request.partnerId = payBean.getData().getPartnerid();
|
||||
request.prepayId= payBean.getData().getPrepayid();
|
||||
request.packageValue = payBean.getData().getPackage_str();
|
||||
request.nonceStr= payBean.getData().getNoncestr();
|
||||
request.timeStamp= payBean.getData().getTimestamp();
|
||||
request.sign=payBean.getData().getSign();
|
||||
api.sendReq(request);
|
||||
// Log.d("WXEntryActivity","pay "+pay);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ToastUtil.showToast(payBean.getMessage());
|
||||
}
|
||||
// if (payChannel.equals("")) {
|
||||
// if ("\"SUCCEED\"".equals(resultJson)) {
|
||||
// getPaySucceedResult();
|
||||
// } else if("\"密码错误\"".equals(resultJson)) {
|
||||
// ToastUtil.showMessage("密码错误");
|
||||
// }else{
|
||||
// ToastUtil.showMessage("支付失败");
|
||||
// }
|
||||
//
|
||||
// } else {
|
||||
// String result = StringEscapeUtils.unescapeJava(resultJson);
|
||||
// if (!StringUtil.isEmpty(result)) {
|
||||
// String sssss = result.substring(1, result.length() - 1);
|
||||
// Pingpp.createPayment(PayCourseActivity.this, sssss);
|
||||
// } else {
|
||||
// ToastUtil.showMessage("服务器异常");
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
break;
|
||||
case GET_PAYR_SUCCESS_RESULT:
|
||||
if ("\"SUCCEED\"".equals(resultJson)) {
|
||||
ToastUtil.showMessage("支付成功");
|
||||
paySUCCESS = true;
|
||||
aaa();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private ECAlertDialog buildAlert;
|
||||
|
||||
public void aaa() {
|
||||
if(payChannel.equals("balance"))
|
||||
{
|
||||
needreportPays("order_gdfile_download",0+"","分",1+"",getIntent().getStringExtra("title"),getIntent().getStringExtra("getTags"),"肝胆课件");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
int nnum= (int)pay;
|
||||
needreportPays("order_gdfile_download",nnum+"","分",1+"",getIntent().getStringExtra("title"),getIntent().getStringExtra("getTags"),"肝胆课件");
|
||||
|
||||
|
||||
}
|
||||
buildAlert = ECAlertDialog.buildAlert(mActivity, "支付成功",
|
||||
null, "确定", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
LogUtil.i("paySucess", "111");
|
||||
|
||||
|
||||
// TODO Auto-generated method stub
|
||||
buildAlert.dismiss();
|
||||
}
|
||||
}, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
LogUtil.i("paySucess", "222");
|
||||
|
||||
IUniMP uniapp_MP_cash = BaseApplication.getUniMPCaches().get(uniapp_mp_appid);
|
||||
if(uniapp_MP_cash != null && uniapp_MP_cash.isRunning()){
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
try {
|
||||
jsonObject.put("order_id", order_id);
|
||||
jsonObject.put("type", "GandanFile");
|
||||
} catch (JSONException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
uniapp_MP_cash.sendUniMPEvent("paySuccess", jsonObject);
|
||||
uniapp_MP_cash.showUniMP();
|
||||
}
|
||||
|
||||
mActivity.finish();
|
||||
buildAlert.dismiss();
|
||||
|
||||
}
|
||||
});
|
||||
buildAlert.setTitle("提示");
|
||||
buildAlert.setTitleColor(mActivity.getResources().getColor(
|
||||
R.color.top_title));
|
||||
buildAlert.setCanceledOnTouchOutside(false);
|
||||
buildAlert.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
// TODO Auto-generated method stub
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == Pingpp.REQUEST_CODE_PAYMENT) {
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
String result = data.getExtras().getString("pay_result");
|
||||
if (result.equals("success")) {
|
||||
getPaySucceedResult();
|
||||
}
|
||||
// 处理返回值
|
||||
// "success" - 支付成功
|
||||
// "fail" - 支付失败
|
||||
// "cancel" - 取消支付
|
||||
// "invalid" - 支付插件未安装(一般是微信客户端未安装的情况)
|
||||
String errorMsg = data.getExtras().getString("error_msg"); // 错误信息
|
||||
String extraMsg = data.getExtras().getString("extra_msg"); // 错误信息
|
||||
// showMsg(result, errorMsg, extraMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void showMsg(String title, String msg1, String msg2) {
|
||||
String str = title;
|
||||
if (null != msg1 && msg1.length() != 0) {
|
||||
str += "\n" + msg1;
|
||||
}
|
||||
if (null != msg2 && msg2.length() != 0) {
|
||||
str += "\n" + msg2;
|
||||
}
|
||||
Builder builder = new Builder(this);
|
||||
builder.setMessage(str);
|
||||
builder.setTitle("提示");
|
||||
builder.setPositiveButton("OK", null);
|
||||
builder.create().show();
|
||||
}
|
||||
|
||||
private Dialog dialog;
|
||||
EditText mEt_getpassword;
|
||||
|
||||
protected void sendMessageDialog() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
LayoutInflater inflater = LayoutInflater.from(mActivity);
|
||||
RelativeLayout layout = (RelativeLayout) inflater.inflate(
|
||||
R.layout.dialog_get_password, null);
|
||||
// 2. 新建对话框对象
|
||||
dialog = new Builder(mActivity,
|
||||
R.style.Theme_Light_FullScreenDialogAct).create();
|
||||
dialog.setCancelable(false);
|
||||
dialog.show();
|
||||
Window window =dialog.getWindow();
|
||||
// window.setGravity(Gravity.CENTER);
|
||||
WindowManager.LayoutParams layoutParams = window.getAttributes();
|
||||
layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
window.setAttributes(layoutParams);
|
||||
dialog.getWindow().setContentView(layout);
|
||||
// 只用下面这一行弹出对话框时需要点击输入框才能弹出软键盘
|
||||
dialog.getWindow().clearFlags(
|
||||
WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
|
||||
Button btn_cancel = (Button) layout.findViewById(R.id.dilaog_cancel);
|
||||
Button btn_sure = (Button) layout.findViewById(R.id.dilaog_sure);
|
||||
mEt_getpassword = (EditText) layout.findViewById(R.id.et_get_password);
|
||||
btn_cancel.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
hideSoftKeyboard(v);
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
btn_sure.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
String password = mEt_getpassword.getText().toString().trim();
|
||||
if (!StringUtil.isEmpty(password)) {
|
||||
getPayChargeResult(password);
|
||||
hideSoftKeyboard(v);
|
||||
dialog.dismiss();
|
||||
} else {
|
||||
ToastUtil.showMessage("请输入您的登陆密码");
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if(Constant.WePayed)
|
||||
{
|
||||
aaa();
|
||||
}
|
||||
else
|
||||
{
|
||||
getOrderStatus();
|
||||
}
|
||||
}
|
||||
private void getOrderStatus()
|
||||
{ if(order_id==null)
|
||||
{
|
||||
order_id=getIntent().getStringExtra("order_id");
|
||||
}
|
||||
Map<String, String> param = new HashMap<>();
|
||||
// param.put("trade_no","99361202930720");
|
||||
param.put("trade_no",order_id);
|
||||
Log.d("WXEntryActivity","orderId "+order_id);
|
||||
sendJsonPostParamtoNetSignMD5(Url.getOrderStatus,param,102,this);
|
||||
|
||||
}
|
||||
@Override
|
||||
public void finish() {
|
||||
// TODO Auto-generated method stub
|
||||
if (Constant.WePayed) {
|
||||
Log.d("WXEntryActivity","finish ");
|
||||
Intent intent = new Intent();
|
||||
setResult(201, intent);
|
||||
}
|
||||
super.finish();
|
||||
}
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
Constant.WePayed=false;
|
||||
super.onDestroy();
|
||||
}
|
||||
public void hideSoftKeyboard(View localView) {
|
||||
InputMethodManager inputMethodManager = (InputMethodManager) ct
|
||||
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (inputMethodManager != null) {
|
||||
// View localView = ((Activity) ct).getCurrentFocus();
|
||||
if (localView != null && localView.getWindowToken() != null) {
|
||||
IBinder windowToken = localView.getWindowToken();
|
||||
inputMethodManager.hideSoftInputFromWindow(windowToken, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user