好运司机端2.0初始化
15
.gitignore
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/caches
|
||||
/.idea/libraries
|
||||
/.idea/modules.xml
|
||||
/.idea/workspace.xml
|
||||
/.idea/navEditor.xml
|
||||
/.idea/assetWizardSettings.xml
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
local.properties
|
3
.idea/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
6
.idea/compiler.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="11" />
|
||||
</component>
|
||||
</project>
|
10
.idea/deploymentTargetDropDown.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetDropDown">
|
||||
<value>
|
||||
<entry key="app">
|
||||
<State />
|
||||
</entry>
|
||||
</value>
|
||||
</component>
|
||||
</project>
|
20
.idea/gradle.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
<option value="$PROJECT_DIR$/mylibrary" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveExternalAnnotations" value="false" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
6
.idea/kotlinc.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="KotlinJpsPluginSettings">
|
||||
<option name="version" value="1.9.22" />
|
||||
</component>
|
||||
</project>
|
10
.idea/migrations.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectMigrations">
|
||||
<option name="MigrateToGradleLocalJavaHome">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
87
.idea/misc.xml
Normal file
@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DesignSurface">
|
||||
<option name="filePathToZoomLevelMap">
|
||||
<map>
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.2225" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/drawable-v24/marquee_bg.xml" value="0.216" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/drawable-v24/shape_code_bg5.xml" value="0.206" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/drawable-v24/shape_ok_bg.xml" value="0.216" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/drawable-v24/shape_phone_bg.xml" value="0.206" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/drawable/bg_btn.xml" value="0.2225" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/drawable/bg_waybill_item.xml" value="0.216" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/drawable/ic_baseline_home_24.xml" value="0.1925" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/drawable/ic_launcher_background.xml" value="0.2225" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/drawable/marquee_bg.xml" value="0.216" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/drawable/search_bg.xml" value="0.216" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/drawable/select_auth_team.xml" value="0.2215" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/drawable/select_auth_team_text.xml" value="0.2215" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/drawable/select_pass.xml" value="0.2225" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/drawable/select_read.xml" value="0.2225" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/drawable/shape_btn_bg4.xml" value="0.1925" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/drawable/shape_code_bg5.xml" value="0.206" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/drawable/shape_count_downbg.xml" value="0.192" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/drawable/shape_gray_5.xml" value="0.2135" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/drawable/shape_message_item_bg.xml" value="0.206" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/drawable/shape_mine_bg20.xml" value="0.1925" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/drawable/shape_ok_bg.xml" value="0.216" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/drawable/shape_orange_5.xml" value="0.2135" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/drawable/shape_person_bg.xml" value="0.1805" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/drawable/shape_phone_bg.xml" value="0.206" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/drawable/shape_search_bg.xml" value="0.2265" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/drawable/shape_waybill_item_bg.xml" value="0.216" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/drawable/shape_white_12.xml" value="0.216" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout-w936dp/activity_auth.xml" value="0.35498046875" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout-w936dp/activity_auth_bankcard.xml" value="0.18932291666666667" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout-w936dp/activity_auth_driver.xml" value="0.35498046875" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout-w936dp/activity_auth_driving.xml" value="0.18932291666666667" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout-w936dp/activity_auth_face.xml" value="0.18932291666666667" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout-w936dp/activity_auth_load.xml" value="0.18932291666666667" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout-w936dp/activity_auth_qualification.xml" value="0.22" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout-w936dp/activity_auth_role.xml" value="0.35498046875" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout-w936dp/activity_auth_team.xml" value="0.18932291666666667" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout-w936dp/activity_login.xml" value="0.2714285714285714" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout-w936dp/activity_person_auth.xml" value="0.35498046875" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout-w936dp/activity_waybill_detail.xml" value="0.20078125" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout-w936dp/fragment_message.xml" value="0.5" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout-w936dp/fragment_waybill.xml" value="0.274609375" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout-w936dp/item_message.xml" value="0.33" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout/activity_auth_bankcard.xml" value="0.30055579307396324" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout/activity_auth_driver.xml" value="0.30055579307396324" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout/activity_auth_driving.xml" value="0.30055579307396324" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout/activity_auth_face.xml" value="0.30055579307396324" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout/activity_auth_load.xml" value="0.30055579307396324" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout/activity_auth_person.xml" value="0.3099615220179564" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout/activity_auth_qualification.xml" value="0.29674968341072183" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout/activity_auth_road.xml" value="0.1351004702864472" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout/activity_auth_role.xml" value="0.25" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout/activity_auth_team.xml" value="0.3060363022372309" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout/activity_code.xml" value="0.30055579307396324" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout/activity_home.xml" value="0.36614583333333334" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout/activity_launcher.xml" value="0.36614583333333334" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout/activity_login.xml" value="0.3605128205128205" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout/activity_main.xml" value="0.36614583333333334" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout/activity_person_auth.xml" value="0.29674968341072183" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout/activity_select_role.xml" value="0.28858486532706284" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout/activity_text.xml" value="0.16822916666666668" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout/activity_waybill_detail.xml" value="0.20906370243693886" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout/fragment_home.xml" value="0.33" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout/fragment_message.xml" value="0.30055579307396324" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout/fragment_mine.xml" value="0.36614583333333334" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout/fragment_waybill.xml" value="0.30055579307396324" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout/fragment_waybill_list.xml" value="0.30055579307396324" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout/grid_item.xml" value="0.3651041666666667" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout/grid_mine_item.xml" value="0.2535271483539974" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout/item_message.xml" value="0.30055579307396324" />
|
||||
<entry key="..\:/2024work/GLDriver/app/src/main/res/layout/item_waybill.xml" value="0.3651041666666667" />
|
||||
<entry key="..\:/2024work/GLDriver/mylibrary/src/main/res/layout/common_toolbar.xml" value="0.30055579307396324" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
</project>
|
6
.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
1
app/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
110
app/build.gradle
Normal file
@ -0,0 +1,110 @@
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
id 'org.jetbrains.kotlin.android'
|
||||
}
|
||||
def releaseTime() {
|
||||
return new Date().format("yyyyMMddHHmm", TimeZone.getTimeZone("GMT+08:00"))
|
||||
}
|
||||
android {
|
||||
compileSdk rootProject.ext.android["compileSdkVersion"]
|
||||
|
||||
defaultConfig {
|
||||
applicationId rootProject.ext.android["applicationId"]
|
||||
minSdkVersion rootProject.ext.android["minSdkVersion"]
|
||||
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
|
||||
versionCode rootProject.ext.android["versionCode"]
|
||||
versionName rootProject.ext.android["versionName"]
|
||||
flavorDimensions "CHANNEL_VALUE"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '11'
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
viewBinding = true
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
jniLibs.srcDir 'libs'
|
||||
//说明so的路径为该libs路径,关联所有地图SDK的so文件
|
||||
}
|
||||
}
|
||||
|
||||
productFlavors {
|
||||
|
||||
dev {
|
||||
applicationId "com.dahe.gldriver"
|
||||
manifestPlaceholders = [CHANNEL_VALUE: "审核端(测试)",
|
||||
// app_icon : "@drawable/head_defaut",
|
||||
JPUSH_PKGNAME: applicationId,
|
||||
//JPush 上注册的包名对应的 Appkey.
|
||||
JPUSH_APPKEY : "5d63ef6fdf58ada352bb8f07",
|
||||
//暂时填写默认值即可.
|
||||
JPUSH_CHANNEL: "developer-n"]
|
||||
buildConfigField("String", "OPEN_AL_URL", "\"https://oapi-staging.alct56.com\"")
|
||||
buildConfigField("String", "BASE_URL", "\"http://app.test.dahehuoyun.com/api/\"")
|
||||
buildConfigField "boolean", "isTest", "true"
|
||||
//APP名称,可以在androidMainfest中引用
|
||||
resValue "string", "appName", "审核测试"
|
||||
}
|
||||
prod {
|
||||
applicationId "com.dahe.gldriver"
|
||||
manifestPlaceholders = [CHANNEL_VALUE: "审核端",
|
||||
// app_icon : "@drawable/ysxy",
|
||||
JPUSH_PKGNAME: applicationId,
|
||||
//JPush 上注册的包名对应的 Appkey.
|
||||
JPUSH_APPKEY : "5d63ef6fdf58ada352bb8f07",
|
||||
//暂时填写默认值即可.
|
||||
JPUSH_CHANNEL: "developer-default"]
|
||||
buildConfigField("String", "OPEN_AL_URL", "\"https://oapi.alct56.com\"")
|
||||
buildConfigField("String", "BASE_URL", "\"http://app.dahehuoyun.com/api/\"")
|
||||
buildConfigField "boolean", "isTest", "false"
|
||||
resValue "string", "appName", "审核"
|
||||
}
|
||||
}
|
||||
|
||||
android.applicationVariants.all { variant ->
|
||||
variant.outputs.all {
|
||||
//获取渠道名称
|
||||
def isText = variant.productFlavors[0].properties.get("buildConfigFields").getAt("isTest").properties.get("value")
|
||||
def appName = null
|
||||
if (isText == "true") {
|
||||
appName = '司机端测试_'
|
||||
} else {
|
||||
appName = '司机端正式_'
|
||||
}
|
||||
outputFileName = appName + "${variant.buildType.name}_${defaultConfig.versionName}_${releaseTime()}.apk"
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation 'androidx.core:core-ktx:1.7.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.3.0'
|
||||
implementation 'com.google.android.material:material:1.4.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||
implementation 'androidx.annotation:annotation:1.2.0'
|
||||
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
|
||||
|
||||
implementation project(path: ':mylibrary')
|
||||
}
|
21
app/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
@ -0,0 +1,24 @@
|
||||
package com.dahe.gldriver
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ExampleInstrumentedTest {
|
||||
@Test
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("com.dahe.gldriver", appContext.packageName)
|
||||
}
|
||||
}
|
145
app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,145 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.dahe.gldriver">
|
||||
|
||||
<application
|
||||
android:name=".base.App"
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.GLDriver"
|
||||
tools:targetApi="31">
|
||||
|
||||
<meta-data
|
||||
android:name="CHANNEL"
|
||||
android:value="${CHANNEL_VALUE}" />
|
||||
|
||||
<!-- 适配全面屏 Android O vivo&oppo -->
|
||||
<meta-data
|
||||
android:name="android.max_aspect"
|
||||
android:value="2.2" /> <!-- 适配刘海屏、水滴屏 Android O 小米 -->
|
||||
<meta-data
|
||||
android:name="notch.config"
|
||||
android:value="portrait|landscape" /> <!-- 适配刘海屏、水滴屏 Android O 华为 -->
|
||||
<meta-data
|
||||
android:name="android.notch_support"
|
||||
android:value="true" />
|
||||
|
||||
<activity
|
||||
android:name=".ui.LauncherActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.Splash"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".ui.HomeActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden">
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".ui.account.LoginActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
|
||||
<activity
|
||||
android:name=".ui.account.CodeLoginActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
|
||||
<!-- 司机车辆认证相关start -->
|
||||
|
||||
<activity
|
||||
android:name=".ui.account.SelectRoleActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
|
||||
|
||||
<activity
|
||||
android:name=".ui.account.authperson.AuthPersonActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
<activity
|
||||
android:name=".ui.account.authperson.AuthDriverActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
<activity
|
||||
android:name=".ui.account.authperson.AuthQualificationActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
<activity
|
||||
android:name=".ui.account.authperson.AuthBankCardActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
<activity
|
||||
android:name=".ui.account.authperson.AuthFaceActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
<activity
|
||||
android:name=".ui.account.authperson.AuthDrivingActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
|
||||
<activity
|
||||
android:name=".ui.account.authperson.AuthRoadActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
<activity
|
||||
android:name=".ui.account.authteam.AuthTeamActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
<!-- 司机车辆认证相关end -->
|
||||
|
||||
<!-- 运单相关start -->
|
||||
<activity
|
||||
android:name=".ui.waybill.activity.WaybillDetailActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
<!-- 运单相关end -->
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
@ -0,0 +1,71 @@
|
||||
package com.dahe.gldriver.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.BaseAdapter
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.gldriver.bean.GridBean
|
||||
|
||||
|
||||
/**
|
||||
* @ClassName GridItemAdapter
|
||||
* @Author 用户
|
||||
* @Date 2024/1/23 10:26
|
||||
* @Description TODO
|
||||
*/
|
||||
class GridItemAdapter(private val context: Context, private val dataList: MutableList<GridBean>) :
|
||||
BaseAdapter() {
|
||||
|
||||
private var cusLayout: Int = 0
|
||||
|
||||
constructor(context: Context, dataList: MutableList<GridBean>, mlayoutid: Int) : this(
|
||||
context,
|
||||
dataList
|
||||
) {
|
||||
this.cusLayout = mlayoutid
|
||||
}
|
||||
|
||||
// 实现必要的方法...
|
||||
override fun getCount(): Int {
|
||||
return dataList.size
|
||||
}
|
||||
|
||||
override fun getItem(position: Int): Any {
|
||||
return dataList[position]
|
||||
}
|
||||
|
||||
override fun getItemId(position: Int): Long {
|
||||
return position.toLong()
|
||||
}
|
||||
|
||||
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
|
||||
var view = convertView
|
||||
var holder: ViewHolder
|
||||
if (convertView == null) {
|
||||
|
||||
view = LayoutInflater.from(context)
|
||||
.inflate(if (cusLayout == 0) R.layout.grid_item else cusLayout, null)
|
||||
holder = ViewHolder()
|
||||
holder.title = view.findViewById(R.id.title)
|
||||
holder.image = view.findViewById(R.id.image)
|
||||
view?.tag = holder
|
||||
} else {
|
||||
holder = (view?.tag) as ViewHolder
|
||||
}
|
||||
val item = dataList[position]
|
||||
holder.title?.text = item.title
|
||||
holder.image?.setBackgroundResource(item.image)
|
||||
|
||||
return view!!
|
||||
}
|
||||
|
||||
private class ViewHolder {
|
||||
var title: TextView? = null
|
||||
var image: ImageView? = null
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,17 @@
|
||||
package com.dahe.gldriver.adapter
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.glex.bean.WayBillBean
|
||||
|
||||
/**
|
||||
* @ClassName MessageAdapter
|
||||
* @Author 用户
|
||||
* @Date 2024/1/24 14:40
|
||||
* @Description TODO
|
||||
*/
|
||||
class MessageAdapter: BaseQuickAdapter<WayBillBean, BaseViewHolder>(R.layout.item_message) {
|
||||
override fun convert(holder: BaseViewHolder, item: WayBillBean) {
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.dahe.gldriver.adapter
|
||||
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter
|
||||
import java.util.ArrayList
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/7/16 0016.
|
||||
*/
|
||||
class MyHomePagerAdapter : FragmentStatePagerAdapter {
|
||||
private lateinit var mTitles: Array<String>
|
||||
private var mFragments = ArrayList<Fragment>()
|
||||
|
||||
constructor(fm: FragmentManager?) : super(fm!!) {}
|
||||
constructor(
|
||||
fm: FragmentManager?,
|
||||
mTitles: Array<String>,
|
||||
mFragments: ArrayList<Fragment>
|
||||
) : super(
|
||||
fm!!) {
|
||||
this.mTitles = mTitles
|
||||
this.mFragments = mFragments
|
||||
}
|
||||
|
||||
// 初始化每个页卡选项
|
||||
// @Override
|
||||
// public Object instantiateItem(ViewGroup arg0, int arg1) {
|
||||
// // TODO Auto-generated method stub
|
||||
// node_return super.instantiateItem(arg0, arg1);
|
||||
// }
|
||||
override fun getCount(): Int {
|
||||
return mFragments.size
|
||||
}
|
||||
|
||||
override fun getPageTitle(position: Int): CharSequence? {
|
||||
return mTitles[position]
|
||||
}
|
||||
|
||||
override fun getItem(position: Int): Fragment {
|
||||
return mFragments[position]
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.dahe.gldriver.adapter
|
||||
|
||||
import android.widget.Button
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.glex.bean.WayBillBean
|
||||
|
||||
/**
|
||||
* @ClassName WaybillAdapter
|
||||
* @Author 用户
|
||||
* @Date 2024/1/23 16:27
|
||||
* @Description TODO
|
||||
*/
|
||||
class WaybillAdapter :
|
||||
BaseQuickAdapter<WayBillBean, BaseViewHolder>(R.layout.item_waybill) {
|
||||
override fun convert(holder: BaseViewHolder, item: WayBillBean) {
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.dahe.gldriver.adapter
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.glex.bean.WayBillBean
|
||||
|
||||
/**
|
||||
* @ClassName WaybillAdapter
|
||||
* @Author 用户
|
||||
* @Date 2024/1/23 16:27
|
||||
* @Description TODO
|
||||
*/
|
||||
class WaybillListAdapter() :
|
||||
BaseQuickAdapter<WayBillBean, BaseViewHolder>(R.layout.item_waybill) {
|
||||
override fun convert(holder: BaseViewHolder, item: WayBillBean) {
|
||||
}
|
||||
}
|
86
app/src/main/java/com/dahe/gldriver/base/App.kt
Normal file
@ -0,0 +1,86 @@
|
||||
package com.dahe.gldriver.base
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import com.dahe.gldriver.BuildConfig
|
||||
import com.dahe.gldriver.base.App
|
||||
import com.dahe.mylibrary.CommonBaseLibrary
|
||||
import com.dahe.gldriver.net.Api
|
||||
import java.lang.Exception
|
||||
import java.security.SecureRandom
|
||||
import java.security.cert.X509Certificate
|
||||
import javax.net.ssl.HttpsURLConnection
|
||||
import javax.net.ssl.SSLContext
|
||||
import javax.net.ssl.TrustManager
|
||||
import javax.net.ssl.X509TrustManager
|
||||
|
||||
class App : Application() {
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
app = this
|
||||
CommonBaseLibrary.getInstance().init(this, Api.BASE_URL)
|
||||
if (BuildConfig.DEBUG) {
|
||||
// CrashHandler.getInstance().init(this);
|
||||
// CrashHandler2.getInstance().init(getApplicationContext());
|
||||
}
|
||||
// CrashReport.initCrashReport(getApplicationContext(), AppConfig.BUGLY_APP_ID, false);
|
||||
|
||||
|
||||
// SophixManager.getInstance().queryAndLoadNewPatch();
|
||||
|
||||
// OssServiceUtil.getInstance().init();
|
||||
|
||||
// PendingIntent pendingIntent =
|
||||
// PendingIntent.getActivity(this, 0, new Intent(this, HomeActivity.class), PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
// Cactus.getInstance()
|
||||
// .isDebug(true)
|
||||
// //可选,设置通知栏点击事件
|
||||
// .setPendingIntent(pendingIntent)
|
||||
//// .setBackgroundMusicEnabled(true)//可选,退到后台是否可以播放音乐
|
||||
//// .setMusicId(R.raw.main) //可选,设置音乐
|
||||
//// .setPendingIntent(pendingIntent)//可选,设置通知栏点击事件
|
||||
//// .addCallback(new CactusCallback())//可选,运行时回调
|
||||
// .setCrashRestartUIEnabled(true) //可选,设置奔溃可以重启,google原生rom android 10以下可以正常重启
|
||||
// .setCrashRestartUIEnabled(true)//可选,设置奔溃可以重启,google原生rom android 10以下可以正常重启
|
||||
// .setTitle("大河好运")
|
||||
// .hideNotificationAfterO(true)
|
||||
// .setSmallIcon(R.drawable.right_icon)
|
||||
// .addBackgroundCallback(new CactusBackgroundCallback() {
|
||||
// @Override
|
||||
// public void onBackground(boolean b) {
|
||||
// if (b){
|
||||
//// getBillLocation();
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// .register(this);
|
||||
}
|
||||
|
||||
override fun attachBaseContext(base: Context) {
|
||||
super.attachBaseContext(base)
|
||||
}
|
||||
|
||||
//忽略https的证书校验
|
||||
fun handleSSLHandshake() {
|
||||
try {
|
||||
val trustAllCerts = arrayOf<TrustManager>(object : X509TrustManager {
|
||||
override fun getAcceptedIssuers(): Array<X509Certificate?> {
|
||||
return arrayOfNulls(0)
|
||||
}
|
||||
|
||||
override fun checkClientTrusted(certs: Array<X509Certificate>, authType: String) {}
|
||||
override fun checkServerTrusted(certs: Array<X509Certificate>, authType: String) {}
|
||||
})
|
||||
val sc = SSLContext.getInstance("TLS")
|
||||
// trustAllCerts信任所有的证书
|
||||
sc.init(null, trustAllCerts, SecureRandom())
|
||||
HttpsURLConnection.setDefaultSSLSocketFactory(sc.socketFactory)
|
||||
HttpsURLConnection.setDefaultHostnameVerifier { hostname, session -> true }
|
||||
} catch (ignored: Exception) {
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
var app: App? = null
|
||||
}
|
||||
}
|
16
app/src/main/java/com/dahe/gldriver/base/AppConfig.kt
Normal file
@ -0,0 +1,16 @@
|
||||
package com.dahe.gldriver.base
|
||||
|
||||
/**
|
||||
* @ClassName AppConfig
|
||||
* @Author 用户
|
||||
* @Date 2022/1/14 15:24
|
||||
* @Description TODO
|
||||
*/
|
||||
object AppConfig {
|
||||
const val BUGLY_APP_ID = "a5b894cef7"
|
||||
const val TIME = "DA_HE_TIME"
|
||||
const val ID = "DA_HE_ID"
|
||||
const val PWD = "DA_HE_PHONE"
|
||||
const val CODE = "DA_HE_PHONE"
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.dahe.gldriver.bean
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
class CheckCodeBean : Serializable {
|
||||
var image: String? = null
|
||||
var expireTime: String? = null
|
||||
var uuid: String? = null
|
||||
}
|
13
app/src/main/java/com/dahe/gldriver/bean/CommListBean.kt
Normal file
@ -0,0 +1,13 @@
|
||||
package com.dahe.glex.bean
|
||||
|
||||
/**
|
||||
* @ClassName TextBean
|
||||
* @Author 用户
|
||||
* @Date 2023/9/21 11:08
|
||||
* @Description TODO
|
||||
*/
|
||||
data class CommListBean(
|
||||
val list: MutableList<OrderBean>,
|
||||
val num: Int,
|
||||
val totalFreight: String
|
||||
)
|
12
app/src/main/java/com/dahe/gldriver/bean/GridBean.kt
Normal file
@ -0,0 +1,12 @@
|
||||
package com.dahe.gldriver.bean
|
||||
|
||||
/**
|
||||
* @ClassName GridBean
|
||||
* @Author 用户
|
||||
* @Date 2024/1/23 10:37
|
||||
* @Description TODO
|
||||
*/
|
||||
data class GridBean(
|
||||
val title:String,
|
||||
val image : Int
|
||||
)
|
14
app/src/main/java/com/dahe/gldriver/bean/LogBean.kt
Normal file
@ -0,0 +1,14 @@
|
||||
package com.dahe.glex.bean
|
||||
|
||||
/**
|
||||
* @ClassName LogBean
|
||||
* @Author 用户
|
||||
* @Date 2022/1/17 15:18
|
||||
* @Description TODO
|
||||
*/
|
||||
data class LogBean(
|
||||
var smscode: String,
|
||||
var uname: String,
|
||||
var registerType: Int,
|
||||
var roleId: Int,
|
||||
)
|
26
app/src/main/java/com/dahe/gldriver/bean/OrderBean.kt
Normal file
@ -0,0 +1,26 @@
|
||||
package com.dahe.glex.bean
|
||||
|
||||
/**
|
||||
* @ClassName OrderBean
|
||||
* @Author 用户
|
||||
* @Date 2023/9/21 10:22
|
||||
* @Description TODO
|
||||
*/
|
||||
data class OrderBean(
|
||||
var orderId: String,
|
||||
var waybillId: String,
|
||||
var orderNum: String,
|
||||
var waybillNum: String,
|
||||
var orderTime: String,
|
||||
var totalFreight: String,
|
||||
var dispatchType : Int,
|
||||
var effectiveTime: String,
|
||||
var sendPut: String,
|
||||
var distance: String,
|
||||
var loadingAddress: String,
|
||||
var receiverAddress: String,
|
||||
var waybillStatus: Int,
|
||||
var evaluation: Int,
|
||||
var complaint: Int,
|
||||
var multipleScore: String,
|
||||
)
|
9
app/src/main/java/com/dahe/gldriver/bean/RefreshBean.kt
Normal file
@ -0,0 +1,9 @@
|
||||
package com.dahe.glex.bean
|
||||
|
||||
/**
|
||||
* @ClassName RefreshBean
|
||||
* @Author 用户
|
||||
* @Date 2023/9/21 10:53
|
||||
* @Description TODO
|
||||
*/
|
||||
data class RefreshBean(var page : Int,var limit : Int)
|
26
app/src/main/java/com/dahe/gldriver/bean/TabBean.kt
Normal file
@ -0,0 +1,26 @@
|
||||
package com.dahe.gldriver.bean
|
||||
|
||||
import com.flyco.tablayout.listener.CustomTabEntity
|
||||
|
||||
/**
|
||||
* @ClassName TabBean2
|
||||
* @Author 用户
|
||||
* @Date 2023/12/28 15:27
|
||||
* @Description TODO
|
||||
*/
|
||||
data class TabBean(var title:String,
|
||||
var selectedIcon:Int,
|
||||
var unSelectedIcon:Int
|
||||
) : CustomTabEntity {
|
||||
override fun getTabTitle(): String {
|
||||
return title
|
||||
}
|
||||
|
||||
override fun getTabSelectedIcon(): Int {
|
||||
return selectedIcon
|
||||
}
|
||||
|
||||
override fun getTabUnselectedIcon(): Int {
|
||||
return unSelectedIcon
|
||||
}
|
||||
}
|
27
app/src/main/java/com/dahe/gldriver/bean/UserBean.kt
Normal file
@ -0,0 +1,27 @@
|
||||
package com.dahe.glex.bean
|
||||
|
||||
/**
|
||||
* @ClassName UserBean
|
||||
* @Author 用户
|
||||
* @Date 2023/9/21 09:52
|
||||
* @Description TODO
|
||||
*/
|
||||
data class UserBean(
|
||||
var token :String,
|
||||
var id :String,
|
||||
var roleId :String,
|
||||
var uname :String,
|
||||
var registerPhone :String,
|
||||
var companyName :String,
|
||||
var account :String,
|
||||
var headportraitUrl :String,
|
||||
var salt :String,
|
||||
var jumpUrl :String,
|
||||
var distance :String,
|
||||
var idCardValidity :String,
|
||||
var driverValidity :String,
|
||||
var qualificationValidity :String,
|
||||
var isCar :String,
|
||||
var qrcodeUrl :String,
|
||||
var credit :String
|
||||
)
|
82
app/src/main/java/com/dahe/gldriver/bean/WayBill.kt
Normal file
@ -0,0 +1,82 @@
|
||||
|
||||
|
||||
/**
|
||||
* @ClassName WayBill2
|
||||
* @Author 用户
|
||||
* @Date 2023/9/21 17:48
|
||||
* @Description TODO
|
||||
*/
|
||||
data class WayBill2(
|
||||
val acceptTime: String,
|
||||
val avgScore: Int,
|
||||
val carNumber: String,
|
||||
val carType: String,
|
||||
val contractUrl: String,
|
||||
val distance: String,
|
||||
val driverName: String,
|
||||
val endCountrySubdivisionCode: String,
|
||||
val isEvaluation: Int,
|
||||
val nfcId: String,
|
||||
val operation: Int,
|
||||
val report: Int,
|
||||
val reportAlct: Int,
|
||||
val roleId: Int,
|
||||
val serialNumber: String,
|
||||
val shippingNoteNumber: String,
|
||||
val startCountrySubdivisionCode: String,
|
||||
val totalAmount: String,
|
||||
val wayChildren: List<WayChildren>,
|
||||
val waybillId: Int,
|
||||
val waybillStatus: String
|
||||
)
|
||||
|
||||
data class WayChildren(
|
||||
val acceptTime: String,
|
||||
val address: String,
|
||||
val carNumber: String,
|
||||
val carType: String,
|
||||
val deadline: String,
|
||||
val deadlineDate: Long,
|
||||
val delay: Int,
|
||||
val displayOrder: String,
|
||||
val distance: String,
|
||||
val driverName: String,
|
||||
val goods: List<Good>,
|
||||
val id: Long,
|
||||
val imageTakenDate: String,
|
||||
val isEvaluation: Int,
|
||||
val latitude: String,
|
||||
val longitude: String,
|
||||
val name: String,
|
||||
val orderId: Int,
|
||||
val phone: String,
|
||||
val realityTimeDate: Long,
|
||||
val receiptLatitude: String,
|
||||
val receiptLocationAddress: String,
|
||||
val receiptLongitude: String,
|
||||
val receiptTime: String,
|
||||
val receiptUrl: List<String>,
|
||||
val report: Int,
|
||||
val reportAlct: Int,
|
||||
val sendPutImagesUrl: List<String>,
|
||||
val sendPutLatitude: String,
|
||||
val sendPutLocationAddress: String,
|
||||
val sendPutLongitude: String,
|
||||
val shippingNoteNumber: String,
|
||||
val status: Int,
|
||||
val totalAmount: String,
|
||||
val type: Int,
|
||||
val updateTime: String,
|
||||
val waybillStatus: String
|
||||
)
|
||||
|
||||
data class Good(
|
||||
val childrenId: String,
|
||||
val createTime: String,
|
||||
val goodName: String,
|
||||
val goodNum: String,
|
||||
val goodPrice: String,
|
||||
val goodUnit: String,
|
||||
val id: String,
|
||||
val packName: String
|
||||
)
|
9
app/src/main/java/com/dahe/gldriver/bean/WayBillBean.kt
Normal file
@ -0,0 +1,9 @@
|
||||
package com.dahe.glex.bean
|
||||
|
||||
/**
|
||||
* @ClassName WayBillBean
|
||||
* @Author 用户
|
||||
* @Date 2023/9/21 17:34
|
||||
* @Description TODO
|
||||
*/
|
||||
data class WayBillBean(var waybillId :String="")
|
37
app/src/main/java/com/dahe/gldriver/net/Api.kt
Normal file
@ -0,0 +1,37 @@
|
||||
package com.dahe.gldriver.net
|
||||
|
||||
import WayBill2
|
||||
import com.dahe.gldriver.BuildConfig
|
||||
import com.dahe.glex.bean.*
|
||||
import com.dahe.mylibrary.net.CommonResponseBean
|
||||
import io.reactivex.rxjava3.core.Observable
|
||||
import retrofit2.http.Body
|
||||
import retrofit2.http.POST
|
||||
import retrofit2.http.Query
|
||||
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/8/8 0008.
|
||||
*/
|
||||
interface Api {
|
||||
/*-------------------登录----------------------------*/
|
||||
@POST(BASE_URL + "common/register")
|
||||
fun log(@Body logBean: LogBean?): Observable<CommonResponseBean<UserBean>>
|
||||
|
||||
//运单列表
|
||||
@POST(BASE_URL + "app/driver/waybill/listV2")
|
||||
fun orderList(@Body bean: RefreshBean?): Observable<CommonResponseBean<CommListBean>>
|
||||
|
||||
//获取正在执行的运单/运单详情
|
||||
@POST(BASE_URL + "app/driver/waybill/getExecuteWaybill")
|
||||
fun getExecuteWaybill(@Body bean: WayBillBean?): Observable<CommonResponseBean<WayBill2>>
|
||||
fun getExecuteWaybill2(@Query("waybillId") waybillId: String?): Observable<CommonResponseBean<UserBean>>
|
||||
|
||||
companion object {
|
||||
// String BASE_URL = "https://tmstest.dahehuoyun.com/";
|
||||
const val BASE_URL = BuildConfig.BASE_URL
|
||||
|
||||
//获取版本
|
||||
const val VERSION = BASE_URL + "app/version"
|
||||
}
|
||||
}
|
43
app/src/main/java/com/dahe/gldriver/net/BaseObserver.kt
Normal file
@ -0,0 +1,43 @@
|
||||
package com.dahe.gldriver.net
|
||||
|
||||
import android.content.Context
|
||||
import com.dahe.mylibrary.net.CommonResponseBean
|
||||
import io.reactivex.rxjava3.core.Observer
|
||||
import io.reactivex.rxjava3.disposables.Disposable
|
||||
|
||||
/**
|
||||
* 自定义观察者
|
||||
*/
|
||||
class BaseObserver<T>(
|
||||
private val mContext: Context,
|
||||
private val mRxHttpCallBack: RxHttpCallBack<T>
|
||||
) : Observer<CommonResponseBean<T>> {
|
||||
private var disposable: Disposable? = null
|
||||
|
||||
/**
|
||||
* 订阅成功
|
||||
*
|
||||
* @param d
|
||||
*/
|
||||
override fun onSubscribe(d: Disposable) {
|
||||
disposable = d
|
||||
mRxHttpCallBack.onStart()
|
||||
}
|
||||
|
||||
override fun onNext(tCommonResponseBean: CommonResponseBean<T>) {
|
||||
if (200 == tCommonResponseBean.code) {
|
||||
mRxHttpCallBack.onSuccess(tCommonResponseBean)
|
||||
} else {
|
||||
mRxHttpCallBack.onCodeError(mContext, tCommonResponseBean)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
mRxHttpCallBack.onFailure(mContext, e)
|
||||
if (disposable != null && disposable!!.isDisposed) {
|
||||
disposable!!.dispose()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onComplete() {}
|
||||
}
|
33
app/src/main/java/com/dahe/gldriver/net/DataManager.kt
Normal file
@ -0,0 +1,33 @@
|
||||
package com.dahe.gldriver.net
|
||||
|
||||
import com.dahe.gldriver.utils.BaseSingNoParam
|
||||
import com.dahe.mylibrary.CommonBaseLibrary
|
||||
import com.dahe.mylibrary.net.JsonInterceptor
|
||||
import okhttp3.OkHttpClient
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
/**
|
||||
* @ClassName DataManager3
|
||||
* @Author 用户
|
||||
* @Date 2023/12/29 10:09
|
||||
* @Description TODO
|
||||
*/
|
||||
class DataManager private constructor(){
|
||||
|
||||
//伴生对象实现BaseSingleton抽象类
|
||||
companion object : BaseSingNoParam<Api>() {
|
||||
//重写方法并给出具体实现
|
||||
override fun creator(): Api {
|
||||
return CommonBaseLibrary.getRetrofit().newBuilder()
|
||||
.client(OkHttpClient.Builder()
|
||||
.connectTimeout(30, TimeUnit.SECONDS)
|
||||
.readTimeout(30, TimeUnit.SECONDS)
|
||||
.writeTimeout(30, TimeUnit.SECONDS)
|
||||
.addInterceptor(JsonInterceptor())
|
||||
.addInterceptor(RequestHeadInterceptor())
|
||||
.build()) // .addNetworkInterceptor(new TokenInterceptor())
|
||||
.build().create(Api::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package com.dahe.gldriver.net
|
||||
|
||||
import kotlin.Throws
|
||||
import com.dahe.gldriver.base.App
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import com.dahe.gldriver.utils.SPUtils
|
||||
import com.dahe.mylibrary.utils.BaseUtils
|
||||
import com.dahe.mylibrary.utils.AppUtils
|
||||
import com.dahe.mylibrary.utils.BaseSPUtils
|
||||
import okhttp3.Interceptor
|
||||
import okhttp3.Request
|
||||
import okhttp3.Response
|
||||
import java.io.IOException
|
||||
|
||||
/**
|
||||
* 头部Interceptor
|
||||
*/
|
||||
class RequestHeadInterceptor : Interceptor {
|
||||
@Throws(IOException::class)
|
||||
override fun intercept(chain: Interceptor.Chain): Response {
|
||||
val builder: Request.Builder = chain.request().newBuilder()
|
||||
if (BaseSPUtils.hasUserInfo(App.app) && !TextUtils.isEmpty(SPUtils.instance.getUserInfo(App.app)?.token)) {
|
||||
|
||||
// builder.addHeader("Authorization", SPUtils.getUserInfo(App.getApp()).getToken());
|
||||
builder.addHeader("Authorization",
|
||||
"Bearer " + SPUtils.instance.getUserInfo(App.app)?.token)
|
||||
}
|
||||
val request: Request = builder
|
||||
.addHeader("versionCode", AppUtils.getAppVersionCode().toString() + "")
|
||||
.addHeader("versionValue", AppUtils.getAppVersionName() + "")
|
||||
.addHeader("deviceType", "ANDROID")
|
||||
.addHeader("language", BaseUtils.getLanguage(App.app).toString() + "")
|
||||
.build()
|
||||
Log.i(TAG, "intercept: " + request.headers)
|
||||
return chain.proceed(request)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "RequestHeadInterceptor"
|
||||
}
|
||||
}
|
126
app/src/main/java/com/dahe/gldriver/net/RxHttpCallBack.kt
Normal file
@ -0,0 +1,126 @@
|
||||
package com.dahe.gldriver.net
|
||||
|
||||
import android.accounts.NetworkErrorException
|
||||
import android.app.Activity
|
||||
import android.app.ProgressDialog
|
||||
import com.dahe.gldriver.utils.UserUtils.Companion.instance
|
||||
import android.content.Context
|
||||
import android.text.TextUtils
|
||||
import android.view.Window
|
||||
import com.dahe.mylibrary.net.CommonResponseBean
|
||||
import com.dahe.mylibrary.net.ResultException
|
||||
import com.dahe.mylibrary.utils.ToastUtils
|
||||
import java.net.ConnectException
|
||||
import java.net.SocketTimeoutException
|
||||
import java.net.UnknownHostException
|
||||
import java.util.concurrent.TimeoutException
|
||||
import javax.net.ssl.SSLException
|
||||
|
||||
/**
|
||||
* 统一的网络回调
|
||||
*/
|
||||
abstract class RxHttpCallBack<T> {
|
||||
private var dialog: ProgressDialog? = null
|
||||
private fun initDialog(activity: Activity, dialogMessage: String) {
|
||||
dialog = ProgressDialog(activity)
|
||||
dialog!!.requestWindowFeature(Window.FEATURE_NO_TITLE)
|
||||
dialog!!.setCanceledOnTouchOutside(false)
|
||||
dialog!!.setProgressStyle(ProgressDialog.STYLE_SPINNER)
|
||||
dialog!!.setMessage(dialogMessage)
|
||||
}
|
||||
|
||||
constructor(activity: Activity, dialogMessage: String?) {
|
||||
initDialog(activity,
|
||||
(if (TextUtils.isEmpty(dialogMessage)) "网络请求中......" else dialogMessage)!!)
|
||||
}
|
||||
|
||||
constructor(activity: Activity) {
|
||||
initDialog(activity, "网络请求中......")
|
||||
}
|
||||
|
||||
constructor() {}
|
||||
|
||||
/**
|
||||
* 订阅成功
|
||||
*/
|
||||
fun onStart() {
|
||||
if (dialog != null && !dialog!!.isShowing) {
|
||||
dialog!!.show()
|
||||
}
|
||||
}
|
||||
|
||||
fun onStop() {
|
||||
if (dialog != null && dialog!!.isShowing) {
|
||||
dialog!!.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回成功
|
||||
*
|
||||
* @param t
|
||||
* @throws Exception
|
||||
*/
|
||||
fun onSuccess(t: CommonResponseBean<T>) {
|
||||
if (dialog != null && dialog!!.isShowing) {
|
||||
dialog!!.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回成功了,但是code错误
|
||||
*
|
||||
* @param t
|
||||
* @throws Exception
|
||||
*/
|
||||
fun onCodeError(mContext: Context?, t: CommonResponseBean<T>) {
|
||||
if (dialog != null && dialog!!.isShowing) {
|
||||
dialog!!.dismiss()
|
||||
}
|
||||
if (t.code == 401) {
|
||||
instance.loginOut(mContext!!)
|
||||
// Intent intent = new Intent(mContext, LoginActivity.class);
|
||||
// intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
// mContext.startActivity(intent);
|
||||
ToastUtils.showToast(mContext, "您的账号再异地登录,请重新登录")
|
||||
} else {
|
||||
ToastUtils.showToast(mContext, t.msg)
|
||||
}
|
||||
|
||||
// if (t.getMessage().getMsg_code() == 100 && SPUtils.hasUserInfo(mContext)) {
|
||||
// SPUtils.remove(mContext, SPUtils.USER_INFO_KEY);
|
||||
// } else {
|
||||
// ToastUtils.showToast(mContext, t.getMessage().getMsg_desc());
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回失败
|
||||
*
|
||||
* @param e
|
||||
* @throws Exception
|
||||
*/
|
||||
fun onFailure(mContext: Context?, e: Throwable) {
|
||||
if (dialog != null && dialog!!.isShowing) {
|
||||
dialog!!.dismiss()
|
||||
}
|
||||
if (e is ConnectException
|
||||
|| e is TimeoutException
|
||||
|| e is SocketTimeoutException
|
||||
|| e is SSLException
|
||||
|| e is NetworkErrorException
|
||||
|| e is UnknownHostException
|
||||
) {
|
||||
ToastUtils.showToast(mContext, "请检查您的网络~")
|
||||
} else if (e is ResultException) {
|
||||
e.printStackTrace()
|
||||
//自定义的ResultException
|
||||
//由于返回200,300返回格式不统一的问题,自定义GsonResponseBodyConverter凡是300的直接抛异常
|
||||
// System.out.println("---------errorCode------->"+((ResultException) e).getErrCode());
|
||||
} else if (e is SSLException) {
|
||||
ToastUtils.showToast(mContext, "网络连接终端,请检查您的网络~")
|
||||
} else {
|
||||
ToastUtils.showToast(mContext, e.message)
|
||||
}
|
||||
}
|
||||
}
|
44
app/src/main/java/com/dahe/gldriver/net/TokenInterceptor.kt
Normal file
@ -0,0 +1,44 @@
|
||||
package com.dahe.gldriver.net
|
||||
|
||||
import okhttp3.Interceptor
|
||||
import okhttp3.Request
|
||||
import okhttp3.Response
|
||||
import kotlin.Throws
|
||||
import org.json.JSONObject
|
||||
import java.io.IOException
|
||||
import java.lang.Exception
|
||||
import java.nio.charset.StandardCharsets
|
||||
|
||||
class TokenInterceptor : Interceptor {
|
||||
@Throws(IOException::class)
|
||||
override fun intercept(chain: Interceptor.Chain): Response {
|
||||
val request: Request = chain.request()
|
||||
val response: Response = chain.proceed(request)
|
||||
val responseBody = response.body
|
||||
if (responseBody != null) {
|
||||
val source = responseBody.source()
|
||||
source.request(Long.MAX_VALUE) // Buffer the entire body.
|
||||
val buffer = source.buffer()
|
||||
try {
|
||||
val result = buffer.clone().readString(StandardCharsets.UTF_8)
|
||||
val jsonObject = JSONObject(result)
|
||||
val code = jsonObject.getInt("code")
|
||||
if (code == -1) { //判断返回code
|
||||
|
||||
// SPUtils.cleanUserInfo(App.getApp());
|
||||
// Intent intent = new Intent(App.getApp(), LoginActivity.class);
|
||||
// intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
// App.getApp().startActivity(intent);
|
||||
// ToastUtils.showToast(App.getApp(), "您的账号再异地登录,请重新登录");
|
||||
// ToastUtils.showShort("身份过期,请重新登录");
|
||||
//跳转方式
|
||||
//1.使用MyApplication添加跳转
|
||||
//2.使用路由跳转
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
return response
|
||||
}
|
||||
}
|
106
app/src/main/java/com/dahe/gldriver/ui/HomeActivity.kt
Normal file
@ -0,0 +1,106 @@
|
||||
package com.dahe.gldriver.ui
|
||||
|
||||
import android.Manifest
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.widget.Toast
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.viewpager.widget.ViewPager
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.gldriver.adapter.MyHomePagerAdapter
|
||||
import com.dahe.gldriver.bean.TabBean
|
||||
import com.dahe.gldriver.databinding.ActivityHomeBinding
|
||||
import com.dahe.gldriver.ui.home.HomeFragment
|
||||
import com.dahe.gldriver.ui.message.MessageFragment
|
||||
import com.dahe.gldriver.ui.mine.MineFragment
|
||||
import com.dahe.gldriver.ui.waybill.WaybillFragment
|
||||
import com.dahe.mylibrary.base.BaseActivity
|
||||
import com.flyco.tablayout.listener.CustomTabEntity
|
||||
import com.flyco.tablayout.listener.OnTabSelectListener
|
||||
import com.permissionx.guolindev.PermissionX
|
||||
|
||||
/**
|
||||
* @ClassName HomeActivity
|
||||
* @Author 用户
|
||||
* @Date 2023/12/27 17:12
|
||||
* @Description TODO
|
||||
*/
|
||||
class HomeActivity: BaseActivity<ActivityHomeBinding>(), OnTabSelectListener,
|
||||
ViewPager.OnPageChangeListener {
|
||||
|
||||
private val mNormalRes = mutableListOf(
|
||||
R.drawable.tab_home_normal,
|
||||
R.drawable.tab_message_normal,
|
||||
R.drawable.tab_waybill_normal,
|
||||
R.drawable.tab_mine_normal
|
||||
)
|
||||
|
||||
|
||||
private val mSelectRes = mutableListOf(
|
||||
R.drawable.tab_home_press,
|
||||
R.drawable.tab_message_press,
|
||||
R.drawable.tab_waybill_press,
|
||||
R.drawable.tab_mine_press
|
||||
)
|
||||
private var mTitles = arrayOf("首页","消息","运单","我的")
|
||||
private var mTabEntities = arrayListOf<CustomTabEntity>(
|
||||
TabBean(mTitles[0],mSelectRes[0],mNormalRes[0]),
|
||||
TabBean(mTitles[1],mSelectRes[1],mNormalRes[1]),
|
||||
TabBean(mTitles[2],mSelectRes[2],mNormalRes[2]),
|
||||
TabBean(mTitles[3],mSelectRes[3],mNormalRes[3]))
|
||||
private var mFragments = arrayListOf<Fragment>(HomeFragment(),MessageFragment(), WaybillFragment(),MineFragment())
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
|
||||
binding.homeTabLayout.run {
|
||||
setTabData(mTabEntities)
|
||||
setOnTabSelectListener(this@HomeActivity)
|
||||
currentTab=0
|
||||
}
|
||||
|
||||
binding.homeNoScrollViewPager.run {
|
||||
adapter = MyHomePagerAdapter(this@HomeActivity.supportFragmentManager, mTitles, mFragments)
|
||||
addOnPageChangeListener(this@HomeActivity)
|
||||
offscreenPageLimit = 3
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
getPermissions()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
override fun initDate() {
|
||||
}
|
||||
|
||||
private fun getPermissions() {
|
||||
PermissionX.init(this)
|
||||
.permissions(
|
||||
Manifest.permission.CAMERA)
|
||||
.request { allGranted, grantedList, deniedList ->
|
||||
if (allGranted) {
|
||||
|
||||
} else {
|
||||
Toast.makeText(mContext, "开启权限失败,请在应用设置-权限-定位-始终允许", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTabSelect(position: Int) {
|
||||
binding.homeNoScrollViewPager.setCurrentItem(position)
|
||||
}
|
||||
|
||||
override fun onTabReselect(position: Int) {
|
||||
}
|
||||
|
||||
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
|
||||
}
|
||||
|
||||
override fun onPageSelected(position: Int) {
|
||||
binding.homeTabLayout.setCurrentTab(position)
|
||||
}
|
||||
|
||||
override fun onPageScrollStateChanged(state: Int) {
|
||||
}
|
||||
|
||||
}
|
86
app/src/main/java/com/dahe/gldriver/ui/LauncherActivity.kt
Normal file
@ -0,0 +1,86 @@
|
||||
package com.dahe.gldriver.ui
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.WindowManager
|
||||
import com.dahe.gldriver.databinding.ActivityLauncherBinding
|
||||
import com.dahe.mylibrary.base.BaseActivity
|
||||
import com.dahe.mylibrary.utils.ActivityUtils
|
||||
import com.dahe.gldriver.ui.account.LoginActivity
|
||||
import com.dahe.gldriver.utils.SPUtils
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.core.Observable
|
||||
import io.reactivex.rxjava3.disposables.Disposable
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
class LauncherActivity : BaseActivity<ActivityLauncherBinding>() {
|
||||
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
// setStatusBarColorToLight2()
|
||||
val extras = intent.extras
|
||||
binding.llCount.setOnClickListener {
|
||||
mDisposable?.dispose()
|
||||
//已登录,直接跳转首页
|
||||
// val userInfo = SPUtils.getUserInfo(mContext)
|
||||
//
|
||||
// if (userInfo != null && StringUtils.isNotEmpty(userInfo.token)) {
|
||||
// ActivityUtils.startActivity(mContext, HomeActivity::class.java,intent.extras)
|
||||
// } else {
|
||||
// ActivityUtils.startActivity(this@LauncherActivity, LoginActivity::class.java)
|
||||
// }
|
||||
// window.setFlags(
|
||||
// WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,
|
||||
// WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
|
||||
ActivityUtils.startActivity(this@LauncherActivity, LoginActivity::class.java)
|
||||
finish()
|
||||
}
|
||||
val count = 3
|
||||
mDisposable = Observable.interval(0, 1, TimeUnit.SECONDS)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe { aLong: Long ->
|
||||
binding.tvCount.setText((count - aLong).toString())
|
||||
if (count - aLong == 0L) {
|
||||
mDisposable?.dispose()
|
||||
//已登录,直接跳转首页
|
||||
//已登录,直接跳转首页
|
||||
// val userInfo: UserBean? = SPUtils.getUserInfo(mContext)
|
||||
//
|
||||
// if (userInfo != null && !TextUtils.isEmpty(userInfo.getToken())) {
|
||||
// ActivityUtils.startActivity(mContext, HomeActivity::class.java,intent.extras)
|
||||
// } else {
|
||||
// ActivityUtils.startActivity(
|
||||
// this@LauncherActivity,
|
||||
// LoginActivity::class.java
|
||||
// )
|
||||
//
|
||||
// }
|
||||
|
||||
// ActivityUtils.startActivity(
|
||||
// this@LauncherActivity,
|
||||
// LoginActivity::class.java
|
||||
// )
|
||||
|
||||
|
||||
// window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
|
||||
// window.setFlags(
|
||||
// WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,
|
||||
// WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
|
||||
|
||||
// finish()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private var mDisposable: Disposable? = null
|
||||
|
||||
override fun initDate() {
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
mDisposable?.dispose()
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.dahe.gldriver.ui.account
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import com.dahe.gldriver.databinding.ActivityCodeBinding
|
||||
import com.dahe.gldriver.databinding.ActivityLoginBinding
|
||||
import com.dahe.gldriver.ui.HomeActivity
|
||||
import com.dahe.mylibrary.base.BaseActivity
|
||||
import com.dahe.mylibrary.utils.ActivityUtils
|
||||
import com.dahe.mylibrary.utils.SmsTimeUtils
|
||||
import kotlin.math.log
|
||||
|
||||
/**
|
||||
* @ClassName LoginActivity
|
||||
* @Author 用户
|
||||
* @Date 2024/1/17 08:51
|
||||
* @Description TODO
|
||||
*/
|
||||
class CodeLoginActivity : BaseActivity<ActivityCodeBinding>(), View.OnClickListener {
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
|
||||
|
||||
binding.tvLoginType.setOnClickListener(this)
|
||||
}
|
||||
|
||||
override fun initDate() {
|
||||
}
|
||||
|
||||
override fun onClick(view: View?) {
|
||||
super.onClick(view)
|
||||
}
|
||||
|
||||
private fun changeLoginType() {
|
||||
}
|
||||
|
||||
private fun login(){
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
package com.dahe.gldriver.ui.account
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import com.dahe.gldriver.databinding.ActivityLoginBinding
|
||||
import com.dahe.gldriver.ui.HomeActivity
|
||||
import com.dahe.mylibrary.base.BaseActivity
|
||||
import com.dahe.mylibrary.utils.ActivityUtils
|
||||
|
||||
/**
|
||||
* @ClassName LoginActivity
|
||||
* @Author 用户
|
||||
* @Date 2024/1/17 08:51
|
||||
* @Description TODO
|
||||
*/
|
||||
class LoginActivity : BaseActivity<ActivityLoginBinding>(), View.OnClickListener {
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
binding.cb.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (isChecked) {
|
||||
// et_pass.setTransformationMethod(PasswordTransformationMethod.getInstance())
|
||||
} else {
|
||||
// et_pass.setTransformationMethod(HideReturnsTransformationMethod.getInstance())
|
||||
}
|
||||
// et_pass.setSelection(et_pass.getText().toString().length)
|
||||
}
|
||||
//
|
||||
// binding.btnLogin.setOnClickListener {
|
||||
// ActivityUtils.startActivity(this, HomeActivity::class.java)
|
||||
//// ActivityUtils.startActivity(this, TextActivity::class.java)
|
||||
// }
|
||||
//
|
||||
// binding.getCode.setOnClickListener {
|
||||
// SmsTimeUtils.startCountdown(binding.getCode,mContext)
|
||||
// }
|
||||
|
||||
binding.tvLoginType.setOnClickListener(this)
|
||||
binding.ok.setOnClickListener(this)
|
||||
|
||||
binding.imgHead.setOnLongClickListener {
|
||||
ActivityUtils.startActivity(mContext, HomeActivity::class.java)
|
||||
return@setOnLongClickListener true
|
||||
}
|
||||
}
|
||||
|
||||
override fun initDate() {
|
||||
}
|
||||
|
||||
override fun onClick(view: View?) {
|
||||
super.onClick(view)
|
||||
when (view?.id) {
|
||||
binding.tvLoginType.id -> {
|
||||
changeLoginType()
|
||||
}
|
||||
|
||||
binding.ok.id -> {
|
||||
login()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun changeLoginType() {
|
||||
if ("手机号登录/注册" == binding.tvLoginType.text) {
|
||||
binding.tvLoginType.text = "本机号码一键登录"
|
||||
binding.ok.text = "获取验证码"
|
||||
binding.llPhone.visibility = View.VISIBLE
|
||||
} else {
|
||||
binding.tvLoginType.text = "手机号登录/注册"
|
||||
binding.ok.text = "本机号码一键登录/注册"
|
||||
binding.llPhone.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
private fun login() {
|
||||
if ("获取验证码" == binding.ok.text) {
|
||||
ActivityUtils.startActivity(mContext, CodeLoginActivity::class.java)
|
||||
}else{
|
||||
ActivityUtils.startActivity(mContext, SelectRoleActivity::class.java)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.dahe.gldriver.ui.account
|
||||
|
||||
import android.os.Bundle
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.gldriver.databinding.ActivitySelectRoleBinding
|
||||
import com.dahe.gldriver.ui.account.authperson.AuthPersonActivity
|
||||
import com.dahe.gldriver.ui.account.authteam.AuthTeamActivity
|
||||
import com.dahe.mylibrary.base.BaseActivity
|
||||
import com.dahe.mylibrary.utils.ActivityUtils
|
||||
|
||||
/**
|
||||
* @ClassName AuthRoleActivity
|
||||
* @Author 用户
|
||||
* @Date 2024/1/25 11:15
|
||||
* @Description 选择角色 (独立司机或者运输公司)
|
||||
*/
|
||||
class SelectRoleActivity : BaseActivity<ActivitySelectRoleBinding>() {
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
setStatusBarColor(R.color.white)
|
||||
setTitleBar("选择角色",true)
|
||||
binding.rlPerson.setOnClickListener {
|
||||
ActivityUtils.startActivity(mContext, AuthPersonActivity::class.java)
|
||||
}
|
||||
binding.rlCom.setOnClickListener {
|
||||
ActivityUtils.startActivity(mContext, AuthTeamActivity::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
override fun initDate() {
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.dahe.gldriver.ui.account.authperson
|
||||
|
||||
import android.os.Bundle
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.gldriver.databinding.ActivityAuthBankcardBinding
|
||||
import com.dahe.mylibrary.base.BaseActivity
|
||||
import com.dahe.mylibrary.utils.ActivityUtils
|
||||
|
||||
/**
|
||||
* @ClassName AuthBankCardActivity
|
||||
* @Author john
|
||||
* @Date 2024/1/25 15:31
|
||||
* @Description TODO
|
||||
*/
|
||||
class AuthBankCardActivity : BaseActivity<ActivityAuthBankcardBinding>() {
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
setStatusBarColor(R.color.white)
|
||||
setTitleBar("实名认证",true)
|
||||
binding.btnOk.setOnClickListener {
|
||||
ActivityUtils.startActivity(mContext,AuthFaceActivity::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
override fun initDate() {
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.dahe.gldriver.ui.account.authperson
|
||||
|
||||
import android.os.Bundle
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.gldriver.databinding.ActivityAuthDriverBinding
|
||||
import com.dahe.mylibrary.base.BaseActivity
|
||||
import com.dahe.mylibrary.utils.ActivityUtils
|
||||
|
||||
/**
|
||||
* @ClassName AuthRoleActivity
|
||||
* @Author 用户
|
||||
* @Date 2024/1/25 11:15
|
||||
* @Description 驾驶证认证
|
||||
*/
|
||||
class AuthDriverActivity : BaseActivity<ActivityAuthDriverBinding>() {
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
setStatusBarColor(R.color.white)
|
||||
setTitleBar("实名认证",true)
|
||||
binding.btnOk.setOnClickListener {
|
||||
ActivityUtils.startActivity(mContext,AuthQualificationActivity::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
override fun initDate() {
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.dahe.gldriver.ui.account.authperson
|
||||
|
||||
import android.os.Bundle
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.gldriver.databinding.ActivityAuthDrivingBinding
|
||||
import com.dahe.mylibrary.base.BaseActivity
|
||||
import com.dahe.mylibrary.utils.ActivityUtils
|
||||
|
||||
/**
|
||||
* @ClassName AuthRoleActivity
|
||||
* @Author 用户
|
||||
* @Date 2024/1/25 11:15
|
||||
* @Description 行驶证认证
|
||||
*/
|
||||
class AuthDrivingActivity : BaseActivity<ActivityAuthDrivingBinding>() {
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
setStatusBarColor(R.color.white)
|
||||
setTitleBar("实名认证",true)
|
||||
binding.btnOk.setOnClickListener {
|
||||
ActivityUtils.startActivity(mContext,AuthRoadActivity::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
override fun initDate() {
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.dahe.gldriver.ui.account.authperson
|
||||
|
||||
import android.os.Bundle
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.gldriver.databinding.ActivityAuthFaceBinding
|
||||
import com.dahe.mylibrary.base.BaseActivity
|
||||
import com.dahe.mylibrary.utils.ActivityUtils
|
||||
|
||||
/**
|
||||
* @ClassName AuthFaceActivity
|
||||
* @Author john
|
||||
* @Date 2024/1/25 15:38
|
||||
* @Description TODO
|
||||
*/
|
||||
class AuthFaceActivity : BaseActivity<ActivityAuthFaceBinding>() {
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
setStatusBarColor(R.color.white)
|
||||
setTitleBar("实名认证",true)
|
||||
binding.btnOk.setOnClickListener {
|
||||
ActivityUtils.startActivity(mContext,AuthDrivingActivity::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
override fun initDate() {
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.dahe.gldriver.ui.account.authperson
|
||||
|
||||
import android.os.Bundle
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.gldriver.databinding.ActivityAuthPersonBinding
|
||||
import com.dahe.mylibrary.base.BaseActivity
|
||||
import com.dahe.mylibrary.utils.ActivityUtils
|
||||
|
||||
/**
|
||||
* @ClassName AuthRoleActivity
|
||||
* @Author 用户
|
||||
* @Date 2024/1/25 11:15
|
||||
* @Description 身份证认证
|
||||
*/
|
||||
class AuthPersonActivity : BaseActivity<ActivityAuthPersonBinding>() {
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
setStatusBarColor(R.color.white)
|
||||
setTitleBar("实名认证",true)
|
||||
binding.btnOk.setOnClickListener {
|
||||
ActivityUtils.startActivity(mContext,AuthDriverActivity::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
override fun initDate() {
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.dahe.gldriver.ui.account.authperson
|
||||
|
||||
import android.os.Bundle
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.gldriver.databinding.ActivityAuthQualificationBinding
|
||||
import com.dahe.mylibrary.base.BaseActivity
|
||||
import com.dahe.mylibrary.utils.ActivityUtils
|
||||
|
||||
/**
|
||||
* @ClassName AuthQualificationActivity
|
||||
* @Author john
|
||||
* @Date 2024/1/25 15:20
|
||||
* @Description 从业资格证认证
|
||||
*/
|
||||
class AuthQualificationActivity : BaseActivity<ActivityAuthQualificationBinding>(){
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
setStatusBarColor(R.color.white)
|
||||
setTitleBar("实名认证",true)
|
||||
binding.btnOk.setOnClickListener {
|
||||
ActivityUtils.startActivity(mContext,AuthBankCardActivity::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
override fun initDate() {
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.dahe.gldriver.ui.account.authperson
|
||||
|
||||
import android.os.Bundle
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.gldriver.databinding.ActivityAuthRoadBinding
|
||||
import com.dahe.gldriver.ui.account.SelectRoleActivity
|
||||
import com.dahe.mylibrary.base.BaseActivity
|
||||
import com.dahe.mylibrary.utils.ActivityUtils
|
||||
|
||||
/**
|
||||
* @ClassName AuthRoadActivity
|
||||
* @Author john
|
||||
* @Date 2024/1/25 16:02
|
||||
* @Description 道路运输许可证认证
|
||||
*/
|
||||
class AuthRoadActivity : BaseActivity<ActivityAuthRoadBinding>() {
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
setStatusBarColor(R.color.white)
|
||||
setTitleBar("实名认证",true)
|
||||
binding.btnOk.setOnClickListener {
|
||||
ActivityUtils.startActivity(mContext, SelectRoleActivity::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
override fun initDate() {
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package com.dahe.gldriver.ui.account.authteam
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.gldriver.databinding.ActivityAuthTeamBinding
|
||||
import com.dahe.mylibrary.base.BaseActivity
|
||||
|
||||
/**
|
||||
* @ClassName AuthTeamActivity
|
||||
* @Author john
|
||||
* @Date 2024/1/25 16:44
|
||||
* @Description 个人车队认证
|
||||
*/
|
||||
class AuthTeamActivity : BaseActivity<ActivityAuthTeamBinding>() {
|
||||
private var checkTeamType = 0 //0代表运输公司,1代表个人车队
|
||||
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
setStatusBarColor(R.color.white)
|
||||
setTitleBar("身份认证",true)
|
||||
|
||||
binding.rgTeam.setOnCheckedChangeListener { _, i ->
|
||||
changeTeamType(if (i==binding.rbCom.id) 0 else 1)
|
||||
}
|
||||
}
|
||||
|
||||
override fun initDate() {
|
||||
}
|
||||
|
||||
private fun changeTeamType(type : Int){
|
||||
checkTeamType = type
|
||||
if (0==checkTeamType){
|
||||
binding.llCom.visibility = View.VISIBLE
|
||||
binding.llPerson.visibility = View.GONE
|
||||
}else{
|
||||
binding.llCom.visibility = View.GONE
|
||||
binding.llPerson.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
}
|
100
app/src/main/java/com/dahe/gldriver/ui/home/HomeFragment.kt
Normal file
@ -0,0 +1,100 @@
|
||||
package com.dahe.gldriver.ui.home
|
||||
|
||||
import android.graphics.Color
|
||||
import android.widget.LinearLayout
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.listener.OnItemChildClickListener
|
||||
import com.chad.library.adapter.base.listener.OnItemClickListener
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.gldriver.adapter.GridItemAdapter
|
||||
import com.dahe.gldriver.adapter.WaybillAdapter
|
||||
import com.dahe.gldriver.bean.GridBean
|
||||
import com.dahe.gldriver.databinding.FragmentHomeBinding
|
||||
import com.dahe.gldriver.ui.HomeActivity
|
||||
import com.dahe.gldriver.ui.waybill.activity.WaybillDetailActivity
|
||||
import com.dahe.glex.bean.WayBillBean
|
||||
import com.dahe.mylibrary.base.BaseFragment
|
||||
import com.dahe.mylibrary.callback.RefreshCallBack
|
||||
import com.dahe.mylibrary.recycleviewswipe.RecycleViewDivider
|
||||
import com.dahe.mylibrary.utils.ActivityUtils
|
||||
import com.dahe.mylibrary.utils.ConvertUtils
|
||||
import com.dahe.mylibrary.utils.ToastUtils
|
||||
import com.flyco.tablayout.listener.OnTabSelectListener
|
||||
import okhttp3.internal.wait
|
||||
|
||||
/**
|
||||
* @ClassName HomeFragment
|
||||
* @Author 用户
|
||||
* @Date 2023/9/21 10:13
|
||||
* @Description TODO
|
||||
*/
|
||||
class HomeFragment : BaseFragment<FragmentHomeBinding>(), RefreshCallBack {
|
||||
private val gridDatas = mutableListOf(
|
||||
GridBean("司机之家", R.drawable.home_driver),
|
||||
GridBean("咨询客服", R.drawable.home_ask),
|
||||
GridBean("问卷调查", R.drawable.home_que),
|
||||
GridBean("知识竞赛", R.drawable.home_know),
|
||||
)
|
||||
|
||||
override fun onFragmentVisibleChange(isVisible: Boolean) {
|
||||
if (isVisible) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onFragmentFirstVisible() {
|
||||
initRecy()
|
||||
binding.gridView.run {
|
||||
adapter = activity?.let { GridItemAdapter(it, gridDatas) }
|
||||
setOnItemClickListener { adapterView, view, i, l ->
|
||||
// println(i)
|
||||
}
|
||||
}
|
||||
|
||||
binding.tvMar.isSelected = true
|
||||
|
||||
}
|
||||
|
||||
|
||||
override fun getRefreshDate(stat: Int, page: Int, count: Int) {
|
||||
|
||||
}
|
||||
|
||||
private fun initRecy() {
|
||||
var datas = mutableListOf<WayBillBean>(
|
||||
WayBillBean(),
|
||||
WayBillBean(),
|
||||
WayBillBean(),
|
||||
WayBillBean(),
|
||||
WayBillBean(),
|
||||
WayBillBean(),
|
||||
WayBillBean(),
|
||||
WayBillBean()
|
||||
)
|
||||
var adapter = binding.recyclerView.run {
|
||||
layoutManager = LinearLayoutManager(mContext, RecyclerView.VERTICAL, false)
|
||||
setHasFixedSize(true)
|
||||
addItemDecoration(
|
||||
RecycleViewDivider(
|
||||
LinearLayout.VERTICAL,
|
||||
ConvertUtils.dp2px(16.0f),
|
||||
Color.TRANSPARENT
|
||||
)
|
||||
)
|
||||
adapter = WaybillAdapter()
|
||||
adapter as WaybillAdapter
|
||||
}.apply {
|
||||
setOnItemClickListener(OnItemClickListener { adapter, view, position ->
|
||||
ToastUtils.showToast(mContext,position.toString())
|
||||
})
|
||||
addChildClickViewIds(R.id.btnOk)
|
||||
setOnItemChildClickListener() { adapter, view, position ->
|
||||
ActivityUtils.startActivity(mContext,WaybillDetailActivity::class.java)
|
||||
}
|
||||
}
|
||||
adapter.addData(datas)
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package com.dahe.gldriver.ui.message
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.widget.LinearLayout
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.gldriver.adapter.MessageAdapter
|
||||
import com.dahe.gldriver.databinding.FragmentMessageBinding
|
||||
import com.dahe.gldriver.databinding.FragmentWaybillBinding
|
||||
import com.dahe.glex.bean.WayBillBean
|
||||
import com.dahe.mylibrary.base.BaseFragment
|
||||
import com.dahe.mylibrary.callback.RefreshCallBack
|
||||
import com.dahe.mylibrary.recycleviewswipe.RecycleViewDivider
|
||||
import com.dahe.mylibrary.utils.ConvertUtils
|
||||
import net.lucode.hackware.magicindicator.ViewPagerHelper
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.CommonNavigator
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.CommonNavigatorAdapter
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerIndicator
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerTitleView
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.indicators.LinePagerIndicator
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.ColorTransitionPagerTitleView
|
||||
|
||||
|
||||
/**
|
||||
* @ClassName HomeFragment
|
||||
* @Author 用户
|
||||
* @Date 2023/9/21 10:13
|
||||
* @Description TODO
|
||||
*/
|
||||
class MessageFragment : BaseFragment<FragmentMessageBinding>(), RefreshCallBack {
|
||||
|
||||
|
||||
override fun onFragmentVisibleChange(isVisible: Boolean) {
|
||||
if (isVisible) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onFragmentFirstVisible() {
|
||||
initRecy()
|
||||
|
||||
}
|
||||
|
||||
|
||||
override fun getRefreshDate(stat: Int, page: Int, count: Int) {
|
||||
|
||||
}
|
||||
|
||||
private fun initRecy() {
|
||||
var datas = mutableListOf<WayBillBean>(
|
||||
WayBillBean(),
|
||||
WayBillBean(),
|
||||
WayBillBean(),
|
||||
WayBillBean(),
|
||||
WayBillBean(),
|
||||
WayBillBean(),
|
||||
WayBillBean(),
|
||||
WayBillBean()
|
||||
)
|
||||
|
||||
var adapter = binding.recyclerView.run {
|
||||
layoutManager = LinearLayoutManager(mContext,RecyclerView.VERTICAL,false)
|
||||
addItemDecoration(
|
||||
RecycleViewDivider(
|
||||
LinearLayout.VERTICAL,
|
||||
ConvertUtils.dp2px(16.0f),
|
||||
Color.TRANSPARENT
|
||||
)
|
||||
)
|
||||
setHasFixedSize(true)
|
||||
adapter = MessageAdapter()
|
||||
adapter as MessageAdapter
|
||||
}
|
||||
|
||||
adapter.addData(datas)
|
||||
}
|
||||
|
||||
}
|
103
app/src/main/java/com/dahe/gldriver/ui/mine/MineFragment.kt
Normal file
@ -0,0 +1,103 @@
|
||||
package com.dahe.gldriver.ui.mine
|
||||
|
||||
import android.view.View
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.gldriver.adapter.GridItemAdapter
|
||||
import com.dahe.gldriver.bean.GridBean
|
||||
import com.dahe.gldriver.databinding.FragmentMineBinding
|
||||
import com.dahe.gldriver.utils.SPUtils
|
||||
import com.dahe.mylibrary.base.BaseFragment
|
||||
import com.dahe.mylibrary.utils.ToastUtils
|
||||
import com.tencent.bugly.crashreport.CrashReport
|
||||
|
||||
class MineFragment : BaseFragment<FragmentMineBinding>(), View.OnClickListener {
|
||||
private val tools = mutableListOf(
|
||||
GridBean("车队管理", R.drawable.car_team),
|
||||
GridBean("车辆管理", R.drawable.car_manage),
|
||||
GridBean("司机课堂", R.drawable.mine_class),
|
||||
GridBean("评价管理", R.drawable.rate)
|
||||
)
|
||||
|
||||
private val plats = mutableListOf(
|
||||
GridBean("平台规则", R.drawable.rules),
|
||||
GridBean("常见问题", R.drawable.question),
|
||||
GridBean("联系我们", R.drawable.call_us),
|
||||
GridBean("意见反馈", R.drawable.opin),
|
||||
GridBean("红色方向盘", R.drawable.part_dir),
|
||||
GridBean("检查更新", R.drawable.update),
|
||||
GridBean("关于我们", R.drawable.about),
|
||||
GridBean("设置", R.drawable.setting)
|
||||
)
|
||||
|
||||
override fun onFragmentVisibleChange(isVisible: Boolean) {
|
||||
if (isVisible) {
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun onFragmentFirstVisible() {
|
||||
|
||||
// val userInfo = SPUtils.instance.getUserInfo(mContext)
|
||||
// if (null==userInfo)
|
||||
// return
|
||||
|
||||
binding.gvTools.run {
|
||||
|
||||
adapter = GridItemAdapter(mContext, tools, R.layout.grid_mine_item)
|
||||
setOnItemClickListener { _, _, i, _ ->
|
||||
goTools(i)
|
||||
}
|
||||
}
|
||||
|
||||
binding.gvPlat.run {
|
||||
adapter = GridItemAdapter(mContext, plats, R.layout.grid_mine_item)
|
||||
setOnItemClickListener { _, _, i, _ ->
|
||||
goPlats(i)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onClick(v: View) {
|
||||
when (v.id) {
|
||||
// R.id.rlPass->ActivityUtils.startActivity(mContext,ChangePwdActivity::class.java)
|
||||
// R.id.rlPhone-> AppActivityUtils.openWebViewActivity(mContext, "隐私政策",
|
||||
// "http://tms.down.user.test.dahehuodongbao.com/user-privacy.html")
|
||||
//// R.id.rlPhone->ActivityUtils.startActivity(mContext,ChangePhoneActivity::class.java)
|
||||
// R.id.btnOut-> CrashReport.testJavaCrash();
|
||||
}
|
||||
}
|
||||
|
||||
fun logOut() {
|
||||
// UserUtils.instance.loginOut(requireActivity())
|
||||
// val intent = Intent(mContext, LoginActivity::class.java)
|
||||
// intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
// requireActivity().startActivity(intent)
|
||||
}
|
||||
|
||||
|
||||
private fun goTools(pos: Int) {
|
||||
when (pos) {
|
||||
0 -> {
|
||||
ToastUtils.showToast(mContext, tools[pos].title)
|
||||
}
|
||||
1 -> {
|
||||
ToastUtils.showToast(mContext, tools[pos].title)
|
||||
}
|
||||
2 -> {
|
||||
ToastUtils.showToast(mContext, tools[pos].title)
|
||||
}
|
||||
3 -> {
|
||||
ToastUtils.showToast(mContext, tools[pos].title)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private fun goPlats(pos: Int) {
|
||||
ToastUtils.showToast(mContext, plats[pos].title)
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,127 @@
|
||||
package com.dahe.gldriver.ui.waybill
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.gldriver.databinding.FragmentWaybillBinding
|
||||
import com.dahe.gldriver.ui.waybill.fragment.AllWaybillFragment
|
||||
import com.dahe.mylibrary.base.BaseFragment
|
||||
import com.dahe.mylibrary.callback.RefreshCallBack
|
||||
import net.lucode.hackware.magicindicator.FragmentContainerHelper
|
||||
import net.lucode.hackware.magicindicator.buildins.UIUtil
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.CommonNavigator
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.CommonNavigatorAdapter
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerIndicator
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerTitleView
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.indicators.LinePagerIndicator
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.ColorTransitionPagerTitleView
|
||||
|
||||
|
||||
/**
|
||||
* @ClassName HomeFragment
|
||||
* @Author 用户
|
||||
* @Date 2023/9/21 10:13
|
||||
* @Description TODO
|
||||
*/
|
||||
class WaybillFragment : BaseFragment<FragmentWaybillBinding>(), RefreshCallBack {
|
||||
|
||||
private val mFragmentContainerHelper = FragmentContainerHelper()
|
||||
var mFragments = listOf<Fragment>(AllWaybillFragment(),AllWaybillFragment(),AllWaybillFragment(),AllWaybillFragment(),AllWaybillFragment())
|
||||
val titles = mutableListOf(
|
||||
"全部",
|
||||
"待装货",
|
||||
"待卸货",
|
||||
"待评价",
|
||||
"取消"
|
||||
)
|
||||
|
||||
override fun onFragmentVisibleChange(isVisible: Boolean) {
|
||||
if (isVisible) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onFragmentFirstVisible() {
|
||||
initRecy()
|
||||
|
||||
|
||||
|
||||
mFragmentContainerHelper.handlePageSelected(0,true)
|
||||
switchPages(0)
|
||||
|
||||
var commonNavigator = CommonNavigator(mContext)
|
||||
commonNavigator.run {
|
||||
isAdjustMode = true
|
||||
adapter = object : CommonNavigatorAdapter() {
|
||||
override fun getCount(): Int {
|
||||
return titles.size
|
||||
}
|
||||
|
||||
override fun getTitleView(context: Context?, index: Int): IPagerTitleView {
|
||||
val colorTransitionPagerTitleView = ColorTransitionPagerTitleView(context)
|
||||
colorTransitionPagerTitleView.normalColor = Color.BLACK
|
||||
colorTransitionPagerTitleView.selectedColor = Color.RED
|
||||
colorTransitionPagerTitleView.text = titles[index]
|
||||
colorTransitionPagerTitleView.setOnClickListener {
|
||||
mFragmentContainerHelper.handlePageSelected(index)
|
||||
switchPages(index)
|
||||
}
|
||||
return colorTransitionPagerTitleView
|
||||
}
|
||||
|
||||
override fun getIndicator(context: Context?): IPagerIndicator {
|
||||
// val indicator = LinePagerIndicator(context)
|
||||
// indicator.mode = LinePagerIndicator.MODE_WRAP_CONTENT
|
||||
// return indicator
|
||||
|
||||
val indicator = LinePagerIndicator(context)
|
||||
indicator.mode = LinePagerIndicator.MODE_WRAP_CONTENT
|
||||
indicator.yOffset =
|
||||
UIUtil.dip2px(context, 3.0).toFloat()
|
||||
indicator.setColors(Color.RED)
|
||||
return indicator
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
binding.magicIndicator.navigator = commonNavigator
|
||||
mFragmentContainerHelper.attachMagicIndicator(binding.magicIndicator)
|
||||
// ViewPagerHelper.bind(binding.magicIndicator, binding.viewPager);
|
||||
}
|
||||
|
||||
|
||||
override fun getRefreshDate(stat: Int, page: Int, count: Int) {
|
||||
|
||||
}
|
||||
|
||||
private fun initRecy() {
|
||||
|
||||
}
|
||||
private fun switchPages(index: Int) {
|
||||
val fragmentManager = requireActivity().supportFragmentManager
|
||||
val fragmentTransaction = fragmentManager.beginTransaction()
|
||||
var fragment: Fragment
|
||||
var i = 0
|
||||
val j: Int = mFragments.size
|
||||
while (i < j) {
|
||||
if (i == index) {
|
||||
i++
|
||||
continue
|
||||
}
|
||||
fragment = mFragments[i]
|
||||
if (fragment.isAdded) {
|
||||
fragmentTransaction.hide(fragment)
|
||||
}
|
||||
i++
|
||||
}
|
||||
fragment = mFragments[index]
|
||||
if (fragment.isAdded) {
|
||||
fragmentTransaction.show(fragment)
|
||||
} else {
|
||||
fragmentTransaction.add(R.id.fragmentContainer, fragment)
|
||||
}
|
||||
fragmentTransaction.commitAllowingStateLoss()
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.dahe.gldriver.ui.waybill.activity
|
||||
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.gldriver.databinding.ActivityWaybillDetailBinding
|
||||
import com.dahe.mylibrary.base.BaseActivity
|
||||
|
||||
/**
|
||||
* @ClassName WaybillDetailActivity
|
||||
* @Author john
|
||||
* @Date 2024/1/26 14:50
|
||||
* @Description 运单详情-接单
|
||||
*/
|
||||
class WaybillDetailActivity :BaseActivity<ActivityWaybillDetailBinding>(){
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
}
|
||||
|
||||
override fun initDate() {
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.dahe.gldriver.ui.waybill.fragment
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.dahe.gldriver.adapter.WaybillListAdapter
|
||||
import com.dahe.gldriver.databinding.FragmentWaybillBinding
|
||||
import com.dahe.gldriver.databinding.FragmentWaybillListBinding
|
||||
import com.dahe.glex.bean.WayBillBean
|
||||
import com.dahe.mylibrary.base.BaseFragment
|
||||
|
||||
/**
|
||||
* @ClassName AllWaybillFragment
|
||||
* @Author 用户
|
||||
* @Date 2024/1/24 14:06
|
||||
* @Description TODO
|
||||
*/
|
||||
class AllWaybillFragment : BaseFragment<FragmentWaybillListBinding>() {
|
||||
|
||||
|
||||
override fun onFragmentVisibleChange(isVisible: Boolean) {
|
||||
|
||||
}
|
||||
|
||||
override fun onFragmentFirstVisible() {
|
||||
var datas = mutableListOf<WayBillBean>(
|
||||
WayBillBean(),
|
||||
WayBillBean(),
|
||||
WayBillBean(),
|
||||
WayBillBean(),
|
||||
WayBillBean(),
|
||||
WayBillBean(),
|
||||
WayBillBean(),
|
||||
WayBillBean()
|
||||
)
|
||||
var adapter = binding.recyclerView.run {
|
||||
layoutManager = LinearLayoutManager(mContext,RecyclerView.VERTICAL,false)
|
||||
setHasFixedSize(true)
|
||||
adapter = WaybillListAdapter()
|
||||
adapter as WaybillListAdapter
|
||||
}
|
||||
adapter.addData(datas)
|
||||
}
|
||||
}
|
38
app/src/main/java/com/dahe/gldriver/utils/BaseSingleton.kt
Normal file
@ -0,0 +1,38 @@
|
||||
package com.dahe.gldriver.utils
|
||||
|
||||
/**
|
||||
* @ClassName BaseSingleton
|
||||
* @Author 用户
|
||||
* @Date 2023/12/29 09:49
|
||||
* @Description //要实现单例类,就只需要继承这个 BaseSingleton 即可
|
||||
//P为参数,T为返回值
|
||||
*/
|
||||
abstract class BaseSingleton<in P, out T> {
|
||||
|
||||
@Volatile
|
||||
private var instance: T? = null
|
||||
|
||||
//抽象方法,需要我们在具体的单例子类当中实现此方法
|
||||
protected abstract fun creator(param: P?): T
|
||||
|
||||
fun getInstance(param: P?): T =
|
||||
instance ?: synchronized(this) {
|
||||
instance ?: creator(param).also { instance = it }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
abstract class BaseSingNoParam<out T> {
|
||||
|
||||
@Volatile
|
||||
private var instance: T? = null
|
||||
|
||||
//抽象方法,需要我们在具体的单例子类当中实现此方法
|
||||
protected abstract fun creator(): T
|
||||
|
||||
fun getInstance(): T =
|
||||
instance ?: synchronized(this) {
|
||||
instance ?: creator().also { instance = it }
|
||||
}
|
||||
|
||||
}
|
127
app/src/main/java/com/dahe/gldriver/utils/SPUtils.kt
Normal file
@ -0,0 +1,127 @@
|
||||
package com.dahe.gldriver.utils
|
||||
|
||||
import android.content.Context
|
||||
import com.dahe.glex.bean.UserBean
|
||||
import com.dahe.mylibrary.net.JsonUtils
|
||||
import com.dahe.mylibrary.utils.BaseSPUtils
|
||||
|
||||
/**
|
||||
* @ClassName SPUtils2
|
||||
* @Author 用户
|
||||
* @Date 2023/12/29 08:52
|
||||
* @Description TODO
|
||||
*/
|
||||
class SPUtils private constructor() : BaseSPUtils() {
|
||||
companion object{
|
||||
val instance = Holder.holder
|
||||
}
|
||||
|
||||
object Holder {
|
||||
val holder = SPUtils()
|
||||
}
|
||||
|
||||
/**
|
||||
* 存用户信息
|
||||
*
|
||||
* @param context
|
||||
* @param json
|
||||
*/
|
||||
fun setUserInfo(context: Context?, json: String?) {
|
||||
BaseSPUtils.put(context, BaseSPUtils.USER_INFO_KEY, json)
|
||||
}
|
||||
|
||||
/**
|
||||
* 拿用户信息
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
fun getUserInfo(context: Context?): UserBean? {
|
||||
return JsonUtils.getInstance()
|
||||
.fromJson(BaseSPUtils.get(context, BaseSPUtils.USER_INFO_KEY, "") as String,
|
||||
UserBean::class.java)
|
||||
}
|
||||
|
||||
/**
|
||||
* 存服务器类型
|
||||
*
|
||||
* @param context
|
||||
* @param isTestService
|
||||
*/
|
||||
fun setNetServiceType(context: Context?, isTestService: Boolean) {
|
||||
BaseSPUtils.put(context, BaseSPUtils.NET_SERVICE_TEST, isTestService)
|
||||
}
|
||||
|
||||
/**
|
||||
* 拿服务器类型
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
fun geNetServiceType(context: Context?): Boolean {
|
||||
return BaseSPUtils.get(context, BaseSPUtils.NET_SERVICE_TEST, false) as Boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* 存搜索数据
|
||||
*
|
||||
* @param context
|
||||
* @param json
|
||||
*/
|
||||
fun setSearchCache(context: Context?, json: String?) {
|
||||
BaseSPUtils.put(context, BaseSPUtils.SEARRH_CACHE, json)
|
||||
}
|
||||
|
||||
fun getSearchCache(context: Context?): String? {
|
||||
return JsonUtils.getInstance()
|
||||
.fromJson(BaseSPUtils.get(context, BaseSPUtils.SEARRH_CACHE, "") as String,
|
||||
String::class.java)
|
||||
}
|
||||
|
||||
fun removeSearchCache(context: Context?) {
|
||||
BaseSPUtils.remove(context, BaseSPUtils.SEARRH_CACHE)
|
||||
}
|
||||
|
||||
/**
|
||||
* 导航偏好设置
|
||||
*/
|
||||
fun setNaviPreferenceCache(context: Context?, json: String?) {
|
||||
BaseSPUtils.put(context, BaseSPUtils.NAVI_PH_EDIT_CACHE, json)
|
||||
}
|
||||
|
||||
fun getNaviPreferenceCache(context: Context?): String? {
|
||||
return JsonUtils.getInstance()
|
||||
.fromJson(BaseSPUtils.get(context, BaseSPUtils.NAVI_PH_EDIT_CACHE, "") as String,
|
||||
String::class.java)
|
||||
}
|
||||
|
||||
fun removeNaviPreference(context: Context?) {
|
||||
BaseSPUtils.remove(context, BaseSPUtils.NAVI_PH_EDIT_CACHE)
|
||||
}
|
||||
|
||||
//第一次登录
|
||||
fun getIsFirstOpen(context: Context?): Boolean {
|
||||
return BaseSPUtils.get(context, BaseSPUtils.FIRST_OPEN, true) as Boolean
|
||||
}
|
||||
|
||||
fun setIsFirstOpen(context: Context?, json: Boolean) {
|
||||
BaseSPUtils.put(context, BaseSPUtils.FIRST_OPEN, json)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置隐私协议是否同意
|
||||
*
|
||||
* @param value 是否同意
|
||||
*/
|
||||
fun setAgreePrivacyAgreement(context: Context?, value: Boolean) {
|
||||
BaseSPUtils.put(context, BaseSPUtils.KEY_PRIVACY_AGREEMENT, value)
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否同意了隐私协议
|
||||
*
|
||||
* @return true 已经同意;false 还没有同意
|
||||
*/
|
||||
fun hasAgreePrivacyAgreement(context: Context?): Boolean {
|
||||
return BaseSPUtils.get(context, BaseSPUtils.KEY_PRIVACY_AGREEMENT, false) as Boolean
|
||||
}
|
||||
}
|
26
app/src/main/java/com/dahe/gldriver/utils/UserUtils.kt
Normal file
@ -0,0 +1,26 @@
|
||||
package com.dahe.gldriver.utils
|
||||
|
||||
import android.content.Context
|
||||
import com.dahe.mylibrary.utils.BaseSPUtils
|
||||
|
||||
class UserUtils private constructor(){
|
||||
|
||||
companion object{
|
||||
val instance = Holder.holder
|
||||
}
|
||||
|
||||
private object Holder {
|
||||
val holder = UserUtils()
|
||||
}
|
||||
|
||||
fun loginOut(context : Context){
|
||||
if (null== SPUtils.instance.getUserInfo(context))
|
||||
return
|
||||
// PushAgent.getInstance(context).deleteAlias(SPUtils.getUserInfo(context).userInfo.userId,"uid"){ b, s -> }
|
||||
BaseSPUtils.cleanUserInfo(context)
|
||||
// val intent = Intent(context, LauncherActivity::class.java)
|
||||
// intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
// context.startActivity(intent)
|
||||
// ToastUtils.showToast(context, "您的账号再异地登录,请重新登录")
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package com.dahe.gldriver.weight
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import androidx.viewpager.widget.ViewPager
|
||||
import android.view.MotionEvent
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/7/16 0016.
|
||||
*/
|
||||
class NoScrollViewPager : ViewPager {
|
||||
private val isCanScroll = false
|
||||
|
||||
constructor(context: Context?) : super(context!!) {}
|
||||
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {}
|
||||
|
||||
/**
|
||||
* 去掉viewpage滑动动画
|
||||
*
|
||||
* @param item
|
||||
*/
|
||||
override fun setCurrentItem(item: Int) {
|
||||
super.setCurrentItem(item, false)
|
||||
}
|
||||
|
||||
/**
|
||||
* 1.dispatchTouchEvent一般情况不做处理
|
||||
* ,如果修改了默认的返回值,子孩子都无法收到事件
|
||||
*/
|
||||
override fun dispatchTouchEvent(ev: MotionEvent): Boolean {
|
||||
return super.dispatchTouchEvent(ev) // node_return true;不行
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否拦截
|
||||
* 拦截:会走到自己的onTouchEvent方法里面来
|
||||
* 不拦截:事件传递给子孩子
|
||||
*/
|
||||
override fun onInterceptTouchEvent(ev: MotionEvent): Boolean {
|
||||
// node_return false;//可行,不拦截事件,
|
||||
// node_return true;//不行,孩子无法处理事件
|
||||
//node_return super.onInterceptTouchEvent(ev);//不行,会有细微移动
|
||||
return if (isCanScroll) {
|
||||
super.onInterceptTouchEvent(ev)
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否消费事件
|
||||
* 消费:事件就结束
|
||||
* 不消费:往父控件传
|
||||
*/
|
||||
override fun onTouchEvent(ev: MotionEvent): Boolean {
|
||||
//node_return false;// 可行,不消费,传给父控件
|
||||
//node_return true;// 可行,消费,拦截事件
|
||||
//super.onTouchEvent(ev); //不行,
|
||||
//虽然onInterceptTouchEvent中拦截了,
|
||||
//但是如果viewpage里面子控件不是viewgroup,还是会调用这个方法.
|
||||
return if (isCanScroll) {
|
||||
super.onTouchEvent(ev)
|
||||
} else {
|
||||
true // 可行,消费,拦截事件
|
||||
}
|
||||
}
|
||||
|
||||
fun setScroll(isCanScroll: Boolean) {
|
||||
var isCanScroll = isCanScroll
|
||||
isCanScroll = isCanScroll
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.dahe.gldriver.weight
|
||||
|
||||
import android.content.Context
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.ColorTransitionPagerTitleView
|
||||
|
||||
/**
|
||||
* 带颜色渐变和缩放的指示器标题
|
||||
* 博客: http://hackware.lucode.net
|
||||
* Created by hackware on 2016/6/26.
|
||||
*/
|
||||
class ScaleTransitionPagerTitleView(context: Context?) : ColorTransitionPagerTitleView(context) {
|
||||
var minScale = 0.75f
|
||||
override fun onEnter(index: Int, totalCount: Int, enterPercent: Float, leftToRight: Boolean) {
|
||||
super.onEnter(index, totalCount, enterPercent, leftToRight) // 实现颜色渐变
|
||||
scaleX = minScale + (1.0f - minScale) * enterPercent
|
||||
scaleY = minScale + (1.0f - minScale) * enterPercent
|
||||
}
|
||||
|
||||
override fun onLeave(index: Int, totalCount: Int, leavePercent: Float, leftToRight: Boolean) {
|
||||
super.onLeave(index, totalCount, leavePercent, leftToRight) // 实现颜色渐变
|
||||
scaleX = 1.0f + (minScale - 1.0f) * leavePercent
|
||||
scaleY = 1.0f + (minScale - 1.0f) * leavePercent
|
||||
}
|
||||
|
||||
}
|
416
app/src/main/java/com/dahe/gldriver/weight/VerifyEditText.kt
Normal file
@ -0,0 +1,416 @@
|
||||
package com.dahe.gldriver.weight
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.animation.ValueAnimator
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.ActionBar
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.ClipDrawable.HORIZONTAL
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.text.*
|
||||
import android.text.method.HideReturnsTransformationMethod
|
||||
import android.text.method.PasswordTransformationMethod
|
||||
import android.util.AttributeSet
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.EditText
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.RelativeLayout
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.dahe.gldriver.R
|
||||
import com.lxj.xpopup.util.KeyboardUtils
|
||||
import java.security.AccessController.getContext
|
||||
|
||||
/**
|
||||
* @ClassName VerifyEditText
|
||||
* @Author 用户
|
||||
* @Date 2024/1/25 09:55
|
||||
* @Description TODO
|
||||
*/
|
||||
class VerifyEditText @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : LinearLayout(context, attrs, defStyleAttr) {
|
||||
private val mTextViewList: MutableList<TextView> = ArrayList()
|
||||
private val mRelativeLayouts: MutableList<RelativeLayout> = mutableListOf()
|
||||
private val mCursorViews: MutableList<View> = mutableListOf()
|
||||
private var mShowCursor = false
|
||||
private var mCursorColor: Int = Color.parseColor("#FFFFFF")
|
||||
private var mEditText: EditText? = null
|
||||
private var drawableNormal: Drawable? = null
|
||||
private var drawableSelected: Drawable? = null
|
||||
private var mContext: Context? = null
|
||||
private var valueAnimator: ValueAnimator? = null
|
||||
private var mItemCount = 0
|
||||
|
||||
//输入完成监听
|
||||
private var mInputCompleteListener: InputCompleteListener? = null
|
||||
|
||||
init {
|
||||
init(context, attrs)
|
||||
}
|
||||
|
||||
private fun init(context: Context, attrs: AttributeSet?) {
|
||||
mContext = context
|
||||
orientation = HORIZONTAL
|
||||
gravity = Gravity.CENTER
|
||||
@SuppressLint("CustomViewStyleable")
|
||||
val obtainStyledAttributes =
|
||||
getContext().obtainStyledAttributes(attrs, R.styleable.verify_EditText)
|
||||
drawableNormal =
|
||||
obtainStyledAttributes.getDrawable(R.styleable.verify_EditText_verify_background_normal)
|
||||
drawableSelected =
|
||||
obtainStyledAttributes.getDrawable(R.styleable.verify_EditText_verify_background_selected)
|
||||
val textColor = obtainStyledAttributes.getColor(
|
||||
R.styleable.verify_EditText_verify_textColor,
|
||||
ContextCompat.getColor(context, android.R.color.black)
|
||||
)
|
||||
mItemCount = obtainStyledAttributes.getInt(
|
||||
R.styleable.verify_EditText_verify_count,
|
||||
DEFAULT_ITEM_COUNT
|
||||
)
|
||||
val inputType = obtainStyledAttributes.getInt(
|
||||
R.styleable.verify_EditText_verify_inputType,
|
||||
InputType.TYPE_CLASS_NUMBER
|
||||
)
|
||||
val passwordVisibleTime = obtainStyledAttributes.getInt(
|
||||
R.styleable.verify_EditText_verify_password_visible_time,
|
||||
DEFAULT_PASSWORD_VISIBLE_TIME
|
||||
)
|
||||
val width = obtainStyledAttributes.getDimension(
|
||||
R.styleable.verify_EditText_verify_width,
|
||||
DEFAULT_ITEM_WIDTH.toFloat()
|
||||
).toInt()
|
||||
val height =
|
||||
obtainStyledAttributes.getDimension(R.styleable.verify_EditText_verify_height, 0f)
|
||||
.toInt()
|
||||
val cursorWidth = obtainStyledAttributes.getDimension(
|
||||
R.styleable.verify_EditText_cursor_width,
|
||||
1F
|
||||
).toInt()
|
||||
mCursorColor = obtainStyledAttributes.getColor(
|
||||
R.styleable.verify_EditText_cursor_color,
|
||||
ContextCompat.getColor(context, android.R.color.black)
|
||||
)
|
||||
mShowCursor =
|
||||
obtainStyledAttributes.getBoolean(R.styleable.verify_EditText_show_cursor, false)
|
||||
val cursorHeight = obtainStyledAttributes.getDimension(
|
||||
R.styleable.verify_EditText_cursor_height,
|
||||
20F
|
||||
).toInt()
|
||||
val margin = obtainStyledAttributes.getDimension(
|
||||
R.styleable.verify_EditText_verify_margin,
|
||||
DEFAULT_ITEM_MARGIN.toFloat()
|
||||
).toInt()
|
||||
val textSize = px2sp(
|
||||
context,
|
||||
obtainStyledAttributes.getDimension(
|
||||
R.styleable.verify_EditText_verify_textSize,
|
||||
sp2px(context, DEFAULT_ITEM_TEXT_SIZE.toFloat()).toFloat()
|
||||
)
|
||||
).toFloat()
|
||||
val password =
|
||||
obtainStyledAttributes.getBoolean(R.styleable.verify_EditText_verify_password, false)
|
||||
obtainStyledAttributes.recycle()
|
||||
if (mItemCount < 2) mItemCount = 2 //最少 2 个 item
|
||||
mEditText = EditText(context)
|
||||
mEditText?.run {
|
||||
mEditText?.inputType = inputType
|
||||
layoutParams = ActionBar.LayoutParams(1, 1)
|
||||
isCursorVisible = false
|
||||
background = null
|
||||
filters = arrayOf<InputFilter>(InputFilter.LengthFilter(mItemCount)) //限制输入长度为 count
|
||||
addTextChangedListener(object : TextWatcher {
|
||||
override fun beforeTextChanged(
|
||||
s: CharSequence,
|
||||
start: Int,
|
||||
count: Int,
|
||||
after: Int
|
||||
) {
|
||||
}
|
||||
|
||||
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
|
||||
if (before == 0 && (start + count) < 7) {// 输入
|
||||
if (count > 1) {// 有复制内容进来
|
||||
for (i in start until start + count) {
|
||||
val input = s.subSequence(i, i + 1) // 获取新输入的字
|
||||
inputText(i, password, passwordVisibleTime, input.toString())
|
||||
}
|
||||
} else {// 逐步输入
|
||||
inputText(
|
||||
start,
|
||||
password,
|
||||
passwordVisibleTime,
|
||||
s.subSequence(start, s.length).toString()
|
||||
)
|
||||
}
|
||||
} else {// 删除
|
||||
val textView = mTextViewList[start] // 获取对应的 textview
|
||||
textView.text = ""
|
||||
setTextViewBackground(textView, drawableNormal)
|
||||
}
|
||||
if (mInputCompleteListener != null && s.length == mTextViewList.size)
|
||||
mInputCompleteListener?.complete(
|
||||
s.toString()
|
||||
)
|
||||
}
|
||||
|
||||
override fun afterTextChanged(s: Editable) {
|
||||
setCursorColor()
|
||||
}
|
||||
})
|
||||
}
|
||||
addView(mEditText)
|
||||
//点击弹出软键盘
|
||||
setOnClickListener { v: View? ->
|
||||
mEditText?.requestFocus()
|
||||
showSoftKeyBoard()
|
||||
}
|
||||
//遍历生成 textview
|
||||
for (i in 0 until mItemCount) {
|
||||
val relativeLayout = RelativeLayout(context)
|
||||
relativeLayout.layoutParams = getRelativeLayoutParams(i, margin, width, height)
|
||||
mRelativeLayouts.add(relativeLayout)
|
||||
|
||||
val textView = TextView(context)
|
||||
textView.textSize = textSize
|
||||
textView.maxEms = 1
|
||||
textView.maxLines = 1
|
||||
// textView.gravity = Gravity.CENTER
|
||||
textView.setTextColor(textColor)
|
||||
// textView.layoutParams = layoutParams
|
||||
initTextView(textView)
|
||||
setTextViewBackground(textView, drawableNormal)
|
||||
// addView(textView)
|
||||
relativeLayout.addView(textView)
|
||||
mTextViewList.add(textView)
|
||||
|
||||
if (mShowCursor) {
|
||||
val cursorView = View(context)
|
||||
initCursorView(cursorView, cursorWidth, cursorHeight)
|
||||
relativeLayout.addView(cursorView)
|
||||
mCursorViews.add(cursorView)
|
||||
}
|
||||
relativeLayout.setBackgroundColor(Color.TRANSPARENT)
|
||||
addView(relativeLayout)
|
||||
}
|
||||
|
||||
setCursorColor()
|
||||
}
|
||||
|
||||
private fun getRelativeLayoutParams(
|
||||
i: Int,
|
||||
margin: Int,
|
||||
width: Int,
|
||||
height: Int
|
||||
): ActionBar.LayoutParams {
|
||||
val layoutParams = ActionBar.LayoutParams(
|
||||
width,
|
||||
if (height == 0) ViewGroup.LayoutParams.WRAP_CONTENT else height
|
||||
)
|
||||
if (i == 0) layoutParams.leftMargin = -1 else layoutParams.leftMargin = margin
|
||||
return layoutParams
|
||||
}
|
||||
|
||||
private fun initTextView(textView: TextView) {
|
||||
val lp: RelativeLayout.LayoutParams = RelativeLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT
|
||||
)
|
||||
textView.gravity = Gravity.CENTER
|
||||
textView.layoutParams = lp
|
||||
}
|
||||
|
||||
private fun initCursorView(cursorView: View, cursorWidth: Int, cursorHeight: Int) {
|
||||
val lp: RelativeLayout.LayoutParams = RelativeLayout.LayoutParams(
|
||||
cursorWidth,
|
||||
cursorHeight
|
||||
)
|
||||
lp.addRule(RelativeLayout.ALIGN_PARENT_START)
|
||||
lp.addRule(RelativeLayout.CENTER_VERTICAL)
|
||||
lp.marginStart = 6
|
||||
cursorView.layoutParams = lp
|
||||
}
|
||||
|
||||
private fun inputText(start: Int, password: Boolean, passwordVisibleTime: Int, input: String) {
|
||||
val textView = mTextViewList[start] // 获取对应的 textview
|
||||
textView.text = input
|
||||
if (password) { //如果需要密文显示
|
||||
textView.transformationMethod =
|
||||
HideReturnsTransformationMethod.getInstance()
|
||||
//passwordVisibleTime 毫秒后设置为密文显示
|
||||
textView.postDelayed(
|
||||
{
|
||||
textView.transformationMethod =
|
||||
PasswordTransformationMethod.getInstance()
|
||||
},
|
||||
passwordVisibleTime.toLong()
|
||||
)
|
||||
}
|
||||
setTextViewBackground(textView, drawableSelected)
|
||||
}
|
||||
|
||||
/**
|
||||
* view 添加到窗口时,延迟 500ms 弹出软键盘
|
||||
*/
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
mEditText?.postDelayed({ showSoftKeyBoard() }, 500)
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置背景
|
||||
* @param textView
|
||||
* @param drawable
|
||||
*/
|
||||
private fun setTextViewBackground(textView: TextView, drawable: Drawable?) {
|
||||
if (drawable != null) textView.background = drawable
|
||||
}
|
||||
|
||||
private fun setCursorColor() {
|
||||
if (mShowCursor) {
|
||||
valueAnimator?.cancel()
|
||||
|
||||
for (i in 0 until mItemCount) {
|
||||
val cursorView = mCursorViews[i]
|
||||
cursorView.setBackgroundColor(Color.TRANSPARENT)
|
||||
}
|
||||
|
||||
val index = mEditText?.text?.length ?: 0
|
||||
if (index < mItemCount) {
|
||||
setCursorView(mCursorViews[index])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置焦点色变换动画
|
||||
*
|
||||
* @param view
|
||||
*/
|
||||
private fun setCursorView(view: View) {
|
||||
this.valueAnimator = ObjectAnimator.ofInt(
|
||||
view,
|
||||
"backgroundColor",
|
||||
mCursorColor,
|
||||
android.R.color.transparent
|
||||
)
|
||||
valueAnimator?.run {
|
||||
duration = 1500
|
||||
repeatCount = -1
|
||||
repeatMode = ValueAnimator.RESTART
|
||||
setEvaluator { fraction, startValue, endValue -> if (fraction <= 0.5f) startValue else endValue }
|
||||
start()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前输入的内容
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
val content: String
|
||||
get() {
|
||||
val text = mEditText?.text
|
||||
return if (TextUtils.isEmpty(text)) "" else mEditText?.text.toString()
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除内容
|
||||
*/
|
||||
fun clearContent() {
|
||||
mEditText?.setText("")
|
||||
for (i in mTextViewList.indices) {
|
||||
val textView = mTextViewList[i]
|
||||
textView.text = ""
|
||||
setTextViewBackground(textView, drawableNormal)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置默认的内容
|
||||
*
|
||||
* @param content
|
||||
*/
|
||||
fun setDefaultContent(content: String) {
|
||||
mEditText?.setText(content)
|
||||
mEditText?.requestFocus()
|
||||
val chars = content.toCharArray()
|
||||
val min = Math.min(chars.size, mTextViewList.size)
|
||||
for (i in 0 until min) {
|
||||
val aChar = chars[i]
|
||||
val s = aChar.toString()
|
||||
val textView = mTextViewList[i]
|
||||
textView.text = s
|
||||
setTextViewBackground(textView, drawableSelected)
|
||||
}
|
||||
if (mInputCompleteListener != null && min == mTextViewList.size) mInputCompleteListener?.complete(
|
||||
content.substring(0, min)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示软键盘
|
||||
*/
|
||||
private fun showSoftKeyBoard() {
|
||||
val imm = mContext?.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
imm.showSoftInput(mEditText, InputMethodManager.SHOW_FORCED)
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加输入完成的监听
|
||||
*
|
||||
* @param inputCompleteListener
|
||||
*/
|
||||
fun addInputCompleteListener(inputCompleteListener: InputCompleteListener) {
|
||||
mInputCompleteListener = inputCompleteListener
|
||||
val content = mEditText?.text
|
||||
if (!TextUtils.isEmpty(content) && content.toString().length == mTextViewList.size) {
|
||||
mInputCompleteListener?.complete(content.toString())
|
||||
}
|
||||
}
|
||||
|
||||
interface InputCompleteListener {
|
||||
fun complete(content: String)
|
||||
}
|
||||
|
||||
private fun px2sp(context: Context, pxValue: Float): Int {
|
||||
val fontScale = context.resources.displayMetrics.scaledDensity
|
||||
return (pxValue / fontScale + 0.5f).toInt()
|
||||
}
|
||||
|
||||
private fun sp2px(context: Context, spValue: Float): Int {
|
||||
val fontScale = context.resources.displayMetrics.scaledDensity
|
||||
return (spValue * fontScale + 0.5f).toInt()
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
KeyboardUtils.hideSoftInput(this)
|
||||
// CommonUtil.hideKeyboard(this)
|
||||
valueAnimator?.cancel()
|
||||
}
|
||||
|
||||
|
||||
companion object {
|
||||
//默认 item 个数为 4 个
|
||||
private const val DEFAULT_ITEM_COUNT = 4
|
||||
|
||||
//默认每个 item 的宽度为 100
|
||||
private const val DEFAULT_ITEM_WIDTH = 100
|
||||
|
||||
//默认每个 item 的间距为 50
|
||||
private const val DEFAULT_ITEM_MARGIN = 50
|
||||
|
||||
//默认每个 item 的字体大小为 14
|
||||
private const val DEFAULT_ITEM_TEXT_SIZE = 14
|
||||
|
||||
//默认密码明文显示时间为 200ms,之后密文显示
|
||||
private const val DEFAULT_PASSWORD_VISIBLE_TIME = 200
|
||||
}
|
||||
}
|
30
app/src/main/res/drawable-v24/ic_launcher_foreground.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
BIN
app/src/main/res/drawable-xxhdpi/about.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/drawable-xxhdpi/auth_car.png
Normal file
After Width: | Height: | Size: 88 KiB |
BIN
app/src/main/res/drawable-xxhdpi/bank_card.png
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
app/src/main/res/drawable-xxhdpi/bobao.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
app/src/main/res/drawable-xxhdpi/call_us.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/drawable-xxhdpi/car_manage.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/drawable-xxhdpi/car_photo.png
Normal file
After Width: | Height: | Size: 35 KiB |
BIN
app/src/main/res/drawable-xxhdpi/car_team.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
app/src/main/res/drawable-xxhdpi/driver_back.png
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
app/src/main/res/drawable-xxhdpi/driver_front.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
app/src/main/res/drawable-xxhdpi/driving_back.png
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
app/src/main/res/drawable-xxhdpi/driving_front.png
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
app/src/main/res/drawable-xxhdpi/face.png
Normal file
After Width: | Height: | Size: 51 KiB |
BIN
app/src/main/res/drawable-xxhdpi/face1.png
Normal file
After Width: | Height: | Size: 7.7 KiB |
BIN
app/src/main/res/drawable-xxhdpi/face2.png
Normal file
After Width: | Height: | Size: 7.8 KiB |
BIN
app/src/main/res/drawable-xxhdpi/face3.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
app/src/main/res/drawable-xxhdpi/go_right.png
Normal file
After Width: | Height: | Size: 352 B |
BIN
app/src/main/res/drawable-xxhdpi/head_defaut.png
Normal file
After Width: | Height: | Size: 8.3 KiB |
BIN
app/src/main/res/drawable-xxhdpi/home_all.png
Normal file
After Width: | Height: | Size: 46 KiB |
BIN
app/src/main/res/drawable-xxhdpi/home_ask.png
Normal file
After Width: | Height: | Size: 9.5 KiB |
BIN
app/src/main/res/drawable-xxhdpi/home_driver.png
Normal file
After Width: | Height: | Size: 8.0 KiB |
BIN
app/src/main/res/drawable-xxhdpi/home_know.png
Normal file
After Width: | Height: | Size: 5.6 KiB |
BIN
app/src/main/res/drawable-xxhdpi/home_logo.png
Normal file
After Width: | Height: | Size: 9.9 KiB |
BIN
app/src/main/res/drawable-xxhdpi/home_my.png
Normal file
After Width: | Height: | Size: 59 KiB |
BIN
app/src/main/res/drawable-xxhdpi/home_que.png
Normal file
After Width: | Height: | Size: 7.5 KiB |
BIN
app/src/main/res/drawable-xxhdpi/home_top_bg.jpg
Normal file
After Width: | Height: | Size: 261 KiB |
BIN
app/src/main/res/drawable-xxhdpi/icon_go.png
Normal file
After Width: | Height: | Size: 997 B |
BIN
app/src/main/res/drawable-xxhdpi/icon_load.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
app/src/main/res/drawable-xxhdpi/icon_route.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
app/src/main/res/drawable-xxhdpi/icon_unload.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
app/src/main/res/drawable-xxhdpi/kuaixun.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
app/src/main/res/drawable-xxhdpi/login_car.png
Normal file
After Width: | Height: | Size: 211 KiB |
BIN
app/src/main/res/drawable-xxhdpi/login_top_bg.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
app/src/main/res/drawable-xxhdpi/message_noti.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/drawable-xxhdpi/message_order.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
app/src/main/res/drawable-xxhdpi/message_sys.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
app/src/main/res/drawable-xxhdpi/mine_bg.png
Normal file
After Width: | Height: | Size: 1020 KiB |