Skip to content

Commit 77e6186

Browse files
committed
MCinaBox 1.New Downloader (stable) 2.Mult Languages Support 3.Fix some known bugs 4.Support mods?(Lack Tests). This is not a release Version, So there is no prebuild apk provided.I will continue to test this version,and release it in one day.
1 parent a3b37fb commit 77e6186

File tree

95 files changed

+2332
-1295
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+2332
-1295
lines changed

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

boat/src/main/java/cosine/boat/BoatClientActivity.java

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ private void OnTouchCrossKey(View p1,MotionEvent p2){
703703
Log.e("OnTouchCrossKey","Release Index: "+temp);
704704
mInputEventSender.setKey(temp,false,0);
705705

706-
//TODO:时序
706+
//时序
707707
try {
708708
Thread.sleep(0);
709709
} catch (InterruptedException e) {
@@ -933,7 +933,7 @@ private void SendDownOrUpToInput(int[] recordKeys,int[] downKeys,int mode){
933933
Log.e("DnOrUpInput", "Catch Index: " + temp);
934934
mInputEventSender.setKey(temp, true, 0);
935935

936-
//TODO:时序
936+
//时序
937937
try {
938938
Thread.sleep(0);
939939
} catch (InterruptedException e) {
@@ -949,7 +949,7 @@ private void SendDownOrUpToInput(int[] recordKeys,int[] downKeys,int mode){
949949
Log.e("DnOrUpInput","Release Index: "+temp);
950950
mInputEventSender.setKey(temp,false,0);
951951

952-
//TODO:时序
952+
//时序
953953
try {
954954
Thread.sleep(0);
955955
} catch (InterruptedException e) {
@@ -1058,7 +1058,7 @@ public void onFinish() {
10581058
Log.e("JoyStick","Release Index " + temp);
10591059
mInputEventSender.setKey(temp,false,0);
10601060

1061-
//TODO:时序
1061+
//时序
10621062
try {
10631063
Thread.sleep(0);
10641064
} catch (InterruptedException e) {
@@ -1118,37 +1118,10 @@ private void OnClickTouchPad(MotionEvent p1){
11181118
//捕获模式
11191119
switch(p1.getAction()){
11201120
case MotionEvent.ACTION_DOWN:
1121-
/*TOUCH_DOWN_TIME = p1.getDownTime();
1122-
if(layoutsPos.containsKey(touchpad)){
1123-
layoutsPos.remove(touchpad);
1124-
layoutsPos.put(touchpad,new int[] {(int) p1.getRawX(),(int) p1.getRawY()});
1125-
}else{
1126-
layoutsPos.put(touchpad,new int[] {(int) p1.getRawX(),(int) p1.getRawY()});
1127-
}*/
11281121
break;
11291122
case MotionEvent.ACTION_MOVE:
11301123
TOUCH_IS_MOVED = true;
1131-
//int[] temp = layoutsPos.get(touchpad);
1132-
/*if(!TOUCH_LONG_APPLY && !TOUCH_IS_OUTLIMITION) {
1133-
if (Math.abs(temp[0] - p1.getRawX()) >= MAX_MOVE_LIMITION && Math.abs(temp[1] - p1.getRawY()) >= MAX_MOVE_LIMITION) {
1134-
Log.e("Location","X轴偏移: " + Math.abs(temp[0] - p1.getRawX()) + " Y轴偏移: " + Math.abs(temp[1] - p1.getRawY()));
1135-
Log.e("Screen","触摸位置超出限制!");
1136-
TOUCH_IS_OUTLIMITION = true;
1137-
} else {
1138-
Log.e("Location","X轴偏移: " + Math.abs(temp[0] - p1.getRawX()) + " Y轴偏移: " + Math.abs(temp[1] - p1.getRawY()));
1139-
Log.e("Screen","触摸位置未超出限制!");
1140-
TOUCH_IS_OUTLIMITION = false;
1141-
}
1142-
if(p1.getEventTime() - TOUCH_DOWN_TIME > MAX_CLICK_TIME){
1143-
Log.e("Screen","触摸达到长按阀值!");
1144-
TOUCH_IS_LONGCLICK = true;
1145-
}
1146-
if(TOUCH_IS_LONGCLICK && !TOUCH_IS_OUTLIMITION){
1147-
Log.e("Screen","长按事件被激活!");
1148-
//mInputEventSender.setMouseButton((byte)1,true);
1149-
TOUCH_LONG_APPLY = true;
1150-
}
1151-
}*/
1124+
11521125
break;
11531126
case MotionEvent.ACTION_UP:
11541127
//TOUCH_UP_TIME = p1.getEventTime();

boat/src/main/java/cosine/boat/LauncherActivity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ public void onCreate(Bundle savedInstance) {
2323

2424
//初始化日志
2525
//【release版暂时不开启】
26-
/*
26+
2727
final String logPath = BOAT_HOME + "/log.txt";
2828
Logcat.initializeOutOfProcess(this, logPath, LogcatService.class);
29-
*/
29+
3030

3131
final String reportPath = BOAT_HOME + "/crash.txt";
3232
System.out.println("Crash report: " + reportPath);

boat/src/main/java/cosine/boat/version3/BoatClientActivity.java

Lines changed: 45 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package cosine.boat.version3;
22

33
import android.content.Context;
4+
import android.content.Intent;
45
import android.graphics.drawable.GradientDrawable;
6+
import android.text.method.Touch;
57
import android.util.Log;
68
import android.view.MotionEvent;
79
import android.os.Bundle;
@@ -78,7 +80,7 @@ public class BoatClientActivity extends NativeActivity implements View.OnClickL
7880
private HashMap<Object,int[]> layoutsPos;
7981
private CrossButton[] crosskeychildren;
8082
private int[] tempCrossKey;
81-
private CheckBox checkbox_qwertkeyboard,checkbox_crosskey,checkbox_mousekey,checkbox_virtualkeyboard,checkbox_otg,checkbox_joystick,checkbox_lock;
83+
private CheckBox checkbox_qwertkeyboard,checkbox_crosskey,checkbox_mousekey,checkbox_virtualkeyboard,checkbox_otg,checkbox_joystick,checkbox_lock,checkbox_edittext;
8284
private CheckBox[] toolerBarChildren;
8385
private HorizontalScrollView SwitcherBar_container;
8486
private ImageButton SwitcherBar_switcher;
@@ -90,6 +92,7 @@ public class BoatClientActivity extends NativeActivity implements View.OnClickL
9092
private Button qwertkeyboard_move;
9193
private Button mousekey_move;
9294
private Button crosskey_move;
95+
private HashMap<GameButton,Boolean> autoKeep = new HashMap<GameButton,Boolean>();
9396

9497
private long TOUCH_DOWN_TIME;
9598
private long TOUCH_UP_TIME;
@@ -373,7 +376,8 @@ public void InitWindowsAndScreenKeyboard(){
373376
checkbox_joystick = SwitcherBar.findViewById(R.id.checkbox_Joystick);
374377
checkbox_otg = SwitcherBar.findViewById(R.id.checkbox_Otg);
375378
checkbox_lock = SwitcherBar.findViewById(R.id.checkbox_Lock);
376-
toolerBarChildren = new CheckBox[]{checkbox_qwertkeyboard,checkbox_crosskey,checkbox_mousekey,checkbox_virtualkeyboard,checkbox_otg,checkbox_joystick,checkbox_lock};
379+
checkbox_edittext = SwitcherBar.findViewById(R.id.checkbox_Edittext);
380+
toolerBarChildren = new CheckBox[]{checkbox_qwertkeyboard,checkbox_crosskey,checkbox_mousekey,checkbox_virtualkeyboard,checkbox_otg,checkbox_joystick,checkbox_lock,checkbox_edittext};
377381
SwitcherBar_container = SwitcherBar.findViewById(R.id.switchbar_container);
378382
SwitcherBar_switcher = SwitcherBar.findViewById(R.id.switchbar_switcher);
379383
SwitcherBar_switcher.setOnTouchListener(this);
@@ -440,19 +444,19 @@ public void InitWindowsAndScreenKeyboard(){
440444
}
441445
}
442446

443-
//设定CrossKey十字键的监听
444-
for(int i = 0;i < ((LinearLayout)base.findViewById(R.id.CrossKey)).getChildCount();i++){
445-
if(((LinearLayout)base.findViewById(R.id.CrossKey)).getChildAt(i) instanceof Button){
446-
((LinearLayout)base.findViewById(R.id.CrossKey)).getChildAt(i).setOnTouchListener(this);
447-
}else{
448-
for(int a = 0;a < ((LinearLayout)((LinearLayout)base.findViewById(R.id.CrossKey)).getChildAt(i)).getChildCount();a++){
449-
for(int b = 0;b< ((LinearLayout)(((LinearLayout)((LinearLayout)base.findViewById(R.id.CrossKey)).getChildAt(i)).getChildAt(a))).getChildCount();b++){
450-
((LinearLayout)(((LinearLayout)((LinearLayout)base.findViewById(R.id.CrossKey)).getChildAt(i)).getChildAt(a))).getChildAt(b).setOnTouchListener(this);
451-
((LinearLayout)(((LinearLayout)((LinearLayout)base.findViewById(R.id.CrossKey)).getChildAt(i)).getChildAt(a))).getChildAt(b).getBackground().setAlpha(100);
452-
}
453-
}
454-
}
455-
}
447+
//设定CrossKey十字键的监听
448+
for(int i = 0;i < ((LinearLayout)base.findViewById(R.id.CrossKey)).getChildCount();i++){
449+
if(((LinearLayout)base.findViewById(R.id.CrossKey)).getChildAt(i) instanceof Button){
450+
((LinearLayout)base.findViewById(R.id.CrossKey)).getChildAt(i).setOnTouchListener(this);
451+
}else{
452+
for(int a = 0;a < ((LinearLayout)((LinearLayout)base.findViewById(R.id.CrossKey)).getChildAt(i)).getChildCount();a++){
453+
for(int b = 0;b< ((LinearLayout)(((LinearLayout)((LinearLayout)base.findViewById(R.id.CrossKey)).getChildAt(i)).getChildAt(a))).getChildCount();b++){
454+
((LinearLayout)(((LinearLayout)((LinearLayout)base.findViewById(R.id.CrossKey)).getChildAt(i)).getChildAt(a))).getChildAt(b).setOnTouchListener(this);
455+
((LinearLayout)(((LinearLayout)((LinearLayout)base.findViewById(R.id.CrossKey)).getChildAt(i)).getChildAt(a))).getChildAt(b).getBackground().setAlpha(150);
456+
}
457+
}
458+
}
459+
}
456460

457461

458462
//显示布局到悬浮窗
@@ -538,18 +542,26 @@ public GameButton GetButtonFromModel(String KeyName, int KeySizeW,int KeySizeH,
538542
return KeyButton;
539543
}
540544

541-
public static float getPxFromDp(Context context, float dpValue) {
542-
final float scale = context.getResources().getDisplayMetrics().density;
543-
return (dpValue * scale);
544-
}
545+
public static float getPxFromDp(Context context, float dpValue) {
546+
final float scale = context.getResources().getDisplayMetrics().density;
547+
return (float) (dpValue * scale + 0.5f);
548+
}
545549

546-
public static float getDpFromPx(Context context, float pxValue){
547-
final float scale = context.getResources().getDisplayMetrics().density;
548-
return (pxValue / scale);
549-
}
550+
public static float getDpFromPx(Context context, float pxValue){
551+
final float scale = context.getResources().getDisplayMetrics().density;
552+
return ((float) ((pxValue - 0.5f)/scale))+1;
553+
}
550554

551555
private void OnTouchVirtualKeyboard(GameButton gameButton,MotionEvent p2){
552556
if(p2.getActionMasked() == MotionEvent.ACTION_DOWN){
557+
if(gameButton.isKeep()){
558+
if(autoKeep.containsKey(gameButton)){
559+
autoKeep.remove(gameButton);
560+
return;
561+
}else{
562+
autoKeep.put(gameButton,true);
563+
}
564+
}
553565
if(gameButton.isMult()){
554566
Log.e("VirtualKey-Mult","KeyName: " + gameButton.getKeyMain() + " " + gameButton.getSpecialOne() + " " + gameButton.getSpecialTwo() +" KeyIndex: " + gameButton.getMainIndex() + " " + gameButton.getSpecialOneIndex() + " " + gameButton.getSpecialTwoIndex() + " Status: " + "pressed");
555567
BoatInputEventSender.setKey(gameButton.getMainIndex(), true, 0);
@@ -651,7 +663,7 @@ private void OnTouchCrossKey(View p1,MotionEvent p2){
651663
Log.e("OnTouchCrossKey","Release Index: "+temp);
652664
BoatInputEventSender.setKey(temp,false,0);
653665

654-
//TODO:时序
666+
//时序
655667
try {
656668
Thread.sleep(0);
657669
} catch (InterruptedException e) {
@@ -881,7 +893,7 @@ private void SendDownOrUpToInput(int[] recordKeys,int[] downKeys,int mode){
881893
Log.e("DnOrUpInput", "Catch Index: " + temp);
882894
BoatInputEventSender.setKey(temp, true, 0);
883895

884-
//TODO:时序
896+
//时序
885897
try {
886898
Thread.sleep(0);
887899
} catch (InterruptedException e) {
@@ -897,7 +909,7 @@ private void SendDownOrUpToInput(int[] recordKeys,int[] downKeys,int mode){
897909
Log.e("DnOrUpInput","Release Index: "+temp);
898910
BoatInputEventSender.setKey(temp,false,0);
899911

900-
//TODO:时序
912+
//时序
901913
try {
902914
Thread.sleep(0);
903915
} catch (InterruptedException e) {
@@ -970,6 +982,12 @@ public void onCheckedChanged(CompoundButton v,boolean ischecked){
970982
mousekey_move.setVisibility(View.INVISIBLE);
971983
crosskey_move.setVisibility(View.INVISIBLE);
972984
}
985+
}else if(v == checkbox_edittext){
986+
if(ischecked){
987+
inputScanner.setVisibility(View.VISIBLE);
988+
}else{
989+
inputScanner.setVisibility(View.INVISIBLE);
990+
}
973991
}
974992
}
975993
};
@@ -1000,7 +1018,7 @@ public void onFinish() {
10001018
Log.e("JoyStick","Release Index " + temp);
10011019
BoatInputEventSender.setKey(temp,false,0);
10021020

1003-
//TODO:时序
1021+
//时序
10041022
try {
10051023
Thread.sleep(0);
10061024
} catch (InterruptedException e) {
@@ -1060,37 +1078,9 @@ private void OnClickTouchPad(MotionEvent p1){
10601078
//捕获模式
10611079
switch(p1.getAction()){
10621080
case MotionEvent.ACTION_DOWN:
1063-
/*TOUCH_DOWN_TIME = p1.getDownTime();
1064-
if(layoutsPos.containsKey(touchpad)){
1065-
layoutsPos.remove(touchpad);
1066-
layoutsPos.put(touchpad,new int[] {(int) p1.getRawX(),(int) p1.getRawY()});
1067-
}else{
1068-
layoutsPos.put(touchpad,new int[] {(int) p1.getRawX(),(int) p1.getRawY()});
1069-
}*/
10701081
break;
10711082
case MotionEvent.ACTION_MOVE:
10721083
TOUCH_IS_MOVED = true;
1073-
//int[] temp = layoutsPos.get(touchpad);
1074-
/*if(!TOUCH_LONG_APPLY && !TOUCH_IS_OUTLIMITION) {
1075-
if (Math.abs(temp[0] - p1.getRawX()) >= MAX_MOVE_LIMITION && Math.abs(temp[1] - p1.getRawY()) >= MAX_MOVE_LIMITION) {
1076-
Log.e("Location","X轴偏移: " + Math.abs(temp[0] - p1.getRawX()) + " Y轴偏移: " + Math.abs(temp[1] - p1.getRawY()));
1077-
Log.e("Screen","触摸位置超出限制!");
1078-
TOUCH_IS_OUTLIMITION = true;
1079-
} else {
1080-
Log.e("Location","X轴偏移: " + Math.abs(temp[0] - p1.getRawX()) + " Y轴偏移: " + Math.abs(temp[1] - p1.getRawY()));
1081-
Log.e("Screen","触摸位置未超出限制!");
1082-
TOUCH_IS_OUTLIMITION = false;
1083-
}
1084-
if(p1.getEventTime() - TOUCH_DOWN_TIME > MAX_CLICK_TIME){
1085-
Log.e("Screen","触摸达到长按阀值!");
1086-
TOUCH_IS_LONGCLICK = true;
1087-
}
1088-
if(TOUCH_IS_LONGCLICK && !TOUCH_IS_OUTLIMITION){
1089-
Log.e("Screen","长按事件被激活!");
1090-
//mInputEventSender.setMouseButton((byte)1,true);
1091-
TOUCH_LONG_APPLY = true;
1092-
}
1093-
}*/
10941084
break;
10951085
case MotionEvent.ACTION_UP:
10961086
//TOUCH_UP_TIME = p1.getEventTime();

mcinabox/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ android {
1313
minSdkVersion 21
1414
targetSdkVersion 21
1515
versionCode 1
16-
versionName '0.1.1'
16+
versionName '0.1.2'
1717
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1818
}
1919
buildTypes {
2020
release {
2121
minifyEnabled false
2222
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23+
debuggable = true
24+
jniDebuggable = false
2325
}
2426
}
2527
lintOptions{
@@ -35,6 +37,7 @@ dependencies {
3537
implementation 'com.google.code.gson:gson:2.8.6'
3638
implementation 'com.github.shixiuwen:colorpicker:v1.0.3'
3739
implementation 'com.github.MasayukiSuda:BubbleLayout:v1.2.1'
40+
implementation 'com.liulishuo.filedownloader:library:1.7.7'
3841
implementation project(path: ':sharedmodule')
3942
implementation project(path: ':boat')
4043
}
-259 KB
Binary file not shown.
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
package com.aof.mcinabox;
22

3-
//为避免循环依赖,且顾及到前后端适配的可扩展性
4-
//需要copy一份adapt包保持对象的一致性
5-
63
public class DataPathManifest extends com.aof.sharedmodule.Data.DataPathManifest{}

0 commit comments

Comments
 (0)