人口页面新
@ -50,11 +50,10 @@
|
||||
tools:ignore="GoogleAppIndexingWarning">
|
||||
<activity
|
||||
android:name=".activitys.common.WorkSignActivity"
|
||||
android:exported="false">
|
||||
<meta-data
|
||||
android:name="android.app.lib_name"
|
||||
android:value="" />
|
||||
</activity>
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden"
|
||||
tools:ignore="LockedOrientationActivity" />
|
||||
|
||||
<activity
|
||||
android:name=".activitys.addresslist.SearchGridActivity"
|
||||
android:screenOrientation="portrait"
|
||||
|
@ -12,6 +12,7 @@ import android.os.Environment;
|
||||
import android.provider.Settings;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.GridLayoutManager;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
@ -40,6 +41,7 @@ import com.sucstepsoft.cm_utils.core.retrofit_net.BaseUrlApi;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.core.widget.views.CenterFuncDialogView;
|
||||
import com.sucstepsoft.cm_utils.core.widget.views.CustomStateView;
|
||||
import com.sucstepsoft.cm_utils.utils.AppUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.FileUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.LogUtils;
|
||||
@ -51,12 +53,13 @@ import com.sucstepsoft.cm_utils.utils.UserLgUtils;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.ScreenManager;
|
||||
import com.sucstepsoft.realtimelocation.activitys.addresslist.AddressListMainActivity;
|
||||
import com.sucstepsoft.realtimelocation.activitys.census.CensusExpandableMainActivity;
|
||||
import com.sucstepsoft.realtimelocation.activitys.census.hire.CensusHireListActivity;
|
||||
import com.sucstepsoft.realtimelocation.activitys.census.house.SearchHouseByPersonActivity;
|
||||
import com.sucstepsoft.realtimelocation.activitys.census.house.SearchPersonByHouseActivity;
|
||||
import com.sucstepsoft.realtimelocation.activitys.census.newhouse.activitys.NewHouseManageActivity;
|
||||
import com.sucstepsoft.realtimelocation.activitys.census.normal.CensusRegisterAddActivity;
|
||||
import com.sucstepsoft.realtimelocation.activitys.census.outbound.CensusOutboundListActivity;
|
||||
import com.sucstepsoft.realtimelocation.activitys.common.WorkSignActivity;
|
||||
import com.sucstepsoft.realtimelocation.activitys.issue.IssueCheckActivity;
|
||||
import com.sucstepsoft.realtimelocation.activitys.issue.IssueMineActivity;
|
||||
import com.sucstepsoft.realtimelocation.activitys.issue.IssuePubReportActivity;
|
||||
@ -69,12 +72,14 @@ import com.sucstepsoft.realtimelocation.activitys.mine.UserActivity;
|
||||
import com.sucstepsoft.realtimelocation.activitys.mine.WorkLogActivity;
|
||||
import com.sucstepsoft.realtimelocation.activitys.notice.NoticeActivity;
|
||||
import com.sucstepsoft.realtimelocation.adapters.FunctionNumAdapter;
|
||||
import com.sucstepsoft.realtimelocation.adapters.NoticeAdapter;
|
||||
import com.sucstepsoft.realtimelocation.beans.AppTokenUser;
|
||||
import com.sucstepsoft.realtimelocation.beans.BaseUserBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.CheckSignBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.CheckSignOffBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.LocationPosition;
|
||||
import com.sucstepsoft.realtimelocation.beans.MainNumBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.NewsListBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.PenNewLineBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.SignBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.SignDataBean;
|
||||
@ -112,54 +117,40 @@ import okhttp3.RequestBody;
|
||||
public class MainActivity extends BaseActivity {
|
||||
private static final int GPS_REQUEST_CODE = 1234;
|
||||
public static boolean isForeground = false;
|
||||
@BindView(R.id.rlv_funcs)
|
||||
RecyclerView mRlvBtns;
|
||||
@BindView(R.id.iv_user_icon)
|
||||
ImageView mIvUserIcon;
|
||||
@BindView(R.id.tv_user_name)
|
||||
TextView mTvUserName;
|
||||
@BindView(R.id.btn_sign)
|
||||
Button mBtnSign;
|
||||
@BindView(R.id.rl_main_bg)
|
||||
RelativeLayout mRlMainBg;
|
||||
// @BindView(R.id.rl_title_count)
|
||||
// RelativeLayout mRlTitleCount;
|
||||
@BindView(R.id.tv_current_time)
|
||||
TextView mTvCurrentTime;
|
||||
@BindView(R.id.tv_state)
|
||||
TextView mTvState;
|
||||
@BindView(R.id.iv_state)
|
||||
ImageView mIvState;
|
||||
@BindView(R.id.tv_depart)
|
||||
TextView mTvDepart;
|
||||
@BindView(R.id.tv_online)
|
||||
TextView mTvOnline;
|
||||
@BindView(R.id.ll_user_center)
|
||||
LinearLayout mLlUserCenter;
|
||||
@BindView(R.id.btn_sign)
|
||||
Button mBtnSign;
|
||||
@BindView(R.id.tv_aviso_num)
|
||||
TextView mTvAvisoNum;
|
||||
@BindView(R.id.ll_day_aviso)
|
||||
LinearLayout mLlDayAviso;
|
||||
// @BindView(R.id.tv_issue_dis_num)
|
||||
// TextView mTvIssueDisNum;
|
||||
// @BindView(R.id.iv_issue_dis_num)
|
||||
// ImageView mIvIssueDisNum;
|
||||
// @BindView(R.id.ll_issue_dis)
|
||||
// LinearLayout mLlIssueDis;
|
||||
// @BindView(R.id.tv_plan_num)
|
||||
// TextView mTvMineIssueNum;
|
||||
@BindView(R.id.ll_plan)
|
||||
LinearLayout mLlMineIssue;
|
||||
@BindView(R.id.tv_depart)
|
||||
TextView mTvDepart;
|
||||
@BindView(R.id.tv_rule)
|
||||
TextView mTvRule;
|
||||
@BindView(R.id.tv_online)
|
||||
TextView mTvOnline;
|
||||
@BindView(R.id.tv_history_num)
|
||||
TextView mTvHistoryNum;//待办案件
|
||||
TextView mTvHistoryNum;
|
||||
@BindView(R.id.ll_history)
|
||||
LinearLayout mLlHistory;
|
||||
@BindView(R.id.tv_plan_num)
|
||||
TextView mTvPlanNum;//我的案件
|
||||
// @BindView(R.id.ll_inspect)
|
||||
// LinearLayout mLlInspect;
|
||||
// @BindView(R.id.tv_inspect_num)
|
||||
// TextView mTvInspectNum;
|
||||
TextView mTvPlanNum;
|
||||
@BindView(R.id.ll_plan)
|
||||
LinearLayout mLlPlan;
|
||||
@BindView(R.id.ll_func_title)
|
||||
LinearLayout mLlFuncTitle;
|
||||
@BindView(R.id.rl_main_bg)
|
||||
RelativeLayout mRlMainBg;
|
||||
@BindView(R.id.rlv_funcs)
|
||||
RecyclerView mRlvFuncs;
|
||||
@BindView(R.id.rlv_notice)
|
||||
RecyclerView mRlvNotice;
|
||||
@BindView(R.id.csv_notice)
|
||||
CustomStateView mCsvNotice;
|
||||
|
||||
|
||||
private String[] permissions = new String[]{
|
||||
@ -180,15 +171,13 @@ public class MainActivity extends BaseActivity {
|
||||
public static final String KEY_EXTRAS = "extras";
|
||||
private List<FuncBean> mFuncs = new ArrayList<>();
|
||||
//TODO "特殊案件\n上报", "特殊案件\n处理", "特殊案件\n记录",
|
||||
private String[] mBtnStrs = new String[]{"案件上报", "案件记录", "案件处理", "工作路径", "通讯录", "通知公告", "人口房屋", "工作日志"};
|
||||
private int[] mBtnIds = new int[]{R.drawable.ic_issue_report,
|
||||
R.drawable.ic_issue_record,
|
||||
private String[] mBtnStrs = new String[]{"案件上报", "案件处理", "工作路径", "人口房屋", "工作日志"};
|
||||
private int[] mBtnIds = new int[]{
|
||||
R.drawable.ic_issue_report,
|
||||
R.drawable.ic_issue_disp,
|
||||
R.drawable.ic_work_path,
|
||||
R.drawable.ic_address_list,
|
||||
R.drawable.ic_notice,
|
||||
R.drawable.ic_address_list,
|
||||
R.drawable.ic_issue_record};
|
||||
R.drawable.ic_hose_person,
|
||||
R.drawable.ic_work_log};
|
||||
private Gson mGson = null;
|
||||
private boolean isSgin = false;//是否签到
|
||||
private boolean isSignOff = false;//是否签退
|
||||
@ -206,9 +195,12 @@ public class MainActivity extends BaseActivity {
|
||||
private long mCurrentLongTime;
|
||||
private LocationClient mLocationClient;
|
||||
|
||||
private List<NewsListBean.RowsBean> mDatas;
|
||||
private NoticeAdapter mAdapter;
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
return R.layout.activity_main;
|
||||
return R.layout.activity_main_new;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -217,8 +209,6 @@ public class MainActivity extends BaseActivity {
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
mRlTitleBar.setVisibility(View.GONE);
|
||||
initMainFuncs();
|
||||
//TODO 一像素保活
|
||||
// initScreenListener();
|
||||
mCurrentLongTime = 0;
|
||||
PermissionUtils.permission(permissions).callback(new PermissionUtils.SimpleCallback() {
|
||||
@Override
|
||||
@ -226,7 +216,6 @@ public class MainActivity extends BaseActivity {
|
||||
registerMessageReceiver();
|
||||
createCacheFile();
|
||||
startListenLocation();
|
||||
startSignLocation();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -235,14 +224,10 @@ public class MainActivity extends BaseActivity {
|
||||
}
|
||||
}).request();
|
||||
initBaseView();
|
||||
//TODO
|
||||
getPunchTime(123);
|
||||
setSignText();
|
||||
getUserPenList();
|
||||
interval();
|
||||
// getUserPenList();
|
||||
registerGpsSignal();
|
||||
// checkLocalText();
|
||||
registerGpsState();
|
||||
getNoticeList();
|
||||
String page = getIntent().getStringExtra("page");
|
||||
if (!TextUtils.isEmpty(page) && "uncheck".equals(page)) {
|
||||
startActivity(new Intent(MainActivity.this, IssueCheckActivity.class));
|
||||
@ -410,8 +395,8 @@ public class MainActivity extends BaseActivity {
|
||||
mFuncs.add(bean);
|
||||
}
|
||||
FunctionNumAdapter adapter = new FunctionNumAdapter(mActivity, mFuncs);
|
||||
mRlvBtns.setLayoutManager(new GridLayoutManager(mActivity, 2));
|
||||
mRlvBtns.setAdapter(adapter);
|
||||
mRlvFuncs.setLayoutManager(new GridLayoutManager(mActivity, 4));
|
||||
mRlvFuncs.setAdapter(adapter);
|
||||
adapter.addOnItemClickListener(this::chosePage);
|
||||
}
|
||||
|
||||
@ -463,7 +448,6 @@ public class MainActivity extends BaseActivity {
|
||||
case "工作日志":
|
||||
startActivity(new Intent(mActivity, WorkLogActivity.class));
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -486,7 +470,10 @@ public class MainActivity extends BaseActivity {
|
||||
@Override
|
||||
public void choseAlbum() {
|
||||
//户籍人口
|
||||
startActivity(new Intent(mActivity, CensusExpandableMainActivity.class));
|
||||
// startActivity(new Intent(mActivity, CensusExpandableMainActivity.class));
|
||||
Intent intent = new Intent(mActivity, CensusRegisterAddActivity.class);
|
||||
intent.putExtra("title", "基础人口信息录入");
|
||||
startActivity(intent);
|
||||
build.dismiss();
|
||||
}
|
||||
|
||||
@ -561,13 +548,16 @@ public class MainActivity extends BaseActivity {
|
||||
.error(R.drawable.ic_user_default)
|
||||
.placeholder(R.drawable.ic_user_default))
|
||||
.into(mIvUserIcon);
|
||||
mTvCurrentTime.setText("当前地址:定位中...");
|
||||
Glide.with(mActivity)
|
||||
.load(R.drawable.ic_nomal)
|
||||
.into(mIvState);
|
||||
mTvState.setText("正常");
|
||||
mTvState.setTextColor(Color.WHITE);
|
||||
// checkAmSign();
|
||||
mDatas = new ArrayList<>();
|
||||
mAdapter = new NoticeAdapter(mActivity, mDatas);
|
||||
mRlvNotice.setLayoutManager(new LinearLayoutManager(mActivity));
|
||||
mRlvNotice.setAdapter(mAdapter);
|
||||
mCsvNotice.setOnClickListener(v -> {
|
||||
if (mCsvNotice.getState() == CustomStateView.STATE_ERROR) {
|
||||
mCsvNotice.setState(CustomStateView.STATE_LOAD);
|
||||
getNoticeList();
|
||||
}
|
||||
});
|
||||
checkPermission();
|
||||
}
|
||||
|
||||
@ -735,33 +725,10 @@ public class MainActivity extends BaseActivity {
|
||||
|
||||
@Override
|
||||
public void onNext(CheckSignBean checkSignBean) {
|
||||
if (checkSignBean != null && !TextUtils.isEmpty(checkSignBean.getData().getIsSign())) {
|
||||
boolean b = Boolean.parseBoolean(checkSignBean.getData().getIsSign());
|
||||
if (!TextUtils.isEmpty(checkSignBean.getData().getStatus())) {
|
||||
boolean late = Boolean.parseBoolean(checkSignBean.getData().getStatus());
|
||||
if (late) {
|
||||
//迟到了
|
||||
Glide.with(mActivity)
|
||||
.load(R.drawable.ic_late)
|
||||
.into(mIvState);
|
||||
mTvState.setText("迟到");
|
||||
mTvState.setTextColor(Color.RED);
|
||||
} else {
|
||||
//正常
|
||||
Glide.with(mActivity)
|
||||
.load(R.drawable.ic_nomal)
|
||||
.into(mIvState);
|
||||
mTvState.setText("正常");
|
||||
mTvState.setTextColor(Color.WHITE);
|
||||
}
|
||||
} else {
|
||||
//正常
|
||||
Glide.with(mActivity)
|
||||
.load(R.drawable.ic_nomal)
|
||||
.into(mIvState);
|
||||
mTvState.setText("正常");
|
||||
mTvState.setTextColor(Color.WHITE);
|
||||
}
|
||||
if (checkSignBean != null) {
|
||||
boolean b = checkSignBean.getData().isSignIn();
|
||||
boolean late = checkSignBean.getData().isLate();
|
||||
|
||||
if (b) {
|
||||
isSgin = true;
|
||||
mBtnSign.setTextColor(Color.WHITE);
|
||||
@ -789,6 +756,47 @@ public class MainActivity extends BaseActivity {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取通知公告
|
||||
*/
|
||||
private void getNoticeList() {
|
||||
mDatas.clear();
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.getNewsList("notice", "20", "1", UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<NewsListBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(NewsListBean newsListBean) {
|
||||
if (newsListBean != null && newsListBean.getRows() != null && newsListBean.getRows().size() > 0) {
|
||||
mDatas = newsListBean.getRows();
|
||||
mAdapter.setData(mDatas);
|
||||
mCsvNotice.setState(CustomStateView.STATE_SUCCESS);
|
||||
} else {
|
||||
mRlvNotice.setVisibility(View.GONE);
|
||||
mCsvNotice.setState(CustomStateView.STATE_EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
e.printStackTrace();
|
||||
mCsvNotice.setState(CustomStateView.STATE_ERROR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验是否签退
|
||||
*/
|
||||
@ -891,60 +899,32 @@ public class MainActivity extends BaseActivity {
|
||||
* 显示N员签到签退
|
||||
*/
|
||||
private void showN() {
|
||||
String nowHour = TimeUtils.getNowHourHHmmSS();
|
||||
if (mSignTimeBean != null) {
|
||||
if (isSgin) {
|
||||
//已经签到,显示签退
|
||||
if (isSignOff) {
|
||||
ToastUtils.showShort("今日打卡已完成");
|
||||
} else {
|
||||
boolean isTimeLegal = false;
|
||||
if (!TextUtils.isEmpty(mSignTimeBean.getCustomSignOutStr())) {
|
||||
// isTimeLegal = TimeUtils.isInTimeHHmmSS(mSignTimeBean.getGaSignOutStr() + "-" + mSignTimeBean.getGaSignOutEnd(), nowHour);
|
||||
isTimeLegal = TimeUtils.isInTimeHHmmSS(mSignTimeBean.getCustomSignOutStr() + "-" + mSignTimeBean.getCustomSignOutEnd(), nowHour);
|
||||
} else {
|
||||
isTimeLegal = TimeUtils.isInTimeHHmmSS(mSignTimeBean.getNSignOutStr() + "-" + mSignTimeBean.getNSignOutEnd(), nowHour);
|
||||
}
|
||||
if (isTimeLegal) {
|
||||
if (mPenLineList != null && mPenLineList.size() > 0) {
|
||||
if (checkCurrenPointIsBeyond(mCurrentLocation)) {
|
||||
showSignOffDialog();
|
||||
} else {
|
||||
ToastUtils.showShort("当前位置不在所管辖片区内,请前往片区内进行签到或签退操作.");
|
||||
}
|
||||
} else {
|
||||
getPenList();
|
||||
}
|
||||
} else {
|
||||
//获取当前时间判断在哪个时间范围内
|
||||
ToastUtils.showLong("请按照签退规则进行签退.");
|
||||
}
|
||||
}
|
||||
if (isSgin) {
|
||||
//已经签到,显示签退
|
||||
if (isSignOff) {
|
||||
ToastUtils.showShort("今日打卡已完成");
|
||||
} else {
|
||||
//未签到
|
||||
boolean isLegalTime = false;
|
||||
if (!TextUtils.isEmpty(mSignTimeBean.getCustomSignInStr())) {
|
||||
// isLegalTime = TimeUtils.isInTimeHHmmSS(mSignTimeBean.getGaSignInStr() + "-" + mSignTimeBean.getGaSignOutStr(), nowHour);
|
||||
isLegalTime = TimeUtils.isInTimeHHmmSS(mSignTimeBean.getCustomSignInStr() + "-" + mSignTimeBean.getCustomSignOutStr(), nowHour);
|
||||
} else {
|
||||
isLegalTime = TimeUtils.isInTimeHHmmSS(mSignTimeBean.getNSignInStr() + "-" + mSignTimeBean.getNSignOutStr(), nowHour);
|
||||
}
|
||||
if (isLegalTime) {
|
||||
if (mPenLineList != null && mPenLineList.size() > 0) {
|
||||
if (checkCurrenPointIsBeyond(mCurrentLocation)) {
|
||||
showSDialog();
|
||||
} else {
|
||||
ToastUtils.showShort("当前位置不在所管辖片区内,请前往片区内进行签到或签退操作.");
|
||||
}
|
||||
if (mPenLineList != null && mPenLineList.size() > 0) {
|
||||
if (checkCurrenPointIsBeyond(mCurrentLocation)) {
|
||||
showSignOffDialog();
|
||||
} else {
|
||||
getPenList();
|
||||
ToastUtils.showShort("当前位置不在所管辖片区内,请前往片区内进行签到或签退操作.");
|
||||
}
|
||||
} else {
|
||||
ToastUtils.showLong("请按照签到规则进行签到.");
|
||||
getPenList();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
getPunchTime(2);
|
||||
//未签到
|
||||
if (mPenLineList != null && mPenLineList.size() > 0) {
|
||||
if (checkCurrenPointIsBeyond(mCurrentLocation)) {
|
||||
showSDialog();
|
||||
} else {
|
||||
ToastUtils.showShort("当前位置不在所管辖片区内,请前往片区内进行签到或签退操作.");
|
||||
}
|
||||
} else {
|
||||
getPenList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -952,48 +932,32 @@ public class MainActivity extends BaseActivity {
|
||||
* 显示片长签到签退
|
||||
*/
|
||||
private void show() {
|
||||
String nowHour = TimeUtils.getNowHourHHmmSS();
|
||||
if (mSignTimeBean != null) {
|
||||
if (isSgin) {
|
||||
//已经签到,显示签退
|
||||
if (isSignOff) {
|
||||
ToastUtils.showShort("今日打卡已完成");
|
||||
} else {
|
||||
boolean isTimeLegal = TimeUtils.isInTimeHHmmSS(mSignTimeBean.getSignOutStr() + "-" + mSignTimeBean.getSignOutEnd(), nowHour);
|
||||
if (isTimeLegal) {
|
||||
if (mPenLineList != null && mPenLineList.size() > 0) {
|
||||
if (checkCurrenPointIsBeyond(mCurrentLocation)) {
|
||||
showSignOffDialog();
|
||||
} else {
|
||||
ToastUtils.showShort("当前位置不在所管辖片区内,请前往片区内进行签到或签退操作.");
|
||||
}
|
||||
} else {
|
||||
getPenList();
|
||||
}
|
||||
} else {
|
||||
//获取当前时间判断在哪个时间范围内
|
||||
ToastUtils.showLong("请按照签退规则进行签退.");
|
||||
}
|
||||
}
|
||||
if (isSgin) {
|
||||
//已经签到,显示签退
|
||||
if (isSignOff) {
|
||||
ToastUtils.showShort("今日打卡已完成");
|
||||
} else {
|
||||
//未签到
|
||||
boolean isLegalTime = TimeUtils.isInTimeHHmmSS(mSignTimeBean.getSignInStr() + "-" + mSignTimeBean.getSignOutStr(), nowHour);
|
||||
if (isLegalTime) {
|
||||
if (mPenLineList != null && mPenLineList.size() > 0) {
|
||||
if (checkCurrenPointIsBeyond(mCurrentLocation)) {
|
||||
showSDialog();
|
||||
} else {
|
||||
ToastUtils.showShort("当前位置不在所管辖片区内,请前往片区内进行签到或签退操作.");
|
||||
}
|
||||
if (mPenLineList != null && mPenLineList.size() > 0) {
|
||||
if (checkCurrenPointIsBeyond(mCurrentLocation)) {
|
||||
showSignOffDialog();
|
||||
} else {
|
||||
getPenList();
|
||||
ToastUtils.showShort("当前位置不在所管辖片区内,请前往片区内进行签到或签退操作.");
|
||||
}
|
||||
} else {
|
||||
ToastUtils.showLong("请按照签到规则进行签到.");
|
||||
getPenList();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
getPunchTime(2);
|
||||
//未签到
|
||||
if (mPenLineList != null && mPenLineList.size() > 0) {
|
||||
if (checkCurrenPointIsBeyond(mCurrentLocation)) {
|
||||
showSDialog();
|
||||
} else {
|
||||
ToastUtils.showShort("当前位置不在所管辖片区内,请前往片区内进行签到或签退操作.");
|
||||
}
|
||||
} else {
|
||||
getPenList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1222,23 +1186,9 @@ public class MainActivity extends BaseActivity {
|
||||
|
||||
@Override
|
||||
public void onNext(SignDataBean successBean) {
|
||||
// LogUtils.e(successBean);
|
||||
// uploadPoint();
|
||||
isSgin = true;
|
||||
isSignOff = false;
|
||||
if (successBean.isData()) {
|
||||
Glide.with(mActivity)
|
||||
.load(R.drawable.ic_late)
|
||||
.into(mIvState);
|
||||
mTvState.setText("迟到");
|
||||
mTvState.setTextColor(Color.RED);
|
||||
} else {
|
||||
Glide.with(mActivity)
|
||||
.load(R.drawable.ic_nomal)
|
||||
.into(mIvState);
|
||||
mTvState.setText("正常");
|
||||
mTvState.setTextColor(Color.WHITE);
|
||||
}
|
||||
|
||||
dialog.dismiss();
|
||||
GlobalProvider.save(mActivity, "isUpload", "13");
|
||||
setSignOffText();
|
||||
@ -1304,40 +1254,7 @@ public class MainActivity extends BaseActivity {
|
||||
* 设置签到完成文字
|
||||
*/
|
||||
private void setSignCompleteText() {
|
||||
mBtnSign.setText("打卡\n完成");
|
||||
Glide.with(mActivity)
|
||||
.load(R.drawable.ic_nomal)
|
||||
.into(mIvState);
|
||||
mTvState.setText("正常");
|
||||
mTvState.setTextColor(Color.WHITE);
|
||||
// if (userType == 2) {
|
||||
// mBtnSign.setText("打卡\n完成");
|
||||
// Glide.with(mActivity)
|
||||
// .load(R.drawable.ic_nomal)
|
||||
// .into(mIvState);
|
||||
// mTvState.setText("正常");
|
||||
// mTvState.setTextColor(Color.WHITE);
|
||||
// boolean amOrPm = TimeUtils.isAmOrPm();
|
||||
// if (amOrPm) {
|
||||
// //未签到
|
||||
// mBtnSign.setText("下午\n签到");
|
||||
// } else {
|
||||
// //下午
|
||||
// mBtnSign.setText("打卡\n完成");
|
||||
// Glide.with(mActivity)
|
||||
// .load(R.drawable.ic_nomal)
|
||||
// .into(mIvState);
|
||||
// mTvState.setText("正常");
|
||||
// mTvState.setTextColor(Color.WHITE);
|
||||
// }
|
||||
// } else {
|
||||
// mBtnSign.setText("打卡\n完成");
|
||||
// Glide.with(mActivity)
|
||||
// .load(R.drawable.ic_nomal)
|
||||
// .into(mIvState);
|
||||
// mTvState.setText("正常");
|
||||
// mTvState.setTextColor(Color.WHITE);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1378,19 +1295,14 @@ public class MainActivity extends BaseActivity {
|
||||
* <p>
|
||||
* R.id.ll_mine_issue,
|
||||
*/
|
||||
@OnClick({/**R.id.rl_issue_report,
|
||||
R.id.rl_issue_record,
|
||||
R.id.rl_issue_dispose,
|
||||
R.id.rl_address_list,
|
||||
R.id.rl_notice,
|
||||
R.id.rl_work_iocus,*/
|
||||
// R.id.ll_issue_dis,
|
||||
@OnClick({
|
||||
R.id.ll_history,
|
||||
R.id.btn_sign,
|
||||
R.id.ll_plan,
|
||||
R.id.tv_rule,
|
||||
R.id.ll_user_center,
|
||||
R.id.ll_day_aviso})
|
||||
R.id.ll_day_aviso,
|
||||
R.id.ll_address_list,
|
||||
R.id.ll_case_record})
|
||||
public void onViewClicked(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.ll_history://待办案件
|
||||
@ -1400,7 +1312,8 @@ public class MainActivity extends BaseActivity {
|
||||
startActivity(new Intent(mActivity, IssueMineActivity.class));
|
||||
break;
|
||||
case R.id.btn_sign://签到
|
||||
showSignDialog();
|
||||
// showSignDialog();
|
||||
startActivity(new Intent(mActivity, WorkSignActivity.class));
|
||||
break;
|
||||
case R.id.ll_day_aviso://每日通报
|
||||
Intent intent = new Intent(MainActivity.this, NoticeActivity.class);
|
||||
@ -1410,12 +1323,13 @@ public class MainActivity extends BaseActivity {
|
||||
case R.id.ll_user_center://个人中心
|
||||
startActivity(new Intent(MainActivity.this, UserActivity.class));
|
||||
break;
|
||||
case R.id.tv_rule://签到规则
|
||||
if (2 == userType) {
|
||||
showRuleDialog();
|
||||
} else {
|
||||
showNRuleDialog();
|
||||
}
|
||||
case R.id.ll_address_list://通讯录
|
||||
Intent intent2 = new Intent(mActivity, AddressListMainActivity.class);
|
||||
intent2.putExtra("uType", userType);
|
||||
startActivity(intent2);
|
||||
break;
|
||||
case R.id.ll_case_record://案件记录
|
||||
startActivity(new Intent(mActivity, IssueRecordActivity.class));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1732,76 +1646,76 @@ public class MainActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
private void checkPointIsLegal(BDLocation bdLocation) {
|
||||
LogUtils.e("城市码==" + bdLocation.getCityCode() + "===" + bdLocation.getLatitude() + "===" + bdLocation.getLongitude());
|
||||
if (PathConfig.IS_LIMIT) {
|
||||
if (PathConfig.mDefaultCityCode.equals(bdLocation.getCityCode())) {
|
||||
if (bdLocation.getLatitude() != 0 && bdLocation.getLongitude() != 0) {
|
||||
if (mPrecision >= mPrecMax) {
|
||||
mPrecision = mPrecisionDefault;
|
||||
if (mGpsWeakDialog == null) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
|
||||
builder.setMessage("当前GPS信号较弱,请调整当前所在位置,或检查手机GPS是否开启,将Wifi与蓝牙打开会提高定位精度.")
|
||||
.setTitle("提示")
|
||||
.setNegativeButton("确定", (dialog, which) -> dialog.dismiss());
|
||||
mGpsWeakDialog = builder.create();
|
||||
}
|
||||
if (!mGpsWeakDialog.isShowing()) {
|
||||
mGpsWeakDialog.show();
|
||||
}
|
||||
} else {
|
||||
if (bdLocation.getRadius() <= mPrecision) {
|
||||
mPrecision = mPrecisionDefault;
|
||||
if (bdLocation.getLatitude() != Double.MIN_VALUE && bdLocation.getLongitude() != Double.MIN_VALUE) {
|
||||
mCurrentLocation = bdLocation;
|
||||
if (mGpsDis != null && !mGpsDis.isDisposed()) {
|
||||
mGpsDis.dispose();
|
||||
}
|
||||
if (TextUtils.isEmpty(mCurrentLocation.getAddrStr())) {
|
||||
mTvCurrentTime.setText("当前地址:未知");
|
||||
} else {
|
||||
mTvCurrentTime.setText("当前地址:" + mCurrentLocation.getAddrStr());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mPrecision += 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (bdLocation.getLatitude() != 0 && bdLocation.getLongitude() != 0) {
|
||||
if (mPrecision >= mPrecMax) {
|
||||
mPrecision = mPrecisionDefault;
|
||||
if (mGpsWeakDialog == null) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
|
||||
builder.setMessage("当前GPS信号较弱,请调整当前所在位置,或检查手机GPS是否开启,将Wifi与蓝牙打开会提高定位精度.")
|
||||
.setTitle("提示")
|
||||
.setNegativeButton("确定", (dialog, which) -> dialog.dismiss());
|
||||
mGpsWeakDialog = builder.create();
|
||||
}
|
||||
if (!mGpsWeakDialog.isShowing()) {
|
||||
mGpsWeakDialog.show();
|
||||
}
|
||||
} else {
|
||||
if (bdLocation.getRadius() <= mPrecision) {
|
||||
mPrecision = mPrecisionDefault;
|
||||
if (bdLocation.getLatitude() != Double.MIN_VALUE && bdLocation.getLongitude() != Double.MIN_VALUE) {
|
||||
mCurrentLocation = bdLocation;
|
||||
if (mGpsDis != null && !mGpsDis.isDisposed()) {
|
||||
mGpsDis.dispose();
|
||||
}
|
||||
if (TextUtils.isEmpty(mCurrentLocation.getAddrStr())) {
|
||||
mTvCurrentTime.setText("当前地址:未知");
|
||||
} else {
|
||||
mTvCurrentTime.setText("当前地址:" + mCurrentLocation.getAddrStr());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mPrecision += 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// LogUtils.e("城市码==" + bdLocation.getCityCode() + "===" + bdLocation.getLatitude() + "===" + bdLocation.getLongitude());
|
||||
// if (PathConfig.IS_LIMIT) {
|
||||
// if (PathConfig.mDefaultCityCode.equals(bdLocation.getCityCode())) {
|
||||
// if (bdLocation.getLatitude() != 0 && bdLocation.getLongitude() != 0) {
|
||||
// if (mPrecision >= mPrecMax) {
|
||||
// mPrecision = mPrecisionDefault;
|
||||
// if (mGpsWeakDialog == null) {
|
||||
// AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
|
||||
// builder.setMessage("当前GPS信号较弱,请调整当前所在位置,或检查手机GPS是否开启,将Wifi与蓝牙打开会提高定位精度.")
|
||||
// .setTitle("提示")
|
||||
// .setNegativeButton("确定", (dialog, which) -> dialog.dismiss());
|
||||
// mGpsWeakDialog = builder.create();
|
||||
// }
|
||||
// if (!mGpsWeakDialog.isShowing()) {
|
||||
// mGpsWeakDialog.show();
|
||||
// }
|
||||
// } else {
|
||||
// if (bdLocation.getRadius() <= mPrecision) {
|
||||
// mPrecision = mPrecisionDefault;
|
||||
// if (bdLocation.getLatitude() != Double.MIN_VALUE && bdLocation.getLongitude() != Double.MIN_VALUE) {
|
||||
// mCurrentLocation = bdLocation;
|
||||
// if (mGpsDis != null && !mGpsDis.isDisposed()) {
|
||||
// mGpsDis.dispose();
|
||||
// }
|
||||
// if (TextUtils.isEmpty(mCurrentLocation.getAddrStr())) {
|
||||
// mTvCurrentTime.setText("当前地址:未知");
|
||||
// } else {
|
||||
// mTvCurrentTime.setText("当前地址:" + mCurrentLocation.getAddrStr());
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// mPrecision += 10;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// if (bdLocation.getLatitude() != 0 && bdLocation.getLongitude() != 0) {
|
||||
// if (mPrecision >= mPrecMax) {
|
||||
// mPrecision = mPrecisionDefault;
|
||||
// if (mGpsWeakDialog == null) {
|
||||
// AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
|
||||
// builder.setMessage("当前GPS信号较弱,请调整当前所在位置,或检查手机GPS是否开启,将Wifi与蓝牙打开会提高定位精度.")
|
||||
// .setTitle("提示")
|
||||
// .setNegativeButton("确定", (dialog, which) -> dialog.dismiss());
|
||||
// mGpsWeakDialog = builder.create();
|
||||
// }
|
||||
// if (!mGpsWeakDialog.isShowing()) {
|
||||
// mGpsWeakDialog.show();
|
||||
// }
|
||||
// } else {
|
||||
// if (bdLocation.getRadius() <= mPrecision) {
|
||||
// mPrecision = mPrecisionDefault;
|
||||
// if (bdLocation.getLatitude() != Double.MIN_VALUE && bdLocation.getLongitude() != Double.MIN_VALUE) {
|
||||
// mCurrentLocation = bdLocation;
|
||||
// if (mGpsDis != null && !mGpsDis.isDisposed()) {
|
||||
// mGpsDis.dispose();
|
||||
// }
|
||||
// if (TextUtils.isEmpty(mCurrentLocation.getAddrStr())) {
|
||||
// mTvCurrentTime.setText("当前地址:未知");
|
||||
// } else {
|
||||
// mTvCurrentTime.setText("当前地址:" + mCurrentLocation.getAddrStr());
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// mPrecision += 10;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -875,7 +875,7 @@ public class CensusEnterActivity extends BaseActivity {
|
||||
}
|
||||
mReligionPicker.show();
|
||||
} else {
|
||||
getDicListByType(PathConfig.DIC_FAITH, 6);
|
||||
getDicListByType(PathConfig.DIC_RELIGION, 6);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@ import com.sucstepsoft.cm_utils.constant.PathConfig;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.core.widget.views.CenterChooseAreaDialogView;
|
||||
import com.sucstepsoft.cm_utils.utils.IDCard;
|
||||
import com.sucstepsoft.cm_utils.utils.ToastUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.UIUtil;
|
||||
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
|
||||
@ -242,7 +241,7 @@ public class CensusOutBoundAddActivity extends BaseActivity {
|
||||
}
|
||||
mFaithPicker.show();
|
||||
} else {
|
||||
getDicListByType(PathConfig.DIC_FAITH, 4);
|
||||
getDicListByType(PathConfig.DIC_RELIGION, 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,15 +1,119 @@
|
||||
package com.sucstepsoft.realtimelocation.activitys.common;
|
||||
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.ZoomControls;
|
||||
|
||||
import com.baidu.location.BDAbstractLocationListener;
|
||||
import com.baidu.location.BDLocation;
|
||||
import com.baidu.location.LocationClient;
|
||||
import com.baidu.location.LocationClientOption;
|
||||
import com.baidu.mapapi.map.BaiduMap;
|
||||
import com.baidu.mapapi.map.MapStatus;
|
||||
import com.baidu.mapapi.map.MapStatusUpdate;
|
||||
import com.baidu.mapapi.map.MapStatusUpdateFactory;
|
||||
import com.baidu.mapapi.map.MyLocationData;
|
||||
import com.baidu.mapapi.map.OverlayOptions;
|
||||
import com.baidu.mapapi.map.PolygonOptions;
|
||||
import com.baidu.mapapi.map.Stroke;
|
||||
import com.baidu.mapapi.map.TextureMapView;
|
||||
import com.baidu.mapapi.model.LatLng;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.resource.bitmap.CircleCrop;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.google.gson.Gson;
|
||||
import com.sucstepsoft.cm_utils.constant.PathConfig;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.BaseUrlApi;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.utils.ConvertUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.TimeUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.ToastUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.UIUtil;
|
||||
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
|
||||
import com.sucstepsoft.realtimelocation.R;
|
||||
import com.sucstepsoft.realtimelocation.beans.AppTokenUser;
|
||||
import com.sucstepsoft.realtimelocation.beans.CheckSignBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.CheckSignOffBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.PenNewLineBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.SignBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.SignDataBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.SignOffBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.SignTimeBean;
|
||||
import com.sucstepsoft.realtimelocation.beans.SuccessBean;
|
||||
import com.sucstepsoft.realtimelocation.net.LocationApiService;
|
||||
import com.sucstepsoft.realtimelocation.services.GlobalProvider;
|
||||
import com.sucstepsoft.realtimelocation.utils.ExceptionHandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
/**
|
||||
* 签到
|
||||
*/
|
||||
public class WorkSignActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.iv_user_icon)
|
||||
ImageView mIvUserIcon;
|
||||
@BindView(R.id.tv_user_name)
|
||||
TextView mTvUserName;
|
||||
@BindView(R.id.tv_user_department)
|
||||
TextView mTvUserDepartment;
|
||||
@BindView(R.id.tv_cur_location)
|
||||
TextView mTvCurLocation;
|
||||
@BindView(R.id.tmv_map)
|
||||
TextureMapView mTmvMap;
|
||||
@BindView(R.id.btn_reset_loc)
|
||||
Button mBtnResetLoc;
|
||||
@BindView(R.id.tv_state)
|
||||
TextView mTvState;
|
||||
@BindView(R.id.ll_sign)
|
||||
LinearLayout mLlSign;
|
||||
@BindView(R.id.tv_in_time)
|
||||
TextView mTvInTime;
|
||||
@BindView(R.id.tv_cur_time)
|
||||
TextView mTvCurTime;
|
||||
@BindView(R.id.tv_out_time)
|
||||
TextView mTvOutTime;
|
||||
@BindView(R.id.iv_state)
|
||||
ImageView mIvState;
|
||||
@BindView(R.id.iv_sign_in_state)
|
||||
ImageView mIvSignInState;
|
||||
@BindView(R.id.iv_sign_out_state)
|
||||
ImageView mIvSignOutState;
|
||||
private List<List<LatLng>> mPenLineList;
|
||||
private BaiduMap mBaiduMap;
|
||||
private BDLocation mCurrent;
|
||||
private LatLng mDefaultLocation = new LatLng(PathConfig.LA, PathConfig.LO);
|
||||
private LocationClient mLocationClient;
|
||||
private ProgressDialog mProgressDialog;
|
||||
private SignTimeBean mSignTimeBean;
|
||||
private Gson mGson;
|
||||
private int userType = 2;//1专管员 2是网格员
|
||||
private Disposable mTimeDisposable;
|
||||
private ProgressDialog mCheckSignDialog;
|
||||
private boolean isSign = false;//是否签到
|
||||
private boolean isSignOff = false;//是否签退
|
||||
private boolean mCanSign = false;//能否签到、签退
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
return R.layout.activity_work_sign;
|
||||
@ -19,5 +123,702 @@ public class WorkSignActivity extends BaseActivity {
|
||||
public void initData() {
|
||||
super.initData();
|
||||
ButterKnife.bind(this);
|
||||
refreshView(STATE_LOAD_LOADING);
|
||||
initMap();
|
||||
getSignRule(123);
|
||||
}
|
||||
|
||||
private void initMap() {
|
||||
mBaiduMap = mTmvMap.getMap();
|
||||
MapStatus ms = new MapStatus.Builder().zoom(16).target(mDefaultLocation).build();
|
||||
MapStatusUpdate u = MapStatusUpdateFactory.newMapStatus(ms);
|
||||
mBaiduMap.animateMapStatus(u);
|
||||
mTvUserName.setText(UserLgUtils.getName());
|
||||
Glide.with(mActivity)
|
||||
.load(BaseUrlApi.BASE_IMG_URL + UserLgUtils.getAvatar())
|
||||
.apply(RequestOptions.bitmapTransform(new CircleCrop())
|
||||
.error(R.drawable.ic_user_default)
|
||||
.placeholder(R.drawable.ic_user_default))
|
||||
.into(mIvUserIcon);
|
||||
|
||||
mBtnResetLoc.setOnClickListener(v -> {
|
||||
if (mCurrent != null && mCurrent.getLatitude() != 0 && mCurrent.getLongitude() != 0) {
|
||||
MapStatus cur = new MapStatus.Builder().zoom(16).target(new LatLng(mCurrent.getLatitude(), mCurrent.getLongitude())).build();
|
||||
MapStatusUpdate curUpdate = MapStatusUpdateFactory.newMapStatus(cur);
|
||||
mBaiduMap.animateMapStatus(curUpdate);
|
||||
}
|
||||
});
|
||||
View child = mTmvMap.getChildAt(1);
|
||||
if (child != null && (child instanceof ImageView || child instanceof ZoomControls)) {
|
||||
child.setVisibility(View.GONE);
|
||||
}
|
||||
mTmvMap.showZoomControls(false);
|
||||
getUserGrid();
|
||||
startLocation();
|
||||
getCurrentTime();
|
||||
checkSign();
|
||||
mLlSign.setOnClickListener(v -> doSign());
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 签到或签退
|
||||
*/
|
||||
private void doSign() {
|
||||
if (mCanSign) {
|
||||
if (isSign) {
|
||||
//已经签到,显示签退
|
||||
if (isSignOff) {
|
||||
ToastUtils.showShort("今日打卡已完成");
|
||||
} else {
|
||||
if (mPenLineList != null && mPenLineList.size() > 0) {
|
||||
if (checkCurrentPointIsBeyond(mCurrent)) {
|
||||
showSignOffDialog();
|
||||
} else {
|
||||
ToastUtils.showShort("当前位置不在所管辖片区内,请前往片区内进行签到或签退操作.");
|
||||
}
|
||||
} else {
|
||||
getUserGrid();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//未签到
|
||||
if (mPenLineList != null && mPenLineList.size() > 0) {
|
||||
if (checkCurrentPointIsBeyond(mCurrent)) {
|
||||
showSDialog();
|
||||
} else {
|
||||
ToastUtils.showShort("当前位置不在所管辖片区内,请前往片区内进行签到或签退操作.");
|
||||
}
|
||||
} else {
|
||||
getUserGrid();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
checkSign();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 显示签到
|
||||
*/
|
||||
private void showSDialog() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setMessage("确认要签到吗?");
|
||||
builder.setTitle("提示")
|
||||
.setMessage("确认要签到吗?")
|
||||
.setPositiveButton("确定", (dialog, which) -> {
|
||||
dialog.dismiss();
|
||||
doSignNet();
|
||||
})
|
||||
.setNegativeButton("取消", (dialog, which) -> dialog.dismiss());
|
||||
builder.create().show();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 显示签退
|
||||
*/
|
||||
private void showSignOffDialog() {
|
||||
if (mSignTimeBean == null) {
|
||||
getSignRule(2);
|
||||
} else {
|
||||
String hintMsg;
|
||||
boolean legal;
|
||||
//判断是那个时间
|
||||
if (!TextUtils.isEmpty(mSignTimeBean.getCustomSignInStr())) {
|
||||
legal = TimeUtils.compareToCurrent(mSignTimeBean.getCustomSignOutStr());
|
||||
} else {
|
||||
if (userType == 1) {
|
||||
//专管员
|
||||
legal = TimeUtils.compareToCurrent(mSignTimeBean.getNSignOutStr());
|
||||
} else {
|
||||
//网格员
|
||||
legal = TimeUtils.compareToCurrent(mSignTimeBean.getSignOutStr());
|
||||
}
|
||||
}
|
||||
|
||||
if (legal) {
|
||||
hintMsg = "确定要签退吗?";
|
||||
} else {
|
||||
hintMsg = "未到签退时间,提前签退属早退,您确定要早退吗?";
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle("提示")
|
||||
.setMessage(hintMsg)
|
||||
.setPositiveButton("确定", (dialog, which) -> {
|
||||
dialog.dismiss();
|
||||
doSignOff();
|
||||
})
|
||||
.setNegativeButton("取消", (dialog, which) -> dialog.dismiss());
|
||||
builder.create().show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 进行签到
|
||||
*/
|
||||
private void doSignNet() {
|
||||
ProgressDialog dialog = UIUtil.initDialog(mActivity, "签到中...");
|
||||
dialog.show();
|
||||
SignBean bean = new SignBean();
|
||||
bean.setSigninLatitude(mCurrent.getLatitude() + "");
|
||||
bean.setSigninLongitude(mCurrent.getLongitude() + "");
|
||||
Gson gson = new Gson();
|
||||
String obj = gson.toJson(bean);
|
||||
RequestBody body = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), obj);
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.doSign(body, UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<SignDataBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(SignDataBean successBean) {
|
||||
if (successBean.isData()) {
|
||||
mIvSignInState.setBackground(getResources().getDrawable(R.drawable.ic_sign_late));
|
||||
} else {
|
||||
mIvSignInState.setBackground(getResources().getDrawable(R.drawable.ic_sign_normal));
|
||||
Glide.with(mActivity)
|
||||
.load(R.drawable.ic_nomal)
|
||||
.into(mIvState);
|
||||
mTvState.setText("正常");
|
||||
mTvState.setTextColor(Color.WHITE);
|
||||
}
|
||||
|
||||
|
||||
isSign = true;
|
||||
isSignOff = false;
|
||||
dialog.dismiss();
|
||||
GlobalProvider.save(mActivity, "isUpload", "13");
|
||||
mTvState.setText("签退");
|
||||
mTvState.setTextColor(Color.WHITE);
|
||||
ToastUtils.showLong("签到成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
e.printStackTrace();
|
||||
dialog.dismiss();
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 签退
|
||||
*/
|
||||
private void doSignOff() {
|
||||
ProgressDialog dialog = UIUtil.initDialog(mActivity, "签退中...");
|
||||
dialog.show();
|
||||
SignOffBean bean = new SignOffBean();
|
||||
bean.setSignoutLatitude(mCurrent.getLatitude() + "");
|
||||
bean.setSignoutLongitude(mCurrent.getLongitude() + "");
|
||||
Gson gson = new Gson();
|
||||
String obj = gson.toJson(bean);
|
||||
RequestBody body = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), obj);
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.doSignOff(body, UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<SuccessBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(SuccessBean successBean) {
|
||||
dialog.dismiss();
|
||||
isSignOff = true;
|
||||
mTvState.setText("今日完成");
|
||||
mIvSignOutState.setBackground(getResources().getDrawable(R.drawable.ic_sign_normal));
|
||||
mTvState.setTextColor(Color.WHITE);
|
||||
ToastUtils.showLong("签退成功");
|
||||
GlobalProvider.save(mActivity, "isUpload", "12");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
dialog.dismiss();
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否越界
|
||||
*
|
||||
* @param bdLocation
|
||||
*/
|
||||
private boolean checkCurrentPointIsBeyond(BDLocation bdLocation) {
|
||||
// if (mPenLineList != null && mPenLineList.size() > 0) {
|
||||
// for (int i = 0; i < mPenLineList.size(); i++) {
|
||||
// LatLng latLng = new LatLng(bdLocation.getLatitude(), bdLocation.getLongitude());
|
||||
// boolean inPolygon = PointUtils.isInPolygon(latLng, mPenLineList.get(i));
|
||||
// if (inPolygon) {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// } else {
|
||||
// return false;
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
|
||||
private void checkSign() {
|
||||
mCheckSignDialog = UIUtil.initDialog(mActivity, "获取中...");
|
||||
mCheckSignDialog.show();
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.checkSign(UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<CheckSignBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(CheckSignBean checkSignBean) {
|
||||
if (checkSignBean != null) {
|
||||
mTvState.setBackground(null);
|
||||
if (checkSignBean.getData().isSignIn()) {
|
||||
if (checkSignBean.getData().isLate()) {
|
||||
mIvSignInState.setBackground(getResources().getDrawable(R.drawable.ic_sign_late));
|
||||
} else {
|
||||
mIvSignInState.setBackground(getResources().getDrawable(R.drawable.ic_sign_normal));
|
||||
}
|
||||
isSign = true;
|
||||
mTvState.setTextColor(Color.WHITE);
|
||||
mTvState.setText("签退");
|
||||
checkSignOff();
|
||||
GlobalProvider.save(mActivity, "isUpload", "13");
|
||||
} else {
|
||||
if (mCheckSignDialog != null && mCheckSignDialog.isShowing()) {
|
||||
mCheckSignDialog.dismiss();
|
||||
}
|
||||
mIvSignInState.setBackground(null);
|
||||
mCanSign = true;
|
||||
isSign = false;
|
||||
mTvState.setTextColor(Color.WHITE);
|
||||
mTvState.setText("签到");
|
||||
GlobalProvider.save(mActivity, "isUpload", "12");
|
||||
}
|
||||
} else {
|
||||
if (mCheckSignDialog != null && mCheckSignDialog.isShowing()) {
|
||||
mCheckSignDialog.dismiss();
|
||||
}
|
||||
ToastUtils.showShort("签到状态获取失败,点击重试");
|
||||
mTvState.setBackground(getResources().getDrawable(R.drawable.ic_reload_refresh));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
if (mCheckSignDialog != null && mCheckSignDialog.isShowing()) {
|
||||
mCheckSignDialog.dismiss();
|
||||
}
|
||||
ToastUtils.showShort("签到状态获取失败,点击重试");
|
||||
mTvState.setBackground(getResources().getDrawable(R.drawable.ic_reload_refresh));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取是否签退
|
||||
*/
|
||||
private void checkSignOff() {
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.checkSignOff(UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<CheckSignOffBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(CheckSignOffBean checkSignBean) {
|
||||
if (checkSignBean != null && !TextUtils.isEmpty(checkSignBean.getData())) {
|
||||
boolean b = Boolean.parseBoolean(checkSignBean.getData());
|
||||
mTvState.setBackground(null);
|
||||
if (mCheckSignDialog != null && mCheckSignDialog.isShowing()) {
|
||||
mCheckSignDialog.dismiss();
|
||||
}
|
||||
if (b) {
|
||||
//已经签退
|
||||
mCanSign = false;
|
||||
isSignOff = true;
|
||||
mTvState.setTextColor(Color.WHITE);
|
||||
mTvState.setText("今日完成");
|
||||
mIvSignOutState.setBackground(getResources().getDrawable(R.drawable.ic_sign_normal));
|
||||
GlobalProvider.save(mActivity, "isUpload", "12");
|
||||
} else {
|
||||
mCanSign = true;
|
||||
//没有签退
|
||||
isSignOff = false;
|
||||
mTvState.setTextColor(Color.WHITE);
|
||||
mTvState.setText("签退");
|
||||
mIvSignOutState.setBackground(null);
|
||||
GlobalProvider.save(mActivity, "isUpload", "13");
|
||||
}
|
||||
} else {
|
||||
//加载失败了
|
||||
if (mCheckSignDialog != null && mCheckSignDialog.isShowing()) {
|
||||
mCheckSignDialog.dismiss();
|
||||
}
|
||||
mCanSign = false;
|
||||
mIvSignOutState.setBackground(null);
|
||||
ToastUtils.showShort("签到状态获取失败,点击重试");
|
||||
mTvState.setBackground(getResources().getDrawable(R.drawable.ic_reload_refresh));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
if (mCheckSignDialog != null && mCheckSignDialog.isShowing()) {
|
||||
mCheckSignDialog.dismiss();
|
||||
}
|
||||
mIvSignOutState.setBackground(null);
|
||||
mCanSign = false;
|
||||
ToastUtils.showShort("签到状态获取失败,点击重试");
|
||||
mTvState.setBackground(getResources().getDrawable(R.drawable.ic_reload_refresh));
|
||||
GlobalProvider.save(mActivity, "isUpload", "13");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示当前日期和时间
|
||||
*/
|
||||
private void getCurrentTime() {
|
||||
Observable.interval(1, TimeUnit.SECONDS)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<Long>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mTimeDisposable = d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(Long aLong) {
|
||||
String curTime = TimeUtils.getCurDate() + "\n" + TimeUtils.getCurTime();
|
||||
mTvCurTime.setText(curTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取签到规则
|
||||
*/
|
||||
private void getSignRule(int i) {
|
||||
if (i == 2) {
|
||||
mProgressDialog = UIUtil.initDialog(WorkSignActivity.this, "获取中...");
|
||||
mProgressDialog.show();
|
||||
}
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.getpunchTime(UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<SignTimeBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(SignTimeBean signTimeBean) {
|
||||
if (mProgressDialog != null && mProgressDialog.isShowing() && i == 2) {
|
||||
mProgressDialog.dismiss();
|
||||
if (signTimeBean == null) {
|
||||
ToastUtils.showShort("获取签到规则失败");
|
||||
} else {
|
||||
mSignTimeBean = signTimeBean;
|
||||
ToastUtils.showShort("获取签到规则成功,请重新签到或签退");
|
||||
}
|
||||
}
|
||||
if (signTimeBean != null) {
|
||||
mSignTimeBean = signTimeBean;
|
||||
//保存签到时间
|
||||
mGson = new Gson();
|
||||
String loginInfo = UserLgUtils.getLoginInfo();
|
||||
if (!TextUtils.isEmpty(loginInfo)) {
|
||||
AppTokenUser appTokenUser = mGson.fromJson(loginInfo, AppTokenUser.class);
|
||||
if (appTokenUser.getRoles() != null && appTokenUser.getRoles().size() > 0) {
|
||||
for (int i = 0; i < appTokenUser.getRoles().size(); i++) {
|
||||
if (!TextUtils.isEmpty(appTokenUser.getRoles().get(i).getRoleName())) {
|
||||
mTvUserDepartment.setText(appTokenUser.getRoles().get(i).getRoleName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (appTokenUser.getRoles() != null && appTokenUser.getRoles().size() > 0) {
|
||||
for (int i = 0; i < appTokenUser.getRoles().size(); i++) {
|
||||
if (PathConfig.USER_TYPE_N.equals(appTokenUser.getRoles().get(i).getRoleId())) {
|
||||
GlobalProvider.save(mActivity, "userType", "N");
|
||||
mTvUserDepartment.setText(appTokenUser.getRoles().get(i).getRoleName());
|
||||
userType = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
GlobalProvider.save(mActivity, "userType", "P");
|
||||
userType = 2;
|
||||
}
|
||||
} else {
|
||||
GlobalProvider.save(mActivity, "userType", "P");
|
||||
userType = 2;
|
||||
}
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(PathConfig.ACTION_PUNCH_TIME_MESSAGE);
|
||||
intent.putExtra("timeBean", mSignTimeBean);
|
||||
sendBroadcast(intent);
|
||||
setSignRuleTimeText();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
e.printStackTrace();
|
||||
if (mProgressDialog != null && mProgressDialog.isShowing() && i == 2) {
|
||||
mProgressDialog.dismiss();
|
||||
}
|
||||
ToastUtils.showShort("获取签到规则失败,请稍后重试");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断显示签到时间
|
||||
*/
|
||||
private void setSignRuleTimeText() {
|
||||
if (mSignTimeBean == null) return;
|
||||
if (!TextUtils.isEmpty(mSignTimeBean.getCustomSignInStr())) {
|
||||
mTvInTime.setText(mSignTimeBean.getCustomSignInStr() + " - " + mSignTimeBean.getCustomSignInEnd());
|
||||
mTvOutTime.setText(mSignTimeBean.getCustomSignOutStr() + " - " + mSignTimeBean.getCustomSignOutEnd());
|
||||
} else {
|
||||
if (userType == 1) {
|
||||
//专管员
|
||||
mTvInTime.setText(mSignTimeBean.getNSignInStr() + " - " + mSignTimeBean.getNSignInEnd());
|
||||
mTvOutTime.setText(mSignTimeBean.getNSignOutStr() + "-" + mSignTimeBean.getNSignOutEnd());
|
||||
} else {
|
||||
//网格员
|
||||
mTvInTime.setText(mSignTimeBean.getSignInStr() + " - " + mSignTimeBean.getSignInEnd());
|
||||
mTvOutTime.setText(mSignTimeBean.getSignOutStr() + "-" + mSignTimeBean.getSignOutEnd());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取电子网格
|
||||
*/
|
||||
private void getUserGrid() {
|
||||
RetrofitManager.getInstance()
|
||||
.create(LocationApiService.class)
|
||||
.getUserNewPenList(UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<List<PenNewLineBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<PenNewLineBean> penLineBeans) {
|
||||
if (penLineBeans != null && penLineBeans.size() > 0) {
|
||||
buildPenList(penLineBeans);
|
||||
} else {
|
||||
ToastUtils.showShort("您未画所属网格,请联系管理员");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
ToastUtils.showShort("获取电子网格识别,请稍后重试");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void buildPenList(List<PenNewLineBean> penLineBeans) {
|
||||
mPenLineList = new ArrayList<>();
|
||||
for (int i = 0; i < penLineBeans.size(); i++) {
|
||||
List<PenNewLineBean.PointArrayBean> areaPoints = penLineBeans.get(i).getPointArray();
|
||||
if (areaPoints != null && areaPoints.size() > 0) {
|
||||
List<LatLng> tempList = new ArrayList<>();
|
||||
for (int j = 0; j < areaPoints.size(); j++) {
|
||||
LatLng latLng = new LatLng(Double.parseDouble(areaPoints.get(j).getLat()), Double.parseDouble(areaPoints.get(j).getLng()));
|
||||
tempList.add(latLng);
|
||||
}
|
||||
LatLng latLng = new LatLng(Double.parseDouble(areaPoints.get(0).getLat()), Double.parseDouble(areaPoints.get(0).getLng()));
|
||||
tempList.add(latLng);
|
||||
mPenLineList.add(tempList);
|
||||
}
|
||||
}
|
||||
//绘制电子网格
|
||||
drawPenToMap(penLineBeans);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 画电子围栏
|
||||
*/
|
||||
private void drawPenToMap(List<PenNewLineBean> penLineBeans) {
|
||||
mBaiduMap.clear();
|
||||
for (int i = 0; i < penLineBeans.size(); i++) {
|
||||
List<PenNewLineBean.PointArrayBean> areaPoints = penLineBeans.get(i).getPointArray();
|
||||
if (areaPoints != null && areaPoints.size() >= 4) {
|
||||
List<LatLng> pts = new ArrayList<>();
|
||||
for (int j = 0; j < areaPoints.size(); j++) {
|
||||
double la = Double.parseDouble(areaPoints.get(j).getLat());
|
||||
double lo = Double.parseDouble(areaPoints.get(j).getLng());
|
||||
pts.add(new LatLng(la, lo));
|
||||
}
|
||||
double laend = Double.parseDouble(areaPoints.get(0).getLat());
|
||||
double loend = Double.parseDouble(areaPoints.get(0).getLng());
|
||||
pts.add(new LatLng(laend, loend));
|
||||
PenNewLineBean bean = penLineBeans.get(i);
|
||||
int borderColor = TextUtils.isEmpty(bean.getFillColor()) ? Color.WHITE : Color.parseColor(bean.getFillColor());
|
||||
int colorWithAlpha = ConvertUtils.getColorWithAlpha(0.3f, borderColor);
|
||||
OverlayOptions polygonOption = new PolygonOptions()
|
||||
.points(pts)
|
||||
.stroke(new Stroke(3, colorWithAlpha))
|
||||
.fillColor(colorWithAlpha);
|
||||
mBaiduMap.addOverlay(polygonOption);
|
||||
moveMapToCenter(pts.get(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 移动地图到指定中心点
|
||||
*
|
||||
* @param latLng
|
||||
*/
|
||||
private void moveMapToCenter(LatLng latLng) {
|
||||
MapStatus cur = new MapStatus.Builder().zoom(16).target(latLng).build();
|
||||
MapStatusUpdate curUpdate = MapStatusUpdateFactory.newMapStatus(cur);
|
||||
mBaiduMap.animateMapStatus(curUpdate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启定位
|
||||
*/
|
||||
private void startLocation() {
|
||||
stopLocation();
|
||||
mLocationClient = new LocationClient(getApplicationContext());
|
||||
LocationClientOption locationOption = new LocationClientOption();
|
||||
SignLocationListener myLocationListener = new SignLocationListener();
|
||||
mLocationClient.registerLocationListener(myLocationListener);
|
||||
locationOption.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy);
|
||||
locationOption.setCoorType("bd09ll");
|
||||
locationOption.setScanSpan(30 * 1000);
|
||||
locationOption.setIsNeedAddress(true);
|
||||
locationOption.setNeedDeviceDirect(false);
|
||||
locationOption.setLocationNotify(false);
|
||||
locationOption.setIgnoreKillProcess(true);
|
||||
locationOption.setIsNeedLocationDescribe(true);
|
||||
locationOption.setIsNeedLocationPoiList(true);
|
||||
locationOption.SetIgnoreCacheException(false);
|
||||
locationOption.setOpenGps(true);
|
||||
locationOption.setIsNeedAltitude(false);
|
||||
mLocationClient.setLocOption(locationOption);
|
||||
//开始定位
|
||||
mLocationClient.start();
|
||||
}
|
||||
|
||||
private void stopLocation() {
|
||||
if (null != mLocationClient) {
|
||||
mLocationClient.stop();
|
||||
}
|
||||
}
|
||||
|
||||
private class SignLocationListener extends BDAbstractLocationListener {
|
||||
@Override
|
||||
public void onReceiveLocation(BDLocation bdLocation) {
|
||||
if (bdLocation != null && bdLocation.getLatitude() != Double.MIN_VALUE && bdLocation.getLongitude() != Double.MIN_VALUE) {
|
||||
mCurrent = bdLocation;
|
||||
if (TextUtils.isEmpty(mCurrent.getAddrStr())) {
|
||||
mTvCurLocation.setText("当前地址:未知");
|
||||
} else {
|
||||
mTvCurLocation.setText("当前地址:" + mCurrent.getAddrStr());
|
||||
}
|
||||
mBaiduMap.setMyLocationEnabled(true);
|
||||
MyLocationData locData = new MyLocationData.Builder()
|
||||
.accuracy(bdLocation.getRadius())
|
||||
.latitude(bdLocation.getLatitude())
|
||||
.longitude(bdLocation.getLongitude()).build();
|
||||
mBaiduMap.setMyLocationData(locData);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (mLocationClient != null) {
|
||||
stopLocation();
|
||||
mLocationClient = null;
|
||||
}
|
||||
|
||||
if (mTimeDisposable != null) {
|
||||
mTimeDisposable.dispose();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
@ -25,7 +25,7 @@ public class FunctionNumAdapter extends BaseRecyclerAdapter<FuncBean, FuncNumHol
|
||||
|
||||
@Override
|
||||
public FuncNumHolder createHolder(ViewGroup parent, int viewType) {
|
||||
View itemView = LayoutInflater.from(mContext).inflate(R.layout.item_main_func, parent, false);
|
||||
View itemView = LayoutInflater.from(mContext).inflate(R.layout.item_main_func_ver, parent, false);
|
||||
return new FuncNumHolder(itemView);
|
||||
}
|
||||
|
||||
|
@ -17,32 +17,25 @@ public class CheckSignBean {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
|
||||
public static class CheckBean {
|
||||
private String late;
|
||||
private String signIn;
|
||||
private boolean late;
|
||||
private boolean signIn;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CheckBean{" +
|
||||
"late='" + late + '\'' +
|
||||
", signIn='" + signIn + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
public String getIsSign() {
|
||||
return signIn;
|
||||
}
|
||||
|
||||
public void setIsSign(String isSign) {
|
||||
this.signIn = isSign;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
public boolean isLate() {
|
||||
return late;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.late = status;
|
||||
public void setLate(boolean late) {
|
||||
this.late = late;
|
||||
}
|
||||
|
||||
public boolean isSignIn() {
|
||||
return signIn;
|
||||
}
|
||||
|
||||
public void setSignIn(boolean signIn) {
|
||||
this.signIn = signIn;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -332,8 +332,8 @@ public class LocationService extends NotificationService {
|
||||
|
||||
@Override
|
||||
public void onNext(CheckSignBean checkSignBean) {
|
||||
if (checkSignBean != null && !TextUtils.isEmpty(checkSignBean.getData().getIsSign())) {
|
||||
boolean b = Boolean.parseBoolean(checkSignBean.getData().getIsSign());
|
||||
if (checkSignBean != null){
|
||||
boolean b = checkSignBean.getData().isSignIn();
|
||||
if (!b) {
|
||||
String nowHourMM = TimeUtils.getNowHourMM();
|
||||
String userType = GlobalProvider.getString(LocationService.this, "userType", "P");
|
||||
@ -677,8 +677,8 @@ public class LocationService extends NotificationService {
|
||||
|
||||
@Override
|
||||
public void onNext(CheckSignBean checkSignBean) {
|
||||
if (checkSignBean != null && !TextUtils.isEmpty(checkSignBean.getData().getIsSign())) {
|
||||
isSignIn = Boolean.parseBoolean(checkSignBean.getData().getIsSign());
|
||||
if (checkSignBean != null ) {
|
||||
isSignIn = checkSignBean.getData().isSignIn();
|
||||
if (isSignIn) {
|
||||
//已经签到
|
||||
checkSignOff();
|
||||
@ -955,7 +955,7 @@ public class LocationService extends NotificationService {
|
||||
private void sendLocationBroadcast(BDLocation bdLocation) {
|
||||
if (null != bdLocation) {
|
||||
boolean isLegal = checkSinglePoint(bdLocation);
|
||||
LogUtils.e("定位是否合法:" + isLegal + "\n定位点:" + bdLocation.getLatitude() + "===" + bdLocation.getLongitude());
|
||||
// LogUtils.e("定位是否合法:" + isLegal + "\n定位点:" + bdLocation.getLatitude() + "===" + bdLocation.getLongitude());
|
||||
if (isLegal) {
|
||||
if (mTempList.size() >= 25) {
|
||||
checkPoints();
|
||||
|
BIN
app/src/main/res/drawable-xhdpi/ic_address_list_icon.png
Normal file
After Width: | Height: | Size: 757 B |
BIN
app/src/main/res/drawable-xhdpi/ic_case_recod_icon.png
Normal file
After Width: | Height: | Size: 405 B |
BIN
app/src/main/res/drawable-xhdpi/ic_hose_person.png
Normal file
After Width: | Height: | Size: 6.4 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_issue_disp.png
Normal file
After Width: | Height: | Size: 7.0 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_issue_report.png
Normal file
After Width: | Height: | Size: 7.0 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_item_title_icon.png
Normal file
After Width: | Height: | Size: 240 B |
BIN
app/src/main/res/drawable-xhdpi/ic_item_title_icon_rec.png
Normal file
After Width: | Height: | Size: 83 B |
Before Width: | Height: | Size: 42 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_main_title_shadow.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_maint_title_btn_left.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_maint_title_btn_right.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_reload_refresh.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_sign_late.png
Normal file
After Width: | Height: | Size: 908 B |
BIN
app/src/main/res/drawable-xhdpi/ic_sign_normal.png
Normal file
After Width: | Height: | Size: 589 B |
BIN
app/src/main/res/drawable-xhdpi/ic_start_hint.png
Executable file → Normal file
Before Width: | Height: | Size: 487 B After Width: | Height: | Size: 511 B |
BIN
app/src/main/res/drawable-xhdpi/ic_work_log.png
Normal file
After Width: | Height: | Size: 7.5 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_work_path.png
Normal file
After Width: | Height: | Size: 6.1 KiB |
6
app/src/main/res/drawable/sel_cir_btn_blue_gray.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/shp_circle_gray" android:state_focused="false" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/shp_circle_main_theme" android:state_pressed="false" android:state_selected="false" />
|
||||
|
||||
</selector>
|
13
app/src/main/res/drawable/shp_circle_main_theme.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval"
|
||||
android:useLevel="false">
|
||||
|
||||
<solid android:color="@color/text_blue" />
|
||||
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/text_blue" />
|
||||
|
||||
|
||||
</shape>
|
@ -106,6 +106,7 @@
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:layout_marginTop="5dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
@ -129,6 +130,7 @@
|
||||
android:id="@+id/tv_rule"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:clickable="true"
|
||||
android:drawablePadding="5dp"
|
||||
android:gravity="center"
|
||||
|
331
app/src/main/res/layout/activity_main_new.xml
Executable file
@ -0,0 +1,331 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/gray_F8"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="240dp"
|
||||
android:background="@color/blue_title_bg" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_main_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginTop="50dp"
|
||||
android:layout_marginRight="20dp">
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="215dp"
|
||||
android:background="@drawable/ic_main_title_shadow" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:background="@drawable/shape_rectangle_white_20"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_user_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:background="@drawable/ic_user_default" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_user_center"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_toRightOf="@id/iv_user_icon"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_user_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableRight="@drawable/ic_arrow_white_right"
|
||||
android:drawablePadding="5dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:textColor="#000000"
|
||||
android:textSize="16dp"
|
||||
tools:text="王丽霞 个人中心" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_depart"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#000000"
|
||||
android:textSize="14dp"
|
||||
tools:text="片长办(调度人员)" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_online"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="13dp"
|
||||
tools:text="(在线)" />
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_sign"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="30dp"
|
||||
android:background="@drawable/sel_rectangle_btn_yellow_gray"
|
||||
android:gravity="center"
|
||||
android:text="签到"
|
||||
android:textColor="@color/col_black_gray"
|
||||
android:textSize="14dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_func_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_day_aviso"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_aviso_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="0"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="24dp" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:gravity="center"
|
||||
android:text="每日通报"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:background="@color/base_line" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_history"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp"
|
||||
android:visibility="visible">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_history_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="0"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="24dp" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:gravity="center"
|
||||
android:text="待办案件"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:background="@color/base_line" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_plan"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_plan_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="0"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="24dp" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:gravity="center"
|
||||
android:text="我的案件"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12dp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_address_list"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/ic_maint_title_btn_left"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableLeft="@drawable/ic_address_list_icon"
|
||||
android:drawablePadding="8dp"
|
||||
android:text="通讯录"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_case_record"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginLeft="-20dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/ic_maint_title_btn_right"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableLeft="@drawable/ic_case_recod_icon"
|
||||
android:drawablePadding="8dp"
|
||||
android:text="案件记录"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14dp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<android.support.v4.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/rl_main_bg">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:visibility="visible">
|
||||
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/rlv_funcs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginTop="7dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:overScrollMode="never"
|
||||
tools:itemCount="4"
|
||||
tools:layoutManager="GridLayoutManager"
|
||||
tools:listitem="@layout/item_main_func_ver"
|
||||
tools:spanCount="4" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/rlv_funcs"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableLeft="@drawable/ic_item_title_icon"
|
||||
android:drawablePadding="10dp"
|
||||
android:text="通知公告"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="200dp">
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.CustomStateView
|
||||
android:id="@+id/csv_notice"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true" />
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/rlv_notice"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
</android.support.v4.widget.NestedScrollView>
|
||||
</RelativeLayout>
|
@ -1,9 +1,219 @@
|
||||
<?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"
|
||||
<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="match_parent"
|
||||
tools:context=".activitys.common.WorkSignActivity">
|
||||
android:background="@color/gray_fa"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp">
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/white"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_user_icon"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
tools:src="@drawable/ic_user_default" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_user_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp"
|
||||
tools:text="姓名" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_user_department"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
tools:text="部门职位" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_cur_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/text_15"
|
||||
tools:text="2022年12月12日\n23:23:23" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/white"
|
||||
android:gravity="center|top"
|
||||
android:orientation="vertical"
|
||||
android:padding="5dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="left|center"
|
||||
android:paddingLeft="3dp"
|
||||
android:paddingTop="3dp"
|
||||
android:text="规则"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/text_16" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:padding="8dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="签到时间区间:"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/text_14" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_in_time"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_weight="1"
|
||||
android:textSize="14dp"
|
||||
tools:text="23:00:00-24:00:00" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_sign_in_state"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
tools:src="@drawable/ic_sign_late" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingLeft="8dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="签退时间区间:"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_out_time"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_weight="1"
|
||||
android:textSize="14dp"
|
||||
tools:text="23:00:00-24:00:00" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_sign_out_state"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
tools:src="@drawable/ic_sign_normal" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
|
||||
<com.baidu.mapapi.map.TextureMapView
|
||||
android:id="@+id/tmv_map"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_reset_loc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@id/tmv_map"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="15dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:background="@drawable/bm_btn_background"
|
||||
android:minWidth="0dp"
|
||||
android:minHeight="0dp"
|
||||
android:visibility="visible" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_cur_location"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:drawableLeft="@drawable/ic_location_blue"
|
||||
android:gravity="center"
|
||||
android:padding="5dp"
|
||||
android:text="正在定位中..." />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_sign"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/sel_cir_btn_blue_gray"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="5dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_state"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_state"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
tools:text="今日完成" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
52
app/src/main/res/layout/item_main_func_ver.xml
Executable file
@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_hint_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:background="@drawable/shp_circle_hint_num"
|
||||
android:gravity="center"
|
||||
android:padding="2dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="10sp"
|
||||
tools:text="99+" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_icon"
|
||||
android:layout_width="57dp"
|
||||
android:layout_height="57dp"
|
||||
android:scaleType="fitXY"
|
||||
tools:background="@drawable/ic_address_list" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="11dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawablePadding="15dp"
|
||||
android:gravity="center_vertical"
|
||||
android:includeFontPadding="true"
|
||||
android:textColor="#ff353535"
|
||||
android:textSize="14dp"
|
||||
tools:text="案件上报" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
@ -70,6 +70,23 @@
|
||||
<item name="android:padding">2dp</item>
|
||||
</style>
|
||||
|
||||
<style name="item_white_bottom_border">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:background">@drawable/shp_rectangle_bottom_border</item>
|
||||
<item name="android:orientation">horizontal</item>
|
||||
<item name="android:paddingTop">5dp</item>
|
||||
<item name="android:paddingBottom">5dp</item>
|
||||
</style>
|
||||
|
||||
<style name="item_white_ver">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:orientation">vertical</item>
|
||||
<item name="android:paddingTop">5dp</item>
|
||||
<item name="android:paddingBottom">5dp</item>
|
||||
</style>
|
||||
|
||||
<style name="item_title">
|
||||
<item name="android:layout_width">0dp</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
@ -79,6 +96,34 @@
|
||||
<item name="android:textSize">13sp</item>
|
||||
</style>
|
||||
|
||||
<style name="item_title_wrap">
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:padding">2dp</item>
|
||||
<item name="android:textColor">@color/black</item>
|
||||
<item name="android:textSize">14dp</item>
|
||||
</style>
|
||||
|
||||
<style name="item_content_match">
|
||||
<item name="android:layout_width">0dp</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_weight">1</item>
|
||||
<item name="android:background">@null</item>
|
||||
<item name="android:gravity">right</item>
|
||||
<item name="android:padding">5dp</item>
|
||||
<item name="android:textSize">14dp</item>
|
||||
</style>
|
||||
|
||||
<style name="item_content_match_ver_gray">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:background">@drawable/shape_rectangle_gray_5</item>
|
||||
<item name="android:gravity">left</item>
|
||||
<item name="android:padding">10dp</item>
|
||||
<item name="android:textSize">14dp</item>
|
||||
<item name="android:layout_marginTop">5dp</item>
|
||||
</style>
|
||||
|
||||
<style name="item_content">
|
||||
<item name="android:layout_width">0dp</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
@ -94,7 +139,7 @@
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_weight">1</item>
|
||||
<item name="android:drawablePadding">5dp</item>
|
||||
<item name="android:drawableRight">@drawable/ic_arrow_gray_down</item>
|
||||
<item name="android:drawableRight">@drawable/ic_arrow_sort_gray</item>
|
||||
<item name="android:gravity">right</item>
|
||||
<item name="android:padding">5dp</item>
|
||||
<item name="android:clickable">true</item>
|
||||
@ -127,8 +172,8 @@
|
||||
</style>
|
||||
|
||||
<style name="style_hint_star">
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_width">8dp</item>
|
||||
<item name="android:layout_height">8dp</item>
|
||||
<item name="android:background">@drawable/ic_start_hint</item>
|
||||
</style>
|
||||
|
||||
|
@ -39,16 +39,24 @@ public class PathConfig {
|
||||
|
||||
//=========================字典ID===================================
|
||||
public static final String DIC_RELATION = "4c21d91a-d5e1-4cfc-a18a-d63272763cdb";//与户主关系
|
||||
public static final String DIC_CARD_TYPE = "76c5044f-805a-4313-b1e8-79e966b97c0d";//证件类型
|
||||
public static final String DIC_CARD_TYPE = "360d6062-754d-4d43-95ba-cb9938102050";//证件类型
|
||||
public static final String DIC_GENDER = "4ef46940-76ab-4758-b5f0-0cbc93ffc660";//性别
|
||||
|
||||
public static final String DIC_HOUSE_TYPE = "";//住所类型
|
||||
|
||||
public static final String DIC_CASE_TYPE = "e45bbd02-35b3-4f5c-bc2e-ffd924e87abb";//案件类别
|
||||
|
||||
public static final String DIC_NATIONALITY = "1c9098f8-155a-453e-8766-51d8df1556b3";//国籍
|
||||
public static final String DIC_FAITH = "792e5742-d302-4943-b04c-161f406ea7ca";//宗教信仰
|
||||
public static final String DIC_RELIGION = "792e5742-d302-4943-b04c-161f406ea7ca";//宗教信仰
|
||||
public static final String DIC_WORK_TYPE = "5867642c-2b79-4bea-adc9-477a5b784159";//职业类别
|
||||
public static final String DIC_NATION = "a981579c-572b-4fd1-8e76-5d17df97f6a4";//名族
|
||||
public static final String DIC_NATION = "a981579c-572b-4fd1-8e76-5d17df97f6a4";//民族
|
||||
public static final String DIC_MARRIAGE = "91bdd01b-e9d2-4a2b-98b5-45e25d3cd8ae";//婚姻状况
|
||||
public static final String DIC_INSURE = "8b91f082-57d0-475c-aa86-665b9b28e12e";//社会保险情况
|
||||
public static final String DIC_HEALTH = "c32ecdca-c99e-478c-801d-f3c66a106042";//健康状况
|
||||
public static final String DIC_FLOW_CAUSE = "1bc43423-37cf-44c9-99b1-963ac0ece09b";//流动原因
|
||||
public static final String DIC_OLD_TYPE = "c0dfe952-55d0-494f-8e55-24be6471b72e";//老人类别
|
||||
public static final String DIC_OLD_LIVE_CARE = "c176d9e1-3c3e-49ac-9c6a-b886dcf46a33";//生活照料情况
|
||||
public static final String DIC_OLD_LIVE_ABILITY = "cd70da85-02b5-4ab2-a952-ecd55b02ab75";//生活自理能力
|
||||
public static final String DIC_POLITICS = "b2c96de0-3df8-41db-99b1-bc4e24ac6c24";//政治面貌
|
||||
public static final String DIC_EDU = "d6b9f026-6ea9-456a-b48b-0c18d502523b";//学历
|
||||
public static final String DIC_TREAT = "ed085b3e-25c1-43fe-9d42-77510ee89d58";//治疗情况
|
||||
@ -75,16 +83,16 @@ public class PathConfig {
|
||||
public static final String DIC_FOUR = "6f5fc00e-dfe2-4c7a-bb7b-114d54ad6fb8";//四史
|
||||
public static final String DIC_THREE = "34aefb4b-5918-4de7-a6b8-8e361f76c557";//三涉
|
||||
public static final String DIC_GROUP = "b30da878-2576-4e70-8a39-4eeee5ad9983";//小组组成
|
||||
public static final String DIC_LEAVE="f29299aa-0651-4346-845a-2f8bf8987778";//请假类型
|
||||
public static final String DIC_LEAVE_2="626c1b6a-e1cc-45f8-9782-55e5a295aae6";//请假类型2
|
||||
public static final String DIC_LEAVE = "f29299aa-0651-4346-845a-2f8bf8987778";//请假类型
|
||||
public static final String DIC_LEAVE_2 = "626c1b6a-e1cc-45f8-9782-55e5a295aae6";//请假类型2
|
||||
/**
|
||||
* 请假外出市五区外
|
||||
*/
|
||||
public static final String LEAVE_OUTGOING_CITY5_OUTER = "0d9e9d33-286b-4b4c-9e5c-8155592326fe";
|
||||
public static final String LEAVE_OUTGOING_CITY5_OUTER = "0d9e9d33-286b-4b4c-9e5c-8155592326fe";
|
||||
/**
|
||||
* 请假外出市五区内
|
||||
*/
|
||||
public static final String LEAVE_OUTGOING_CITY5_INNER = "af6ecb02-58df-412b-8bbe-25b7cdc640d6";
|
||||
public static final String LEAVE_OUTGOING_CITY5_INNER = "af6ecb02-58df-412b-8bbe-25b7cdc640d6";
|
||||
|
||||
public static final String DEFAULT_AREA_CODE = "0";//地区
|
||||
public static final String APP_VERSION_ID = "402e60d8-8270-4bb9-8850-83d30a39a53f";/* 包头版本一 */
|
||||
@ -115,7 +123,7 @@ public class PathConfig {
|
||||
public static final int MSG_SEND_STATUS = 1100;
|
||||
public static final String mDefaultCityCode = "229";//TODO 包头 229
|
||||
public static final boolean IS_LIMIT = true;//TODO 是否判断城市代码
|
||||
// public static final String mDefaultCityCode = "321";//TODO 呼和浩特 321
|
||||
// public static final String mDefaultCityCode = "321";//TODO 呼和浩特 321
|
||||
// public static final String mDefaultCityCode = "168";//TODO 乌兰察布 168
|
||||
// 区直领导:b01dac8e-c516-4974-b513-f1352ca40202
|
||||
// 片长:e483f019-d971-49ac-b5fa-3314220da703
|
||||
@ -231,4 +239,6 @@ public class PathConfig {
|
||||
public static final String ACTION_MSG_CHAT_SEND = "com.tenlionsoft.realtimelocation.chat_send";//发送聊天信息
|
||||
public static final String ACTION_PUSH_RESTART_SOCKET = "com.tengshisoft.zonemanagement.push_restart";//重新登录socket
|
||||
public static final String ACTION_PUSH_STOP_SOCKET = "com.tengshisoft.zonemanagement.push_stop";//关闭socket
|
||||
|
||||
|
||||
}
|
||||
|
@ -9,8 +9,8 @@ import com.sucstepsoft.cm_utils.constant.PathConfig;
|
||||
*/
|
||||
public class BaseUrlApi {
|
||||
|
||||
// public static final String IP = "http://219.147.99.164:8082/usercenter/"; /*正式统一用户*/
|
||||
public static final String IP = "http://192.168.0.15:7021/usercenter/"; /*测试统一用户*/
|
||||
// public static final String IP = "http://219.147.99.164:8082/usercenter/"; /*正式统一用户*/
|
||||
public static final String IP = "http://192.168.0.15:7021/usercenter/"; /*测试统一用户*/
|
||||
// public static final String IP = "http://175.24.42.217:7000/usercenter/"; /*测试统一用户*/
|
||||
public static final String BASE_URL = IP;
|
||||
public static final String APP_VERSION = BASE_URL + "appCmVersionManagement/getAppVersion";
|
||||
@ -18,12 +18,13 @@ public class BaseUrlApi {
|
||||
public static final String FIELD_SAFETY = BASE_URL + "appFieldSafety/goFloorPlan";
|
||||
public static final int PHOTO_REQUEST = 233;
|
||||
public static final int CAMERA_REQUEST = 123;
|
||||
// public static final String BASE_IP_P = "http://219.147.99.164:8082/"; /*正式IP*/
|
||||
// public static final String BASE_IP_P = "http://219.147.99.164:8082/"; /*正式IP*/
|
||||
// public static final String BASE_IP_P = "http://175.24.42.217"; /*演示IP*/
|
||||
public static final String BASE_IP_P = "http://192.168.0.15:7022/"; /*测试IP*/
|
||||
public static final String BASE_IP = BASE_IP_P + "servicecity/";/*网格系统*/
|
||||
// public static final String BASE_IP = "http://192.168.0.109:8083/servicecity/";/*测试网格系统*/
|
||||
public static final String BASE_POPULATION_IP = BASE_IP_P + "population/";/*人口系统*/
|
||||
// public static final String BASE_POPULATION_IP = BASE_IP_P + "population/";/*人口系统*/
|
||||
public static final String BASE_POPULATION_IP = "http://192.168.0.115:7023/population/";/*人口系统 测试*/
|
||||
// public static final String BASE_POPULATION_IP = "http://192.168.0.15:7023/population/";/*人口系统*/
|
||||
public static final String BASE_IMG_URL = BASE_IP + "route/file/downloadfile/true/";
|
||||
public static final String SOCKET_IP = BASE_IP_P + "social/appws";/*SocketIP*/
|
||||
|
@ -0,0 +1,93 @@
|
||||
package com.sucstepsoft.cm_utils.core.widget.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.sucstepsoft.cm_utils.R;
|
||||
|
||||
|
||||
/**
|
||||
* 作者: adam
|
||||
* 日期: 2022/4/27 - 16:40
|
||||
* 邮箱: itgaojian@163.com
|
||||
* 描述: 加载状态view
|
||||
*/
|
||||
public class CustomStateView extends LinearLayout {
|
||||
public static final int STATE_LOAD = 0x123;//加载中
|
||||
public static final int STATE_EMPTY = 0x124;//空数据
|
||||
public static final int STATE_ERROR = 0x125;//加载失败
|
||||
public static final int STATE_SUCCESS = 0x126;//加载成功
|
||||
public static final int STATE_ERROR_NET = 0x127;//加载失败,网络错误
|
||||
public static final int STATE_SEARCH = 0x128;//搜索默认状态
|
||||
private ImageView mIvStateDate;
|
||||
private TextView mTvStateHint;
|
||||
private ProgressBar mPbStateLoading;
|
||||
public int mCurrentState = STATE_LOAD;
|
||||
|
||||
public CustomStateView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public CustomStateView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.layout_state_view, this, true);
|
||||
mPbStateLoading = view.findViewById(R.id.pb_state_loading);
|
||||
mIvStateDate = view.findViewById(R.id.iv_state_data);
|
||||
mTvStateHint = view.findViewById(R.id.tv_state_hint);
|
||||
setState(STATE_LOAD);
|
||||
}
|
||||
|
||||
public CustomStateView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
|
||||
}
|
||||
|
||||
public int getState() {
|
||||
return mCurrentState;
|
||||
}
|
||||
|
||||
public void setState(int state) {
|
||||
mCurrentState = state;
|
||||
switch (state) {
|
||||
case STATE_LOAD://加载中
|
||||
mIvStateDate.setVisibility(View.GONE);
|
||||
mPbStateLoading.setVisibility(View.VISIBLE);
|
||||
mTvStateHint.setVisibility(View.VISIBLE);
|
||||
mTvStateHint.setText("加载中...");
|
||||
break;
|
||||
case STATE_EMPTY://没有数据
|
||||
mIvStateDate.setVisibility(View.VISIBLE);
|
||||
mIvStateDate.setBackgroundResource(R.drawable.ic_empty_data);
|
||||
mPbStateLoading.setVisibility(View.GONE);
|
||||
mTvStateHint.setVisibility(View.VISIBLE);
|
||||
mTvStateHint.setText("暂无数据");
|
||||
break;
|
||||
case STATE_ERROR:
|
||||
mIvStateDate.setVisibility(View.VISIBLE);
|
||||
mIvStateDate.setBackgroundResource(R.drawable.ic_load_error);
|
||||
mPbStateLoading.setVisibility(View.GONE);
|
||||
mTvStateHint.setVisibility(View.VISIBLE);
|
||||
mTvStateHint.setText("加载失败");
|
||||
break;
|
||||
case STATE_SUCCESS:
|
||||
mIvStateDate.setVisibility(GONE);
|
||||
mPbStateLoading.setVisibility(GONE);
|
||||
mTvStateHint.setVisibility(GONE);
|
||||
break;
|
||||
case STATE_SEARCH://搜索默认
|
||||
mIvStateDate.setVisibility(View.VISIBLE);
|
||||
mIvStateDate.setBackgroundResource(R.drawable.ic_empty_data);
|
||||
mPbStateLoading.setVisibility(View.GONE);
|
||||
mTvStateHint.setVisibility(View.VISIBLE);
|
||||
mTvStateHint.setText("请输入要搜索的内容");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@ -26,6 +26,17 @@ public final class TimeUtils {
|
||||
return simpleDateFormat;
|
||||
}
|
||||
|
||||
public static String getCurDate() {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日", Locale.US);
|
||||
return millis2String(System.currentTimeMillis(), simpleDateFormat);
|
||||
}
|
||||
|
||||
public static String getCurTime() {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm:ss", Locale.US);
|
||||
return millis2String(System.currentTimeMillis(), simpleDateFormat);
|
||||
}
|
||||
|
||||
|
||||
private TimeUtils() {
|
||||
throw new UnsupportedOperationException("u can't instantiate me...");
|
||||
}
|
||||
@ -64,7 +75,7 @@ public final class TimeUtils {
|
||||
}
|
||||
|
||||
public static List<String> getTimeSegment(int year, int month, int day) {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss",Locale.US);
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US);
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.set(year, month - 1, day, 8, 0, 0);
|
||||
cal.set(Calendar.MILLISECOND, 0);
|
||||
@ -187,12 +198,12 @@ public final class TimeUtils {
|
||||
* @return
|
||||
*/
|
||||
public static boolean compareToCurrent(String time) {
|
||||
SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss",Locale.US);
|
||||
SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss", Locale.US);
|
||||
String nowString = getNowString(format);
|
||||
try {
|
||||
Date a = format.parse(nowString);
|
||||
Date b = format.parse(time);
|
||||
//Date类的一个方法,如果a早于b返回true,否则返回false
|
||||
//Date类的一个方法,如果现在早于指定返回true,否则返回false
|
||||
return a.before(b);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
@ -204,7 +215,7 @@ public final class TimeUtils {
|
||||
* @return false 下午 true 上午
|
||||
*/
|
||||
public static boolean isAmOrPm() {
|
||||
SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss",Locale.US);
|
||||
SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss", Locale.US);
|
||||
String nowString = getNowString(format);
|
||||
try {
|
||||
Date a = format.parse(nowString);
|
||||
@ -282,7 +293,7 @@ public final class TimeUtils {
|
||||
}
|
||||
|
||||
public static String getCurrentTime(String sTime) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm",Locale.US);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm", Locale.US);
|
||||
try {
|
||||
Date parse = sdf.parse(sTime);
|
||||
Calendar beforeTime = Calendar.getInstance();
|
||||
@ -298,7 +309,7 @@ public final class TimeUtils {
|
||||
}
|
||||
|
||||
public static String getCurrentTimeSpan(String stime, int span) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm",Locale.US);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm", Locale.US);
|
||||
try {
|
||||
Date parse = sdf.parse(stime);
|
||||
Calendar beforeTime = Calendar.getInstance();
|
||||
@ -314,7 +325,7 @@ public final class TimeUtils {
|
||||
}
|
||||
|
||||
public static String getCurrentTime(int span) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd",Locale.US);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
|
||||
Calendar beforeTime = Calendar.getInstance();
|
||||
beforeTime.add(Calendar.DAY_OF_WEEK, span);// 3后
|
||||
Date beforeD = beforeTime.getTime();
|
||||
@ -326,7 +337,7 @@ public final class TimeUtils {
|
||||
List<String> mDatas = new ArrayList<>();
|
||||
try {
|
||||
Date nowDate = new Date();
|
||||
SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd",Locale.US);
|
||||
SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
|
||||
Calendar beforeTime = Calendar.getInstance();
|
||||
beforeTime.add(Calendar.YEAR, 2);
|
||||
Date time = beforeTime.getTime();
|
||||
@ -348,7 +359,7 @@ public final class TimeUtils {
|
||||
public static List<String> findDates(Date dEnd) {
|
||||
List<String> lDate = new ArrayList();
|
||||
Date dBegin = new Date();
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd",Locale.US);
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
|
||||
lDate.add(format.format(dBegin));
|
||||
Calendar calBegin = Calendar.getInstance();
|
||||
// 使用给定的 Date 设置此 Calendar 的时间
|
||||
@ -568,7 +579,7 @@ public final class TimeUtils {
|
||||
*/
|
||||
public static int getNowAmOrPm() {
|
||||
Date date = new Date();
|
||||
SimpleDateFormat df = new SimpleDateFormat("HH",Locale.US);
|
||||
SimpleDateFormat df = new SimpleDateFormat("HH", Locale.US);
|
||||
String str = df.format(date);
|
||||
int a = Integer.parseInt(str);
|
||||
if (a > 0 && a <= 13) {
|
||||
@ -582,7 +593,7 @@ public final class TimeUtils {
|
||||
|
||||
public static int getAmOrPm() {
|
||||
Date date = new Date();
|
||||
SimpleDateFormat df = new SimpleDateFormat("HH",Locale.US);
|
||||
SimpleDateFormat df = new SimpleDateFormat("HH", Locale.US);
|
||||
String str = df.format(date);
|
||||
int a = Integer.parseInt(str);
|
||||
if (a > 0 && a <= 13) {
|
||||
@ -616,13 +627,13 @@ public final class TimeUtils {
|
||||
}
|
||||
|
||||
public static String getNowHour() {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm",Locale.US);
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm", Locale.US);
|
||||
String format = dateFormat.format(new Date());
|
||||
return format;
|
||||
}
|
||||
|
||||
public static String getNowHourHHmmSS() {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss",Locale.US);
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss", Locale.US);
|
||||
String format = dateFormat.format(new Date());
|
||||
return format;
|
||||
}
|
||||
@ -643,7 +654,7 @@ public final class TimeUtils {
|
||||
return false;
|
||||
}
|
||||
String[] args = sourceTime.split("-");
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm",Locale.US);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm", Locale.US);
|
||||
try {
|
||||
long now = sdf.parse(curTime).getTime();
|
||||
long start = sdf.parse(args[0]).getTime();
|
||||
@ -679,7 +690,7 @@ public final class TimeUtils {
|
||||
return false;
|
||||
}
|
||||
String[] args = sourceTime.split("-");
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss",Locale.US);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss", Locale.US);
|
||||
try {
|
||||
long now = sdf.parse(curTime).getTime();
|
||||
long start = sdf.parse(args[0]).getTime();
|
||||
@ -709,13 +720,13 @@ public final class TimeUtils {
|
||||
|
||||
public static String getNowHourMM() {
|
||||
Date date = new Date();
|
||||
SimpleDateFormat df = new SimpleDateFormat("HH:mm",Locale.US);
|
||||
SimpleDateFormat df = new SimpleDateFormat("HH:mm", Locale.US);
|
||||
return df.format(date);
|
||||
}
|
||||
|
||||
public static int getNowBetween(int s, int e) {
|
||||
Date date = new Date();
|
||||
SimpleDateFormat df = new SimpleDateFormat("HH",Locale.US);
|
||||
SimpleDateFormat df = new SimpleDateFormat("HH", Locale.US);
|
||||
String str = df.format(date);
|
||||
int a = Integer.parseInt(str);
|
||||
//9点之前
|
||||
@ -910,7 +921,7 @@ public final class TimeUtils {
|
||||
|
||||
//前者大于后者 返回大于0的数字反之小于0的数字,等于返回0
|
||||
public static int compareDate(String time, String time1) {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd",Locale.US);
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
|
||||
try {
|
||||
Date d1 = format.parse(time);
|
||||
Date d2 = format.parse(time1);
|
||||
@ -944,7 +955,7 @@ public final class TimeUtils {
|
||||
|
||||
public static boolean compare(String time1, String time2) {
|
||||
//如果想比较日期则写成"yyyy-MM-dd"就可以了
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd",Locale.US);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
|
||||
//将字符串形式的时间转化为Date类型的时间
|
||||
try {
|
||||
Date a = sdf.parse(time1);
|
||||
|
5
cm_utils/src/main/res/color/col_black_gray.xml
Executable file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@color/gray_text" android:state_pressed="true" />
|
||||
<item android:color="@color/black" android:state_pressed="false" />
|
||||
</selector>
|
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.4 KiB |
BIN
cm_utils/src/main/res/drawable-xhdpi/ic_load_error.png
Normal file
After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 1.9 KiB |
5
cm_utils/src/main/res/drawable/sel_rectangle_btn_yellow_gray.xml
Executable 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/shape_rectangle_round_gray" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/shape_rectangle_round_yellow" android:state_pressed="false" />
|
||||
</selector>
|
6
cm_utils/src/main/res/drawable/shape_rectangle_gray_5.xml
Executable file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/gray_bg" />
|
||||
<corners android:radius="5dp" />
|
||||
</shape>
|
6
cm_utils/src/main/res/drawable/shape_rectangle_round_gray.xml
Executable file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/gray_bg" />
|
||||
<corners android:radius="15dp" />
|
||||
</shape>
|
6
cm_utils/src/main/res/drawable/shape_rectangle_round_yellow.xml
Executable file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/btn_yellow_100" />
|
||||
<corners android:radius="15dp" />
|
||||
</shape>
|
6
cm_utils/src/main/res/drawable/shape_rectangle_white_20.xml
Executable file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/white" />
|
||||
<corners android:radius="20dp" />
|
||||
</shape>
|
15
cm_utils/src/main/res/drawable/shp_rectangle_bottom_border.xml
Executable file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 边框颜色值 -->
|
||||
<item>
|
||||
<shape>
|
||||
<solid android:color="#EFEFEF" />
|
||||
</shape>
|
||||
</item>
|
||||
<!-- 主体背景颜色值 -->
|
||||
<item android:bottom="1dp">
|
||||
<shape>
|
||||
<solid android:color="@color/white" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
40
cm_utils/src/main/res/layout/layout_state_view.xml
Normal file
@ -0,0 +1,40 @@
|
||||
<?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:id="@+id/ll_state_hint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp">
|
||||
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/pb_state_loading"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:indeterminateBehavior="repeat"
|
||||
android:indeterminateDrawable="@drawable/anim_loading"
|
||||
/>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_state_data"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="60dp"
|
||||
android:scaleType="fitXY"
|
||||
tools:src="@drawable/ic_empty_data" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_state_hint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:clickable="true"
|
||||
android:textColor="@color/gray_text"
|
||||
android:textSize="@dimen/text_14"
|
||||
tools:text="加载数据失败" />
|
||||
|
||||
</LinearLayout>
|
@ -133,6 +133,7 @@
|
||||
<color name="line">#efefef</color>
|
||||
<color name="gray_f5">#F5F5F5</color>
|
||||
<color name="gray_tr_hint">#aa000000</color>
|
||||
<color name="gray_F8">#F8F8F8</color>
|
||||
|
||||
<color name="teb_unselected">#b4b4b4</color>
|
||||
<color name="teb_selected">#d70715</color>
|
||||
@ -170,6 +171,7 @@
|
||||
<!--学习考试-->
|
||||
<!-- 白色 -->
|
||||
<color name="blue">#99B1DC</color>
|
||||
<color name="blue_title_bg">#4583FE</color>
|
||||
<color name="btn_yellow">#AAFD9521</color>
|
||||
<color name="btn_blue">#AA1BAAE2</color>
|
||||
<color name="btn_green">#AA37B54A</color>
|
||||
@ -181,4 +183,5 @@
|
||||
<color name="mask_color">#88888888</color>
|
||||
<color name="check_bg">#f2f2f2</color>
|
||||
<color name="un_press_color">#9C27B0</color>
|
||||
<color name="btn_yellow_100">#FCCA00</color>
|
||||
</resources>
|