适配最新版本sdk35

master
hwf452 10 months ago
parent 2f422488dd
commit 38bc5ce5e9

@ -1,15 +1,15 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
}
android {
namespace 'com.rehome.bhdxj'
compileSdk 34
compileSdk 35
defaultConfig {
applicationId "com.rehome.bhdxj"
minSdk 24
targetSdk 34
targetSdk 35
versionCode 110
versionName "1.1.0"
multiDexEnabled true
@ -43,20 +43,36 @@ android {
minifyEnabled false
debuggable false // debug
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
//apk
android.applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "DJ_APP.apk"
}
}
signingConfig signingConfigs.release //
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
sourceCompatibility JavaVersion.VERSION_21
targetCompatibility JavaVersion.VERSION_21
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation libs.androidx.core.ktx
implementation libs.androidx.appcompat
implementation libs.material
implementation libs.androidx.activity
implementation libs.androidx.constraintlayout
testImplementation libs.junit
androidTestImplementation libs.androidx.junit
androidTestImplementation libs.androidx.espresso.core
// implementation 'androidx.appcompat:appcompat:1.2.0'
// implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
// implementation 'com.zhy:autolayout:1.4.5'
// implementation 'com.yolanda.nohttp:nohttp:1.0.5'
@ -69,13 +85,12 @@ dependencies {
//
implementation project(':litepal')
implementation 'com.android.volley:volley:1.2.1'
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.0'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.github.huangyanbin:SmartTable:2.2.0'
implementation 'com.google.android.material:material:1.2.1'
// implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.github.bumptech.glide:glide:4.11.0'
@ -92,9 +107,9 @@ dependencies {
implementation 'io.github.azhon:appupdate:4.2.6'
implementation 'com.tencent.bugly:crashreport:3.2.1'
implementation 'com.github.xuexiangjys:XUI:1.1.4'
testImplementation 'junit:junit:4.13.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
// testImplementation 'junit:junit:4.13.1'
// androidTestImplementation 'androidx.test.ext:junit:1.1.2'
// androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
configurations {
all*.exclude group: 'com.google.code.gson'
}

Binary file not shown.

Binary file not shown.

@ -6,14 +6,11 @@ import android.content.pm.PackageInfo
import android.content.pm.PackageManager
import android.graphics.Color
import android.os.Build
import android.os.Looper
import android.provider.Settings
import android.text.TextUtils
import android.util.Log
import android.view.KeyEvent
import android.view.View
import com.android.volley.toolbox.StringRequest
import com.android.volley.toolbox.Volley
import com.azhon.appupdate.listener.OnButtonClickListener
import com.azhon.appupdate.listener.OnDownloadListener
import com.azhon.appupdate.manager.DownloadManager
@ -173,36 +170,6 @@ class LoginActivity : BaseActivityAutoToolbarViewBinding<ActivityLoginBinding>()
})
}
private fun checkUpdateApkOld() {
val queue = Volley.newRequestQueue(this)
val url = Contans.IP + Contans.CHECK_UPDATA_APK
Log.i("app", url)
val stringRequest = StringRequest(url,
{ response ->
Log.i("app", response!!)
val gson = Gson()
val apkUpdateBean: ApkUpdateBean =
gson.fromJson(response, ApkUpdateBean::class.java)
if (apkUpdateBean.total.equals("1")) {
val rowsBean: ApkUpdateBean.RowsBean = apkUpdateBean.rows[0]
val appURL: String = rowsBean.apkurl
val appVersionName: String = rowsBean.versionname
val versioncode: String = rowsBean.versioncode
val appDesc: String = rowsBean.appdesc
if (appVersionName != getVersionName()) {
downloadAndInstall(appURL, appVersionName, appDesc, versioncode)
}
}
},
{ error ->
Log.e("app", error.message, error)
Log.e("app", "调用自动更新接口,获取数据失败")
}
)
queue.add(stringRequest)
}
private fun downloadAndInstall(
downloadURL: String,
versionName: String,
@ -283,9 +250,11 @@ class LoginActivity : BaseActivityAutoToolbarViewBinding<ActivityLoginBinding>()
val sdFormat = SimpleDateFormat("yyyy年MM月dd日")
val date = sdFormat.parse(lastLoginDate)
val calendarLastLogin = Calendar.getInstance()
calendarLastLogin.setTime(date)
if (!Calendar.getInstance().after(calendarLastLogin)) {
return true
if(date!=null){
calendarLastLogin.setTime(date)
if (!Calendar.getInstance().after(calendarLastLogin)) {
return true
}
}
} catch (e: java.lang.Exception) {
e.printStackTrace()
@ -365,7 +334,8 @@ class LoginActivity : BaseActivityAutoToolbarViewBinding<ActivityLoginBinding>()
//静态方法getInstance()使用默认时区和语言环境获得一个日历。
val calendar = Calendar.getInstance()
//增加7天负数则为减少天数
calendar.add(Calendar.DATE, 1)
//calendar.add(Calendar.DATE, 1)
calendar.add(Calendar.DATE, 7)
val nowStr = sdFormat.format(calendar.time)
SPUtils.put(
context,

@ -8,6 +8,7 @@ import android.content.pm.PackageManager;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.IBinder;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
@ -46,7 +47,10 @@ import com.yolanda.nohttp.rest.Response;
import org.litepal.crud.DataSupport;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
public class MainActivity extends BaseActivity3 {
@ -91,6 +95,35 @@ public class MainActivity extends BaseActivity3 {
super.onRestart();
showLog("onRestart");
checkUpdateApk();
//检查登录是否已过期
boolean canOfflineLogin = checkLoginDateNoExpire();
if (!canOfflineLogin) {
Intent intent = new Intent(MainActivity.this, LoginActivity.class);
startActivity(intent);
showToast("离线登录有效期只有7天离线自动登录已失效,请连接wifi后重新登录");
finish();
}
}
private boolean checkLoginDateNoExpire() {
String lastLoginDate = (String) SPUtils.get(MainActivity.this, Contans.LASTLOGINDATE, "");
if (!TextUtils.isEmpty(lastLoginDate)) {
try {
//格式化日期的对象(转化成习惯的时间格式)
SimpleDateFormat sdFormat = new SimpleDateFormat("yyyy年MM月dd日");
Date date = sdFormat.parse(lastLoginDate);
Calendar calendarLastLogin = Calendar.getInstance();
if(date!=null){
calendarLastLogin.setTime(date);
if (!Calendar.getInstance().after(calendarLastLogin)) {
return true;
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
return false;
}
private void setAdapter() {

@ -64,6 +64,7 @@ public class BlueTestInfoActivity extends BaseActivity3 {
initToolbar("蓝牙数据管理", "扫描并确认", new View.OnClickListener() {
@Override
public void onClick(View v) {
showLog("扫描蓝牙设备");
mLeDeviceListAdapter.clear();
mLeDeviceListAdapter.notifyDataSetChanged();
scanLeDevice(true);

@ -1,15 +1,15 @@
apply plugin: 'com.android.library'
android {
compileSdk 34
compileSdk 35
defaultConfig {
minSdk 24
targetSdk 34
targetSdk 35
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
namespace 'com.zhy.autolayout'
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation libs.androidx.appcompat.v170
}

@ -3,7 +3,7 @@ package com.zhy.autolayout;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
;import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatActivity;
/**
* Created by zhy on 15/11/19.

@ -1,6 +1,10 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
//plugins {
// id 'com.android.application' version '8.6.0' apply false
// id 'org.jetbrains.kotlin.android' version '1.8.0' apply false
//}
plugins {
id 'com.android.application' version '8.6.0' apply false
id 'org.jetbrains.kotlin.android' version '1.8.0' apply false
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.android) apply false
}

@ -15,4 +15,5 @@
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
kotlin.code.style=official
android.nonTransitiveRClass=true

@ -0,0 +1,42 @@
[versions]
agp = "8.8.0"
androidxAppcompat = "1.2.0"
androidxRecyclerview = "1.3.0"
appcompatVersion = "1.7.0"
fragment = "1.8.3"
kotlin = "1.9.24"
coreKtx = "1.10.1"
junit = "4.13.2"
junitVersion = "1.1.5"
espressoCore = "3.5.1"
appcompat = "1.6.1"
material = "1.10.0"
activity = "1.8.0"
constraintlayout = "2.1.4"
supportCompat = "28.0.0"
pdfiumAndroid = "1.9.0"
annotationJvm = "1.9.1"
[libraries]
androidx-appcompat-v120 = { module = "androidx.appcompat:appcompat", version.ref = "androidxAppcompat" }
androidx-appcompat-v170 = { module = "androidx.appcompat:appcompat", version.ref = "appcompatVersion" }
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
androidx-fragment = { module = "androidx.fragment:fragment", version.ref = "fragment" }
androidx-recyclerview-recyclerview = { module = "androidx.recyclerview:recyclerview", version.ref = "androidxRecyclerview" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
androidx-activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
pdfium-android = { module = "com.github.barteksc:pdfium-android", version.ref = "pdfiumAndroid" }
recyclerview-v7 = { module = "com.android.support:recyclerview-v7", version.ref = "supportCompat" }
support-compat = { module = "com.android.support:support-compat", version.ref = "supportCompat" }
support-v4 = { module = "com.android.support:support-v4", version.ref = "supportCompat" }
androidx-annotation-jvm = { group = "androidx.annotation", name = "annotation-jvm", version.ref = "annotationJvm" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip

@ -1,10 +1,10 @@
apply plugin: 'com.android.library'
android {
compileSdk 34
compileSdk 35
defaultConfig {
minSdk 24
targetSdk 34
targetSdk 35
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
namespace 'org.litepal'

@ -1,10 +1,10 @@
apply plugin: 'com.android.library'
android {
compileSdk 34
compileSdk 35
defaultConfig {
minSdk 24
targetSdk 34
targetSdk 35
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
namespace 'com.yolanda.nohttp'

@ -7,6 +7,7 @@ pluginManagement {
includeGroupByRegex("androidx.*")
}
}
//google()
mavenCentral()
gradlePluginPortal()
jcenter()
@ -19,10 +20,11 @@ dependencyResolutionManagement {
mavenCentral()
jcenter()
maven {url "https://jitpack.io"}
maven {url 'https://dl.bintray.com/jenly/maven' }
//maven {url 'https://maven.google.com'}
}
}
include ':app',':nohttp',':autolayout',':litepal'
rootProject.name = "BHDXJ"
Loading…
Cancel
Save