隐患上报 企业录入

This commit is contained in:
itgaojian163 2020-03-29 20:58:50 +08:00
parent 0ad547b651
commit 4f713c9e0e
38 changed files with 3789 additions and 3980 deletions

View File

@ -0,0 +1,7 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AndroidLintLockedOrientationActivity" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidLintSourceLockedOrientationActivity" enabled="false" level="ERROR" enabled_by_default="false" />
</profile>
</component>

View File

@ -5,7 +5,7 @@
<configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" />
</configurations>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="13" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View File

@ -47,6 +47,14 @@
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".activitys.trouble.SelCompanyActivity"></activity>
<activity android:name=".activitys.trouble.TroubleReportActivity" />
<activity android:name=".activitys.companylib.CompanyInfoEditActivity" />
<activity android:name=".activitys.companylib.CompanyDetailActivity" />
<activity
android:name=".activitys.companylib.EnterCompanyInfoActivity"
android:screenOrientation="portrait" />
<activity android:name=".activitys.companylib.CompanyLibActivity" />
<activity
android:name=".activitys.issue.CheckOptionsActivity"
android:screenOrientation="portrait" />
@ -100,10 +108,9 @@
android:screenOrientation="portrait" />
<activity
android:name=".activitys.mine.AvisoActivity"
android:screenOrientation="portrait" />
<activity
android:name=".activitys.issue.IssueDetailActivity"
android:screenOrientation="portrait" />
android:screenOrientation="portrait" /> <!-- <activity -->
<!-- android:name=".activitys.issue.IssueDetailActivity" -->
<!-- android:screenOrientation="portrait" /> -->
<activity
android:name=".activitys.mine.UserInfoActivity"
android:screenOrientation="portrait" />
@ -118,18 +125,16 @@
android:screenOrientation="portrait" />
<activity
android:name=".activitys.mine.UserActivity"
android:screenOrientation="portrait" />
<activity
android:name=".activitys.locus.LocusMapActivity"
android:screenOrientation="portrait" />
android:screenOrientation="portrait" /> <!-- <activity -->
<!-- android:name=".activitys.locus.LocusMapActivity" -->
<!-- android:screenOrientation="portrait" /> -->
<activity
android:name=".activitys.issue.IssueRecordActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan|stateHidden" />
<activity
android:name=".activitys.issue.IssueReportActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan|stateHidden" />
android:windowSoftInputMode="adjustPan|stateHidden" /> <!-- <activity -->
<!-- android:name=".activitys.issue.IssueReportActivity" -->
<!-- android:screenOrientation="portrait" -->
<!-- android:windowSoftInputMode="adjustPan|stateHidden" /> -->
<activity
android:name=".activitys.base.SinglePixelActivity"
android:excludeFromRecents="true"
@ -171,37 +176,34 @@
</intent-filter>
</activity> <!-- ====百度地图=== -->
<activity android:name=".activitys.common.PhotoActivity" /> <!-- ============== -->
<!-- <activity-->
<!-- android:name="cn.jpush.android.ui.PopWinActivity"-->
<!-- android:exported="false"-->
<!-- android:screenOrientation="portrait"-->
<!-- android:theme="@style/MyDialogStyle" />-->
<!-- <activity-->
<!-- android:name="cn.jpush.android.ui.PushActivity"-->
<!-- android:configChanges="orientation|keyboardHidden"-->
<!-- android:exported="false"-->
<!-- android:screenOrientation="portrait"-->
<!-- android:theme="@android:style/Theme.NoTitleBar">-->
<!-- <intent-filter>-->
<!-- <action android:name="cn.jpush.android.ui.PushActivity" />-->
<!-- <category android:name="android.intent.category.DEFAULT" />-->
<!-- <category android:name="${applicationId}" />-->
<!-- </intent-filter>-->
<!-- </activity>-->
<!-- <activity-->
<!-- android:name="cn.jpush.android.service.JNotifyActivity"-->
<!-- android:exported="true"-->
<!-- android:screenOrientation="portrait"-->
<!-- android:taskAffinity="jpush.custom"-->
<!-- android:theme="@android:style/Theme.Translucent.NoTitleBar">-->
<!-- <intent-filter>-->
<!-- <action android:name="cn.jpush.android.intent.JNotifyActivity" />-->
<!-- <category android:name="${applicationId}" />-->
<!-- </intent-filter>-->
<!-- </activity>-->
<!-- <activity -->
<!-- android:name="cn.jpush.android.ui.PopWinActivity" -->
<!-- android:exported="false" -->
<!-- android:screenOrientation="portrait" -->
<!-- android:theme="@style/MyDialogStyle" /> -->
<!-- <activity -->
<!-- android:name="cn.jpush.android.ui.PushActivity" -->
<!-- android:configChanges="orientation|keyboardHidden" -->
<!-- android:exported="false" -->
<!-- android:screenOrientation="portrait" -->
<!-- android:theme="@android:style/Theme.NoTitleBar"> -->
<!-- <intent-filter> -->
<!-- <action android:name="cn.jpush.android.ui.PushActivity" /> -->
<!-- <category android:name="android.intent.category.DEFAULT" /> -->
<!-- <category android:name="${applicationId}" /> -->
<!-- </intent-filter> -->
<!-- </activity> -->
<!-- <activity -->
<!-- android:name="cn.jpush.android.service.JNotifyActivity" -->
<!-- android:exported="true" -->
<!-- android:screenOrientation="portrait" -->
<!-- android:taskAffinity="jpush.custom" -->
<!-- android:theme="@android:style/Theme.Translucent.NoTitleBar"> -->
<!-- <intent-filter> -->
<!-- <action android:name="cn.jpush.android.intent.JNotifyActivity" /> -->
<!-- <category android:name="${applicationId}" /> -->
<!-- </intent-filter> -->
<!-- </activity> -->
<meta-data
android:name="com.baidu.lbsapi.API_KEY"
android:value="ulhypZnhFbnhzgEUAUqbA28N7DRB8agg" />
@ -239,68 +241,66 @@
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" /> &lt;!&ndash; Required SDK 核心功能 &ndash;&gt;-->
<!-- <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" /> &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> &lt;!&ndash; since 1.8.0 option 可选项。用于同一设备中不同应用的JPush服务相互拉起的功能。 &ndash;&gt;-->
<!-- <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> &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=".services.jpush.MyReceiver"
android:enabled="true"
android:exported="false">
<intent-filter>
<action android:name="cn.jpush.android.intent.REGISTRATION" /> <!-- Required 用户注册SDK的intent -->
<action android:name="cn.jpush.android.intent.MESSAGE_RECEIVED" /> <!-- Required 用户接收SDK消息的intent -->
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED" /> <!-- Required 用户接收SDK通知栏信息的intent -->
<action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED" /> <!-- Required 用户打开自定义通知栏的intent -->
<action android:name="cn.jpush.android.intent.CONNECTION" /> <!-- 接收网络变化 连接/断开 since 1.6.3 -->
<category android:name="${applicationId}" />
</intent-filter>
</receiver> <!-- Required SDK核心功能 -->
<receiver android:name=".services.jpush.PushMessageReceiver">
<intent-filter>
<action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" />
<category android:name="${applicationId}" />
</intent-filter>
</receiver> <!-- Required SDK核心功能 -->
<service
android:name=".services.LocationService"
android:exported="true"
android:process=":locations">
<intent-filter>
<action android:name="com.sucstepsoft.txrealtimelocation.services.LocationService" />
</intent-filter>
</service> <!-- User defined. For test only 用户自定义的广播接收器 -->
<!-- <receiver -->
<!-- android:name="cn.jpush.android.service.AlarmReceiver" -->
<!-- android:exported="false" /> &lt;!&ndash; since 3.1.0 Required SDK 核心功能 &ndash;&gt; -->
<!-- <receiver -->
<!-- android:name=".services.jpush.MyReceiver" -->
<!-- android:enabled="true" -->
<!-- android:exported="false"> -->
<!-- <intent-filter> -->
<!-- <action android:name="cn.jpush.android.intent.REGISTRATION" /> &lt;!&ndash; Required 用户注册SDK的intent &ndash;&gt; -->
<!-- <action android:name="cn.jpush.android.intent.MESSAGE_RECEIVED" /> &lt;!&ndash; Required 用户接收SDK消息的intent &ndash;&gt; -->
<!-- <action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED" /> &lt;!&ndash; Required 用户接收SDK通知栏信息的intent &ndash;&gt; -->
<!-- <action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED" /> &lt;!&ndash; Required 用户打开自定义通知栏的intent &ndash;&gt; -->
<!-- <action android:name="cn.jpush.android.intent.CONNECTION" /> &lt;!&ndash; 接收网络变化 连接/断开 since 1.6.3 &ndash;&gt; -->
<!-- <category android:name="${applicationId}" /> -->
<!-- </intent-filter> -->
<!-- </receiver> &lt;!&ndash; Required SDK核心功能 &ndash;&gt; -->
<!-- <receiver android:name=".services.jpush.PushMessageReceiver"> -->
<!-- <intent-filter> -->
<!-- <action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" /> -->
<!-- <category android:name="${applicationId}" /> -->
<!-- </intent-filter> -->
<!-- </receiver> &lt;!&ndash; Required SDK核心功能 &ndash;&gt; -->
<!-- <service -->
<!-- android:name=".services.LocationService" -->
<!-- android:exported="true" -->
<!-- android:process=":locations"> -->
<!-- <intent-filter> -->
<!-- <action android:name="com.sucstepsoft.txrealtimelocation.services.LocationService" /> -->
<!-- </intent-filter> -->
<!-- </service> &lt;!&ndash; User defined. For test only 用户自定义的广播接收器 &ndash;&gt; -->
<service
android:name=".services.MyJobService"
android:enabled="true"
@ -316,33 +316,32 @@
<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" /> &lt;!&ndash; since 3.3.0 Required SDK 核心功能 &ndash;&gt;-->
<!-- <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> &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>-->
<!-- <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> -->
<service
android:name=".services.jpush.PushService"
android:process=":pushcore">

View File

@ -0,0 +1,39 @@
package com.sucstepsoft.txrealtimelocation.activitys.companylib;
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
import com.sucstepsoft.txrealtimelocation.R;
import butterknife.ButterKnife;
import butterknife.Unbinder;
/**
* 企业信息详情
*/
public class CompanyDetailActivity extends BaseActivity {
private Unbinder mBind;
@Override
protected int setLayoutId() {
return R.layout.activity_company_detail;
}
@Override
public void initData() {
mBind = ButterKnife.bind(this);
mTvBaseTitle.setText("企业详情");
refreshView(STATE_LOAD_LOADING);
String mId = getIntent().getStringExtra("id");
getCompanyDetailById(mId);
}
private void getCompanyDetailById(String mId) {
}
@Override
protected void onDestroy() {
super.onDestroy();
mBind.unbind();
}
}

View File

@ -0,0 +1,41 @@
package com.sucstepsoft.txrealtimelocation.activitys.companylib;
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
import com.sucstepsoft.txrealtimelocation.R;
import butterknife.ButterKnife;
import butterknife.Unbinder;
/**
* 企业信息编辑
*/
public class CompanyInfoEditActivity extends BaseActivity {
private Unbinder mBind;
private String mId;
@Override
protected int setLayoutId() {
return R.layout.activity_company_info_edit;
}
@Override
public void initData() {
mBind = ButterKnife.bind(this);
mTvBaseTitle.setText("企业信息编辑");
refreshView(STATE_LOAD_LOADING);
mId = getIntent().getStringExtra("id");
getCompanyDetail(mId);
}
private void getCompanyDetail(String id) {
}
@Override
protected void onDestroy() {
super.onDestroy();
mBind.unbind();
}
}

View File

