修改页面

This commit is contained in:
itgaojian163 2020-03-27 16:48:14 +08:00
parent cedf629519
commit 0ad547b651
78 changed files with 4732 additions and 4150 deletions

View File

@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="delegatedBuild" value="false" />
<option name="testRunner" value="PLATFORM" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
@ -14,7 +17,6 @@
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="testRunner" value="PLATFORM" />
</GradleProjectSettings>
</option>
</component>

View File

@ -51,11 +51,11 @@ dependencies {
implementation project(':cm_utils')
implementation project(':camera')
//
implementation files('libs/BaiduLBS_Android.jar')
implementation files('libs/IndoorscapeAlbumPlugin.jar')
// implementation files('libs/BaiduLBS_Android.jar')
// implementation files('libs/IndoorscapeAlbumPlugin.jar')
//
implementation files('libs/jcore-android-2.0.1.jar')
implementation files('libs/jpush-android-3.3.4.jar')
// implementation files('libs/jcore-android-2.0.1.jar')
// implementation files('libs/jpush-android-3.3.4.jar')
implementation 'com.android.support:multidex:1.0.3'
//Rxjava

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -38,7 +38,7 @@
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application
android:name="com.sucstepsoft.txrealtimelocation.base.BaseApplication"
android:name=".base.BaseApplication"
android:allowBackup="true"
android:icon="@drawable/ic_logo"
android:label="@string/app_name"
@ -48,103 +48,118 @@
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity
android:name="com.sucstepsoft.txrealtimelocation.activitys.addresslist.PersonListActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.sucstepsoft.txrealtimelocation.activitys.addresslist.AddressListMainActivity"
android:name=".activitys.issue.CheckOptionsActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.sucstepsoft.txrealtimelocation.activitys.issue.MineIssueNewActivity"
android:name=".activitys.addresslist.PersonListActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.sucstepsoft.txrealtimelocation.activitys.mine.LeaveCheckListActivity"
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="com.sucstepsoft.txrealtimelocation.activitys.mine.LeaveDetailActivity"
android:name=".activitys.mine.LeaveDetailActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan|stateHidden" />
<activity
android:name="com.sucstepsoft.txrealtimelocation.activitys.mine.LeaveHistoryActivity"
android:name=".activitys.mine.LeaveHistoryActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan|stateHidden" />
<activity
android:name="com.sucstepsoft.txrealtimelocation.activitys.mine.LeaveActivity"
android:name=".activitys.mine.LeaveActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan|stateHidden" />
<activity
android:name="com.sucstepsoft.txrealtimelocation.activitys.issue.TakePointActivity"
android:name=".activitys.issue.TakePointActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan|stateHidden" />
<activity
android:name="com.sucstepsoft.txrealtimelocation.activitys.addresslist.AddressListDetailActivity"
android:name=".activitys.addresslist.AddressListDetailActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.sucstepsoft.txrealtimelocation.activitys.issue.IssueMineActivity"
android:name=".activitys.issue.IssueMineActivity"
android:screenOrientation="portrait" />
<activity android:name="com.sucstepsoft.txrealtimelocation.activitys.issue.IssueCheckActivity" />
<activity android:name=".activitys.issue.IssueCheckActivity" />
<activity
android:name="com.sucstepsoft.txrealtimelocation.activitys.issue.IssueMineDisActivity"
android:name=".activitys.issue.IssueMineDisActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.sucstepsoft.txrealtimelocation.activitys.notice.NoticeDetailActivity"
android:name=".activitys.notice.NoticeDetailActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.sucstepsoft.txrealtimelocation.activitys.notice.NoticeActivity"
android:name=".activitys.notice.NoticeActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.sucstepsoft.txrealtimelocation.activitys.issue.IssueStepActivity"
android:name=".activitys.issue.IssueStepActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.sucstepsoft.txrealtimelocation.activitys.mine.AvisoActivity"
android:name=".activitys.mine.AvisoActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.sucstepsoft.txrealtimelocation.activitys.issue.IssueDetailActivity"
android:name=".activitys.issue.IssueDetailActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.sucstepsoft.txrealtimelocation.activitys.mine.UserInfoActivity"
android:name=".activitys.mine.UserInfoActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.sucstepsoft.txrealtimelocation.activitys.mine.ChangePwdActivity"
android:name=".activitys.mine.ChangePwdActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.sucstepsoft.txrealtimelocation.activitys.locus.LocusManagerActivity"
android:name=".activitys.locus.LocusManagerActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.sucstepsoft.txrealtimelocation.activitys.addresslist.AddressListActivity"
android:name=".activitys.addresslist.AddressListActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.sucstepsoft.txrealtimelocation.activitys.mine.UserActivity"
android:name=".activitys.mine.UserActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.sucstepsoft.txrealtimelocation.activitys.locus.LocusMapActivity"
android:name=".activitys.locus.LocusMapActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.sucstepsoft.txrealtimelocation.activitys.issue.IssueRecordActivity"
android:name=".activitys.issue.IssueRecordActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan|stateHidden" />
<activity
android:name="com.sucstepsoft.txrealtimelocation.activitys.issue.IssueReportActivity"
android:name=".activitys.issue.IssueReportActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan|stateHidden" />
<activity
android:name="com.sucstepsoft.txrealtimelocation.activitys.base.SinglePixelActivity"
android:name=".activitys.base.SinglePixelActivity"
android:excludeFromRecents="true"
android:finishOnTaskLaunch="false"
android:launchMode="singleInstance"
android:theme="@style/OnePixelActivityTheme" />
<activity
android:name="com.sucstepsoft.txrealtimelocation.activitys.base.LoginActivity"
android:name=".activitys.base.LoginActivity"
android:exported="true"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<data
android:host="wanggehua"
android:path="/login"
android:scheme="yiji" />
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
<activity
android:name="com.sucstepsoft.txrealtimelocation.activitys.base.MainActivity"
android:name=".activitys.base.MainActivity"
android:configChanges="orientation|screenSize"
android:exported="false"
android:launchMode="singleTask"
@ -155,37 +170,37 @@
<category android:name="jpush.testCategory" />
</intent-filter>
</activity> <!-- ====百度地图=== -->
<activity android:name="com.sucstepsoft.txrealtimelocation.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" />
<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="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>
<!-- <category android:name="${applicationId}" />-->
<!-- </intent-filter>-->
<!-- </activity>-->
<meta-data
android:name="com.baidu.lbsapi.API_KEY"
@ -211,7 +226,7 @@
android:name="JPUSH_APPKEY"
android:value="${JPUSH_APPKEY}" /> <!-- 配置APP版本号 -->
<provider
android:name="com.sucstepsoft.txrealtimelocation.services.GlobalProvider"
android:name=".services.GlobalProvider"
android:authorities="com.sucstepsoft.txrealtimelocation"
android:enabled="true"
android:exported="true" /> <!-- 配置APP渠道号 -->
@ -224,42 +239,42 @@
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 核心功能 -->
<!-- <provider-->
<!-- android:name="cn.jpush.android.service.DataProvider"-->
<!-- android:authorities="${applicationId}.DataProvider"-->
<!-- android:exported="false"-->
<!-- android:process=":pushcore" /> &lt;!&ndash; Required SDK 核心功能 &ndash;&gt;-->
<!-- 可配置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" />
<!-- <provider-->
<!-- android:name="cn.jpush.android.service.DownloadProvider"-->
<!-- android:authorities="${applicationId}.DownloadProvider"-->
<!-- android:exported="true" /> &lt;!&ndash; since 3.0.9 Required SDK 核心功能 &ndash;&gt;-->
<!-- <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" /> &lt;!&ndash; Required 显示通知栏 &ndash;&gt;-->
<!-- <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>-->
<!-- &lt;!&ndash; Optional &ndash;&gt;-->
<!-- <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服务相互拉起的功能。 -->
<!-- <data android:scheme="package" />-->
<!-- </intent-filter>-->
<!-- </receiver> &lt;!&ndash; since 1.8.0 option 可选项。用于同一设备中不同应用的JPush服务相互拉起的功能。 &ndash;&gt;-->
<!-- 若不启用该功能可删除该组件,将不拉起其他应用也不能被其他应用拉起 -->
<!-- <receiver-->
<!-- android:name="cn.jpush.android.service.AlarmReceiver"-->
<!-- android:exported="false" /> &lt;!&ndash; since 3.1.0 Required SDK 核心功能 &ndash;&gt;-->
<receiver
android:name="cn.jpush.android.service.AlarmReceiver"
android:exported="false" /> <!-- since 3.1.0 Required SDK 核心功能 -->
<receiver
android:name="com.sucstepsoft.txrealtimelocation.services.jpush.MyReceiver"
android:name=".services.jpush.MyReceiver"
android:enabled="true"
android:exported="false">
<intent-filter>
@ -271,7 +286,7 @@
<category android:name="${applicationId}" />
</intent-filter>
</receiver> <!-- Required SDK核心功能 -->
<receiver android:name="com.sucstepsoft.txrealtimelocation.services.jpush.PushMessageReceiver">
<receiver android:name=".services.jpush.PushMessageReceiver">
<intent-filter>
<action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" />
@ -279,7 +294,7 @@
</intent-filter>
</receiver> <!-- Required SDK核心功能 -->
<service
android:name="com.sucstepsoft.txrealtimelocation.services.LocationService"
android:name=".services.LocationService"
android:exported="true"
android:process=":locations">
<intent-filter>
@ -287,13 +302,13 @@
</intent-filter>
</service> <!-- User defined. For test only 用户自定义的广播接收器 -->
<service
android:name="com.sucstepsoft.txrealtimelocation.services.MyJobService"
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="com.sucstepsoft.txrealtimelocation.services.LocationHelperService"
android:name=".services.LocationHelperService"
android:enabled="true"
android:exported="true"
android:process=":helperlocation">
@ -301,35 +316,35 @@
<action android:name="com.sucstepsoft.txrealtimelocation.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 核心功能 -->
<!-- <service-->
<!-- android:name="com.baidu.location.f"-->
<!-- android:enabled="true"-->
<!-- android:process=":remote" /> &lt;!&ndash; since 3.3.0 Required SDK 核心功能 &ndash;&gt;-->
<!-- 可配置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" />
<!-- <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> &lt;!&ndash; Required . Enable it you can get statistics data with channel &ndash;&gt;-->
<!-- <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>
<!-- <category android:name="${applicationId}" />-->
<!-- </intent-filter>-->
<!-- </service>-->
<service
android:name="com.sucstepsoft.txrealtimelocation.services.jpush.PushService"
android:name=".services.jpush.PushService"
android:process=":pushcore">
<intent-filter>
<action android:name="cn.jiguang.user.service.action" />

View File

@ -1,12 +1,7 @@
package com.sucstepsoft.txrealtimelocation.activitys.base;
import android.Manifest;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.provider.Settings;
import android.support.v4.app.ActivityCompat;
import android.telephony.TelephonyManager;
import android.text.Editable;
import android.text.Selection;
import android.text.TextUtils;
@ -17,6 +12,7 @@ import android.util.Base64;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
@ -31,7 +27,6 @@ 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.PermissionUtils;
import com.sucstepsoft.cm_utils.utils.ToastUtils;
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
@ -51,7 +46,6 @@ import java.util.UUID;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import cn.jpush.android.api.JPushInterface;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
@ -74,6 +68,8 @@ public class LoginActivity extends BaseActivity {
ImageView mIvShowPwd;
@BindView(R.id.iv_clear_phone)
ImageView mIvClosePhone;
@BindView(R.id.cb_remember)
CheckBox mCbRemember;
private Unbinder mUnbinder;
private boolean isShowPwd = false;
private Disposable mDisposable;
@ -90,9 +86,7 @@ public class LoginActivity extends BaseActivity {
mRlTitleBar.setVisibility(View.GONE);
refreshView(STATE_LOAD_SUCCESS);
mRlNotify.setVisibility(View.GONE);
mBtnConfirm.setOnClickListener(v -> {
login();
});
mBtnConfirm.setOnClickListener(v -> login());
mTvChangePwd.setOnClickListener(v -> ToastUtils.showShort("请联系管理员"));
mIvShowPwd.setOnClickListener(v -> {
Editable etext = mEtUserPwd.getText();
@ -107,6 +101,20 @@ public class LoginActivity extends BaseActivity {
mEtUserPwd.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
}
});
// mScvCheck.setOnClickListener(v -> {
// EmStateCheck state = mScvCheck.getViewState();
// switch (state) {
// case NORMAL:
// mScvCheck.setCheckState(EmStateCheck.CHECK);
// break;
// case CHECK:
// mScvCheck.setCheckState(EmStateCheck.UNCHECK);
// break;
// case UNCHECK:
// mScvCheck.setCheckState(EmStateCheck.NORMAL);
// break;
// }
// });
setEditTextInhibitInputSpeChat(mEtUserPhone);
setEditTextInhibitInputSpeChat(mEtUserPwd);
mEtUserPhone.addTextChangedListener(new TextWatcher() {
@ -143,13 +151,15 @@ public class LoginActivity extends BaseActivity {
/**
* 登录
* TODO 跳转测试页面
*/
private void login() {
if (checkUserInputInfo()) {
String userName = mEtUserPhone.getText().toString().trim();
String pwd = mEtUserPwd.getText().toString().trim();
doLoginApp(userName, pwd);
}
startActivity(new Intent(this, MainActivity.class));
// if (checkUserInputInfo()) {
// String userName = mEtUserPhone.getText().toString().trim();
// String pwd = mEtUserPwd.getText().toString().trim();
// doLoginApp(userName, pwd);
// }
}
/**
@ -157,15 +167,7 @@ public class LoginActivity extends BaseActivity {
*/
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 deviceId = getDeviceId();
String md5Pwd = EncryptUtils.encryptMD5ToStringTimes(pwd, 3);
LoginUser info = new LoginUser();
info.setAppVersion(AppUtils.getAppVersionCode());
@ -173,9 +175,9 @@ public class LoginActivity extends BaseActivity {
info.setPassword(md5Pwd);
info.setUsername(name);
info.setDeviceNo(deviceId);
if (!UserLgUtils.getAliasIsSeting()) {
JPushInterface.setAlias(getApplicationContext(), 65536, 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);

View File

@ -6,7 +6,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Color;
import android.graphics.Path;
import android.os.Build;
import android.provider.Settings;
import android.support.v7.app.AlertDialog;
@ -19,12 +18,6 @@ import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
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.BitmapDescriptor;
import com.baidu.mapapi.model.LatLng;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.CircleCrop;
import com.bumptech.glide.request.RequestOptions;
@ -51,8 +44,6 @@ import com.sucstepsoft.txrealtimelocation.activitys.addresslist.AddressListMainA
import com.sucstepsoft.txrealtimelocation.activitys.issue.IssueCheckActivity;
import com.sucstepsoft.txrealtimelocation.activitys.issue.IssueMineActivity;
import com.sucstepsoft.txrealtimelocation.activitys.issue.IssueRecordActivity;
import com.sucstepsoft.txrealtimelocation.activitys.issue.IssueReportActivity;
import com.sucstepsoft.txrealtimelocation.activitys.locus.LocusMapActivity;
import com.sucstepsoft.txrealtimelocation.activitys.mine.UserActivity;
import com.sucstepsoft.txrealtimelocation.activitys.notice.NoticeActivity;
import com.sucstepsoft.txrealtimelocation.adapters.FunctionAdapter;
@ -63,9 +54,6 @@ import com.sucstepsoft.txrealtimelocation.beans.CheckSignOffBean;
import com.sucstepsoft.txrealtimelocation.beans.LocationPosition;
import com.sucstepsoft.txrealtimelocation.beans.MainNumBean;
import com.sucstepsoft.txrealtimelocation.beans.PenLineBean;
import com.sucstepsoft.txrealtimelocation.beans.SignBean;
import com.sucstepsoft.txrealtimelocation.beans.SignDataBean;
import com.sucstepsoft.txrealtimelocation.beans.SignOffBean;
import com.sucstepsoft.txrealtimelocation.beans.SignTimeBean;
import com.sucstepsoft.txrealtimelocation.beans.SuccessBean;
import com.sucstepsoft.txrealtimelocation.beans.VersionBean;
@ -76,7 +64,6 @@ import com.sucstepsoft.txrealtimelocation.services.LocationService;
import com.sucstepsoft.txrealtimelocation.utils.ExceptionHandler;
import com.sucstepsoft.txrealtimelocation.utils.GpsUtils;
import com.sucstepsoft.txrealtimelocation.utils.IntentWrapper;
import com.sucstepsoft.txrealtimelocation.utils.PointUtils;
import java.io.File;
import java.util.ArrayList;
@ -96,6 +83,10 @@ import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
//import com.sucstepsoft.txrealtimelocation.activitys.issue.IssueReportActivity;
//import com.sucstepsoft.txrealtimelocation.activitys.locus.LocusMapActivity;
//import com.sucstepsoft.txrealtimelocation.utils.PointUtils;
public class MainActivity extends BaseActivity {
private static final int GPS_REQUEST_CODE = 1234;
public static boolean isForeground = false;
@ -146,12 +137,12 @@ public class MainActivity extends BaseActivity {
PermissionConstants.MICROPHONE,
};
private MessageReceiver mMessageReceiver;
private BitmapDescriptor mBitMap;
// private BitmapDescriptor mBitMap;
//TODO 默认坐标点
private double latitude = 111.771815;
private double longitude = 40.823879;
//109.926934,40.574501
private BDLocation mCurrentLocation;
// private BDLocation mCurrentLocation;
private Unbinder mBind;
private int userType = 2;//1是N员 2是片长
public static final String MESSAGE_JPUSH = "com.example.jpushdemo.MESSAGE_RECEIVED_ACTION";
@ -159,13 +150,11 @@ public class MainActivity extends BaseActivity {
public static final String KEY_MESSAGE = "message";
public static final String KEY_EXTRAS = "extras";
private List<FuncBean> mFuncs = new ArrayList<>();
private String[] mBtnStrs = new String[]{"案件上报", "案件记录", "案件处理", "工作路径", "通讯录", "通知公告"};
private String[] mBtnStrs = new String[]{"企业信息", "隐患上报", "隐患复查", "法律法规"};
private int[] mBtnIds = new int[]{R.drawable.ic_issue_report,
R.drawable.ic_issue_record,
R.drawable.ic_issue_disp,
R.drawable.ic_work_path,
R.drawable.ic_address_list,
R.drawable.ic_notice};
R.drawable.ic_work_path};
private Gson mGson = null;
private boolean isSgin = false;//是否签到
private boolean isSignOff = false;//是否签退
@ -173,7 +162,7 @@ public class MainActivity extends BaseActivity {
private boolean isForeg = true;//是否在前台
private Disposable mGpsDis;
private SignTimeBean mSignTimeBean;
private List<List<LatLng>> mPenLineList;
// private List<List<LatLng>> mPenLineList;
private int mPrecisionDefault = 70;
private int mPrecMax = 150;
private int mPrecision = mPrecisionDefault;
@ -181,7 +170,7 @@ public class MainActivity extends BaseActivity {
private AlertDialog mGpsSettingDialog;
private AlertDialog mGpsWeakDialog;
private long mCurrentLongTime;
private LocationClient mLocationClient;
// private LocationClient mLocationClient;
@Override
protected int setLayoutId() {
@ -195,15 +184,15 @@ public class MainActivity extends BaseActivity {
mRlTitleBar.setVisibility(View.GONE);
initMainFuncs();
//TODO 一像素保活
initScreenListener();
// initScreenListener();
mCurrentLongTime = 0;
PermissionUtils.permission(permissions).callback(new PermissionUtils.SimpleCallback() {
@Override
public void onGranted() {
registerMessageReceiver();
// registerMessageReceiver();
createCacheFile();
startListenLocation();
startSignLocation();
// startListenLocation();
// startSignLocation();
}
@Override
@ -213,13 +202,13 @@ public class MainActivity extends BaseActivity {
}).request();
initBaseView();
//TODO
getPunchTime(123);
setSignText();
getUserPenList();
interval();
registerGpsSignal();
// getPunchTime(123);
// setSignText();
// getUserPenList();
// interval();
// registerGpsSignal();
// checkLocalText();
registerGpsState();
// registerGpsState();
}
@ -397,7 +386,7 @@ public class MainActivity extends BaseActivity {
mFuncs.add(bean);
}
FunctionAdapter adapter = new FunctionAdapter(mActivity, mFuncs);
mRlvBtns.setLayoutManager(new GridLayoutManager(mActivity, 3));
mRlvBtns.setLayoutManager(new GridLayoutManager(mActivity, 2));
mRlvBtns.setAdapter(adapter);
adapter.addOnItemClickListener(this::chosePage);
}
@ -411,7 +400,7 @@ public class MainActivity extends BaseActivity {
// "案件上报", "案件记录", "案件处理", "工作路径", "通讯录", "通知公告"
switch (bean.getText()) {
case "案件上报":
startActivity(new Intent(MainActivity.this, IssueReportActivity.class));
// startActivity(new Intent(MainActivity.this, IssueReportActivity.class));
break;
case "案件记录"://案件记录
startActivity(new Intent(MainActivity.this, IssueRecordActivity.class));
@ -423,7 +412,7 @@ public class MainActivity extends BaseActivity {
// if (userType == 1) {
// startActivity(new Intent(MainActivity.this, LocusManagerActivity.class));
// } else {
startActivity(new Intent(MainActivity.this, LocusMapActivity.class));
// startActivity(new Intent(MainActivity.this, LocusMapActivity.class));
// }
break;
case "通讯录"://通讯录
@ -583,10 +572,10 @@ public class MainActivity extends BaseActivity {
private void uploadPoint() {
LocationPosition position = new LocationPosition();
position.setUserLatitude(mCurrentLocation.getLatitude() + "");
position.setUserLongitude(mCurrentLocation.getLongitude() + "");
position.setUserLocation(mCurrentLocation.getAddress().address);
position.setUserSpeed(mCurrentLocation.getSpeed() + "");
// position.setUserLatitude(mCurrentLocation.getLatitude() + "");
// position.setUserLongitude(mCurrentLocation.getLongitude() + "");
// position.setUserLocation(mCurrentLocation.getAddress().address);
// position.setUserSpeed(mCurrentLocation.getSpeed() + "");
Gson gson = new Gson();
String s = gson.toJson(position);
RequestBody body = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), s);
@ -779,15 +768,15 @@ public class MainActivity extends BaseActivity {
*/
private void showSignDialog() {
// test();
if (mCurrentLocation == null) {
ToastUtils.showShort("正在定位中,请稍后重试.");
} else {
if (2 == userType) {
show();//片长签到退
} else {
showN();//显示N员签到退
}
}
// if (mCurrentLocation == null) {
// ToastUtils.showShort("正在定位中,请稍后重试.");
// } else {
// if (2 == userType) {
// show();//片长签到退
// } else {
// showN();//显示N员签到退
// }
// }
}
private void test() {
@ -814,33 +803,33 @@ public class MainActivity extends BaseActivity {
} else {
boolean isTimeLegal = TimeUtils.isInTime(mSignTimeBean.getNEndWorkTime() + "-" + mSignTimeBean.getNEndPunchTime(), nowHour);
LogUtils.e("N员签到时间区间=" + mSignTimeBean.getNEndWorkTime() + "-" + mSignTimeBean.getNEndPunchTime());
if (isTimeLegal) {
if (mPenLineList != null && mPenLineList.size() > 0) {
if (checkCurrenPointIsBeyond(mCurrentLocation)) {
showSignOffDialog();
} else {
ToastUtils.showShort("当前位置不在所管辖片区内,请前往片区内进行签到或签退操作.");
}
} else {
getPenList();
}
} else {
ToastUtils.showShort("未到签退时间");
}
// if (isTimeLegal) {
// if (mPenLineList != null && mPenLineList.size() > 0) {
// if (checkCurrenPointIsBeyond(mCurrentLocation)) {
// showSignOffDialog();
// } else {
// ToastUtils.showShort("当前位置不在所管辖片区内,请前往片区内进行签到或签退操作.");
// }
// } else {
// getPenList();
// }
// } else {
// ToastUtils.showShort("未到签退时间");
// }
}
} else {
//未签到
boolean isLegalTime = TimeUtils.isInTime(mSignTimeBean.getNStartPunchTime() + "-" + mSignTimeBean.getNEndPunchTime(), nowHour);
if (isLegalTime) {
if (mPenLineList != null && mPenLineList.size() > 0) {
if (checkCurrenPointIsBeyond(mCurrentLocation)) {
showSDialog();
} else {
ToastUtils.showShort("当前位置不在所管辖片区内,请前往片区内进行签到或签退操作.");
}
} else {
getPenList();
}
// if (mPenLineList != null && mPenLineList.size() > 0) {
// if (checkCurrenPointIsBeyond(mCurrentLocation)) {
// showSDialog();
// } else {
// ToastUtils.showShort("当前位置不在所管辖片区内,请前往片区内进行签到或签退操作.");
// }
// } else {
// getPenList();
// }
} else {
ToastUtils.showShort("未到签到时间");
}
@ -869,15 +858,15 @@ public class MainActivity extends BaseActivity {
boolean isPmPunch = TimeUtils.isInTime(mSignTimeBean.getPmStartPunchTime() + "-" + mSignTimeBean.getPmEndPunchTime(), nowHour);
if (isPmPunch) {
if (2 == userType) {
if (mPenLineList != null && mPenLineList.size() > 0) {
if (checkCurrenPointIsBeyond(mCurrentLocation)) {
showSDialog();
} else {
ToastUtils.showShort("当前位置不在所管辖片区内,请前往片区内进行签到或签退操作.");
}
} else {
getPenList();
}
// if (mPenLineList != null && mPenLineList.size() > 0) {
// if (checkCurrenPointIsBeyond(mCurrentLocation)) {
// showSDialog();
// } else {
// ToastUtils.showShort("当前位置不在所管辖片区内,请前往片区内进行签到或签退操作.");
// }
// } else {
// getPenList();
// }
} else {
showSDialog();
}
@ -891,15 +880,15 @@ public class MainActivity extends BaseActivity {
boolean isPmPunch = TimeUtils.isInTime(mSignTimeBean.getPmEndWorkTime() + "-" + mSignTimeBean.getPmEndPunchTime(), nowHour);
if (isAmPunch || isPmPunch) {
if (2 == userType) {
if (mPenLineList != null && mPenLineList.size() > 0) {
if (checkCurrenPointIsBeyond(mCurrentLocation)) {
showSignOffDialog();
} else {
ToastUtils.showShort("当前位置不在所管辖片区内,请前往片区内进行签到或签退操作.");
}
} else {
getPenList();
}
// if (mPenLineList != null && mPenLineList.size() > 0) {
// if (checkCurrenPointIsBeyond(mCurrentLocation)) {
// showSignOffDialog();
// } else {
// ToastUtils.showShort("当前位置不在所管辖片区内,请前往片区内进行签到或签退操作.");
// }
// } else {
// getPenList();
// }
} else {
showSignOffDialog();
@ -920,30 +909,30 @@ public class MainActivity extends BaseActivity {
LogUtils.e("下午签到时间:" + mSignTimeBean.getPmStartPunchTime() + "-" + mSignTimeBean.getPmEndPunchTime());
if (isInAmTime) {
if (2 == userType) {
if (mPenLineList != null && mPenLineList.size() > 0) {
if (checkCurrenPointIsBeyond(mCurrentLocation)) {
showSDialog();
} else {
ToastUtils.showShort("当前位置不在所管辖片区内,请前往片区内进行签到或签退操作.");
}
} else {
getPenList();
}
// if (mPenLineList != null && mPenLineList.size() > 0) {
// if (checkCurrenPointIsBeyond(mCurrentLocation)) {
// showSDialog();
// } else {
// ToastUtils.showShort("当前位置不在所管辖片区内,请前往片区内进行签到或签退操作.");
// }
// } else {
// getPenList();
// }
} else {
showSDialog();
}
} else {
if (isInPmTime) {
if (2 == userType) {
if (mPenLineList != null && mPenLineList.size() > 0) {
if (checkCurrenPointIsBeyond(mCurrentLocation)) {
showSDialog();
} else {
ToastUtils.showShort("当前位置不在所管辖片区内,请前往片区内进行签到或签退操作.");
}
} else {
getPenList();
}
// if (mPenLineList != null && mPenLineList.size() > 0) {
// if (checkCurrenPointIsBeyond(mCurrentLocation)) {
// showSDialog();
// } else {
// ToastUtils.showShort("当前位置不在所管辖片区内,请前往片区内进行签到或签退操作.");
// }
// } else {
// getPenList();
// }
} else {
showSDialog();
}
@ -993,46 +982,46 @@ public class MainActivity extends BaseActivity {
* 签退
*/
private void doSignOff() {
ProgressDialog dialog = UIUtil.initDialog(mActivity, "签退中...");
dialog.show();
SignOffBean bean = new SignOffBean();
bean.setSignoutLatitude(mCurrentLocation.getLatitude() + "");
bean.setSignoutLongitude(mCurrentLocation.getLongitude() + "");
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)
.doSignOff(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) {
// uploadPoint();
dialog.dismiss();
isSignOff = true;
setSignCompleteText();
mTvSign.setTextColor(Color.WHITE);
ToastUtils.showLong("签退成功");
GlobalProvider.save(mActivity, "isUpload", "12");
}
@Override
public void onError(Throwable e) {
dialog.dismiss();
ExceptionHandler.handleException(e);
}
@Override
public void onComplete() {
}
});
// ProgressDialog dialog = UIUtil.initDialog(mActivity, "签退中...");
// dialog.show();
// SignOffBean bean = new SignOffBean();
// bean.setSignoutLatitude(mCurrentLocation.getLatitude() + "");
// bean.setSignoutLongitude(mCurrentLocation.getLongitude() + "");
// 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)
// .doSignOff(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) {
//// uploadPoint();
// dialog.dismiss();
// isSignOff = true;
// setSignCompleteText();
// mTvSign.setTextColor(Color.WHITE);
// ToastUtils.showLong("签退成功");
// GlobalProvider.save(mActivity, "isUpload", "12");
// }
//
// @Override
// public void onError(Throwable e) {
// dialog.dismiss();
// ExceptionHandler.handleException(e);
// }
//
// @Override
// public void onComplete() {
//
// }
// });
}
private void getUserPenList() {
@ -1050,7 +1039,7 @@ public class MainActivity extends BaseActivity {
@Override
public void onNext(List<PenLineBean> penLineBeans) {
if (penLineBeans != null && penLineBeans.size() > 0) {
buildPenList(penLineBeans);
// buildPenList(penLineBeans);
}
}
@ -1086,25 +1075,25 @@ public class MainActivity extends BaseActivity {
@Override
public void onNext(List<PenLineBean> penLineBeans) {
dialog.dismiss();
if (penLineBeans != null && penLineBeans.size() > 0) {
mPenLineList = new ArrayList<>();
for (int i = 0; i < penLineBeans.size(); i++) {
List<PenLineBean.AreaPointsBean> areaPoints = penLineBeans.get(i).getAreaPoints();
if (areaPoints != null && areaPoints.size() > 0) {
List<LatLng> tempList = new ArrayList<>();
for (int j = 0; j < areaPoints.size(); j++) {
LatLng latLng = new LatLng(Double.parseDouble(areaPoints.get(j).getLatitude()), Double.parseDouble(areaPoints.get(j).getLongitude()));
tempList.add(latLng);
}
LatLng latLng = new LatLng(Double.parseDouble(areaPoints.get(0).getLatitude()), Double.parseDouble(areaPoints.get(0).getLongitude()));
tempList.add(latLng);
mPenLineList.add(tempList);
}
}
ToastUtils.showShort("获取片区数据成功,请重新签到或签退");
} else {
ToastUtils.showShort("暂无片区数据");
}
// if (penLineBeans != null && penLineBeans.size() > 0) {
// mPenLineList = new ArrayList<>();
// for (int i = 0; i < penLineBeans.size(); i++) {
// List<PenLineBean.AreaPointsBean> areaPoints = penLineBeans.get(i).getAreaPoints();
// if (areaPoints != null && areaPoints.size() > 0) {
// List<LatLng> tempList = new ArrayList<>();
// for (int j = 0; j < areaPoints.size(); j++) {
// LatLng latLng = new LatLng(Double.parseDouble(areaPoints.get(j).getLatitude()), Double.parseDouble(areaPoints.get(j).getLongitude()));
// tempList.add(latLng);
// }
// LatLng latLng = new LatLng(Double.parseDouble(areaPoints.get(0).getLatitude()), Double.parseDouble(areaPoints.get(0).getLongitude()));
// tempList.add(latLng);
// mPenLineList.add(tempList);
// }
// }
// ToastUtils.showShort("获取片区数据成功,请重新签到或签退");
// } else {
// ToastUtils.showShort("暂无片区数据");
// }
}
@Override
@ -1126,99 +1115,99 @@ public class MainActivity extends BaseActivity {
*
* @param bdLocation
*/
private boolean checkCurrenPointIsBeyond(BDLocation bdLocation) {
if (mPenLineList != null && mPenLineList.size() > 0) {
for (int i = 0; i < mPenLineList.size(); i++) {
LatLng latLng = new LatLng(bdLocation.getLatitude(), bdLocation.getLongitude());
boolean inPolygon = PointUtils.isInPolygon(latLng, mPenLineList.get(i));
if (inPolygon) {
return true;
}
}
return false;
} else {
return false;
}
}
// private boolean checkCurrenPointIsBeyond(BDLocation bdLocation) {
// if (mPenLineList != null && mPenLineList.size() > 0) {
// for (int i = 0; i < mPenLineList.size(); i++) {
// LatLng latLng = new LatLng(bdLocation.getLatitude(), bdLocation.getLongitude());
// boolean inPolygon = PointUtils.isInPolygon(latLng, mPenLineList.get(i));
// if (inPolygon) {
// return true;
// }
// }
// return false;
// } else {
// return false;
// }
// }
private void buildPenList(List<PenLineBean> penLineBeans) {
mPenLineList = new ArrayList<>();
for (int i = 0; i < penLineBeans.size(); i++) {
List<PenLineBean.AreaPointsBean> areaPoints = penLineBeans.get(i).getAreaPoints();
if (areaPoints != null && areaPoints.size() > 0) {
List<LatLng> tempList = new ArrayList<>();
for (int j = 0; j < areaPoints.size(); j++) {
LatLng latLng = new LatLng(Double.parseDouble(areaPoints.get(j).getLatitude()), Double.parseDouble(areaPoints.get(j).getLongitude()));
tempList.add(latLng);
}
LatLng latLng = new LatLng(Double.parseDouble(areaPoints.get(0).getLatitude()), Double.parseDouble(areaPoints.get(0).getLongitude()));
tempList.add(latLng);
mPenLineList.add(tempList);
}
}
}
// private void buildPenList(List<PenLineBean> penLineBeans) {
// mPenLineList = new ArrayList<>();
// for (int i = 0; i < penLineBeans.size(); i++) {
// List<PenLineBean.AreaPointsBean> areaPoints = penLineBeans.get(i).getAreaPoints();
// if (areaPoints != null && areaPoints.size() > 0) {
// List<LatLng> tempList = new ArrayList<>();
// for (int j = 0; j < areaPoints.size(); j++) {
// LatLng latLng = new LatLng(Double.parseDouble(areaPoints.get(j).getLatitude()), Double.parseDouble(areaPoints.get(j).getLongitude()));
// tempList.add(latLng);
// }
// LatLng latLng = new LatLng(Double.parseDouble(areaPoints.get(0).getLatitude()), Double.parseDouble(areaPoints.get(0).getLongitude()));
// tempList.add(latLng);
// mPenLineList.add(tempList);
// }
// }
// }
/**
* 进行签到
*/
private void doSign() {
ProgressDialog dialog = UIUtil.initDialog(mActivity, "签到中...");
dialog.show();
SignBean bean = new SignBean();
bean.setSigninLatitude(mCurrentLocation.getLatitude() + "");
bean.setSigninLongitude(mCurrentLocation.getLongitude() + "");
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)
.doSign(body, UserLgUtils.getToken())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<SignDataBean>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(SignDataBean successBean) {
// LogUtils.e(successBean);
// uploadPoint();
isSgin = true;
isSignOff = false;
if (successBean.isData()) {
Glide.with(mActivity)
.load(R.drawable.ic_late)
.into(mIvState);
mTvState.setText("迟到");
mTvState.setTextColor(Color.RED);
} else {
Glide.with(mActivity)
.load(R.drawable.ic_nomal)
.into(mIvState);
mTvState.setText("正常");
mTvState.setTextColor(Color.WHITE);
}
dialog.dismiss();
GlobalProvider.save(mActivity, "isUpload", "13");
setSignOffText();
mTvSign.setTextColor(Color.WHITE);
ToastUtils.showLong("签到成功");
}
@Override
public void onError(Throwable e) {
e.printStackTrace();
dialog.dismiss();
ExceptionHandler.handleException(e);
}
@Override
public void onComplete() {
}
});
// ProgressDialog dialog = UIUtil.initDialog(mActivity, "签到中...");
// dialog.show();
// SignBean bean = new SignBean();
// bean.setSigninLatitude(mCurrentLocation.getLatitude() + "");
// bean.setSigninLongitude(mCurrentLocation.getLongitude() + "");
// 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)
// .doSign(body, UserLgUtils.getToken())
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(new Observer<SignDataBean>() {
// @Override
// public void onSubscribe(Disposable d) {
//
// }
//
// @Override
// public void onNext(SignDataBean successBean) {
//// LogUtils.e(successBean);
//// uploadPoint();
// isSgin = true;
// isSignOff = false;
// if (successBean.isData()) {
// Glide.with(mActivity)
// .load(R.drawable.ic_late)
// .into(mIvState);
// mTvState.setText("迟到");
// mTvState.setTextColor(Color.RED);
// } else {
// Glide.with(mActivity)
// .load(R.drawable.ic_nomal)
// .into(mIvState);
// mTvState.setText("正常");
// mTvState.setTextColor(Color.WHITE);
// }
// dialog.dismiss();
// GlobalProvider.save(mActivity, "isUpload", "13");
// setSignOffText();
// mTvSign.setTextColor(Color.WHITE);
// ToastUtils.showLong("签到成功");
// }
//
// @Override
// public void onError(Throwable e) {
// e.printStackTrace();
// dialog.dismiss();
// ExceptionHandler.handleException(e);
// }
//
// @Override
// public void onComplete() {
//
// }
// });
}
/**
@ -1606,79 +1595,79 @@ public class MainActivity extends BaseActivity {
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);
// locationOption.setLocationPurpose(LocationClientOption.BDLocationPurpose.SignIn);
mLocationClient.setLocOption(locationOption);
//开始定位
mLocationClient.start();
// 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);
//// locationOption.setLocationPurpose(LocationClientOption.BDLocationPurpose.SignIn);
// mLocationClient.setLocOption(locationOption);
// //开始定位
// mLocationClient.start();
}
private void stopLocation() {
if (null != mLocationClient) {
mLocationClient.stop();
}
// 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 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 (PathConfig.CITY_CODE_DEFAULT.equals(bdLocation.getCityCode())) {
if (bdLocation != null && bdLocation.getLatitude() != 0 && bdLocation.getLongitude() != 0) {
if (mPrecision >= mPrecMax) {
mPrecision = mPrecisionDefault;
if (mGpsWeakDialog == null) {
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
builder.setMessage("当前GPS信号较弱请调整当前所在位置,或检查手机GPS是否开启,将Wifi与蓝牙打开会提高定位精度.")
.setTitle("提示")
.setNegativeButton("确定", (dialog, which) -> dialog.dismiss());
mGpsWeakDialog = builder.create();
}
if (!mGpsWeakDialog.isShowing()) {
mGpsWeakDialog.show();
}
} else {
if (bdLocation.getRadius() <= mPrecision) {
mPrecision = mPrecisionDefault;
if (bdLocation.getLatitude() != Double.MIN_VALUE && bdLocation.getLongitude() != Double.MIN_VALUE) {
mCurrentLocation = bdLocation;
if (mGpsDis != null && !mGpsDis.isDisposed()) {
mGpsDis.dispose();
}
if (TextUtils.isEmpty(mCurrentLocation.getAddrStr())) {
mTvCurrentTime.setText("当前地址:未知");
} else {
mTvCurrentTime.setText("当前地址:" + mCurrentLocation.getAddrStr());
}
}
} else {
mPrecision += 10;
}
}
}
}
}
// private void checkPointIsLegal(BDLocation bdLocation) {
// if (PathConfig.CITY_CODE_DEFAULT.equals(bdLocation.getCityCode())) {
// if (bdLocation != null && bdLocation.getLatitude() != 0 && bdLocation.getLongitude() != 0) {
// if (mPrecision >= mPrecMax) {
// mPrecision = mPrecisionDefault;
// if (mGpsWeakDialog == null) {
// AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
// builder.setMessage("当前GPS信号较弱请调整当前所在位置,或检查手机GPS是否开启,将Wifi与蓝牙打开会提高定位精度.")
// .setTitle("提示")
// .setNegativeButton("确定", (dialog, which) -> dialog.dismiss());
// mGpsWeakDialog = builder.create();
// }
// if (!mGpsWeakDialog.isShowing()) {
// mGpsWeakDialog.show();
// }
// } else {
// if (bdLocation.getRadius() <= mPrecision) {
// mPrecision = mPrecisionDefault;
// if (bdLocation.getLatitude() != Double.MIN_VALUE && bdLocation.getLongitude() != Double.MIN_VALUE) {
// mCurrentLocation = bdLocation;
// if (mGpsDis != null && !mGpsDis.isDisposed()) {
// mGpsDis.dispose();
// }
// if (TextUtils.isEmpty(mCurrentLocation.getAddrStr())) {
// mTvCurrentTime.setText("当前地址:未知");
// } else {
// mTvCurrentTime.setText("当前地址:" + mCurrentLocation.getAddrStr());
// }
// }
// } else {
// mPrecision += 10;
// }
// }
// }
// }
// }
@Override
public void onBackPressed() {

View File

@ -0,0 +1,270 @@
package com.sucstepsoft.txrealtimelocation.activitys.issue;
import android.app.ProgressDialog;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.provider.MediaStore;
import android.support.v4.content.FileProvider;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.Gravity;
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.BaseActivity;
import com.sucstepsoft.cm_utils.core.widget.views.ButtomDialogView;
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.txrealtimelocation.R;
import com.sucstepsoft.txrealtimelocation.activitys.common.PhotoActivity;
import com.sucstepsoft.txrealtimelocation.activitys.issue.demo.Options;
import com.sucstepsoft.txrealtimelocation.activitys.issue.demo.OptionsAdapter;
import com.sucstepsoft.txrealtimelocation.beans.BaseUserBean;
import com.sucstepsoft.txrealtimelocation.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.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 CheckOptionsActivity extends BaseActivity {
Unbinder mBind;
@BindView(R.id.rlv_options)
RecyclerView mRlvOptions;
private AddPhotoBean mCurrentBean;
private String mPicPath;
private int mCurrentIndex = 0;
private List<Options> mOptions;
private OptionsAdapter mAdapter;
@Override
protected int setLayoutId() {
return R.layout.activity_check_options_ce;
}
@Override
public void initData() {
mBind = ButterKnife.bind(this);
refreshView(STATE_LOAD_SUCCESS);
mTvBaseTitle.setText("企业检查");
mOptions = new ArrayList<>();
for (int i = 0; i < 200; i++) {
List<AddPhotoBean> mPhotos = new ArrayList<>();
mPhotos.add(new AddPhotoBean());
Options o = new Options();
o.setTitle("测试检查项" + i);
o.setPhotos(mPhotos);
mOptions.add(o);
}
mAdapter = new OptionsAdapter(this, mOptions);
mRlvOptions.setAdapter(mAdapter);
mRlvOptions.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mAdapter.addSelectPhotoListener((bean, options, i, type) -> {
if (type == 1) {
//选择图片
mCurrentIndex = i;
showSelectPhoto(bean);
} else {
//预览
ArrayList<String> list = new ArrayList<>();
list.add(bean.getPath());
Intent intent = new Intent();
intent.putExtra(PhotoActivity.TAG_IMGURL, list);
intent.setClass(CheckOptionsActivity.this, PhotoActivity.class);
startActivity(intent);
}
});
}
/**
* 显示选择图片
*
* @param bean
*/
private void showSelectPhoto(AddPhotoBean bean) {
hideSoftKeyboard();
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) {
mOptions.get(mCurrentIndex).getPhotos().add(new AddPhotoBean());
mCurrentBean.setPath(picPath);
mCurrentBean.setId("1234");
mAdapter.notifyItemChanged(mCurrentIndex);
// 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();
}
}

View File

@ -1,42 +1,12 @@
package com.sucstepsoft.txrealtimelocation.activitys.issue;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
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.txrealtimelocation.R;
import butterknife.BindView;
@ -51,18 +21,18 @@ public class TakePointActivity extends BaseActivity {
TextView mTvLatitude;
@BindView(R.id.tv_longitude)
TextView mTvLongitude;
@BindView(R.id.tmv_map)
TextureMapView mTmvMap;
// @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 LocationClient mLocationClient;
// private BaiduMap mBaiduMap;
// private GeoCoder mGeoCoder;
// private BitmapDescriptor mBitmap;
// private MessageReceiver mReceiver;
// private LocationClient mLocationClient;
@Override
protected int setLayoutId() {
@ -76,263 +46,263 @@ public class TakePointActivity extends BaseActivity {
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 (PathConfig.CITY_CODE_DEFAULT.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);
// 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 (PathConfig.CITY_CODE_DEFAULT.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();
}
// stopLocation();
// mBaiduMap = null;
// mBitmap = null;
// mGeoCoder.destroy();
// mGeoCoder = null;
// mTmvMap.onDestroy();
// if (mBind != null) {
// mBind.unbind();
// }
super.onDestroy();
}

View File

@ -0,0 +1,43 @@
package com.sucstepsoft.txrealtimelocation.activitys.issue.demo;
import com.sucstepsoft.cm_utils.core.beans.AddPhotoBean;
import com.sucstepsoft.txrealtimelocation.widget.EmStateCheck;
import java.util.List;
/**
* 作者: adam
* 日期: 2020/3/27 - 10:30 AM
* 邮箱: itgaojian@163.com
* 描述:
*/
public class Options {
private List<AddPhotoBean> photos;
private String title;
private EmStateCheck state = EmStateCheck.NORMAL;
public List<AddPhotoBean> getPhotos() {
return photos;
}
public void setPhotos(List<AddPhotoBean> photos) {
this.photos = photos;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public EmStateCheck getState() {
return state;
}
public void setState(EmStateCheck state) {
this.state = state;
}
}

View File

@ -0,0 +1,96 @@
package com.sucstepsoft.txrealtimelocation.activitys.issue.demo;
import android.content.Context;
import android.support.v7.widget.GridLayoutManager;
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.beans.AddPhotoBean;
import com.sucstepsoft.cm_utils.core.widget.base.AddPhotoAdapter;
import com.sucstepsoft.cm_utils.core.widget.base.BaseRecyclerAdapter;
import com.sucstepsoft.txrealtimelocation.R;
import com.sucstepsoft.txrealtimelocation.widget.EmStateCheck;
import java.util.List;
/**
* 作者: adam
* 日期: 2020/3/27 - 10:30 AM
* 邮箱: itgaojian@163.com
* 描述:
*/
public class OptionsAdapter extends BaseRecyclerAdapter<Options, OptionsHolder> {
public OptionsAdapter(Context ctx, List<Options> list) {
super(ctx, list);
}
@Override
public OptionsHolder createHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(mContext).inflate(R.layout.item_options, parent, false);
return new OptionsHolder(view);
}
@Override
public void bindHolder(OptionsHolder oHolder, int i) {
oHolder.mScvOptions.setCheckState(mData.get(i).getState());
oHolder.mScvOptions.setOnClickListener(v -> {
EmStateCheck state = oHolder.mScvOptions.getViewState();
switch (state) {
case NORMAL:
oHolder.mScvOptions.setCheckState(EmStateCheck.CHECK);
mData.get(i).setState(EmStateCheck.CHECK);
oHolder.mRlvPhotos.setVisibility(View.GONE);
break;
case CHECK:
oHolder.mScvOptions.setCheckState(EmStateCheck.UNCHECK);
mData.get(i).setState(EmStateCheck.UNCHECK);
oHolder.mRlvPhotos.setVisibility(View.VISIBLE);
initPhotosView(oHolder.mRlvPhotos, mData.get(i), i);
break;
case UNCHECK:
oHolder.mRlvPhotos.setVisibility(View.GONE);
oHolder.mScvOptions.setCheckState(EmStateCheck.NORMAL);
mData.get(i).setState(EmStateCheck.NORMAL);
break;
}
});
if (mData.get(i).getState() == EmStateCheck.UNCHECK) {
oHolder.mRlvPhotos.setVisibility(View.VISIBLE);
initPhotosView(oHolder.mRlvPhotos, mData.get(i), i);
} else {
oHolder.mRlvPhotos.setVisibility(View.GONE);
}
oHolder.mTvTitle.setText(mData.get(i).getTitle());
}
public void initPhotosView(RecyclerView rlv, Options op, int index) {
AddPhotoAdapter photoAdapter = new AddPhotoAdapter(mContext, op.getPhotos());
rlv.setAdapter(photoAdapter);
rlv.setLayoutManager(new GridLayoutManager(mContext, 4));
photoAdapter.addOnItemClickListener(bean -> {
if (mSelectPhotoListener != null) {
if (TextUtils.isEmpty(bean.getPath())) {
//空数据,选择图片
mSelectPhotoListener.onSelectPhoto(bean, op, index,1);
} else {
mSelectPhotoListener.onSelectPhoto(bean,op,index,2);
}
}
});
}
private SelectPhoto mSelectPhotoListener;
public void addSelectPhotoListener(SelectPhoto selectPhotoListener) {
this.mSelectPhotoListener = selectPhotoListener;
}
public interface SelectPhoto {
void onSelectPhoto(AddPhotoBean bean, Options options, int i,int type);
}
}

View File

@ -0,0 +1,28 @@
package com.sucstepsoft.txrealtimelocation.activitys.issue.demo;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;
import com.sucstepsoft.txrealtimelocation.R;
import com.sucstepsoft.txrealtimelocation.widget.StateCheckView;
/**
* 作者: adam
* 日期: 2020/3/27 - 10:32 AM
* 邮箱: itgaojian@163.com
* 描述:
*/
public class OptionsHolder extends RecyclerView.ViewHolder {
public TextView mTvTitle;
public StateCheckView mScvOptions;
public RecyclerView mRlvPhotos;
public OptionsHolder(@NonNull View itemView) {
super(itemView);
mTvTitle = itemView.findViewById(R.id.tv_title);
mScvOptions = itemView.findViewById(R.id.scv_options);
mRlvPhotos = itemView.findViewById(R.id.rlv_photos);
}
}

View File

@ -4,13 +4,9 @@ import android.content.Context;
import android.support.multidex.MultiDex;
import android.support.multidex.MultiDexApplication;
import com.baidu.mapapi.CoordType;
import com.baidu.mapapi.SDKInitializer;
import com.squareup.leakcanary.LeakCanary;
import com.tencent.bugly.crashreport.CrashReport;
import cn.jpush.android.api.JPushInterface;
/**
* 作者: Adam
* 日期: 2019/6/24 - 14:38
@ -26,12 +22,9 @@ public class BaseApplication extends MultiDexApplication {
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
initBaiduMap();
}
private void initJPush() {
JPushInterface.setDebugMode(false);
JPushInterface.init(this);
}
private void initLeak() {
@ -54,10 +47,10 @@ public class BaseApplication extends MultiDexApplication {
* 百度地图初始化
*/
private void initBaiduMap() {
SDKInitializer.initialize(this);
// SDKInitializer.initialize(this);
//自4.3.0起百度地图SDK所有接口均支持百度坐标和国测局坐标用此方法设置您使用的坐标类型.
//包括BD09LL和GCJ02两种坐标默认是BD09LL坐标
SDKInitializer.setCoordType(CoordType.BD09LL);
// SDKInitializer.setCoordType(CoordType.BD09LL);
}
// public static LocationChangBroadcastReceiver getlocationChangeBoardcase() {

View File

@ -1,48 +1,48 @@
package com.sucstepsoft.txrealtimelocation.beans;
import com.baidu.mapapi.model.LatLng;
/**
* 作者: Adam
* 日期: 2019/8/29 - 17:34
* 邮箱: itgaojian@163.com
* 描述: type 线的类型 12:移动 13:等待 14:异常
*/
public class DrawMapLineBean {
private int type;//线的类型
private LatLng onePoint;
private LatLng twoPoint;
private Integer lineColor;
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public LatLng getOnePoint() {
return onePoint;
}
public void setOnePoint(LatLng onePoint) {
this.onePoint = onePoint;
}
public LatLng getTwoPoint() {
return twoPoint;
}
public void setTwoPoint(LatLng twoPoint) {
this.twoPoint = twoPoint;
}
public Integer getLineColor() {
return lineColor;
}
public void setLineColor(Integer lineColor) {
this.lineColor = lineColor;
}
}
//package com.sucstepsoft.txrealtimelocation.beans;
//
//import com.baidu.mapapi.model.LatLng;
//
///**
// * 作者: Adam
// * 日期: 2019/8/29 - 17:34
// * 邮箱: itgaojian@163.com
// * 描述: type 线的类型 12:移动 13:等待 14:异常
// */
//public class DrawMapLineBean {
// private int type;//线的类型
// private LatLng onePoint;
// private LatLng twoPoint;
// private Integer lineColor;
//
// public int getType() {
// return type;
// }
//
// public void setType(int type) {
// this.type = type;
// }
//
// public LatLng getOnePoint() {
// return onePoint;
// }
//
// public void setOnePoint(LatLng onePoint) {
// this.onePoint = onePoint;
// }
//
// public LatLng getTwoPoint() {
// return twoPoint;
// }
//
// public void setTwoPoint(LatLng twoPoint) {
// this.twoPoint = twoPoint;
// }
//
// public Integer getLineColor() {
// return lineColor;
// }
//
// public void setLineColor(Integer lineColor) {
// this.lineColor = lineColor;
// }
//}

View File

@ -15,7 +15,7 @@ import com.sucstepsoft.cm_utils.core.widget.base.LazyFragment;
import com.sucstepsoft.cm_utils.utils.ToastUtils;
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
import com.sucstepsoft.txrealtimelocation.R;
import com.sucstepsoft.txrealtimelocation.activitys.issue.IssueDetailActivity;
//import com.sucstepsoft.txrealtimelocation.activitys.issue.IssueDetailActivity;
import com.sucstepsoft.txrealtimelocation.adapters.IssueSubAdapter;
import com.sucstepsoft.txrealtimelocation.beans.IssueSubBean;
import com.sucstepsoft.txrealtimelocation.net.LocationApiService;
@ -101,9 +101,9 @@ public class MineIssueFragment extends LazyFragment {
* @param bean
*/
private void showIssueDetail(IssueSubBean.RowsBean bean) {
Intent intent = new Intent(mActivity, IssueDetailActivity.class);
intent.putExtra("bean", bean);
startActivity(intent);
// Intent intent = new Intent(mActivity, IssueDetailActivity.class);
// intent.putExtra("bean", bean);
// startActivity(intent);
}
@Override

View File

@ -15,7 +15,7 @@ import com.sucstepsoft.cm_utils.core.widget.base.LazyFragment;
import com.sucstepsoft.cm_utils.utils.ToastUtils;
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
import com.sucstepsoft.txrealtimelocation.R;
import com.sucstepsoft.txrealtimelocation.activitys.issue.IssueDetailActivity;
//import com.sucstepsoft.txrealtimelocation.activitys.issue.IssueDetailActivity;
import com.sucstepsoft.txrealtimelocation.adapters.IssueSubAdapter;
import com.sucstepsoft.txrealtimelocation.beans.IssueSubBean;
import com.sucstepsoft.txrealtimelocation.net.LocationApiService;
@ -121,27 +121,27 @@ public class PendingFragment extends LazyFragment {
* @param bean
*/
private void showIssueDetail(IssueSubBean.RowsBean bean) {
Intent intent = new Intent(mActivity, IssueDetailActivity.class);
intent.putExtra("bean", bean);
switch (bean.getCaseStatus()) {
case "0"://待受理
break;
case "1"://待立案
break;
case "2"://待下派
break;
case "3"://待处理
break;
case "4":
case "5":
intent.putExtra("check", "check");
break;
case "6"://已经归档
break;
default:
break;
}
startActivity(intent);
// Intent intent = new Intent(mActivity, IssueDetailActivity.class);
// intent.putExtra("bean", bean);
// switch (bean.getCaseStatus()) {
// case "0"://待受理
// break;
// case "1"://待立案
// break;
// case "2"://待下派
// break;
// case "3"://待处理
// break;
// case "4":
// case "5":
// intent.putExtra("check", "check");
// break;
// case "6"://已经归档
// break;
// default:
// break;
// }
// startActivity(intent);
}
@Override

View File

@ -4,29 +4,13 @@ import android.app.Activity;
import android.app.ProgressDialog;
import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
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.InfoWindow;
import com.baidu.mapapi.map.MapStatus;
import com.baidu.mapapi.map.MapStatusUpdate;
import com.baidu.mapapi.map.MapStatusUpdateFactory;
import com.baidu.mapapi.map.MapView;
import com.baidu.mapapi.map.MarkerOptions;
import com.baidu.mapapi.map.OverlayOptions;
import com.baidu.mapapi.map.PolylineOptions;
import com.baidu.mapapi.model.LatLng;
import com.bigkoo.pickerview.builder.TimePickerBuilder;
import com.bigkoo.pickerview.view.TimePickerView;
import com.bumptech.glide.Glide;
import com.sucstepsoft.cm_utils.constant.PathConfig;
import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager;
import com.sucstepsoft.cm_utils.core.widget.base.LazyFragment;
import com.sucstepsoft.cm_utils.utils.ToastUtils;
@ -39,11 +23,9 @@ import com.sucstepsoft.txrealtimelocation.net.LocationApiService;
import com.sucstepsoft.txrealtimelocation.widget.ListPopup;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
import io.reactivex.Observer;
@ -58,8 +40,8 @@ import io.reactivex.schedulers.Schedulers;
* 描述:
*/
public class LocusMapFragment extends LazyFragment {
@BindView(R.id.mv_map)
MapView mMapView;
// @BindView(R.id.mv_map)
// MapView mMapView;
@BindView(R.id.tv_time)
TextView mTvTime;
@BindView(R.id.iv_4)
@ -74,45 +56,45 @@ public class LocusMapFragment extends LazyFragment {
private String mPath;
private List<UnderlingBean> mUserBeans;
private boolean mIsOnline;
private BaiduMap mBaiduMap;
private LatLng mDefaultPoint;
// private BaiduMap mBaiduMap;
// private LatLng mDefaultPoint;
private String mSelUserId;
private String mSelTime;
@Override
protected void onCreateViewLazy(Bundle savedInstanceState) {
super.onCreateViewLazy(savedInstanceState);
View view = LayoutInflater.from(mActivity).inflate(R.layout.fragment_locus_map, null);
setContentView(view);
mBind = ButterKnife.bind(this, view);
mUserBeans = new ArrayList<>();
mDefaultPoint = new LatLng(PathConfig.LA, PathConfig.LO);
mPath = getArguments().getString("title");
mIsOnline = getArguments().getBoolean("isOnline");
mBaiduMap = mMapView.getMap();
MapStatus ms = new MapStatus.Builder().zoom(14).target(mDefaultPoint).build();
MapStatusUpdate u = MapStatusUpdateFactory.newMapStatus(ms);
View child = mMapView.getChildAt(1);
if (child != null && (child instanceof ImageView || child instanceof ZoomControls)) {
child.setVisibility(View.GONE);
}
mMapView.showZoomControls(false);
mBaiduMap.animateMapStatus(u);
getOfflineUserList(mPath, mIsOnline);
mSelTime = mDateFormat.format(System.currentTimeMillis());
mTvTime.setText(mSelTime);
mBtnReload.setOnClickListener(v -> {
mSelTime = mDateFormat.format(System.currentTimeMillis());
mTvTime.setText(mSelTime);
mSelUserId = "";
mBaiduMap.clear();
if (mUserBeans != null && mUserBeans.size() > 0) {
addMarkers();
}
});
Glide.with(mActivity)
.load(R.drawable.ic_user_default)
.into(mIvUser_4);
// View view = LayoutInflater.from(mActivity).inflate(R.layout.fragment_locus_map, null);
// setContentView(view);
// mBind = ButterKnife.bind(this, view);
// mUserBeans = new ArrayList<>();
// mDefaultPoint = new LatLng(PathConfig.LA, PathConfig.LO);
// mPath = getArguments().getString("title");
// mIsOnline = getArguments().getBoolean("isOnline");
// mBaiduMap = mMapView.getMap();
// MapStatus ms = new MapStatus.Builder().zoom(14).target(mDefaultPoint).build();
// MapStatusUpdate u = MapStatusUpdateFactory.newMapStatus(ms);
// View child = mMapView.getChildAt(1);
// if (child != null && (child instanceof ImageView || child instanceof ZoomControls)) {
// child.setVisibility(View.GONE);
// }
// mMapView.showZoomControls(false);
// mBaiduMap.animateMapStatus(u);
// getOfflineUserList(mPath, mIsOnline);
// mSelTime = mDateFormat.format(System.currentTimeMillis());
// mTvTime.setText(mSelTime);
// mBtnReload.setOnClickListener(v -> {
// mSelTime = mDateFormat.format(System.currentTimeMillis());
// mTvTime.setText(mSelTime);
// mSelUserId = "";
// mBaiduMap.clear();
// if (mUserBeans != null && mUserBeans.size() > 0) {
// addMarkers();
// }
// });
// Glide.with(mActivity)
// .load(R.drawable.ic_user_default)
// .into(mIvUser_4);
}
@ -181,11 +163,11 @@ public class LocusMapFragment extends LazyFragment {
@Override
protected void onDestroyViewLazy() {
mMapView.onDestroy();
mMapView = null;
if (mBind != null) {
mBind.unbind();
}
// mMapView.onDestroy();
// mMapView = null;
// if (mBind != null) {
// mBind.unbind();
// }
super.onDestroyViewLazy();
}
@ -249,24 +231,24 @@ public class LocusMapFragment extends LazyFragment {
private void drawUserLines(List<UserocationBean> userocationBeans) {
if (userocationBeans.size() > 2) {
mBaiduMap.clear();
List<LatLng> points11 = new ArrayList<>();
for (int i = 0; i < userocationBeans.size(); i++) {
double l = Double.parseDouble(userocationBeans.get(i).getUserLongitude());
double a = Double.parseDouble(userocationBeans.get(i).getUserLatitude());
LatLng latLng = new LatLng(a, l);
// if ("1".equals(userocationBeans.get(i).getIsOverstep())) {
// beans.add(userocationBeans.get(i));
// }
points11.add(latLng);
}
OverlayOptions ooPolyline11 = new PolylineOptions()
.width(20)
.points(points11)
.dottedLine(false)
.customTexture(BitmapDescriptorFactory.fromResource(R.drawable.ic_road_red));
mBaiduMap.addOverlay(ooPolyline11);
// mBaiduMap.clear();
// List<LatLng> points11 = new ArrayList<>();
// for (int i = 0; i < userocationBeans.size(); i++) {
// double l = Double.parseDouble(userocationBeans.get(i).getUserLongitude());
// double a = Double.parseDouble(userocationBeans.get(i).getUserLatitude());
// LatLng latLng = new LatLng(a, l);
//// if ("1".equals(userocationBeans.get(i).getIsOverstep())) {
//// beans.add(userocationBeans.get(i));
//// }
// points11.add(latLng);
// }
//
// OverlayOptions ooPolyline11 = new PolylineOptions()
// .width(20)
// .points(points11)
// .dottedLine(false)
// .customTexture(BitmapDescriptorFactory.fromResource(R.drawable.ic_road_red));
// mBaiduMap.addOverlay(ooPolyline11);
} else {
ToastUtils.showShort("暂无数据");
}
@ -274,40 +256,40 @@ public class LocusMapFragment extends LazyFragment {
private void addMarkers() {
List<OverlayOptions> options = new ArrayList<OverlayOptions>();
View view = View.inflate(mActivity, R.layout.item_map_user_icon, null);
for (int i = 0; i < mUserBeans.size(); i++) {
LatLng latLng = new LatLng(Double.parseDouble(mUserBeans.get(i).getUserLatitude()), Double.parseDouble(mUserBeans.get(i).getUserLongitude()));
TextView mTvName = view.findViewById(R.id.tv_name);
mTvName.setText(mUserBeans.get(i).getUseName());
BitmapDescriptor bt = BitmapDescriptorFactory.fromView(view);
Bundle bundle = new Bundle();
bundle.putString("uId", mUserBeans.get(i).getCreator());
bundle.putString("uName", mUserBeans.get(i).getUseName());
bundle.putString("uLocation", mUserBeans.get(i).getUserLocation());
bundle.putString("uTime", mUserBeans.get(i).getGmtCreate());
OverlayOptions option1 = new MarkerOptions()
.position(latLng)
.perspective(true)
.extraInfo(bundle)
.anchor(0.3f, 1f)
.icon(bt);
options.add(option1);
}
mBaiduMap.addOverlays(options);
mBaiduMap.setOnMarkerClickListener(marker -> {
View infoView = View.inflate(mActivity, R.layout.item_map_user_info, null);
TextView mTvName = infoView.findViewById(R.id.tv_user_name);
TextView mTvLocation = infoView.findViewById(R.id.tv_user_location);
TextView mTvTime = infoView.findViewById(R.id.tv_user_time);
mTvName.setText("姓名 :" + marker.getExtraInfo().getString("uName"));
mTvLocation.setText(marker.getExtraInfo().getString("uLocation"));
mTvTime.setText("时间 :" + marker.getExtraInfo().getString("uTime"));
InfoWindow infoWindow = new InfoWindow(infoView, marker.getPosition(), -view.getHeight());
mBaiduMap.showInfoWindow(infoWindow);
infoView.setOnClickListener(v -> mBaiduMap.hideInfoWindow());
return false;
});
// List<OverlayOptions> options = new ArrayList<OverlayOptions>();
// View view = View.inflate(mActivity, R.layout.item_map_user_icon, null);
// for (int i = 0; i < mUserBeans.size(); i++) {
// LatLng latLng = new LatLng(Double.parseDouble(mUserBeans.get(i).getUserLatitude()), Double.parseDouble(mUserBeans.get(i).getUserLongitude()));
// TextView mTvName = view.findViewById(R.id.tv_name);
// mTvName.setText(mUserBeans.get(i).getUseName());
// BitmapDescriptor bt = BitmapDescriptorFactory.fromView(view);
// Bundle bundle = new Bundle();
// bundle.putString("uId", mUserBeans.get(i).getCreator());
// bundle.putString("uName", mUserBeans.get(i).getUseName());
// bundle.putString("uLocation", mUserBeans.get(i).getUserLocation());
// bundle.putString("uTime", mUserBeans.get(i).getGmtCreate());
// OverlayOptions option1 = new MarkerOptions()
// .position(latLng)
// .perspective(true)
// .extraInfo(bundle)
// .anchor(0.3f, 1f)
// .icon(bt);
// options.add(option1);
// }
// mBaiduMap.addOverlays(options);
// mBaiduMap.setOnMarkerClickListener(marker -> {
// View infoView = View.inflate(mActivity, R.layout.item_map_user_info, null);
// TextView mTvName = infoView.findViewById(R.id.tv_user_name);
// TextView mTvLocation = infoView.findViewById(R.id.tv_user_location);
// TextView mTvTime = infoView.findViewById(R.id.tv_user_time);
// mTvName.setText("姓名 :" + marker.getExtraInfo().getString("uName"));
// mTvLocation.setText(marker.getExtraInfo().getString("uLocation"));
// mTvTime.setText("时间 :" + marker.getExtraInfo().getString("uTime"));
// InfoWindow infoWindow = new InfoWindow(infoView, marker.getPosition(), -view.getHeight());
// mBaiduMap.showInfoWindow(infoWindow);
// infoView.setOnClickListener(v -> mBaiduMap.hideInfoWindow());
// return false;
// });
}
private void showTimePicker() {
@ -328,9 +310,9 @@ public class LocusMapFragment extends LazyFragment {
@Override
public void onDestroy() {
if (mMapView != null) {
mMapView.onDestroy();
}
// if (mMapView != null) {
// mMapView.onDestroy();
// }
super.onDestroy();
}
}

View File

@ -21,8 +21,6 @@ import android.os.Environment;
import android.text.TextUtils;
import android.util.Log;
import com.baidu.location.BDLocation;
import com.sucstepsoft.cm_utils.constant.PathConfig;
import com.sucstepsoft.cm_utils.utils.LogUtils;
import com.sucstepsoft.txrealtimelocation.R;

View File

@ -1,167 +1,167 @@
package com.sucstepsoft.txrealtimelocation.utils;
import com.baidu.mapapi.model.LatLng;
import java.util.List;
/**
* 作者: Adam
* 日期: 2019/7/17 - 16:42
* 邮箱: itgaojian@163.com
* 描述:
*/
public class PointUtils {
private static double EARTH_RADIUS = 6378.137;
public static boolean isMove(LatLng p1, LatLng p2, int i) {
return false;
}
/**
* 获取list范围内的中心点
*
* @param mPoints
* @return
*/
public static LatLng getCenterOfGravityPoint(List<LatLng> mPoints) {
double area = 0.000000000;//多边形面积
double x = 0.0000000d, y = 0.0000000000d;// 重心的xy
for (int i = 1; i <= mPoints.size(); i++) {
double iLat = mPoints.get(i % mPoints.size()).latitude;
double iLng = mPoints.get(i % mPoints.size()).longitude;
double nextLat = mPoints.get(i - 1).latitude;
double nextLng = mPoints.get(i - 1).longitude;
double temp = (iLat * nextLng - iLng * nextLat) / 2.0f;
area += temp;
x += temp * (iLat + nextLat) / 3.0f;
y += temp * (iLng + nextLng) / 3.0f;
}
x = x / area;
y = y / area;
return new LatLng(x, y);
}
private static LatLng GetCenterPoint(List<LatLng> latLngs) {
int total = latLngs.size();
double lat = 0, lon = 0;
for (LatLng g : latLngs) {
lat += g.latitude * Math.PI / 180;
lon += g.longitude * Math.PI / 180;
}
lat /= total;
lon /= total;
return new LatLng(lat * 180 / Math.PI, lon * 180 / Math.PI);
}
/**
* 判断点是否在多边形内
*
* @param point 测试点
* @param pts 多边形的点
* @return boolean
* @throws
* @Title: IsPointInPoly
*/
public static boolean isInPolygon(LatLng point, List<LatLng> pts) {
int N = pts.size();
boolean boundOrVertex = true;
int intersectCount = 0;//交叉点数量
double precision = 2e-10; //浮点类型计算时候与0比较时候的容差
LatLng p1, p2;//临近顶点
LatLng p = point; //当前点
p1 = pts.get(0);
for (int i = 1; i <= N; ++i) {
if (p.equals(p1)) {
return boundOrVertex;
}
p2 = pts.get(i % N);
if (p.latitude < Math.min(p1.latitude, p2.latitude) || p.latitude > Math.max(p1.latitude, p2.latitude)) {
p1 = p2;
continue;
}
//射线穿过算法
if (p.latitude > Math.min(p1.latitude, p2.latitude) && p.latitude < Math.max(p1.latitude, p2.latitude)) {
if (p.longitude <= Math.max(p1.longitude, p2.longitude)) {
if (p1.latitude == p2.latitude && p.longitude >= Math.min(p1.longitude, p2.longitude)) {
return boundOrVertex;
}
if (p1.longitude == p2.longitude) {
if (p1.longitude == p.longitude) {
return boundOrVertex;
} else {
++intersectCount;
}
} else {
double xinters = (p.latitude - p1.latitude) * (p2.longitude - p1.longitude) / (p2.latitude - p1.latitude) + p1.longitude;
if (Math.abs(p.longitude - xinters) < precision) {
return boundOrVertex;
}
if (p.longitude < xinters) {
++intersectCount;
}
}
}
} else {
if (p.latitude == p2.latitude && p.longitude <= p2.longitude) {
LatLng p3 = pts.get((i + 1) % N);
if (p.latitude >= Math.min(p1.latitude, p3.latitude) && p.latitude <= Math.max(p1.latitude, p3.latitude)) {
++intersectCount;
} else {
intersectCount += 2;
}
}
}
p1 = p2;
}
if (intersectCount % 2 == 0) {//偶数在多边形外
return false;
} else { //奇数在多边形内
return true;
}
}
/**
* 通过经纬度获取距离(单位)
*
* @param lat1
* @param lng1
* @param lat2
* @param lng2
* @return
*/
public static double getDistance(double lat1, double lng1, double lat2,
double lng2) {
double radLat1 = rad(lat1);
double radLat2 = rad(lat2);
double a = radLat1 - radLat2;
double b = rad(lng1) - rad(lng2);
double s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) +
Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
s = s * EARTH_RADIUS;
s = Math.round(s * 10000d) / 10000d;
return s;
}
/**
* 判断一个点是否在圆形区域内
*/
public static boolean isInCircle(double lng1, double lat1, double lng2, double lat2, String radius) {
double distance = getDistance(lat1, lng1, lat2, lng2);
double r = Double.parseDouble(radius);
if (distance > r) {
return false;
} else {
return true;
}
}
private static double rad(double d) {
return d * Math.PI / 180.0;
}
}
//package com.sucstepsoft.txrealtimelocation.utils;
//
//import com.baidu.mapapi.model.LatLng;
//
//import java.util.List;
//
///**
// * 作者: Adam
// * 日期: 2019/7/17 - 16:42
// * 邮箱: itgaojian@163.com
// * 描述:
// */
//public class PointUtils {
//
// private static double EARTH_RADIUS = 6378.137;
//
// public static boolean isMove(LatLng p1, LatLng p2, int i) {
//
// return false;
// }
//
// /**
// * 获取list范围内的中心点
// *
// * @param mPoints
// * @return
// */
// public static LatLng getCenterOfGravityPoint(List<LatLng> mPoints) {
// double area = 0.000000000;//多边形面积
// double x = 0.0000000d, y = 0.0000000000d;// 重心的xy
// for (int i = 1; i <= mPoints.size(); i++) {
// double iLat = mPoints.get(i % mPoints.size()).latitude;
// double iLng = mPoints.get(i % mPoints.size()).longitude;
// double nextLat = mPoints.get(i - 1).latitude;
// double nextLng = mPoints.get(i - 1).longitude;
// double temp = (iLat * nextLng - iLng * nextLat) / 2.0f;
// area += temp;
// x += temp * (iLat + nextLat) / 3.0f;
// y += temp * (iLng + nextLng) / 3.0f;
// }
// x = x / area;
// y = y / area;
// return new LatLng(x, y);
// }
//
// private static LatLng GetCenterPoint(List<LatLng> latLngs) {
// int total = latLngs.size();
// double lat = 0, lon = 0;
// for (LatLng g : latLngs) {
// lat += g.latitude * Math.PI / 180;
// lon += g.longitude * Math.PI / 180;
// }
// lat /= total;
// lon /= total;
// return new LatLng(lat * 180 / Math.PI, lon * 180 / Math.PI);
// }
//
// /**
// * 判断点是否在多边形内
// *
// * @param point 测试点
// * @param pts 多边形的点
// * @return boolean
// * @throws
// * @Title: IsPointInPoly
// */
// public static boolean isInPolygon(LatLng point, List<LatLng> pts) {
//
// int N = pts.size();
// boolean boundOrVertex = true;
// int intersectCount = 0;//交叉点数量
// double precision = 2e-10; //浮点类型计算时候与0比较时候的容差
// LatLng p1, p2;//临近顶点
// LatLng p = point; //当前点
// p1 = pts.get(0);
// for (int i = 1; i <= N; ++i) {
// if (p.equals(p1)) {
// return boundOrVertex;
// }
// p2 = pts.get(i % N);
// if (p.latitude < Math.min(p1.latitude, p2.latitude) || p.latitude > Math.max(p1.latitude, p2.latitude)) {
// p1 = p2;
// continue;
// }
// //射线穿过算法
// if (p.latitude > Math.min(p1.latitude, p2.latitude) && p.latitude < Math.max(p1.latitude, p2.latitude)) {
// if (p.longitude <= Math.max(p1.longitude, p2.longitude)) {
// if (p1.latitude == p2.latitude && p.longitude >= Math.min(p1.longitude, p2.longitude)) {
// return boundOrVertex;
// }
// if (p1.longitude == p2.longitude) {
// if (p1.longitude == p.longitude) {
// return boundOrVertex;
// } else {
// ++intersectCount;
// }
// } else {
// double xinters = (p.latitude - p1.latitude) * (p2.longitude - p1.longitude) / (p2.latitude - p1.latitude) + p1.longitude;
// if (Math.abs(p.longitude - xinters) < precision) {
// return boundOrVertex;
// }
//
// if (p.longitude < xinters) {
// ++intersectCount;
// }
// }
// }
// } else {
// if (p.latitude == p2.latitude && p.longitude <= p2.longitude) {
// LatLng p3 = pts.get((i + 1) % N);
// if (p.latitude >= Math.min(p1.latitude, p3.latitude) && p.latitude <= Math.max(p1.latitude, p3.latitude)) {
// ++intersectCount;
// } else {
// intersectCount += 2;
// }
// }
// }
// p1 = p2;
// }
// if (intersectCount % 2 == 0) {//偶数在多边形外
// return false;
// } else { //奇数在多边形内
// return true;
// }
// }
//
// /**
// * 通过经纬度获取距离(单位)
// *
// * @param lat1
// * @param lng1
// * @param lat2
// * @param lng2
// * @return
// */
// public static double getDistance(double lat1, double lng1, double lat2,
// double lng2) {
// double radLat1 = rad(lat1);
// double radLat2 = rad(lat2);
// double a = radLat1 - radLat2;
// double b = rad(lng1) - rad(lng2);
// double s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) +
// Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
// s = s * EARTH_RADIUS;
// s = Math.round(s * 10000d) / 10000d;
// return s;
// }
//
// /**
// * 判断一个点是否在圆形区域内
// */
// public static boolean isInCircle(double lng1, double lat1, double lng2, double lat2, String radius) {
// double distance = getDistance(lat1, lng1, lat2, lng2);
// double r = Double.parseDouble(radius);
// if (distance > r) {
// return false;
// } else {
// return true;
// }
//
// }
//
// private static double rad(double d) {
// return d * Math.PI / 180.0;
// }
//
//}

View File

@ -0,0 +1,11 @@
package com.sucstepsoft.txrealtimelocation.widget;
/**
* 作者: adam
* 日期: 2020-03-26 - 12:53
* 邮箱: itgaojian@163.com
* 描述:
*/
public enum EmStateCheck {
UNCHECK, NORMAL, CHECK
}

View File

@ -0,0 +1,86 @@
package com.sucstepsoft.txrealtimelocation.widget;
import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.sucstepsoft.txrealtimelocation.R;
/**
* 作者: adam
* 日期: 2020-03-26 - 12:47
* 邮箱: itgaojian@163.com
* 描述:
*/
public class StateCheckView extends LinearLayout {
private static final int[] STATE_NORMAL = new int[]{R.attr.state_normal};
private static final int[] STATE_CHECK = new int[]{R.attr.state_check};
private static final int[] STATE_UNCHECK = new int[]{R.attr.state_uncheck};
private EmStateCheck mState = EmStateCheck.NORMAL;
private TextView mTvState;
public StateCheckView(Context context) {
super(context);
initView();
}
public StateCheckView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
initView();
}
public StateCheckView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initView();
}
private void initView() {
View view = LayoutInflater.from(getContext()).inflate(R.layout.options_state, this);
mTvState = view.findViewById(R.id.tv_state);
mTvState.setText("未检查");
}
@Override
protected int[] onCreateDrawableState(int extraSpace) {
int[] sate = super.onCreateDrawableState(extraSpace + 1);
switch (mState) {
case NORMAL:
mergeDrawableStates(sate, STATE_NORMAL);
break;
case CHECK:
mergeDrawableStates(sate, STATE_CHECK);
break;
case UNCHECK:
mergeDrawableStates(sate, STATE_UNCHECK);
break;
}
return sate;
}
public void setCheckState(EmStateCheck state) {
if (state != mState) {
mState = state;
refreshDrawableState();
switch (mState) {
case NORMAL:
mTvState.setText("未检查");
break;
case CHECK:
mTvState.setText("已检查");
break;
case UNCHECK:
mTvState.setText("不合格");
break;
}
}
}
public EmStateCheck getViewState() {
return mState;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:example="http://schemas.android.com/apk/res-auto">
<!-- <attr name="state_normal" format="boolean"/>-->
<!-- <attr name="state_check" format="boolean"/>-->
<!-- <attr name="state_uncheck" format="boolean"/>-->
<item android:drawable="@drawable/ic_check_un" example:state_normal="true" />
<item android:drawable="@drawable/ic_check_del" example:state_uncheck="true" />
<item android:drawable="@drawable/ic_check_sel" example:state_check="true" />
</selector>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activitys.issue.CheckOptionsActivity">
<android.support.v7.widget.RecyclerView
android:id="@+id/rlv_options"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>

View File

@ -12,11 +12,6 @@
android:layout_margin="50dp">
<!--<ImageView-->
<!--android:id="@+id/iv_test"-->
<!--android:layout_width="50dp"-->
<!--android:layout_height="50dp" />-->
<RelativeLayout
android:id="@+id/rl_phone"
android:layout_width="match_parent"
@ -96,23 +91,34 @@
android:textColor="@color/white"
android:textSize="17sp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/btn_confirm"
android:layout_marginTop="10dp">
<CheckBox
android:id="@+id/cb_remember"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="记住密码"
android:textColor="@color/white"
android:textSize="15sp" />
<TextView
android:id="@+id/tv_change_pwd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:clickable="true"
android:text="忘记密码"
android:textColor="@color/white"
android:textSize="15sp" />
android:textSize="15sp"
android:visibility="gone" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>

View File

@ -22,7 +22,6 @@
android:layout_centerInParent="true"
android:gravity="center_vertical">
<ImageView
android:id="@+id/iv_user_icon"
android:layout_width="wrap_content"
@ -81,7 +80,8 @@
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
android:orientation="horizontal"
android:visibility="gone">
<LinearLayout
android:layout_width="wrap_content"
@ -279,7 +279,7 @@
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="10dp"
android:text="版权所有 包头市稀土高新区"
android:text="版权所有 包头市应急管理局"
android:textColor="#ffcbcbcb"
android:textSize="12sp" />

View File

@ -10,9 +10,9 @@
android:gravity="center"
android:orientation="vertical"
android:paddingLeft="15dp"
android:paddingTop="10dp"
android:paddingTop="25dp"
android:paddingRight="15dp"
android:paddingBottom="10dp">
android:paddingBottom="25dp">
<ImageView
android:id="@+id/iv_icon"

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="5dp">
<TextView
android:id="@+id/tv_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="6"
android:textColor="@color/black"
android:textSize="15sp"
tools:text="测试数据" />
<com.sucstepsoft.txrealtimelocation.widget.StateCheckView
android:id="@+id/scv_options"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/rlv_photos"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:duplicateParentState="true"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/iv_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/sel_check_options"
android:duplicateParentState="true" />
<TextView
android:id="@+id/tv_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:duplicateParentState="true"
android:text="天气"
android:textColor="@color/black"
tools:text="状态" />
</LinearLayout>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="CheckState">
<attr name="state_normal" format="boolean"/>
<attr name="state_check" format="boolean"/>
<attr name="state_uncheck" format="boolean"/>
</declare-styleable>
</resources>

View File

@ -1,6 +1,6 @@
<resources>
<string name="app_name">应急管理局</string>
<!-- <string name="app_name">片长工作测试</string>-->
<string name="app_name">应急管理局</string>
<!-- <string name="app_name">片长工作测试</string>-->
<string name="default_channel">定位点记录中...</string>
<string name="tip_issue_area"><Data><![CDATA[<font size="14">所属区域</font><font color="#e60012" size="10"> * </font>]]></Data></string>
<string name="tip_issue_detail"><Data><![CDATA[<font color="#e60012" size="10"> * </font><font size="17">详细信息</font>]]></Data></string>