初始化项目
This commit is contained in:
commit
f083775286
13
.gitignore
vendored
Normal file
13
.gitignore
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
*.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
|
1
app/.gitignore
vendored
Normal file
1
app/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
BIN
app/libs/BaiduLBS_Android.jar
Normal file
BIN
app/libs/BaiduLBS_Android.jar
Normal file
Binary file not shown.
BIN
app/libs/IndoorscapeAlbumPlugin.jar
Normal file
BIN
app/libs/IndoorscapeAlbumPlugin.jar
Normal file
Binary file not shown.
BIN
app/libs/arm64-v8a/libBaiduMapSDK_base_v6_0_0.so
Normal file
BIN
app/libs/arm64-v8a/libBaiduMapSDK_base_v6_0_0.so
Normal file
Binary file not shown.
BIN
app/libs/arm64-v8a/libBaiduMapSDK_bikenavi_v5_4_0.so
Normal file
BIN
app/libs/arm64-v8a/libBaiduMapSDK_bikenavi_v5_4_0.so
Normal file
Binary file not shown.
BIN
app/libs/arm64-v8a/libBaiduMapSDK_map_for_bikenavi_v5_4_0.so
Normal file
BIN
app/libs/arm64-v8a/libBaiduMapSDK_map_for_bikenavi_v5_4_0.so
Normal file
Binary file not shown.
BIN
app/libs/arm64-v8a/libBaiduMapSDK_map_v6_0_0.so
Normal file
BIN
app/libs/arm64-v8a/libBaiduMapSDK_map_v6_0_0.so
Normal file
Binary file not shown.
BIN
app/libs/arm64-v8a/libapp_BaiduPanoramaAppLib.so
Normal file
BIN
app/libs/arm64-v8a/libapp_BaiduPanoramaAppLib.so
Normal file
Binary file not shown.
BIN
app/libs/arm64-v8a/libindoor.so
Normal file
BIN
app/libs/arm64-v8a/libindoor.so
Normal file
Binary file not shown.
BIN
app/libs/arm64-v8a/libjcore201.so
Normal file
BIN
app/libs/arm64-v8a/libjcore201.so
Normal file
Binary file not shown.
BIN
app/libs/arm64-v8a/liblocSDK8a.so
Normal file
BIN
app/libs/arm64-v8a/liblocSDK8a.so
Normal file
Binary file not shown.
BIN
app/libs/armeabi-v7a/libBaiduMapSDK_base_v6_0_0.so
Normal file
BIN
app/libs/armeabi-v7a/libBaiduMapSDK_base_v6_0_0.so
Normal file
Binary file not shown.
BIN
app/libs/armeabi-v7a/libBaiduMapSDK_bikenavi_v5_4_0.so
Normal file
BIN
app/libs/armeabi-v7a/libBaiduMapSDK_bikenavi_v5_4_0.so
Normal file
Binary file not shown.
BIN
app/libs/armeabi-v7a/libBaiduMapSDK_map_for_bikenavi_v5_4_0.so
Normal file
BIN
app/libs/armeabi-v7a/libBaiduMapSDK_map_for_bikenavi_v5_4_0.so
Normal file
Binary file not shown.
BIN
app/libs/armeabi-v7a/libBaiduMapSDK_map_v6_0_0.so
Normal file
BIN
app/libs/armeabi-v7a/libBaiduMapSDK_map_v6_0_0.so
Normal file
Binary file not shown.
BIN
app/libs/armeabi-v7a/libapp_BaiduPanoramaAppLib.so
Normal file
BIN
app/libs/armeabi-v7a/libapp_BaiduPanoramaAppLib.so
Normal file
Binary file not shown.
BIN
app/libs/armeabi-v7a/libindoor.so
Normal file
BIN
app/libs/armeabi-v7a/libindoor.so
Normal file
Binary file not shown.
BIN
app/libs/armeabi-v7a/libjcore201.so
Normal file
BIN
app/libs/armeabi-v7a/libjcore201.so
Normal file
Binary file not shown.
BIN
app/libs/armeabi-v7a/liblocSDK8a.so
Normal file
BIN
app/libs/armeabi-v7a/liblocSDK8a.so
Normal file
Binary file not shown.
BIN
app/libs/armeabi/libBaiduMapSDK_base_v6_0_0.so
Normal file
BIN
app/libs/armeabi/libBaiduMapSDK_base_v6_0_0.so
Normal file
Binary file not shown.
BIN
app/libs/armeabi/libBaiduMapSDK_bikenavi_v5_4_0.so
Normal file
BIN
app/libs/armeabi/libBaiduMapSDK_bikenavi_v5_4_0.so
Normal file
Binary file not shown.
BIN
app/libs/armeabi/libBaiduMapSDK_map_for_bikenavi_v5_4_0.so
Normal file
BIN
app/libs/armeabi/libBaiduMapSDK_map_for_bikenavi_v5_4_0.so
Normal file
Binary file not shown.
BIN
app/libs/armeabi/libBaiduMapSDK_map_v6_0_0.so
Normal file
BIN
app/libs/armeabi/libBaiduMapSDK_map_v6_0_0.so
Normal file
Binary file not shown.
BIN
app/libs/armeabi/libapp_BaiduPanoramaAppLib.so
Normal file
BIN
app/libs/armeabi/libapp_BaiduPanoramaAppLib.so
Normal file
Binary file not shown.
BIN
app/libs/armeabi/libindoor.so
Normal file
BIN
app/libs/armeabi/libindoor.so
Normal file
Binary file not shown.
BIN
app/libs/armeabi/libjcore201.so
Normal file
BIN
app/libs/armeabi/libjcore201.so
Normal file
Binary file not shown.
BIN
app/libs/armeabi/liblocSDK8a.so
Normal file
BIN
app/libs/armeabi/liblocSDK8a.so
Normal file
Binary file not shown.
BIN
app/libs/jcore-android-2.0.1.jar
Normal file
BIN
app/libs/jcore-android-2.0.1.jar
Normal file
Binary file not shown.
BIN
app/libs/jpush-android-3.3.4.jar
Normal file
BIN
app/libs/jpush-android-3.3.4.jar
Normal file
Binary file not shown.
BIN
app/libs/x86/libBaiduMapSDK_base_v6_0_0.so
Normal file
BIN
app/libs/x86/libBaiduMapSDK_base_v6_0_0.so
Normal file
Binary file not shown.
BIN
app/libs/x86/libBaiduMapSDK_bikenavi_v5_4_0.so
Normal file
BIN
app/libs/x86/libBaiduMapSDK_bikenavi_v5_4_0.so
Normal file
Binary file not shown.
BIN
app/libs/x86/libBaiduMapSDK_map_for_bikenavi_v5_4_0.so
Normal file
BIN
app/libs/x86/libBaiduMapSDK_map_for_bikenavi_v5_4_0.so
Normal file
Binary file not shown.
BIN
app/libs/x86/libBaiduMapSDK_map_v6_0_0.so
Normal file
BIN
app/libs/x86/libBaiduMapSDK_map_v6_0_0.so
Normal file
Binary file not shown.
BIN
app/libs/x86/libapp_BaiduPanoramaAppLib.so
Normal file
BIN
app/libs/x86/libapp_BaiduPanoramaAppLib.so
Normal file
Binary file not shown.
BIN
app/libs/x86/libindoor.so
Normal file
BIN
app/libs/x86/libindoor.so
Normal file
Binary file not shown.
BIN
app/libs/x86/libjcore201.so
Normal file
BIN
app/libs/x86/libjcore201.so
Normal file
Binary file not shown.
BIN
app/libs/x86/liblocSDK8a.so
Normal file
BIN
app/libs/x86/liblocSDK8a.so
Normal file
Binary file not shown.
BIN
app/libs/x86_64/libBaiduMapSDK_base_v6_0_0.so
Normal file
BIN
app/libs/x86_64/libBaiduMapSDK_base_v6_0_0.so
Normal file
Binary file not shown.
BIN
app/libs/x86_64/libBaiduMapSDK_bikenavi_v5_4_0.so
Normal file
BIN
app/libs/x86_64/libBaiduMapSDK_bikenavi_v5_4_0.so
Normal file
Binary file not shown.
BIN
app/libs/x86_64/libBaiduMapSDK_map_for_bikenavi_v5_4_0.so
Normal file
BIN
app/libs/x86_64/libBaiduMapSDK_map_for_bikenavi_v5_4_0.so
Normal file
Binary file not shown.
BIN
app/libs/x86_64/libBaiduMapSDK_map_v6_0_0.so
Normal file
BIN
app/libs/x86_64/libBaiduMapSDK_map_v6_0_0.so
Normal file
Binary file not shown.
BIN
app/libs/x86_64/libapp_BaiduPanoramaAppLib.so
Normal file
BIN
app/libs/x86_64/libapp_BaiduPanoramaAppLib.so
Normal file
Binary file not shown.
BIN
app/libs/x86_64/libindoor.so
Normal file
BIN
app/libs/x86_64/libindoor.so
Normal file
Binary file not shown.
BIN
app/libs/x86_64/libjcore201.so
Normal file
BIN
app/libs/x86_64/libjcore201.so
Normal file
Binary file not shown.
BIN
app/libs/x86_64/liblocSDK8a.so
Normal file
BIN
app/libs/x86_64/liblocSDK8a.so
Normal file
Binary file not shown.
21
app/proguard-rules.pro
vendored
Normal file
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
|
1
app/release/output.json
Normal file
1
app/release/output.json
Normal file
@ -0,0 +1 @@
|
||||
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":31,"versionName":"1.3.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
|
BIN
app/release/pz-1.3.0.apk
Normal file
BIN
app/release/pz-1.3.0.apk
Normal file
Binary file not shown.
@ -0,0 +1,26 @@
|
||||
package com.sucstepsoft.realtimelocation;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getTargetContext();
|
||||
|
||||
assertEquals("com.sucstepsoft.realtimelocation", appContext.getPackageName());
|
||||
}
|
||||
}
|
340
app/src/main/AndroidManifest.xml
Normal file
340
app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,340 @@
|
||||
<?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.sucstepsoft.realtimelocation">
|
||||
|
||||
<permission
|
||||
android:name="${applicationId}.permission.JPUSH_MESSAGE"
|
||||
android:protectionLevel="signature" />
|
||||
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="com.android.launcher.permission.READ_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission
|
||||
android:name="android.permission.WRITE_SETTINGS"
|
||||
tools:ignore="ProtectedPermissions" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" /> <!-- Required -->
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <!-- Required 一些系统要求的权限,如访问网络等 -->
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="${applicationId}.permission.JPUSH_MESSAGE" /> <!-- <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> -->
|
||||
<!-- Optional for location -->
|
||||
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" /> <!-- 用于开启 debug 版本的应用在6.0 系统上 层叠窗口权限 -->
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <!-- Android Q后台定位权限 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
|
||||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.CALL_PHONE" />
|
||||
<uses-permission android:name="android.permission.GET_TASKS" />
|
||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
|
||||
<application
|
||||
android:name=".base.BaseApplication"
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/ic_logo"
|
||||
android:label="@string/app_name"
|
||||
android:networkSecurityConfig="@xml/network_config"
|
||||
android:roundIcon="@drawable/ic_logo"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme"
|
||||
tools:ignore="GoogleAppIndexingWarning">
|
||||
<activity
|
||||
android:name=".activitys.addresslist.PersonListActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name=".activitys.addresslist.AddressListMainActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activitys.issue.MineIssueNewActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activitys.mine.LeaveCheckListActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
<activity
|
||||
android:name=".activitys.mine.LeaveDetailActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
<activity
|
||||
android:name=".activitys.mine.LeaveHistoryActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
<activity
|
||||
android:name=".activitys.mine.LeaveActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
<activity
|
||||
android:name=".activitys.issue.TakePointActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
<activity
|
||||
android:name=".activitys.addresslist.AddressListDetailActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activitys.issue.IssueMineActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity android:name=".activitys.issue.IssueCheckActivity" />
|
||||
<activity
|
||||
android:name=".activitys.issue.IssueMineDisActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activitys.notice.NoticeDetailActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activitys.notice.NoticeActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activitys.issue.IssueStepActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activitys.mine.AvisoActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activitys.issue.IssueDetailActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activitys.mine.UserInfoActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activitys.mine.ChangePwdActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activitys.locus.LocusManagerActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activitys.addresslist.AddressListActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activitys.mine.UserActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activitys.locus.LocusMapActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activitys.issue.IssueRecordActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
<activity
|
||||
android:name=".activitys.issue.IssueReportActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
<activity
|
||||
android:name=".activitys.base.SinglePixelActivity"
|
||||
android:excludeFromRecents="true"
|
||||
android:finishOnTaskLaunch="false"
|
||||
android:launchMode="singleInstance"
|
||||
android:theme="@style/OnePixelActivityTheme" />
|
||||
<activity
|
||||
android:name=".activitys.base.LoginActivity"
|
||||
android:screenOrientation="portrait">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activitys.base.MainActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:exported="false"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait">
|
||||
<intent-filter>
|
||||
<action android:name="jpush.testAction" />
|
||||
|
||||
<category android:name="jpush.testCategory" />
|
||||
</intent-filter>
|
||||
</activity> <!-- ====百度地图=== -->
|
||||
<activity android:name=".activitys.common.PhotoActivity" /> <!-- ============== -->
|
||||
<activity
|
||||
android:name="cn.jpush.android.ui.PopWinActivity"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/MyDialogStyle" />
|
||||
<activity
|
||||
android:name="cn.jpush.android.ui.PushActivity"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@android:style/Theme.NoTitleBar">
|
||||
<intent-filter>
|
||||
<action android:name="cn.jpush.android.ui.PushActivity" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="${applicationId}" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="cn.jpush.android.service.JNotifyActivity"
|
||||
android:exported="true"
|
||||
android:screenOrientation="portrait"
|
||||
android:taskAffinity="jpush.custom"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar">
|
||||
<intent-filter>
|
||||
<action android:name="cn.jpush.android.intent.JNotifyActivity" />
|
||||
|
||||
<category android:name="${applicationId}" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<meta-data
|
||||
android:name="com.baidu.lbsapi.API_KEY"
|
||||
android:value="DeBPdLMDT0RtO6VPFVpTYAfQOxLDE7ok" />
|
||||
<meta-data
|
||||
android:name="BUGLY_APPID"
|
||||
android:value="ff95776367" />
|
||||
<meta-data
|
||||
android:name="BUGLY_APP_VERSION"
|
||||
android:value="1.3.0" />
|
||||
<meta-data
|
||||
android:name="BUGLY_APP_CHANNEL"
|
||||
android:value="realtimelocation" /> <!-- 极光推送 -->
|
||||
<!-- Rich push 核心功能 since 2.0.6 -->
|
||||
<meta-data
|
||||
android:name="BUGLY_ENABLE_DEBUG"
|
||||
android:value="false" /> <!-- Required SDK核心功能 -->
|
||||
<meta-data
|
||||
android:name="JPUSH_CHANNEL"
|
||||
android:value="${JPUSH_CHANNEL}" /> <!-- Bugly -->
|
||||
<!-- 配置APP ID -->
|
||||
<meta-data
|
||||
android:name="JPUSH_APPKEY"
|
||||
android:value="${JPUSH_APPKEY}" /> <!-- 配置APP版本号 -->
|
||||
<provider
|
||||
android:name=".services.GlobalProvider"
|
||||
android:authorities="com.sucstepsoft.realtimelocation"
|
||||
android:enabled="true"
|
||||
android:exported="true" /> <!-- 配置APP渠道号 -->
|
||||
<provider
|
||||
android:name="android.support.v4.content.FileProvider"
|
||||
android:authorities="${applicationId}.provider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/provider_paths" />
|
||||
</provider> <!-- 配置Bugly调试模式(true或者false) -->
|
||||
<provider
|
||||
android:name="cn.jpush.android.service.DataProvider"
|
||||
android:authorities="${applicationId}.DataProvider"
|
||||
android:exported="false"
|
||||
android:process=":pushcore" /> <!-- Required SDK 核心功能 -->
|
||||
<!-- 可配置android:process参数将PushService放在其他进程中 -->
|
||||
<provider
|
||||
android:name="cn.jpush.android.service.DownloadProvider"
|
||||
android:authorities="${applicationId}.DownloadProvider"
|
||||
android:exported="true" /> <!-- since 3.0.9 Required SDK 核心功能 -->
|
||||
<receiver
|
||||
android:name="cn.jpush.android.service.PushReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="false">
|
||||
<intent-filter android:priority="1000">
|
||||
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY" /> <!-- Required 显示通知栏 -->
|
||||
<category android:name="${applicationId}" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.USER_PRESENT" />
|
||||
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
|
||||
</intent-filter>
|
||||
<!-- Optional -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.PACKAGE_ADDED" />
|
||||
<action android:name="android.intent.action.PACKAGE_REMOVED" />
|
||||
|
||||
<data android:scheme="package" />
|
||||
</intent-filter>
|
||||
</receiver> <!-- since 1.8.0 option 可选项。用于同一设备中不同应用的JPush服务相互拉起的功能。 -->
|
||||
<!-- 若不启用该功能可删除该组件,将不拉起其他应用也不能被其他应用拉起 -->
|
||||
<receiver
|
||||
android:name="cn.jpush.android.service.AlarmReceiver"
|
||||
android:exported="false" /> <!-- since 3.1.0 Required SDK 核心功能 -->
|
||||
<receiver
|
||||
android:name=".services.jpush.MyReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="cn.jpush.android.intent.REGISTRATION" /> <!-- Required 用户注册SDK的intent -->
|
||||
<action android:name="cn.jpush.android.intent.MESSAGE_RECEIVED" /> <!-- Required 用户接收SDK消息的intent -->
|
||||
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED" /> <!-- Required 用户接收SDK通知栏信息的intent -->
|
||||
<action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED" /> <!-- Required 用户打开自定义通知栏的intent -->
|
||||
<action android:name="cn.jpush.android.intent.CONNECTION" /> <!-- 接收网络变化 连接/断开 since 1.6.3 -->
|
||||
<category android:name="${applicationId}" />
|
||||
</intent-filter>
|
||||
</receiver> <!-- Required SDK核心功能 -->
|
||||
<receiver android:name=".services.jpush.PushMessageReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" />
|
||||
|
||||
<category android:name="${applicationId}" />
|
||||
</intent-filter>
|
||||
</receiver> <!-- Required SDK核心功能 -->
|
||||
<service
|
||||
android:name=".services.LocationService"
|
||||
android:exported="true"
|
||||
android:process=":locations">
|
||||
<intent-filter>
|
||||
<action android:name="com.sucstepsoft.realtimelocation.services.LocationService" />
|
||||
</intent-filter>
|
||||
</service> <!-- User defined. For test only 用户自定义的广播接收器 -->
|
||||
<service
|
||||
android:name=".services.MyJobService"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.BIND_JOB_SERVICE" /> <!-- User defined. For test only 用户自定义接收消息器,3.0.7开始支持,目前新tag/alias接口设置结果会在该广播接收器对应的方法中回调 -->
|
||||
<!-- since 3.3.0 接收JPush相关事件 -->
|
||||
<service
|
||||
android:name=".services.LocationHelperService"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
android:process=":helperlocation">
|
||||
<intent-filter>
|
||||
<action android:name="com.sucstepsoft.realtimelocation.services.LocationHelperService" />
|
||||
</intent-filter>
|
||||
</service> <!-- since 3.3.0 Required SDK核心功能 -->
|
||||
<service
|
||||
android:name="com.baidu.location.f"
|
||||
android:enabled="true"
|
||||
android:process=":remote" /> <!-- since 3.3.0 Required SDK 核心功能 -->
|
||||
<!-- 可配置android:process参数将PushService放在其他进程中 -->
|
||||
<!-- User defined. For test only 继承自cn.jpush.android.service.JCommonService -->
|
||||
<service
|
||||
android:name="cn.jpush.android.service.PushService"
|
||||
android:exported="false"
|
||||
android:process=":pushcore">
|
||||
<intent-filter>
|
||||
<action android:name="cn.jpush.android.intent.REGISTER" />
|
||||
<action android:name="cn.jpush.android.intent.REPORT" />
|
||||
<action android:name="cn.jpush.android.intent.PushService" />
|
||||
<action android:name="cn.jpush.android.intent.PUSH_TIME" />
|
||||
</intent-filter>
|
||||
</service> <!-- Required . Enable it you can get statistics data with channel -->
|
||||
<service
|
||||
android:name="cn.jpush.android.service.DaemonService"
|
||||
android:enabled="true"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="cn.jpush.android.intent.DaemonService" />
|
||||
|
||||
<category android:name="${applicationId}" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
<service
|
||||
android:name=".services.jpush.PushService"
|
||||
android:process=":pushcore">
|
||||
<intent-filter>
|
||||
<action android:name="cn.jiguang.user.service.action" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
</application>
|
||||
|
||||
</manifest>
|
@ -0,0 +1,9 @@
|
||||
// ILocationHelperServiceAIDL.aidl
|
||||
package com.sucstepsoft.realtimelocation;
|
||||
|
||||
// Declare any non-default types here with import statements
|
||||
|
||||
interface ILocationHelperServiceAIDL{
|
||||
|
||||
void onFinishBind(int notiId);
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
// ILocationServiceAIDL.aidl
|
||||
package com.sucstepsoft.realtimelocation;
|
||||
|
||||
// Declare any non-default types here with import statements
|
||||
|
||||
interface ILocationServiceAIDL {
|
||||
|
||||
/** 当其他服务已经绑定时调起 */
|
||||
void onFinishBind();
|
||||
|
||||
}
|
19
app/src/main/assets/locationpos.json
Normal file
19
app/src/main/assets/locationpos.json
Normal file
@ -0,0 +1,19 @@
|
||||
[{"longitude":"111.717414","latitude":"40.8093"},
|
||||
{"longitude":"111.713389","latitude":"40.808645"},
|
||||
{"longitude":"111.707353","latitude":"40.808591"},
|
||||
{"longitude":"111.698945","latitude":"40.806679"},
|
||||
{"longitude":"111.693842","latitude":"40.806079"},
|
||||
{"longitude":"111.668402","latitude":"40.798488"},
|
||||
{"longitude":"111.664162","latitude":"40.797832"},
|
||||
{"longitude":"111.661934","latitude":"40.807444"},
|
||||
{"longitude":"111.661359","latitude":"40.814269"},
|
||||
{"longitude":"111.661647","latitude":"40.818419"},
|
||||
{"longitude":"111.662294","latitude":"40.824206"},
|
||||
{"longitude":"111.675157","latitude":"40.827427"},
|
||||
{"longitude":"111.686081","latitude":"40.829556"},
|
||||
{"longitude":"111.70225","latitude":"40.834032"},
|
||||
{"longitude":"111.706275","latitude":"40.835069"},
|
||||
{"longitude":"111.715114","latitude":"40.837307"},
|
||||
{"longitude":"111.717989","latitude":"40.82972"},
|
||||
{"longitude":"111.720648","latitude":"40.82235"},
|
||||
{"longitude":"111.712742","latitude":"40.82033"}]
|
21
app/src/main/assets/news_detail/index.html
Normal file
21
app/src/main/assets/news_detail/index.html
Normal file
@ -0,0 +1,21 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="initial-scale=1.0"/>
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content">
|
||||
|
||||
</div>
|
||||
<script src="js/jquery-2.1.4.min.js"></script>
|
||||
<script>
|
||||
$(function(){
|
||||
//高度计算
|
||||
var jsonStr= android.getData();
|
||||
$('#content').append(jsonStr);
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
4
app/src/main/assets/news_detail/js/jquery-2.1.4.min.js
vendored
Normal file
4
app/src/main/assets/news_detail/js/jquery-2.1.4.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,51 @@
|
||||
package com.sucstepsoft.realtimelocation;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
|
||||
import com.sucstepsoft.realtimelocation.activitys.base.SinglePixelActivity;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
/**
|
||||
* 作者: Adam
|
||||
* 日期: 2019/6/25 - 09:21
|
||||
* 邮箱: itgaojian@163.com
|
||||
* 描述: 保活方案之一:添加一个像素的activity到前台
|
||||
*/
|
||||
public class ScreenManager {
|
||||
private Context mContext;
|
||||
private WeakReference<Activity> mActivityWref;
|
||||
public static ScreenManager gDefualt;
|
||||
|
||||
public static ScreenManager getInstance(Context pContext) {
|
||||
synchronized (ScreenManager.class) {
|
||||
if (gDefualt == null) {
|
||||
gDefualt = new ScreenManager(pContext.getApplicationContext());
|
||||
}
|
||||
return gDefualt;
|
||||
}
|
||||
}
|
||||
|
||||
private ScreenManager(Context pContext) {
|
||||
this.mContext = pContext;
|
||||
}
|
||||
|
||||
public void setActivity(Activity pActivity) {
|
||||
mActivityWref = new WeakReference<Activity>(pActivity);
|
||||
}
|
||||
|
||||
public void startActivity() {
|
||||
SinglePixelActivity.actionToSinglePixelActivity(mContext);
|
||||
}
|
||||
|
||||
public void finishActivity() {
|
||||
//结束掉SinglePixelActivity
|
||||
if (mActivityWref != null) {
|
||||
Activity activity = mActivityWref.get();
|
||||
if (activity != null) {
|
||||
activity.finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,182 @@
|
||||
package com.sucstepsoft.realtimelocation.activitys.addresslist;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.utils.LogUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.ToastUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.adapters.AddressListBaseAdapter;
|
||||
import com.sucstepsoft.realtimelocation.adapters.AddressListTitleAdapter;
|
||||
import com.sucstepsoft.realtimelocation.adapters.DeparmentListAdapter;
|
||||
import com.sucstepsoft.realtimelocation.beans.AddressListBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.AreaListBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.DepartmentBean;
|
||||
import com.sucstepsoft.realtimelocation.net.LocationApiService;
|
||||
import com.sucstepsoft.realtimelocation.utils.ExceptionHandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Dictionary;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.Scheduler;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
public class AddressListActivity extends BaseActivity {
|
||||
|
||||
// @BindView(R.id.rlv_title)
|
||||
// RecyclerView mRlvTitle;
|
||||
@BindView(R.id.rlv_content)
|
||||
RecyclerView mRlvContent;
|
||||
private Unbinder mBind;
|
||||
private List<String> mTitles = new ArrayList<>();
|
||||
private List<DepartmentBean> mBaseDatas = new ArrayList<>();
|
||||
private List<AreaListBean> mPDepartList = new ArrayList<>();
|
||||
private AddressListBaseAdapter mBaseAdapter;
|
||||
private DeparmentListAdapter mDeparmentListAdapter;
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
return R.layout.activity_address_list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
mBind = ButterKnife.bind(this);
|
||||
mTvBaseTitle.setText("通讯录");
|
||||
refreshView(STATE_LOAD_LOADING);
|
||||
|
||||
String type = getIntent().getStringExtra("type");
|
||||
if (!TextUtils.isEmpty(type)) {
|
||||
//1是N员 2是片长
|
||||
if ("1".equals(type)) {
|
||||
mBaseAdapter = new AddressListBaseAdapter(mActivity, mBaseDatas);
|
||||
mRlvContent.setLayoutManager(new LinearLayoutManager(mActivity));
|
||||
mRlvContent.setAdapter(mBaseAdapter);
|
||||
mBaseAdapter.addOnItemClickListener(bean -> {
|
||||
Intent intent = new Intent(mActivity, AddressListDetailActivity.class);
|
||||
intent.putExtra("title", bean.getName());
|
||||
intent.putExtra("pId", bean.getId());
|
||||
startActivity(intent);
|
||||
});
|
||||
//N员
|
||||
getDepartMentList();
|
||||
} else {
|
||||
//2是片长
|
||||
mDeparmentListAdapter = new DeparmentListAdapter(mActivity, mPDepartList);
|
||||
mRlvContent.setLayoutManager(new LinearLayoutManager(mActivity));
|
||||
mRlvContent.setAdapter(mDeparmentListAdapter);
|
||||
mDeparmentListAdapter.addOnItemClickListener(bean -> {
|
||||
Intent intent = new Intent(mActivity, PersonListActivity.class);
|
||||
intent.putExtra("id", bean.getDictId());
|
||||
intent.putExtra("bId", "0");
|
||||
intent.putExtra("title", bean.getDictName());
|
||||
startActivity(intent);
|
||||
});
|
||||
getPDepartMentList();
|
||||
}
|
||||
} else {
|
||||
ToastUtils.showShort("数据有误,请重试");
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取片长部门数据
|
||||
*/
|
||||
private void getPDepartMentList() {
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.getDictList("9d179f05-3ea0-48f7-853c-d3b7124b791c", UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<List<AreaListBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<AreaListBean> areaListBeans) {
|
||||
if (areaListBeans != null && areaListBeans.size() > 0) {
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
mPDepartList = areaListBeans;
|
||||
mDeparmentListAdapter.setData(mPDepartList);
|
||||
} else {
|
||||
refreshView(STATE_LOAD_EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
refreshView(STATE_LOAD_ERROR);
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取N员部门数据
|
||||
*/
|
||||
private void getDepartMentList() {
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.getDepartmentList("", UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<List<DepartmentBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<DepartmentBean> departmentBeans) {
|
||||
if (departmentBeans != null && departmentBeans.size() > 0) {
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
mBaseDatas = departmentBeans;
|
||||
mBaseAdapter.setData(mBaseDatas);
|
||||
} else {
|
||||
refreshView(STATE_LOAD_EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
refreshView(STATE_LOAD_ERROR);
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (mBind != null) {
|
||||
mBind.unbind();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,173 @@
|
||||
package com.sucstepsoft.realtimelocation.activitys.addresslist;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
import android.view.TextureView;
|
||||
import android.widget.Button;
|
||||
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.utils.ToastUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.adapters.AddressListMainAdapter;
|
||||
import com.sucstepsoft.realtimelocation.adapters.AddressListUserAdapter;
|
||||
import com.sucstepsoft.realtimelocation.beans.AddressListBean;
|
||||
import com.sucstepsoft.realtimelocation.net.LocationApiService;
|
||||
import com.sucstepsoft.realtimelocation.utils.ExceptionHandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
public class AddressListDetailActivity extends BaseActivity {
|
||||
@BindView(R.id.rlv_department)
|
||||
RecyclerView mRlvDepart;
|
||||
@BindView(R.id.rlv_users)
|
||||
RecyclerView mRlvUsers;
|
||||
private Unbinder mBind;
|
||||
private List<AddressListBean.DepartmentsBean> mDepartBeans = new ArrayList<>();
|
||||
private List<AddressListBean.UsersBean> mUserBeans = new ArrayList<>();
|
||||
private AddressListUserAdapter mUserAdapter;
|
||||
private AddressListMainAdapter mDepartmentAdapter;
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
return R.layout.activity_address_list_detail;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
mBind = ButterKnife.bind(this);
|
||||
String title = getIntent().getStringExtra("title");
|
||||
String pId = getIntent().getStringExtra("pId");
|
||||
if (TextUtils.isEmpty(title)) {
|
||||
mTvBaseTitle.setText("通讯录");
|
||||
} else {
|
||||
mTvBaseTitle.setText(title);
|
||||
}
|
||||
if (TextUtils.isEmpty(pId)) {
|
||||
ToastUtils.showShort("数据有误");
|
||||
finish();
|
||||
} else {
|
||||
refreshView(STATE_LOAD_LOADING);
|
||||
mUserAdapter = new AddressListUserAdapter(mActivity, mUserBeans);
|
||||
mRlvUsers.setLayoutManager(new LinearLayoutManager(mActivity) {
|
||||
@Override
|
||||
public boolean canScrollVertically() {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
mRlvUsers.setAdapter(mUserAdapter);
|
||||
mRlvUsers.setNestedScrollingEnabled(false);
|
||||
mUserAdapter.addOnItemClickListener(bean -> callUser(bean, Intent.ACTION_DIAL));
|
||||
|
||||
mDepartmentAdapter = new AddressListMainAdapter(mActivity, mDepartBeans);
|
||||
mRlvDepart.setLayoutManager(new LinearLayoutManager(mActivity) {
|
||||
@Override
|
||||
public boolean canScrollVertically() {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
mRlvDepart.setAdapter(mDepartmentAdapter);
|
||||
mRlvDepart.setNestedScrollingEnabled(false);
|
||||
mDepartmentAdapter.addOnItemClickListener(this::showDepartment);
|
||||
getDepartmentDetails(pId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示部门详情
|
||||
*
|
||||
* @param bean
|
||||
*/
|
||||
private void showDepartment(AddressListBean.DepartmentsBean bean) {
|
||||
Intent intent = new Intent(mActivity, AddressListDetailActivity.class);
|
||||
intent.putExtra("title", bean.getName());
|
||||
intent.putExtra("pId", bean.getId());
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拨打电话
|
||||
* Intent.ACTION_DIAL 系统界面
|
||||
* Intent.ACTION_CALL 直接拨打
|
||||
*
|
||||
* @param bean
|
||||
*/
|
||||
private void callUser(AddressListBean.UsersBean bean, String call) {
|
||||
if (bean != null) {
|
||||
if (!TextUtils.isEmpty(bean.getUserPhone())) {
|
||||
Intent mobileIntent = new Intent(call);
|
||||
Uri mobileData = Uri.parse("tel:" + bean.getUserPhone());
|
||||
mobileIntent.setData(mobileData);
|
||||
startActivity(mobileIntent);
|
||||
} else {
|
||||
ToastUtils.showShort("该人员暂未录入联系电话");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void getDepartmentDetails(String pId) {
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.getDepartmentUsers(pId, UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<AddressListBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(AddressListBean addressListBean) {
|
||||
if (addressListBean != null) {
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
boolean isEmpty = false;
|
||||
boolean isUserEmpty = false;
|
||||
if (addressListBean.getDepartments() != null && addressListBean.getDepartments().size() > 0) {
|
||||
mDepartBeans = addressListBean.getDepartments();
|
||||
mDepartmentAdapter.setData(mDepartBeans);
|
||||
} else {
|
||||
isEmpty = true;
|
||||
}
|
||||
if (addressListBean.getUsers() != null && addressListBean.getUsers().size() > 0) {
|
||||
mUserBeans = addressListBean.getUsers();
|
||||
mUserAdapter.setData(mUserBeans);
|
||||
} else {
|
||||
isUserEmpty = true;
|
||||
}
|
||||
if (isEmpty && isUserEmpty) {
|
||||
refreshView(STATE_LOAD_EMPTY);
|
||||
}
|
||||
} else {
|
||||
refreshView(STATE_LOAD_EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
ExceptionHandler.handleException(e);
|
||||
refreshView(STATE_LOAD_ERROR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package com.sucstepsoft.realtimelocation.activitys.addresslist;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
|
||||
public class AddressListMainActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.rl_next)
|
||||
RelativeLayout mRlNext;
|
||||
@BindView(R.id.rl_n_next)
|
||||
RelativeLayout mRlNNext;
|
||||
private Unbinder mBind;
|
||||
private int mUType;
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
return R.layout.activity_address_list_main;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
super.initData();
|
||||
mBind = ButterKnife.bind(this);
|
||||
mUType = getIntent().getIntExtra("uType", 2);
|
||||
mRlNext.setOnClickListener(v -> showNext(2));
|
||||
mRlNNext.setOnClickListener(v -> showNext(1));
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
mTvBaseTitle.setText("通讯录");
|
||||
}
|
||||
|
||||
private void showNext(int type) {
|
||||
Intent intent = new Intent(AddressListMainActivity.this, AddressListActivity.class);
|
||||
if (type == 2) {
|
||||
//片长
|
||||
intent.putExtra("type", "2");
|
||||
} else {
|
||||
//N员
|
||||
intent.putExtra("type", "1");
|
||||
}
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (mBind != null) {
|
||||
mBind.unbind();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,135 @@
|
||||
package com.sucstepsoft.realtimelocation.activitys.addresslist;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.utils.ToastUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.adapters.PersonAdapter;
|
||||
import com.sucstepsoft.realtimelocation.beans.AddressListBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.PersonBean;
|
||||
import com.sucstepsoft.realtimelocation.net.LocationApiService;
|
||||
import com.sucstepsoft.realtimelocation.utils.ExceptionHandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
public class PersonListActivity extends BaseActivity {
|
||||
@BindView(R.id.rlv_persons)
|
||||
RecyclerView mRlvPersons;
|
||||
private Unbinder mBind;
|
||||
PersonAdapter mPersonAdapter;
|
||||
private List<PersonBean> mPersonBeans = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
return R.layout.activity_person_list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
super.initData();
|
||||
mBind = ButterKnife.bind(this);
|
||||
String id = getIntent().getStringExtra("id");
|
||||
String bId = getIntent().getStringExtra("bId");
|
||||
String title = getIntent().getStringExtra("title");
|
||||
mTvBaseTitle.setText(title);
|
||||
if (TextUtils.isEmpty(id)) {
|
||||
ToastUtils.showShort("数据有误,请稍后重试.");
|
||||
} else {
|
||||
mPersonAdapter = new PersonAdapter(mActivity, mPersonBeans);
|
||||
mRlvPersons.setLayoutManager(new LinearLayoutManager(mActivity));
|
||||
mRlvPersons.setAdapter(mPersonAdapter);
|
||||
mPersonAdapter.addNextListener(bean -> {
|
||||
if (bean.getCommunityBossLevel() != 3) {
|
||||
Intent intent = new Intent(mActivity, PersonListActivity.class);
|
||||
intent.putExtra("id", bean.getAreaId());
|
||||
intent.putExtra("bId", bean.getCommunityBossId());
|
||||
intent.putExtra("title", bean.getAreaName());
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
mPersonAdapter.addOnCallListener(bean -> callUser(bean, Intent.ACTION_DIAL));
|
||||
getPersonList(id, bId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 拨打电话
|
||||
* Intent.ACTION_DIAL 系统界面
|
||||
* Intent.ACTION_CALL 直接拨打
|
||||
*
|
||||
* @param bean
|
||||
*/
|
||||
private void callUser(PersonBean bean, String call) {
|
||||
if (bean != null) {
|
||||
if (!TextUtils.isEmpty(bean.getCommunityBossPhone())) {
|
||||
Intent mobileIntent = new Intent(call);
|
||||
Uri mobileData = Uri.parse("tel:" + bean.getCommunityBossPhone());
|
||||
mobileIntent.setData(mobileData);
|
||||
startActivity(mobileIntent);
|
||||
} else {
|
||||
ToastUtils.showShort("该人员暂未录入联系电话");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void getPersonList(String id, String bId) {
|
||||
refreshView(STATE_LOAD_LOADING);
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.getListCommunityList(id, bId, UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<List<PersonBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<PersonBean> personBeans) {
|
||||
if (personBeans != null && personBeans.size() > 0) {
|
||||
mPersonBeans = personBeans;
|
||||
mPersonAdapter.setData(mPersonBeans);
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
} else {
|
||||
refreshView(STATE_LOAD_EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
refreshView(STATE_LOAD_ERROR);
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (mBind != null) {
|
||||
mBind.unbind();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,407 @@
|
||||
package com.sucstepsoft.realtimelocation.activitys.base;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.location.Location;
|
||||
import android.location.LocationListener;
|
||||
import android.location.LocationManager;
|
||||
import android.media.MediaRecorder;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Process;
|
||||
import android.provider.Settings;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.Editable;
|
||||
import android.text.Html;
|
||||
import android.text.Selection;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.text.method.HideReturnsTransformationMethod;
|
||||
import android.text.method.PasswordTransformationMethod;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.baidu.mapapi.model.LatLng;
|
||||
import com.google.gson.Gson;
|
||||
import com.sucstepsoft.cm_utils.constant.PathConfig;
|
||||
import com.sucstepsoft.cm_utils.constant.PermissionConstants;
|
||||
import com.sucstepsoft.cm_utils.core.network.update.CheckUpdateUtils;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.BaseUrlApi;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.utils.AppUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.EncryptUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.FileIOUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.FileUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.LogUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.PermissionUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.SPUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.TimeUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.ToastUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.UserInfoSPUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.activitys.issue.IssueRecordActivity;
|
||||
import com.sucstepsoft.realtimelocation.activitys.issue.IssueReportActivity;
|
||||
import com.sucstepsoft.realtimelocation.activitys.issue.IssueStepActivity;
|
||||
import com.sucstepsoft.realtimelocation.activitys.issue.TakePointActivity;
|
||||
import com.sucstepsoft.realtimelocation.activitys.mine.UserActivity;
|
||||
import com.sucstepsoft.realtimelocation.beans.AppTokenUser;
|
||||
import com.sucstepsoft.realtimelocation.beans.BaseUserBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.LoginUser;
|
||||
import com.sucstepsoft.realtimelocation.beans.VersionBean;
|
||||
import com.sucstepsoft.realtimelocation.net.LocationApiService;
|
||||
import com.sucstepsoft.realtimelocation.services.GlobalProvider;
|
||||
import com.sucstepsoft.realtimelocation.services.MyJobService;
|
||||
import com.sucstepsoft.realtimelocation.utils.AesUtil;
|
||||
import com.sucstepsoft.realtimelocation.utils.ExceptionHandler;
|
||||
import com.sucstepsoft.realtimelocation.utils.PointUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import cn.jpush.android.api.JPushInterface;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
/**
|
||||
* 登录页面
|
||||
*/
|
||||
public class LoginActivity extends BaseActivity {
|
||||
@BindView(R.id.et_user_phone)
|
||||
EditText mEtUserPhone;
|
||||
@BindView(R.id.et_user_pwd)
|
||||
EditText mEtUserPwd;
|
||||
@BindView(R.id.btn_confirm)
|
||||
Button mBtnConfirm;
|
||||
@BindView(R.id.tv_change_pwd)
|
||||
TextView mTvChangePwd;
|
||||
@BindView(R.id.iv_show_pwd)
|
||||
ImageView mIvShowPwd;
|
||||
@BindView(R.id.iv_clear_phone)
|
||||
ImageView mIvClosePhone;
|
||||
private Unbinder mUnbinder;
|
||||
private boolean isShowPwd = false;
|
||||
private Disposable mDisposable;
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
return R.layout.activity_login;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
mUnbinder = ButterKnife.bind(this);
|
||||
mRlTitleBar.setVisibility(View.GONE);
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
mRlNotify.setVisibility(View.GONE);
|
||||
mBtnConfirm.setOnClickListener(v -> {
|
||||
login();
|
||||
});
|
||||
mTvChangePwd.setOnClickListener(v -> ToastUtils.showShort("请联系管理员"));
|
||||
mIvShowPwd.setOnClickListener(v -> {
|
||||
Editable etext = mEtUserPwd.getText();
|
||||
Selection.setSelection(etext, etext.length());
|
||||
if (isShowPwd) {
|
||||
isShowPwd = false;
|
||||
mEtUserPwd.setTransformationMethod(PasswordTransformationMethod.getInstance());
|
||||
mIvShowPwd.setBackgroundResource(R.drawable.ic_hide_pwd);
|
||||
} else {
|
||||
isShowPwd = true;
|
||||
mIvShowPwd.setBackgroundResource(R.drawable.ic_show_pwd);
|
||||
mEtUserPwd.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
|
||||
}
|
||||
});
|
||||
setEditTextInhibitInputSpeChat(mEtUserPhone);
|
||||
setEditTextInhibitInputSpeChat(mEtUserPwd);
|
||||
mEtUserPhone.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (!TextUtils.isEmpty(s)) {
|
||||
mIvClosePhone.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mIvClosePhone.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
});
|
||||
String username = UserLgUtils.getUserName();
|
||||
String passWord = UserLgUtils.getPassword();
|
||||
if (!TextUtils.isEmpty(username)) {
|
||||
mEtUserPhone.setText(username);
|
||||
}
|
||||
if (!TextUtils.isEmpty(passWord)) {
|
||||
mEtUserPwd.setText(passWord);
|
||||
}
|
||||
mIvClosePhone.setOnClickListener(v -> mEtUserPhone.setText(""));
|
||||
requestPermission();
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录
|
||||
*/
|
||||
private void login() {
|
||||
if (checkUserInputInfo()) {
|
||||
String userName = mEtUserPhone.getText().toString().trim();
|
||||
String pwd = mEtUserPwd.getText().toString().trim();
|
||||
doLoginApp(userName, pwd);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录
|
||||
*/
|
||||
private void doLoginApp(String name, String pwd) {
|
||||
refreshLoginState(11);
|
||||
TelephonyManager manager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
|
||||
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
|
||||
ToastUtils.showShort("未授权");
|
||||
return;
|
||||
}
|
||||
String deviceId = manager.getDeviceId();
|
||||
if (TextUtils.isEmpty(deviceId)) {
|
||||
deviceId = getDeviceId();
|
||||
}
|
||||
String md5Pwd = EncryptUtils.encryptMD5ToStringTimes(pwd, 3);
|
||||
LoginUser info = new LoginUser();
|
||||
info.setAppVersion(AppUtils.getAppVersionCode());
|
||||
info.setAppId(PathConfig.APP_VERSION_ID);
|
||||
info.setPassword(md5Pwd);
|
||||
info.setUsername(name);
|
||||
info.setDeviceNo(deviceId);
|
||||
if (!UserLgUtils.getAliasIsSeting()) {
|
||||
JPushInterface.setAlias(getApplicationContext(), 65536, deviceId);
|
||||
}
|
||||
Gson gson = new Gson();
|
||||
String obj = gson.toJson(info);
|
||||
RequestBody body = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), obj);
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.doLogin(body)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseUserBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mDisposable = d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseUserBean baseUserBean) {
|
||||
refreshLoginState(12);
|
||||
if (!TextUtils.isEmpty(baseUserBean.getData())) {
|
||||
byte[] decode = Base64.decode(baseUserBean.getData(), Base64.DEFAULT);
|
||||
try {
|
||||
String loginUserInfo = AesUtil.aesCommonDecoder(PathConfig.SECRET, new String(decode, "UTF-8"));
|
||||
if (!TextUtils.isEmpty(loginUserInfo)) {
|
||||
LogUtils.e(loginUserInfo);
|
||||
AppTokenUser appTokenUser = gson.fromJson(loginUserInfo, AppTokenUser.class);
|
||||
UserLgUtils.setLoginInfo(loginUserInfo);
|
||||
UserLgUtils.setAvatar(appTokenUser.getAvatar());
|
||||
UserLgUtils.setEmail(appTokenUser.getEmail());
|
||||
UserLgUtils.setId(appTokenUser.getId());
|
||||
UserLgUtils.setName(appTokenUser.getName());
|
||||
UserLgUtils.setUserName(appTokenUser.getUsername());
|
||||
UserLgUtils.setPhone(appTokenUser.getPhone());
|
||||
UserLgUtils.setToken(baseUserBean.getData());
|
||||
GlobalProvider.save(mActivity, "token", baseUserBean.getData());
|
||||
UserLgUtils.setPassword(pwd);
|
||||
startActivity(new Intent(LoginActivity.this, MainActivity.class));
|
||||
finish();
|
||||
} else {
|
||||
ToastUtils.showShort("登录失败,请稍后重试.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
ToastUtils.showShort("登录失败,请稍后重试.");
|
||||
}
|
||||
} else {
|
||||
ToastUtils.showShort("登录失败,请稍后重试.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
e.printStackTrace();
|
||||
refreshLoginState(12);
|
||||
int i = ExceptionHandler.handleExceptionWithLogin(e);
|
||||
if (i == 40502) {
|
||||
checkPermission();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private String getDeviceId() {
|
||||
String filePath = PathConfig.IDENTITY_FILE;
|
||||
File file = new File(filePath);
|
||||
String uuid = "";
|
||||
if (!file.exists()) {
|
||||
try {
|
||||
boolean newFile = file.createNewFile();
|
||||
uuid = UUID.randomUUID().toString();
|
||||
FileIOUtils.writeFileFromString(file, uuid);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
uuid = FileIOUtils.readFile2String(file);
|
||||
}
|
||||
return uuid;
|
||||
}
|
||||
|
||||
private void checkPermission() {
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
|
||||
boolean isInstall = getPackageManager().canRequestPackageInstalls();
|
||||
if (isInstall) {
|
||||
CheckUpdateUtils.checkUpdate(LoginActivity.this,
|
||||
0,
|
||||
BaseUrlApi.APP_DOWNLOAD_URL,
|
||||
"1", "发现新版本");
|
||||
} else {
|
||||
ToastUtils.showLong("软件升级需要使用安装未知来源的权限,请授权.");
|
||||
Intent intent = new Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES);
|
||||
startActivityForResult(intent, 10086);
|
||||
}
|
||||
} else {
|
||||
CheckUpdateUtils.checkUpdate(LoginActivity.this,
|
||||
0,
|
||||
BaseUrlApi.APP_DOWNLOAD_URL,
|
||||
"1", "发现新版本");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (resultCode == RESULT_OK) {
|
||||
switch (requestCode) {
|
||||
case 10086:
|
||||
login();
|
||||
break;
|
||||
}
|
||||
}
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 权限请求
|
||||
*/
|
||||
private void requestPermission() {
|
||||
PermissionUtils.permission(
|
||||
PermissionConstants.SMS,
|
||||
PermissionConstants.LOCATION,
|
||||
PermissionConstants.CAMERA,
|
||||
PermissionConstants.STORAGE,
|
||||
PermissionConstants.MICROPHONE,
|
||||
PermissionConstants.PHONE)
|
||||
.callback(new PermissionUtils.SimpleCallback() {
|
||||
@Override
|
||||
public void onGranted() {
|
||||
File file = new File(PathConfig.CATCH_PATH);
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
File videoFile = new File(PathConfig.VIDEO_PATH);
|
||||
if (!videoFile.exists()) {
|
||||
videoFile.mkdirs();
|
||||
}
|
||||
String loginName = UserLgUtils.getUserName();
|
||||
String pwd = UserLgUtils.getPassword();
|
||||
if (!TextUtils.isEmpty(loginName) && !TextUtils.isEmpty(pwd)) {
|
||||
mEtUserPhone.setText(loginName);
|
||||
mEtUserPwd.setText(pwd);
|
||||
login();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDenied() {
|
||||
ToastUtils.showShort("未授权会导致程序无法正常运行.请前往设置进行程序的授权.");
|
||||
}
|
||||
}).request();
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验用户输入的账号密码
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private boolean checkUserInputInfo() {
|
||||
String userName = mEtUserPhone.getText().toString().trim();
|
||||
String pwd = mEtUserPwd.getText().toString().trim();
|
||||
// || !RegexUtils.isMobileExact(userName)
|
||||
if (TextUtils.isEmpty(userName)) {
|
||||
ToastUtils.showShort("账号有误,请重新输入.");
|
||||
return false;
|
||||
}
|
||||
if (TextUtils.isEmpty(pwd)) {
|
||||
ToastUtils.showShort("密码不能为空.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新登录按钮的状态
|
||||
*
|
||||
* @param state 11登录中 12登录失败或成功
|
||||
*/
|
||||
private void refreshLoginState(int state) {
|
||||
switch (state) {
|
||||
case 11://登录中
|
||||
mBtnConfirm.setEnabled(false);
|
||||
mBtnConfirm.setText("登录中...");
|
||||
break;
|
||||
case 12://登录失败后成功
|
||||
mBtnConfirm.setEnabled(true);
|
||||
mBtnConfirm.setText("登录");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (mDisposable != null && !mDisposable.isDisposed()) {
|
||||
mDisposable.dispose();
|
||||
}
|
||||
mUnbinder.unbind();
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,44 @@
|
||||
package com.sucstepsoft.realtimelocation.activitys.base;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.sucstepsoft.cm_utils.utils.LogUtils;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.ScreenManager;
|
||||
|
||||
/**
|
||||
* 保活方案之一:单像素Activity
|
||||
*/
|
||||
public class SinglePixelActivity extends AppCompatActivity {
|
||||
public static void actionToSinglePixelActivity(Context pContext) {
|
||||
Intent intent = new Intent(pContext, SinglePixelActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
pContext.startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_single_pixel);
|
||||
Window window = getWindow();
|
||||
//放在左上角
|
||||
window.setGravity(Gravity.START | Gravity.TOP);
|
||||
WindowManager.LayoutParams attributes = window.getAttributes();
|
||||
//宽高设计为1个像素
|
||||
attributes.width = 1;
|
||||
attributes.height = 1;
|
||||
//起始坐标
|
||||
attributes.x = 0;
|
||||
attributes.y = 0;
|
||||
window.setAttributes(attributes);
|
||||
ScreenManager.getInstance(this).setActivity(this);
|
||||
LogUtils.e("==一像素Activity==");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,185 @@
|
||||
package com.sucstepsoft.realtimelocation.activitys.common;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Environment;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.sucstepsoft.cm_utils.constant.PathConfig;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.download.DownloadUtils;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.listener.DownloadListener;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.core.widget.photoview.adapter.ImageAdapter;
|
||||
import com.sucstepsoft.cm_utils.utils.LogUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.ToastUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.UIUtil;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableEmitter;
|
||||
import io.reactivex.ObservableOnSubscribe;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* 相片浏览
|
||||
*/
|
||||
public class PhotoActivity extends BaseActivity {
|
||||
@BindView(R.id.vp_images)
|
||||
ViewPager mVpImages;
|
||||
@BindView(R.id.tv_count)
|
||||
TextView mTvCount;
|
||||
public static final String TAG_IMGURL = "imgUrls";
|
||||
private Unbinder mUnbinder;
|
||||
private int mPosition = 0;
|
||||
private ArrayList<String> mImgUrls;
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
return R.layout.activity_photo;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
mUnbinder = ButterKnife.bind(this);
|
||||
mTvBaseTitle.setText("图片浏览");
|
||||
mIbBack.setVisibility(View.VISIBLE);
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
mTvPublish.setText("保存");
|
||||
mTvPublish.setVisibility(View.VISIBLE);
|
||||
mTvPublish.setOnClickListener(v -> downloadImg());
|
||||
|
||||
mImgUrls = getIntent().getStringArrayListExtra(TAG_IMGURL);
|
||||
if (mImgUrls == null) {
|
||||
ToastUtils.showShort(R.string.check_imgurl);
|
||||
finish();
|
||||
} else {
|
||||
mVpImages.setAdapter(new ImageAdapter(this, mImgUrls));
|
||||
mTvCount.setText(String.format(getResources().getString(R.string.img_position), 1, mImgUrls.size()));
|
||||
mVpImages.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
mTvCount.setText(String.format(getResources().getString(R.string.img_position), ++position, mImgUrls.size()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private void downloadImg() {
|
||||
int currentItem = mVpImages.getCurrentItem();
|
||||
if (mImgUrls != null && mImgUrls.size() > 0) {
|
||||
String s = mImgUrls.get(currentItem);
|
||||
ProgressDialog dialog = UIUtil.initDialog(mActivity, "保存中...");
|
||||
dialog.show();
|
||||
Observable.create((ObservableOnSubscribe<File>) e -> {
|
||||
//通过gilde下载得到file文件,这里需要注意android.permission.INTERNET权限
|
||||
e.onNext(Glide.with(mActivity)
|
||||
.load(s)
|
||||
.downloadOnly(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
|
||||
.get());
|
||||
e.onComplete();
|
||||
}).subscribeOn(Schedulers.io())
|
||||
.observeOn(Schedulers.newThread())
|
||||
.subscribe(new Observer<File>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(File file) {
|
||||
dialog.dismiss();
|
||||
File appDir = new File(PathConfig.CATCH_PATH);
|
||||
if (!appDir.exists()) {
|
||||
appDir.mkdirs();
|
||||
}
|
||||
String fileName = System.currentTimeMillis() + ".jpg";
|
||||
File destFile = new File(appDir, fileName);
|
||||
//把gilde下载得到图片复制到定义好的目录中去
|
||||
copy(file, destFile);
|
||||
// 最后通知图库更新
|
||||
sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE,
|
||||
Uri.fromFile(new File(destFile.getPath()))));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
dialog.dismiss();
|
||||
ToastUtils.showShort("保存失败,稍后重试.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ToastUtils.showShort("图片地址有误,请稍后重试.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制文件
|
||||
*
|
||||
* @param source 输入文件
|
||||
* @param target 输出文件
|
||||
*/
|
||||
public void copy(File source, File target) {
|
||||
FileInputStream fileInputStream = null;
|
||||
FileOutputStream fileOutputStream = null;
|
||||
try {
|
||||
fileInputStream = new FileInputStream(source);
|
||||
fileOutputStream = new FileOutputStream(target);
|
||||
byte[] buffer = new byte[1024];
|
||||
while (fileInputStream.read(buffer) > 0) {
|
||||
fileOutputStream.write(buffer);
|
||||
}
|
||||
ToastUtils.showShort("保存成功,前往SD卡下locationReal文件夹下查看");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
ToastUtils.showShort("保存失败,请稍后重试");
|
||||
} finally {
|
||||
try {
|
||||
fileInputStream.close();
|
||||
fileOutputStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
mUnbinder.unbind();
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
@ -0,0 +1,178 @@
|
||||
package com.sucstepsoft.realtimelocation.activitys.issue;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
|
||||
import com.jcodecraeer.xrecyclerview.ProgressStyle;
|
||||
import com.jcodecraeer.xrecyclerview.XRecyclerView;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.utils.ToastUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.adapters.IssueSubAdapter;
|
||||
import com.sucstepsoft.realtimelocation.beans.IssueSubBean;
|
||||
import com.sucstepsoft.realtimelocation.net.LocationApiService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* 案件处理
|
||||
*/
|
||||
public class IssueCheckActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.xlv_items)
|
||||
XRecyclerView mXlvItems;
|
||||
private Unbinder mBind;
|
||||
private String mRows = "20";
|
||||
private int mCurPage = 1;
|
||||
private IssueSubAdapter mAdapter;
|
||||
private List<IssueSubBean.RowsBean> mDatas = new ArrayList<>();
|
||||
private Disposable mDisposable;
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
return R.layout.activity_issue_check;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
mBind = ButterKnife.bind(this);
|
||||
mTvBaseTitle.setText("案件处理");
|
||||
refreshView(STATE_LOAD_LOADING);
|
||||
mAdapter = new IssueSubAdapter(mActivity, mDatas, false);
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(mActivity);
|
||||
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
|
||||
mXlvItems.setLayoutManager(layoutManager);
|
||||
mXlvItems.setAdapter(mAdapter);
|
||||
mAdapter.addOnItemClickListener(bean -> showDetail(bean));
|
||||
mXlvItems.setRefreshProgressStyle(ProgressStyle.BallGridBeat);
|
||||
mXlvItems.setLoadingMoreProgressStyle(ProgressStyle.Pacman);
|
||||
mXlvItems.setPullRefreshEnabled(true);
|
||||
mXlvItems.setLoadingMoreEnabled(true);
|
||||
mXlvItems.setLoadingListener(new XRecyclerView.LoadingListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
refreshData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMore() {
|
||||
getUpcomingList(mCurPage);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void refreshData() {
|
||||
getUpcomingList(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
refreshData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取列表
|
||||
*/
|
||||
private void getUpcomingList(int page) {
|
||||
mCurPage = page;
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.getMineTransactList(mRows, page + "", UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<IssueSubBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mDisposable = d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(IssueSubBean issueSubBean) {
|
||||
if (issueSubBean != null && issueSubBean.getRows() != null && issueSubBean.getRows().size() > 0) {
|
||||
++mCurPage;
|
||||
if (page == 1) {
|
||||
mDatas.clear();
|
||||
mDatas.addAll(issueSubBean.getRows());
|
||||
} else {
|
||||
mDatas.addAll(issueSubBean.getRows());
|
||||
}
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
mXlvItems.refreshComplete();
|
||||
if (mDatas.size() >= issueSubBean.getTotal()) {
|
||||
mXlvItems.loadMoreComplete();
|
||||
mXlvItems.setNoMore(true);
|
||||
} else {
|
||||
mXlvItems.loadMoreComplete();
|
||||
mXlvItems.setNoMore(false);
|
||||
}
|
||||
} else {
|
||||
if (page > 1) {
|
||||
mXlvItems.loadMoreComplete();
|
||||
mXlvItems.setNoMore(true);
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
} else {
|
||||
//无数据
|
||||
refreshView(STATE_LOAD_EMPTY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
ToastUtils.showShort("数据加载失败,请稍后重试.");
|
||||
refreshView(STATE_LOAD_ERROR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示详细内容
|
||||
*
|
||||
* @param bean
|
||||
*/
|
||||
private void showDetail(IssueSubBean.RowsBean bean) {
|
||||
Intent intent = new Intent(mActivity, IssueDetailActivity.class);
|
||||
//待处理处理
|
||||
intent.putExtra("mine", "1");
|
||||
intent.putExtra("bean", bean);
|
||||
if (bean.getCaseStatus().equals("4")) {
|
||||
//待检查
|
||||
intent.putExtra("check", "1");
|
||||
}
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (!mDisposable.isDisposed()) {
|
||||
mDisposable.dispose();
|
||||
}
|
||||
mXlvItems.destroy();
|
||||
mXlvItems = null;
|
||||
if (mBind != null) {
|
||||
mBind.unbind();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,880 @@
|
||||
package com.sucstepsoft.realtimelocation.activitys.issue;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.MediaStore;
|
||||
import android.support.v4.content.FileProvider;
|
||||
import android.support.v7.widget.GridLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.Html;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
import android.widget.ZoomControls;
|
||||
|
||||
import com.baidu.mapapi.map.BaiduMap;
|
||||
import com.baidu.mapapi.map.BitmapDescriptor;
|
||||
import com.baidu.mapapi.map.BitmapDescriptorFactory;
|
||||
import com.baidu.mapapi.map.MapStatus;
|
||||
import com.baidu.mapapi.map.MapStatusUpdateFactory;
|
||||
import com.baidu.mapapi.map.MarkerOptions;
|
||||
import com.baidu.mapapi.map.TextureMapView;
|
||||
import com.baidu.mapapi.model.LatLng;
|
||||
import com.cjt2325.cameralibrary.videorecord.MediaManager;
|
||||
import com.google.gson.Gson;
|
||||
import com.sucstepsoft.cm_utils.constant.PathConfig;
|
||||
import com.sucstepsoft.cm_utils.core.beans.AddPhotoBean;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.BaseUrlApi;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.AddPhotoAdapter;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseShowPhotoAdapter;
|
||||
import com.sucstepsoft.cm_utils.core.widget.views.ButtomDialogView;
|
||||
import com.sucstepsoft.cm_utils.utils.LogUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.ProiderUtil;
|
||||
import com.sucstepsoft.cm_utils.utils.ToastUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.UIUtil;
|
||||
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.activitys.common.PhotoActivity;
|
||||
import com.sucstepsoft.realtimelocation.beans.BaseUserBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.IssueCheckBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.IssueDisBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.IssueSubBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.SuccessBean;
|
||||
import com.sucstepsoft.realtimelocation.net.LocationApiService;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.Scheduler;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.MultipartBody;
|
||||
import okhttp3.RequestBody;
|
||||
import top.zibin.luban.Luban;
|
||||
import top.zibin.luban.OnCompressListener;
|
||||
|
||||
/**
|
||||
* createTime:2019年8月1日 14:00:00
|
||||
* 案件详情
|
||||
*/
|
||||
public class IssueDetailActivity extends BaseActivity {
|
||||
@BindView(R.id.tmv_map)
|
||||
TextureMapView mMapView;
|
||||
@BindView(R.id.tv_up_org)
|
||||
TextView mTvUpOrg;
|
||||
@BindView(R.id.tv_state)
|
||||
TextView mTvState;
|
||||
@BindView(R.id.tv_issue_desc)
|
||||
TextView mTvIssueDesc;
|
||||
@BindView(R.id.tv_up_time)
|
||||
TextView mTvUpTime;
|
||||
@BindView(R.id.tv_type)
|
||||
TextView mTvType;
|
||||
@BindView(R.id.rlv_photos)
|
||||
RecyclerView mRlvPhotos;//显示上报案件
|
||||
@BindView(R.id.tv_issue_address)
|
||||
TextView mTvIssueAddress;
|
||||
@BindView(R.id.tv_issue_dis_title)
|
||||
TextView mTvIssueDisTitle;
|
||||
@BindView(R.id.et_issue_dis_desc)
|
||||
EditText mEtIssueDisDesc;
|
||||
@BindView(R.id.sw_issue_state)
|
||||
Switch mSwIssueState;
|
||||
@BindView(R.id.rlv_issue_dis_photo)
|
||||
RecyclerView mRlvIssueDisPhoto;//上传案件图片
|
||||
@BindView(R.id.btn_issue_dis)
|
||||
Button mBtnIssueDis;
|
||||
@BindView(R.id.ll_issue_dis)
|
||||
LinearLayout mLlIssueDis;
|
||||
@BindView(R.id.tv_up_user)
|
||||
TextView mTvUpUser;
|
||||
@BindView(R.id.tv_issue_dis_desc)
|
||||
TextView mTvIssueDisDesc;
|
||||
@BindView(R.id.rlv_dis_photo)
|
||||
RecyclerView mRlvDisPhoto;//展示案件处理的图片
|
||||
@BindView(R.id.ll_issue_dis_detail)
|
||||
LinearLayout mLlIssueDisDetail;
|
||||
@BindView(R.id.tv_issue_switch_title)
|
||||
TextView mTvSwitchTitle;
|
||||
@BindView(R.id.tv_handle_user)
|
||||
TextView mTvHandleUser;
|
||||
@BindView(R.id.tv_handle_time)
|
||||
TextView mTvHandleTime;
|
||||
@BindView(R.id.btn_reload)
|
||||
Button mBtnReload;
|
||||
@BindView(R.id.rl_accept)
|
||||
RelativeLayout mRlAccept;
|
||||
@BindView(R.id.ll_voice)
|
||||
LinearLayout mLlVoice;
|
||||
@BindView(R.id.tv_voice_anim)
|
||||
TextView mTvVoiceAnim;
|
||||
private Unbinder mBind;
|
||||
private IssueSubBean.RowsBean mRowsBean;
|
||||
private List<AddPhotoBean> mPhotos = new ArrayList<>();
|
||||
private AddPhotoBean mCurrentBean;
|
||||
private String mPicPath;
|
||||
private AddPhotoAdapter mPhotoAdapter;
|
||||
private String mPhotoIds = "";//相片Id
|
||||
private boolean isAccept = true;
|
||||
private String mCheck;
|
||||
private boolean isSelf = false;//是否是自处理
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
return R.layout.activity_issue_detail;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
mBind = ButterKnife.bind(this);
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
mTvBaseTitle.setText("上报详情");
|
||||
mTvPublish.setVisibility(View.VISIBLE);
|
||||
mTvPublish.setText("流程");
|
||||
mRowsBean = (IssueSubBean.RowsBean) getIntent().getSerializableExtra("bean");
|
||||
getDetail(mRowsBean);
|
||||
String mine = getIntent().getStringExtra("mine");
|
||||
mCheck = getIntent().getStringExtra("check");
|
||||
if (TextUtils.isEmpty(mCheck)) {
|
||||
mLlIssueDisDetail.setVisibility(View.GONE);
|
||||
} else {
|
||||
mLlIssueDisDetail.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (!TextUtils.isEmpty(mine)) {
|
||||
mLlIssueDis.setVisibility(View.VISIBLE);
|
||||
initDisView();
|
||||
} else {
|
||||
mLlIssueDis.setVisibility(View.GONE);
|
||||
}
|
||||
setDetailDataToView();
|
||||
mTvPublish.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(IssueDetailActivity.this, IssueStepActivity.class);
|
||||
intent.putExtra("caseId", mRowsBean.getReportCaseId());
|
||||
startActivity(intent);
|
||||
});
|
||||
View child = mMapView.getChildAt(1);
|
||||
if (child != null && (child instanceof ImageView || child instanceof ZoomControls)) {
|
||||
child.setVisibility(View.GONE);
|
||||
}
|
||||
mMapView.showZoomControls(false);
|
||||
setEditTextInhibitInputSpeChat(mEtIssueDisDesc);
|
||||
}
|
||||
|
||||
private void getDetail(IssueSubBean.RowsBean rowsBean) {
|
||||
if (rowsBean != null) {
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.getIssueDetail(rowsBean.getReportCaseId(), UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<Object>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(Object o) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化案件处理视图
|
||||
*/
|
||||
private void initDisView() {
|
||||
mPhotos.add(new AddPhotoBean());
|
||||
//删除上传的相片
|
||||
mPhotoAdapter = new AddPhotoAdapter(mActivity, mPhotos);
|
||||
mRlvIssueDisPhoto.setLayoutManager(new GridLayoutManager(mActivity, 4));
|
||||
mRlvIssueDisPhoto.setAdapter(mPhotoAdapter);
|
||||
mPhotoAdapter.addOnDeleteListener(((bean, i) -> {
|
||||
mPhotoAdapter.removeItem(bean);
|
||||
mPhotoIds = mPhotoIds.replace(bean.getId() + ",", "");
|
||||
}));
|
||||
mPhotoAdapter.addOnItemClickListener(bean -> {
|
||||
if (TextUtils.isEmpty(bean.getPath())) {
|
||||
//空数据
|
||||
showSelectPhoto(bean);
|
||||
} else {
|
||||
//预览
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
list.add(bean.getPath());
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(PhotoActivity.TAG_IMGURL, list);
|
||||
intent.setClass(IssueDetailActivity.this, PhotoActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
//检查
|
||||
if (!TextUtils.isEmpty(mCheck)) {
|
||||
mLlIssueDisDetail.setVisibility(View.VISIBLE);
|
||||
mTvSwitchTitle.setText("是否合格");
|
||||
mEtIssueDisDesc.setHint("请输入评价内容");
|
||||
mTvIssueDisTitle.setText(Html.fromHtml(getResources().getString(R.string.tip_issue_start_check)));
|
||||
} else {
|
||||
mLlIssueDisDetail.setVisibility(View.GONE);
|
||||
mTvSwitchTitle.setText("处理状态");
|
||||
mEtIssueDisDesc.setHint("请输入处理描述内容");
|
||||
mTvIssueDisTitle.setText(Html.fromHtml(getResources().getString(R.string.tip_issue_start_dis)));
|
||||
}
|
||||
//选择是否接受 选择是否合格
|
||||
mSwIssueState.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
isAccept = isChecked;
|
||||
if (TextUtils.isEmpty(mCheck)) {
|
||||
if (isChecked) {
|
||||
// mRlvIssueDisPhoto.setVisibility(View.VISIBLE);
|
||||
mEtIssueDisDesc.setHint("请输入处理描述内容");
|
||||
} else {
|
||||
// mRlvIssueDisPhoto.setVisibility(View.GONE);
|
||||
mEtIssueDisDesc.setHint("请输入不处理的原因");
|
||||
}
|
||||
} else {
|
||||
mRlvIssueDisPhoto.setVisibility(View.VISIBLE);
|
||||
mEtIssueDisDesc.setHint("请输入评价内容");
|
||||
}
|
||||
});
|
||||
mBtnIssueDis.setOnClickListener(v -> doDisportIssue());
|
||||
}
|
||||
|
||||
private void doDisportIssue() {
|
||||
if (TextUtils.isEmpty(mCheck)) {
|
||||
if (checkParams()) {
|
||||
doDis();
|
||||
}
|
||||
} else {
|
||||
doCheck();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查案件
|
||||
*/
|
||||
private void doCheck() {
|
||||
if (checkInspectParams()) {
|
||||
ProgressDialog dialog = UIUtil.initDialog(mActivity, "上报中...");
|
||||
dialog.show();
|
||||
IssueCheckBean issueDisBean = buildCheckParams();
|
||||
Gson gson = new Gson();
|
||||
String obj = gson.toJson(issueDisBean);
|
||||
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), obj);
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.saveIssueInspect(mRowsBean.getReportCaseId(), body, UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<SuccessBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(SuccessBean successBean) {
|
||||
if (dialog != null && dialog.isShowing()) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
ToastUtils.showShort("处理成功");
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
e.printStackTrace();
|
||||
if (dialog != null && dialog.isShowing()) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
ToastUtils.showShort("处理失败,请稍后重试");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private IssueCheckBean buildCheckParams() {
|
||||
IssueCheckBean bean = new IssueCheckBean();
|
||||
String desc = mEtIssueDisDesc.getText().toString().trim();
|
||||
//处理
|
||||
String ids = "";
|
||||
for (int i = 0; i < mPhotoAdapter.getData().size(); i++) {
|
||||
if (!TextUtils.isEmpty(mPhotoAdapter.getData().get(i).getId())) {
|
||||
ids += mPhotoAdapter.getData().get(i).getId() + ",";
|
||||
}
|
||||
}
|
||||
bean.setInspectPhotos(ids);
|
||||
bean.setInspectOpinion(desc);
|
||||
if (isAccept) {
|
||||
bean.setIsPass(1);
|
||||
} else {
|
||||
bean.setIsPass(0);
|
||||
}
|
||||
return bean;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验检查参数
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private boolean checkInspectParams() {
|
||||
if (mPhotoAdapter.getData() == null || mPhotoAdapter.getData().size() <= 1) {
|
||||
ToastUtils.showShort("请上传现场照片.");
|
||||
return false;
|
||||
}
|
||||
String desc = mEtIssueDisDesc.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(desc)) {
|
||||
ToastUtils.showShort("请输入检查描述内容.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理案件
|
||||
*/
|
||||
private void doDis() {
|
||||
ProgressDialog dialog = UIUtil.initDialog(mActivity, "上报中...");
|
||||
dialog.show();
|
||||
IssueDisBean issueDisBean = buildParasm();
|
||||
Gson gson = new Gson();
|
||||
String obj = gson.toJson(issueDisBean);
|
||||
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), obj);
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.saveIssueDis(mRowsBean.getReportCaseId(), body, UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<SuccessBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(SuccessBean successBean) {
|
||||
if (isSelf) {
|
||||
if (isAccept) {
|
||||
doCheckSelf(dialog);
|
||||
} else {
|
||||
if (dialog != null && dialog.isShowing()) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
ToastUtils.showShort("处理成功");
|
||||
finish();
|
||||
}
|
||||
} else {
|
||||
if (dialog != null && dialog.isShowing()) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
ToastUtils.showShort("处理成功");
|
||||
finish();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
e.printStackTrace();
|
||||
if (dialog != null && dialog.isShowing()) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
ToastUtils.showShort("处理失败,请稍后重试.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private IssueDisBean buildParasm() {
|
||||
IssueDisBean bean = new IssueDisBean();
|
||||
String desc = mEtIssueDisDesc.getText().toString().trim();
|
||||
String ids = "";
|
||||
for (int i = 0; i < mPhotoAdapter.getData().size(); i++) {
|
||||
if (!TextUtils.isEmpty(mPhotoAdapter.getData().get(i).getId())) {
|
||||
ids += mPhotoAdapter.getData().get(i).getId() + ",";
|
||||
}
|
||||
}
|
||||
bean.setHandlePhotos(ids);
|
||||
bean.setHandleOpinion(desc);
|
||||
if (isAccept) {
|
||||
//处理
|
||||
bean.setHandleStatus(1);
|
||||
} else {
|
||||
//不处理
|
||||
bean.setHandleStatus(0);
|
||||
}
|
||||
return bean;
|
||||
}
|
||||
|
||||
private boolean checkParams() {
|
||||
if (isAccept) {
|
||||
String desc = mEtIssueDisDesc.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(desc)) {
|
||||
ToastUtils.showShort("请输入处理描述内容.");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
//不接受
|
||||
String desc = mEtIssueDisDesc.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(desc)) {
|
||||
ToastUtils.showShort("请输入不处理的原因.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//接受
|
||||
if (mPhotoAdapter.getData() == null || mPhotoAdapter.getData().size() <= 1) {
|
||||
ToastUtils.showShort("请上传处理现场照片.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查 自处理
|
||||
*
|
||||
* @param dialog
|
||||
*/
|
||||
private void doCheckSelf(ProgressDialog dialog) {
|
||||
IssueCheckBean issueDisBean = new IssueCheckBean();
|
||||
if (isAccept) {
|
||||
issueDisBean.setIsPass(1);
|
||||
} else {
|
||||
issueDisBean.setIsPass(0);
|
||||
}
|
||||
String ids = "";
|
||||
for (int i = 0; i < mPhotoAdapter.getData().size(); i++) {
|
||||
if (!TextUtils.isEmpty(mPhotoAdapter.getData().get(i).getId())) {
|
||||
ids += mPhotoAdapter.getData().get(i).getId() + ",";
|
||||
}
|
||||
}
|
||||
issueDisBean.setInspectPhotos(ids);
|
||||
issueDisBean.setInspectOpinion("自动检查(自处理)");
|
||||
Gson gson = new Gson();
|
||||
String obj = gson.toJson(issueDisBean);
|
||||
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), obj);
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.saveIssueInspect(mRowsBean.getReportCaseId(), body, UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<SuccessBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(SuccessBean successBean) {
|
||||
if (dialog != null && dialog.isShowing()) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
ToastUtils.showShort("处理成功");
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
e.printStackTrace();
|
||||
if (dialog != null && dialog.isShowing()) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
ToastUtils.showShort("处理失败,请稍后重试");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setDetailDataToView() {
|
||||
if (mRowsBean != null) {
|
||||
//区域
|
||||
if (0 == mRowsBean.getIsSelf()) {
|
||||
isSelf = false;
|
||||
//mRlAccept.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
isSelf = true;
|
||||
/*自处理是否需要将选择处理选择去除*/
|
||||
//isAccept = true;
|
||||
//mRlAccept.setVisibility(View.GONE);
|
||||
}
|
||||
mTvUpOrg.setText(mRowsBean.getCommunityName());
|
||||
//状态
|
||||
//描述
|
||||
mTvIssueDesc.setText(mRowsBean.getCaseContent());
|
||||
//上报时间
|
||||
mTvUpTime.setText("上报时间:" + mRowsBean.getReportDate());
|
||||
//类型
|
||||
mTvType.setText("上报类型:" + mRowsBean.getCaseTypeName());
|
||||
//上报人
|
||||
mTvUpUser.setText("上报人员:" + mRowsBean.getCaseReporter());
|
||||
if (!TextUtils.isEmpty(mRowsBean.getCaseAudio())) {
|
||||
mLlVoice.setVisibility(View.VISIBLE);
|
||||
mLlVoice.setOnClickListener(v -> playVoice(mRowsBean.getCaseAudio()));
|
||||
} else {
|
||||
mLlVoice.setVisibility(View.GONE);
|
||||
}
|
||||
if (!TextUtils.isEmpty(mRowsBean.getCaseStatus())) {
|
||||
switch (mRowsBean.getCaseStatus()) {
|
||||
case "0"://待受理
|
||||
mTvState.setText("待受理");
|
||||
mTvState.setTextColor(Color.parseColor("#DE0E0E"));
|
||||
mTvState.setBackgroundResource(R.drawable.shp_status_red);
|
||||
break;
|
||||
case "1":
|
||||
mTvState.setText("待立案");
|
||||
mTvState.setTextColor(Color.parseColor("#DE0E0E"));
|
||||
mTvState.setBackgroundResource(R.drawable.shp_status_red);
|
||||
break;
|
||||
case "2":
|
||||
mTvState.setText("待下派");
|
||||
mTvState.setTextColor(Color.parseColor("#FFAE3B"));
|
||||
mTvState.setBackgroundResource(R.drawable.shp_status_yellow);
|
||||
break;
|
||||
case "3":
|
||||
mTvState.setText("待处理");
|
||||
mTvState.setTextColor(Color.parseColor("#DE0E0E"));
|
||||
mTvState.setBackgroundResource(R.drawable.shp_status_red);
|
||||
break;
|
||||
case "4":
|
||||
mTvState.setText("待检查");
|
||||
mTvState.setTextColor(Color.parseColor("#1189FF"));
|
||||
mTvState.setBackgroundResource(R.drawable.shp_status_blue);
|
||||
break;
|
||||
case "5":
|
||||
mTvState.setText("待结案");
|
||||
mTvState.setTextColor(Color.parseColor("#0EC843"));
|
||||
mTvState.setBackgroundResource(R.drawable.shp_status_green);
|
||||
break;
|
||||
case "6":
|
||||
mTvState.setText("已归档");
|
||||
mTvState.setTextColor(Color.parseColor("#D8D8D8"));
|
||||
mTvState.setBackgroundResource(R.drawable.shp_status_gray);
|
||||
break;
|
||||
default:
|
||||
mTvState.setText("异常");
|
||||
mTvState.setTextColor(Color.parseColor("#DE0E0E"));
|
||||
mTvState.setBackgroundResource(R.drawable.shp_status_red);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
mTvState.setText("异常");
|
||||
mTvState.setTextColor(Color.parseColor("#DE0E0E"));
|
||||
mTvState.setBackgroundResource(R.drawable.shp_status_red);
|
||||
}
|
||||
mTvIssueAddress.setText(mRowsBean.getCasePosition());
|
||||
String caseLongitude = mRowsBean.getCaseLongitude();
|
||||
String caseLatitude = mRowsBean.getCaseLatitude();
|
||||
if (!TextUtils.isEmpty(caseLatitude) && !TextUtils.isEmpty(caseLongitude)) {
|
||||
Double l = Double.parseDouble(caseLongitude);
|
||||
Double a = Double.parseDouble(caseLatitude);
|
||||
BaiduMap map = mMapView.getMap();
|
||||
BitmapDescriptor mapIcon = BitmapDescriptorFactory.fromResource(R.drawable.ic_map_marker);
|
||||
MapStatus ms = new MapStatus.Builder().zoom(14).target(new LatLng(a, l)).build();
|
||||
map.animateMapStatus(MapStatusUpdateFactory.newMapStatus(ms));
|
||||
MarkerOptions markerOptions = new MarkerOptions()
|
||||
.position(new LatLng(a, l))//mark出现的位置
|
||||
.icon(mapIcon) //mark图标
|
||||
.draggable(false)//mark可拖拽
|
||||
.animateType(MarkerOptions.MarkerAnimateType.none);
|
||||
map.addOverlay(markerOptions);
|
||||
mBtnReload.setOnClickListener(v -> map.animateMapStatus(MapStatusUpdateFactory.newMapStatus(ms)));
|
||||
}
|
||||
if (!TextUtils.isEmpty(mRowsBean.getCasePhotos())) {
|
||||
mRlvPhotos.setVisibility(View.VISIBLE);
|
||||
List<String> photos = new ArrayList<>();
|
||||
String[] split = mRowsBean.getCasePhotos().split(",");
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
if (!TextUtils.isEmpty(split[i])) {
|
||||
photos.add(BaseUrlApi.BASE_IMG_URL + split[i]);
|
||||
}
|
||||
}
|
||||
BaseShowPhotoAdapter adapter = new BaseShowPhotoAdapter(mActivity, photos);
|
||||
GridLayoutManager manager = new GridLayoutManager(mActivity, 4) {
|
||||
@Override
|
||||
public boolean canScrollVertically() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
mRlvPhotos.setLayoutManager(manager);
|
||||
mRlvPhotos.setAdapter(adapter);
|
||||
adapter.addOnItemClickListener(url -> {
|
||||
Intent intent = new Intent(IssueDetailActivity.this, PhotoActivity.class);
|
||||
intent.putExtra("imgUrls", new ArrayList<>(adapter.getData()));
|
||||
startActivity(intent);
|
||||
});
|
||||
} else {
|
||||
mRlvPhotos.setVisibility(View.GONE);
|
||||
}
|
||||
//TODO 填充处理数据
|
||||
if (!TextUtils.isEmpty(mCheck)) {
|
||||
mTvHandleTime.setText("处理时间:" + mRowsBean.getHandleDate());
|
||||
mTvHandleUser.setText("处理人:" + mRowsBean.getHandleUserName());
|
||||
mTvIssueDisDesc.setText(mRowsBean.getHandleOpinion());
|
||||
if (TextUtils.isEmpty(mRowsBean.getHandlePhotos())) {
|
||||
mRlvDisPhoto.setVisibility(View.GONE);
|
||||
} else {
|
||||
mRlvDisPhoto.setVisibility(View.VISIBLE);
|
||||
List<String> photos = new ArrayList<>();
|
||||
String[] split = mRowsBean.getHandlePhotos().split(",");
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
if (!TextUtils.isEmpty(split[i])) {
|
||||
photos.add(BaseUrlApi.BASE_IMG_URL + split[i]);
|
||||
}
|
||||
}
|
||||
BaseShowPhotoAdapter adapter = new BaseShowPhotoAdapter(mActivity, photos);
|
||||
GridLayoutManager manager = new GridLayoutManager(mActivity, 4) {
|
||||
@Override
|
||||
public boolean canScrollVertically() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
mRlvDisPhoto.setLayoutManager(manager);
|
||||
mRlvDisPhoto.setAdapter(adapter);
|
||||
adapter.addOnItemClickListener(url -> {
|
||||
Intent intent = new Intent(IssueDetailActivity.this, PhotoActivity.class);
|
||||
intent.putExtra("imgUrls", new ArrayList<>(adapter.getData()));
|
||||
startActivity(intent);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 播放案件录音
|
||||
*
|
||||
* @param caseAudio
|
||||
*/
|
||||
private void playVoice(String caseAudio) {
|
||||
AnimationDrawable animationDrawable = (AnimationDrawable) mTvVoiceAnim.getBackground();
|
||||
animationDrawable.start();
|
||||
MediaManager.playSound(BaseUrlApi.BASE_IMG_URL + caseAudio,
|
||||
mp -> {
|
||||
animationDrawable.selectDrawable(0);//显示动画第一帧
|
||||
animationDrawable.stop();
|
||||
MediaManager.destroy();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示选择图片
|
||||
*
|
||||
* @param bean
|
||||
*/
|
||||
private void showSelectPhoto(AddPhotoBean bean) {
|
||||
ButtomDialogView buttomDialogView = new ButtomDialogView.DialogBuilder(mActivity)
|
||||
.setIsBackCancelable(true)
|
||||
.setIscancelable(true)
|
||||
.setShowLocation(Gravity.BOTTOM)
|
||||
.setIsShowFile(false)
|
||||
.build();
|
||||
buttomDialogView.addOnChoseListener(new ButtomDialogView.OnChoseListener() {
|
||||
@Override
|
||||
public void choseFile() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void choseAlbum() {
|
||||
mCurrentBean = bean;
|
||||
Intent intent = new Intent(Intent.ACTION_PICK, null);
|
||||
intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
|
||||
"image/*");
|
||||
startActivityForResult(intent, BaseUrlApi.PHOTO_REQUEST);
|
||||
buttomDialogView.dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void choseShoot() {
|
||||
mCurrentBean = bean;
|
||||
mPicPath = PathConfig.CATCH_PATH + System.currentTimeMillis() + ".jpg";
|
||||
File file = new File(mPicPath);
|
||||
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
// 下面这句指定调用相机拍照后的照片存储的路径
|
||||
Uri uri;
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
|
||||
uri = Uri.fromFile(file);
|
||||
} else {
|
||||
uri = FileProvider.getUriForFile(mActivity, ProiderUtil.getFileProviderName(mActivity), file);
|
||||
}
|
||||
intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
|
||||
startActivityForResult(intent, BaseUrlApi.CAMERA_REQUEST);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loginOut() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changePwd() {
|
||||
|
||||
}
|
||||
});
|
||||
buttomDialogView.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (resultCode == RESULT_OK) {
|
||||
switch (requestCode) {
|
||||
case BaseUrlApi.CAMERA_REQUEST://相机
|
||||
uploadImg(mPicPath, 1);
|
||||
break;
|
||||
case BaseUrlApi.PHOTO_REQUEST://相册
|
||||
try {
|
||||
if (data == null) return;
|
||||
Uri uri = data.getData();
|
||||
String[] proj = {MediaStore.Images.Media.DATA};
|
||||
Cursor cursor = managedQuery(uri, proj, null, null, null);
|
||||
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
|
||||
cursor.moveToFirst();
|
||||
String srcPath = cursor.getString(column_index);
|
||||
uploadImg(srcPath, 2);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param picPath
|
||||
*/
|
||||
private void uploadImg(String picPath, int src) {
|
||||
File file = new File(picPath);
|
||||
if (!file.exists()) {
|
||||
showToast("图片路径错误.");
|
||||
return;
|
||||
}
|
||||
ProgressDialog progressDialog = UIUtil.initDialog(mActivity, "正在上传...");
|
||||
progressDialog.show();
|
||||
Luban.with(mActivity)
|
||||
.load(picPath)
|
||||
.ignoreBy(100)
|
||||
.setTargetDir(PathConfig.CATCH_PATH)
|
||||
.filter(path -> !(TextUtils.isEmpty(path) || path.toLowerCase().endsWith(".gif")))
|
||||
.setCompressListener(new OnCompressListener() {
|
||||
@Override
|
||||
public void onStart() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(File file) {
|
||||
RequestBody requestFile = RequestBody.create(MediaType.parse("multipart/form-data"), file);
|
||||
MultipartBody.Part body = MultipartBody.Part.createFormData("image", file.getName(), requestFile);
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.uploadImage(body, UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseUserBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseUserBean baseUserBean) {
|
||||
if (progressDialog != null && progressDialog.isShowing()) {
|
||||
progressDialog.dismiss();
|
||||
}
|
||||
ToastUtils.showShort("上传成功");
|
||||
mPhotoIds += (baseUserBean.getData() + ",");
|
||||
mCurrentBean.setId(baseUserBean.getData());
|
||||
mCurrentBean.setPath(picPath);
|
||||
if (mPhotos.size() < 4) {
|
||||
mPhotos.add(new AddPhotoBean());
|
||||
}
|
||||
mPhotoAdapter.notifyDataSetChanged();
|
||||
mCurrentBean = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
if (progressDialog != null && progressDialog.isShowing()) {
|
||||
progressDialog.dismiss();
|
||||
}
|
||||
ToastUtils.showShort("上传失败,请稍后重试.");
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
if (progressDialog.isShowing()) {
|
||||
progressDialog.dismiss();
|
||||
}
|
||||
ToastUtils.showShort("图片上传失败,请稍后重试");
|
||||
}
|
||||
})
|
||||
.launch();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
mMapView.onDestroy();
|
||||
if (mBind != null) {
|
||||
mBind.unbind();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,171 @@
|
||||
package com.sucstepsoft.realtimelocation.activitys.issue;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.widget.Button;
|
||||
|
||||
import com.jcodecraeer.xrecyclerview.ProgressStyle;
|
||||
import com.jcodecraeer.xrecyclerview.XRecyclerView;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.utils.ToastUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.adapters.IssueSubAdapter;
|
||||
import com.sucstepsoft.realtimelocation.beans.IssueSubBean;
|
||||
import com.sucstepsoft.realtimelocation.net.LocationApiService;
|
||||
import com.sucstepsoft.realtimelocation.utils.ExceptionHandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* 我的案件
|
||||
*/
|
||||
public class IssueMineActivity extends BaseActivity {
|
||||
@BindView(R.id.xlv_items)
|
||||
XRecyclerView mXlvIssueMine;
|
||||
private String mRows = "20";
|
||||
private int mCurPage = 1;
|
||||
private IssueSubAdapter mAdapter;
|
||||
private List<IssueSubBean.RowsBean> mDatas = new ArrayList<>();
|
||||
private Disposable mDisposable;
|
||||
private Unbinder mBind;
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
return R.layout.activity_issue_mine;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
mBind = ButterKnife.bind(this);
|
||||
mTvBaseTitle.setText("我的案件");
|
||||
refreshView(STATE_LOAD_LOADING);
|
||||
mAdapter = new IssueSubAdapter(mActivity, mDatas, true);
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(mActivity);
|
||||
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
|
||||
mXlvIssueMine.setLayoutManager(layoutManager);
|
||||
mXlvIssueMine.setAdapter(mAdapter);
|
||||
mAdapter.addOnItemClickListener(this::showDetail);
|
||||
mXlvIssueMine.setRefreshProgressStyle(ProgressStyle.Pacman);
|
||||
mXlvIssueMine.setLoadingMoreProgressStyle(ProgressStyle.Pacman);
|
||||
mXlvIssueMine.setPullRefreshEnabled(true);
|
||||
mXlvIssueMine.setLoadingMoreEnabled(true);
|
||||
mXlvIssueMine.setLoadingListener(new XRecyclerView.LoadingListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
refreshData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMore() {
|
||||
getMineDisList(mCurPage);
|
||||
}
|
||||
});
|
||||
getMineDisList(1);
|
||||
}
|
||||
|
||||
private void refreshData() {
|
||||
getMineDisList(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
refreshData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示详细内容
|
||||
*
|
||||
* @param bean
|
||||
*/
|
||||
private void showDetail(IssueSubBean.RowsBean bean) {
|
||||
Intent intent = new Intent(mActivity, IssueDetailActivity.class);
|
||||
intent.putExtra("bean", bean);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
private void getMineDisList(int page) {
|
||||
mCurPage = page;
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.getMineIssueList(mRows, page + "", UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<IssueSubBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mDisposable = d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(IssueSubBean issueSubBean) {
|
||||
if (issueSubBean != null && issueSubBean.getRows() != null && issueSubBean.getRows().size() > 0) {
|
||||
++mCurPage;
|
||||
if (page == 1) {
|
||||
mDatas.clear();
|
||||
mDatas.addAll(issueSubBean.getRows());
|
||||
} else {
|
||||
mDatas.addAll(issueSubBean.getRows());
|
||||
}
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
mXlvIssueMine.refreshComplete();
|
||||
if (mDatas.size() >= issueSubBean.getTotal()) {
|
||||
mXlvIssueMine.loadMoreComplete();
|
||||
mXlvIssueMine.setNoMore(true);
|
||||
} else {
|
||||
mXlvIssueMine.loadMoreComplete();
|
||||
mXlvIssueMine.setNoMore(false);
|
||||
}
|
||||
} else {
|
||||
if (page > 1) {
|
||||
mXlvIssueMine.loadMoreComplete();
|
||||
mXlvIssueMine.setNoMore(true);
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
} else {
|
||||
//无数据
|
||||
refreshView(STATE_LOAD_EMPTY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
refreshView(STATE_LOAD_ERROR);
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (mDisposable != null && !mDisposable.isDisposed()) {
|
||||
mDisposable.dispose();
|
||||
}
|
||||
mXlvIssueMine.destroy();
|
||||
mXlvIssueMine = null;
|
||||
if (mBind != null) {
|
||||
mBind.unbind();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
@ -0,0 +1,168 @@
|
||||
package com.sucstepsoft.realtimelocation.activitys.issue;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
|
||||
import com.jcodecraeer.xrecyclerview.ProgressStyle;
|
||||
import com.jcodecraeer.xrecyclerview.XRecyclerView;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.utils.ToastUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.adapters.IssueSubAdapter;
|
||||
import com.sucstepsoft.realtimelocation.beans.IssueSubBean;
|
||||
import com.sucstepsoft.realtimelocation.net.LocationApiService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
public class IssueMineDisActivity extends BaseActivity {
|
||||
|
||||
|
||||
@BindView(R.id.xlv_issue_mine)
|
||||
XRecyclerView mXlvIssueMine;
|
||||
private Unbinder mBind;
|
||||
private String mRows = "20";
|
||||
private int mCurPage = 1;
|
||||
private IssueSubAdapter mAdapter;
|
||||
private List<IssueSubBean.RowsBean> mDatas = new ArrayList<>();
|
||||
private Disposable mDisposable;
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
return R.layout.activity_issue_mine_dis;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
mBind = ButterKnife.bind(this);
|
||||
mTvBaseTitle.setText("案件处理");
|
||||
refreshView(STATE_LOAD_LOADING);
|
||||
mAdapter = new IssueSubAdapter(mActivity, mDatas,false);
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(mActivity);
|
||||
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
|
||||
mXlvIssueMine.setLayoutManager(layoutManager);
|
||||
mXlvIssueMine.setAdapter(mAdapter);
|
||||
mAdapter.addOnItemClickListener(bean -> showDetail(bean));
|
||||
mXlvIssueMine.setRefreshProgressStyle(ProgressStyle.BallGridBeat);
|
||||
mXlvIssueMine.setLoadingMoreProgressStyle(ProgressStyle.Pacman);
|
||||
mXlvIssueMine.setPullRefreshEnabled(true);
|
||||
mXlvIssueMine.setLoadingMoreEnabled(true);
|
||||
mXlvIssueMine.setLoadingListener(new XRecyclerView.LoadingListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
refreshData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMore() {
|
||||
getMineDisList(mCurPage);
|
||||
}
|
||||
});
|
||||
getMineDisList(1);
|
||||
}
|
||||
|
||||
private void refreshData() {
|
||||
getMineDisList(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
refreshData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示详细内容
|
||||
*
|
||||
* @param bean
|
||||
*/
|
||||
private void showDetail(IssueSubBean.RowsBean bean) {
|
||||
Intent intent = new Intent(IssueMineDisActivity.this, IssueDetailActivity.class);
|
||||
intent.putExtra("mine", "1");
|
||||
intent.putExtra("bean", bean);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
private void getMineDisList(int page) {
|
||||
mCurPage = page;
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.getMineIssueDisList(mRows, page + "", UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<IssueSubBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mDisposable = d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(IssueSubBean issueSubBean) {
|
||||
if (issueSubBean != null && issueSubBean.getRows() != null && issueSubBean.getRows().size() > 0) {
|
||||
++mCurPage;
|
||||
if (page == 1) {
|
||||
mDatas.clear();
|
||||
mDatas.addAll(issueSubBean.getRows());
|
||||
} else {
|
||||
mDatas.addAll(issueSubBean.getRows());
|
||||
}
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
mXlvIssueMine.refreshComplete();
|
||||
if (mDatas.size() >= issueSubBean.getTotal()) {
|
||||
mXlvIssueMine.loadMoreComplete();
|
||||
mXlvIssueMine.setNoMore(true);
|
||||
} else {
|
||||
mXlvIssueMine.loadMoreComplete();
|
||||
mXlvIssueMine.setNoMore(false);
|
||||
}
|
||||
} else {
|
||||
if (page > 1) {
|
||||
mXlvIssueMine.loadMoreComplete();
|
||||
mXlvIssueMine.setNoMore(true);
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
} else {
|
||||
//无数据
|
||||
refreshView(STATE_LOAD_EMPTY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
ToastUtils.showShort("数据加载失败,请稍后重试");
|
||||
refreshView(STATE_LOAD_ERROR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (!mDisposable.isDisposed()) {
|
||||
mDisposable.dispose();
|
||||
}
|
||||
mXlvIssueMine.destroy();
|
||||
mXlvIssueMine = null;
|
||||
if (mBind != null) {
|
||||
mBind.unbind();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
package com.sucstepsoft.realtimelocation.activitys.issue;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentStatePagerAdapter;
|
||||
import android.support.v4.view.ViewPager;
|
||||
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.core.widget.xtablayout.XTabLayout;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.fragments.issue.PendingFragment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
|
||||
/**
|
||||
* createTime:2019-7-25 14:55
|
||||
* 案件记录页面
|
||||
*/
|
||||
public class IssueRecordActivity extends BaseActivity {
|
||||
@BindView(R.id.xtl_tabs)
|
||||
XTabLayout mTablayout;
|
||||
@BindView(R.id.vp_content)
|
||||
ViewPager mVpContent;
|
||||
private Unbinder mBind;
|
||||
private String[] mTitles = new String[]{"待下派", "待处理", "待检查", "待结案", "已归档"};
|
||||
private List<Fragment> mFragments = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
return R.layout.activity_issue_record;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
mBind = ButterKnife.bind(this);
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
mTvBaseTitle.setText("案件记录");
|
||||
for (int i = 0; i < mTitles.length; i++) {
|
||||
PendingFragment fragment = new PendingFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("title", mTitles[i]);
|
||||
fragment.setArguments(bundle);
|
||||
mFragments.add(fragment);
|
||||
}
|
||||
VpRecordAdapter adapter = new VpRecordAdapter(getSupportFragmentManager());
|
||||
mVpContent.setAdapter(adapter);
|
||||
mTablayout.setxTabDisplayNum(4);
|
||||
mTablayout.setupWithViewPager(mVpContent);
|
||||
}
|
||||
|
||||
|
||||
private class VpRecordAdapter extends FragmentStatePagerAdapter {
|
||||
|
||||
public VpRecordAdapter(FragmentManager fm) {
|
||||
super(fm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fragment getItem(int i) {
|
||||
return mFragments.get(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
if (mFragments != null) {
|
||||
return mFragments.size();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
return mTitles[position];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
mFragments = null;
|
||||
if (mBind != null) {
|
||||
mBind.unbind();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,125 @@
|
||||
package com.sucstepsoft.realtimelocation.activitys.issue;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.MacAddress;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.widget.GridLayoutManager;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.utils.ConvertUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.ToastUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.adapters.IssueStepAdapter;
|
||||
import com.sucstepsoft.realtimelocation.beans.CaseFlowBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.IssueStepBean;
|
||||
import com.sucstepsoft.realtimelocation.net.LocationApiService;
|
||||
import com.sucstepsoft.realtimelocation.utils.ExceptionHandler;
|
||||
import com.sucstepsoft.realtimelocation.widget.SpaceItemDecoration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* createTime:2019-8-6
|
||||
* 案件流程
|
||||
*/
|
||||
public class IssueStepActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.rlv_step)
|
||||
RecyclerView mRlvStep;
|
||||
private List<CaseFlowBean> mDatas = new ArrayList<>();
|
||||
private IssueStepAdapter mStepAdapter;
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
ButterKnife.bind(this);
|
||||
mTvBaseTitle.setText("流程");
|
||||
refreshView(STATE_LOAD_LOADING);
|
||||
String caseId = getIntent().getStringExtra("caseId");
|
||||
if (TextUtils.isEmpty(caseId)) {
|
||||
ToastUtils.showShort("数据有误");
|
||||
finish();
|
||||
} else {
|
||||
mStepAdapter = new IssueStepAdapter(mActivity, mDatas);
|
||||
mRlvStep.setLayoutManager(new LinearLayoutManager(mActivity));
|
||||
mRlvStep.setAdapter(mStepAdapter);
|
||||
getCaseFlow(caseId);
|
||||
}
|
||||
}
|
||||
|
||||
private void getCaseFlow(String id) {
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.getCaseFlowList(id, UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<List<CaseFlowBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<CaseFlowBean> caseFlowBeans) {
|
||||
if (caseFlowBeans != null && caseFlowBeans.size() > 0) {
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
mDatas = caseFlowBeans;
|
||||
mStepAdapter.setData(mDatas);
|
||||
} else {
|
||||
refreshView(STATE_LOAD_EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
ExceptionHandler.handleException(e);
|
||||
refreshView(STATE_LOAD_ERROR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
return R.layout.activity_issue_step;
|
||||
}
|
||||
// IssueStepBean step1 = new IssueStepBean(true, 1, "案件下派", "2019-8-1\n24:23:23");
|
||||
// IssueStepBean step2 = new IssueStepBean(true, 2, "案件处理", "2019-8-1\n24:23:23");
|
||||
// IssueStepBean step3 = new IssueStepBean(true, 3, "案件检查", "2019-8-1\n24:23:23");
|
||||
// IssueStepBean step4 = new IssueStepBean(false, 4, "案件结案", "");
|
||||
// IssueStepBean step5 = new IssueStepBean(false, 5, "案件归档", "");
|
||||
// mDatas.add(step1);
|
||||
// mDatas.add(step2);
|
||||
// mDatas.add(step3);
|
||||
// mDatas.add(step4);
|
||||
// mDatas.add(step5);
|
||||
|
||||
// IssueStepAdapter adapter = new IssueStepAdapter(this, mDatas);
|
||||
// GridLayoutManager manager = new GridLayoutManager(this, 5);
|
||||
// mRlvSteps.setLayoutManager(manager);
|
||||
// mRlvSteps.addItemDecoration(new SpaceItemDecoration());
|
||||
// mRlvSteps.setAdapter(adapter);
|
||||
// adapter.addOnItemClickListener(bean -> ToastUtils.showShort(bean.getOrder() + ""));
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
package com.sucstepsoft.realtimelocation.activitys.issue;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentStatePagerAdapter;
|
||||
import android.support.v4.view.ViewPager;
|
||||
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.core.widget.xtablayout.XTabLayout;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.fragments.issue.PendingFragment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
|
||||
public class MineIssueNewActivity extends BaseActivity {
|
||||
@BindView(R.id.xtl_tabs)
|
||||
XTabLayout mTablayout;
|
||||
@BindView(R.id.vp_content)
|
||||
ViewPager mVpContent;
|
||||
private Unbinder mBind;
|
||||
private String[] mTitles = new String[]{"我的案件", "下属案件"};
|
||||
private List<Fragment> mFragments = new ArrayList<>();
|
||||
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
return R.layout.activity_mine_issue_new;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
mBind = ButterKnife.bind(this);
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
mTvBaseTitle.setText("我的案件");
|
||||
for (int i = 0; i < mTitles.length; i++) {
|
||||
PendingFragment fragment = new PendingFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("title", mTitles[i]);
|
||||
fragment.setArguments(bundle);
|
||||
mFragments.add(fragment);
|
||||
}
|
||||
VpRecordAdapter adapter = new VpRecordAdapter(getSupportFragmentManager());
|
||||
mVpContent.setAdapter(adapter);
|
||||
mTablayout.setxTabDisplayNum(4);
|
||||
mTablayout.setupWithViewPager(mVpContent);
|
||||
}
|
||||
|
||||
|
||||
private class VpRecordAdapter extends FragmentStatePagerAdapter {
|
||||
|
||||
public VpRecordAdapter(FragmentManager fm) {
|
||||
super(fm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fragment getItem(int i) {
|
||||
return mFragments.get(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mFragments.size();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
return mTitles[position];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
mFragments = null;
|
||||
if (mBind != null) {
|
||||
mBind.unbind();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,344 @@
|
||||
package com.sucstepsoft.realtimelocation.activitys.issue;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.TextView;
|
||||
import android.widget.ZoomControls;
|
||||
|
||||
import com.baidu.location.BDAbstractLocationListener;
|
||||
import com.baidu.location.BDLocation;
|
||||
import com.baidu.location.LocationClient;
|
||||
import com.baidu.location.LocationClientOption;
|
||||
import com.baidu.mapapi.map.BaiduMap;
|
||||
import com.baidu.mapapi.map.BitmapDescriptor;
|
||||
import com.baidu.mapapi.map.BitmapDescriptorFactory;
|
||||
import com.baidu.mapapi.map.MapPoi;
|
||||
import com.baidu.mapapi.map.MapStatus;
|
||||
import com.baidu.mapapi.map.MapStatusUpdate;
|
||||
import com.baidu.mapapi.map.MapStatusUpdateFactory;
|
||||
import com.baidu.mapapi.map.MarkerOptions;
|
||||
import com.baidu.mapapi.map.MyLocationData;
|
||||
import com.baidu.mapapi.map.OverlayOptions;
|
||||
import com.baidu.mapapi.map.TextureMapView;
|
||||
import com.baidu.mapapi.model.LatLng;
|
||||
import com.baidu.mapapi.search.core.SearchResult;
|
||||
import com.baidu.mapapi.search.geocode.GeoCodeResult;
|
||||
import com.baidu.mapapi.search.geocode.GeoCoder;
|
||||
import com.baidu.mapapi.search.geocode.OnGetGeoCoderResultListener;
|
||||
import com.baidu.mapapi.search.geocode.ReverseGeoCodeOption;
|
||||
import com.baidu.mapapi.search.geocode.ReverseGeoCodeResult;
|
||||
import com.sucstepsoft.cm_utils.constant.PathConfig;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.utils.ToastUtils;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.activitys.locus.LocusMapActivity;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
|
||||
public class TakePointActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.et_address)
|
||||
EditText mEtAddress;
|
||||
@BindView(R.id.tv_latitude)
|
||||
TextView mTvLatitude;
|
||||
@BindView(R.id.tv_longitude)
|
||||
TextView mTvLongitude;
|
||||
@BindView(R.id.tmv_map)
|
||||
TextureMapView mTmvMap;
|
||||
@BindView(R.id.rg_map_type)
|
||||
RadioGroup mRgMapType;
|
||||
@BindView(R.id.btn_reload)
|
||||
Button mBtnReload;
|
||||
private Unbinder mBind;
|
||||
private BaiduMap mBaiduMap;
|
||||
private GeoCoder mGeoCoder;
|
||||
private BitmapDescriptor mBitmap;
|
||||
private MessageReceiver mReceiver;
|
||||
private String mDefaultCityCode = "229";//TODO 包头 229
|
||||
// private String mDefaultCityCode = "321";//TODO 呼和浩特 321
|
||||
private LocationClient mLocationClient;
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
return R.layout.activity_take_point;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
mBind = ButterKnife.bind(this);
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
mTvBaseTitle.setText("地图选点");
|
||||
mTvPublish.setVisibility(View.VISIBLE);
|
||||
mTvPublish.setText("确定");
|
||||
mTvPublish.setOnClickListener(v -> confirmLocation());
|
||||
mBaiduMap = mTmvMap.getMap();
|
||||
//将地图移动到中心点
|
||||
LatLng point = new LatLng(PathConfig.LA, PathConfig.LO);
|
||||
MapStatus.Builder builder = new MapStatus.Builder();
|
||||
builder.target(point).zoom(18.0f);
|
||||
mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
|
||||
//添加marker
|
||||
mBaiduMap.setOnMapClickListener(new BaiduMap.OnMapClickListener() {
|
||||
@Override
|
||||
public void onMapClick(LatLng latLng) {
|
||||
LatLng position = latLng;
|
||||
if (position != null && position.latitude != 0 && position.longitude != 0) {
|
||||
if (position.longitude != Double.MIN_VALUE && position.latitude != Double.MIN_VALUE) {
|
||||
addMarker(position);
|
||||
mTvLatitude.setText(position.latitude + "");
|
||||
mTvLongitude.setText(position.longitude + "");
|
||||
if (mGeoCoder != null) {
|
||||
String address = mEtAddress.getText().toString().trim();
|
||||
if (!TextUtils.isEmpty(address)) {
|
||||
mEtAddress.setText("");
|
||||
mEtAddress.setHint("正在获取地址中...");
|
||||
} else {
|
||||
mEtAddress.setHint("正在获取地址中...");
|
||||
}
|
||||
mGeoCoder.reverseGeoCode(new ReverseGeoCodeOption().location(position));
|
||||
} else {
|
||||
initGeoCoder(position);
|
||||
}
|
||||
} else {
|
||||
ToastUtils.showShort("请重新选择地点");
|
||||
}
|
||||
} else {
|
||||
ToastUtils.showShort("请重新选择地点");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapPoiClick(MapPoi mapPoi) {
|
||||
|
||||
}
|
||||
});
|
||||
initGeoCoder(null);
|
||||
mRgMapType.setOnCheckedChangeListener((group, checkedId) -> {
|
||||
int id = 0;
|
||||
switch (checkedId) {
|
||||
case R.id.rb_type_map://普通的
|
||||
id = 123;
|
||||
break;
|
||||
case R.id.rb_satellite://卫星地图
|
||||
id = 1234;
|
||||
break;
|
||||
}
|
||||
if (id != 0) {
|
||||
setMapType(id);
|
||||
}
|
||||
});
|
||||
// mReceiver = new MessageReceiver();
|
||||
// IntentFilter filter = new IntentFilter();
|
||||
// filter.addAction(PathConfig.ACTION_LOCATION_MESSAGE);
|
||||
// registerReceiver(mReceiver, filter);
|
||||
View child = mTmvMap.getChildAt(1);
|
||||
if (child != null && (child instanceof ImageView || child instanceof ZoomControls)) {
|
||||
child.setVisibility(View.GONE);
|
||||
}
|
||||
mTmvMap.showZoomControls(false);
|
||||
startSignLocation();
|
||||
mBtnReload.setOnClickListener(v -> {
|
||||
if (mCurrentLocation != null && mCurrentLocation.getLatitude() != 0 && mCurrentLocation.getLongitude() != 0) {
|
||||
MapStatus cur = new MapStatus.Builder().zoom(16).target(new LatLng(mCurrentLocation.getLatitude(), mCurrentLocation.getLongitude())).build();
|
||||
MapStatusUpdate curUpdate = MapStatusUpdateFactory.newMapStatus(cur);
|
||||
mBaiduMap.animateMapStatus(curUpdate);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setMapType(int id) {
|
||||
if (id == 123) {
|
||||
mBaiduMap.setMapType(BaiduMap.MAP_TYPE_NORMAL);
|
||||
} else {
|
||||
mBaiduMap.setMapType(BaiduMap.MAP_TYPE_SATELLITE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验参数
|
||||
*/
|
||||
private boolean checkParams() {
|
||||
String la = mTvLatitude.getText().toString().trim();
|
||||
String lo = mTvLongitude.getText().toString().trim();
|
||||
String address = mEtAddress.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(la) || TextUtils.isEmpty(lo)) {
|
||||
ToastUtils.showShort("请点击地图进行选点");
|
||||
return false;
|
||||
}
|
||||
if (TextUtils.isEmpty(address)) {
|
||||
ToastUtils.showShort("请输入案件地址");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void confirmLocation() {
|
||||
hideSoftKeyboard();
|
||||
if (checkParams()) {
|
||||
String la = mTvLatitude.getText().toString().trim();
|
||||
String lo = mTvLongitude.getText().toString().trim();
|
||||
String address = mEtAddress.getText().toString().trim();
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("lo", lo);
|
||||
intent.putExtra("la", la);
|
||||
intent.putExtra("address", address);
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加marker
|
||||
*
|
||||
* @param latLng
|
||||
*/
|
||||
private void addMarker(LatLng latLng) {
|
||||
mBaiduMap.clear();
|
||||
if (mBitmap == null) {
|
||||
mBitmap = BitmapDescriptorFactory.fromResource(R.drawable.ic_map_marker);
|
||||
}
|
||||
OverlayOptions option = new MarkerOptions()
|
||||
.position(latLng)
|
||||
.icon(mBitmap)
|
||||
.animateType(MarkerOptions.MarkerAnimateType.drop);
|
||||
mBaiduMap.addOverlay(option);
|
||||
}
|
||||
|
||||
private void initGeoCoder(LatLng latLng) {
|
||||
if (mGeoCoder == null) {
|
||||
mGeoCoder = GeoCoder.newInstance();
|
||||
mGeoCoder.setOnGetGeoCodeResultListener(new OnGetGeoCoderResultListener() {
|
||||
@Override
|
||||
public void onGetGeoCodeResult(GeoCodeResult geoCodeResult) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGetReverseGeoCodeResult(ReverseGeoCodeResult result) {
|
||||
if (result == null
|
||||
|| result.error != SearchResult.ERRORNO.NO_ERROR) {
|
||||
// 没有检测到结果
|
||||
mEtAddress.setText("");
|
||||
mEtAddress.setHint("获取地址失败,请手动输入地址.");
|
||||
} else {
|
||||
mEtAddress.setText(result.getAddress());
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (latLng != null) {
|
||||
String address = mEtAddress.getText().toString().trim();
|
||||
if (!TextUtils.isEmpty(address)) {
|
||||
mEtAddress.setText("");
|
||||
mEtAddress.setHint("正在获取地址中...");
|
||||
}
|
||||
mGeoCoder.reverseGeoCode(new ReverseGeoCodeOption().location(latLng));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private BDLocation mCurrentLocation = null;
|
||||
|
||||
public class MessageReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (PathConfig.ACTION_LOCATION_MESSAGE.equals(intent.getAction())) {
|
||||
BDLocation location = intent.getParcelableExtra("data");
|
||||
//显示定位图标
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void startSignLocation() {
|
||||
stopLocation();
|
||||
mLocationClient = new LocationClient(getApplicationContext());
|
||||
LocationClientOption locationOption = new LocationClientOption();
|
||||
SignLocationListener myLocationListener = new SignLocationListener();
|
||||
mLocationClient.registerLocationListener(myLocationListener);
|
||||
locationOption.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy);
|
||||
locationOption.setCoorType("bd09ll");
|
||||
locationOption.setScanSpan(30 * 1000);
|
||||
locationOption.setIsNeedAddress(true);
|
||||
locationOption.setNeedDeviceDirect(false);
|
||||
locationOption.setLocationNotify(false);
|
||||
locationOption.setIgnoreKillProcess(true);
|
||||
locationOption.setIsNeedLocationDescribe(true);
|
||||
locationOption.setIsNeedLocationPoiList(true);
|
||||
locationOption.SetIgnoreCacheException(false);
|
||||
locationOption.setOpenGps(true);
|
||||
locationOption.setIsNeedAltitude(false);
|
||||
mLocationClient.setLocOption(locationOption);
|
||||
//开始定位
|
||||
mLocationClient.start();
|
||||
}
|
||||
|
||||
private void stopLocation() {
|
||||
if (null != mLocationClient) {
|
||||
mLocationClient.stop();
|
||||
}
|
||||
}
|
||||
|
||||
private class SignLocationListener extends BDAbstractLocationListener {
|
||||
@Override
|
||||
public void onReceiveLocation(BDLocation bdLocation) {
|
||||
if (bdLocation != null && bdLocation.getLatitude() != 0 && bdLocation.getLongitude() != 0) {
|
||||
checkPointIsLegal(bdLocation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkPointIsLegal(BDLocation bdLocation) {
|
||||
if (mDefaultCityCode.equals(bdLocation.getCityCode())) {
|
||||
if (bdLocation != null && bdLocation.getLatitude() != 0 && bdLocation.getLongitude() != 0) {
|
||||
if (bdLocation.getRadius() <= 150) {
|
||||
if (bdLocation != null && bdLocation.getLatitude() != Double.MIN_VALUE && bdLocation.getLongitude() != Double.MIN_VALUE) {
|
||||
mBaiduMap.setMyLocationEnabled(true);
|
||||
MyLocationData locData = new MyLocationData.Builder()
|
||||
.accuracy(bdLocation.getRadius())
|
||||
.latitude(bdLocation.getLatitude())
|
||||
.longitude(bdLocation.getLongitude()).build();
|
||||
mBaiduMap.setMyLocationData(locData);
|
||||
if (mCurrentLocation == null) {
|
||||
mCurrentLocation = bdLocation;
|
||||
moveMapToCenter(new LatLng(mCurrentLocation.getLatitude(), mCurrentLocation.getLongitude()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//显示定位图标
|
||||
}
|
||||
|
||||
private void moveMapToCenter(LatLng latLng) {
|
||||
MapStatus ms = new MapStatus.Builder().zoom(16).target(latLng).build();
|
||||
MapStatusUpdate u = MapStatusUpdateFactory.newMapStatus(ms);
|
||||
mBaiduMap.setMapStatus(u);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
stopLocation();
|
||||
mBaiduMap = null;
|
||||
mBitmap = null;
|
||||
mGeoCoder.destroy();
|
||||
mGeoCoder = null;
|
||||
mTmvMap.onDestroy();
|
||||
if (mBind != null) {
|
||||
mBind.unbind();
|
||||
}
|
||||
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,205 @@
|
||||
package com.sucstepsoft.realtimelocation.activitys.locus;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentStatePagerAdapter;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.sucstepsoft.cm_utils.constant.PathConfig;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.core.widget.xtablayout.XTabLayout;
|
||||
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.beans.AppTokenUser;
|
||||
import com.sucstepsoft.realtimelocation.beans.SuccessBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.UnderlingBean;
|
||||
import com.sucstepsoft.realtimelocation.fragments.locus.LocusMapFragment;
|
||||
import com.sucstepsoft.realtimelocation.net.LocationApiService;
|
||||
import com.sucstepsoft.realtimelocation.widget.ScrollMapViewPager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
public class LocusManagerActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.xtl_locus_tabs)
|
||||
XTabLayout mTabLayout;
|
||||
@BindView(R.id.vp_locus_content)
|
||||
ScrollMapViewPager mVpContent;
|
||||
private Unbinder mBind;
|
||||
private String[] mTitles = new String[]{"在线", "离线"};
|
||||
private List<Fragment> mFragments = new ArrayList<>();
|
||||
private VpLocusAdapter mAdapter;
|
||||
private String urlPath;
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
return R.layout.activity_locus_manager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
mBind = ButterKnife.bind(this);
|
||||
mTvBaseTitle.setText("实时位置");
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
mTvPublish.setVisibility(View.VISIBLE);
|
||||
mTvPublish.setText("个人");
|
||||
mTvPublish.setOnClickListener(v -> startActivity(new Intent(mActivity, LocusMapActivity.class)));
|
||||
Gson gson = new Gson();
|
||||
String loginInfo = UserLgUtils.getLoginInfo();
|
||||
if (!TextUtils.isEmpty(loginInfo)) {
|
||||
AppTokenUser appTokenUser = gson.fromJson(loginInfo, AppTokenUser.class);
|
||||
if (appTokenUser.getRoles() != null && appTokenUser.getRoles().size() > 0) {
|
||||
urlPath = "leader";
|
||||
for (int i = 0; i < appTokenUser.getRoles().size(); i++) {
|
||||
if (PathConfig.USER_TYPE_P.equals(appTokenUser.getRoles().get(i).getRoleId())) {
|
||||
urlPath = "communityboss";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
LocusMapFragment fragment = new LocusMapFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("title", urlPath);
|
||||
bundle.putBoolean("isOnline", true);
|
||||
fragment.setArguments(bundle);
|
||||
mFragments.add(fragment);
|
||||
LocusMapFragment fragment1 = new LocusMapFragment();
|
||||
Bundle bundle1 = new Bundle();
|
||||
bundle1.putString("title", urlPath);
|
||||
bundle1.putBoolean("isOnline", false);
|
||||
fragment1.setArguments(bundle1);
|
||||
mFragments.add(fragment1);
|
||||
mAdapter = new VpLocusAdapter(getSupportFragmentManager());
|
||||
mVpContent.setAdapter(mAdapter);
|
||||
mTabLayout.setxTabDisplayNum(3);
|
||||
mTabLayout.setupWithViewPager(mVpContent);
|
||||
//true online
|
||||
//false offLine
|
||||
getOnlineUserList();
|
||||
getOfflineUserList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取在线人员列表
|
||||
*/
|
||||
private void getOnlineUserList() {
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.getMineLeaderList(urlPath, UserLgUtils.getToken(), true)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<List<UnderlingBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<UnderlingBean> underlingBeans) {
|
||||
if (underlingBeans != null && underlingBeans.size() > 0) {
|
||||
//在线人数
|
||||
mTitles[0] = "在线(" + underlingBeans.size() + ")";
|
||||
mAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取离线人员列表
|
||||
*/
|
||||
private void getOfflineUserList() {
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.getMineLeaderList(urlPath, UserLgUtils.getToken(), false)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<List<UnderlingBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<UnderlingBean> underlingBeans) {
|
||||
if (underlingBeans != null && underlingBeans.size() > 0) {
|
||||
//离线人数
|
||||
mTitles[1] = "离线(" + underlingBeans.size() + ")";
|
||||
mAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private class VpLocusAdapter extends FragmentStatePagerAdapter {
|
||||
|
||||
public VpLocusAdapter(FragmentManager fm) {
|
||||
super(fm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fragment getItem(int i) {
|
||||
return mFragments.get(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mFragments.size();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
return mTitles[position];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
mFragments = null;
|
||||
mAdapter = null;
|
||||
mTitles = null;
|
||||
if (mBind != null) {
|
||||
mBind.unbind();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,40 @@
|
||||
package com.sucstepsoft.realtimelocation.activitys.mine;
|
||||
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
|
||||
/**
|
||||
* createTime:2019年8月5日
|
||||
* 每日通报
|
||||
*/
|
||||
public class AvisoActivity extends BaseActivity {
|
||||
|
||||
|
||||
private Unbinder mBind;
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
return R.layout.activity_aviso;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
mBind = ButterKnife.bind(this);
|
||||
mTvBaseTitle.setText("每日通报");
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (mBind != null) {
|
||||
mBind.unbind();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
@ -0,0 +1,235 @@
|
||||
package com.sucstepsoft.realtimelocation.activitys.mine;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.sucstepsoft.cm_utils.constant.RegexConstants;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.utils.EncryptUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.RegexUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.ToastUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.UIUtil;
|
||||
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.beans.ChangePwdBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.SuccessBean;
|
||||
import com.sucstepsoft.realtimelocation.net.LocationApiService;
|
||||
import com.sucstepsoft.realtimelocation.services.GlobalProvider;
|
||||
import com.sucstepsoft.realtimelocation.utils.ExceptionHandler;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
public class ChangePwdActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.et_orig_pwd)
|
||||
EditText mEtOrigPwd;
|
||||
@BindView(R.id.iv_clear_orig)
|
||||
ImageView mIvClearOrig;
|
||||
@BindView(R.id.et_new_pwd)
|
||||
EditText mEtNewPwd;
|
||||
@BindView(R.id.iv_clear_new)
|
||||
ImageView mIvClearNew;
|
||||
@BindView(R.id.et_new_pwd_confirm)
|
||||
EditText mEtNewPwdConfirm;
|
||||
@BindView(R.id.iv_clear_confirm)
|
||||
ImageView mIvClearConfirm;
|
||||
@BindView(R.id.btn_submit)
|
||||
Button mBtnSubmit;
|
||||
private Unbinder mBind;
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
return R.layout.activity_change_pwd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
mBind = ButterKnife.bind(this);
|
||||
mTvBaseTitle.setText("修改密码");
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
mEtOrigPwd.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (!TextUtils.isEmpty(s)) {
|
||||
mIvClearOrig.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mIvClearOrig.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
});
|
||||
mEtNewPwd.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (!TextUtils.isEmpty(s)) {
|
||||
mIvClearNew.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mIvClearNew.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
});
|
||||
mEtNewPwdConfirm.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (!TextUtils.isEmpty(s)) {
|
||||
mIvClearConfirm.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mIvClearConfirm.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
});
|
||||
mIvClearConfirm.setOnClickListener(v -> mEtNewPwdConfirm.setText(""));
|
||||
mIvClearNew.setOnClickListener(v -> mEtNewPwd.setText(""));
|
||||
mIvClearOrig.setOnClickListener(v -> mEtOrigPwd.setText(""));
|
||||
mBtnSubmit.setOnClickListener(v -> changePwd());
|
||||
setEditTextInhibitInputSpeChat(mEtNewPwd);
|
||||
setEditTextInhibitInputSpeChat(mEtNewPwdConfirm);
|
||||
setEditTextInhibitInputSpeChat(mEtOrigPwd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成修改密码
|
||||
*/
|
||||
private void changePwd() {
|
||||
String orgPwd = mEtOrigPwd.getText().toString().trim();
|
||||
String newPwd = mEtNewPwd.getText().toString().trim();
|
||||
String cNewPwd = mEtNewPwdConfirm.getText().toString().trim();
|
||||
if (checkInfo(orgPwd, newPwd, cNewPwd)) {
|
||||
doChangePwd(orgPwd, newPwd, cNewPwd);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成密码修改
|
||||
*
|
||||
* @param orgPwd
|
||||
* @param newPwd
|
||||
* @param cNewPwd
|
||||
*/
|
||||
private void doChangePwd(String orgPwd, String newPwd, String cNewPwd) {
|
||||
ProgressDialog dialog = UIUtil.initDialog(mActivity, "修改中...");
|
||||
dialog.show();
|
||||
ChangePwdBean bean = new ChangePwdBean();
|
||||
String md5Pwd = EncryptUtils.encryptMD5ToStringTimes(newPwd, 3);
|
||||
String oldPwd = EncryptUtils.encryptMD5ToStringTimes(orgPwd, 3);
|
||||
bean.setNewPassword(md5Pwd);
|
||||
bean.setOldPassword(oldPwd);
|
||||
Gson gson = new Gson();
|
||||
String obj = gson.toJson(bean);
|
||||
RequestBody body = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), obj);
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.doChangePwd(body, UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<SuccessBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(SuccessBean successBean) {
|
||||
ToastUtils.showShort("密码修改成功,请重新登录");
|
||||
UserLgUtils.setPassword("");
|
||||
GlobalProvider.save(mActivity, "isUpload", "12");
|
||||
GlobalProvider.save(mActivity, "token", "");
|
||||
reStartApp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
dialog.dismiss();
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private boolean checkInfo(String orgPwd, String newPwd, String cNewPwd) {
|
||||
if (TextUtils.isEmpty(orgPwd)) {
|
||||
ToastUtils.showShort("原密码不能为空.");
|
||||
return false;
|
||||
}
|
||||
if (TextUtils.isEmpty(newPwd)) {
|
||||
ToastUtils.showShort("新密码不能为空.");
|
||||
return false;
|
||||
}
|
||||
if (TextUtils.isEmpty(cNewPwd)) {
|
||||
ToastUtils.showShort("新密码不能为空.");
|
||||
return false;
|
||||
}
|
||||
if (!cNewPwd.equals(newPwd)) {
|
||||
ToastUtils.showShort("新密码不一致");
|
||||
return false;
|
||||
}
|
||||
// if (!RegexUtils.isMatch(RegexConstants.REGEX_ZH, newPwd)) {
|
||||
// ToastUtils.showShort("密码中不能包含中文.");
|
||||
// return false;
|
||||
// }
|
||||
// if (!RegexUtils.isMatch(RegexConstants.REGEX_PWD, newPwd)) {
|
||||
// ToastUtils.showShort("密码至少要8位,且包含数字和字母.");
|
||||
// return false;
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (mBind != null) {
|
||||
mBind.unbind();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
@ -0,0 +1,384 @@
|
||||
package com.sucstepsoft.realtimelocation.activitys.mine;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.text.Html;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
|
||||
import com.bigkoo.pickerview.view.OptionsPickerView;
|
||||
import com.google.gson.Gson;
|
||||
import com.sucstepsoft.cm_utils.constant.TimeConstants;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.utils.TimeUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.ToastUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.UIUtil;
|
||||
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.beans.LeavePostBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.SuccessBean;
|
||||
import com.sucstepsoft.realtimelocation.net.LocationApiService;
|
||||
import com.sucstepsoft.realtimelocation.utils.ExceptionHandler;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
public class LeaveActivity extends BaseActivity {
|
||||
|
||||
|
||||
@BindView(R.id.tv_le_type_title)
|
||||
TextView mTvLeTypeTitle;
|
||||
@BindView(R.id.tv_le_type_content)
|
||||
TextView mTvLeTypeContent;
|
||||
@BindView(R.id.rl_le_type)
|
||||
RelativeLayout mRlLeType;
|
||||
@BindView(R.id.tv_le_start_title)
|
||||
TextView mTvLeStartTitle;
|
||||
@BindView(R.id.tv_le_start_content)
|
||||
TextView mTvLeStartContent;
|
||||
@BindView(R.id.rl_le_start)
|
||||
RelativeLayout mRlLeStart;
|
||||
@BindView(R.id.tv_le_end_title)
|
||||
TextView mTvLeEndTitle;
|
||||
@BindView(R.id.tv_le_end_content)
|
||||
TextView mTvLeEndContent;
|
||||
@BindView(R.id.rl_le_end)
|
||||
RelativeLayout mRlLeEnd;
|
||||
@BindView(R.id.tv_le_count_title)
|
||||
TextView mTvLeCountTitle;
|
||||
@BindView(R.id.tv_le_count_content)
|
||||
TextView mTvLeCountContent;
|
||||
@BindView(R.id.rl_le_count)
|
||||
RelativeLayout mRlLeCount;
|
||||
@BindView(R.id.tv_le_cause)
|
||||
TextView mTvLeCause;
|
||||
@BindView(R.id.et_le_cause)
|
||||
EditText mEtLeCause;
|
||||
@BindView(R.id.btn_submit)
|
||||
Button mBtnSubmit;
|
||||
private Unbinder mBind;
|
||||
private String mType = "";
|
||||
private String mStartTime = "";
|
||||
private float mStart = 0;
|
||||
private String amOrPm = "am";
|
||||
private float mEnd = 0;
|
||||
private String mEndTime = "";
|
||||
private float mCount = 0.0f;
|
||||
private int startTimeAmOrPm = 0;
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
return R.layout.activity_leave;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
mBind = ButterKnife.bind(this);
|
||||
mTvBaseTitle.setText("请假");
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
mTvPublish.setVisibility(View.VISIBLE);
|
||||
mTvPublish.setText("历史");
|
||||
mTvPublish.setOnClickListener(v -> startActivity(new Intent(LeaveActivity.this, LeaveHistoryActivity.class)));
|
||||
mTvLeTypeTitle.setText(Html.fromHtml(getResources().getString(R.string.leave_type)));
|
||||
mTvLeStartTitle.setText(Html.fromHtml(getResources().getString(R.string.leave_start)));
|
||||
mTvLeEndTitle.setText(Html.fromHtml(getResources().getString(R.string.leave_end)));
|
||||
mTvLeCountTitle.setText(Html.fromHtml(getResources().getString(R.string.leave_count)));
|
||||
mTvLeCause.setText(Html.fromHtml(getResources().getString(R.string.leave_cause)));
|
||||
mRlLeType.setOnClickListener(v -> choosePage(1));
|
||||
mRlLeStart.setOnClickListener(v -> choosePage(2));
|
||||
mRlLeEnd.setOnClickListener(v -> choosePage(3));
|
||||
mBtnSubmit.setOnClickListener(v -> doSubmit());
|
||||
setEditTextInhibitInputSpeChat(mEtLeCause);
|
||||
}
|
||||
|
||||
private void doSubmit() {
|
||||
if (checkParams()) {
|
||||
ProgressDialog progressDialog = UIUtil.initDialog(LeaveActivity.this, "上报中...");
|
||||
progressDialog.show();
|
||||
String cause = mEtLeCause.getText().toString().trim();
|
||||
LeavePostBean body = new LeavePostBean();
|
||||
body.setLeaveSummary(cause);
|
||||
body.setLeaveType(mType);
|
||||
body.setLeaveTimeLong(mCount + "");
|
||||
body.setLeaveTime(mStartTime);
|
||||
body.setLeaveTimeApm(amOrPm);
|
||||
Gson gson = new Gson();
|
||||
String obj = gson.toJson(body);
|
||||
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), obj);
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.saveLeave(requestBody, UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<SuccessBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(SuccessBean s) {
|
||||
progressDialog.dismiss();
|
||||
ToastUtils.showShort("请假成功");
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
progressDialog.dismiss();
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkParams() {
|
||||
if (TextUtils.isEmpty(mType)) {
|
||||
ToastUtils.showShort("请选择请假类型");
|
||||
return false;
|
||||
}
|
||||
if (TextUtils.isEmpty(mStartTime)) {
|
||||
ToastUtils.showShort("请选择开始时间");
|
||||
return false;
|
||||
}
|
||||
if (TextUtils.isEmpty(mEndTime)) {
|
||||
ToastUtils.showShort("请选择结束时间");
|
||||
return false;
|
||||
}
|
||||
String trim = mEtLeCause.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(trim)) {
|
||||
ToastUtils.showShort("请输入请假事由");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void choosePage(int i) {
|
||||
switch (i) {
|
||||
case 1:
|
||||
showTypePicker();
|
||||
break;
|
||||
case 2:
|
||||
showStartPicker();
|
||||
break;
|
||||
case 3:
|
||||
showEndPicker();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void showEndPicker() {
|
||||
if (TextUtils.isEmpty(mStartTime)) {
|
||||
ToastUtils.showShort("请选择开始时间");
|
||||
} else {
|
||||
List<String> yearDate = TimeUtils.getYearDate();
|
||||
List<List<String>> ampm = new ArrayList<>();
|
||||
if (yearDate != null && yearDate.size() > 0) {
|
||||
for (int i = 0; i < yearDate.size(); i++) {
|
||||
List<String> a = new ArrayList<>();
|
||||
a.add("上午");
|
||||
a.add("下午");
|
||||
ampm.add(a);
|
||||
}
|
||||
OptionsPickerView<String> mTypePicker = new OptionsPickerBuilder(LeaveActivity.this, (options1, options2, options3, v) -> {
|
||||
long timeSpan = TimeUtils.getTimeSpan(yearDate.get(options1), mStartTime, new SimpleDateFormat("yyyy-MM-dd"), TimeConstants.DAY);
|
||||
if (timeSpan > 0) {
|
||||
//正常
|
||||
if (timeSpan < 3) {
|
||||
mEndTime = yearDate.get(options1);
|
||||
String am = ampm.get(options1).get(options2);
|
||||
switch (am) {
|
||||
case "上午":
|
||||
mEnd = 0.5f;
|
||||
break;
|
||||
case "下午":
|
||||
mEnd = 1.0f;
|
||||
break;
|
||||
}
|
||||
if (startTimeAmOrPm == 123) {
|
||||
//开始选择上午
|
||||
mTvLeEndContent.setText(mEndTime + am);
|
||||
mCount = mEnd + timeSpan;
|
||||
mTvLeCountContent.setText(mCount + "天");
|
||||
} else {
|
||||
mTvLeEndContent.setText(mEndTime + am);
|
||||
mCount = (mEnd + timeSpan) - 0.5f;
|
||||
mTvLeCountContent.setText(mCount + "天");
|
||||
}
|
||||
} else if (timeSpan == 3) {
|
||||
if (startTimeAmOrPm == 123) {
|
||||
ToastUtils.showShort("请假时长不能超过3天");
|
||||
} else {
|
||||
mEndTime = yearDate.get(options1);
|
||||
String am = ampm.get(options1).get(options2);
|
||||
if (am.equals("下午")) {
|
||||
ToastUtils.showShort("请假时长不能超过3天");
|
||||
} else {
|
||||
switch (am) {
|
||||
case "上午":
|
||||
mEnd = 0.5f;
|
||||
break;
|
||||
case "下午":
|
||||
mEnd = 1.0f;
|
||||
break;
|
||||
}
|
||||
if (startTimeAmOrPm == 123) {
|
||||
//开始选择上午
|
||||
mTvLeEndContent.setText(mEndTime + am);
|
||||
mCount = mEnd + timeSpan;
|
||||
mTvLeCountContent.setText(mCount + "天");
|
||||
} else {
|
||||
mTvLeEndContent.setText(mEndTime + am);
|
||||
mCount = (mEnd + timeSpan) - 0.5f;
|
||||
mTvLeCountContent.setText(mCount + "天");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ToastUtils.showShort("请假时长不能超过3天");
|
||||
}
|
||||
} else if (timeSpan < 0) {
|
||||
ToastUtils.showShort("结束时间应该大于开始时间");
|
||||
} else {
|
||||
mEndTime = yearDate.get(options1);
|
||||
//同一天
|
||||
String am = ampm.get(options1).get(options2);
|
||||
int endTime = 0;
|
||||
switch (am) {
|
||||
case "上午":
|
||||
endTime = 123;
|
||||
break;
|
||||
case "下午":
|
||||
endTime = 223;
|
||||
break;
|
||||
}
|
||||
if (endTime < startTimeAmOrPm) {
|
||||
ToastUtils.showShort("结束时间不能小于开始时间");
|
||||
} else if (endTime == startTimeAmOrPm) {
|
||||
//选择的相同的
|
||||
mTvLeEndContent.setText(mEndTime + am);
|
||||
mCount = 0.5f;
|
||||
mTvLeCountContent.setText(mCount + "天");
|
||||
} else {
|
||||
mTvLeEndContent.setText(mEndTime + am);
|
||||
mCount = 1.0f;
|
||||
mTvLeCountContent.setText(mCount + "天");
|
||||
}
|
||||
}
|
||||
}).setTitleText("请选择结束时间")
|
||||
.setCancelColor(Color.parseColor("#1189FF"))
|
||||
.setSubmitColor(Color.parseColor("#1189FF"))
|
||||
.setTitleColor(Color.parseColor("#1189FF"))
|
||||
.build();
|
||||
mTypePicker.setPicker(yearDate, ampm);
|
||||
mTypePicker.show();
|
||||
} else {
|
||||
ToastUtils.showShort("数据有误,请重试.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void showStartPicker() {
|
||||
List<String> yearDate = TimeUtils.getYearDate();
|
||||
List<List<String>> ampm = new ArrayList<>();
|
||||
if (yearDate != null && yearDate.size() > 0) {
|
||||
for (int i = 0; i < yearDate.size(); i++) {
|
||||
List<String> a = new ArrayList<>();
|
||||
a.add("上午");
|
||||
a.add("下午");
|
||||
ampm.add(a);
|
||||
}
|
||||
OptionsPickerView<String> mTypePicker = new OptionsPickerBuilder(LeaveActivity.this, (options1, options2, options3, v) -> {
|
||||
mStartTime = yearDate.get(options1);
|
||||
String am = ampm.get(options1).get(options2);
|
||||
mTvLeStartContent.setText(mStartTime + am);
|
||||
switch (am) {
|
||||
case "上午":
|
||||
mStart = 0.5f;
|
||||
amOrPm = "am";
|
||||
startTimeAmOrPm = 123;
|
||||
break;
|
||||
case "下午":
|
||||
mStart = 0.5f;
|
||||
amOrPm = "pm";
|
||||
startTimeAmOrPm = 223;
|
||||
break;
|
||||
}
|
||||
mTvLeEndContent.setText("");
|
||||
mCount = 0.0f;
|
||||
mTvLeCountContent.setText("");
|
||||
mTvLeEndContent.setHint("请选择");
|
||||
mTvLeCountContent.setHint("0天");
|
||||
}).setTitleText("请选择开始时间")
|
||||
.setCancelColor(Color.parseColor("#1189FF"))
|
||||
.setSubmitColor(Color.parseColor("#1189FF"))
|
||||
.setTitleColor(Color.parseColor("#1189FF"))
|
||||
.build();
|
||||
mTypePicker.setPicker(yearDate, ampm);
|
||||
mTypePicker.show();
|
||||
} else {
|
||||
ToastUtils.showShort("数据有误,请重试.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void showTypePicker() {
|
||||
List<String> types = new ArrayList<>();
|
||||
types.add("有病");
|
||||
types.add("有事");
|
||||
OptionsPickerView<String> mTypePicker = new OptionsPickerBuilder(LeaveActivity.this, (options1, options2, options3, v) -> {
|
||||
mType = types.get(options1);
|
||||
String s = types.get(options1);
|
||||
switch (s) {
|
||||
case "有病":
|
||||
mType = "ill";
|
||||
break;
|
||||
case "有事":
|
||||
mType = "busy";
|
||||
break;
|
||||
}
|
||||
mTvLeTypeContent.setText(s);
|
||||
}).setTitleText("请选择请假类型")
|
||||
.setCancelColor(Color.parseColor("#1189FF"))
|
||||
.setSubmitColor(Color.parseColor("#1189FF"))
|
||||
.setTitleColor(Color.parseColor("#1189FF"))
|
||||
.build();
|
||||
mTypePicker.setPicker(types);
|
||||
mTypePicker.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (mBind != null) {
|
||||
mBind.unbind();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,175 @@
|
||||
package com.sucstepsoft.realtimelocation.activitys.mine;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
|
||||
import com.jcodecraeer.xrecyclerview.ProgressStyle;
|
||||
import com.jcodecraeer.xrecyclerview.XRecyclerView;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.utils.ToastUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.adapters.IssueSubAdapter;
|
||||
import com.sucstepsoft.realtimelocation.adapters.LeaveHistoryAdapter;
|
||||
import com.sucstepsoft.realtimelocation.beans.IssueSubBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.LeaveListBean;
|
||||
import com.sucstepsoft.realtimelocation.net.LocationApiService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
public class LeaveCheckListActivity extends BaseActivity {
|
||||
|
||||
|
||||
@BindView(R.id.xlv_leave_record)
|
||||
XRecyclerView mXlvItems;
|
||||
private Unbinder mBind;
|
||||
private String mRows = "20";
|
||||
private int mCurPage = 1;
|
||||
private LeaveHistoryAdapter mAdapter;
|
||||
private List<LeaveListBean.RowsBean> mDatas = new ArrayList<>();
|
||||
private Disposable mDisposable;
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
return R.layout.activity_leave_check_list;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
mBind = ButterKnife.bind(this);
|
||||
mTvBaseTitle.setText("请假审批");
|
||||
refreshView(STATE_LOAD_LOADING);
|
||||
mAdapter = new LeaveHistoryAdapter(mActivity, mDatas, 2);
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(mActivity);
|
||||
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
|
||||
mXlvItems.setLayoutManager(layoutManager);
|
||||
mXlvItems.setAdapter(mAdapter);
|
||||
mAdapter.addOnItemClickListener(bean -> showDetail(bean));
|
||||
mXlvItems.setRefreshProgressStyle(ProgressStyle.BallGridBeat);
|
||||
mXlvItems.setLoadingMoreProgressStyle(ProgressStyle.Pacman);
|
||||
mXlvItems.setPullRefreshEnabled(true);
|
||||
mXlvItems.setLoadingMoreEnabled(true);
|
||||
mXlvItems.setLoadingListener(new XRecyclerView.LoadingListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
refreshData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMore() {
|
||||
getUpcomingList(mCurPage);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void refreshData() {
|
||||
getUpcomingList(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
refreshData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取列表
|
||||
*/
|
||||
private void getUpcomingList(int page) {
|
||||
mCurPage = page;
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.getLeaveListByMineApproval(mRows, page + "", UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<LeaveListBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(LeaveListBean leaveListBean) {
|
||||
if (leaveListBean != null && leaveListBean.getRows() != null && leaveListBean.getRows().size() > 0) {
|
||||
++mCurPage;
|
||||
if (page == 1) {
|
||||
mDatas.clear();
|
||||
mDatas.addAll(leaveListBean.getRows());
|
||||
} else {
|
||||
mDatas.addAll(leaveListBean.getRows());
|
||||
}
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
mXlvItems.refreshComplete();
|
||||
if (mDatas.size() >= leaveListBean.getTotal()) {
|
||||
mXlvItems.loadMoreComplete();
|
||||
mXlvItems.setNoMore(true);
|
||||
} else {
|
||||
mXlvItems.loadMoreComplete();
|
||||
mXlvItems.setNoMore(false);
|
||||
}
|
||||
} else {
|
||||
if (page > 1) {
|
||||
mXlvItems.loadMoreComplete();
|
||||
mXlvItems.setNoMore(true);
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
} else {
|
||||
//无数据
|
||||
refreshView(STATE_LOAD_EMPTY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
ToastUtils.showShort("数据加载失,请稍后重试");
|
||||
refreshView(STATE_LOAD_ERROR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示详细内容
|
||||
*
|
||||
* @param bean
|
||||
*/
|
||||
private void showDetail(LeaveListBean.RowsBean bean) {
|
||||
Intent intent = new Intent();
|
||||
intent.setClass(LeaveCheckListActivity.this, LeaveDetailActivity.class);
|
||||
intent.putExtra("type", "check");
|
||||
intent.putExtra("data", bean);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (mDisposable != null && !mDisposable.isDisposed()) {
|
||||
mDisposable.dispose();
|
||||
}
|
||||
mXlvItems.destroy();
|
||||
mXlvItems = null;
|
||||
if (mBind != null) {
|
||||
mBind.unbind();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
@ -0,0 +1,257 @@
|
||||
package com.sucstepsoft.realtimelocation.activitys.mine;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.android.arouter.exception.HandlerException;
|
||||
import com.google.gson.Gson;
|
||||
import com.sucstepsoft.cm_utils.core.network.response.GsonResponseHandler;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.utils.ToastUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.UIUtil;
|
||||
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.beans.LeaveCheckBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.LeaveDetailBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.LeaveListBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.LeavePostBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.SuccessBean;
|
||||
import com.sucstepsoft.realtimelocation.net.LocationApiService;
|
||||
import com.sucstepsoft.realtimelocation.utils.ExceptionHandler;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
/**
|
||||
* 请假详情
|
||||
*/
|
||||
public class LeaveDetailActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.tv_le_state)
|
||||
TextView mTvLeState;
|
||||
@BindView(R.id.rl_le_state)
|
||||
RelativeLayout mRlLeState;
|
||||
@BindView(R.id.tv_le_type_title)
|
||||
TextView mTvLeTypeTitle;
|
||||
@BindView(R.id.tv_le_type_content)
|
||||
TextView mTvLeTypeContent;
|
||||
@BindView(R.id.rl_le_type)
|
||||
RelativeLayout mRlLeType;
|
||||
@BindView(R.id.tv_le_start_title)
|
||||
TextView mTvLeStartTitle;
|
||||
@BindView(R.id.tv_le_start_content)
|
||||
TextView mTvLeStartContent;
|
||||
@BindView(R.id.rl_le_start)
|
||||
RelativeLayout mRlLeStart;
|
||||
@BindView(R.id.tv_le_count_title)
|
||||
TextView mTvLeCountTitle;
|
||||
@BindView(R.id.tv_le_count_content)
|
||||
TextView mTvLeCountContent;
|
||||
@BindView(R.id.rl_le_count)
|
||||
RelativeLayout mRlLeCount;
|
||||
@BindView(R.id.tv_le_cause)
|
||||
TextView mTvLeCause;
|
||||
@BindView(R.id.et_le_cause)
|
||||
TextView mEtLeCause;
|
||||
@BindView(R.id.ll_btns)
|
||||
LinearLayout mLlBtns;
|
||||
@BindView(R.id.et_cause)
|
||||
EditText mEtCase;
|
||||
@BindView(R.id.submit)
|
||||
Button mBtnSubmit;
|
||||
@BindView(R.id.turm)
|
||||
Button mBtnTurm;
|
||||
@BindView(R.id.ll_neirong)
|
||||
LinearLayout mllNeirong;
|
||||
@BindView(R.id.neirong)
|
||||
TextView mTvNeiron;
|
||||
@BindView(R.id.tv_le_qingren)
|
||||
TextView mTvQingRen;
|
||||
private Unbinder mBind;
|
||||
private String mType;
|
||||
private LeaveDetailBean mDetailBean;
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
return R.layout.activity_leave_detail;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
super.initData();
|
||||
mBind = ButterKnife.bind(this);
|
||||
mTvBaseTitle.setText("详情");
|
||||
refreshView(STATE_LOAD_LOADING);
|
||||
mType = getIntent().getStringExtra("type");
|
||||
if (TextUtils.isEmpty(mType)) {
|
||||
ToastUtils.showShort("数据有误");
|
||||
finish();
|
||||
} else {
|
||||
LeaveListBean.RowsBean bean = (LeaveListBean.RowsBean) getIntent().getSerializableExtra("data");
|
||||
if (bean != null) {
|
||||
getDetailData(bean);
|
||||
} else {
|
||||
ToastUtils.showShort("数据有误");
|
||||
finish();
|
||||
}
|
||||
}
|
||||
mBtnSubmit.setOnClickListener(v -> submit(1));
|
||||
mBtnTurm.setOnClickListener(v -> submit(2));
|
||||
}
|
||||
|
||||
|
||||
private boolean checkParams() {
|
||||
String trim = mEtCase.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(trim)) {
|
||||
ToastUtils.showShort("请输入审批内容");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void submit(int i) {
|
||||
if (checkParams()) {
|
||||
ProgressDialog progressDialog = UIUtil.initDialog(LeaveDetailActivity.this, "审批中...");
|
||||
progressDialog.show();
|
||||
Gson gson = new Gson();
|
||||
LeaveCheckBean bean = new LeaveCheckBean();
|
||||
String trim = mEtCase.getText().toString().trim();
|
||||
bean.setLeaveRefuseSummary(trim);
|
||||
bean.setLeaveState(i);
|
||||
String obj = gson.toJson(bean);
|
||||
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), obj);
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.doCheckLeave(mDetailBean.getLeaveId(), requestBody, UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<SuccessBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(SuccessBean s) {
|
||||
progressDialog.dismiss();
|
||||
ToastUtils.showShort("审批成功");
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
progressDialog.dismiss();
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取详情
|
||||
*
|
||||
* @param bean
|
||||
*/
|
||||
private void getDetailData(LeaveListBean.RowsBean bean) {
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.getLeaveDetail(bean.getLeaveId(), UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<LeaveDetailBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(LeaveDetailBean leaveDetailBean) {
|
||||
if (leaveDetailBean != null) {
|
||||
mDetailBean = leaveDetailBean;
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
mEtLeCause.setText(leaveDetailBean.getLeaveSummary());
|
||||
mTvLeStartContent.setText(leaveDetailBean.getLeaveTime() + " " + leaveDetailBean.getLeaveTimeApm());
|
||||
mTvLeCountContent.setText(leaveDetailBean.getLeaveTimeLong() + "天");
|
||||
mTvQingRen.setText(leaveDetailBean.getLeaveUserName());
|
||||
switch (leaveDetailBean.getLeaveState()) {
|
||||
case 0:
|
||||
mTvLeState.setText("待审批");
|
||||
if (mType.equals("show")) {
|
||||
mLlBtns.setVisibility(View.GONE);
|
||||
mllNeirong.setVisibility(View.GONE);
|
||||
} else {
|
||||
mLlBtns.setVisibility(View.VISIBLE);
|
||||
mllNeirong.setVisibility(View.GONE);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
mTvLeState.setText("已通过");
|
||||
mLlBtns.setVisibility(View.GONE);
|
||||
mllNeirong.setVisibility(View.VISIBLE);
|
||||
mTvNeiron.setText(leaveDetailBean.getLeaveRefuseSummary());
|
||||
break;
|
||||
case 2:
|
||||
mTvLeState.setText("拒绝");
|
||||
mllNeirong.setVisibility(View.VISIBLE);
|
||||
mLlBtns.setVisibility(View.GONE);
|
||||
mTvNeiron.setText(leaveDetailBean.getLeaveRefuseSummary());
|
||||
break;
|
||||
}
|
||||
if (!TextUtils.isEmpty(leaveDetailBean.getLeaveType())) {
|
||||
switch (leaveDetailBean.getLeaveType()) {
|
||||
case "ill":
|
||||
mTvLeTypeContent.setText("有病");
|
||||
break;
|
||||
case "busy":
|
||||
mTvLeTypeContent.setText("有事");
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
refreshView(STATE_LOAD_EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
refreshView(STATE_LOAD_ERROR);
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (mBind != null) {
|
||||
mBind.unbind();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,176 @@
|
||||
package com.sucstepsoft.realtimelocation.activitys.mine;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
|
||||
import com.jcodecraeer.xrecyclerview.ProgressStyle;
|
||||
import com.jcodecraeer.xrecyclerview.XRecyclerView;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.utils.ToastUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.activitys.issue.IssueDetailActivity;
|
||||
import com.sucstepsoft.realtimelocation.adapters.IssueSubAdapter;
|
||||
import com.sucstepsoft.realtimelocation.adapters.LeaveHistoryAdapter;
|
||||
import com.sucstepsoft.realtimelocation.beans.IssueSubBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.LeaveListBean;
|
||||
import com.sucstepsoft.realtimelocation.net.LocationApiService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.Scheduler;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* 请假记录
|
||||
*/
|
||||
public class LeaveHistoryActivity extends BaseActivity {
|
||||
|
||||
|
||||
@BindView(R.id.xlv_leave_record)
|
||||
XRecyclerView mXlvItems;
|
||||
private Unbinder mBind;
|
||||
private String mRows = "20";
|
||||
private int mCurPage = 1;
|
||||
private LeaveHistoryAdapter mAdapter;
|
||||
private List<LeaveListBean.RowsBean> mDatas = new ArrayList<>();
|
||||
private Disposable mDisposable;
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
return R.layout.activity_leave_history;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
mBind = ButterKnife.bind(this);
|
||||
mTvBaseTitle.setText("请假记录");
|
||||
refreshView(STATE_LOAD_LOADING);
|
||||
mAdapter = new LeaveHistoryAdapter(mActivity, mDatas, 1);
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(mActivity);
|
||||
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
|
||||
mXlvItems.setLayoutManager(layoutManager);
|
||||
mXlvItems.setAdapter(mAdapter);
|
||||
mAdapter.addOnItemClickListener(bean -> showDetail(bean));
|
||||
mXlvItems.setRefreshProgressStyle(ProgressStyle.BallGridBeat);
|
||||
mXlvItems.setLoadingMoreProgressStyle(ProgressStyle.Pacman);
|
||||
mXlvItems.setPullRefreshEnabled(true);
|
||||
mXlvItems.setLoadingMoreEnabled(true);
|
||||
mXlvItems.setLoadingListener(new XRecyclerView.LoadingListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
refreshData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMore() {
|
||||
getUpcomingList(mCurPage);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void refreshData() {
|
||||
getUpcomingList(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
refreshData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取列表
|
||||
*/
|
||||
private void getUpcomingList(int page) {
|
||||
mCurPage = page;
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.getLeaveListByMine(mRows, page + "", UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<LeaveListBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(LeaveListBean leaveListBean) {
|
||||
if (leaveListBean != null && leaveListBean.getRows() != null && leaveListBean.getRows().size() > 0) {
|
||||
++mCurPage;
|
||||
if (page == 1) {
|
||||
mDatas.clear();
|
||||
mDatas.addAll(leaveListBean.getRows());
|
||||
} else {
|
||||
mDatas.addAll(leaveListBean.getRows());
|
||||
}
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
mXlvItems.refreshComplete();
|
||||
if (mDatas.size() >= leaveListBean.getTotal()) {
|
||||
mXlvItems.loadMoreComplete();
|
||||
mXlvItems.setNoMore(true);
|
||||
} else {
|
||||
mXlvItems.loadMoreComplete();
|
||||
mXlvItems.setNoMore(false);
|
||||
}
|
||||
} else {
|
||||
if (page > 1) {
|
||||
mXlvItems.loadMoreComplete();
|
||||
mXlvItems.setNoMore(true);
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
} else {
|
||||
//无数据
|
||||
refreshView(STATE_LOAD_EMPTY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
ToastUtils.showShort("数据加载失败,请稍后重试");
|
||||
refreshView(STATE_LOAD_ERROR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示详细内容
|
||||
*
|
||||
* @param bean
|
||||
*/
|
||||
private void showDetail(LeaveListBean.RowsBean bean) {
|
||||
Intent intent = new Intent(LeaveHistoryActivity.this, LeaveDetailActivity.class);
|
||||
intent.putExtra("type", "show");
|
||||
intent.putExtra("data", bean);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (mDisposable != null && !mDisposable.isDisposed()) {
|
||||
mDisposable.dispose();
|
||||
}
|
||||
mXlvItems.destroy();
|
||||
mXlvItems = null;
|
||||
if (mBind != null) {
|
||||
mBind.unbind();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
@ -0,0 +1,614 @@
|
||||
package com.sucstepsoft.realtimelocation.activitys.mine;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.provider.MediaStore;
|
||||
import android.provider.Settings;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.content.FileProvider;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Base64;
|
||||
import android.view.Gravity;
|
||||
import android.widget.Button;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.resource.bitmap.CircleCrop;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.google.gson.Gson;
|
||||
import com.sucstepsoft.cm_utils.constant.PathConfig;
|
||||
import com.sucstepsoft.cm_utils.core.network.update.CheckUpdateUtils;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.BaseUrlApi;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.core.widget.views.ButtomDialogView;
|
||||
import com.sucstepsoft.cm_utils.utils.AppUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.EncryptUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.FileIOUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.FileUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.LogUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.ProiderUtil;
|
||||
import com.sucstepsoft.cm_utils.utils.TimeUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.ToastUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.UIUtil;
|
||||
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.beans.AppTokenUser;
|
||||
import com.sucstepsoft.realtimelocation.beans.BaseUserBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.ChangeUserInfoBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.LoginUser;
|
||||
import com.sucstepsoft.realtimelocation.beans.SuccessBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.VersionBean;
|
||||
import com.sucstepsoft.realtimelocation.net.LocationApiService;
|
||||
import com.sucstepsoft.realtimelocation.services.GlobalProvider;
|
||||
import com.sucstepsoft.realtimelocation.utils.AesUtil;
|
||||
import com.sucstepsoft.realtimelocation.utils.ExceptionHandler;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.MultipartBody;
|
||||
import okhttp3.RequestBody;
|
||||
import top.zibin.luban.Luban;
|
||||
import top.zibin.luban.OnCompressListener;
|
||||
|
||||
public class UserActivity extends BaseActivity {
|
||||
@BindView(R.id.ll_change_pwd)
|
||||
LinearLayout mLlChangePwd;
|
||||
@BindView(R.id.ll_user_info)
|
||||
LinearLayout mLlUserInfo;
|
||||
@BindView(R.id.iv_user_icon)
|
||||
ImageView mIvUserIcon;
|
||||
@BindView(R.id.tv_user_name)
|
||||
TextView mTvUserName;
|
||||
@BindView(R.id.rl_main_bg)
|
||||
RelativeLayout mRlMainBg;
|
||||
@BindView(R.id.btn_submit)
|
||||
Button mBtnSubmit;
|
||||
@BindView(R.id.rl_clear_cache)
|
||||
RelativeLayout mRlClearCache;
|
||||
@BindView(R.id.rl_check_version)
|
||||
RelativeLayout mRlCheckVersion;
|
||||
@BindView(R.id.tv_upload_avatar)
|
||||
TextView mTvUploadAvatar;
|
||||
@BindView(R.id.tv_cache_num)
|
||||
TextView mTvCacheNum;
|
||||
@BindView(R.id.tv_version_num)
|
||||
TextView mTvVersionNum;
|
||||
@BindView(R.id.tv_depart)
|
||||
TextView mTvDepart;
|
||||
@BindView(R.id.sw_mode)
|
||||
Switch mSwMode;
|
||||
@BindView(R.id.rl_leave)
|
||||
RelativeLayout mRlLeave;
|
||||
@BindView(R.id.rl_leave_check)
|
||||
RelativeLayout mRlLeaveCheck;
|
||||
private String mPicPath;
|
||||
private Unbinder mBind;
|
||||
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
return R.layout.activity_user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
mBind = ButterKnife.bind(this);
|
||||
mTvBaseTitle.setText("个人中心");
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
mLlChangePwd.setOnClickListener(v -> choosePage(1));
|
||||
mLlUserInfo.setOnClickListener(v -> choosePage(2));
|
||||
mBtnSubmit.setOnClickListener(v -> loginOut());
|
||||
mRlCheckVersion.setOnClickListener(v -> checkPermission());
|
||||
mRlClearCache.setOnClickListener(v -> doClearCache());
|
||||
mTvUploadAvatar.setOnClickListener(v -> changeUserIcon());
|
||||
mRlLeave.setOnClickListener(v -> choosePage(3));
|
||||
mRlLeaveCheck.setOnClickListener(v -> choosePage(4));
|
||||
String dirSize = FileUtils.getDirSize(PathConfig.PROJECT_CATCH_PATH);
|
||||
LogUtils.e(dirSize);
|
||||
mTvCacheNum.setText(dirSize);
|
||||
mTvVersionNum.setText("v " + AppUtils.getAppVersionName());
|
||||
mTvUserName.setText(UserLgUtils.getName());
|
||||
String loginInfo = UserLgUtils.getLoginInfo();
|
||||
if (!TextUtils.isEmpty(loginInfo)) {
|
||||
Gson mGson = new Gson();
|
||||
AppTokenUser appTokenUser = mGson.fromJson(loginInfo, AppTokenUser.class);
|
||||
String type = "片长";
|
||||
if (appTokenUser.getRoles() != null && appTokenUser.getRoles().size() > 0) {
|
||||
for (int i = 0; i < appTokenUser.getRoles().size(); i++) {
|
||||
if (PathConfig.USER_TYPE_N.equals(appTokenUser.getRoles().get(i).getRoleId())) {
|
||||
type = "N员";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
mTvDepart.setText(type);
|
||||
} else {
|
||||
mTvDepart.setText("片长");
|
||||
}
|
||||
Glide.with(mActivity)
|
||||
.load(BaseUrlApi.BASE_IMG_URL + UserLgUtils.getAvatar())
|
||||
.apply(RequestOptions.bitmapTransform(new CircleCrop())
|
||||
.error(R.drawable.ic_user_default)
|
||||
.placeholder(R.drawable.ic_user_default))
|
||||
.into(mIvUserIcon);
|
||||
String isHolday = GlobalProvider.getString(mActivity, "isHolday");
|
||||
if (!TextUtils.isEmpty(isHolday)) {
|
||||
if ("1".equals(isHolday)) {
|
||||
mSwMode.setChecked(true);
|
||||
} else {
|
||||
mSwMode.setChecked(false);
|
||||
}
|
||||
}
|
||||
mSwMode.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
if (isChecked) {
|
||||
GlobalProvider.save(mActivity, "isHolday", "1");
|
||||
} else {
|
||||
GlobalProvider.save(mActivity, "isHolday", "0");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择上传的图片
|
||||
*/
|
||||
private void changeUserIcon() {
|
||||
ButtomDialogView buttomDialogView = new ButtomDialogView.DialogBuilder(mActivity)
|
||||
.setIsBackCancelable(true)
|
||||
.setIscancelable(true)
|
||||
.setShowLocation(Gravity.BOTTOM)
|
||||
.setIsShowFile(false)
|
||||
.build();
|
||||
buttomDialogView.addOnChoseListener(new ButtomDialogView.OnChoseListener() {
|
||||
@Override
|
||||
public void choseFile() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void choseAlbum() {
|
||||
Intent intent = new Intent(Intent.ACTION_PICK, null);
|
||||
intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
|
||||
"image/*");
|
||||
startActivityForResult(intent, BaseUrlApi.PHOTO_REQUEST);
|
||||
buttomDialogView.dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void choseShoot() {
|
||||
mPicPath = PathConfig.CATCH_PATH + System.currentTimeMillis() + ".jpg";
|
||||
File file = new File(mPicPath);
|
||||
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
// 下面这句指定调用相机拍照后的照片存储的路径
|
||||
Uri uri;
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
|
||||
uri = Uri.fromFile(file);
|
||||
} else {
|
||||
uri = FileProvider.getUriForFile(mActivity, ProiderUtil.getFileProviderName(mActivity), file);
|
||||
}
|
||||
intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
|
||||
startActivityForResult(intent, BaseUrlApi.CAMERA_REQUEST);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loginOut() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changePwd() {
|
||||
|
||||
}
|
||||
});
|
||||
buttomDialogView.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (resultCode == RESULT_OK) {
|
||||
switch (requestCode) {
|
||||
case BaseUrlApi.CAMERA_REQUEST://相机
|
||||
uploadImg(mPicPath, 1);
|
||||
break;
|
||||
case BaseUrlApi.PHOTO_REQUEST://相册
|
||||
try {
|
||||
if (data == null) return;
|
||||
Uri uri = data.getData();
|
||||
String[] proj = {MediaStore.Images.Media.DATA};
|
||||
Cursor cursor = managedQuery(uri, proj, null, null, null);
|
||||
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
|
||||
cursor.moveToFirst();
|
||||
String srcPath = cursor.getString(column_index);
|
||||
uploadImg(srcPath, 2);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
case 10086:
|
||||
checkPermission();
|
||||
break;
|
||||
}
|
||||
}
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
|
||||
private void uploadImg(String picPath, int i) {
|
||||
File file = new File(picPath);
|
||||
if (!file.exists()) {
|
||||
showToast("图片路径错误.");
|
||||
return;
|
||||
}
|
||||
int[] imageWidthHeight = getImageWidthHeight(picPath);
|
||||
if (imageWidthHeight[0] > 413 || imageWidthHeight[1] > 626) {
|
||||
ToastUtils.showShort("图片宽度必须小于等于413像素,高度必须小于626像素");
|
||||
} else {
|
||||
doUploaddImg(picPath);
|
||||
}
|
||||
}
|
||||
|
||||
private void doUploaddImg(String picPath) {
|
||||
ProgressDialog progressDialog = UIUtil.initDialog(mActivity, "头像修改中...");
|
||||
progressDialog.show();
|
||||
Luban.with(mActivity)
|
||||
.load(picPath)
|
||||
.ignoreBy(100)
|
||||
.setTargetDir(PathConfig.CATCH_PATH)
|
||||
.filter(path -> !(TextUtils.isEmpty(path) || path.toLowerCase().endsWith(".gif")))
|
||||
.setCompressListener(new OnCompressListener() {
|
||||
@Override
|
||||
public void onStart() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(File file) {
|
||||
RequestBody requestFile = RequestBody.create(MediaType.parse("multipart/form-data"), file);
|
||||
MultipartBody.Part body = MultipartBody.Part.createFormData("image", file.getName(), requestFile);
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.uploadImage(body, UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseUserBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseUserBean baseUserBean) {
|
||||
changeUserInfo(baseUserBean.getData(), progressDialog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
if (progressDialog != null && progressDialog.isShowing()) {
|
||||
progressDialog.dismiss();
|
||||
}
|
||||
ToastUtils.showShort("头像修改失败,请稍后重试.");
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
if (progressDialog.isShowing()) {
|
||||
progressDialog.dismiss();
|
||||
}
|
||||
ToastUtils.showShort("头像修改失败,请稍后重试");
|
||||
}
|
||||
})
|
||||
.launch();
|
||||
}
|
||||
|
||||
public int[] getImageWidthHeight(String path) {
|
||||
BitmapFactory.Options options = new BitmapFactory.Options();
|
||||
options.inJustDecodeBounds = true;
|
||||
Bitmap bitmap = BitmapFactory.decodeFile(path, options);
|
||||
return new int[]{options.outWidth, options.outHeight};
|
||||
}
|
||||
|
||||
private void changeUserInfo(String id, ProgressDialog dialog) {
|
||||
ChangeUserInfoBean bean = new ChangeUserInfoBean();
|
||||
bean.setAvatar(id);
|
||||
bean.setEmail(UserLgUtils.getEmail());
|
||||
bean.setPhone(UserLgUtils.getPhone());
|
||||
bean.setName(UserLgUtils.getName());
|
||||
Gson gson = new Gson();
|
||||
String obj = gson.toJson(bean);
|
||||
RequestBody body = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), obj);
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.doChangeUserInfo(body, UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<SuccessBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(SuccessBean successBean) {
|
||||
doLoginApp(UserLgUtils.getUserName(), UserLgUtils.getPassword(), dialog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
dialog.dismiss();
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private String getDeviceId() {
|
||||
String filePath = PathConfig.IDENTITY_FILE;
|
||||
File file = new File(filePath);
|
||||
String uuid = "";
|
||||
if (!file.exists()) {
|
||||
try {
|
||||
boolean newFile = file.createNewFile();
|
||||
uuid = UUID.randomUUID().toString();
|
||||
FileIOUtils.writeFileFromString(file, uuid);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
uuid = FileIOUtils.readFile2String(file);
|
||||
}
|
||||
return uuid;
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录
|
||||
*/
|
||||
private void doLoginApp(String name, String pwd, ProgressDialog dialog) {
|
||||
String md5Pwd = EncryptUtils.encryptMD5ToStringTimes(pwd, 3);
|
||||
TelephonyManager manager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
|
||||
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
|
||||
ToastUtils.showShort("未授权");
|
||||
return;
|
||||
}
|
||||
String deviceId = manager.getDeviceId();
|
||||
if (TextUtils.isEmpty(deviceId)) {
|
||||
deviceId = getDeviceId();
|
||||
}
|
||||
LoginUser info = new LoginUser();
|
||||
info.setAppVersion(AppUtils.getAppVersionCode());
|
||||
info.setAppId(PathConfig.APP_VERSION_ID);
|
||||
info.setPassword(md5Pwd);
|
||||
info.setUsername(name);
|
||||
info.setDeviceNo(deviceId);
|
||||
Gson gson = new Gson();
|
||||
String obj = gson.toJson(info);
|
||||
RequestBody body = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), obj);
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.doLogin(body)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseUserBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseUserBean baseUserBean) {
|
||||
dialog.dismiss();
|
||||
if (!TextUtils.isEmpty(baseUserBean.getData())) {
|
||||
byte[] decode = Base64.decode(baseUserBean.getData(), Base64.DEFAULT);
|
||||
try {
|
||||
String loginUserInfo = AesUtil.aesCommonDecoder(PathConfig.SECRET, new String(decode, "UTF-8"));
|
||||
LogUtils.e(loginUserInfo);
|
||||
if (!TextUtils.isEmpty(loginUserInfo)) {
|
||||
AppTokenUser appTokenUser = gson.fromJson(loginUserInfo, AppTokenUser.class);
|
||||
UserLgUtils.setLoginInfo(loginUserInfo);
|
||||
UserLgUtils.setAvatar(appTokenUser.getAvatar());
|
||||
UserLgUtils.setEmail(appTokenUser.getEmail());
|
||||
UserLgUtils.setId(appTokenUser.getId());
|
||||
UserLgUtils.setName(appTokenUser.getName());
|
||||
UserLgUtils.setUserName(appTokenUser.getUsername());
|
||||
UserLgUtils.setPhone(appTokenUser.getPhone());
|
||||
UserLgUtils.setToken(baseUserBean.getData());
|
||||
GlobalProvider.save(mActivity, "token", baseUserBean.getData());
|
||||
UserLgUtils.setPassword(pwd);
|
||||
Glide.with(mActivity)
|
||||
.load(BaseUrlApi.BASE_IMG_URL + appTokenUser.getAvatar())
|
||||
.apply(RequestOptions.bitmapTransform(new CircleCrop())
|
||||
.error(R.drawable.ic_user_default)
|
||||
.placeholder(R.drawable.ic_user_default))
|
||||
.into(mIvUserIcon);
|
||||
ToastUtils.showShort("头像修改成功.");
|
||||
} else {
|
||||
ToastUtils.showShort("头像修改失败,请稍后重试.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
ToastUtils.showShort("头像修改失败,请稍后重试.");
|
||||
}
|
||||
} else {
|
||||
ToastUtils.showShort("头像修改失败,请稍后重试.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
dialog.dismiss();
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除缓存
|
||||
*/
|
||||
private void doClearCache() {
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle("提示")
|
||||
.setMessage("确认要清除缓存文件吗?")
|
||||
.setPositiveButton("确定", (dialog, which) -> {
|
||||
dialog.dismiss();
|
||||
boolean b = FileUtils.deleteFilesInDir(PathConfig.CATCH_PATH);
|
||||
if (b) {
|
||||
ToastUtils.showShort("清除成功");
|
||||
mTvCacheNum.setText("0.00MB");
|
||||
}
|
||||
})
|
||||
.setNegativeButton("取消", (dialog, which) -> dialog.dismiss());
|
||||
builder.create().show();
|
||||
}
|
||||
|
||||
private void checkPermission() {
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
|
||||
boolean isInstall = getPackageManager().canRequestPackageInstalls();
|
||||
if (isInstall) {
|
||||
checkVersion();
|
||||
} else {
|
||||
ToastUtils.showLong("App升级需要使用安装未知来源的权限,请授权.");
|
||||
Intent intent = new Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES);
|
||||
startActivityForResult(intent, 10086);
|
||||
}
|
||||
} else {
|
||||
checkVersion();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查版本
|
||||
*/
|
||||
private void checkVersion() {
|
||||
ProgressDialog dialog = UIUtil.initDialog(mActivity, "检查中...");
|
||||
dialog.show();
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.doCheckAppVersion(PathConfig.APP_VERSION_ID, UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<VersionBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(VersionBean successBean) {
|
||||
dialog.dismiss();
|
||||
if (successBean != null && successBean.getData() > 0) {
|
||||
if (CheckUpdateUtils.checkcode(UserActivity.this, successBean.getData() + "")) {
|
||||
CheckUpdateUtils.checkUpdate(UserActivity.this,
|
||||
successBean.getData(),
|
||||
BaseUrlApi.APP_DOWNLOAD_URL,
|
||||
"2", "发现新版本.");
|
||||
} else {
|
||||
ToastUtils.showShort("已经是最新版本.");
|
||||
}
|
||||
} else {
|
||||
ToastUtils.showShort("已经是最新版本.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
dialog.dismiss();
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出登录
|
||||
*/
|
||||
private void loginOut() {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(PathConfig.ACTION_STOP_LOCATION);
|
||||
sendBroadcast(intent);
|
||||
GlobalProvider.save(mActivity, "isUpload", "12");
|
||||
GlobalProvider.save(mActivity, "token", "");
|
||||
UserLgUtils.setPassword("");
|
||||
// exitLocationService();
|
||||
reStartApp();
|
||||
}
|
||||
|
||||
private void exitLocationService() {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction("com.sucstepsoft.realtimelocation.exit");
|
||||
sendBroadcast(intent);
|
||||
}
|
||||
|
||||
private void choosePage(int type) {
|
||||
switch (type) {
|
||||
case 1:
|
||||
startActivity(new Intent(UserActivity.this, ChangePwdActivity.class));
|
||||
break;
|
||||
case 2:
|
||||
startActivity(new Intent(UserActivity.this, UserInfoActivity.class));
|
||||
break;
|
||||
case 3:
|
||||
startActivity(new Intent(UserActivity.this, LeaveActivity.class));
|
||||
break;
|
||||
case 4:
|
||||
startActivity(new Intent(UserActivity.this, LeaveCheckListActivity.class));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (mBind != null) {
|
||||
mBind.unbind();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,325 @@
|
||||
package com.sucstepsoft.realtimelocation.activitys.mine;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Color;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Base64;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
|
||||
import com.bigkoo.pickerview.builder.TimePickerBuilder;
|
||||
import com.bigkoo.pickerview.view.OptionsPickerView;
|
||||
import com.bigkoo.pickerview.view.TimePickerView;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.resource.bitmap.CircleCrop;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.google.gson.Gson;
|
||||
import com.sucstepsoft.cm_utils.constant.PathConfig;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.BaseUrlApi;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.utils.AppUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.EncryptUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.FileIOUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.LogUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.ToastUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.UIUtil;
|
||||
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.beans.AppTokenUser;
|
||||
import com.sucstepsoft.realtimelocation.beans.BaseUserBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.ChangeUserInfoBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.LoginUser;
|
||||
import com.sucstepsoft.realtimelocation.beans.SuccessBean;
|
||||
import com.sucstepsoft.realtimelocation.net.LocationApiService;
|
||||
import com.sucstepsoft.realtimelocation.utils.AesUtil;
|
||||
import com.sucstepsoft.realtimelocation.utils.ExceptionHandler;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
/**
|
||||
* createTime:2019-8-1
|
||||
* 个人信息详情
|
||||
*/
|
||||
public class UserInfoActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.et_user_name)
|
||||
EditText mEtUserName;
|
||||
@BindView(R.id.tv_sel_gender)
|
||||
TextView mTvSelGender;
|
||||
@BindView(R.id.tv_sel_birth)
|
||||
TextView mTvSelBirth;
|
||||
@BindView(R.id.et_user_phone)
|
||||
EditText mEtUserPhone;
|
||||
@BindView(R.id.et_user_email)
|
||||
EditText mEtUserEmail;
|
||||
@BindView(R.id.btn_submit)
|
||||
Button mBtnSubmit;
|
||||
private Unbinder mBind;
|
||||
private TimePickerView mTimePickerView;
|
||||
private SimpleDateFormat mDateFormat = new SimpleDateFormat("yyyy年MM月dd日");
|
||||
private String mSelBrith;
|
||||
private OptionsPickerView<String> mGenderPickerView;
|
||||
private List<String> mGenders = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
return R.layout.activity_user_info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
mBind = ButterKnife.bind(this);
|
||||
mTvBaseTitle.setText("个人信息");
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
mGenders.add("男");
|
||||
mGenders.add("女");
|
||||
mTvSelBirth.setOnClickListener(v -> showBirthDialog());
|
||||
mTvSelGender.setOnClickListener(v -> showGenderDialog());
|
||||
//回显姓名
|
||||
if (!TextUtils.isEmpty(UserLgUtils.getName())) {
|
||||
mEtUserName.setText(UserLgUtils.getName());
|
||||
}
|
||||
//回显联系电话
|
||||
if (!TextUtils.isEmpty(UserLgUtils.getPhone())) {
|
||||
mEtUserPhone.setText(UserLgUtils.getPhone());
|
||||
}
|
||||
//回显邮箱
|
||||
if (!TextUtils.isEmpty(UserLgUtils.getEmail())) {
|
||||
mEtUserEmail.setText(UserLgUtils.getEmail());
|
||||
}
|
||||
mBtnSubmit.setOnClickListener(v -> doSubmit());
|
||||
setEditTextInhibitInputSpeChat(mEtUserEmail);
|
||||
setEditTextInhibitInputSpeChat(mEtUserName);
|
||||
setEditTextInhibitInputSpeChat(mEtUserPhone);
|
||||
}
|
||||
|
||||
private void doSubmit() {
|
||||
if (checkParams()) {
|
||||
String name = mEtUserName.getText().toString().trim();
|
||||
String phone = mEtUserPhone.getText().toString().trim();
|
||||
String email = mEtUserEmail.getText().toString().trim();
|
||||
ChangeUserInfoBean bean = new ChangeUserInfoBean();
|
||||
bean.setAvatar(UserLgUtils.getAvatar());
|
||||
bean.setEmail(email);
|
||||
bean.setPhone(phone);
|
||||
bean.setName(name);
|
||||
Gson gson = new Gson();
|
||||
String obj = gson.toJson(bean);
|
||||
RequestBody body = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), obj);
|
||||
ProgressDialog dialog = UIUtil.initDialog(mActivity, "修改中...");
|
||||
dialog.show();
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.doChangeUserInfo(body, UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<SuccessBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(SuccessBean successBean) {
|
||||
doLoginApp(UserLgUtils.getUserName(), UserLgUtils.getPassword(), dialog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
dialog.dismiss();
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private String getDeviceId() {
|
||||
String filePath = PathConfig.IDENTITY_FILE;
|
||||
File file = new File(filePath);
|
||||
String uuid = "";
|
||||
if (!file.exists()) {
|
||||
try {
|
||||
boolean newFile = file.createNewFile();
|
||||
uuid = UUID.randomUUID().toString();
|
||||
FileIOUtils.writeFileFromString(file, uuid);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
uuid = FileIOUtils.readFile2String(file);
|
||||
}
|
||||
return uuid;
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录
|
||||
*/
|
||||
private void doLoginApp(String name, String pwd, ProgressDialog dialog) {
|
||||
String md5Pwd = EncryptUtils.encryptMD5ToStringTimes(pwd, 3);
|
||||
TelephonyManager manager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
|
||||
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
|
||||
ToastUtils.showShort("未授权");
|
||||
return;
|
||||
}
|
||||
String deviceId = manager.getDeviceId();
|
||||
if (TextUtils.isEmpty(deviceId)) {
|
||||
deviceId = getDeviceId();
|
||||
}
|
||||
LoginUser info = new LoginUser();
|
||||
info.setAppVersion(AppUtils.getAppVersionCode());
|
||||
info.setAppId(PathConfig.APP_VERSION_ID);
|
||||
info.setPassword(md5Pwd);
|
||||
info.setUsername(name);
|
||||
info.setDeviceNo(deviceId);
|
||||
Gson gson = new Gson();
|
||||
String obj = gson.toJson(info);
|
||||
RequestBody body = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), obj);
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.doLogin(body)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseUserBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseUserBean baseUserBean) {
|
||||
dialog.dismiss();
|
||||
if (!TextUtils.isEmpty(baseUserBean.getData())) {
|
||||
byte[] decode = Base64.decode(baseUserBean.getData(), Base64.DEFAULT);
|
||||
try {
|
||||
String loginUserInfo = AesUtil.aesCommonDecoder(PathConfig.SECRET, new String(decode, "UTF-8"));
|
||||
LogUtils.e(loginUserInfo);
|
||||
if (!TextUtils.isEmpty(loginUserInfo)) {
|
||||
AppTokenUser appTokenUser = gson.fromJson(loginUserInfo, AppTokenUser.class);
|
||||
UserLgUtils.setLoginInfo(loginUserInfo);
|
||||
UserLgUtils.setAvatar(appTokenUser.getAvatar());
|
||||
UserLgUtils.setEmail(appTokenUser.getEmail());
|
||||
UserLgUtils.setId(appTokenUser.getId());
|
||||
UserLgUtils.setName(appTokenUser.getName());
|
||||
UserLgUtils.setUserName(appTokenUser.getUsername());
|
||||
UserLgUtils.setPhone(appTokenUser.getPhone());
|
||||
UserLgUtils.setToken(baseUserBean.getData());
|
||||
UserLgUtils.setPassword(pwd);
|
||||
ToastUtils.showShort("个人信息修改成功.");
|
||||
} else {
|
||||
ToastUtils.showShort("个人信息修改失败.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
ToastUtils.showShort("个人信息修改失败.");
|
||||
}
|
||||
} else {
|
||||
ToastUtils.showShort("个人信息修改失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
dialog.dismiss();
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private boolean checkParams() {
|
||||
String name = mEtUserName.getText().toString().trim();
|
||||
String phone = mEtUserPhone.getText().toString().trim();
|
||||
String email = mEtUserEmail.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(name)) {
|
||||
ToastUtils.showShort("请输入姓名");
|
||||
return false;
|
||||
}
|
||||
if (TextUtils.isEmpty(phone)) {
|
||||
ToastUtils.showShort("请输入联系电话");
|
||||
return false;
|
||||
}
|
||||
if (TextUtils.isEmpty(email)) {
|
||||
ToastUtils.showShort("请输入联系邮箱");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 出生日期选择
|
||||
*/
|
||||
private void showBirthDialog() {
|
||||
hideSoftKeyboard();
|
||||
if (mTimePickerView == null) {
|
||||
mTimePickerView = new TimePickerBuilder(UserInfoActivity.this, (date, v) -> {
|
||||
mTvSelBirth.setText(mDateFormat.format(date));
|
||||
mSelBrith = mDateFormat.format(date);
|
||||
})
|
||||
.setTitleText("请选出生日期")
|
||||
.setCancelColor(Color.parseColor("#1189FF"))
|
||||
.setSubmitColor(Color.parseColor("#1189FF"))
|
||||
.setType(new boolean[]{true, true, true, false, false, false})
|
||||
.setTitleColor(Color.parseColor("#1189FF"))
|
||||
.build();
|
||||
}
|
||||
mTimePickerView.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* 性别选择
|
||||
*/
|
||||
private void showGenderDialog() {
|
||||
hideSoftKeyboard();
|
||||
if (mGenderPickerView == null) {
|
||||
mGenderPickerView = new OptionsPickerBuilder(UserInfoActivity.this, (options1, options2, options3, v) ->
|
||||
mTvSelGender.setText(mGenders.get(options1)))
|
||||
.setTitleText("请选择性别")
|
||||
.setCancelColor(Color.parseColor("#1189FF"))
|
||||
.setSubmitColor(Color.parseColor("#1189FF"))
|
||||
.setTitleColor(Color.parseColor("#1189FF"))
|
||||
.build();
|
||||
mGenderPickerView.setPicker(mGenders);
|
||||
}
|
||||
mGenderPickerView.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (mBind != null) {
|
||||
mBind.unbind();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
package com.sucstepsoft.realtimelocation.activitys.notice;
|
||||
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentStatePagerAdapter;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.core.widget.xtablayout.XTabLayout;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.fragments.issue.PendingFragment;
|
||||
import com.sucstepsoft.realtimelocation.fragments.mine.NewsFragment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
|
||||
/**
|
||||
* createTime:2019-8-6
|
||||
* 通知公告
|
||||
*/
|
||||
public class NoticeActivity extends BaseActivity {
|
||||
@BindView(R.id.xtl_tabs)
|
||||
XTabLayout mTablayout;
|
||||
@BindView(R.id.vp_content)
|
||||
ViewPager mVpContent;
|
||||
|
||||
private Unbinder mBind;
|
||||
private String[] mTitles = new String[]{"通知公告", "全民宣传", "每日通报"};
|
||||
private List<Fragment> mFragments = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
return R.layout.activity_notice;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
mBind = ButterKnife.bind(this);
|
||||
mTvBaseTitle.setText("通知公告");
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
// 通知公告:notice;全民宣传:propaganda;每日通报:daily
|
||||
String type = getIntent().getStringExtra("type");
|
||||
NewsFragment noticeFragment = new NewsFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("type", "notice");
|
||||
noticeFragment.setArguments(bundle);
|
||||
NewsFragment publicFragment = new NewsFragment();
|
||||
Bundle bundle1 = new Bundle();
|
||||
bundle1.putString("type", "propaganda");
|
||||
publicFragment.setArguments(bundle1);
|
||||
NewsFragment avisoFragment = new NewsFragment();
|
||||
Bundle bundle2 = new Bundle();
|
||||
bundle2.putString("type", "daily");
|
||||
avisoFragment.setArguments(bundle2);
|
||||
mFragments.add(noticeFragment);
|
||||
mFragments.add(publicFragment);
|
||||
mFragments.add(avisoFragment);
|
||||
VpNoticeAdapter adapter = new VpNoticeAdapter(getSupportFragmentManager());
|
||||
mVpContent.setAdapter(adapter);
|
||||
mTablayout.setxTabDisplayNum(3);
|
||||
mTablayout.setupWithViewPager(mVpContent);
|
||||
if (!TextUtils.isEmpty(type)) {
|
||||
mVpContent.setCurrentItem(2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (mBind != null) {
|
||||
mBind.unbind();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
private class VpNoticeAdapter extends FragmentStatePagerAdapter {
|
||||
|
||||
public VpNoticeAdapter(FragmentManager fm) {
|
||||
super(fm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fragment getItem(int i) {
|
||||
return mFragments.get(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mFragments.size();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
return mTitles[position];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,193 @@
|
||||
package com.sucstepsoft.realtimelocation.activitys.notice;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Build;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewParent;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.ZoomButtonsController;
|
||||
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.utils.ToastUtils;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.beans.NewsListBean;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
|
||||
/**
|
||||
* 通知公告-详情
|
||||
*/
|
||||
public class NoticeDetailActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.tv_notice_title)
|
||||
TextView mTvNoticeTitle;
|
||||
@BindView(R.id.tv_notice_time)
|
||||
TextView mTvNoticeTime;
|
||||
@BindView(R.id.tv_notice_gator)
|
||||
TextView mTvNoticeGator;
|
||||
@BindView(R.id.ll_content)
|
||||
LinearLayout mLlContent;
|
||||
private Unbinder mBind;
|
||||
private String content;
|
||||
private WebView wvContent;//发布的详情
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
return R.layout.activity_notice_detail;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
mBind = ButterKnife.bind(this);
|
||||
mTvBaseTitle.setText("详情");
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
NewsListBean.RowsBean bean = (NewsListBean.RowsBean) getIntent().getSerializableExtra("bean");
|
||||
if (bean != null) {
|
||||
setDataToView(bean);
|
||||
} else {
|
||||
ToastUtils.showShort("数据有误");
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
private void setDataToView(NewsListBean.RowsBean bean) {
|
||||
mTvNoticeTitle.setText(bean.getNewsTitle());
|
||||
mTvNoticeGator.setText(bean.getNewsAuthor());
|
||||
mTvNoticeTime.setText(bean.getNewsTime());
|
||||
content = bean.getNewsContent();
|
||||
wvContent = new WebView(getApplicationContext());
|
||||
initWebView();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化WevView
|
||||
*/
|
||||
private void initWebView() {
|
||||
mLlContent.addView(wvContent);
|
||||
WebSettings webSettings = wvContent.getSettings();
|
||||
webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
|
||||
webSettings.setBuiltInZoomControls(true);//显示放大缩小按钮(不支持已经适配好移动端的页面)
|
||||
webSettings.setJavaScriptEnabled(true);//启用JS
|
||||
webSettings.setUseWideViewPort(true); //双击缩放
|
||||
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
|
||||
webSettings.setLoadWithOverviewMode(true);
|
||||
webSettings.setSupportZoom(true);
|
||||
disableControls(webSettings);
|
||||
webSettings.setDefaultTextEncodingName("UTF-8");
|
||||
webSettings.setBlockNetworkImage(false);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||
}
|
||||
webSettings.setLoadsImagesAutomatically(true);
|
||||
webSettings.setAllowFileAccess(true);
|
||||
wvContent.addJavascriptInterface(new AndroidListener(), "android");
|
||||
wvContent.setWebViewClient(new WebViewClient() {
|
||||
@Override
|
||||
public void onPageStarted(WebView view, String url, Bitmap favicon) {
|
||||
super.onPageStarted(view, url, favicon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
//所有跳转链接强制在当前webview加载,不跳浏览器
|
||||
view.loadUrl(url);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
super.onPageFinished(view, url);
|
||||
imgReset();
|
||||
}
|
||||
});
|
||||
wvContent.loadUrl("file:///android_asset/news_detail/index.html");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (wvContent != null && wvContent.canGoBack()) {
|
||||
wvContent.goBack();
|
||||
} else {
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
private void disableControls(WebSettings settings) {
|
||||
//基本的设置
|
||||
if (Build.VERSION.SDK_INT >= 8) {
|
||||
settings.setPluginState(WebSettings.PluginState.ON);
|
||||
}
|
||||
wvContent.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
|
||||
//去掉滚动条
|
||||
wvContent.setVerticalScrollBarEnabled(false);
|
||||
wvContent.setHorizontalScrollBarEnabled(false);
|
||||
|
||||
//去掉缩放按钮
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
|
||||
wvContent.getSettings().setBuiltInZoomControls(true);
|
||||
wvContent.getSettings().setDisplayZoomControls(false);
|
||||
} else {
|
||||
getControlls();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void getControlls() {
|
||||
try {
|
||||
Class webview = Class.forName("android.webkit.WebView");
|
||||
Method method = webview.getMethod("getZoomButtonsController");
|
||||
ZoomButtonsController zoom_controll = (ZoomButtonsController) method.invoke(this, true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class AndroidListener {
|
||||
@JavascriptInterface
|
||||
public String getData() {//
|
||||
return content;
|
||||
}
|
||||
}
|
||||
|
||||
private void imgReset() {
|
||||
wvContent.loadUrl("javascript:(function(){"
|
||||
+ "var objs = document.getElementsByTagName('img'); "
|
||||
+ "for(var i=0;i<objs.length;i++) " + "{"
|
||||
+ "var img = objs[i]; "
|
||||
+ " img.style.width = '100%'; "
|
||||
+ " img.style.height = 'auto'; "
|
||||
+ "}" + "})()");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (wvContent != null) {
|
||||
ViewParent parent = wvContent.getParent();
|
||||
if (parent != null) {
|
||||
((ViewGroup) parent).removeView(wvContent);
|
||||
}
|
||||
wvContent.stopLoading();
|
||||
wvContent.getSettings().setJavaScriptEnabled(false);
|
||||
wvContent.clearHistory();
|
||||
wvContent.clearView();
|
||||
wvContent.removeAllViews();
|
||||
wvContent.destroy();
|
||||
}
|
||||
if (mBind != null) {
|
||||
mBind.unbind();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.sucstepsoft.realtimelocation.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseRecyclerAdapter;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.adapters.holders.AddressListBaseHolder;
|
||||
import com.sucstepsoft.realtimelocation.beans.AddressListBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.DepartmentBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 作者: Adam
|
||||
* 日期: 2019/8/14 - 16:01
|
||||
* 邮箱: itgaojian@163.com
|
||||
* 描述:
|
||||
*/
|
||||
public class AddressListBaseAdapter extends BaseRecyclerAdapter<DepartmentBean, AddressListBaseHolder> {
|
||||
public AddressListBaseAdapter(Context ctx, List<DepartmentBean> list) {
|
||||
super(ctx, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddressListBaseHolder createHolder(ViewGroup parent, int viewType) {
|
||||
View itemView = LayoutInflater.from(mContext).inflate(R.layout.item_address_list_depart_main, parent, false);
|
||||
return new AddressListBaseHolder(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindHolder(AddressListBaseHolder holder, int i) {
|
||||
holder.mTvName.setText(mData.get(i).getName());
|
||||
List<AddressListBean.DepartmentsBean> departmentsBeanList = mData.get(i).getDepartmentsBeanList();
|
||||
List<AddressListBean.UsersBean> usersBeans = mData.get(i).getUsersBeans();
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package com.sucstepsoft.realtimelocation.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseRecyclerAdapter;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.adapters.holders.AddressListDepartHolder;
|
||||
import com.sucstepsoft.realtimelocation.beans.AddressListBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 作者: Adam
|
||||
* 日期: 2019/8/14 - 15:35
|
||||
* 邮箱: itgaojian@163.com
|
||||
* 描述:
|
||||
*/
|
||||
public class AddressListMainAdapter extends BaseRecyclerAdapter<AddressListBean.DepartmentsBean, AddressListDepartHolder> {
|
||||
public AddressListMainAdapter(Context ctx, List<AddressListBean.DepartmentsBean> list) {
|
||||
super(ctx, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddressListDepartHolder createHolder(ViewGroup parent, int viewType) {
|
||||
View itemView = LayoutInflater.from(mContext).inflate(R.layout.item_address_list_depart, parent, false);
|
||||
return new AddressListDepartHolder(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindHolder(AddressListDepartHolder addressListDepartHolder, int i) {
|
||||
addressListDepartHolder.mTvDName.setText(mData.get(i).getName());
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package com.sucstepsoft.realtimelocation.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseRecyclerAdapter;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.adapters.holders.AddressListTitleHolder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 作者: Adam
|
||||
* 日期: 2019/8/8 - 17:30
|
||||
* 邮箱: itgaojian@163.com
|
||||
* 描述:
|
||||
*/
|
||||
public class AddressListTitleAdapter extends BaseRecyclerAdapter<String, AddressListTitleHolder> {
|
||||
private ItemClickListener mClickListener;
|
||||
|
||||
public AddressListTitleAdapter(Context ctx, List<String> list) {
|
||||
super(ctx, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddressListTitleHolder createHolder(ViewGroup parent, int viewType) {
|
||||
View itemView = LayoutInflater.from(mContext).inflate(R.layout.item_address_list_title, parent, false);
|
||||
return new AddressListTitleHolder(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindHolder(AddressListTitleHolder addressListTitleHolder, int i) {
|
||||
if (i == mData.size() - 1) {
|
||||
addressListTitleHolder.mTvTitle.setTextColor(Color.parseColor("#808080"));
|
||||
addressListTitleHolder.mIvArrow.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
addressListTitleHolder.mTvTitle.setTextColor(Color.parseColor("#1189FF"));
|
||||
addressListTitleHolder.mIvArrow.setVisibility(View.VISIBLE);
|
||||
}
|
||||
addressListTitleHolder.mTvTitle.setText(mData.get(i));
|
||||
if (mClickListener != null) {
|
||||
addressListTitleHolder.itemView.setOnClickListener(v -> mClickListener.onItemClick(mData.get(i), i));
|
||||
}
|
||||
}
|
||||
|
||||
public void addClickListener(ItemClickListener listener) {
|
||||
this.mClickListener = listener;
|
||||
}
|
||||
|
||||
public interface ItemClickListener {
|
||||
void onItemClick(String s, int pos);
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package com.sucstepsoft.realtimelocation.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseRecyclerAdapter;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.adapters.holders.AddressListDepartHolder;
|
||||
import com.sucstepsoft.realtimelocation.adapters.holders.AddressUserHolder;
|
||||
import com.sucstepsoft.realtimelocation.beans.AddressListBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 作者: Adam
|
||||
* 日期: 2019/8/14 - 15:35
|
||||
* 邮箱: itgaojian@163.com
|
||||
* 描述:
|
||||
*/
|
||||
public class AddressListUserAdapter extends BaseRecyclerAdapter<AddressListBean.UsersBean, AddressUserHolder> {
|
||||
public AddressListUserAdapter(Context ctx, List<AddressListBean.UsersBean> list) {
|
||||
super(ctx, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddressUserHolder createHolder(ViewGroup parent, int viewType) {
|
||||
View itemView = LayoutInflater.from(mContext).inflate(R.layout.item_address_user, parent, false);
|
||||
return new AddressUserHolder(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindHolder(AddressUserHolder userHolder, int i) {
|
||||
userHolder.mTvPhone.setText(mData.get(i).getUserPhone());
|
||||
userHolder.mTvName.setText(mData.get(i).getUserName());
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package com.sucstepsoft.realtimelocation.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.Layout;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseRecyclerAdapter;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.adapters.holders.PDepartMentHolder;
|
||||
import com.sucstepsoft.realtimelocation.beans.AreaListBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 作者: Adam
|
||||
* 日期: 2019-10-24 - 15:26
|
||||
* 邮箱: itgaojian@163.com
|
||||
* 描述:
|
||||
*/
|
||||
public class DeparmentListAdapter extends BaseRecyclerAdapter<AreaListBean, PDepartMentHolder> {
|
||||
|
||||
public DeparmentListAdapter(Context ctx, List<AreaListBean> list) {
|
||||
super(ctx, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PDepartMentHolder createHolder(ViewGroup parent, int viewType) {
|
||||
View itemView = LayoutInflater.from(mContext).inflate(R.layout.item_department_address, parent, false);
|
||||
return new PDepartMentHolder(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindHolder(PDepartMentHolder pDepartMentHolder, int i) {
|
||||
pDepartMentHolder.mTvName.setText(mData.get(i).getDictName());
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package com.sucstepsoft.realtimelocation.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.sucstepsoft.cm_utils.core.beans.FuncBean;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseRecyclerAdapter;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.adapters.holders.FuncHolder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 作者: Adam
|
||||
* 日期: 2019/8/14 - 10:01
|
||||
* 邮箱: itgaojian@163.com
|
||||
* 描述:
|
||||
*/
|
||||
public class FunctionAdapter extends BaseRecyclerAdapter<FuncBean, FuncHolder> {
|
||||
public FunctionAdapter(Context ctx, List<FuncBean> list) {
|
||||
super(ctx, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FuncHolder createHolder(ViewGroup parent, int viewType) {
|
||||
View itemView = LayoutInflater.from(mContext).inflate(R.layout.item_main_func, parent, false);
|
||||
return new FuncHolder(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindHolder(FuncHolder funcHolder, int i) {
|
||||
funcHolder.mTvTitle.setText(mData.get(i).getText());
|
||||
funcHolder.mIvIcon.setBackgroundResource(mData.get(i).getIconRes());
|
||||
}
|
||||
}
|
@ -0,0 +1,107 @@
|
||||
package com.sucstepsoft.realtimelocation.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.support.v7.widget.GridLayoutManager;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.baidu.mapapi.map.TextureMapView;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.BaseUrlApi;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseRecyclerAdapter;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseShowPhotoAdapter;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.activitys.common.PhotoActivity;
|
||||
import com.sucstepsoft.realtimelocation.activitys.issue.IssueDetailActivity;
|
||||
import com.sucstepsoft.realtimelocation.adapters.holders.IssueStepHolder;
|
||||
import com.sucstepsoft.realtimelocation.beans.CaseFlowBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.IssueStepBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
|
||||
/**
|
||||
* 作者: Adam
|
||||
* 日期: 2019/8/6 - 14:10
|
||||
* 邮箱: itgaojian@163.com
|
||||
* 描述:
|
||||
*/
|
||||
public class IssueStepAdapter extends BaseRecyclerAdapter<CaseFlowBean, IssueStepHolder> {
|
||||
|
||||
|
||||
public IssueStepAdapter(Context ctx, List<CaseFlowBean> list) {
|
||||
super(ctx, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IssueStepHolder createHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(mContext).inflate(R.layout.item_case_flow, parent, false);
|
||||
return new IssueStepHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindHolder(IssueStepHolder holder, int i) {
|
||||
CaseFlowBean bean = mData.get(i);
|
||||
holder.mTvTime.setText(bean.getGmtCreate());//时间
|
||||
holder.mTvDesc.setText("处理描述 : " + bean.getUserOpinion());
|
||||
holder.mTvUserName.setText("处理人 : " + bean.getUserName());
|
||||
if (bean.getHandleTime() != 0) {
|
||||
holder.mTvHandleTime.setVisibility(View.VISIBLE);
|
||||
holder.mTvHandleTime.setText("处理时限:" + bean.getHandleTime() + "天");
|
||||
} else {
|
||||
holder.mTvHandleTime.setVisibility(View.GONE);
|
||||
}
|
||||
if (!TextUtils.isEmpty(bean.getUserPhone())) {
|
||||
holder.mTvUserPhone.setVisibility(View.VISIBLE);
|
||||
holder.mTvUserPhone.setText("联系电话 : " + bean.getUserPhone());
|
||||
} else {
|
||||
holder.mTvUserPhone.setVisibility(View.GONE);
|
||||
}
|
||||
holder.mTvType.setText(bean.getOptionType());
|
||||
if (!TextUtils.isEmpty(bean.getHandleUserName())) {
|
||||
holder.mTvHandleUser.setVisibility(View.VISIBLE);
|
||||
holder.mTvHandleUser.setText("受理人 : " + bean.getHandleUserName());
|
||||
} else {
|
||||
holder.mTvHandleUser.setVisibility(View.GONE);
|
||||
}
|
||||
if ("0".equals(bean.getHandleStatus())) {
|
||||
holder.mTvHandleStatus.setTextColor(Color.RED);
|
||||
holder.mTvHandleStatus.setText("不同意");
|
||||
} else {
|
||||
holder.mTvHandleStatus.setTextColor(Color.GREEN);
|
||||
holder.mTvHandleStatus.setText("同意处理");
|
||||
}
|
||||
if (TextUtils.isEmpty(bean.getUserPhotos())) {
|
||||
holder.mRlvPhotos.setVisibility(View.GONE);
|
||||
} else {
|
||||
holder.mRlvPhotos.setVisibility(View.VISIBLE);
|
||||
List<String> photos = new ArrayList<>();
|
||||
String[] split = bean.getUserPhotos().split(",");
|
||||
for (int j = 0; j < split.length; j++) {
|
||||
if (!TextUtils.isEmpty(split[j])) {
|
||||
photos.add(BaseUrlApi.BASE_IMG_URL + split[j]);
|
||||
}
|
||||
}
|
||||
BaseShowPhotoAdapter adapter = new BaseShowPhotoAdapter(mContext, photos);
|
||||
GridLayoutManager manager = new GridLayoutManager(mContext, 4) {
|
||||
@Override
|
||||
public boolean canScrollVertically() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
holder.mRlvPhotos.setLayoutManager(manager);
|
||||
holder.mRlvPhotos.setAdapter(adapter);
|
||||
adapter.addOnItemClickListener(url -> {
|
||||
Intent intent = new Intent(mContext, PhotoActivity.class);
|
||||
intent.putExtra("imgUrls", new ArrayList<>(adapter.getData()));
|
||||
mContext.startActivity(intent);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,130 @@
|
||||
package com.sucstepsoft.realtimelocation.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.resource.bitmap.CircleCrop;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.BaseUrlApi;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseRecyclerAdapter;
|
||||
import com.sucstepsoft.cm_utils.utils.LogUtils;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.adapters.holders.IssueSubHolder;
|
||||
import com.sucstepsoft.realtimelocation.beans.IssueSubBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
|
||||
/**
|
||||
* 作者: Adam
|
||||
* 日期: 2019/8/5 - 15:02
|
||||
* 邮箱: itgaojian@163.com
|
||||
* 描述:
|
||||
*/
|
||||
public class IssueSubAdapter extends BaseRecyclerAdapter<IssueSubBean.RowsBean, IssueSubHolder> {
|
||||
private boolean mIsShow = false;
|
||||
|
||||
public IssueSubAdapter(Context ctx, List<IssueSubBean.RowsBean> list, boolean isShow) {
|
||||
super(ctx, list);
|
||||
mIsShow = isShow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IssueSubHolder createHolder(ViewGroup parent, int viewType) {
|
||||
View itemView = LayoutInflater.from(mContext).inflate(R.layout.item_issue, parent, false);
|
||||
return new IssueSubHolder(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindHolder(IssueSubHolder holder, int i) {
|
||||
IssueSubBean.RowsBean bean = mData.get(i);
|
||||
holder.mTvIssueTitle.setText(bean.getCommunityName());
|
||||
holder.mTvIssueDesc.setText(bean.getCaseContent());
|
||||
holder.mTvIssueLocation.setText(bean.getCasePosition());
|
||||
if (mIsShow) {
|
||||
holder.mIvState.setVisibility(View.VISIBLE);
|
||||
if (TextUtils.isEmpty(bean.getReadTime())) {
|
||||
holder.mIvState.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.mIvState.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
holder.mIvState.setVisibility(View.GONE);
|
||||
}
|
||||
if (!TextUtils.isEmpty(bean.getCaseStatus())) {
|
||||
switch (bean.getCaseStatus()) {
|
||||
case "0"://待受理
|
||||
holder.mTvIssueState.setText("待受理");
|
||||
holder.mTvIssueState.setTextColor(Color.parseColor("#DE0E0E"));
|
||||
holder.mTvIssueState.setBackgroundResource(R.drawable.shp_status_red);
|
||||
break;
|
||||
case "1":
|
||||
holder.mTvIssueState.setText("待立案");
|
||||
holder.mTvIssueState.setTextColor(Color.parseColor("#DE0E0E"));
|
||||
holder.mTvIssueState.setBackgroundResource(R.drawable.shp_status_red);
|
||||
break;
|
||||
case "2":
|
||||
holder.mTvIssueState.setText("待下派");
|
||||
holder.mTvIssueState.setTextColor(Color.parseColor("#FFAE3B"));
|
||||
holder.mTvIssueState.setBackgroundResource(R.drawable.shp_status_yellow);
|
||||
break;
|
||||
case "3":
|
||||
holder.mTvIssueState.setText("待处理");
|
||||
holder.mTvIssueState.setTextColor(Color.parseColor("#DE0E0E"));
|
||||
holder.mTvIssueState.setBackgroundResource(R.drawable.shp_status_red);
|
||||
break;
|
||||
case "4":
|
||||
holder.mTvIssueState.setText("待检查");
|
||||
holder.mTvIssueState.setTextColor(Color.parseColor("#1189FF"));
|
||||
holder.mTvIssueState.setBackgroundResource(R.drawable.shp_status_blue);
|
||||
break;
|
||||
case "5":
|
||||
holder.mTvIssueState.setText("待结案");
|
||||
holder.mTvIssueState.setTextColor(Color.parseColor("#0EC843"));
|
||||
holder.mTvIssueState.setBackgroundResource(R.drawable.shp_status_green);
|
||||
break;
|
||||
case "6":
|
||||
holder.mTvIssueState.setText("已归档");
|
||||
holder.mTvIssueState.setTextColor(Color.parseColor("#D8D8D8"));
|
||||
holder.mTvIssueState.setBackgroundResource(R.drawable.shp_status_gray);
|
||||
break;
|
||||
default:
|
||||
holder.mTvIssueState.setText("异常");
|
||||
holder.mTvIssueState.setTextColor(Color.parseColor("#DE0E0E"));
|
||||
holder.mTvIssueState.setBackgroundResource(R.drawable.shp_status_red);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
holder.mTvIssueState.setText("异常");
|
||||
holder.mTvIssueState.setTextColor(Color.parseColor("#DE0E0E"));
|
||||
holder.mTvIssueState.setBackgroundResource(R.drawable.shp_status_red);
|
||||
}
|
||||
if (!TextUtils.isEmpty(bean.getCasePhotos())) {
|
||||
String[] photos = bean.getCasePhotos().split(",");
|
||||
if (!TextUtils.isEmpty(photos[0])) {
|
||||
Glide.with(mContext)
|
||||
.load(BaseUrlApi.BASE_IMG_URL + photos[0])
|
||||
.apply(RequestOptions.bitmapTransform(new CircleCrop())
|
||||
.error(R.drawable.ic_img_default)
|
||||
.placeholder(R.drawable.ic_img_default))
|
||||
.into(holder.mIvIssueImg);
|
||||
} else {
|
||||
Glide.with(mContext)
|
||||
.load(R.drawable.ic_img_default)
|
||||
.into(holder.mIvIssueImg);
|
||||
}
|
||||
} else {
|
||||
Glide.with(mContext)
|
||||
.load(R.drawable.ic_img_default)
|
||||
.into(holder.mIvIssueImg);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package com.sucstepsoft.realtimelocation.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.TextureView;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.resource.bitmap.CircleCrop;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.BaseUrlApi;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseRecyclerAdapter;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.adapters.holders.IssueSubHolder;
|
||||
import com.sucstepsoft.realtimelocation.adapters.holders.LeaveHistoryHolder;
|
||||
import com.sucstepsoft.realtimelocation.beans.IssueSubBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.LeaveListBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 作者: Adam
|
||||
* 日期: 2019/8/5 - 15:02
|
||||
* 邮箱: itgaojian@163.com
|
||||
* 描述:
|
||||
*/
|
||||
public class LeaveHistoryAdapter extends BaseRecyclerAdapter<LeaveListBean.RowsBean, LeaveHistoryHolder> {
|
||||
private int mType = 1;
|
||||
|
||||
public LeaveHistoryAdapter(Context ctx, List<LeaveListBean.RowsBean> list, int type) {
|
||||
super(ctx, list);
|
||||
mType = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LeaveHistoryHolder createHolder(ViewGroup parent, int viewType) {
|
||||
View itemView = LayoutInflater.from(mContext).inflate(R.layout.item_leave_item, parent, false);
|
||||
return new LeaveHistoryHolder(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindHolder(LeaveHistoryHolder holder, int i) {
|
||||
LeaveListBean.RowsBean rowsBean = mData.get(i);
|
||||
|
||||
holder.mTvCount.setText(rowsBean.getLeaveTimeLong() + "天");
|
||||
holder.mTvPerson.setText(rowsBean.getLeaveUserName());
|
||||
if (!TextUtils.isEmpty(rowsBean.getLeaveType())) {
|
||||
switch (rowsBean.getLeaveType()) {
|
||||
case "ill"://有病
|
||||
holder.mTvType.setText("有病");
|
||||
break;
|
||||
case "busy":
|
||||
holder.mTvType.setText("有事");
|
||||
break;
|
||||
}
|
||||
}
|
||||
holder.mTvTime.setText(rowsBean.getLeaveTime());
|
||||
switch (rowsBean.getLeaveState()) {
|
||||
case 0:
|
||||
holder.mTvState.setText("待审批");
|
||||
holder.mTvState.setTextColor(Color.parseColor("#DE0E0E"));
|
||||
holder.mTvState.setBackgroundResource(R.drawable.shp_status_red);
|
||||
if (mType == 1) {
|
||||
holder.mIvState.setVisibility(View.GONE);
|
||||
} else {
|
||||
holder.mIvState.setVisibility(View.VISIBLE);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
holder.mTvState.setText("通过");
|
||||
holder.mTvState.setTextColor(Color.parseColor("#0EC843"));
|
||||
holder.mTvState.setBackgroundResource(R.drawable.shp_status_green);
|
||||
holder.mIvState.setVisibility(View.GONE);
|
||||
break;
|
||||
case 2:
|
||||
holder.mIvState.setVisibility(View.GONE);
|
||||
holder.mTvState.setText("拒绝");
|
||||
holder.mTvState.setTextColor(Color.parseColor("#DE0E0E"));
|
||||
holder.mTvState.setBackgroundResource(R.drawable.shp_status_red);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,124 @@
|
||||
package com.sucstepsoft.realtimelocation.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseRecyclerAdapter;
|
||||
import com.sucstepsoft.cm_utils.utils.TimeUtils;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.adapters.holders.LocusOfflineHolder;
|
||||
import com.sucstepsoft.realtimelocation.adapters.holders.LocusOnlineHolder;
|
||||
import com.sucstepsoft.realtimelocation.adapters.holders.LocusStartHolder;
|
||||
import com.sucstepsoft.realtimelocation.adapters.holders.LocusStayHolder;
|
||||
import com.sucstepsoft.realtimelocation.adapters.holders.LocusStopHolder;
|
||||
import com.sucstepsoft.realtimelocation.beans.LocusTextBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 作者: Adam
|
||||
* 日期: 2019/7/31 - 10:30
|
||||
* 邮箱: itgaojian@163.com
|
||||
* 描述:
|
||||
*/
|
||||
public class LocusStepAdapter extends BaseRecyclerAdapter<LocusTextBean, RecyclerView.ViewHolder> {
|
||||
public static final int TYPE_START = 121;//开始
|
||||
public static final int TYPE_ONLINE = 122;//在线,移动
|
||||
public static final int TYPE_OFFLINE = 123;//离线
|
||||
public static final int TYPE_STAY = 124;//停留
|
||||
public static final int TYPE_STOP = 125;//停止
|
||||
public static final int TYPE_UNUSUAL = 126;//异常
|
||||
|
||||
public LocusStepAdapter(Context ctx, List<LocusTextBean> list) {
|
||||
super(ctx, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecyclerView.ViewHolder createHolder(ViewGroup parent, int viewType) {
|
||||
RecyclerView.ViewHolder holder = null;
|
||||
View itemView = null;
|
||||
switch (viewType) {
|
||||
case TYPE_START:
|
||||
itemView = LayoutInflater.from(mContext).inflate(R.layout.item_step_start, parent, false);
|
||||
holder = new LocusStartHolder(itemView);
|
||||
break;
|
||||
case TYPE_ONLINE:
|
||||
itemView = LayoutInflater.from(mContext).inflate(R.layout.item_step_online, parent, false);
|
||||
holder = new LocusOnlineHolder(itemView);
|
||||
break;
|
||||
case TYPE_OFFLINE:
|
||||
itemView = LayoutInflater.from(mContext).inflate(R.layout.item_step_offline, parent, false);
|
||||
holder = new LocusOfflineHolder(itemView);
|
||||
break;
|
||||
case TYPE_STAY:
|
||||
itemView = LayoutInflater.from(mContext).inflate(R.layout.item_step_stay, parent, false);
|
||||
holder = new LocusStayHolder(itemView);
|
||||
break;
|
||||
case TYPE_STOP:
|
||||
itemView = LayoutInflater.from(mContext).inflate(R.layout.item_step_stop, parent, false);
|
||||
holder = new LocusStopHolder(itemView);
|
||||
break;
|
||||
case TYPE_UNUSUAL:
|
||||
itemView = LayoutInflater.from(mContext).inflate(R.layout.item_step_unusual, parent, false);
|
||||
holder = new LocusStopHolder(itemView);
|
||||
break;
|
||||
default:
|
||||
itemView = LayoutInflater.from(mContext).inflate(R.layout.item_step_offline, parent, false);
|
||||
holder = new LocusOfflineHolder(itemView);
|
||||
break;
|
||||
}
|
||||
return holder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
return mData.get(position).getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindHolder(RecyclerView.ViewHolder myHolder, int i) {
|
||||
int itemViewType = getItemViewType(i);
|
||||
String time = "";
|
||||
if (mData.get(i).getSecond() > 0) {
|
||||
time = TimeUtils.secToTime(mData.get(i).getSecond());
|
||||
} else {
|
||||
time = "0";
|
||||
}
|
||||
switch (itemViewType) {
|
||||
case TYPE_START:
|
||||
((LocusStartHolder) myHolder).mTvTime.setText(mData.get(i).getTime());
|
||||
((LocusStartHolder) myHolder).mTvAddress.setText(mData.get(i).getAddress());
|
||||
break;
|
||||
case TYPE_ONLINE:
|
||||
((LocusOnlineHolder) myHolder).mTvTime.setText(mData.get(i).getTime());
|
||||
((LocusOnlineHolder) myHolder).mTvAddress.setText(mData.get(i).getAddress());
|
||||
((LocusOnlineHolder) myHolder).mTvStateTime.setText("移动时间:" + time);
|
||||
break;
|
||||
case TYPE_OFFLINE:
|
||||
((LocusOfflineHolder) myHolder).mTvTime.setText(mData.get(i).getTime());
|
||||
((LocusOfflineHolder) myHolder).mTvAddress.setText(mData.get(i).getAddress());
|
||||
((LocusOfflineHolder) myHolder).mTvStateTime.setText("断联时间:" + time);
|
||||
break;
|
||||
case TYPE_STAY:
|
||||
((LocusStayHolder) myHolder).mTvTime.setText(mData.get(i).getTime());
|
||||
((LocusStayHolder) myHolder).mTvAddress.setText(mData.get(i).getAddress());
|
||||
((LocusStayHolder) myHolder).mTvStateTime.setText("等待时间:" + time);
|
||||
break;
|
||||
case TYPE_STOP:
|
||||
((LocusStopHolder) myHolder).mTvTime.setText(mData.get(i).getTime());
|
||||
((LocusStopHolder) myHolder).mTvAddress.setText(mData.get(i).getAddress());
|
||||
break;
|
||||
case TYPE_UNUSUAL:
|
||||
((LocusStopHolder) myHolder).mTvTime.setText(mData.get(i).getTime());
|
||||
((LocusStopHolder) myHolder).mTvAddress.setText(mData.get(i).getAddress());
|
||||
((LocusStopHolder) myHolder).mTvStateTime.setText("异常时间:" + time);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,38 @@
|
||||
package com.sucstepsoft.realtimelocation.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseRecyclerAdapter;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.adapters.holders.NoticeHolder;
|
||||
import com.sucstepsoft.realtimelocation.beans.NewsListBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 作者: Adam
|
||||
* 日期: 2019/8/13 - 10:29
|
||||
* 邮箱: itgaojian@163.com
|
||||
* 描述:
|
||||
*/
|
||||
public class NoticeAdapter extends BaseRecyclerAdapter<NewsListBean.RowsBean, NoticeHolder> {
|
||||
public NoticeAdapter(Context ctx, List<NewsListBean.RowsBean> list) {
|
||||
super(ctx, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NoticeHolder createHolder(ViewGroup parent, int viewType) {
|
||||
View itemView = LayoutInflater.from(mContext).inflate(R.layout.item_notice, parent, false);
|
||||
return new NoticeHolder(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindHolder(NoticeHolder noticeHolder, int i) {
|
||||
noticeHolder.mTvTitle.setText(mData.get(i).getNewsTitle());
|
||||
noticeHolder.mTvTime.setText(mData.get(i).getNewsTime());
|
||||
noticeHolder.mTvPub.setText(mData.get(i).getNewsAuthor());
|
||||
}
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
package com.sucstepsoft.realtimelocation.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseRecyclerAdapter;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.adapters.holders.PersonHolder;
|
||||
import com.sucstepsoft.realtimelocation.beans.PersonBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 作者: Adam
|
||||
* 日期: 2019-10-24 - 17:02
|
||||
* 邮箱: itgaojian@163.com
|
||||
* 描述:
|
||||
*/
|
||||
public class PersonAdapter extends BaseRecyclerAdapter<PersonBean, PersonHolder> {
|
||||
public PersonAdapter(Context ctx, List<PersonBean> list) {
|
||||
super(ctx, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersonHolder createHolder(ViewGroup parent, int viewType) {
|
||||
View itemView = LayoutInflater.from(mContext).inflate(R.layout.item_person_community, parent, false);
|
||||
return new PersonHolder(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindHolder(PersonHolder personHolder, int i) {
|
||||
personHolder.mTvUserPhone.setText("联系电话 : " + mData.get(i).getCommunityBossPhone());
|
||||
if (TextUtils.isEmpty(mData.get(i).getCommunityNames())) {
|
||||
personHolder.mTvArea.setText(mData.get(i).getAreaName());
|
||||
} else {
|
||||
personHolder.mTvArea.setText(mData.get(i).getAreaName() + "-" + mData.get(i).getCommunityNames());
|
||||
}
|
||||
personHolder.mTvLevel.setVisibility(View.GONE);
|
||||
int le = mData.get(i).getCommunityBossLevel();
|
||||
if (le != 0) {
|
||||
switch (le) {
|
||||
case 1:
|
||||
personHolder.mTvUserName.setText(mData.get(i).getCommunityBossName() + "(一级片长)");
|
||||
personHolder.mLlNext.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
case 2:
|
||||
personHolder.mTvUserName.setText(mData.get(i).getCommunityBossName() + "(二级片长)");
|
||||
personHolder.mLlNext.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
case 3:
|
||||
personHolder.mTvUserName.setText(mData.get(i).getCommunityBossName() + "(三级片长)");
|
||||
personHolder.mLlNext.setVisibility(View.GONE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (callListener != null) {
|
||||
personHolder.mIvCallUser.setOnClickListener(v -> callListener.call(mData.get(i)));
|
||||
}
|
||||
if (nextListener != null) {
|
||||
personHolder.mLlNext.setOnClickListener(v -> nextListener.next(mData.get(i)));
|
||||
}
|
||||
}
|
||||
|
||||
private OnCallListener callListener;
|
||||
private OnNextListener nextListener;
|
||||
|
||||
public void addOnCallListener(OnCallListener listener) {
|
||||
this.callListener = listener;
|
||||
}
|
||||
|
||||
public void addNextListener(OnNextListener listener) {
|
||||
this.nextListener = listener;
|
||||
}
|
||||
|
||||
public interface OnCallListener {
|
||||
void call(PersonBean bean);
|
||||
}
|
||||
|
||||
public interface OnNextListener {
|
||||
void next(PersonBean bean);
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.sucstepsoft.realtimelocation.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseRecyclerAdapter;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.GlideRoundTransform;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.adapters.holders.ShowPhotoHolder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 作者 : Adam on 2018/11/14.
|
||||
* 邮箱 : itgaojian@163.com
|
||||
* 描述 : <功能描述>
|
||||
*/
|
||||
public class ShowPhotoAdapter extends BaseRecyclerAdapter<String, ShowPhotoHolder> {
|
||||
public ShowPhotoAdapter(Context ctx, List<String> list) {
|
||||
super(ctx, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShowPhotoHolder createHolder(ViewGroup parent, int viewType) {
|
||||
View itemView = LayoutInflater.from(mContext)
|
||||
.inflate(R.layout.item_show_photo, parent, false);
|
||||
return new ShowPhotoHolder(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindHolder(ShowPhotoHolder showPhotoHolder, int i) {
|
||||
RequestOptions options = new RequestOptions()
|
||||
.transform(new GlideRoundTransform(mContext, 5)).error(R.drawable.ic_img_default).placeholder(R.drawable.ic_img_default);
|
||||
Glide.with(mContext)
|
||||
.load(mData.get(i))
|
||||
.apply(options)
|
||||
.into(showPhotoHolder.mIvPhoto);
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.sucstepsoft.realtimelocation.adapters.holders;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
|
||||
/**
|
||||
* 作者: Adam
|
||||
* 日期: 2019/8/14 - 16:00
|
||||
* 邮箱: itgaojian@163.com
|
||||
* 描述:
|
||||
*/
|
||||
public class AddressListBaseHolder extends RecyclerView.ViewHolder {
|
||||
public TextView mTvName;
|
||||
public ImageView mIvIcon;
|
||||
public LinearLayout mLlContent;
|
||||
|
||||
public AddressListBaseHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
mTvName = itemView.findViewById(R.id.tv_depart_name);
|
||||
mIvIcon = itemView.findViewById(R.id.iv_icon);
|
||||
mLlContent = itemView.findViewById(R.id.ll_content);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user