lib_google
lib_huawei
This commit is contained in:
@@ -82,7 +82,6 @@ dependencies {
|
||||
//抽屉菜单
|
||||
implementation 'com.justkiddingbaby:slidemenu:1.3.0'
|
||||
implementation 'com.xj.marqueeView:marqueeView:0.1.20'
|
||||
implementation 'com.google.android.gms:play-services-auth:15.0.0'
|
||||
//引导层
|
||||
implementation 'com.binioter:guideview:1.0.0'
|
||||
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0'
|
||||
|
||||
@@ -47,12 +47,6 @@ import com.facebook.login.LoginResult;
|
||||
import com.fm.openinstall.OpenInstall;
|
||||
import com.fm.openinstall.listener.AppInstallAdapter;
|
||||
import com.fm.openinstall.model.AppData;
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignIn;
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignInClient;
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
|
||||
import com.google.android.gms.common.api.ApiException;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import com.linecorp.linesdk.Scope;
|
||||
import com.linecorp.linesdk.auth.LineAuthenticationParams;
|
||||
import com.linecorp.linesdk.auth.LineLoginApi;
|
||||
@@ -84,6 +78,7 @@ import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.manager.NoviceInstructorManager;
|
||||
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.GoogleUtils;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.http.LiveHttpUtil;
|
||||
@@ -96,6 +91,7 @@ import com.yunbao.main.http.MainHttpUtil;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
import org.json.JSONException;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
@@ -124,12 +120,13 @@ public class EntryActivity extends AppCompatActivity {
|
||||
private static boolean mShowInvite;//显示邀请码弹窗
|
||||
private static Context Contexts;
|
||||
private ImageView img_view;
|
||||
private GoogleSignInClient mGoogleSignInClient;
|
||||
private LinearLayout lt_btn_twitter, lt_btn_facebook, lt_customer;
|
||||
private String kefuUrl = "";
|
||||
private boolean mBtnClick = false;
|
||||
private Dialog loginLoadingDialog;
|
||||
|
||||
GoogleUtils googleUtils;
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void close(String str) {
|
||||
if ("close_login".equals(str)) {
|
||||
@@ -180,6 +177,9 @@ public class EntryActivity extends AppCompatActivity {
|
||||
IMLoginManager.get(this).logout(this);
|
||||
ToastUtil.show(R.string.login_invalid);
|
||||
}
|
||||
|
||||
googleUtils = new GoogleUtils(EntryActivity.this);
|
||||
|
||||
Get_hash_key();
|
||||
activity = this;
|
||||
Contexts = this;
|
||||
@@ -209,14 +209,14 @@ public class EntryActivity extends AppCompatActivity {
|
||||
btn_tip1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
WebViewActivity.forward(EntryActivity.this, HtmlConfig.LOGIN_PRIVCAY+ "&isZh=" + (WordUtil.isNewZh() ? "1" : "0"),false);
|
||||
WebViewActivity.forward(EntryActivity.this, HtmlConfig.LOGIN_PRIVCAY + "&isZh=" + (WordUtil.isNewZh() ? "1" : "0"), false);
|
||||
}
|
||||
});
|
||||
|
||||
btn_tip.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
WebViewActivity.forward(EntryActivity.this, HtmlConfig.LOGIN_PRIVCAY1+ "&isZh=" + (WordUtil.isNewZh() ? "1" : "0"),false);
|
||||
WebViewActivity.forward(EntryActivity.this, HtmlConfig.LOGIN_PRIVCAY1 + "&isZh=" + (WordUtil.isNewZh() ? "1" : "0"), false);
|
||||
|
||||
}
|
||||
});
|
||||
@@ -262,24 +262,23 @@ public class EntryActivity extends AppCompatActivity {
|
||||
return;
|
||||
}
|
||||
timerOutBtn(view);
|
||||
MainNetManager.get(EntryActivity.this)
|
||||
.FaceBookUp(new com.yunbao.common.http.base.HttpCallback<FaceBookUpModel>() {
|
||||
@Override
|
||||
public void onSuccess(FaceBookUpModel data) {
|
||||
if (data.getType().equals("0")) {
|
||||
LoginManager.getInstance().logInWithReadPermissions(EntryActivity.this, Arrays.asList("public_profile"));
|
||||
} else {
|
||||
WebViewActivity.forward(EntryActivity.this, data.getLink() + "?",false);
|
||||
}
|
||||
MainNetManager.get(EntryActivity.this).FaceBookUp(new com.yunbao.common.http.base.HttpCallback<FaceBookUpModel>() {
|
||||
@Override
|
||||
public void onSuccess(FaceBookUpModel data) {
|
||||
if (data.getType().equals("0")) {
|
||||
LoginManager.getInstance().logInWithReadPermissions(EntryActivity.this, Arrays.asList("public_profile"));
|
||||
} else {
|
||||
WebViewActivity.forward(EntryActivity.this, data.getLink() + "?", false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred");
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" : "i \\'m sorry! An error occurred");
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -300,7 +299,6 @@ public class EntryActivity extends AppCompatActivity {
|
||||
}
|
||||
});
|
||||
|
||||
googleLoginSet();
|
||||
twitterLoginSet();
|
||||
|
||||
btn_google.setOnClickListener(new View.OnClickListener() {
|
||||
@@ -310,8 +308,7 @@ public class EntryActivity extends AppCompatActivity {
|
||||
return;
|
||||
}
|
||||
timerOutBtn(v);
|
||||
Intent signInIntent = mGoogleSignInClient.getSignInIntent();
|
||||
startActivityForResult(signInIntent, 1002);
|
||||
startActivityForResult(googleUtils.getIntent(), 1002);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -365,13 +362,9 @@ public class EntryActivity extends AppCompatActivity {
|
||||
timerOutBtn(view);
|
||||
try {
|
||||
// App-to-app login
|
||||
Intent loginIntent = LineLoginApi.getLoginIntent(
|
||||
view.getContext(),
|
||||
"1656399535",
|
||||
new LineAuthenticationParams.Builder()
|
||||
.scopes(Arrays.asList(Scope.PROFILE))
|
||||
// .nonce("<a randomly-generated string>") // nonce can be used to improve security
|
||||
.build());
|
||||
Intent loginIntent = LineLoginApi.getLoginIntent(view.getContext(), "1656399535", new LineAuthenticationParams.Builder().scopes(Arrays.asList(Scope.PROFILE))
|
||||
// .nonce("<a randomly-generated string>") // nonce can be used to improve security
|
||||
.build());
|
||||
startActivityForResult(loginIntent, 1001);
|
||||
} catch (Exception e) {
|
||||
Log.e("ERROR", e.toString());
|
||||
@@ -388,7 +381,7 @@ public class EntryActivity extends AppCompatActivity {
|
||||
public void onClick(View v) {
|
||||
if (!"".equals(kefuUrl)) {
|
||||
Constants.LoginKefu = true;
|
||||
WebViewActivity.forward(EntryActivity.this, kefuUrl,false);
|
||||
WebViewActivity.forward(EntryActivity.this, kefuUrl, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -408,26 +401,10 @@ public class EntryActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
private void twitterLoginSet() {
|
||||
TwitterConfig config = new TwitterConfig.Builder(this)
|
||||
.logger(new DefaultLogger(Log.DEBUG))
|
||||
.twitterAuthConfig(new TwitterAuthConfig(getResources().getString(R.string.twitter_key), getResources().getString(R.string.twitter_secret)))
|
||||
.debug(true)
|
||||
.build();
|
||||
TwitterConfig config = new TwitterConfig.Builder(this).logger(new DefaultLogger(Log.DEBUG)).twitterAuthConfig(new TwitterAuthConfig(getResources().getString(R.string.twitter_key), getResources().getString(R.string.twitter_secret))).debug(true).build();
|
||||
Twitter.initialize(config);
|
||||
}
|
||||
|
||||
private void googleLoginSet() {
|
||||
//TODO Google登录
|
||||
//配置登录以请求用户的ID,电子邮件地址和基本配置文件.ID和基本配置文件包含在DEFAULT_SIGN_IN中.
|
||||
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
|
||||
.requestEmail()
|
||||
// .requestIdToken("AIzaSyDVnuGnQzjI_vDrxh20Hv_S1OMUD7Vp3zU")
|
||||
.build();
|
||||
//使用gso指定的选项构建一个GoogleSignInClient.
|
||||
mGoogleSignInClient = GoogleSignIn.getClient(this, gso);
|
||||
|
||||
}
|
||||
|
||||
private void requestPermission() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {//30
|
||||
// 先判断有没有权限
|
||||
@@ -481,8 +458,7 @@ public class EntryActivity extends AppCompatActivity {
|
||||
|
||||
}
|
||||
} else if (requestCode == 1002) {//google登录
|
||||
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
|
||||
handleSignInResult(task);
|
||||
handleSignInResult(data);
|
||||
} else {
|
||||
tt_login_button.onActivityResult(requestCode, resultCode, data);//twitter登录回调
|
||||
callbackManager.onActivityResult(requestCode, resultCode, data);//facebook登录回调
|
||||
@@ -491,22 +467,16 @@ public class EntryActivity extends AppCompatActivity {
|
||||
|
||||
}
|
||||
|
||||
private void handleSignInResult(Task<GoogleSignInAccount> completedTask) {
|
||||
private void handleSignInResult(Intent intent) {
|
||||
org.json.JSONObject jsonObject = googleUtils.getLoginResult(intent);
|
||||
try {
|
||||
GoogleSignInAccount account = completedTask.getResult(ApiException.class);
|
||||
//account里可以直接获取到ID,name,和头像
|
||||
String idToken = account.getIdToken();
|
||||
account.getFamilyName();
|
||||
account.getGivenName();
|
||||
|
||||
LoginData data = new LoginData();
|
||||
data.setAvatar("");
|
||||
data.setNickName(account.getDisplayName());
|
||||
data.setOpenID(account.getId());
|
||||
data.setNickName(jsonObject.getString("displayName"));
|
||||
data.setOpenID(jsonObject.getString("openId"));
|
||||
data.setType("google");
|
||||
|
||||
loginBuyThird(data);
|
||||
} catch (ApiException e) {
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
Log.i("Log", "ApiException = " + e);
|
||||
ToastUtil.show(getResources().getString(R.string.user_login_outtime));
|
||||
@@ -562,7 +532,7 @@ public class EntryActivity extends AppCompatActivity {
|
||||
Log.d("OpenInstall", "appData.getData()= " + appData.getData());
|
||||
//获取自定义数据
|
||||
if (appData.getData() != null && !appData.getData().equals("")) {
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == 1 || CommonAppConfig.IS_GOOGLE_PLAY == 2) {
|
||||
|
||||
} else {
|
||||
JSONObject data = JSON.parseObject(appData.getData());
|
||||
@@ -598,7 +568,7 @@ public class EntryActivity extends AppCompatActivity {
|
||||
*/
|
||||
private void loginBuyThird(LoginData data) {
|
||||
mLoginType = data.getType();
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == 1 || CommonAppConfig.IS_GOOGLE_PLAY == 2) {
|
||||
mPromoCode = "";
|
||||
}
|
||||
MainHttpUtil.loginByThird(UserID, data.getOpenID(), mPromoCode, mUuidDevice, data.getNickName(), data.getAvatar(), data.getType(), new HttpCallback() {
|
||||
@@ -646,33 +616,31 @@ public class EntryActivity extends AppCompatActivity {
|
||||
public void callback(UserBean bean) {
|
||||
|
||||
if (mFirstLogin) {
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == 1 || CommonAppConfig.IS_GOOGLE_PLAY == 2) {
|
||||
EntryActivity.this.startActivity(new Intent(EntryActivity.this, OneLoginActivity.class));
|
||||
} else {
|
||||
HttpClient.getInstance().post("Home.getRandJoinAnchor", "Home.getRandJoinAnchor")
|
||||
.execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (info[0] != null) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
IMLoginManager.get(EntryActivity.this).setNewUserGif(true);
|
||||
IMLoginManager.get(EntryActivity.this).setisNewUserOne(true);
|
||||
MainActivity.forward(EntryActivity.this, false);
|
||||
gotoLive(obj.getString("anchor_id"));
|
||||
if (obj.containsKey("home_zdy_img_us")) {
|
||||
home_zdy_img_us = obj.getString("home_zdy_img_us");
|
||||
home_zdy_img_cn = obj.getString("home_zdy_img_cn");
|
||||
}
|
||||
if (obj.containsKey("home_zdy_pop")) {
|
||||
NoviceInstructorManager.get(activity).setHomeZdyPop(obj.getString(
|
||||
"home_zdy_pop"));
|
||||
}
|
||||
|
||||
} else {
|
||||
MainActivity.forward(EntryActivity.this, false);
|
||||
}
|
||||
HttpClient.getInstance().post("Home.getRandJoinAnchor", "Home.getRandJoinAnchor").execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (info[0] != null) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
IMLoginManager.get(EntryActivity.this).setNewUserGif(true);
|
||||
IMLoginManager.get(EntryActivity.this).setisNewUserOne(true);
|
||||
MainActivity.forward(EntryActivity.this, false);
|
||||
gotoLive(obj.getString("anchor_id"));
|
||||
if (obj.containsKey("home_zdy_img_us")) {
|
||||
home_zdy_img_us = obj.getString("home_zdy_img_us");
|
||||
home_zdy_img_cn = obj.getString("home_zdy_img_cn");
|
||||
}
|
||||
});
|
||||
if (obj.containsKey("home_zdy_pop")) {
|
||||
NoviceInstructorManager.get(activity).setHomeZdyPop(obj.getString("home_zdy_pop"));
|
||||
}
|
||||
|
||||
} else {
|
||||
MainActivity.forward(EntryActivity.this, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
MainActivity.forward(EntryActivity.this, false);
|
||||
|
||||
@@ -15,27 +15,19 @@ import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import com.android.billingclient.api.Purchase;
|
||||
|
||||
import com.facebook.appevents.AppEventsConstants;
|
||||
import com.google.android.gms.ads.identifier.AdvertisingIdClient;
|
||||
import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
|
||||
import com.google.android.gms.common.GooglePlayServicesRepairableException;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.utils.GoogleBillingUtilNew;
|
||||
import com.yunbao.common.utils.GoogleUtils;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.main.R;
|
||||
import com.yunbao.main.views.TestWebViewClient;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
@SuppressLint("ValidFragment")
|
||||
public class GoogleFragment extends Fragment {
|
||||
|
||||
|
||||
private View view;
|
||||
public static String mOrderid, mProductId, MoneyUsds;
|
||||
|
||||
@@ -43,6 +35,8 @@ public class GoogleFragment extends Fragment {
|
||||
private String url;
|
||||
String adid = null;
|
||||
|
||||
GoogleUtils googleUtils;
|
||||
|
||||
public GoogleFragment() {
|
||||
}
|
||||
|
||||
@@ -55,33 +49,20 @@ public class GoogleFragment extends Fragment {
|
||||
assert getArguments() != null;
|
||||
url = getArguments().getString("url");
|
||||
|
||||
|
||||
if(StringUtil.isEmpty(url)){
|
||||
Log.e(TAG, "URL为空" );
|
||||
if (StringUtil.isEmpty(url)) {
|
||||
Log.e(TAG, "URL为空");
|
||||
return view;
|
||||
}
|
||||
rlWebview = (WebView) view.findViewById(R.id.rlWebview);
|
||||
Log.e("ttt", url);
|
||||
rlWebview.loadUrl(url);
|
||||
initGooglePay();
|
||||
new Thread(new Runnable() {
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
try {
|
||||
adid = AdvertisingIdClient.getAdvertisingIdInfo(getActivity()).getId();
|
||||
Log.e("vssss", adid);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (GooglePlayServicesNotAvailableException e) {
|
||||
e.printStackTrace();
|
||||
} catch (GooglePlayServicesRepairableException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
adid = googleUtils.getAdid();
|
||||
}
|
||||
}).start();
|
||||
}.start();
|
||||
WebSettings webSettings = rlWebview.getSettings();
|
||||
|
||||
webSettings.setDomStorageEnabled(true);
|
||||
@@ -95,7 +76,6 @@ public class GoogleFragment extends Fragment {
|
||||
webSettings.setSupportZoom(true); // 是否支持缩放
|
||||
webSettings.setBuiltInZoomControls(true); // 是否支持缩放变焦,前提是支持缩放
|
||||
|
||||
|
||||
rlWebview.addJavascriptInterface(new JsInteration(), "androidObject");
|
||||
|
||||
TestWebViewClient testWebViewClient = new TestWebViewClient(getActivity(), rlWebview);
|
||||
@@ -105,71 +85,64 @@ public class GoogleFragment extends Fragment {
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
String TAG = "GooglePay";
|
||||
|
||||
private void initGooglePay() {
|
||||
GoogleBillingUtilNew.getInstance().initGooglePay(getActivity());
|
||||
googleUtils = new GoogleUtils(getActivity());
|
||||
googleUtils.initGooglePay();
|
||||
}
|
||||
|
||||
|
||||
private Handler payHandler = new Handler();
|
||||
|
||||
//js调用原生
|
||||
public class JsInteration {
|
||||
|
||||
|
||||
@JavascriptInterface
|
||||
public void androidNewGoToGooglePay(String ProductId, String OrderNumber, String MoneyUsd) {
|
||||
Log.e(TAG, "ProductId" + ProductId + "OrderNumber" + OrderNumber + "MoneyUsd" + MoneyUsd);
|
||||
mProductId = ProductId;
|
||||
mOrderid = OrderNumber;
|
||||
MoneyUsds = MoneyUsd;
|
||||
// googleBillingUtil.purchaseInApp(getActivity(), mProductId);
|
||||
GoogleBillingUtilNew.getInstance().setBillingListener(new GoogleBillingUtilNew.GoogleBillingListener() {
|
||||
|
||||
googleUtils.setBillingListener(new GoogleUtils.GoogleBillingListener() {
|
||||
@Override
|
||||
public void onPaySuccess(List<Purchase> list) {
|
||||
for (Purchase purchase : list) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
int finalI = i;
|
||||
payHandler.post(new Runnable() {
|
||||
public void onPaySuccess(String token, String orderId) {
|
||||
payHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
CommonHttpUtil.notifyGoogle(token, orderId, mProductId, mOrderid, adid, new HttpCallback() {
|
||||
@Override
|
||||
public void run() {
|
||||
CommonHttpUtil.notifyGoogle(list.get(finalI).getPurchaseToken(), list.get(finalI).getOrderId(), mProductId, mOrderid, adid, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
Bundle params = new Bundle();
|
||||
params.putString("currency", "HKD");
|
||||
params.putString("money", MoneyUsds);
|
||||
Bundle fb_params = new Bundle();
|
||||
fb_params.putString(AppEventsConstants.EVENT_PARAM_CURRENCY, "HKD");
|
||||
fb_params.putString(AppEventsConstants.EVENT_PARAM_CONTENT_ID, mProductId);
|
||||
//Google官方充值通知
|
||||
Bundle google_params = new Bundle();
|
||||
google_params.putString("currency", "HKD");
|
||||
google_params.putString("product_id", mProductId);
|
||||
google_params.putString("transaction_id", mOrderid);
|
||||
google_params.putString("value", MoneyUsds);
|
||||
google_params.putString("price", MoneyUsds);
|
||||
google_params.putString("quantity", "1");
|
||||
dis();
|
||||
ToastUtil.show("支付成功");
|
||||
}
|
||||
}
|
||||
});
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
Bundle params = new Bundle();
|
||||
params.putString("currency", "HKD");
|
||||
params.putString("money", MoneyUsds);
|
||||
Bundle fb_params = new Bundle();
|
||||
fb_params.putString(AppEventsConstants.EVENT_PARAM_CURRENCY, "HKD");
|
||||
fb_params.putString(AppEventsConstants.EVENT_PARAM_CONTENT_ID, mProductId);
|
||||
//Google官方充值通知
|
||||
Bundle google_params = new Bundle();
|
||||
google_params.putString("currency", "HKD");
|
||||
google_params.putString("product_id", mProductId);
|
||||
google_params.putString("transaction_id", mOrderid);
|
||||
google_params.putString("value", MoneyUsds);
|
||||
google_params.putString("price", MoneyUsds);
|
||||
google_params.putString("quantity", "1");
|
||||
dis();
|
||||
ToastUtil.show("支付成功");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
Log.e("谷歌支付", purchase.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPayFailed(int code, String msg) {
|
||||
|
||||
public void onPayFailed(String msg) {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
}).checkSku(ProductId);
|
||||
});
|
||||
googleUtils.purchase(mProductId);
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
|
||||
111
main/src/main/java/com/yunbao/main/activity/HuaWeiFragment.java
Normal file
111
main/src/main/java/com/yunbao/main/activity/HuaWeiFragment.java
Normal file
@@ -0,0 +1,111 @@
|
||||
package com.yunbao.main.activity;
|
||||
|
||||
|
||||
import static com.yunbao.main.activity.MyWalletActivity.orderId;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.yunbao.common.pay.hw.HwBuilder;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.main.R;
|
||||
import com.yunbao.main.views.TestWebViewClient;
|
||||
|
||||
|
||||
@SuppressLint("ValidFragment")
|
||||
public class HuaWeiFragment extends Fragment {
|
||||
|
||||
private View view;
|
||||
public static String mOrderid, mProductId, MoneyUsds;
|
||||
|
||||
private WebView rlWebview;
|
||||
private String url;
|
||||
String adid = null;
|
||||
|
||||
public HuaWeiFragment() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
//通过参数中的布局填充获取对应布局
|
||||
view = inflater.inflate(R.layout.activity_recharge, container, false);
|
||||
|
||||
assert getArguments() != null;
|
||||
url = getArguments().getString("url");
|
||||
|
||||
if (StringUtil.isEmpty(url)) {
|
||||
Log.e(TAG, "URL为空");
|
||||
return view;
|
||||
}
|
||||
rlWebview = (WebView) view.findViewById(R.id.rlWebview);
|
||||
Log.e("ttt", url);
|
||||
rlWebview.loadUrl(url);
|
||||
WebSettings webSettings = rlWebview.getSettings();
|
||||
|
||||
webSettings.setDomStorageEnabled(true);
|
||||
webSettings.setTextZoom(100);
|
||||
webSettings.setUseWideViewPort(true);
|
||||
|
||||
webSettings.setJavaScriptEnabled(true); // 是否开启JS支持
|
||||
webSettings.setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口
|
||||
|
||||
webSettings.setLoadWithOverviewMode(true); // 缩放至屏幕大小
|
||||
webSettings.setSupportZoom(true); // 是否支持缩放
|
||||
webSettings.setBuiltInZoomControls(true); // 是否支持缩放变焦,前提是支持缩放
|
||||
|
||||
rlWebview.addJavascriptInterface(new JsInteration(), "androidObject");
|
||||
|
||||
TestWebViewClient testWebViewClient = new TestWebViewClient(getActivity(), rlWebview);
|
||||
|
||||
rlWebview.setWebViewClient(testWebViewClient);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
String TAG = "HuaWeiPay";
|
||||
|
||||
//js调用原生
|
||||
public class JsInteration {
|
||||
|
||||
@JavascriptInterface
|
||||
public void androidNewGoToGooglePay(String ProductId, String OrderNumber, String MoneyUsd) {
|
||||
Log.e(TAG, "ProductId:" + ProductId + " OrderNumber:" + OrderNumber + " MoneyUsd:" + MoneyUsd);
|
||||
|
||||
if (ProductId.equals("zs640")) {
|
||||
ProductId = "zs0640";
|
||||
}
|
||||
|
||||
mProductId = ProductId;
|
||||
mOrderid = OrderNumber;
|
||||
MoneyUsds = MoneyUsd;
|
||||
orderId = OrderNumber;
|
||||
|
||||
HwBuilder hwBuilder = new HwBuilder(getActivity());
|
||||
hwBuilder.pay(mProductId);
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void androidMethodBack() {
|
||||
getActivity().onBackPressed();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void androidGoBack() {
|
||||
getActivity().onBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
public void release() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,6 +93,8 @@ import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.GiftCacheUtil;
|
||||
import com.yunbao.common.utils.GoogleUtils;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.LiveRoomCheckLivePresenter;
|
||||
import com.yunbao.common.utils.LocationUtil;
|
||||
import com.yunbao.common.utils.ProcessResultUtil;
|
||||
@@ -291,25 +293,17 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
} else if (getIntent().getStringExtra("type") != null && getIntent().getStringExtra("type").equals("8")) {
|
||||
WebViewActivity.forward(mContext, getIntent().getStringExtra("activityUrl"), true, false);
|
||||
}
|
||||
FirebaseMessaging.getInstance().getToken()
|
||||
.addOnCompleteListener(new OnCompleteListener<String>() {
|
||||
@Override
|
||||
public void onComplete(@NonNull Task<String> task) {
|
||||
if (!task.isSuccessful()) {
|
||||
Log.w(TAG, "Fetching FCM registration token failed", task.getException());
|
||||
return;
|
||||
}
|
||||
|
||||
// Get new FCM registration token
|
||||
String token = task.getResult();
|
||||
|
||||
// Log and toast
|
||||
Log.d(TAG, token);
|
||||
PushManager.getInstance()
|
||||
.onReceiveToken(MainActivity.this, PushType.GOOGLE_FCM, token);
|
||||
// Toast.makeText(MainActivity.this, token, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
|
||||
GoogleUtils.newInstance(MainActivity.this).setFirebaseTokenListener(MainActivity.this, new GoogleUtils.FirebaseTokenListener() {
|
||||
@Override
|
||||
public void onResultToken(String token) {
|
||||
L.e("GoogleUtils.newInstance:onResultToken:" + token);
|
||||
PushManager.getInstance().onReceiveToken(MainActivity.this, PushType.GOOGLE_FCM, token);
|
||||
}
|
||||
});
|
||||
GoogleUtils.newInstance(MainActivity.this).initFireToken(MainActivity.this);
|
||||
}
|
||||
|
||||
//华为推送
|
||||
// getToken();
|
||||
@@ -460,51 +454,49 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
return null;
|
||||
}
|
||||
});
|
||||
RxView.clicks(findViewById(R.id.banner_click))
|
||||
.throttleFirst(2, TimeUnit.SECONDS)
|
||||
.subscribe(new Observer<Unit>() {
|
||||
RxView.clicks(findViewById(R.id.banner_click)).throttleFirst(2, TimeUnit.SECONDS).subscribe(new Observer<Unit>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(Unit unit) {
|
||||
MobclickAgent.onEvent(mContext, "home_page_to_recommend", "首页点击右下角去推荐直播间按钮");
|
||||
String Uid = floatBanner.getUid();
|
||||
LiveHttpUtil.getLiveInfo(Uid + "", new HttpCallback() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(Unit unit) {
|
||||
MobclickAgent.onEvent(mContext, "home_page_to_recommend", "首页点击右下角去推荐直播间按钮");
|
||||
String Uid = floatBanner.getUid();
|
||||
LiveHttpUtil.getLiveInfo(Uid + "", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
|
||||
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||
@Override
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
|
||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCheckError(String contextError) {
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
RouteUtil.forwardUserHome(mContext, Uid, 0);
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
|
||||
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||
@Override
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
|
||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
@Override
|
||||
public void onCheckError(String contextError) {
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
RouteUtil.forwardUserHome(mContext, Uid, 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
//选中监听
|
||||
mTabButtonGroup.addTabButtonGroupChangeListener((view, index) -> {
|
||||
@@ -517,8 +509,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
floatRedPacket.setVisibility(View.GONE);
|
||||
findViewById(R.id.banner_click).setVisibility(View.GONE);
|
||||
isfloatBannernet = false;
|
||||
if (mainMessageViewHolder != null)
|
||||
mainMessageViewHolder.onResume();
|
||||
if (mainMessageViewHolder != null) mainMessageViewHolder.onResume();
|
||||
} else {
|
||||
floatBanner.setVisibility(View.GONE);
|
||||
floatRedPacket.setVisibility(View.GONE);
|
||||
@@ -592,37 +583,36 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("num", "10");
|
||||
map.put("live_recommend", "quick_look");
|
||||
MainNetManager.get(mContext)
|
||||
.anchorRecommend(map, new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
|
||||
@SuppressLint("SetTextI18n")
|
||||
@Override
|
||||
public void onSuccess(AnchorRecommendModel data) {
|
||||
if (isFinishing()) return;
|
||||
if (data.getListShow() == 1 && data.getList().size() > 2) {
|
||||
floatBanner.setVisibility(View.VISIBLE);
|
||||
findViewById(R.id.banner_click).setVisibility(View.VISIBLE);
|
||||
floatBanner.showBanner(data.getList());
|
||||
} else {
|
||||
floatBanner.setVisibility(View.GONE);
|
||||
findViewById(R.id.banner_click).setVisibility(View.GONE);
|
||||
}
|
||||
if (data.getShowRedPacket() == 0) {
|
||||
floatRedPacket.setVisibility(View.GONE);
|
||||
} else {
|
||||
floatRedPacket.setVisibility(View.VISIBLE);
|
||||
((ProgressBar) floatRedPacket.findViewById(R.id.progress)).setMax(data.getRedPacketTotal());
|
||||
((ProgressBar) floatRedPacket.findViewById(R.id.progress)).setProgress(data.getRedPacketNum());
|
||||
((TextView) floatRedPacket.findViewById(R.id.progressText)).setText(data.getRedPacketNum() + "/" + data.getRedPacketTotal());
|
||||
}
|
||||
MainNetManager.get(mContext).anchorRecommend(map, new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
|
||||
@SuppressLint("SetTextI18n")
|
||||
@Override
|
||||
public void onSuccess(AnchorRecommendModel data) {
|
||||
if (isFinishing()) return;
|
||||
if (data.getListShow() == 1 && data.getList().size() > 2) {
|
||||
floatBanner.setVisibility(View.VISIBLE);
|
||||
findViewById(R.id.banner_click).setVisibility(View.VISIBLE);
|
||||
floatBanner.showBanner(data.getList());
|
||||
} else {
|
||||
floatBanner.setVisibility(View.GONE);
|
||||
findViewById(R.id.banner_click).setVisibility(View.GONE);
|
||||
}
|
||||
if (data.getShowRedPacket() == 0) {
|
||||
floatRedPacket.setVisibility(View.GONE);
|
||||
} else {
|
||||
floatRedPacket.setVisibility(View.VISIBLE);
|
||||
((ProgressBar) floatRedPacket.findViewById(R.id.progress)).setMax(data.getRedPacketTotal());
|
||||
((ProgressBar) floatRedPacket.findViewById(R.id.progress)).setProgress(data.getRedPacketNum());
|
||||
((TextView) floatRedPacket.findViewById(R.id.progressText)).setText(data.getRedPacketNum() + "/" + data.getRedPacketTotal());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(mContext.getString(R.string.net_error));
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(mContext.getString(R.string.net_error));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -778,12 +768,9 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
}
|
||||
if (!VersionUtil.isLatest(configBean.getVersion())) {
|
||||
if (!APKManager.get().getApkVerNew()) {
|
||||
new XPopup.Builder(mContext)
|
||||
.isDestroyOnDismiss(true)
|
||||
.dismissOnBackPressed(false) // 按返回键是否关闭弹窗,默认为true
|
||||
new XPopup.Builder(mContext).isDestroyOnDismiss(true).dismissOnBackPressed(false) // 按返回键是否关闭弹窗,默认为true
|
||||
.dismissOnTouchOutside(false) // 点击外部是否关闭弹窗,默认为true
|
||||
.asCustom(new APKUpdateCustomPopup(mContext, false))
|
||||
.show();
|
||||
.asCustom(new APKUpdateCustomPopup(mContext, false)).show();
|
||||
}
|
||||
} else {
|
||||
requestBonus();
|
||||
@@ -1087,14 +1074,12 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
private void notifyLiveFlot() {
|
||||
if (startListNotifyList.iterator().hasNext()) {
|
||||
AnchorStartLiveBean bean = startListNotifyList.iterator().next();
|
||||
new AnchorStartLiveNotifyDialog(mContext, bean)
|
||||
.setOnDismissListener(dialog -> {
|
||||
startListNotifyList.remove(bean);
|
||||
if (startListNotifyList.iterator().hasNext()) {
|
||||
notifyLiveFlot();
|
||||
}
|
||||
})
|
||||
.showDialog();
|
||||
new AnchorStartLiveNotifyDialog(mContext, bean).setOnDismissListener(dialog -> {
|
||||
startListNotifyList.remove(bean);
|
||||
if (startListNotifyList.iterator().hasNext()) {
|
||||
notifyLiveFlot();
|
||||
}
|
||||
}).showDialog();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1448,9 +1433,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onLiveFloatEvent(LiveFloatEvent event) {
|
||||
if (event != null && event.getmLiveBean() != null && !TextUtils.isEmpty(event.getmLiveBean().getPull())) {
|
||||
new Handler().post(() -> LiveFloatView.getInstance()
|
||||
.cacheLiveData(event.getmLiveBean(), event.getmLiveType(), event.getmLiveSDK(), event.getmLiveTypeVal())
|
||||
.builderFloat(mContext, event.getmLiveBean().getPull(), LiveAudienceActivity.class));
|
||||
new Handler().post(() -> LiveFloatView.getInstance().cacheLiveData(event.getmLiveBean(), event.getmLiveType(), event.getmLiveSDK(), event.getmLiveTypeVal()).builderFloat(mContext, event.getmLiveBean().getPull(), LiveAudienceActivity.class));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,11 @@ package com.yunbao.main.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
@@ -62,6 +64,7 @@ public class MyCoinActivity extends AbsActivity implements OnItemClickListener<C
|
||||
private String mCoinName;
|
||||
private String mGoldCoinName;
|
||||
List<CoinBean> listPro;//商品列表
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_coin;
|
||||
@@ -105,10 +108,10 @@ public class MyCoinActivity extends AbsActivity implements OnItemClickListener<C
|
||||
goldCoinNameTV.setText(String.format(mContext.getString(R.string.wallet_gold_name), mGoldCoinName));
|
||||
mBalance = findViewById(R.id.coin);
|
||||
mTvGoldCoinNum = findViewById(R.id.tvGoldCoinNum);
|
||||
View btnChargeExplain= findViewById(R.id.btn_charge_explain);
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY){
|
||||
View btnChargeExplain = findViewById(R.id.btn_charge_explain);
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == 1 || CommonAppConfig.IS_GOOGLE_PLAY == 2) {
|
||||
btnChargeExplain.setVisibility(View.GONE);
|
||||
}else {
|
||||
} else {
|
||||
btnChargeExplain.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@@ -139,6 +142,7 @@ public class MyCoinActivity extends AbsActivity implements OnItemClickListener<C
|
||||
mPayPresenter.checkPayResult();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed() {
|
||||
}
|
||||
@@ -167,24 +171,26 @@ public class MyCoinActivity extends AbsActivity implements OnItemClickListener<C
|
||||
String goldNum = obj.getString("gold");
|
||||
mGoldCoinNum = Long.parseLong(goldNum);
|
||||
mTvGoldCoinNum.setText(goldNum);
|
||||
}catch (Exception e){e.printStackTrace();}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//支付方式列表
|
||||
List<CoinPayBean> payList = JSON.parseArray(obj.getString("paylist"), CoinPayBean.class);
|
||||
if (mPayAdapter != null) {
|
||||
mPayAdapter.setList(payList);
|
||||
}
|
||||
//商品列表
|
||||
listPro = JSON.parseArray(obj.getString("rules"), CoinBean.class);
|
||||
listPro = JSON.parseArray(obj.getString("rules"), CoinBean.class);
|
||||
if (mAdapter != null) {
|
||||
mAdapter.setList(listPro);
|
||||
}
|
||||
if (payList != null && payList.size()>0){
|
||||
if ("google".equals(payList.get(0).getId()) && payList.get(0).isChecked()){
|
||||
if (payList != null && payList.size() > 0) {
|
||||
if ("google".equals(payList.get(0).getId()) && payList.get(0).isChecked()) {
|
||||
EventBus.getDefault().post(payList.get(0));
|
||||
}
|
||||
|
||||
}
|
||||
if (mPayPresenter != null){
|
||||
if (mPayPresenter != null) {
|
||||
mPayPresenter.setBalanceValue(mBalanceValue);
|
||||
mPayPresenter.setAliPartner(obj.getString("aliapp_partner"));
|
||||
mPayPresenter.setAliSellerId(obj.getString("aliapp_seller_id"));
|
||||
@@ -223,10 +229,7 @@ public class MyCoinActivity extends AbsActivity implements OnItemClickListener<C
|
||||
if (TextUtils.isEmpty(href)) {
|
||||
String money = bean.getMoney();
|
||||
String goodsName = StringUtil.contact(bean.getCoin(), mCoinName);
|
||||
String orderParams = StringUtil.contact(
|
||||
"&uid=", CommonAppConfig.getInstance().getUid(),
|
||||
"&changeid=", bean.getId(),
|
||||
"&coin=", bean.getCoin());
|
||||
String orderParams = StringUtil.contact("&uid=", CommonAppConfig.getInstance().getUid(), "&changeid=", bean.getId(), "&coin=", bean.getCoin());
|
||||
// if(coinPayBean.getId().equals(Constants.PAY_TYPE_HW)
|
||||
// || coinPayBean.getId().equals(Constants.PAY_TYPE_PAYSSION)
|
||||
// || coinPayBean.getId().equals(Constants.PAY_TYPE_PAYPAL)
|
||||
@@ -240,8 +243,7 @@ public class MyCoinActivity extends AbsActivity implements OnItemClickListener<C
|
||||
// );
|
||||
// }
|
||||
|
||||
orderParams=StringUtil.contact(orderParams,
|
||||
"&money=", bean.getMoney_usd());
|
||||
orderParams = StringUtil.contact(orderParams, "&money=", bean.getMoney_usd());
|
||||
mPayPresenter.pay(coinPayBean.getId(), "5", goodsName, orderParams);
|
||||
|
||||
} else {
|
||||
@@ -253,7 +255,6 @@ public class MyCoinActivity extends AbsActivity implements OnItemClickListener<C
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onCoinChangeEvent(CoinChangeEvent e) {
|
||||
if (mBalance != null) {
|
||||
@@ -267,28 +268,32 @@ public class MyCoinActivity extends AbsActivity implements OnItemClickListener<C
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onGoogleLimitEvent(CoinPayBean bean) {
|
||||
if (listPro==null || listPro.size()<=0){
|
||||
if (listPro == null || listPro.size() <= 0) {
|
||||
return;
|
||||
}
|
||||
int size=listPro.size();
|
||||
int size = listPro.size();
|
||||
int indexTmp;
|
||||
if (bean!=null){
|
||||
if (bean != null) {
|
||||
//谷歌支付不显示大额价格
|
||||
if ("google".equals(bean.getId())){
|
||||
String numS= bean.getPriceNum();
|
||||
int num = 7;
|
||||
if (numS != null && !numS.isEmpty()){
|
||||
try {
|
||||
num= Integer.parseInt(bean.getPriceNum());
|
||||
}catch (Exception e){ e.printStackTrace(); }
|
||||
}
|
||||
indexTmp=num;
|
||||
}else { indexTmp=size; }
|
||||
if (indexTmp <= size){
|
||||
List<CoinBean> listTmp=listPro.subList(0,indexTmp);
|
||||
mAdapter.setList(listTmp);
|
||||
}
|
||||
}
|
||||
if ("google".equals(bean.getId())) {
|
||||
String numS = bean.getPriceNum();
|
||||
int num = 7;
|
||||
if (numS != null && !numS.isEmpty()) {
|
||||
try {
|
||||
num = Integer.parseInt(bean.getPriceNum());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
indexTmp = num;
|
||||
} else {
|
||||
indexTmp = size;
|
||||
}
|
||||
if (indexTmp <= size) {
|
||||
List<CoinBean> listTmp = listPro.subList(0, indexTmp);
|
||||
mAdapter.setList(listTmp);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -297,16 +302,14 @@ public class MyCoinActivity extends AbsActivity implements OnItemClickListener<C
|
||||
int i = v.getId();
|
||||
if (i == R.id.btn_tip) {
|
||||
//充值协议
|
||||
WebViewActivity.forward(mContext, HtmlConfig.CHARGE_PRIVCAY + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"),false);
|
||||
}else if (i == R.id.btn_charge_explain) {
|
||||
WebViewActivity.forward(mContext, HtmlConfig.CHARGE_PRIVCAY + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"), false);
|
||||
} else if (i == R.id.btn_charge_explain) {
|
||||
//充值说明
|
||||
WebViewActivity.forward(mContext, HtmlConfig.CHARGE_EXPLAIN + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"),false);
|
||||
WebViewActivity.forward(mContext, HtmlConfig.CHARGE_EXPLAIN + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"), false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
EventBus.getDefault().unregister(this);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.yunbao.main.activity;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
@@ -12,6 +12,7 @@ import android.view.animation.DecelerateInterpolator;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentPagerAdapter;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
@@ -20,6 +21,7 @@ import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.android.billingclient.api.BillingResult;
|
||||
import com.android.billingclient.api.Purchase;
|
||||
import com.android.billingclient.api.PurchasesResponseListener;
|
||||
import com.google.gson.Gson;
|
||||
import com.umeng.analytics.MobclickAgent;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
@@ -27,10 +29,12 @@ import com.yunbao.common.fragment.LoadingDialog;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.pay.hw.HwBuilder;
|
||||
import com.yunbao.common.utils.GoogleBillingUtilNew;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.main.R;
|
||||
import com.yunbao.main.http.MainHttpUtil;
|
||||
import com.yunbao.main.utils.HXLinePagerIndicator;
|
||||
|
||||
import net.lucode.hackware.magicindicator.MagicIndicator;
|
||||
@@ -43,6 +47,9 @@ import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerTit
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.indicators.LinePagerIndicator;
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.ColorTransitionPagerTitleView;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
@@ -52,6 +59,10 @@ public class MyWalletActivity extends AbsActivity {
|
||||
static MyWalletActivity mw;
|
||||
Fragment[] fragments = null;
|
||||
private Handler payHandler = new Handler();
|
||||
public static String orderId;
|
||||
|
||||
HwBuilder hwBuilder;
|
||||
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
@@ -64,7 +75,11 @@ public class MyWalletActivity extends AbsActivity {
|
||||
super.main();
|
||||
mw = MyWalletActivity.this;
|
||||
setTitle(mContext.getString(R.string.wallet));
|
||||
|
||||
GoogleBillingUtilNew.getInstance().initGooglePay(mContext);
|
||||
|
||||
hwBuilder = new HwBuilder(MyWalletActivity.this);
|
||||
|
||||
vp_content = (ViewPager) findViewById(R.id.vp_content);
|
||||
TextView rView = (TextView) findViewById(R.id.rView);
|
||||
findViewById(R.id.redPacketMain).setVisibility(View.VISIBLE);
|
||||
@@ -75,69 +90,62 @@ public class MyWalletActivity extends AbsActivity {
|
||||
LoadingDialog loadingDialog = new LoadingDialog();
|
||||
loadingDialog.show(getSupportFragmentManager(), "LoadingDialog");
|
||||
loadingDialog.setShowText(getString(R.string.order_query));
|
||||
GoogleBillingUtilNew.getInstance().queryPurchasesAsync(new PurchasesResponseListener() {
|
||||
@Override
|
||||
public void onQueryPurchasesResponse(@NonNull BillingResult billingResult, @NonNull List<Purchase> list) {
|
||||
if (list.size() == 0) {
|
||||
loadingDialog.setShowText(getString(R.string.order_query_success));
|
||||
payHandler.postDelayed(() -> loadingDialog.dismiss(), 2000);
|
||||
} else {
|
||||
loadingDialog.setShowText(getString(R.string.order_query));
|
||||
//消费订单
|
||||
GoogleBillingUtilNew.getInstance().consume(list);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
int finalI = i;
|
||||
payHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
//谷歌掉单处理
|
||||
CommonHttpUtil
|
||||
.Google_sec_pay(list.get(finalI).getPurchaseToken(),
|
||||
list.get(finalI).getOrderId(),
|
||||
list.get(finalI).getProducts().get(0),
|
||||
new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (finalI == list.size() - 1) {
|
||||
loadingDialog.setShowText(getString(R.string.order_query_success));
|
||||
loadingDialog.dismiss();
|
||||
}
|
||||
ToastUtil.show("充值已到账");
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
|
||||
GoogleBillingUtilNew.getInstance().queryPurchasesAsync(new PurchasesResponseListener() {
|
||||
@Override
|
||||
public void onQueryPurchasesResponse(@NonNull BillingResult billingResult, @NonNull List<Purchase> list) {
|
||||
if (list.size() == 0) {
|
||||
loadingDialog.setShowText(getString(R.string.order_query_success));
|
||||
payHandler.postDelayed(() -> loadingDialog.dismiss(), 2000);
|
||||
} else {
|
||||
loadingDialog.setShowText(getString(R.string.order_query));
|
||||
//消费订单
|
||||
GoogleBillingUtilNew.getInstance().consume(list);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
int finalI = i;
|
||||
payHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
//谷歌掉单处理
|
||||
CommonHttpUtil.Google_sec_pay(list.get(finalI).getPurchaseToken(), list.get(finalI).getOrderId(), list.get(finalI).getProducts().get(0), new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (finalI == list.size() - 1) {
|
||||
loadingDialog.setShowText(getString(R.string.order_query_success));
|
||||
loadingDialog.dismiss();
|
||||
}
|
||||
ToastUtil.show("充值已到账");
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
hwBuilder.consume();
|
||||
loadingDialog.setShowText(getString(R.string.order_query_success));
|
||||
payHandler.postDelayed(() -> loadingDialog.dismiss(), 2000);
|
||||
}
|
||||
});
|
||||
|
||||
WalletFragment walletFragment;
|
||||
GoogleFragment googleFragment1;
|
||||
GoogleFragment googleFragment2;
|
||||
WalletFragment walletFragment = null;
|
||||
|
||||
GoogleFragment googleFragment1 = null;
|
||||
GoogleFragment googleFragment2 = null;
|
||||
|
||||
HuaWeiFragment huaWeiFragment1 = null;
|
||||
HuaWeiFragment huaWeiFragment2 = null;
|
||||
|
||||
final String[] titles = {mContext.getString(R.string.diamond), mContext.getString(R.string.coins), mContext.getString(R.string.golden_beans)};
|
||||
if (getIntent().getStringExtra("tag") != null) {
|
||||
Log.i("tss", "首充");
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == false) {
|
||||
walletFragment = new WalletFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletbean&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
|
||||
walletFragment.setArguments(bundle);
|
||||
|
||||
googleFragment1 = new GoogleFragment();
|
||||
Bundle bundle1 = new Bundle();
|
||||
bundle1.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&first_page=1&m=Mall&a=walletcoin&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
|
||||
googleFragment1.setArguments(bundle1);
|
||||
|
||||
googleFragment2 = new GoogleFragment();
|
||||
Bundle bundle2 = new Bundle();
|
||||
bundle2.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletgold&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
|
||||
googleFragment2.setArguments(bundle2);
|
||||
} else {
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
|
||||
//google
|
||||
rView.setVisibility(View.VISIBLE);
|
||||
walletFragment = new WalletFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
@@ -153,9 +161,75 @@ public class MyWalletActivity extends AbsActivity {
|
||||
Bundle bundle2 = new Bundle();
|
||||
bundle2.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaygole&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
|
||||
googleFragment2.setArguments(bundle2);
|
||||
} else if (CommonAppConfig.IS_GOOGLE_PLAY == 2) {
|
||||
//华为
|
||||
rView.setVisibility(View.VISIBLE);
|
||||
walletFragment = new WalletFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletbean&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
|
||||
walletFragment.setArguments(bundle);
|
||||
|
||||
huaWeiFragment1 = new HuaWeiFragment();
|
||||
Bundle bundle1 = new Bundle();
|
||||
bundle1.putString("url", CommonAppConfig.HOST + "/themes/simplebootx/appapi/mall/huaweipaycoin.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd");
|
||||
huaWeiFragment1.setArguments(bundle1);
|
||||
|
||||
huaWeiFragment2 = new HuaWeiFragment();
|
||||
Bundle bundle2 = new Bundle();
|
||||
bundle2.putString("url", CommonAppConfig.HOST + "/themes/simplebootx/appapi/mall/huaweipaygole.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd");
|
||||
huaWeiFragment2.setArguments(bundle2);
|
||||
} else {
|
||||
walletFragment = new WalletFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletbean&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
|
||||
walletFragment.setArguments(bundle);
|
||||
|
||||
googleFragment1 = new GoogleFragment();
|
||||
Bundle bundle1 = new Bundle();
|
||||
bundle1.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&first_page=1&m=Mall&a=walletcoin&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
|
||||
googleFragment1.setArguments(bundle1);
|
||||
|
||||
googleFragment2 = new GoogleFragment();
|
||||
Bundle bundle2 = new Bundle();
|
||||
bundle2.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletgold&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
|
||||
googleFragment2.setArguments(bundle2);
|
||||
}
|
||||
} else {
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == false) {
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
|
||||
rView.setVisibility(View.VISIBLE);
|
||||
|
||||
walletFragment = new WalletFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletbean&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
|
||||
walletFragment.setArguments(bundle);
|
||||
|
||||
googleFragment1 = new GoogleFragment();
|
||||
Bundle bundle1 = new Bundle();
|
||||
bundle1.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaycoin&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
|
||||
googleFragment1.setArguments(bundle1);
|
||||
|
||||
googleFragment2 = new GoogleFragment();
|
||||
Bundle bundle2 = new Bundle();
|
||||
bundle2.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaygole&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
|
||||
googleFragment2.setArguments(bundle2);
|
||||
} else if (CommonAppConfig.IS_GOOGLE_PLAY == 2) {
|
||||
rView.setVisibility(View.VISIBLE);
|
||||
|
||||
walletFragment = new WalletFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletbean&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
|
||||
walletFragment.setArguments(bundle);
|
||||
|
||||
huaWeiFragment1 = new HuaWeiFragment();
|
||||
Bundle bundle1 = new Bundle();
|
||||
bundle1.putString("url", CommonAppConfig.HOST + "/themes/simplebootx/appapi/mall/huaweipaycoin.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd");
|
||||
huaWeiFragment1.setArguments(bundle1);
|
||||
|
||||
huaWeiFragment2 = new HuaWeiFragment();
|
||||
Bundle bundle2 = new Bundle();
|
||||
bundle2.putString("url", CommonAppConfig.HOST + "/themes/simplebootx/appapi/mall/huaweipaygole.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd");
|
||||
huaWeiFragment2.setArguments(bundle2);
|
||||
} else {
|
||||
Log.i("tss", "不是首充");
|
||||
//链接版本
|
||||
|
||||
@@ -173,30 +247,16 @@ public class MyWalletActivity extends AbsActivity {
|
||||
Bundle bundle2 = new Bundle();
|
||||
bundle2.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=walletgold&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
|
||||
googleFragment2.setArguments(bundle2);
|
||||
|
||||
} else {
|
||||
rView.setVisibility(View.VISIBLE);
|
||||
|
||||
walletFragment = new WalletFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletbean&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
|
||||
walletFragment.setArguments(bundle);
|
||||
|
||||
googleFragment1 = new GoogleFragment();
|
||||
Bundle bundle1 = new Bundle();
|
||||
bundle1.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaycoin&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
|
||||
googleFragment1.setArguments(bundle1);
|
||||
|
||||
googleFragment2 = new GoogleFragment();
|
||||
Bundle bundle2 = new Bundle();
|
||||
bundle2.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaygole&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
|
||||
googleFragment2.setArguments(bundle2);
|
||||
}
|
||||
}
|
||||
|
||||
fragments = new Fragment[]{googleFragment1,
|
||||
googleFragment2,
|
||||
walletFragment};
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
|
||||
fragments = new Fragment[]{googleFragment1, googleFragment2, walletFragment};
|
||||
} else if (CommonAppConfig.IS_GOOGLE_PLAY == 2) {
|
||||
fragments = new Fragment[]{huaWeiFragment1, huaWeiFragment2, walletFragment};
|
||||
} else {
|
||||
fragments = new Fragment[]{googleFragment1, googleFragment2, walletFragment};
|
||||
}
|
||||
|
||||
MagicIndicator magicIndicator = (MagicIndicator) findViewById(R.id.magic_indicator);
|
||||
CommonNavigator commonNavigator = new CommonNavigator(this);
|
||||
@@ -266,10 +326,69 @@ public class MyWalletActivity extends AbsActivity {
|
||||
magicIndicator.onPageSelected(getIntent().getIntExtra("p", 0));
|
||||
vp_content.setCurrentItem(getIntent().getIntExtra("p", 0));
|
||||
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == 2) {
|
||||
if (hwBuilder != null) {
|
||||
hwBuilder.consume();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == 6666) {
|
||||
if (data == null) {
|
||||
Log.e("TAG", "onActivityResult__data is null");
|
||||
return;
|
||||
}
|
||||
|
||||
JSONObject object = hwBuilder.getPayResult(data);
|
||||
|
||||
int code;
|
||||
String inAppPurchaseData;
|
||||
String inAppPurchaseDataSignature;
|
||||
try {
|
||||
code = object.getInt("code");
|
||||
Log.e("TAG", "code:" + code);
|
||||
|
||||
if (hwBuilder != null) {
|
||||
hwBuilder.consume();
|
||||
}
|
||||
|
||||
switch (code) {
|
||||
case 60000:
|
||||
ToastUtil.show("支付取消");
|
||||
break;
|
||||
case -1:
|
||||
case 60051:
|
||||
ToastUtil.show("支付失败");
|
||||
break;
|
||||
case 0:
|
||||
ToastUtil.show("支付成功");
|
||||
inAppPurchaseData = object.getString("inAppPurchaseData");
|
||||
inAppPurchaseDataSignature = object.getString("inAppPurchaseDataSignature");
|
||||
MainHttpUtil.hwNotify(inAppPurchaseData, inAppPurchaseDataSignature, orderId, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
} catch (JSONException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static void dis() {
|
||||
mw.finish();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.binioter.guideview.Guide;
|
||||
import com.binioter.guideview.GuideBuilder;
|
||||
import com.facebook.appevents.AppEventsLogger;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
import com.lzf.easyfloat.EasyFloat;
|
||||
import com.opensource.svgaplayer.SVGADrawable;
|
||||
import com.opensource.svgaplayer.SVGAImageView;
|
||||
@@ -322,7 +321,6 @@ public class PDLiveConversationListActivity extends AbsActivity implements View.
|
||||
ViewClicksAntiShake.clicksAntiShake(imgNewsOnline, () -> {
|
||||
type = userBean.getType();
|
||||
netHandler.post(systemNumberRunnable);
|
||||
FirebaseAnalytics.getInstance(mContext).logEvent("FS_customer_service", null);
|
||||
AppEventsLogger.newLogger(mContext).logEvent("FB_customer_service");
|
||||
if (userBean.getLink() != null && !"".equals(userBean.getLink())) {
|
||||
WebViewActivity.forward(mContext, userBean.getLink(),false);
|
||||
|
||||
@@ -123,8 +123,8 @@ public class RegisterActivity extends AbsActivity {
|
||||
getUuidDevice();
|
||||
getPromoCode();
|
||||
|
||||
mGetCode =mContext.getString(R.string.reg_get_code);
|
||||
mGetCodeAgain =mContext.getString(R.string.reg_get_code_again);
|
||||
mGetCode = mContext.getString(R.string.reg_get_code);
|
||||
mGetCodeAgain = mContext.getString(R.string.reg_get_code_again);
|
||||
mTvCountryCodeClick();
|
||||
mEditPhone.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
@@ -240,7 +240,7 @@ public class RegisterActivity extends AbsActivity {
|
||||
webSettings.setJavaScriptEnabled(true);
|
||||
webview.addJavascriptInterface(new JsBridge(), "jsBridge");
|
||||
// 也可以加载本地html(webView.loadUrl("file:///android_asset/xxx.html"))
|
||||
webview.loadUrl(CommonAppConfig.HOST + "/h5/live/TCaptcha.html"+ "?isZh=" + (WordUtil.isNewZh() ? "1" : 0));
|
||||
webview.loadUrl(CommonAppConfig.HOST + "/h5/live/TCaptcha.html" + "?isZh=" + (WordUtil.isNewZh() ? "1" : 0));
|
||||
}
|
||||
|
||||
|
||||
@@ -282,9 +282,9 @@ public class RegisterActivity extends AbsActivity {
|
||||
} else if (i == R.id.btn_register) {
|
||||
register();
|
||||
} else if (i == R.id.btn_tip2) {
|
||||
WebViewActivity.forward(mContext, HtmlConfig.REG_PRIVCAY1+ "&isZh=" + (WordUtil.isNewZh() ? "1" : "0"),false);
|
||||
WebViewActivity.forward(mContext, HtmlConfig.REG_PRIVCAY1 + "&isZh=" + (WordUtil.isNewZh() ? "1" : "0"), false);
|
||||
} else if (i == R.id.btn_tip3) {
|
||||
WebViewActivity.forward(mContext, HtmlConfig.REG_PRIVCAY2+ "&isZh=" + (WordUtil.isNewZh() ? "1" : "0"),false);
|
||||
WebViewActivity.forward(mContext, HtmlConfig.REG_PRIVCAY2 + "&isZh=" + (WordUtil.isNewZh() ? "1" : "0"), false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -364,12 +364,12 @@ public class RegisterActivity extends AbsActivity {
|
||||
mDialog.show();
|
||||
}
|
||||
String ti = "";
|
||||
if (edit_invitecode_2.getText().toString().trim().equals("此設備已註冊")){
|
||||
if (edit_invitecode_2.getText().toString().trim().equals("此設備已註冊")) {
|
||||
ti = "";
|
||||
}else{
|
||||
} else {
|
||||
ti = edit_invitecode_2.getText().toString().trim();
|
||||
}
|
||||
MainHttpUtil.register(UserID,ti, phoneNum, mPromoCode, mUuidDevice, mCountryCode, pwd, pwd2, code, new HttpCallback() {
|
||||
MainHttpUtil.register(UserID, ti, phoneNum, mPromoCode, mUuidDevice, mCountryCode, pwd, pwd2, code, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
@@ -404,25 +404,25 @@ public class RegisterActivity extends AbsActivity {
|
||||
//获取自定义数据
|
||||
if (appData.getData() != null && !appData.getData().equals("")) {
|
||||
JSONObject data = JSON.parseObject(appData.getData());
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == 1 || CommonAppConfig.IS_GOOGLE_PLAY == 2) {
|
||||
yqm_view.setVisibility(View.VISIBLE);
|
||||
MainHttpUtil.getDeviceLoginType(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if(code == 201){
|
||||
if (code == 201) {
|
||||
edit_invitecode_2.setText("此設備已註冊");
|
||||
edit_invitecode_2.setEnabled(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
yqm_view.setVisibility(View.GONE);
|
||||
//推广的码
|
||||
} else {
|
||||
yqm_view.setVisibility(View.GONE);
|
||||
//推广的码
|
||||
mPromoCode = data.getString("admin_id") + "";
|
||||
//用户的码
|
||||
UserID = data.getString("user_id") + "";
|
||||
}
|
||||
Log.d("OpenInstall", UserID+"appData.getData()1111= " + mPromoCode);
|
||||
Log.d("OpenInstall", UserID + "appData.getData()1111= " + mPromoCode);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -485,31 +485,28 @@ public class RegisterActivity extends AbsActivity {
|
||||
@Override
|
||||
public void run() {
|
||||
IMLoginModel userInfo = IMLoginManager.get(activity).getUserInfo();
|
||||
HttpClient.getInstance().post("Home.getRandJoinAnchor", "Home.getRandJoinAnchor")
|
||||
.params("uid", userInfo.getId())
|
||||
.params("token", userInfo.getToken())
|
||||
.execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (info[0] != null) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
IMLoginManager.get(activity).setisNewUserOne(true);
|
||||
IMLoginManager.get(activity).setNewUserGif(true);
|
||||
if (obj.containsKey("home_zdy_img_us")) {
|
||||
home_zdy_img_us = obj.getString("home_zdy_img_us");
|
||||
home_zdy_img_cn = obj.getString("home_zdy_img_cn");
|
||||
}
|
||||
gotoLive(obj.getString("anchor_id"));
|
||||
if (obj.containsKey("home_zdy_pop")) {
|
||||
NoviceInstructorManager.get(mContext).setHomeZdyPop(obj.getString("home_zdy_pop"));
|
||||
}
|
||||
jumpMain(false);
|
||||
} else {
|
||||
jumpMain(false);
|
||||
}
|
||||
EventBus.getDefault().post(new RegSuccessEvent());
|
||||
HttpClient.getInstance().post("Home.getRandJoinAnchor", "Home.getRandJoinAnchor").params("uid", userInfo.getId()).params("token", userInfo.getToken()).execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (info[0] != null) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
IMLoginManager.get(activity).setisNewUserOne(true);
|
||||
IMLoginManager.get(activity).setNewUserGif(true);
|
||||
if (obj.containsKey("home_zdy_img_us")) {
|
||||
home_zdy_img_us = obj.getString("home_zdy_img_us");
|
||||
home_zdy_img_cn = obj.getString("home_zdy_img_cn");
|
||||
}
|
||||
});
|
||||
gotoLive(obj.getString("anchor_id"));
|
||||
if (obj.containsKey("home_zdy_pop")) {
|
||||
NoviceInstructorManager.get(mContext).setHomeZdyPop(obj.getString("home_zdy_pop"));
|
||||
}
|
||||
jumpMain(false);
|
||||
} else {
|
||||
jumpMain(false);
|
||||
}
|
||||
EventBus.getDefault().post(new RegSuccessEvent());
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.facebook.appevents.AppEventsLogger;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
import com.yunbao.common.activity.WebViewActivity;
|
||||
import com.yunbao.common.bean.ImUserInfoModel;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
@@ -86,7 +85,6 @@ public class SystemMessageAdapter extends RecyclerView.Adapter {
|
||||
type = model1.getType();
|
||||
netHandler.post(updataRunable);
|
||||
if (model1.getTitle().equals("在線客服")) {
|
||||
FirebaseAnalytics.getInstance(mContext).logEvent("FS_customer_service", null);
|
||||
AppEventsLogger.newLogger(mContext).logEvent("FB_customer_service");
|
||||
}
|
||||
if (!TextUtils.isEmpty(model1.getLink())) {
|
||||
|
||||
@@ -60,10 +60,16 @@ public class MainHttpUtil {
|
||||
*/
|
||||
public static void loginByThird(String openid, String nicename, String avatar, String type, HttpCallback callback) {
|
||||
String sign = MD5Util.getMD5("openid=" + openid + "&" + SALT);
|
||||
String appSource = "3";
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
|
||||
appSource = "1";
|
||||
} else if (CommonAppConfig.IS_GOOGLE_PLAY == 2) {
|
||||
appSource = "2";
|
||||
}
|
||||
HttpClient.getInstance().get("Login.userLoginByThird", MainHttpConsts.LOGIN_BY_THIRD)
|
||||
.params("openid", openid)
|
||||
.params("nicename", nicename)
|
||||
.params("app_source", CommonAppConfig.IS_GOOGLE_PLAY == true ? "1" : "3")
|
||||
.params("app_source", appSource)
|
||||
.params("avatar", avatar)
|
||||
.params("type", type)
|
||||
.params("source", DEVICE)
|
||||
@@ -80,9 +86,15 @@ public class MainHttpUtil {
|
||||
|
||||
public static void loginByThird(String UserID, String openid, String promoCode, String uuidDevice, String nicename, String avatar, String type, HttpCallback callback) {
|
||||
String sign = MD5Util.getMD5("openid=" + openid + "&" + SALT);
|
||||
String appSource = "3";
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
|
||||
appSource = "1";
|
||||
} else if (CommonAppConfig.IS_GOOGLE_PLAY == 2) {
|
||||
appSource = "2";
|
||||
}
|
||||
HttpClient.getInstance().get("Login.userLoginByThird", MainHttpConsts.LOGIN_BY_THIRD)
|
||||
.params("openid", openid)
|
||||
.params("app_source", CommonAppConfig.IS_GOOGLE_PLAY == true ? "1" : "3")
|
||||
.params("app_source", appSource)
|
||||
.params("admin_id", promoCode)
|
||||
.params("uuid_Device", uuidDevice)
|
||||
.params("nicename", nicename)
|
||||
@@ -93,7 +105,7 @@ public class MainHttpUtil {
|
||||
.params("sign", sign)
|
||||
.params("lastlogindevice", "Android")
|
||||
.params("pushid", "")
|
||||
.params("langue", WordUtil.isNewZh()?"chinese":"english")
|
||||
.params("langue", WordUtil.isNewZh() ? "chinese" : "english")
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
@@ -574,9 +586,15 @@ public class MainHttpUtil {
|
||||
* 手机注册接口---增加参数:推广码,手机唯一标识,国家代码
|
||||
*/
|
||||
public static void register(String UserID, String invitecode, String user_login, String promo_code, String uuidDevice, int countryCode, String pass, String pass2, String code, HttpCallback callback) {
|
||||
String appSource = "3";
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
|
||||
appSource = "1";
|
||||
} else if (CommonAppConfig.IS_GOOGLE_PLAY == 2) {
|
||||
appSource = "2";
|
||||
}
|
||||
HttpClient.getInstance().get("Login.userReg", MainHttpConsts.REGISTER)
|
||||
.params("user_login", user_login)
|
||||
.params("app_source", CommonAppConfig.IS_GOOGLE_PLAY == true ? "1" : "3")
|
||||
.params("app_source", appSource)
|
||||
//增加参数:推广码
|
||||
.params("user_activation_key", promo_code)
|
||||
.params("admin_id", promo_code)
|
||||
@@ -590,7 +608,7 @@ public class MainHttpUtil {
|
||||
.params("code", code)
|
||||
.params("source", DEVICE)
|
||||
.params("invitation_code", invitecode)
|
||||
.params("langue", WordUtil.isNewZh()?"chinese":"english")
|
||||
.params("langue", WordUtil.isNewZh() ? "chinese" : "english")
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
@@ -740,6 +758,18 @@ public class MainHttpUtil {
|
||||
.execute(callback);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单通知
|
||||
*/
|
||||
public static void hwNotify(String InAppPurchaseData, String Signature, String orderId, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Charge.HuaweiNotify", "Charge.HuaweiNotify")
|
||||
.params("InAppPurchaseData", InAppPurchaseData)
|
||||
.params("InAppDataSignature", Signature)
|
||||
.params("SelfOrderId", orderId)
|
||||
.params("PackageName", "pd")
|
||||
.execute(callback);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.binioter.guideview.Guide;
|
||||
import com.binioter.guideview.GuideBuilder;
|
||||
import com.facebook.appevents.AppEventsLogger;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
import com.opensource.svgaplayer.SVGADrawable;
|
||||
import com.opensource.svgaplayer.SVGAImageView;
|
||||
import com.opensource.svgaplayer.SVGAParser;
|
||||
@@ -277,7 +276,6 @@ public class MainMessageViewHolder extends AbsMainViewHolder {
|
||||
MobclickAgent.onEvent(mContext, "information_system_service", "在線客服");
|
||||
type = userBean.getType();
|
||||
netHandler.post(systemNumberRunnable);
|
||||
FirebaseAnalytics.getInstance(mContext).logEvent("FS_customer_service", null);
|
||||
AppEventsLogger.newLogger(mContext).logEvent("FB_customer_service");
|
||||
if (userBean.getLink() != null && !"".equals(userBean.getLink())) {
|
||||
// WebViewActivity.forward(mContext, userBean.getLink());
|
||||
|
||||
Reference in New Issue
Block a user