Skip to content

Commit

Permalink
Bug fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
ssYanhuo committed Oct 5, 2019
1 parent ae9ab4c commit da14789
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "com.ssyanhuo.arknightshelper"
minSdkVersion 21
targetSdkVersion 29
versionCode 9
versionName "Beta-EarlyAutumn-1.0.0"
versionCode 10
versionName "Beta-EarlyAutumn-1.0.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
Binary file modified app/release/app-release.apk
Binary file not shown.
2 changes: 1 addition & 1 deletion app/release/output.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":9,"versionName":"Beta-EarlyAutumn-1.0.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":10,"versionName":"Beta-EarlyAutumn-1.0.1","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void startEngine(View view, boolean startGame){
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean("firstRun", false);
editor.apply();
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){
if(Settings.canDrawOverlays(getApplicationContext())){
Intent intent1 = new Intent(getApplicationContext(), BackendService.class);
try{
Expand All @@ -74,7 +74,7 @@ public void startEngine(View view, boolean startGame){
final Intent intent2 = new Intent(Intent.ACTION_MAIN);
intent2.addCategory(Intent.CATEGORY_LAUNCHER);
if(checkApplication("com.hypergryph.arknights") && checkApplication("com.hypergryph.arknights.bilibili")){
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this, R.style.Theme_AppCompat_Light_Dialog_Alert);
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this, R.style.AppTheme_AlertDialog);
builder.setTitle(R.string.start_two_apps)
.setPositiveButton(R.string.game_official, new DialogInterface.OnClickListener() {
@Override
Expand Down Expand Up @@ -139,7 +139,7 @@ public void onClick(View view) {
final Intent intent2 = new Intent(Intent.ACTION_MAIN);
intent2.addCategory(Intent.CATEGORY_LAUNCHER);
if(checkApplication("com.hypergryph.arknights") && checkApplication("com.hypergryph.arknights.bilibili")){
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this, R.style.Theme_AppCompat_Light_Dialog_Alert);
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this, R.style.AppTheme);
builder.setTitle(R.string.start_two_apps)
.setPositiveButton(R.string.game_official, new DialogInterface.OnClickListener() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,6 @@ public class BackendService extends Service {
ScrollView scrollView_exp;
ScrollView scrollView_material;
Button button;
//公开招募

//经验计算
//TODO 变量放在类里面
//材料计算
String hrJson;
String expJson;
String materialJson;
final int HR = 0;
final int EXP = 1;
final int MATERIAL = 2;
Expand Down Expand Up @@ -101,6 +93,8 @@ public void onCreate() {
layoutParams.type = WindowManager.LayoutParams.TYPE_PHONE;
}
startFloatingButton();
//预处理
floatingWindowPreProcess();
}

public void startFloatingButton(){
Expand Down Expand Up @@ -149,25 +143,11 @@ public void onClick(View view) {
}
});
windowManager.addView(button, layoutParams);

}

public void showFloatingWindow(){
public void floatingWindowPreProcess(){
linearLayout = (LinearLayout) LayoutInflater.from(this).inflate(R.layout.overlay_main, null);
windowManager.removeView(button);
DisplayMetrics displayMetrics = new DisplayMetrics();
windowManager.getDefaultDisplay().getMetrics(displayMetrics);
int rotation = windowManager.getDefaultDisplay().getRotation();
layoutParams.gravity = Gravity.END | Gravity.TOP;
layoutParams.x = 0;
layoutParams.y = 0;
if(rotation == 1 || rotation == 3){
layoutParams.height = displayMetrics.heightPixels;
layoutParams.width = displayMetrics.widthPixels / 2;
}else {
layoutParams.height = displayMetrics.heightPixels / 2;
layoutParams.width = displayMetrics.widthPixels;
}
windowManager.addView(linearLayout, layoutParams);
//实例化view
scrollView_hr = linearLayout.findViewById(R.id.scroll_hr);
scrollView_exp = linearLayout.findViewById(R.id.scroll_exp);
Expand Down Expand Up @@ -218,6 +198,25 @@ public void onTabReselected(TabLayout.Tab tab) {
Material material = new Material();
material.init(getApplicationContext(), linearLayout_material);
}

public void showFloatingWindow(){
windowManager.removeView(button);
DisplayMetrics displayMetrics = new DisplayMetrics();
windowManager.getDefaultDisplay().getMetrics(displayMetrics);
int rotation = windowManager.getDefaultDisplay().getRotation();
layoutParams.gravity = Gravity.END | Gravity.TOP;
layoutParams.x = 0;
layoutParams.y = 0;
if(rotation == 1 || rotation == 3){
layoutParams.height = displayMetrics.heightPixels;
layoutParams.width = displayMetrics.widthPixels / 2;
}else {
layoutParams.height = displayMetrics.heightPixels / 2;
layoutParams.width = displayMetrics.widthPixels;
}
windowManager.addView(linearLayout, layoutParams);

}
public void changeFloatingWindowContent(int i){
switch (i){
case HR:
Expand Down Expand Up @@ -248,6 +247,7 @@ public void changeFloatingWindowContent(int i){
public void hideFloatingWindow(){
windowManager.removeView(linearLayout);
startFloatingButton();
floatingWindowPreProcess();
}
@Override
public void onDestroy() {
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.AlertDialog" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
Expand Down
11 changes: 5 additions & 6 deletions versioninfo
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
versionCode 9
versionName Beta-EarlyAutumn-1.0.0
releaseNote 掉落查询正式上线
versionCode 10
versionName Beta-EarlyAutumn-1.0.1
releaseNote 修复了部分系统不能正常启动悬浮窗的问题
掉落查询正式上线
应用已初步完成构建,进入Beta测试阶段
修复了一些在竖屏模式下可能遇到的小问题
添加调试工具,用于提交错误报告
更新依赖库至最新版本
修复了一些在竖屏模式下可能遇到的小问题

0 comments on commit da14789

Please sign in to comment.