Commit 3f84e07f authored by zhengyingbing's avatar zhengyingbing
Browse files

feat(app): 更新fastsdk版本

parent 3452ce96
......@@ -3,14 +3,29 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.hoolai.access.demo"
applicationId "com.hoolai.demo"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
manifestPlaceholders.put("APPLOG_SCHEME","rangersapplog.byAx6uYt".toLowerCase())
}
signingConfigs {
demo {
storeFile file('..\\demo.keystore')
storePassword 'hoolai321'
keyPassword 'hoolai321'
keyAlias 'access-debug'
}
}
buildTypes {
release {
signingConfig signingConfigs.demo
minifyEnabled false
}
debug {
signingConfig signingConfigs.demo
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
......@@ -18,7 +33,6 @@ android {
}
dependencies {
implementation 'com.hoolai.access.open:hoolai-core:1.0.1.19'
implementation 'androidx.core:core:1.3.0'
implementation 'com.hoolai.access.open:hoolai-core:1.0.2.20'
implementation 'androidx.core:core:1.3.2'
}
\ No newline at end of file
......@@ -13,7 +13,7 @@
android:icon="@mipmap/ic_launcher"
android:label="fastSdkDemo"
android:supportsRtl="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:usesCleartextTraffic="true">
<!-- 游戏主类 -->
<activity
......@@ -43,8 +43,7 @@
<!-- demo分享类,无需拷贝 -->
<activity
android:name=".ShareActivity"
android:theme="@style/HlAccountTransparent"/>
android:name=".ShareActivity"/>
</application>
</manifest>
\ No newline at end of file
dWU6HTC2i8CNHTVpYuoEUb479pDMdbgcBM99Fx/MNUBrK6lQQVn+LZAGg82D37cPEXvUKkjoYecH6hWlS3T2ZogrArgLXiZlxBciEuOtwC1eliKFzLB8Ognk/R+JdP8VWuh7WfAGLvoI/8YFpDm3lXocXG2U6eUH5GrM11LbXk/TwL1mfmp4sEYsasYtnd2tVpkIZSJSNJCc90PWinb/IERw3cb2zzA0F1GpSzC3H0AQFw5O2ap+s0GwM/RjdqjIqHD176/qA9plD8eVL1wtAv4agld1P/eqNEEBLhRqouXZlClPvwLvc96E3XRcoNRwEqvMB/Gtx7E2jOOzNgv+XhhZZu22tZCKwBeasIb5QISeQ1lUVMkblKdzGQHvtRia/bq9J/odH8NTFy+pE/h0e8BVYcB5N3YfOawpghN4KT0dQeIxI2EfBRg6UNsZGzBPSEJf8DW19Z5tndH4IosrNRnqBYw3BruFOW7ZSXRz5BZoB9S0QcYBZkFJ8l9JAEzlHUqPwFnfghZ77yRhPpDHyzbyyxHzhlOLF67iAR450k9KtLGLtDiMo0j60U90AHzTJrT2oi0z9j0vwpNcuAgLHKANn4QdE+SDkDrr1ekMY2vIAif2p+I1uRXdYqL8d3fK9oZQTwn6FOYb59zyVhVIdUzjcTL37173PHnmlhoqlx4=
\ No newline at end of file
......@@ -11,8 +11,6 @@ public class GameApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
//如使用了Multidex 需要指定 hoolaisdk相关代码到主dex中
//-keep com.hoolai.**
FastSdk.onApplicationCreate(this);
}
......
......@@ -4,6 +4,7 @@ import android.Manifest;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.View;
......@@ -27,8 +28,10 @@ import com.hoolai.access.open.fastaccess.utils.ToastUtils;
import java.util.List;
public class MainActivity extends Activity {
private static final String TAG = "fastsdkdemo";
private boolean isInit, isLogin;
private TextView textview;
private TextView textView;
private Button initBtn;
private String str = "";
......@@ -36,7 +39,7 @@ public class MainActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textview = findViewById(R.id.textview);
textView = findViewById(R.id.textview);
initBtn = findViewById(R.id.initBtn);
//声明系统回调(初始化,退出,版本升级)监听
......@@ -44,21 +47,32 @@ public class MainActivity extends Activity {
@Override
public void onInitSuccess(InitResult initResult) {
isInit = true;
Logger.data("fastsdkdemo","初始化成功");
Logger.data(TAG,"初始化成功");
setText(">>初始化成功");
initBtn.setVisibility(View.GONE);
// 如用到敏感权限,调用以下方法
//单个权限申请
boolean hasPermission = FastSdk.checkPermission(MainActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE);
//批量权限申请,showRefusedTip:拒绝后是否弹框提示(一般当拒绝权限会影响功能时设置为true)
// boolean hasPermission = FastSdk.checkPermissions(MainActivity.this,
// new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA},
// false);
if(hasPermission){
//your code
}
}
@Override
public void onInitFailed(String reason) {
Logger.data("fastsdkdemo","初始化失败:"+reason);
Logger.data(TAG,"初始化失败:"+reason);
setText(">>初始化失败");
initBtn.setVisibility(View.VISIBLE);
}
@Override
public void onCustomExit() {
Logger.data("fastsdkdemo","弹出游戏的退出界面");
//需要自己创建退出界面
Logger.data(TAG,"弹出游戏的退出界面");
setText(">>弹出游戏的退出界面");
new AlertDialog.Builder(MainActivity.this)
.setTitle("游戏退出弹窗")
......@@ -84,7 +98,7 @@ public class MainActivity extends Activity {
@Override
public void onUpdate(String data) {
Logger.data("fastsdkdemo","升级:" + data);
Logger.data(TAG,"升级:" + data);
}
};
//声明账号回调监听
......@@ -96,20 +110,20 @@ public class MainActivity extends Activity {
@Override
public void onLoginSuccess(LoginResult result) {
Logger.data("fastsdkdemo","登录成功:" + result);
Logger.data(TAG,"登录成功:" + result);
setText(">>登录成功:" + result.toString() + "");
isLogin = true;
}
@Override
public void onLoginFailed(String reason) {
Logger.data("fastsdkdemo","登录失败:" + reason);
Logger.data(TAG,"登录失败:" + reason);
setText(">>登录失败");
}
@Override
public void onLogout(Object... var1) {
Logger.data("fastsdkdemo","已登出");
Logger.data(TAG,"已登出");
setText(">>已登出");
isLogin = false;
}
......@@ -117,19 +131,19 @@ public class MainActivity extends Activity {
FastSdk.hlPaymentListener = new HLPaymentListener() {
@Override
public void onPaySuccess(String result) {
Logger.data("fastsdkdemo","支付成功 " + result);
Logger.data(TAG,"支付成功 " + result);
setText(">>支付成功");
}
@Override
public void onPayFailed(String reason) {
Logger.data("fastsdkdemo","支付失败:" + reason);
Logger.data(TAG,"支付失败:" + reason);
setText(">>支付失败");
}
@Override
public void onQuerySuccess(List<GoodsInfo> list) {
Logger.data("fastsdkdemo","商品信息获取成功:" + list.toString());
Logger.data(TAG,"商品信息获取成功:" + list.toString());
ProductUtils.showProducts(MainActivity.this, list);
setText(">>商品信息获取成功");
}
......@@ -147,6 +161,7 @@ public class MainActivity extends Activity {
};
FastSdk.onCreate(MainActivity.this);
setText("调用初始化");
}
@Override
......@@ -163,7 +178,7 @@ public class MainActivity extends Activity {
@Override
protected void onResume() {
Logger.data("fastsdkdemo","游戏页面onResume");
Logger.data(TAG,"游戏页面onResume");
super.onResume();
FastSdk.onResume(this);
}
......@@ -183,7 +198,7 @@ public class MainActivity extends Activity {
@Override
protected void onRestart() {
super.onRestart();
Logger.data("fastsdkdemo","游戏页面onRestart");
Logger.data(TAG,"游戏页面onRestart");
FastSdk.onRestart(this);
}
......@@ -208,6 +223,17 @@ public class MainActivity extends Activity {
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
FastSdk.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == Math.abs(Manifest.permission.WRITE_EXTERNAL_STORAGE.hashCode())){
if(grantResults[0] == PackageManager.PERMISSION_GRANTED){
Logger.i("权限已被允许");
//your code
}else{
Logger.i("权限已被拒绝");
}
}
// else if (requestCode == Math.abs(Manifest.permission.CAMERA.hashCode())){
//
// }
}
@Override
......@@ -340,6 +366,6 @@ public class MainActivity extends Activity {
}
private void setText(String temp){
str = str + temp + "\n";
textview.setText(str);
textView.setText(str);
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.hl.demo;
import android.app.Activity;
import android.app.AlertDialog;
import android.text.TextUtils;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
......@@ -18,7 +19,7 @@ import java.util.UUID;
public class ProductUtils {
public static void showProducts(Activity activity, List<GoodsInfo> list){
if (list.size() == 0) {
if (list == null || list.size() == 0) {
ToastUtils.toast("商品信息获取为空");
return;
}
......@@ -31,13 +32,21 @@ public class ProductUtils {
PayParams payParams = new PayParams();
payParams.setItemId(payInfo.getItemId());
payParams.setItemName(payInfo.getItemName());
payParams.setAmount(Integer.parseInt(payInfo.getItemPrice()));
payParams.setCount(Integer.valueOf(payInfo.getItemCount()));
if (TextUtils.isEmpty(payInfo.getItemPrice())){
payParams.setAmount(1);
}else {
payParams.setAmount(Integer.parseInt(payInfo.getItemPrice()));
}
if (TextUtils.isEmpty(payInfo.getItemCount())){
payParams.setCount(1);
}else{
payParams.setCount(Integer.parseInt(payInfo.getItemCount()));
}
//扩展信息,回调时原样返回,因为各渠道回调参数限制不一致。回调参数暂时只支持长度50。callBackInfo中不要使用这些符号:“|”、“=”、“+”、“/”。
payParams.setCallbackInfo("支付扩展信息,游戏透传参数"+ UUID.randomUUID().toString().replace("-",""));
Map<String, String> map = new HashMap<>();
map.put("isSupportThirdPayment", "true");//是否支持google之外的三方支付
map.put("payType", "1");// 1 钱包(默认此类型) 2 点卡,短代类支付,需要通过FastSdk.supportShortterm查询
map.put("payType", "1");// 1 钱包(默认此类型) 2 点卡
map.put("currency", payInfo.getShowTag());//币种
payParams.setOpt(map);
FastSdk.pay(activity, payParams);
......
......@@ -24,12 +24,14 @@ import com.hoolai.access.open.fastaccess.interf.HLShareListener;
public class ShareActivity extends Activity {
private TextView picPathTv, contentTv;
private String picPath = "";
private ShareParams params;
private ShareType shareType;
private String picPath = "";//图片url
private ShareParams params;//分享参数
private ShareType shareType;//分享类型
private EditText share_title, share_content, share_url;
private CheckBox share_check;
private int qqShareType;
private int qqShareType;//qq分享类型,1:图片+文字 2:图片
private static final int REQUEST_CODE = 100;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -64,7 +66,7 @@ public class ShareActivity extends Activity {
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 100) {
if (requestCode == REQUEST_CODE) {
if (data != null) {
Uri uri = data.getData();
picPath = getImagePath(uri);
......@@ -197,8 +199,9 @@ public class ShareActivity extends Activity {
return cursor.getString(1);
}
} finally {
if (cursor != null)
if (cursor != null){
cursor.close();
}
}
}
return null;
......
......@@ -30,6 +30,8 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingTop="10dp"
android:paddingRight="5dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
......
......@@ -4,7 +4,7 @@
android:layout_height="match_parent"
android:background="#ccc"
android:orientation="horizontal"
android:padding="20dp">
android:padding="10dp">
<LinearLayout
android:layout_width="0dp"
......@@ -20,7 +20,7 @@
android:layout_height="match_parent"
android:layout_marginTop="5dp"
android:padding="5dp"
android:text="用户信息用户信息用户信息用户信息用户信息用户信"
android:text="分享结果"
android:textColor="#333"
android:textSize="18sp" />
</LinearLayout>
......@@ -35,35 +35,35 @@
<EditText
android:id="@+id/share_title"
android:layout_width="match_parent"
android:layout_height="48dp"
android:text="111"
android:layout_height="42dp"
android:text="我是标题"
android:hint="标题" />
<EditText
android:id="@+id/share_content"
android:layout_width="match_parent"
android:layout_height="48dp"
android:text="222"
android:text="我是内容"
android:hint="内容" />
<EditText
android:id="@+id/share_url"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_height="42dp"
android:hint="链接"
android:text="http://www.baidu.com" />
android:text="https://xx.com" />
<Button
android:id="@+id/share_select"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_height="42dp"
android:layout_gravity="center"
android:onClick="shareSelect"
android:text="选择图片" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_height="60dp"
android:orientation="horizontal"
android:paddingRight="10dp">
<TextView
......
......@@ -3,15 +3,13 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ccc"
android:orientation="vertical"
android:paddingTop="40dp"
android:paddingLeft="20dp"
android:paddingRight="20dp">
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:layout_margin="10dp"
android:background="#fff"
android:padding="3dp">
......@@ -21,7 +19,7 @@
android:layout_height="match_parent"
android:layout_marginTop="5dp"
android:textColor="#333"
android:text="用户信息用户信息用户信息用户信息用户信息用户信"
android:text="分享结果"
android:textSize="18sp" />
</ScrollView>
......@@ -29,28 +27,31 @@
android:id="@+id/share_title"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="4dp"
android:text="111"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text="我是标题"
android:hint="标题"/>
<EditText
android:id="@+id/share_content"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginBottom="4dp"
android:text="222"
android:layout_margin="10dp"
android:text="我是内容"
android:hint="内容"/>
<EditText
android:id="@+id/share_url"
android:layout_width="match_parent"
android:layout_height="48dp"
android:text="http://www.baidu.com"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text="https://xx.com"
android:hint="链接"/>
<Button
android:id="@+id/share_select"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_margin="10dp"
android:layout_gravity="center"
android:onClick="shareSelect"
android:text="选择图片" />
......@@ -74,6 +75,8 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:orientation="horizontal">
<Button
android:layout_width="0dp"
......@@ -101,6 +104,8 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:orientation="horizontal">
<Button
android:layout_width="0dp"
......
File added
include ':app'
rootProject.name='sdk-demo'
include ':app'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment