update:2020.11.27

fix:适配横屏
add:
This commit is contained in:
2020-11-27 11:13:32 +08:00
parent cf253e460c
commit 790dd16b1a
11 changed files with 546 additions and 7 deletions

View File

@@ -15,8 +15,8 @@ android {
applicationId "com.info.sn"
minSdkVersion 23
targetSdkVersion 28
versionCode 24
versionName "1.2.4"
versionCode 25
versionName "1.2.5"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk {

View File

@@ -61,7 +61,8 @@
android:enabled="true"
android:exported="true"></service>
<activity android:name=".MainActivity">
<activity android:name=".MainActivity"
android:screenOrientation="sensor">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

View File

@@ -11,6 +11,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Bundle;
@@ -96,9 +97,9 @@ public class MainActivity extends CheckPermissionsActivity implements AMapLocati
//设置定位监听
locationClient.setLocationListener(this);
locationClient.startLocation();
if (getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
// if (getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
// setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
// }
PackageManager pm = getPackageManager();
//后台为0可能传过来null
@@ -124,6 +125,16 @@ public class MainActivity extends CheckPermissionsActivity implements AMapLocati
HTTPInterface.setBrowser(MainActivity.this);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
}
public void registerRefreshReceiver() {
mRefreshReceiver = new RefreshReceiver();
IntentFilter filter = new IntentFilter();

View File

@@ -410,6 +410,20 @@ public class MyReceiver extends BroadcastReceiver {
boolean qch_usb_choose = Settings.System.putString(context.getContentResolver(), "qch_usb_choose", "usb_mtp");
LogUtils.e("setUsbState:", Settings.System.getString(context.getContentResolver(), "qch_usb_choose"));
}
String usbStatus = "";
switch (is_dataline) {
case 1:
usbStatus = "qch_action_usb_usb_charge";
break;
case 0:
usbStatus = "qch_action_usb_usb_mtp";
break;
// case "usb_midi":
// usbStatus = "qch_action_usb_usb_midi";
// break;
}
Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
context.sendBroadcast(usbIntent);
} catch (JSONException e) {
e.printStackTrace();
LogUtils.e("setUsbState", e.getMessage());

View File

@@ -368,6 +368,7 @@ public class HTTPInterface {
});
}
synchronized public static void getAllAppPackageName(final Context context) {
OkGo.<String>post(UrlPath.GET_ALL_PACKAGENAME)
.params("sn", Utils.getSerial())
@@ -387,10 +388,13 @@ public class HTTPInterface {
for (com.alibaba.fastjson.JSONObject jsonObject : jsonArray) {
packageList += jsonObject.getString("app_package") + ",";
}
packageList = packageList + "com.info.sn,com.android.uiuios,com.appstore.uiui,com.uiuios.updatetools";
packageList = packageList + "com.info.sn,com.android.uiuios,com.appstore.uiui,com.uiuios.updatetools,com.jiaoguanyi.pager2,com.android.uiuios";
Log.e("packageList now", packageList);
Log.e("packageList", Settings.System.getString(context.getContentResolver(), "qch_app_forbid"));
Settings.System.putString(context.getContentResolver(), "qch_app_forbid", packageList);
}else {
Settings.System.putString(context.getContentResolver(), "qch_app_forbid", "com.info.sn,com.android.uiuios,com.appstore.uiui,com.uiuios.updatetools,com.jiaoguanyi.pager2,com.android.uiuios");
}
} catch (Exception e) {
Log.e("getAllAppPackageName", e.getMessage());
@@ -405,6 +409,7 @@ public class HTTPInterface {
});
}
public static void setBrowser(final Context context) {
OkGo.<String>post(UrlPath.SET_BROWSER_URL)
.params("sn", Utils.getSerial())

View File

@@ -0,0 +1,325 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
tools:context=".MainActivity">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_30"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_exit"
android:layout_width="@dimen/dp_15"
android:layout_height="@dimen/dp_15"
android:layout_marginLeft="@dimen/dp_5"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@drawable/bt_return"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="设备信息"
android:textColor="#4b4b4b"
android:textSize="@dimen/sp_14"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintTop_toBottomOf="@+id/constraintLayout"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<ImageView
android:id="@+id/imageView3"
android:layout_width="@dimen/dp_120"
android:layout_height="@dimen/dp_120"
android:layout_marginTop="16dp"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:src="@drawable/logo"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
</ImageView>
<ImageView
android:id="@+id/imageView"
android:layout_width="@dimen/dp_120"
android:layout_height="@dimen/dp_120"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.500"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView3"
app:layout_constraintVertical_bias="0.241">
</ImageView>
<TextView
android:id="@+id/tv_note"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="请扫描绑定设备"
android:textColor="#4b4b4b"
android:textSize="@dimen/sp_12"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView"
app:layout_constraintVertical_bias="0.276" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="@dimen/dp_280"
android:layout_height="wrap_content"
android:background="@drawable/background"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_30">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="设备SN"
android:textColor="#4b4b4b"
android:textSize="@dimen/sp_12"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_devsn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:text="设备SN"
android:textSize="@dimen/sp_11"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!-- <ImageView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="1dp"-->
<!-- android:layout_alignParentBottom="true"-->
<!-- android:layout_marginLeft="@dimen/dp_10"-->
<!-- android:layout_marginRight="@dimen/dp_10"-->
<!-- android:src="#797979">-->
<!-- </ImageView>-->
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_5">
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="用户姓名"
android:textColor="#4b4b4b"
android:textSize="@dimen/sp_12"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:text=" "
android:textSize="@dimen/sp_11"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!-- <ImageView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="1dp"-->
<!-- android:layout_alignParentBottom="true"-->
<!-- android:layout_marginLeft="@dimen/dp_10"-->
<!-- android:layout_marginRight="@dimen/dp_10"-->
<!-- android:src="#797979">-->
<!-- </ImageView>-->
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_5">
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="学校"
android:textColor="#4b4b4b"
android:textSize="@dimen/sp_12"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_school"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:text=" "
android:textSize="@dimen/sp_11"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!-- <ImageView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="1dp"-->
<!-- android:layout_alignParentBottom="true"-->
<!-- android:layout_marginLeft="@dimen/dp_10"-->
<!-- android:layout_marginRight="@dimen/dp_10"-->
<!-- android:src="#797979">-->
<!-- </ImageView>-->
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_5">
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="年级"
android:textColor="#4b4b4b"
android:textSize="@dimen/sp_12"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_grade"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:text=" "
android:textSize="@dimen/sp_11"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!-- <ImageView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="1dp"-->
<!-- android:layout_alignParentBottom="true"-->
<!-- android:layout_marginLeft="@dimen/dp_10"-->
<!-- android:layout_marginRight="@dimen/dp_10"-->
<!-- android:src="#8c8b8b">-->
<!-- </ImageView>-->
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginBottom="@dimen/dp_10">
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="版本"
android:textColor="#4b4b4b"
android:textSize="@dimen/sp_12"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:text=" "
android:textSize="@dimen/sp_11"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!-- <ImageView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="1dp"-->
<!-- android:layout_alignParentBottom="true"-->
<!-- android:layout_marginLeft="@dimen/dp_10"-->
<!-- android:layout_marginRight="@dimen/dp_10"-->
<!-- android:src="#8c8b8b"></ImageView>-->
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<TextView
android:id="@+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="连续点击版本号,自动下载新版本"
android:textColor="#E14B88"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.503"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minWidth="260dp"
android:layout_centerInParent="true"
android:paddingTop="16dp"
android:background="@drawable/bg_dialog"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:id="@+id/image"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:maxWidth="80dp"
android:maxHeight="80dp"
android:layout_marginRight="16dp"
android:visibility="visible"
tools:src="@drawable/bind" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_vertical"
android:textColor="#333333"
android:textSize="20sp"
android:visibility="visible"
tools:text="消息提示" />
</LinearLayout>
<TextView
android:id="@+id/message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center|left"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:lineSpacingExtra="3dp"
android:lineSpacingMultiplier="1.2"
android:textSize="16dp"
android:textColor="#999999"
tools:text="提示消息提示消息提示消息提示消息提示消息提示消息提示消息提示消息" />
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginTop="16dp"
android:background="#E4E4E4" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/negtive"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:layout_weight="1"
android:background="@null"
android:gravity="center"
android:singleLine="true"
tools:text="No"
android:textColor="#999999"
android:textSize="16sp" />
<View
android:id="@+id/column_line"
android:layout_width="1px"
android:layout_height="match_parent"
android:background="#E4E4E4" />
<Button
android:id="@+id/positive"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:background="@null"
android:gravity="center"
android:singleLine="true"
tools:text="Yes"
android:textColor="#38ADFF"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>

View File

@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
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:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffffff">
<LinearLayout
android:id="@+id/dialog_header"
android:orientation="vertical"
android:layout_width="220dp"
android:layout_height="wrap_content"
android:padding="16dp"
android:gravity="center"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<!-- Icon -->
<ImageView
android:contentDescription="@id/dialog_title"
android:id="@+id/dialog_icon"
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/bind" />
<!-- Titledefault is gone) -->
<TextView
android:id="@+id/dialog_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
android:textSize="18sp"
android:textStyle="bold"
android:textColor="#ffffff"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
android:gravity="center"
app:layout_constraintTop_toBottomOf="@+id/dialog_header"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent">
<!-- Dialog Message -->
<TextView
android:id="@+id/dialog_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
tools:text="Dialog Message" />
<Button
android:id="@+id/dialog_button"
android:layout_width="100dp"
android:layout_height="42dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="8dp"
android:textColor="#ffffff"
android:text="xx"
>
</Button>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>