@ -0,0 +1,143 @@
package com.sucstepsoft.txrealtimelocation.activitys.companylib;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.jcodecraeer.xrecyclerview.ProgressStyle;
import com.jcodecraeer.xrecyclerview.XRecyclerView;
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
import com.sucstepsoft.txrealtimelocation.R;
import com.sucstepsoft.txrealtimelocation.adapters.CompanyLibAdapter;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
/**
* 企业信息首页
*/
public class CompanyLibActivity extends BaseActivity {
@BindView(R.id.et_company_name)
EditText mEtCompanyName;
@BindView(R.id.tv_com_type)
TextView mTvComType;
@BindView(R.id.pb_loading)
ProgressBar mPbLoading;
@BindView(R.id.iv_empty)
ImageView mIvEmpty;
@BindView(R.id.tv_error_hint)
TextView mTvErrorHint;
private Unbinder mBind;
@BindView(R.id.xlv_com_lib)
XRecyclerView mRlvComList;
private int mCurrentPage = 1;
private List<String> mDatas = new ArrayList<>();
private static final int STATE_LOADING = 333;
private static final int STATE_EMPTY = 433;
private static final int STATE_ERROR = 533;
@Override
protected int setLayoutId() {
return R.layout.activity_company_lib;
}
@Override
public void initData() {
refreshView(STATE_LOAD_SUCCESS);
mTvBaseTitle.setText("企业信息");
mBind = ButterKnife.bind(this);
mTvPublish.setVisibility(View.VISIBLE);
mTvPublish.setText("录入");
mTvPublish.setOnClickListener(v -> startActivity(new Intent(this, EnterCompanyInfoActivity.class)));
CompanyLibAdapter mAdapter = new CompanyLibAdapter(mActivity, mDatas);
LinearLayoutManager layoutManager = new LinearLayoutManager(mActivity);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
mRlvComList.setLayoutManager(layoutManager);
mRlvComList.setAdapter(mAdapter);
mAdapter.addOnItemClickListener(bean -> showDetail(bean));
mRlvComList.setRefreshProgressStyle(ProgressStyle.BallGridBeat);
mRlvComList.setLoadingMoreProgressStyle(ProgressStyle.Pacman);
mRlvComList.setPullRefreshEnabled(true);
mRlvComList.setLoadingMoreEnabled(true);
mRlvComList.setLoadingListener(new XRecyclerView.LoadingListener() {
@Override
public void onRefresh() {
refreshData();
}
@Override
public void onLoadMore() {
getCompanyLibList(mCurrentPage);
}
});
stateView(STATE_LOADING);
}
private void stateView(int state) {
switch (state) {
case STATE_EMPTY:
mTvErrorHint.setText("暂无数据");
mRlvComList.setVisibility(View.GONE);
mPbLoading.setVisibility(View.GONE);
mIvEmpty.setVisibility(View.VISIBLE);
break;//空数据
case STATE_ERROR:
mTvErrorHint.setText("数据加载失败,请稍后重试.");
mRlvComList.setVisibility(View.GONE);
mPbLoading.setVisibility(View.GONE);
mIvEmpty.setVisibility(View.VISIBLE);
break;//加载错误
case STATE_LOADING:
default:
mTvErrorHint.setText("数据加载中...");
mRlvComList.setVisibility(View.GONE);
mPbLoading.setVisibility(View.VISIBLE);
mIvEmpty.setVisibility(View.GONE);
break;
}
}
/**
* 显示详情
*
* @param id
*/
private void showDetail(String id) {
Intent intent = new Intent();
intent.setClass(mActivity, CompanyDetailActivity.class);
intent.putExtra("id", id);
startActivity(intent);
}
/**
* 获取列表
*
* @param currentPage
*/
private void getCompanyLibList(int currentPage) {
}
/**
* 刷新列表
*/
private void refreshData() {
}
@Override
protected void onDestroy() {
super.onDestroy();
mBind.unbind();
}
}

View File

