merge
This commit is contained in:
commit
9e25e95a82
14
.idea/misc.xml
generated
14
.idea/misc.xml
generated
@ -1,6 +1,18 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
|
|
||||||
|
<component name="DesignSurface">
|
||||||
|
<option name="filePathToZoomLevelMap">
|
||||||
|
<map>
|
||||||
|
<entry key="app/src/main/res/layout/qr_vew.xml" value="0.125" />
|
||||||
|
<entry key="app/src/main/res/layout/qrcode_view.xml" value="0.1421875" />
|
||||||
|
<entry key="res/drawable/ic_launcher_background.xml" value="0.225" />
|
||||||
|
<entry key="res/layout/activity_main.xml" value="0.18840579710144928" />
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
|
||||||
|
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
@ -16,6 +16,7 @@ import android.view.KeyEvent;
|
|||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
|
|
||||||
|
import com.fitchgc.jcwallet.dialog.QRCodeActivity;
|
||||||
import com.google.android.gms.auth.api.signin.GoogleSignIn;
|
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.GoogleSignInAccount;
|
||||||
import com.google.android.gms.auth.api.signin.GoogleSignInClient;
|
import com.google.android.gms.auth.api.signin.GoogleSignInClient;
|
||||||
@ -95,6 +96,8 @@ public class MainActivity extends Activity
|
|||||||
private String title;
|
private String title;
|
||||||
private String funId;
|
private String funId;
|
||||||
|
|
||||||
|
private QRCodeActivity qrCodeActivity;
|
||||||
|
|
||||||
//AppAuth
|
//AppAuth
|
||||||
private AuthorizationService mAuthService;
|
private AuthorizationService mAuthService;
|
||||||
private AuthStateManager mAuthStateManager;
|
private AuthStateManager mAuthStateManager;
|
||||||
@ -719,4 +722,14 @@ public class MainActivity extends Activity
|
|||||||
JcSDK.googleOauthCb(this.funId, null, idToken);
|
JcSDK.googleOauthCb(this.funId, null, idToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void showQRCode(String funid, String str, String title) {
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
if (qrCodeActivity == null) {
|
||||||
|
qrCodeActivity = new QRCodeActivity(getContext());
|
||||||
|
}
|
||||||
|
qrCodeActivity.showQRCode(str, title);
|
||||||
|
qrCodeActivity.show();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
29
app/src/com/fitchgc/jcwallet/dialog/BaseDialog.java
Normal file
29
app/src/com/fitchgc/jcwallet/dialog/BaseDialog.java
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package com.fitchgc.jcwallet.dialog;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
|
||||||
|
import com.fitchgc.jcwallet.R;
|
||||||
|
|
||||||
|
public class BaseDialog extends Dialog {
|
||||||
|
|
||||||
|
public BaseDialog(Context context, int themeResId) {
|
||||||
|
super(context, R.style.DialogStyle);
|
||||||
|
Window win = getWindow();
|
||||||
|
// win.setWindowAnimations(R.style.Dialog_bottom_enter_ani);
|
||||||
|
// win.getDecorView().setPadding(0, 0, 0, 0);
|
||||||
|
// win.setGravity(Gravity.BOTTOM);
|
||||||
|
WindowManager.LayoutParams lp = win.getAttributes();
|
||||||
|
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||||
|
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||||
|
win.setAttributes(lp);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseDialog(Context context) {
|
||||||
|
this(context, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
45
app/src/com/fitchgc/jcwallet/dialog/QRCodeActivity.java
Normal file
45
app/src/com/fitchgc/jcwallet/dialog/QRCodeActivity.java
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
package com.fitchgc.jcwallet.dialog;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.BitmapFactory;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.fitchgc.jcwallet.MainActivity;
|
||||||
|
import com.fitchgc.jcwallet.R;
|
||||||
|
import com.king.zxing.util.CodeUtils;
|
||||||
|
|
||||||
|
public class QRCodeActivity extends BaseDialog{
|
||||||
|
|
||||||
|
private final Context baseContent;
|
||||||
|
private TextView titleLabel;
|
||||||
|
private ImageView ivCode;
|
||||||
|
|
||||||
|
|
||||||
|
public QRCodeActivity(Context context) {
|
||||||
|
super(context);
|
||||||
|
baseContent = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.qrcode_view);
|
||||||
|
ivCode = findViewById(R.id.ivCode);
|
||||||
|
titleLabel = findViewById(R.id.qrTitleLabel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showQRCode(String content, String title){
|
||||||
|
new Thread(() -> {
|
||||||
|
Bitmap logo = BitmapFactory.decodeResource(baseContent.getResources(),R.drawable.zxl_flashlight_on);
|
||||||
|
Bitmap bitmap = CodeUtils.createQRCode(content,600, logo);
|
||||||
|
MainActivity.app.runOnUiThread(()->{
|
||||||
|
titleLabel.setText(title);
|
||||||
|
ivCode.setImageBitmap(bitmap);
|
||||||
|
});
|
||||||
|
}).start();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -67,7 +67,7 @@ public class JcSDK {
|
|||||||
MainActivity.app.startActivity(i);
|
MainActivity.app.startActivity(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static void showQRCode(String funid, String content, String title) { MainActivity.app.showQRCode(funid, content, title);}
|
||||||
public static void scanQRCode(String funid, String title) {
|
public static void scanQRCode(String funid, String title) {
|
||||||
MainActivity.app.showQRScan(funid, title);
|
MainActivity.app.showQRScan(funid, title);
|
||||||
}
|
}
|
||||||
|
22
app/src/main/res/layout/qrcode_view.xml
Normal file
22
app/src/main/res/layout/qrcode_view.xml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/ivCode"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/qrTitleLabel"
|
||||||
|
android:text="假装是 APP 主页"
|
||||||
|
android:gravity="center"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"/>
|
||||||
|
</LinearLayout>
|
File diff suppressed because one or more lines are too long
14
js/main.js
14
js/main.js
@ -174,16 +174,6 @@ function importAccount(funId, privateKey) {
|
|||||||
errmsg: err,
|
errmsg: err,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// jc.wallet.erc20Standard.transfer({
|
|
||||||
// address: '0xC76c692450d6221A8B1E035CB8bdB639bC60658D',
|
|
||||||
// from: '0x50A8e60041A206AcaA5F844a1104896224be6F39',
|
|
||||||
// to: '0x746338765a8FbDD1c5aB61bfb92CD6D960C3C662',
|
|
||||||
// amount: 101
|
|
||||||
// }).then((res) => {
|
|
||||||
// console.log(JSON.stringify(res))
|
|
||||||
// }).catch(err => {
|
|
||||||
// console.log(JSON.stringify(err))
|
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* active one account
|
* active one account
|
||||||
@ -342,6 +332,7 @@ function restoreFromMnemonic(funId, mnemonic, password) {
|
|||||||
|
|
||||||
function scanQRCode(funId, title) {
|
function scanQRCode(funId, title) {
|
||||||
try {
|
try {
|
||||||
|
console.log('scanQRCode: ' + title)
|
||||||
jsb.scanQRCode(funId, title);
|
jsb.scanQRCode(funId, title);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return JSON.stringify({
|
return JSON.stringify({
|
||||||
@ -563,7 +554,8 @@ function shardMixByUser(
|
|||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
jsb.jcCallback(funId,JSON.stringify({errcode: 1,errmsg: err}));
|
jsb.jcCallback(funId,JSON.stringify({errcode: 1,errmsg: err}));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// addresses: [nftId, chip, sign_address]
|
// addresses: [nftId, chip, sign_address]
|
||||||
// values: [token_id,salt_nonce,startTime]
|
// values: [token_id,salt_nonce,startTime]
|
||||||
|
@ -7,4 +7,5 @@
|
|||||||
<color name="teal_700">#FF018786</color>
|
<color name="teal_700">#FF018786</color>
|
||||||
<color name="black">#FF000000</color>
|
<color name="black">#FF000000</color>
|
||||||
<color name="white">#FFFFFFFF</color>
|
<color name="white">#FFFFFFFF</color>
|
||||||
|
<color name="transparent">#00000000</color>
|
||||||
</resources>
|
</resources>
|
@ -2,5 +2,6 @@
|
|||||||
<string name="app_name">HeadlessCocos</string>
|
<string name="app_name">HeadlessCocos</string>
|
||||||
<string name="game_view_content_description">Game view</string>
|
<string name="game_view_content_description">Game view</string>
|
||||||
<string name="permission_camera">Scan QRCode need camera permission</string>
|
<string name="permission_camera">Scan QRCode need camera permission</string>
|
||||||
|
<string name="qr_code_title">QRCode</string>
|
||||||
<string name="default_web_client_id">165555585193-j22geb66hjku5ns5lq5voaj4v7811cl7.apps.googleusercontent.com</string>
|
<string name="default_web_client_id">165555585193-j22geb66hjku5ns5lq5voaj4v7811cl7.apps.googleusercontent.com</string>
|
||||||
</resources>
|
</resources>
|
@ -9,4 +9,15 @@
|
|||||||
<item name="android:windowIsTranslucent">true</item>
|
<item name="android:windowIsTranslucent">true</item>
|
||||||
<item name="android:windowBackground">@android:color/transparent</item>
|
<item name="android:windowBackground">@android:color/transparent</item>
|
||||||
</style>
|
</style>
|
||||||
|
<style name="DialogStyle" parent="@android:style/Theme.Dialog">
|
||||||
|
<item name="android:windowFrame">@null</item>
|
||||||
|
<item name="android:windowBackground">@color/transparent</item>
|
||||||
|
<item name="android:windowNoTitle">true</item>
|
||||||
|
<item name="android:windowIsFloating">true</item>
|
||||||
|
<item name="android:windowContentOverlay">@null</item>
|
||||||
|
</style>
|
||||||
|
<style name="Dialog_bottom_enter_ani">
|
||||||
|
<item name="android:windowEnterAnimation">@anim/dlg_enter</item>
|
||||||
|
<item name="android:windowExitAnimation">@anim/dlg_exit</item>
|
||||||
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user