This commit is contained in:
18142669586 2022-09-27 14:53:31 +08:00
parent 2490c6bdd1
commit 9e527d6a5d

View File

@ -3,13 +3,11 @@ package com.yunbao.main.activity;
import android.content.Context; import android.content.Context;
import android.graphics.Color; import android.graphics.Color;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentPagerAdapter; import androidx.fragment.app.FragmentPagerAdapter;
import androidx.viewpager.widget.ViewPager; import androidx.viewpager.widget.ViewPager;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.view.animation.AccelerateInterpolator; import android.view.animation.AccelerateInterpolator;
@ -20,17 +18,9 @@ import android.widget.TextView;
import com.adjust.sdk.Adjust; import com.adjust.sdk.Adjust;
import com.adjust.sdk.AdjustEvent; import com.adjust.sdk.AdjustEvent;
import com.alibaba.android.arouter.facade.annotation.Route; import com.alibaba.android.arouter.facade.annotation.Route;
import com.android.billingclient.api.Purchase;
import com.android.billingclient.api.SkuDetails;
import com.facebook.appevents.AppEventsConstants;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.utils.GoogleBillingUtil;
import com.yunbao.common.utils.OnGoogleBillingListener;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.main.R; import com.yunbao.main.R;
import com.yunbao.main.utils.HXLinePagerIndicator; import com.yunbao.main.utils.HXLinePagerIndicator;
@ -48,80 +38,16 @@ import net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.ColorT
import static com.yunbao.common.CommonAppContext.logger; import static com.yunbao.common.CommonAppContext.logger;
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics; import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
import java.util.List;
import java.util.Locale;
@Route(path = RouteUtil.PATH_COIN) @Route(path = RouteUtil.PATH_COIN)
public class MyWalletActivity extends AbsActivity { public class MyWalletActivity extends AbsActivity {
ViewPager vp_content; ViewPager vp_content;
static MyWalletActivity mw; static MyWalletActivity mw;
Fragment[] fragments = null; Fragment[] fragments = null;
String TAG = "GooglePay";
@Override @Override
protected int getLayoutId() { protected int getLayoutId() {
return R.layout.activity_my_wallet; return R.layout.activity_my_wallet;
} }
private GoogleBillingUtil googleBillingUtil;
private OnGoogleBillingListener mOnMyGoogleBillingListener=new OnGoogleBillingListener(){
@Override
public void onSetupSuccess(boolean isSelf) {
super.onSetupSuccess(isSelf);
Log.d(TAG,"内购服务初始化完成");
}
@Override
public void onQuerySuccess(@NonNull String skuType, @NonNull List<SkuDetails> list, boolean isSelf) {
}
@Override
public boolean onPurchaseSuccess(@NonNull Purchase purchase, boolean isSelf) {
StringBuffer tempBuffer =new StringBuffer();
return true ;//自动消耗(只有当isSelf为true,并且支付状态为PURCHASED时该值才会生效)
}
@Override
public boolean onRecheck(@NonNull String skuType, @NonNull Purchase purchase, boolean isSelf) {
StringBuffer tempBuffer =new StringBuffer();
tempBuffer.append("检测到未处理的订单($skuType):${purchase.sku}()");
Log.d(TAG,tempBuffer.toString());
return true;
}
@Override
public void onBillingServiceDisconnected() {
super.onBillingServiceDisconnected();
}
@Override
public void onConsumeSuccess(@NonNull String purchaseToken, boolean isSelf) {
Log.d(TAG,"消耗商品成功:$purchaseToken");
}
@Override
public void onAcknowledgePurchaseSuccess(boolean isSelf) {
Log.d(TAG,"确认购买商品成功");
}
@Override
public void onFail(@NonNull GoogleBillingUtil.GoogleBillingListenerTag tag, int responseCode, boolean isSelf) {
Log.d(TAG,"操作失败:tag=${" + tag.name() + "responseCode=" + responseCode);
}
@Override
public void onError(@NonNull GoogleBillingUtil.GoogleBillingListenerTag tag, boolean isSelf) {
Log.d(TAG,"发生错误:tag="+tag.name());
}
};
@Override @Override
protected void main() { protected void main() {