@ -0,0 +1,315 @@
package com.sucstepsoft.txrealtimelocation.activitys.companylib;
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.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.Gravity;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
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.widget.base.AddPhotoAdapter;
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.txrealtimelocation.R;
import com.sucstepsoft.txrealtimelocation.activitys.common.PhotoActivity;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
/**
* 录入企业信息页面
*/
public class EnterCompanyInfoActivity extends BaseActivity {
@BindView(R.id.tv_issue_base_info)
TextView mTvIssueBaseInfo;
@BindView(R.id.et_company_name)
EditText mEtCompanyName;
@BindView(R.id.tv_com_type)
TextView mTvComType;
@BindView(R.id.et_register_address)
EditText mEtRegisterAddress;
@BindView(R.id.et_detail_address)
EditText mEtDetailAddress;
@BindView(R.id.tv_trade)
TextView mTvTrade;
@BindView(R.id.et_peo_count)
EditText mEtPeoCount;
@BindView(R.id.tv_risk)
TextView mTvRisk;
@BindView(R.id.et_pre)
EditText mEtPre;
@BindView(R.id.et_phone)
EditText mEtPhone;
@BindView(R.id.tv_issue_detail_info)
TextView mTvIssueDetailInfo;
@BindView(R.id.rlv_door)
RecyclerView mRlvDoor;
@BindView(R.id.rlv_place)
RecyclerView mRlvPlace;
@BindView(R.id.btn_submit)
Button mBtnSubmit;
private Unbinder mBind;
private List<AddPhotoBean> mDoorPhotos;
private List<AddPhotoBean> mPlacePhotos;
private AddPhotoBean mCurrentBean;
private String mPicPath;
private String mDoorPhotoIds = "";
private String mPlacePhotoIds = "";
@Override
protected int setLayoutId() {
return R.layout.activity_enter_company_info;
}
@Override
public void initData() {
mTvBaseTitle.setText("企业信息录入");
refreshView(STATE_LOAD_SUCCESS);
mBind = ButterKnife.bind(this);
initPhotoView();
}
private void initPhotoView() {
mDoorPhotos = new ArrayList<>();
mPlacePhotos = new ArrayList<>();
mDoorPhotos.add(new AddPhotoBean());
mPlacePhotos.add(new AddPhotoBean());
AddPhotoAdapter mDoorPhotoAdapter = new AddPhotoAdapter(this, mDoorPhotos);
mRlvDoor.setLayoutManager(new GridLayoutManager(mActivity, 4));
mRlvDoor.setAdapter(mDoorPhotoAdapter);
//删除上传的相片
mDoorPhotoAdapter.addOnDeleteListener(((bean, i) -> {
mDoorPhotoAdapter.removeItem(bean);
mDoorPhotoIds = mDoorPhotoIds.replace(bean.getId() + ",", "");
}));
mDoorPhotoAdapter.addOnItemClickListener(bean -> {
if (TextUtils.isEmpty(bean.getPath())) {
//空数据
showSelectPhoto(bean);
} else {
//预览
ArrayList<String> list = new ArrayList<>();
list.add(bean.getPath());
Intent intent = new Intent();
intent.putExtra(PhotoActivity.TAG_IMGURL, list);
intent.setClass(EnterCompanyInfoActivity.this, PhotoActivity.class);
startActivity(intent);
}
});
AddPhotoAdapter mPlacePhotoAdapter = new AddPhotoAdapter(this, mPlacePhotos);
mRlvPlace.setLayoutManager(new GridLayoutManager(mActivity, 4));
mRlvPlace.setAdapter(mPlacePhotoAdapter);
//删除上传的相片
mPlacePhotoAdapter.addOnDeleteListener(((bean, i) -> {
mDoorPhotoAdapter.removeItem(bean);
mPlacePhotoIds = mPlacePhotoIds.replace(bean.getId() + ",", "");
}));
mPlacePhotoAdapter.addOnItemClickListener(bean -> {
if (TextUtils.isEmpty(bean.getPath())) {
//空数据
showSelectPhoto(bean);
} else {
//预览
ArrayList<String> list = new ArrayList<>();
list.add(bean.getPath());
Intent intent = new Intent();
intent.putExtra(PhotoActivity.TAG_IMGURL, list);
intent.setClass(EnterCompanyInfoActivity.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) {
// File file = new File(picPath);
// if (!file.exists()) {
// showToast("图片路径错误.");
// return;
// }
// ProgressDialog progressDialog = UIUtil.initDialog(mActivity, "正在上传...");
// progressDialog.show();
// Luban.with(mActivity)
// .load(picPath)
// .ignoreBy(100)
// .setTargetDir(PathConfig.CATCH_PATH)
// .filter(path -> !(TextUtils.isEmpty(path) || path.toLowerCase().endsWith(".gif")))
// .setCompressListener(new OnCompressListener() {
// @Override
// public void onStart() {
//
// }
//
// @Override
// public void onSuccess(File file) {
// RequestBody requestFile = RequestBody.create(MediaType.parse("multipart/form-data"), file);
// MultipartBody.Part body = MultipartBody.Part.createFormData("image", file.getName(), requestFile);
// RetrofitManager.getInstance()
// .create(LocationApiService.class)
// .uploadImage(body, UserLgUtils.getToken())
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(new Observer<BaseUserBean>() {
// @Override
// public void onSubscribe(Disposable d) {
//
// }
//
// @Override
// public void onNext(BaseUserBean baseUserBean) {
// if (progressDialog != null && progressDialog.isShowing()) {
// progressDialog.dismiss();
// }
// ToastUtils.showShort("上传成功");
// mPhotoIds += (baseUserBean.getData() + ",");
// mCurrentBean.setId(baseUserBean.getData());
// mCurrentBean.setPath(picPath);
// if (mPhotos.size() < 4) {
// mPhotos.add(new AddPhotoBean());
// }
// mPhotoAdapter.notifyDataSetChanged();
// mCurrentBean = null;
// }
//
// @Override
// public void onError(Throwable e) {
// if (progressDialog != null && progressDialog.isShowing()) {
// progressDialog.dismiss();
// }
// ToastUtils.showShort("上传失败,请稍后重试.");
// if (file.exists()) {
// file.delete();
// }
// }
//
// @Override
// public void onComplete() {
//
// }
// });
// }
//
// @Override
// public void onError(Throwable e) {
// if (progressDialog.isShowing()) {
// progressDialog.dismiss();
// }
// ToastUtils.showShort("图片上传失败,请稍后重试");
// }
// })
// .launch();
}
@Override
protected void onDestroy() {
super.onDestroy();
mBind.unbind();
}
}

View File

@ -149,15 +149,15 @@ public class IssueCheckActivity extends BaseActivity {
* @param bean
*/
private void showDetail(IssueSubBean.RowsBean bean) {
Intent intent = new Intent(mActivity, IssueDetailActivity.class);
//待处理处理
intent.putExtra("mine", "1");
intent.putExtra("bean", bean);
if (bean.getCaseStatus().equals("4")) {
//待检查
intent.putExtra("check", "1");
}
startActivity(intent);
// Intent intent = new Intent(mActivity, IssueDetailActivity.class);
// //待处理处理
// intent.putExtra("mine", "1");
// intent.putExtra("bean", bean);
// if (bean.getCaseStatus().equals("4")) {
// //待检查
// intent.putExtra("check", "1");
// }
// startActivity(intent);
}
@Override

View File

@ -89,9 +89,9 @@ public class IssueMineActivity extends BaseActivity {
* @param bean
*/
private void showDetail(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);
}
private void getMineDisList(int page) {

View File

@ -87,10 +87,10 @@ public class IssueMineDisActivity extends BaseActivity {
* @param bean
*/
private void showDetail(IssueSubBean.RowsBean bean) {
Intent intent = new Intent(IssueMineDisActivity.this, IssueDetailActivity.class);
intent.putExtra("mine", "1");
intent.putExtra("bean", bean);
startActivity(intent);
// Intent intent = new Intent(IssueMineDisActivity.this, IssueDetailActivity.class);
// intent.putExtra("mine", "1");
// intent.putExtra("bean", bean);
// startActivity(intent);
}
private void getMineDisList(int page) {

View File

@ -57,7 +57,7 @@ public class LocusManagerActivity extends BaseActivity {
refreshView(STATE_LOAD_SUCCESS);
mTvPublish.setVisibility(View.VISIBLE);
mTvPublish.setText("个人");
mTvPublish.setOnClickListener(v -> startActivity(new Intent(mActivity, LocusMapActivity.class)));
// mTvPublish.setOnClickListener(v -> startActivity(new Intent(mActivity, LocusMapActivity.class)));
Gson gson = new Gson();
String loginInfo = UserLgUtils.getLoginInfo();
if (!TextUtils.isEmpty(loginInfo)) {

View File

@ -0,0 +1,37 @@
package com.sucstepsoft.txrealtimelocation.activitys.trouble;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
import com.sucstepsoft.txrealtimelocation.R;
import butterknife.ButterKnife;
import butterknife.Unbinder;
/**
* 选择企业
*/
public class SelCompanyActivity extends BaseActivity {
private Unbinder mBind;
@Override
protected int setLayoutId() {
return R.layout.activity_sel_company;
}
@Override
public void initData() {
mBind = ButterKnife.bind(this);
mTvBaseTitle.setText("选择企业");
refreshView(STATE_LOAD_SUCCESS);
}
@Override
protected void onDestroy() {
super.onDestroy();
mBind.unbind();
}
}

View File

@ -0,0 +1,42 @@
package com.sucstepsoft.txrealtimelocation.activitys.trouble;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
import com.sucstepsoft.txrealtimelocation.R;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
/**
* 隐患上报
*/
public class TroubleReportActivity extends BaseActivity {
@BindView(R.id.tv_sel_company)
TextView mTvSelCompany;
private Unbinder mBind;
@Override
protected int setLayoutId() {
return R.layout.activity_trouble_report;
}
@Override
public void initData() {
mBind = ButterKnife.bind(this);
refreshView(STATE_LOAD_SUCCESS);
mTvBaseTitle.setText("企业隐患上报");
mTvSelCompany.setOnClickListener(v -> startActivity(new Intent(this, SelCompanyActivity.class)));
}
@Override
protected void onDestroy() {
super.onDestroy();
mBind.unbind();
}
}

View File

@ -0,0 +1,35 @@
package com.sucstepsoft.txrealtimelocation.adapters;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.sucstepsoft.cm_utils.core.widget.base.BaseRecyclerAdapter;
import com.sucstepsoft.txrealtimelocation.R;
import com.sucstepsoft.txrealtimelocation.adapters.holders.CompanyHolder;
import java.util.List;
/**
* 作者: adam
* 日期: 2020/3/29 - 14:43
* 邮箱: itgaojian@163.com
* 描述:
*/
public class CompanyLibAdapter extends BaseRecyclerAdapter<String, CompanyHolder> {
public CompanyLibAdapter(Context ctx, List<String> list) {
super(ctx, list);
}
@Override
public CompanyHolder createHolder(ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(mContext).inflate(R.layout.item_company_lib, parent, false);
return new CompanyHolder(itemView);
}
@Override
public void bindHolder(CompanyHolder companyHolder, int i) {
}
}

View File

@ -0,0 +1,21 @@
package com.sucstepsoft.txrealtimelocation.adapters.holders;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;
/**
* 作者: adam
* 日期: 2020/3/29 - 14:41
* 邮箱: itgaojian@163.com
* 描述: 企业信息
*/
public class CompanyHolder extends RecyclerView.ViewHolder {
public TextView mTvCompanyName;
public TextView mTvCompanyPeo;
public CompanyHolder(@NonNull View itemView) {
super(itemView);
}
}

View File

@ -4,10 +4,6 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.baidu.location.BDLocation;
import com.sucstepsoft.cm_utils.constant.PathConfig;
import com.sucstepsoft.txrealtimelocation.activitys.base.MainActivity;
import java.text.SimpleDateFormat;
import java.util.Locale;
@ -20,23 +16,23 @@ public class LocationChangBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action.equals(RECEIVER_ACTION)) {
BDLocation location = (BDLocation) intent.getParcelableExtra(RECEIVER_DATA);
if (null != location) {
processCustomMessageA(context, location);
}
}
// String action = intent.getAction();
// if (action.equals(RECEIVER_ACTION)) {
// BDLocation location = (BDLocation) intent.getParcelableExtra(RECEIVER_DATA);
// if (null != location) {
// processCustomMessageA(context, location);
// }
// }
}
private void processCustomMessageA(Context context, BDLocation aMapLocation) {
if (MainActivity.isForeground) {
Intent msgIntent = new Intent(PathConfig.ACTION_LOCATION_MESSAGE);
if (aMapLocation != null) {
msgIntent.putExtra("data", aMapLocation);
}
context.sendBroadcast(msgIntent);
}
}
// private void processCustomMessageA(Context context, BDLocation aMapLocation) {
// if (MainActivity.isForeground) {
// Intent msgIntent = new Intent(PathConfig.ACTION_LOCATION_MESSAGE);
// if (aMapLocation != null) {
// msgIntent.putExtra("data", aMapLocation);
// }
// context.sendBroadcast(msgIntent);
// }
// }
}

View File

@ -41,41 +41,41 @@ public class Utils {
// private final static String PRIMARY_CHANNEL = "default";
private final static String PRIMARY_CHANNEL = "txrealtimelocation";
public synchronized static String getLocationStr(BDLocation location) {
if (null == location) {
return null;
}
StringBuffer sb = new StringBuffer();
if (location != null) {
sb.append("定位成功" + "\n");
sb.append("定位类型: " + location.getLocType() + "\n");
sb.append("经 度 : " + location.getLongitude() + "\n");
sb.append("纬 度 : " + location.getLatitude() + "\n");
sb.append("精 度 : " + location.getRadius() + "" + "\n");
sb.append("海 拔 : " + location.getAltitude() + "" + "\n");
sb.append("速 度 : " + location.getSpeed() + "米/秒" + "\n");
sb.append("角 度 : " + location.getDirection() + "\n");
//逆地理信息
sb.append("国 家 : " + location.getCountry() + "\n");
sb.append("省 : " + location.getProvince() + "\n");
sb.append("市 : " + location.getCity() + "\n");
sb.append("城市编码 : " + location.getCityCode() + "\n");
sb.append("区 : " + location.getDistrict() + "\n");
sb.append("区域 码 : " + location.getAdCode() + "\n");
sb.append("地 址 : " + location.getAddress() + "\n");
//定位完成的时间
sb.append("定位时间: " + location.getTime() + "\n");
} else {
//定位失败
sb.append("定位失败" + location.toString() + "\n");
}
//定位之后的回调时间
sb.append("回调时间: " + formatUTC(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss") + "\n");
return sb.toString();
}
// public synchronized static String getLocationStr(BDLocation location) {
// if (null == location) {
// return null;
// }
// StringBuffer sb = new StringBuffer();
// if (location != null) {
// sb.append("定位成功" + "\n");
// sb.append("定位类型: " + location.getLocType() + "\n");
// sb.append("经 度 : " + location.getLongitude() + "\n");
// sb.append("纬 度 : " + location.getLatitude() + "\n");
// sb.append("精 度 : " + location.getRadius() + "" + "\n");
//
// sb.append("海 拔 : " + location.getAltitude() + "" + "\n");
// sb.append("速 度 : " + location.getSpeed() + "米/秒" + "\n");
// sb.append("角 度 : " + location.getDirection() + "\n");
//
// //逆地理信息
// sb.append("国 家 : " + location.getCountry() + "\n");
// sb.append("省 : " + location.getProvince() + "\n");
// sb.append("市 : " + location.getCity() + "\n");
// sb.append("城市编码 : " + location.getCityCode() + "\n");
// sb.append("区 : " + location.getDistrict() + "\n");
// sb.append("区域 码 : " + location.getAdCode() + "\n");
// sb.append("地 址 : " + location.getAddress() + "\n");
// //定位完成的时间
// sb.append("定位时间: " + location.getTime() + "\n");
//
// } else {
// //定位失败
// sb.append("定位失败" + location.toString() + "\n");
// }
// //定位之后的回调时间
// sb.append("回调时间: " + formatUTC(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss") + "\n");
// return sb.toString();
// }
public synchronized static String formatUTC(long l, String strPattern) {
if (TextUtils.isEmpty(strPattern)) {

View File

@ -1,134 +1,134 @@
package com.sucstepsoft.txrealtimelocation.services.jpush;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.os.Looper;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.widget.Toast;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import cn.jpush.android.api.JPushInterface;
import cn.jpush.android.helper.Logger;
public class ExampleUtil {
public static final String PREFS_NAME = "JPUSH_EXAMPLE";
public static final String PREFS_DAYS = "JPUSH_EXAMPLE_DAYS";
public static final String PREFS_START_TIME = "PREFS_START_TIME";
public static final String PREFS_END_TIME = "PREFS_END_TIME";
public static final String KEY_APP_KEY = "JPUSH_APPKEY";
public static boolean isEmpty(String s) {
if (null == s)
return true;
if (s.length() == 0)
return true;
if (s.trim().length() == 0)
return true;
return false;
}
/**
* 只能以 + 或者 数字开头后面的内容只能包含 - 数字
* */
private final static String MOBILE_NUMBER_CHARS = "^[+0-9][-0-9]{1,}$";
public static boolean isValidMobileNumber(String s) {
if(TextUtils.isEmpty(s)) return true;
Pattern p = Pattern.compile(MOBILE_NUMBER_CHARS);
Matcher m = p.matcher(s);
return m.matches();
}
// 校验Tag Alias 只能是数字,英文字母和中文
public static boolean isValidTagAndAlias(String s) {
Pattern p = Pattern.compile("^[\u4E00-\u9FA50-9a-zA-Z_!@#$&*+=.|]+$");
Matcher m = p.matcher(s);
return m.matches();
}
// 取得AppKey
public static String getAppKey(Context context) {
Bundle metaData = null;
String appKey = null;
try {
ApplicationInfo ai = context.getPackageManager().getApplicationInfo(
context.getPackageName(), PackageManager.GET_META_DATA);
if (null != ai)
metaData = ai.metaData;
if (null != metaData) {
appKey = metaData.getString(KEY_APP_KEY);
if ((null == appKey) || appKey.length() != 24) {
appKey = null;
}
}
} catch (NameNotFoundException e) {
}
return appKey;
}
// 取得版本号
public static String GetVersion(Context context) {
try {
PackageInfo manager = context.getPackageManager().getPackageInfo(
context.getPackageName(), 0);
return manager.versionName;
} catch (NameNotFoundException e) {
return "Unknown";
}
}
public static void showToast(final String toast, final Context context)
{
new Thread(new Runnable() {
@Override
public void run() {
Looper.prepare();
Toast.makeText(context, toast, Toast.LENGTH_SHORT).show();
Looper.loop();
}
}).start();
}
public static boolean isConnected(Context context) {
ConnectivityManager conn = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo info = conn.getActiveNetworkInfo();
return (info != null && info.isConnected());
}
public static String getImei(Context context, String imei) {
String ret = null;
try {
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
ret = telephonyManager.getDeviceId();
} catch (Exception e) {
Logger.e(ExampleUtil.class.getSimpleName(), e.getMessage());
}
if (isReadableASCII(ret)){
return ret;
} else {
return imei;
}
}
private static boolean isReadableASCII(CharSequence string){
if (TextUtils.isEmpty(string)) return false;
try {
Pattern p = Pattern.compile("[\\x20-\\x7E]+");
return p.matcher(string).matches();
} catch (Throwable e){
return true;
}
}
public static String getDeviceId(Context context) {
return JPushInterface.getUdid(context);
}
}
//package com.sucstepsoft.txrealtimelocation.services.jpush;
//
//import android.content.Context;
//import android.content.pm.ApplicationInfo;
//import android.content.pm.PackageInfo;
//import android.content.pm.PackageManager;
//import android.content.pm.PackageManager.NameNotFoundException;
//import android.net.ConnectivityManager;
//import android.net.NetworkInfo;
//import android.os.Bundle;
//import android.os.Looper;
//import android.telephony.TelephonyManager;
//import android.text.TextUtils;
//import android.widget.Toast;
//
//import java.util.regex.Matcher;
//import java.util.regex.Pattern;
//
//import cn.jpush.android.api.JPushInterface;
//import cn.jpush.android.helper.Logger;
//
//public class ExampleUtil {
// public static final String PREFS_NAME = "JPUSH_EXAMPLE";
// public static final String PREFS_DAYS = "JPUSH_EXAMPLE_DAYS";
// public static final String PREFS_START_TIME = "PREFS_START_TIME";
// public static final String PREFS_END_TIME = "PREFS_END_TIME";
// public static final String KEY_APP_KEY = "JPUSH_APPKEY";
//
// public static boolean isEmpty(String s) {
// if (null == s)
// return true;
// if (s.length() == 0)
// return true;
// if (s.trim().length() == 0)
// return true;
// return false;
// }
// /**
// * 只能以 + 或者 数字开头后面的内容只能包含 - 数字
// * */
// private final static String MOBILE_NUMBER_CHARS = "^[+0-9][-0-9]{1,}$";
// public static boolean isValidMobileNumber(String s) {
// if(TextUtils.isEmpty(s)) return true;
// Pattern p = Pattern.compile(MOBILE_NUMBER_CHARS);
// Matcher m = p.matcher(s);
// return m.matches();
// }
// // 校验Tag Alias 只能是数字,英文字母和中文
// public static boolean isValidTagAndAlias(String s) {
// Pattern p = Pattern.compile("^[\u4E00-\u9FA50-9a-zA-Z_!@#$&*+=.|]+$");
// Matcher m = p.matcher(s);
// return m.matches();
// }
//
// // 取得AppKey
// public static String getAppKey(Context context) {
// Bundle metaData = null;
// String appKey = null;
// try {
// ApplicationInfo ai = context.getPackageManager().getApplicationInfo(
// context.getPackageName(), PackageManager.GET_META_DATA);
// if (null != ai)
// metaData = ai.metaData;
// if (null != metaData) {
// appKey = metaData.getString(KEY_APP_KEY);
// if ((null == appKey) || appKey.length() != 24) {
// appKey = null;
// }
// }
// } catch (NameNotFoundException e) {
//
// }
// return appKey;
// }
//
// // 取得版本号
// public static String GetVersion(Context context) {
// try {
// PackageInfo manager = context.getPackageManager().getPackageInfo(
// context.getPackageName(), 0);
// return manager.versionName;
// } catch (NameNotFoundException e) {
// return "Unknown";
// }
// }
//
// public static void showToast(final String toast, final Context context)
// {
// new Thread(new Runnable() {
//
// @Override
// public void run() {
// Looper.prepare();
// Toast.makeText(context, toast, Toast.LENGTH_SHORT).show();
// Looper.loop();
// }
// }).start();
// }
//
// public static boolean isConnected(Context context) {
// ConnectivityManager conn = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
// NetworkInfo info = conn.getActiveNetworkInfo();
// return (info != null && info.isConnected());
// }
//
// public static String getImei(Context context, String imei) {
// String ret = null;
// try {
// TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
// ret = telephonyManager.getDeviceId();
// } catch (Exception e) {
// Logger.e(ExampleUtil.class.getSimpleName(), e.getMessage());
// }
// if (isReadableASCII(ret)){
// return ret;
// } else {
// return imei;
// }
// }
//
// private static boolean isReadableASCII(CharSequence string){
// if (TextUtils.isEmpty(string)) return false;
// try {
// Pattern p = Pattern.compile("[\\x20-\\x7E]+");
// return p.matcher(string).matches();
// } catch (Throwable e){
// return true;
// }
// }
//
// public static String getDeviceId(Context context) {
// return JPushInterface.getUdid(context);
// }
//}

View File

@ -1,128 +1,128 @@
package com.sucstepsoft.txrealtimelocation.services.jpush;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
import android.text.TextUtils;
import com.sucstepsoft.txrealtimelocation.activitys.base.MainActivity;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.Iterator;
import cn.jpush.android.api.JPushInterface;
import cn.jpush.android.helper.Logger;
/**
* 自定义接收器
* <p>
* 如果不定义这个 Receiver
* 1) 默认用户会打开主界面
* 2) 接收不到自定义消息
*/
public class MyReceiver extends BroadcastReceiver {
private static final String TAG = "JIGUANG-Example";
@Override
public void onReceive(Context context, Intent intent) {
try {
Bundle bundle = intent.getExtras();
Logger.d(TAG, "[MyReceiver] onReceive - " + intent.getAction() + ", extras: " + printBundle(bundle));
if (JPushInterface.ACTION_REGISTRATION_ID.equals(intent.getAction())) {
String regId = bundle.getString(JPushInterface.EXTRA_REGISTRATION_ID);
Logger.d(TAG, "[MyReceiver] 接收Registration Id : " + regId);
//send the Registration Id to your server...
} else if (JPushInterface.ACTION_MESSAGE_RECEIVED.equals(intent.getAction())) {
Logger.d(TAG, "[MyReceiver] 接收到推送下来的自定义消息: " + bundle.getString(JPushInterface.EXTRA_MESSAGE));
processCustomMessage(context, bundle);
} else if (JPushInterface.ACTION_NOTIFICATION_RECEIVED.equals(intent.getAction())) {
Logger.d(TAG, "[MyReceiver] 接收到推送下来的通知");
int notifactionId = bundle.getInt(JPushInterface.EXTRA_NOTIFICATION_ID);
Logger.d(TAG, "[MyReceiver] 接收到推送下来的通知的ID: " + notifactionId);
} else if (JPushInterface.ACTION_NOTIFICATION_OPENED.equals(intent.getAction())) {
Logger.d(TAG, "[MyReceiver] 用户点击打开了通知");
// //打开自定义的Activity
// Intent i = new Intent(context, MainActivity.class);
// i.putExtras(bundle);
// //i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
// context.startActivity(i);
} else if (JPushInterface.ACTION_RICHPUSH_CALLBACK.equals(intent.getAction())) {
Logger.d(TAG, "[MyReceiver] 用户收到到RICH PUSH CALLBACK: " + bundle.getString(JPushInterface.EXTRA_EXTRA));
//在这里根据 JPushInterface.EXTRA_EXTRA 的内容处理代码比如打开新的Activity 打开一个网页等..
} else if (JPushInterface.ACTION_CONNECTION_CHANGE.equals(intent.getAction())) {
boolean connected = intent.getBooleanExtra(JPushInterface.EXTRA_CONNECTION_CHANGE, false);
Logger.w(TAG, "[MyReceiver]" + intent.getAction() + " connected state change to " + connected);
} else {
Logger.d(TAG, "[MyReceiver] Unhandled intent - " + intent.getAction());
}
} catch (Exception e) {
}
}
// 打印所有的 intent extra 数据
private static String printBundle(Bundle bundle) {
StringBuilder sb = new StringBuilder();
for (String key : bundle.keySet()) {
if (key.equals(JPushInterface.EXTRA_NOTIFICATION_ID)) {
sb.append("\nkey:" + key + ", value:" + bundle.getInt(key));
} else if (key.equals(JPushInterface.EXTRA_CONNECTION_CHANGE)) {
sb.append("\nkey:" + key + ", value:" + bundle.getBoolean(key));
} else if (key.equals(JPushInterface.EXTRA_EXTRA)) {
if (TextUtils.isEmpty(bundle.getString(JPushInterface.EXTRA_EXTRA))) {
Logger.i(TAG, "This message has no Extra data");
continue;
}
try {
JSONObject json = new JSONObject(bundle.getString(JPushInterface.EXTRA_EXTRA));
Iterator<String> it = json.keys();
while (it.hasNext()) {
String myKey = it.next();
sb.append("\nkey:" + key + ", value: [" +
myKey + " - " + json.optString(myKey) + "]");
}
} catch (JSONException e) {
Logger.e(TAG, "Get message extra JSON error!");
}
} else {
sb.append("\nkey:" + key + ", value:" + bundle.get(key));
}
}
return sb.toString();
}
//send msg to MainActivity
private void processCustomMessage(Context context, Bundle bundle) {
if (MainActivity.isForeground) {
String message = bundle.getString(JPushInterface.EXTRA_MESSAGE);
String extras = bundle.getString(JPushInterface.EXTRA_EXTRA);
Intent msgIntent = new Intent(MainActivity.MESSAGE_JPUSH);
msgIntent.putExtra(MainActivity.KEY_MESSAGE, message);
if (!ExampleUtil.isEmpty(extras)) {
try {
JSONObject extraJson = new JSONObject(extras);
if (extraJson.length() > 0) {
msgIntent.putExtra(MainActivity.KEY_EXTRAS, extras);
}
} catch (JSONException e) {
}
}
LocalBroadcastManager.getInstance(context).sendBroadcast(msgIntent);
}
}
}
//package com.sucstepsoft.txrealtimelocation.services.jpush;
//
//import android.content.BroadcastReceiver;
//import android.content.Context;
//import android.content.Intent;
//import android.os.Bundle;
//import android.support.v4.content.LocalBroadcastManager;
//import android.text.TextUtils;
//
//import com.sucstepsoft.txrealtimelocation.activitys.base.MainActivity;
//
//import org.json.JSONException;
//import org.json.JSONObject;
//
//import java.util.Iterator;
//
//import cn.jpush.android.api.JPushInterface;
//import cn.jpush.android.helper.Logger;
//
///**
// * 自定义接收器
// * <p>
// * 如果不定义这个 Receiver
// * 1) 默认用户会打开主界面
// * 2) 接收不到自定义消息
// */
//public class MyReceiver extends BroadcastReceiver {
// private static final String TAG = "JIGUANG-Example";
//
// @Override
// public void onReceive(Context context, Intent intent) {
// try {
// Bundle bundle = intent.getExtras();
// Logger.d(TAG, "[MyReceiver] onReceive - " + intent.getAction() + ", extras: " + printBundle(bundle));
//
// if (JPushInterface.ACTION_REGISTRATION_ID.equals(intent.getAction())) {
// String regId = bundle.getString(JPushInterface.EXTRA_REGISTRATION_ID);
// Logger.d(TAG, "[MyReceiver] 接收Registration Id : " + regId);
// //send the Registration Id to your server...
//
// } else if (JPushInterface.ACTION_MESSAGE_RECEIVED.equals(intent.getAction())) {
// Logger.d(TAG, "[MyReceiver] 接收到推送下来的自定义消息: " + bundle.getString(JPushInterface.EXTRA_MESSAGE));
// processCustomMessage(context, bundle);
//
// } else if (JPushInterface.ACTION_NOTIFICATION_RECEIVED.equals(intent.getAction())) {
// Logger.d(TAG, "[MyReceiver] 接收到推送下来的通知");
// int notifactionId = bundle.getInt(JPushInterface.EXTRA_NOTIFICATION_ID);
// Logger.d(TAG, "[MyReceiver] 接收到推送下来的通知的ID: " + notifactionId);
//
// } else if (JPushInterface.ACTION_NOTIFICATION_OPENED.equals(intent.getAction())) {
// Logger.d(TAG, "[MyReceiver] 用户点击打开了通知");
//// //打开自定义的Activity
//// Intent i = new Intent(context, MainActivity.class);
//// i.putExtras(bundle);
//// //i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//// i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
//// context.startActivity(i);
// } else if (JPushInterface.ACTION_RICHPUSH_CALLBACK.equals(intent.getAction())) {
// Logger.d(TAG, "[MyReceiver] 用户收到到RICH PUSH CALLBACK: " + bundle.getString(JPushInterface.EXTRA_EXTRA));
// //在这里根据 JPushInterface.EXTRA_EXTRA 的内容处理代码比如打开新的Activity 打开一个网页等..
// } else if (JPushInterface.ACTION_CONNECTION_CHANGE.equals(intent.getAction())) {
// boolean connected = intent.getBooleanExtra(JPushInterface.EXTRA_CONNECTION_CHANGE, false);
// Logger.w(TAG, "[MyReceiver]" + intent.getAction() + " connected state change to " + connected);
// } else {
// Logger.d(TAG, "[MyReceiver] Unhandled intent - " + intent.getAction());
// }
// } catch (Exception e) {
//
// }
//
// }
//
// // 打印所有的 intent extra 数据
// private static String printBundle(Bundle bundle) {
// StringBuilder sb = new StringBuilder();
// for (String key : bundle.keySet()) {
// if (key.equals(JPushInterface.EXTRA_NOTIFICATION_ID)) {
// sb.append("\nkey:" + key + ", value:" + bundle.getInt(key));
// } else if (key.equals(JPushInterface.EXTRA_CONNECTION_CHANGE)) {
// sb.append("\nkey:" + key + ", value:" + bundle.getBoolean(key));
// } else if (key.equals(JPushInterface.EXTRA_EXTRA)) {
// if (TextUtils.isEmpty(bundle.getString(JPushInterface.EXTRA_EXTRA))) {
// Logger.i(TAG, "This message has no Extra data");
// continue;
// }
//
// try {
// JSONObject json = new JSONObject(bundle.getString(JPushInterface.EXTRA_EXTRA));
// Iterator<String> it = json.keys();
//
// while (it.hasNext()) {
// String myKey = it.next();
// sb.append("\nkey:" + key + ", value: [" +
// myKey + " - " + json.optString(myKey) + "]");
// }
// } catch (JSONException e) {
// Logger.e(TAG, "Get message extra JSON error!");
// }
//
// } else {
// sb.append("\nkey:" + key + ", value:" + bundle.get(key));
// }
// }
// return sb.toString();
// }
//
// //send msg to MainActivity
// private void processCustomMessage(Context context, Bundle bundle) {
// if (MainActivity.isForeground) {
// String message = bundle.getString(JPushInterface.EXTRA_MESSAGE);
// String extras = bundle.getString(JPushInterface.EXTRA_EXTRA);
// Intent msgIntent = new Intent(MainActivity.MESSAGE_JPUSH);
// msgIntent.putExtra(MainActivity.KEY_MESSAGE, message);
// if (!ExampleUtil.isEmpty(extras)) {
// try {
// JSONObject extraJson = new JSONObject(extras);
// if (extraJson.length() > 0) {
// msgIntent.putExtra(MainActivity.KEY_EXTRAS, extras);
// }
// } catch (JSONException e) {
//
// }
//
// }
// LocalBroadcastManager.getInstance(context).sendBroadcast(msgIntent);
// }
// }
//}

View File

@ -1,138 +1,138 @@
package com.sucstepsoft.txrealtimelocation.services.jpush;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
import com.sucstepsoft.txrealtimelocation.activitys.base.LoginActivity;
import com.sucstepsoft.txrealtimelocation.activitys.base.MainActivity;
import org.json.JSONException;
import org.json.JSONObject;
import cn.jpush.android.api.CmdMessage;
import cn.jpush.android.api.CustomMessage;
import cn.jpush.android.api.JPushInterface;
import cn.jpush.android.api.JPushMessage;
import cn.jpush.android.api.NotificationMessage;
import cn.jpush.android.service.JPushMessageReceiver;
public class PushMessageReceiver extends JPushMessageReceiver{
private static final String TAG = "PushMessageReceiver";
@Override
public void onMessage(Context context, CustomMessage customMessage) {
Log.e(TAG,"[onMessage] "+customMessage);
processCustomMessage(context,customMessage);
}
@Override
public void onNotifyMessageOpened(Context context, NotificationMessage message) {
Log.e(TAG,"[onNotifyMessageOpened] "+message);
try{
//打开自定义的Activity
Intent i = new Intent(context, LoginActivity.class);
Bundle bundle = new Bundle();
bundle.putString(JPushInterface.EXTRA_NOTIFICATION_TITLE,message.notificationTitle);
bundle.putString(JPushInterface.EXTRA_ALERT,message.notificationContent);
i.putExtras(bundle);
//i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP );
context.startActivity(i);
}catch (Throwable throwable){
}
}
@Override
public void onMultiActionClicked(Context context, Intent intent) {
Log.e(TAG, "[onMultiActionClicked] 用户点击了通知栏按钮");
String nActionExtra = intent.getExtras().getString(JPushInterface.EXTRA_NOTIFICATION_ACTION_EXTRA);
//开发者根据不同 Action 携带的 extra 字段来分配不同的动作
if(nActionExtra==null){
Log.d(TAG,"ACTION_NOTIFICATION_CLICK_ACTION nActionExtra is null");
return;
}
if (nActionExtra.equals("my_extra1")) {
Log.e(TAG, "[onMultiActionClicked] 用户点击通知栏按钮一");
} else if (nActionExtra.equals("my_extra2")) {
Log.e(TAG, "[onMultiActionClicked] 用户点击通知栏按钮二");
} else if (nActionExtra.equals("my_extra3")) {
Log.e(TAG, "[onMultiActionClicked] 用户点击通知栏按钮三");
} else {
Log.e(TAG, "[onMultiActionClicked] 用户点击通知栏按钮未定义");
}
}
@Override
public void onNotifyMessageArrived(Context context, NotificationMessage message) {
Log.e(TAG,"[onNotifyMessageArrived] "+message);
}
@Override
public void onNotifyMessageDismiss(Context context, NotificationMessage message) {
Log.e(TAG,"[onNotifyMessageDismiss] "+message);
}
@Override
public void onRegister(Context context, String registrationId) {
Log.e(TAG,"[onRegister] "+registrationId);
}
@Override
public void onConnected(Context context, boolean isConnected) {
Log.e(TAG,"[onConnected] "+isConnected);
}
@Override
public void onCommandResult(Context context, CmdMessage cmdMessage) {
Log.e(TAG,"[onCommandResult] "+cmdMessage);
}
@Override
public void onTagOperatorResult(Context context,JPushMessage jPushMessage) {
TagAliasOperatorHelper.getInstance().onTagOperatorResult(context,jPushMessage);
super.onTagOperatorResult(context, jPushMessage);
}
@Override
public void onCheckTagOperatorResult(Context context,JPushMessage jPushMessage){
TagAliasOperatorHelper.getInstance().onCheckTagOperatorResult(context,jPushMessage);
super.onCheckTagOperatorResult(context, jPushMessage);
}
@Override
public void onAliasOperatorResult(Context context, JPushMessage jPushMessage) {
TagAliasOperatorHelper.getInstance().onAliasOperatorResult(context,jPushMessage);
super.onAliasOperatorResult(context, jPushMessage);
}
@Override
public void onMobileNumberOperatorResult(Context context, JPushMessage jPushMessage) {
TagAliasOperatorHelper.getInstance().onMobileNumberOperatorResult(context,jPushMessage);
super.onMobileNumberOperatorResult(context, jPushMessage);
}
//send msg to MainActivity
private void processCustomMessage(Context context, CustomMessage customMessage) {
if (MainActivity.isForeground) {
String message = customMessage.message;
String extras = customMessage.extra;
Intent msgIntent = new Intent(MainActivity.MESSAGE_JPUSH);
msgIntent.putExtra(MainActivity.KEY_MESSAGE, message);
if (!ExampleUtil.isEmpty(extras)) {
try {
JSONObject extraJson = new JSONObject(extras);
if (extraJson.length() > 0) {
msgIntent.putExtra(MainActivity.KEY_EXTRAS, extras);
}
} catch (JSONException e) {
}
}
LocalBroadcastManager.getInstance(context).sendBroadcast(msgIntent);
}
}
}
//package com.sucstepsoft.txrealtimelocation.services.jpush;
//
//import android.content.Context;
//import android.content.Intent;
//import android.os.Bundle;
//import android.support.v4.content.LocalBroadcastManager;
//import android.util.Log;
//
//import com.sucstepsoft.txrealtimelocation.activitys.base.LoginActivity;
//import com.sucstepsoft.txrealtimelocation.activitys.base.MainActivity;
//
//import org.json.JSONException;
//import org.json.JSONObject;
//
//import cn.jpush.android.api.CmdMessage;
//import cn.jpush.android.api.CustomMessage;
//import cn.jpush.android.api.JPushInterface;
//import cn.jpush.android.api.JPushMessage;
//import cn.jpush.android.api.NotificationMessage;
//import cn.jpush.android.service.JPushMessageReceiver;
//
//public class PushMessageReceiver extends JPushMessageReceiver{
// private static final String TAG = "PushMessageReceiver";
// @Override
// public void onMessage(Context context, CustomMessage customMessage) {
// Log.e(TAG,"[onMessage] "+customMessage);
// processCustomMessage(context,customMessage);
// }
//
// @Override
// public void onNotifyMessageOpened(Context context, NotificationMessage message) {
// Log.e(TAG,"[onNotifyMessageOpened] "+message);
// try{
// //打开自定义的Activity
// Intent i = new Intent(context, LoginActivity.class);
// Bundle bundle = new Bundle();
// bundle.putString(JPushInterface.EXTRA_NOTIFICATION_TITLE,message.notificationTitle);
// bundle.putString(JPushInterface.EXTRA_ALERT,message.notificationContent);
// i.putExtras(bundle);
// //i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP );
// context.startActivity(i);
// }catch (Throwable throwable){
//
// }
// }
//
// @Override
// public void onMultiActionClicked(Context context, Intent intent) {
// Log.e(TAG, "[onMultiActionClicked] 用户点击了通知栏按钮");
// String nActionExtra = intent.getExtras().getString(JPushInterface.EXTRA_NOTIFICATION_ACTION_EXTRA);
//
// //开发者根据不同 Action 携带的 extra 字段来分配不同的动作
// if(nActionExtra==null){
// Log.d(TAG,"ACTION_NOTIFICATION_CLICK_ACTION nActionExtra is null");
// return;
// }
// if (nActionExtra.equals("my_extra1")) {
// Log.e(TAG, "[onMultiActionClicked] 用户点击通知栏按钮一");
// } else if (nActionExtra.equals("my_extra2")) {
// Log.e(TAG, "[onMultiActionClicked] 用户点击通知栏按钮二");
// } else if (nActionExtra.equals("my_extra3")) {
// Log.e(TAG, "[onMultiActionClicked] 用户点击通知栏按钮三");
// } else {
// Log.e(TAG, "[onMultiActionClicked] 用户点击通知栏按钮未定义");
// }
// }
//
// @Override
// public void onNotifyMessageArrived(Context context, NotificationMessage message) {
// Log.e(TAG,"[onNotifyMessageArrived] "+message);
// }
//
// @Override
// public void onNotifyMessageDismiss(Context context, NotificationMessage message) {
// Log.e(TAG,"[onNotifyMessageDismiss] "+message);
// }
//
// @Override
// public void onRegister(Context context, String registrationId) {
// Log.e(TAG,"[onRegister] "+registrationId);
// }
//
// @Override
// public void onConnected(Context context, boolean isConnected) {
// Log.e(TAG,"[onConnected] "+isConnected);
// }
//
// @Override
// public void onCommandResult(Context context, CmdMessage cmdMessage) {
// Log.e(TAG,"[onCommandResult] "+cmdMessage);
// }
//
// @Override
// public void onTagOperatorResult(Context context,JPushMessage jPushMessage) {
// TagAliasOperatorHelper.getInstance().onTagOperatorResult(context,jPushMessage);
// super.onTagOperatorResult(context, jPushMessage);
// }
// @Override
// public void onCheckTagOperatorResult(Context context,JPushMessage jPushMessage){
// TagAliasOperatorHelper.getInstance().onCheckTagOperatorResult(context,jPushMessage);
// super.onCheckTagOperatorResult(context, jPushMessage);
// }
// @Override
// public void onAliasOperatorResult(Context context, JPushMessage jPushMessage) {
// TagAliasOperatorHelper.getInstance().onAliasOperatorResult(context,jPushMessage);
// super.onAliasOperatorResult(context, jPushMessage);
// }
//
// @Override
// public void onMobileNumberOperatorResult(Context context, JPushMessage jPushMessage) {
// TagAliasOperatorHelper.getInstance().onMobileNumberOperatorResult(context,jPushMessage);
// super.onMobileNumberOperatorResult(context, jPushMessage);
// }
//
// //send msg to MainActivity
// private void processCustomMessage(Context context, CustomMessage customMessage) {
// if (MainActivity.isForeground) {
// String message = customMessage.message;
// String extras = customMessage.extra;
// Intent msgIntent = new Intent(MainActivity.MESSAGE_JPUSH);
// msgIntent.putExtra(MainActivity.KEY_MESSAGE, message);
// if (!ExampleUtil.isEmpty(extras)) {
// try {
// JSONObject extraJson = new JSONObject(extras);
// if (extraJson.length() > 0) {
// msgIntent.putExtra(MainActivity.KEY_EXTRAS, extras);
// }
// } catch (JSONException e) {
//
// }
//
// }
// LocalBroadcastManager.getInstance(context).sendBroadcast(msgIntent);
// }
// }
//
//}

View File

@ -1,8 +1,11 @@
package com.sucstepsoft.txrealtimelocation.services.jpush;
import cn.jpush.android.service.JCommonService;
//import cn.jpush.android.service.JCommonService;
public class PushService extends JCommonService {
public class PushService {
}
//public class PushService extends JCommonService {
//
//}

View File

@ -1,378 +1,378 @@
package com.sucstepsoft.txrealtimelocation.services.jpush;
import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.util.SparseArray;
import com.sucstepsoft.cm_utils.utils.LogUtils;
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
import java.util.Locale;
import java.util.Set;
import cn.jpush.android.api.JPushInterface;
import cn.jpush.android.api.JPushMessage;
import cn.jpush.android.helper.Logger;
/**
* 处理tagalias相关的逻辑
*/
public class TagAliasOperatorHelper {
private static final String TAG = "JIGUANG-TagAliasHelper";
public static int sequence = 1;
/**
* 增加
*/
public static final int ACTION_ADD = 1;
/**
* 覆盖
*/
public static final int ACTION_SET = 2;
/**
* 删除部分
*/
public static final int ACTION_DELETE = 3;
/**
* 删除所有
*/
public static final int ACTION_CLEAN = 4;
/**
* 查询
*/
public static final int ACTION_GET = 5;
public static final int ACTION_CHECK = 6;
public static final int DELAY_SEND_ACTION = 1;
public static final int DELAY_SET_MOBILE_NUMBER_ACTION = 2;
private Context context;
private static TagAliasOperatorHelper mInstance;
private TagAliasOperatorHelper() {
}
public static TagAliasOperatorHelper getInstance() {
if (mInstance == null) {
synchronized (TagAliasOperatorHelper.class) {
if (mInstance == null) {
mInstance = new TagAliasOperatorHelper();
}
}
}
return mInstance;
}
public void init(Context context) {
if (context != null) {
this.context = context.getApplicationContext();
}
}
private SparseArray<Object> setActionCache = new SparseArray<Object>();
public Object get(int sequence) {
return setActionCache.get(sequence);
}
public Object remove(int sequence) {
return setActionCache.get(sequence);
}
public void put(int sequence, Object tagAliasBean) {
setActionCache.put(sequence, tagAliasBean);
}
private Handler delaySendHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case DELAY_SEND_ACTION:
if (msg.obj != null && msg.obj instanceof TagAliasBean) {
Logger.i(TAG, "on delay time");
sequence++;
TagAliasBean tagAliasBean = (TagAliasBean) msg.obj;
setActionCache.put(sequence, tagAliasBean);
if (context != null) {
handleAction(context, sequence, tagAliasBean);
} else {
Logger.e(TAG, "#unexcepted - context was null");
}
} else {
Logger.w(TAG, "#unexcepted - msg obj was incorrect");
}
break;
case DELAY_SET_MOBILE_NUMBER_ACTION:
if (msg.obj != null && msg.obj instanceof String) {
Logger.i(TAG, "retry set mobile number");
sequence++;
String mobileNumber = (String) msg.obj;
setActionCache.put(sequence, mobileNumber);
if (context != null) {
handleAction(context, sequence, mobileNumber);
} else {
Logger.e(TAG, "#unexcepted - context was null");
}
} else {
Logger.w(TAG, "#unexcepted - msg obj was incorrect");
}
break;
}
}
};
public void handleAction(Context context, int sequence, String mobileNumber) {
put(sequence, mobileNumber);
Logger.d(TAG, "sequence:" + sequence + ",mobileNumber:" + mobileNumber);
JPushInterface.setMobileNumber(context, sequence, mobileNumber);
}
/**
* 处理设置tag
*/
public void handleAction(Context context, int sequence, TagAliasBean tagAliasBean) {
init(context);
if (tagAliasBean == null) {
Logger.w(TAG, "tagAliasBean was null");
return;
}
put(sequence, tagAliasBean);
if (tagAliasBean.isAliasAction) {
switch (tagAliasBean.action) {
case ACTION_GET:
JPushInterface.getAlias(context, sequence);
break;
case ACTION_DELETE:
JPushInterface.deleteAlias(context, sequence);
break;
case ACTION_SET:
JPushInterface.setAlias(context, sequence, tagAliasBean.alias);
break;
default:
Logger.w(TAG, "unsupport alias action type");
return;
}
} else {
switch (tagAliasBean.action) {
case ACTION_ADD:
JPushInterface.addTags(context, sequence, tagAliasBean.tags);
break;
case ACTION_SET:
JPushInterface.setTags(context, sequence, tagAliasBean.tags);
break;
case ACTION_DELETE:
JPushInterface.deleteTags(context, sequence, tagAliasBean.tags);
break;
case ACTION_CHECK:
//一次只能check一个tag
String tag = (String) tagAliasBean.tags.toArray()[0];
JPushInterface.checkTagBindState(context, sequence, tag);
break;
case ACTION_GET:
JPushInterface.getAllTags(context, sequence);
break;
case ACTION_CLEAN:
JPushInterface.cleanTags(context, sequence);
break;
default:
Logger.w(TAG, "unsupport tag action type");
return;
}
}
}
private boolean RetryActionIfNeeded(int errorCode, TagAliasBean tagAliasBean) {
if (!ExampleUtil.isConnected(context)) {
Logger.w(TAG, "no network");
return false;
}
//返回的错误码为6002 超时,6014 服务器繁忙,都建议延迟重试
if (errorCode == 6002 || errorCode == 6014) {
Logger.d(TAG, "need retry");
if (tagAliasBean != null) {
Message message = new Message();
message.what = DELAY_SEND_ACTION;
message.obj = tagAliasBean;
delaySendHandler.sendMessageDelayed(message, 1000 * 60);
String logs = getRetryStr(tagAliasBean.isAliasAction, tagAliasBean.action, errorCode);
ExampleUtil.showToast(logs, context);
return true;
}
}
return false;
}
private boolean RetrySetMObileNumberActionIfNeeded(int errorCode, String mobileNumber) {
if (!ExampleUtil.isConnected(context)) {
Logger.w(TAG, "no network");
return false;
}
//返回的错误码为6002 超时,6024 服务器内部错误,建议稍后重试
if (errorCode == 6002 || errorCode == 6024) {
Logger.d(TAG, "need retry");
Message message = new Message();
message.what = DELAY_SET_MOBILE_NUMBER_ACTION;
message.obj = mobileNumber;
delaySendHandler.sendMessageDelayed(message, 1000 * 60);
String str = "Failed to set mobile number due to %s. Try again after 60s.";
str = String.format(Locale.ENGLISH, str, (errorCode == 6002 ? "timeout" : "server internal error”"));
ExampleUtil.showToast(str, context);
return true;
}
return false;
}
private String getRetryStr(boolean isAliasAction, int actionType, int errorCode) {
String str = "Failed to %s %s due to %s. Try again after 60s.";
str = String.format(Locale.ENGLISH, str, getActionStr(actionType), (isAliasAction ? "alias" : " tags"), (errorCode == 6002 ? "timeout" : "server too busy"));
return str;
}
private String getActionStr(int actionType) {
switch (actionType) {
case ACTION_ADD:
return "add";
case ACTION_SET:
return "set";
case ACTION_DELETE:
return "delete";
case ACTION_GET:
return "get";
case ACTION_CLEAN:
return "clean";
case ACTION_CHECK:
return "check";
}
return "unkonw operation";
}
public void onTagOperatorResult(Context context, JPushMessage jPushMessage) {
int sequence = jPushMessage.getSequence();
Logger.i(TAG, "action - onTagOperatorResult, sequence:" + sequence + ",tags:" + jPushMessage.getTags());
Logger.i(TAG, "tags size:" + jPushMessage.getTags().size());
init(context);
//根据sequence从之前操作缓存中获取缓存记录
TagAliasBean tagAliasBean = (TagAliasBean) setActionCache.get(sequence);
if (tagAliasBean == null) {
// ExampleUtil.showToast("获取缓存记录失败", context);
return;
}
if (jPushMessage.getErrorCode() == 0) {
Logger.i(TAG, "action - modify tag Success,sequence:" + sequence);
setActionCache.remove(sequence);
String logs = getActionStr(tagAliasBean.action) + " tags success";
Logger.i(TAG, logs);
ExampleUtil.showToast(logs, context);
} else {
String logs = "Failed to " + getActionStr(tagAliasBean.action) + " tags";
if (jPushMessage.getErrorCode() == 6018) {
//tag数量超过限制,需要先清除一部分再add
logs += ", tags is exceed limit need to clean";
}
logs += ", errorCode:" + jPushMessage.getErrorCode();
Logger.e(TAG, logs);
if (!RetryActionIfNeeded(jPushMessage.getErrorCode(), tagAliasBean)) {
ExampleUtil.showToast(logs, context);
}
}
}
/**
* 设置别名回调
*
* @param context
* @param jPushMessage
*/
public void onCheckTagOperatorResult(Context context, JPushMessage jPushMessage) {
int sequence = jPushMessage.getSequence();
Logger.i(TAG, "action - onCheckTagOperatorResult, sequence:" + sequence + ",checktag:" + jPushMessage.getCheckTag());
init(context);
//根据sequence从之前操作缓存中获取缓存记录
TagAliasBean tagAliasBean = (TagAliasBean) setActionCache.get(sequence);
if (tagAliasBean == null) {
// ExampleUtil.showToast("获取缓存记录失败", context);
return;
}
if (jPushMessage.getErrorCode() == 0) {
Logger.i(TAG, "tagBean:" + tagAliasBean);
setActionCache.remove(sequence);
String logs = getActionStr(tagAliasBean.action) + " tag " + jPushMessage.getCheckTag() + " bind state success,state:" + jPushMessage.getTagCheckStateResult();
Logger.i(TAG, logs);
ExampleUtil.showToast(logs, context);
} else {
String logs = "Failed to " + getActionStr(tagAliasBean.action) + " tags, errorCode:" + jPushMessage.getErrorCode();
Logger.e(TAG, logs);
if (!RetryActionIfNeeded(jPushMessage.getErrorCode(), tagAliasBean)) {
ExampleUtil.showToast(logs, context);
}
}
}
public void onAliasOperatorResult(Context context, JPushMessage jPushMessage) {
int sequence = jPushMessage.getSequence();
Logger.i(TAG, "action - onAliasOperatorResult, sequence:" + sequence + ",alias:" + jPushMessage.getAlias());
init(context);
//根据sequence从之前操作缓存中获取缓存记录
TagAliasBean tagAliasBean = (TagAliasBean) setActionCache.get(sequence);
if (tagAliasBean == null) {
// ExampleUtil.showToast("获取缓存记录失败", context);
return;
}
if (jPushMessage.getErrorCode() == 0) {
UserLgUtils.setAlias(true);
LogUtils.e("设置成功");
Logger.i(TAG, "action - modify alias Success,sequence:" + sequence);
setActionCache.remove(sequence);
String logs = getActionStr(tagAliasBean.action) + " alias success";
Logger.i(TAG, logs);
ExampleUtil.showToast(logs, context);
} else {
UserLgUtils.setAlias(false);
String logs = "Failed to " + getActionStr(tagAliasBean.action) + " alias, errorCode:" + jPushMessage.getErrorCode();
Logger.e(TAG, logs);
if (!RetryActionIfNeeded(jPushMessage.getErrorCode(), tagAliasBean)) {
ExampleUtil.showToast(logs, context);
}
}
}
//设置手机号码回调
public void onMobileNumberOperatorResult(Context context, JPushMessage jPushMessage) {
int sequence = jPushMessage.getSequence();
Logger.i(TAG, "action - onMobileNumberOperatorResult, sequence:" + sequence + ",mobileNumber:" + jPushMessage.getMobileNumber());
init(context);
if (jPushMessage.getErrorCode() == 0) {
Logger.i(TAG, "action - set mobile number Success,sequence:" + sequence);
setActionCache.remove(sequence);
} else {
String logs = "Failed to set mobile number, errorCode:" + jPushMessage.getErrorCode();
Logger.e(TAG, logs);
if (!RetrySetMObileNumberActionIfNeeded(jPushMessage.getErrorCode(), jPushMessage.getMobileNumber())) {
ExampleUtil.showToast(logs, context);
}
}
}
public static class TagAliasBean {
int action;
Set<String> tags;
String alias;
boolean isAliasAction;
@Override
public String toString() {
return "TagAliasBean{" +
"action=" + action +
", tags=" + tags +
", alias='" + alias + '\'' +
", isAliasAction=" + isAliasAction +
'}';
}
}
}
//package com.sucstepsoft.txrealtimelocation.services.jpush;
//
//import android.content.Context;
//import android.os.Handler;
//import android.os.Message;
//import android.util.SparseArray;
//
//import com.sucstepsoft.cm_utils.utils.LogUtils;
//import com.sucstepsoft.cm_utils.utils.UserLgUtils;
//
//import java.util.Locale;
//import java.util.Set;
//
//import cn.jpush.android.api.JPushInterface;
//import cn.jpush.android.api.JPushMessage;
//import cn.jpush.android.helper.Logger;
//
///**
// * 处理tagalias相关的逻辑
// */
//public class TagAliasOperatorHelper {
// private static final String TAG = "JIGUANG-TagAliasHelper";
// public static int sequence = 1;
// /**
// * 增加
// */
// public static final int ACTION_ADD = 1;
// /**
// * 覆盖
// */
// public static final int ACTION_SET = 2;
// /**
// * 删除部分
// */
// public static final int ACTION_DELETE = 3;
// /**
// * 删除所有
// */
// public static final int ACTION_CLEAN = 4;
// /**
// * 查询
// */
// public static final int ACTION_GET = 5;
//
// public static final int ACTION_CHECK = 6;
//
// public static final int DELAY_SEND_ACTION = 1;
//
// public static final int DELAY_SET_MOBILE_NUMBER_ACTION = 2;
//
// private Context context;
//
// private static TagAliasOperatorHelper mInstance;
//
// private TagAliasOperatorHelper() {
// }
//
// public static TagAliasOperatorHelper getInstance() {
// if (mInstance == null) {
// synchronized (TagAliasOperatorHelper.class) {
// if (mInstance == null) {
// mInstance = new TagAliasOperatorHelper();
// }
// }
// }
// return mInstance;
// }
//
// public void init(Context context) {
// if (context != null) {
// this.context = context.getApplicationContext();
// }
// }
//
// private SparseArray<Object> setActionCache = new SparseArray<Object>();
//
// public Object get(int sequence) {
// return setActionCache.get(sequence);
// }
//
// public Object remove(int sequence) {
// return setActionCache.get(sequence);
// }
//
// public void put(int sequence, Object tagAliasBean) {
// setActionCache.put(sequence, tagAliasBean);
// }
//
// private Handler delaySendHandler = new Handler() {
// @Override
// public void handleMessage(Message msg) {
// switch (msg.what) {
// case DELAY_SEND_ACTION:
// if (msg.obj != null && msg.obj instanceof TagAliasBean) {
// Logger.i(TAG, "on delay time");
// sequence++;
// TagAliasBean tagAliasBean = (TagAliasBean) msg.obj;
// setActionCache.put(sequence, tagAliasBean);
// if (context != null) {
// handleAction(context, sequence, tagAliasBean);
// } else {
// Logger.e(TAG, "#unexcepted - context was null");
// }
// } else {
// Logger.w(TAG, "#unexcepted - msg obj was incorrect");
// }
// break;
// case DELAY_SET_MOBILE_NUMBER_ACTION:
// if (msg.obj != null && msg.obj instanceof String) {
// Logger.i(TAG, "retry set mobile number");
// sequence++;
// String mobileNumber = (String) msg.obj;
// setActionCache.put(sequence, mobileNumber);
// if (context != null) {
// handleAction(context, sequence, mobileNumber);
// } else {
// Logger.e(TAG, "#unexcepted - context was null");
// }
// } else {
// Logger.w(TAG, "#unexcepted - msg obj was incorrect");
// }
// break;
// }
// }
// };
//
// public void handleAction(Context context, int sequence, String mobileNumber) {
// put(sequence, mobileNumber);
// Logger.d(TAG, "sequence:" + sequence + ",mobileNumber:" + mobileNumber);
// JPushInterface.setMobileNumber(context, sequence, mobileNumber);
// }
//
// /**
// * 处理设置tag
// */
// public void handleAction(Context context, int sequence, TagAliasBean tagAliasBean) {
// init(context);
// if (tagAliasBean == null) {
// Logger.w(TAG, "tagAliasBean was null");
// return;
// }
// put(sequence, tagAliasBean);
// if (tagAliasBean.isAliasAction) {
// switch (tagAliasBean.action) {
// case ACTION_GET:
// JPushInterface.getAlias(context, sequence);
// break;
// case ACTION_DELETE:
// JPushInterface.deleteAlias(context, sequence);
// break;
// case ACTION_SET:
// JPushInterface.setAlias(context, sequence, tagAliasBean.alias);
// break;
// default:
// Logger.w(TAG, "unsupport alias action type");
// return;
// }
// } else {
// switch (tagAliasBean.action) {
// case ACTION_ADD:
// JPushInterface.addTags(context, sequence, tagAliasBean.tags);
// break;
// case ACTION_SET:
// JPushInterface.setTags(context, sequence, tagAliasBean.tags);
// break;
// case ACTION_DELETE:
// JPushInterface.deleteTags(context, sequence, tagAliasBean.tags);
// break;
// case ACTION_CHECK:
// //一次只能check一个tag
// String tag = (String) tagAliasBean.tags.toArray()[0];
// JPushInterface.checkTagBindState(context, sequence, tag);
// break;
// case ACTION_GET:
// JPushInterface.getAllTags(context, sequence);
// break;
// case ACTION_CLEAN:
// JPushInterface.cleanTags(context, sequence);
// break;
// default:
// Logger.w(TAG, "unsupport tag action type");
// return;
// }
// }
// }
//
// private boolean RetryActionIfNeeded(int errorCode, TagAliasBean tagAliasBean) {
// if (!ExampleUtil.isConnected(context)) {
// Logger.w(TAG, "no network");
// return false;
// }
// //返回的错误码为6002 超时,6014 服务器繁忙,都建议延迟重试
// if (errorCode == 6002 || errorCode == 6014) {
// Logger.d(TAG, "need retry");
// if (tagAliasBean != null) {
// Message message = new Message();
// message.what = DELAY_SEND_ACTION;
// message.obj = tagAliasBean;
// delaySendHandler.sendMessageDelayed(message, 1000 * 60);
// String logs = getRetryStr(tagAliasBean.isAliasAction, tagAliasBean.action, errorCode);
// ExampleUtil.showToast(logs, context);
// return true;
// }
// }
// return false;
// }
//
// private boolean RetrySetMObileNumberActionIfNeeded(int errorCode, String mobileNumber) {
// if (!ExampleUtil.isConnected(context)) {
// Logger.w(TAG, "no network");
// return false;
// }
// //返回的错误码为6002 超时,6024 服务器内部错误,建议稍后重试
// if (errorCode == 6002 || errorCode == 6024) {
// Logger.d(TAG, "need retry");
// Message message = new Message();
// message.what = DELAY_SET_MOBILE_NUMBER_ACTION;
// message.obj = mobileNumber;
// delaySendHandler.sendMessageDelayed(message, 1000 * 60);
// String str = "Failed to set mobile number due to %s. Try again after 60s.";
// str = String.format(Locale.ENGLISH, str, (errorCode == 6002 ? "timeout" : "server internal error”"));
// ExampleUtil.showToast(str, context);
// return true;
// }
// return false;
//
// }
//
// private String getRetryStr(boolean isAliasAction, int actionType, int errorCode) {
// String str = "Failed to %s %s due to %s. Try again after 60s.";
// str = String.format(Locale.ENGLISH, str, getActionStr(actionType), (isAliasAction ? "alias" : " tags"), (errorCode == 6002 ? "timeout" : "server too busy"));
// return str;
// }
//
// private String getActionStr(int actionType) {
// switch (actionType) {
// case ACTION_ADD:
// return "add";
// case ACTION_SET:
// return "set";
// case ACTION_DELETE:
// return "delete";
// case ACTION_GET:
// return "get";
// case ACTION_CLEAN:
// return "clean";
// case ACTION_CHECK:
// return "check";
// }
// return "unkonw operation";
// }
//
// public void onTagOperatorResult(Context context, JPushMessage jPushMessage) {
// int sequence = jPushMessage.getSequence();
// Logger.i(TAG, "action - onTagOperatorResult, sequence:" + sequence + ",tags:" + jPushMessage.getTags());
// Logger.i(TAG, "tags size:" + jPushMessage.getTags().size());
// init(context);
// //根据sequence从之前操作缓存中获取缓存记录
// TagAliasBean tagAliasBean = (TagAliasBean) setActionCache.get(sequence);
// if (tagAliasBean == null) {
//// ExampleUtil.showToast("获取缓存记录失败", context);
// return;
// }
// if (jPushMessage.getErrorCode() == 0) {
// Logger.i(TAG, "action - modify tag Success,sequence:" + sequence);
// setActionCache.remove(sequence);
// String logs = getActionStr(tagAliasBean.action) + " tags success";
// Logger.i(TAG, logs);
// ExampleUtil.showToast(logs, context);
// } else {
// String logs = "Failed to " + getActionStr(tagAliasBean.action) + " tags";
// if (jPushMessage.getErrorCode() == 6018) {
// //tag数量超过限制,需要先清除一部分再add
// logs += ", tags is exceed limit need to clean";
// }
// logs += ", errorCode:" + jPushMessage.getErrorCode();
// Logger.e(TAG, logs);
// if (!RetryActionIfNeeded(jPushMessage.getErrorCode(), tagAliasBean)) {
// ExampleUtil.showToast(logs, context);
// }
// }
// }
//
// /**
// * 设置别名回调
// *
// * @param context
// * @param jPushMessage
// */
// public void onCheckTagOperatorResult(Context context, JPushMessage jPushMessage) {
// int sequence = jPushMessage.getSequence();
// Logger.i(TAG, "action - onCheckTagOperatorResult, sequence:" + sequence + ",checktag:" + jPushMessage.getCheckTag());
// init(context);
// //根据sequence从之前操作缓存中获取缓存记录
// TagAliasBean tagAliasBean = (TagAliasBean) setActionCache.get(sequence);
// if (tagAliasBean == null) {
//// ExampleUtil.showToast("获取缓存记录失败", context);
// return;
// }
// if (jPushMessage.getErrorCode() == 0) {
// Logger.i(TAG, "tagBean:" + tagAliasBean);
// setActionCache.remove(sequence);
// String logs = getActionStr(tagAliasBean.action) + " tag " + jPushMessage.getCheckTag() + " bind state success,state:" + jPushMessage.getTagCheckStateResult();
// Logger.i(TAG, logs);
// ExampleUtil.showToast(logs, context);
// } else {
// String logs = "Failed to " + getActionStr(tagAliasBean.action) + " tags, errorCode:" + jPushMessage.getErrorCode();
// Logger.e(TAG, logs);
// if (!RetryActionIfNeeded(jPushMessage.getErrorCode(), tagAliasBean)) {
// ExampleUtil.showToast(logs, context);
// }
// }
// }
//
// public void onAliasOperatorResult(Context context, JPushMessage jPushMessage) {
// int sequence = jPushMessage.getSequence();
// Logger.i(TAG, "action - onAliasOperatorResult, sequence:" + sequence + ",alias:" + jPushMessage.getAlias());
// init(context);
// //根据sequence从之前操作缓存中获取缓存记录
// TagAliasBean tagAliasBean = (TagAliasBean) setActionCache.get(sequence);
// if (tagAliasBean == null) {
//// ExampleUtil.showToast("获取缓存记录失败", context);
// return;
// }
// if (jPushMessage.getErrorCode() == 0) {
// UserLgUtils.setAlias(true);
// LogUtils.e("设置成功");
// Logger.i(TAG, "action - modify alias Success,sequence:" + sequence);
// setActionCache.remove(sequence);
// String logs = getActionStr(tagAliasBean.action) + " alias success";
// Logger.i(TAG, logs);
// ExampleUtil.showToast(logs, context);
// } else {
// UserLgUtils.setAlias(false);
// String logs = "Failed to " + getActionStr(tagAliasBean.action) + " alias, errorCode:" + jPushMessage.getErrorCode();
// Logger.e(TAG, logs);
// if (!RetryActionIfNeeded(jPushMessage.getErrorCode(), tagAliasBean)) {
// ExampleUtil.showToast(logs, context);
// }
// }
// }
//
// //设置手机号码回调
// public void onMobileNumberOperatorResult(Context context, JPushMessage jPushMessage) {
// int sequence = jPushMessage.getSequence();
// Logger.i(TAG, "action - onMobileNumberOperatorResult, sequence:" + sequence + ",mobileNumber:" + jPushMessage.getMobileNumber());
// init(context);
// if (jPushMessage.getErrorCode() == 0) {
// Logger.i(TAG, "action - set mobile number Success,sequence:" + sequence);
// setActionCache.remove(sequence);
// } else {
// String logs = "Failed to set mobile number, errorCode:" + jPushMessage.getErrorCode();
// Logger.e(TAG, logs);
// if (!RetrySetMObileNumberActionIfNeeded(jPushMessage.getErrorCode(), jPushMessage.getMobileNumber())) {
// ExampleUtil.showToast(logs, context);
// }
// }
// }
//
// public static class TagAliasBean {
// int action;
// Set<String> tags;
// String alias;
// boolean isAliasAction;
//
// @Override
// public String toString() {
// return "TagAliasBean{" +
// "action=" + action +
// ", tags=" + tags +
// ", alias='" + alias + '\'' +
// ", isAliasAction=" + isAliasAction +
// '}';
// }
// }
//
//
//}

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_uncheck" android:state_checked="false" />
<item android:drawable="@drawable/ic_checked" android:state_checked="true" />
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activitys.companylib.CompanyDetailActivity">
</android.support.constraint.ConstraintLayout>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activitys.companylib.CompanyInfoEditActivity">
</android.support.constraint.ConstraintLayout>

View File

@ -0,0 +1,111 @@
<?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"
android:background="@color/white"
android:orientation="vertical"
tools:context=".activitys.companylib.CompanyLibActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp">
<EditText
android:id="@+id/et_company_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shp_rectangle_gray"
android:gravity="left"
android:hint="@string/hit_company_name"
android:padding="5dp"
android:textColor="@color/black"
android:textSize="15sp"
tools:text="" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_com_type"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:background="@drawable/shp_rectangle_gray"
android:drawableRight="@drawable/ic_arrow_gray_down"
android:hint="请选择单位类型"
android:padding="5dp"
android:textColor="@color/black"
tools:text="单位类型" />
<Button
android:id="@+id/btn_search"
android:layout_width="60dp"
android:layout_height="30dp"
android:layout_margin="0dp"
android:background="@drawable/sel_btn_submit"
android:padding="0dp"
android:text="搜索"
android:textColor="@color/white" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="5dp"
android:background="@color/gray_bg" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:orientation="vertical">
<ProgressBar
android:id="@+id/pb_loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminateBehavior="repeat"
android:indeterminateDrawable="@drawable/anim_loading" />
<ImageView
android:id="@+id/iv_empty"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerInParent="true"
android:background="@drawable/ic_empty_data" />
<TextView
android:id="@+id/tv_error_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:clickable="true"
android:textColor="@color/black"
tools:text="加载数据失败" />
</LinearLayout>
<com.jcodecraeer.xrecyclerview.XRecyclerView
android:id="@+id/xlv_com_lib"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp" />
</RelativeLayout>
</LinearLayout>

View File

@ -0,0 +1,431 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tv_issue_base_info"
style="@style/issue_report_title"
android:padding="8dp"
android:text="基本信息"
android:textStyle="bold" />
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
app:cardCornerRadius="5dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="false">
<LinearLayout
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:orientation="horizontal"
android:padding="10dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_start_hint" />
<EditText
android:id="@+id/et_company_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:background="@drawable/shp_rectangle_gray"
android:gravity="left"
android:hint="@string/hit_company_name"
android:padding="10dp"
android:textColor="@color/black"
android:textSize="15sp"
tools:text="" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_start_hint" />
<TextView
android:id="@+id/tv_com_type"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shp_rectangle_gray"
android:drawableRight="@drawable/ic_arrow_gray_down"
android:hint="请选择单位类型"
android:padding="10dp"
android:textColor="@color/black"
tools:text="单位类型" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_start_hint" />
<EditText
android:id="@+id/et_register_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="@drawable/shp_rectangle_gray"
android:gravity="left"
android:hint="请输入注册地址"
android:minLines="3"
android:padding="8dp"
android:textSize="15sp"
tools:text="" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_start_hint" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shp_rectangle_gray"
android:drawableRight="@drawable/ic_arrow_gray_down"
android:hint="企业所属旗县"
android:padding="10dp"
android:textColor="@color/black"
tools:text="旗县" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_start_hint" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shp_rectangle_gray"
android:drawableRight="@drawable/ic_arrow_gray_down"
android:hint="请选择所属街道"
android:padding="10dp"
android:textColor="@color/black"
tools:text="街道" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_start_hint" />
<EditText
android:id="@+id/et_detail_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="@drawable/shp_rectangle_gray"
android:gravity="left"
android:hint="请输入详细地址"
android:minLines="3"
android:padding="8dp"
android:textSize="15sp"
tools:text="" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_start_hint" />
<TextView
android:id="@+id/tv_trade"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:background="@drawable/shp_rectangle_gray"
android:drawableRight="@drawable/ic_arrow_gray_down"
android:gravity="left"
android:hint="请选择管理行业"
android:padding="10dp"
android:textColor="@color/black"
android:textSize="15sp"
tools:text="管理行业" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_start_hint" />
<EditText
android:id="@+id/et_peo_count"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="@drawable/shp_rectangle_gray"
android:gravity="left"
android:hint="请输入从业人员数量"
android:inputType="number"
android:minLines="3"
android:padding="8dp"
android:textSize="15sp"
tools:text="" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_start_hint" />
<TextView
android:id="@+id/tv_risk"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:background="@drawable/shp_rectangle_gray"
android:drawableRight="@drawable/ic_arrow_gray_down"
android:gravity="left"
android:hint="请选择风险特点"
android:padding="10dp"
android:textColor="@color/black"
android:textSize="15sp"
tools:text="请选择高风险" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_start_hint" />
<EditText
android:id="@+id/et_pre"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="@drawable/shp_rectangle_gray"
android:gravity="left"
android:hint="请输入主要负责人"
android:padding="8dp"
android:textSize="15sp"
tools:text="" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_start_hint" />
<EditText
android:id="@+id/et_phone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="@drawable/shp_rectangle_gray"
android:gravity="left"
android:hint="请输入手机号码"
android:padding="8dp"
android:textSize="15sp"
tools:text="" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<TextView
android:id="@+id/tv_issue_detail_info"
style="@style/issue_report_title"
android:padding="8dp"
android:text="企业照片"
android:textStyle="bold" />
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
app:cardCornerRadius="10dp"
app:cardElevation="1dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="false">
<LinearLayout
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:orientation="vertical"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_start_hint" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shp_rectangle_gray"
android:padding="10dp"
android:text="厂区大门"
android:textColor="@color/black" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/rlv_door"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_start_hint" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shp_rectangle_gray"
android:padding="10dp"
android:text="主要作业场所"
android:textColor="@color/black" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/rlv_place"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:layout_marginRight="15dp"
android:layout_marginBottom="10dp"
app:cardCornerRadius="10dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="false">
<Button
android:id="@+id/btn_submit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/sel_btn_submit"
android:text="录入"
android:textColor="@color/white"
android:textSize="18sp" />
</android.support.v7.widget.CardView>
</LinearLayout>
</ScrollView>
</RelativeLayout>

View File

@ -2,7 +2,7 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_main">
android:background="@drawable/bg_login">
<RelativeLayout
@ -15,9 +15,9 @@
<RelativeLayout
android:id="@+id/rl_phone"
android:layout_width="match_parent"
android:background="@drawable/shape_login_input_bg"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:background="@drawable/shape_login_input_bg">
android:layout_marginTop="30dp">
<EditText
android:id="@+id/et_user_phone"
@ -95,12 +95,18 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/btn_confirm"
android:layout_marginTop="10dp">
android:layout_marginTop="5dp">
<CheckBox
android:id="@+id/cb_remember"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:background="@null"
android:button="@null"
android:drawableLeft="@drawable/sel_remeber_pwd"
android:drawablePadding="5dp"
android:gravity="center"
android:text="记住密码"
android:textColor="@color/white"
android:textSize="15sp" />
@ -110,7 +116,6 @@
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="忘记密码"

View File

@ -175,48 +175,10 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="每日通报"
android:text="隐患复查"
android:textSize="10sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_issue_dis"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_issue_dis_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shp_point_red"
android:visibility="invisible" />
<TextView
android:id="@+id/tv_issue_dis_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="0"
android:textColor="#353535"
android:textSize="20sp" />
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="待办案件"
android:textSize="10sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_mine_issue"
@ -239,7 +201,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="我的案件"
android:text="我的企业"
android:textSize="10sp" />
</LinearLayout>
@ -247,11 +209,6 @@
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/gray_line_ver" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/gray_line_ver" />
</LinearLayout>
</RelativeLayout>
@ -261,16 +218,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/tv_current_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="9dp"
android:padding="8dp"
android:textColor="#ff808080"
android:textSize="12sp"
tools:text="当前时间2019年10月10日 22:00:202019年10月10日 22:00:202019年10月10日 22:00:202019年10月10日 22:00:202019年10月10日 22:00:202019年10月10日 22:00:202019年10月10日 22:00:20" />
<TextView
android:layout_width="wrap_content"
@ -287,7 +234,6 @@
android:id="@+id/rlv_funcs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/tv_current_time"
android:layout_marginLeft="5dp"
android:layout_marginTop="7dp"
android:layout_marginRight="5dp"
@ -295,316 +241,5 @@
tools:layoutManager="GridLayoutManager"
tools:listitem="@layout/item_main_func"
tools:spanCount="3" />
<!--<LinearLayout-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_below="@id/tv_current_time"-->
<!--android:layout_marginLeft="15dp"-->
<!--android:layout_marginTop="7dp"-->
<!--android:layout_marginRight="15dp"-->
<!--android:gravity="center_vertical"-->
<!--android:orientation="vertical">-->
<!--&lt;!&ndash;案件上报&ndash;&gt;-->
<!--<RelativeLayout-->
<!--android:id="@+id/rl_issue_report"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:background="@drawable/shape_rectangle_white"-->
<!--android:orientation="horizontal"-->
<!--android:padding="14dp">-->
<!--<ImageView-->
<!--android:id="@+id/ll_report_icon"-->
<!--android:layout_width="48dp"-->
<!--android:layout_height="48dp"-->
<!--android:background="@drawable/ic_issue_report" />-->
<!--<LinearLayout-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_marginLeft="12dp"-->
<!--android:layout_toRightOf="@id/ll_report_icon"-->
<!--android:gravity="center_vertical"-->
<!--android:orientation="vertical">-->
<!--<TextView-->
<!--android:layout_width="72dp"-->
<!--android:layout_height="25dp"-->
<!--android:text="案件上报"-->
<!--android:textColor="#ff353535"-->
<!--android:textSize="18sp" />-->
<!--<TextView-->
<!--android:layout_width="132dp"-->
<!--android:layout_height="17dp"-->
<!--android:layout_marginTop="6dp"-->
<!--android:text="准确上报给片区案件信息"-->
<!--android:textColor="#ff808080"-->
<!--android:textSize="12sp" />-->
<!--</LinearLayout>-->
<!--<ImageView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_alignParentRight="true"-->
<!--android:layout_centerVertical="true"-->
<!--android:layout_marginRight="10dp"-->
<!--android:src="@drawable/ic_arrow_gray_right" />-->
<!--</RelativeLayout>-->
<!--<RelativeLayout-->
<!--android:id="@+id/rl_issue_record"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_marginTop="10dp"-->
<!--android:background="@drawable/shape_rectangle_white"-->
<!--android:orientation="horizontal"-->
<!--android:padding="14dp">-->
<!--<ImageView-->
<!--android:id="@+id/ll_record_icon"-->
<!--android:layout_width="48dp"-->
<!--android:layout_height="48dp"-->
<!--android:background="@drawable/ic_issue_record" />-->
<!--<LinearLayout-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_marginLeft="12dp"-->
<!--android:layout_toRightOf="@id/ll_record_icon"-->
<!--android:gravity="center_vertical"-->
<!--android:orientation="vertical">-->
<!--<TextView-->
<!--android:layout_width="72dp"-->
<!--android:layout_height="25dp"-->
<!--android:text="案件记录"-->
<!--android:textColor="#ff353535"-->
<!--android:textSize="18sp" />-->
<!--<TextView-->
<!--android:layout_width="132dp"-->
<!--android:layout_height="17dp"-->
<!--android:layout_marginTop="6dp"-->
<!--android:text="快速查看历史案件信息"-->
<!--android:textColor="#ff808080"-->
<!--android:textSize="12sp" />-->
<!--</LinearLayout>-->
<!--<ImageView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_alignParentRight="true"-->
<!--android:layout_centerVertical="true"-->
<!--android:layout_marginRight="10dp"-->
<!--android:src="@drawable/ic_arrow_gray_right" />-->
<!--</RelativeLayout>-->
<!--<RelativeLayout-->
<!--android:id="@+id/rl_issue_dispose"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_marginTop="10dp"-->
<!--android:background="@drawable/shape_rectangle_white"-->
<!--android:orientation="horizontal"-->
<!--android:padding="14dp">-->
<!--<ImageView-->
<!--android:id="@+id/ll_issue_icon"-->
<!--android:layout_width="48dp"-->
<!--android:layout_height="48dp"-->
<!--android:background="@drawable/ic_issue_disp" />-->
<!--<LinearLayout-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_marginLeft="12dp"-->
<!--android:layout_toRightOf="@id/ll_issue_icon"-->
<!--android:gravity="center_vertical"-->
<!--android:orientation="vertical">-->
<!--<TextView-->
<!--android:layout_width="72dp"-->
<!--android:layout_height="25dp"-->
<!--android:text="案件处理"-->
<!--android:textColor="#ff353535"-->
<!--android:textSize="18sp" />-->
<!--<TextView-->
<!--android:layout_width="132dp"-->
<!--android:layout_height="17dp"-->
<!--android:layout_marginTop="6dp"-->
<!--android:text="与我相关案件及时处理"-->
<!--android:textColor="#ff808080"-->
<!--android:textSize="12sp" />-->
<!--</LinearLayout>-->
<!--<ImageView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_alignParentRight="true"-->
<!--android:layout_centerVertical="true"-->
<!--android:layout_marginRight="10dp"-->
<!--android:src="@drawable/ic_arrow_gray_right" />-->
<!--</RelativeLayout>-->
<!--<RelativeLayout-->
<!--android:id="@+id/rl_work_iocus"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_marginTop="10dp"-->
<!--android:background="@drawable/shape_rectangle_white"-->
<!--android:orientation="horizontal"-->
<!--android:padding="14dp">-->
<!--<ImageView-->
<!--android:id="@+id/ll_path_icon"-->
<!--android:layout_width="48dp"-->
<!--android:layout_height="48dp"-->
<!--android:background="@drawable/ic_work_path" />-->
<!--<LinearLayout-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_marginLeft="12dp"-->
<!--android:layout_toRightOf="@id/ll_path_icon"-->
<!--android:gravity="center_vertical"-->
<!--android:orientation="vertical">-->
<!--<TextView-->
<!--android:layout_width="72dp"-->
<!--android:layout_height="25dp"-->
<!--android:text="工作轨迹"-->
<!--android:textColor="#ff353535"-->
<!--android:textSize="18sp" />-->
<!--<TextView-->
<!--android:layout_width="132dp"-->
<!--android:layout_height="17dp"-->
<!--android:layout_marginTop="6dp"-->
<!--android:text="实时定位我的工作轨迹"-->
<!--android:textColor="#ff808080"-->
<!--android:textSize="12sp" />-->
<!--</LinearLayout>-->
<!--<ImageView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_alignParentRight="true"-->
<!--android:layout_centerVertical="true"-->
<!--android:layout_marginRight="10dp"-->
<!--android:src="@drawable/ic_arrow_gray_right" />-->
<!--</RelativeLayout>-->
<!--<RelativeLayout-->
<!--android:id="@+id/rl_address_list"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_marginTop="10dp"-->
<!--android:background="@drawable/shape_rectangle_white"-->
<!--android:orientation="horizontal"-->
<!--android:padding="14dp">-->
<!--<ImageView-->
<!--android:id="@+id/ll_address_icon"-->
<!--android:layout_width="48dp"-->
<!--android:layout_height="48dp"-->
<!--android:background="@drawable/ic_address_list" />-->
<!--<LinearLayout-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_marginLeft="12dp"-->
<!--android:layout_toRightOf="@id/ll_address_icon"-->
<!--android:gravity="center_vertical"-->
<!--android:orientation="vertical">-->
<!--<TextView-->
<!--android:layout_width="72dp"-->
<!--android:layout_height="25dp"-->
<!--android:text="通讯录"-->
<!--android:textColor="#ff353535"-->
<!--android:textSize="18sp" />-->
<!--<TextView-->
<!--android:layout_width="132dp"-->
<!--android:layout_height="17dp"-->
<!--android:layout_marginTop="6dp"-->
<!--android:text="各片区管理人员通讯录信息"-->
<!--android:textColor="#ff808080"-->
<!--android:textSize="12sp" />-->
<!--</LinearLayout>-->
<!--<ImageView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_alignParentRight="true"-->
<!--android:layout_centerVertical="true"-->
<!--android:layout_marginRight="10dp"-->
<!--android:src="@drawable/ic_arrow_gray_right" />-->
<!--</RelativeLayout>-->
<!--<RelativeLayout-->
<!--android:id="@+id/rl_notice"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_marginTop="10dp"-->
<!--android:background="@drawable/shape_rectangle_white"-->
<!--android:orientation="horizontal"-->
<!--android:padding="14dp">-->
<!--<ImageView-->
<!--android:id="@+id/ll_notice_icon"-->
<!--android:layout_width="48dp"-->
<!--android:layout_height="48dp"-->
<!--android:background="@drawable/ic_notice" />-->
<!--<LinearLayout-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_marginLeft="12dp"-->
<!--android:layout_toRightOf="@id/ll_notice_icon"-->
<!--android:gravity="center_vertical"-->
<!--android:orientation="vertical">-->
<!--<TextView-->
<!--android:layout_width="72dp"-->
<!--android:layout_height="25dp"-->
<!--android:text="通知公告"-->
<!--android:textColor="#ff353535"-->
<!--android:textSize="18sp" />-->
<!--<TextView-->
<!--android:layout_width="132dp"-->
<!--android:layout_height="17dp"-->
<!--android:layout_marginTop="6dp"-->
<!--android:text="城市管理工作相关通知公告等"-->
<!--android:textColor="#ff808080"-->
<!--android:textSize="12sp" />-->
<!--</LinearLayout>-->
<!--<ImageView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_alignParentRight="true"-->
<!--android:layout_centerVertical="true"-->
<!--android:layout_marginRight="10dp"-->
<!--android:src="@drawable/ic_arrow_gray_right" />-->
<!--</RelativeLayout>-->
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_gravity="center_horizontal"-->
<!--android:layout_marginTop="10dp"-->
<!--android:layout_marginBottom="10dp"-->
<!--android:text="版权所有 包头市稀土高新区"-->
<!--android:textColor="#ffcbcbcb"-->
<!--android:textSize="12sp" />-->
<!--</LinearLayout>-->
</RelativeLayout>
</LinearLayout>

View File

@ -0,0 +1,110 @@
<?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"
android:background="@color/white"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp">
<EditText
android:id="@+id/et_company_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shp_rectangle_gray"
android:gravity="left"
android:hint="@string/hit_company_name"
android:padding="5dp"
android:textColor="@color/black"
android:textSize="15sp"
tools:text="" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_com_type"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:background="@drawable/shp_rectangle_gray"
android:drawableRight="@drawable/ic_arrow_gray_down"
android:hint="请选择单位类型"
android:padding="5dp"
android:textColor="@color/black"
tools:text="单位类型" />
<Button
android:id="@+id/btn_search"
android:layout_width="60dp"
android:layout_height="30dp"
android:layout_margin="0dp"
android:background="@drawable/sel_btn_submit"
android:padding="0dp"
android:text="搜索"
android:textColor="@color/white" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="5dp"
android:background="@color/gray_bg" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:orientation="vertical">
<ProgressBar
android:id="@+id/pb_loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminateBehavior="repeat"
android:indeterminateDrawable="@drawable/anim_loading" />
<ImageView
android:id="@+id/iv_empty"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerInParent="true"
android:background="@drawable/ic_empty_data" />
<TextView
android:id="@+id/tv_error_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:clickable="true"
android:textColor="@color/black"
tools:text="加载数据失败" />
</LinearLayout>
<com.jcodecraeer.xrecyclerview.XRecyclerView
android:id="@+id/xlv_com_lib"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp" />
</RelativeLayout>
</LinearLayout>

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
tools:context=".activitys.trouble.TroubleReportActivity">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none">
<LinearLayout
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:orientation="horizontal"
android:padding="10dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_start_hint" />
<TextView
android:id="@+id/tv_sel_company"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shp_rectangle_gray"
android:drawableRight="@drawable/ic_arrow_gray_down"
android:hint="请选择企业"
android:padding="10dp"
android:textColor="@color/black"
tools:text="选择企业" />
</LinearLayout>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:layout_marginRight="15dp"
android:layout_marginBottom="10dp"
app:cardCornerRadius="10dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="false">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="30dp"
android:text="请先选择企业"
android:textSize="20sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="企业详情" />
</LinearLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/btn_submit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_margin="10dp"
android:background="@drawable/sel_btn_submit"
android:text="上报"
android:textColor="@color/white"
android:textSize="18sp" />
</RelativeLayout>

View File

@ -0,0 +1,36 @@
<?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:gravity="center_vertical"
android:orientation="horizontal"
android:padding="10dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/tv_company_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/black"
android:textSize="15sp"
tools:text="公司名称" />
<TextView
android:id="@+id/tv_company_peo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="企业负责人:zhangsan" />
</LinearLayout>
<Button
android:id="@+id/btn_claim"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="认领\n企业" />
</LinearLayout>

View File

@ -32,6 +32,7 @@
<string name="long_click_record">长按 录音</string>
<string name="hang_up_finsh">松开 结束</string>
<string name="release_cancel">松开 取消</string>
<string name="hit_company_name">请输入企业名称</string>
<string-array name="issue_source">
<item>群众举报</item>
<item>巡检采集</item>