会议室预订 初始提交
@ -0,0 +1 @@
|
||||
/build
|
||||
@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@ -0,0 +1,26 @@
|
||||
package com.rehome.meetingbook;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("com.rehome.sbcksyy", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.READ_SMS" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission
|
||||
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||
tools:ignore="ScopedStorage" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
||||
<uses-permission android:name="android.permission.READ_PROFILE" />
|
||||
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
||||
<uses-permission android:name="com.huawei.android.launcher.permission.CHANGE_BADGE" />
|
||||
<uses-permission android:name="com.huawei.permission.sec.MDM" />
|
||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||
|
||||
<permission-group android:name="${applicationId}.andpermission" />
|
||||
|
||||
<application
|
||||
android:name=".App"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
|
||||
<meta-data
|
||||
android:name="design_width"
|
||||
android:value="1024" />
|
||||
<meta-data
|
||||
android:name="design_height"
|
||||
android:value="1280" />
|
||||
|
||||
<activity
|
||||
android:name=".ui.activity.LoginActivity"
|
||||
android:exported="true"
|
||||
android:screenOrientation="landscape"
|
||||
android:windowSoftInputMode="stateHidden|adjustPan">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="false"
|
||||
android:screenOrientation="landscape" />
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="${applicationId}"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/file_paths_public" />
|
||||
</provider>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@ -0,0 +1,100 @@
|
||||
package com.rehome.meetingbook;
|
||||
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import androidx.multidex.MultiDex;
|
||||
import com.github.mikephil.charting.utils.Utils;
|
||||
import com.tencent.bugly.crashreport.CrashReport;
|
||||
import com.xuexiang.xui.XUI;
|
||||
import com.yolanda.nohttp.NoHttp;
|
||||
import com.zhy.autolayout.config.AutoLayoutConifg;
|
||||
import org.litepal.LitePalApplication;
|
||||
|
||||
|
||||
public class App extends LitePalApplication {
|
||||
|
||||
|
||||
private static final String APP_NAME = "com.rehome.sbcksyy";
|
||||
|
||||
private String DateSave;
|
||||
|
||||
public String getDateSave() {
|
||||
return DateSave;
|
||||
}
|
||||
|
||||
public void setDateSave(String dateSave) {
|
||||
DateSave = dateSave;
|
||||
}
|
||||
|
||||
private static App mInstance;
|
||||
public static App getInstance() {
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
Log.e("BaseApplication", "onCreate");
|
||||
Log.e("BaseApplication", getProcessNameByPID(getApplicationContext(), android.os.Process.myPid()));
|
||||
Log.e("isAppMainProcess", String.valueOf(isAppMainProcess()));
|
||||
|
||||
mInstance = this;
|
||||
|
||||
NoHttp.initialize(this);
|
||||
MultiDex.install(this);
|
||||
AutoLayoutConifg.getInstance().useDeviceSize();
|
||||
Utils.init(this);
|
||||
XUI.init(this); //初始化UI框架
|
||||
CrashReport.initCrashReport(getApplicationContext(), "ef7c97c038", true);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
super.attachBaseContext(base);
|
||||
MultiDex.install(this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断是否是主进程
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isAppMainProcess() {
|
||||
try {
|
||||
int pid = android.os.Process.myPid();
|
||||
String process = getProcessNameByPID(getApplicationContext(), pid);
|
||||
return TextUtils.isEmpty(process) || APP_NAME.equalsIgnoreCase(process);
|
||||
} catch (Exception e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 pid 获取进程名
|
||||
*
|
||||
* @param context
|
||||
* @param pid
|
||||
* @return
|
||||
*/
|
||||
public String getProcessNameByPID(Context context, int pid) {
|
||||
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
if (manager == null) {
|
||||
return "";
|
||||
}
|
||||
for (android.app.ActivityManager.RunningAppProcessInfo processInfo : manager.getRunningAppProcesses()) {
|
||||
if (processInfo == null) {
|
||||
continue;
|
||||
}
|
||||
if (processInfo.pid == pid) {
|
||||
return processInfo.processName;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,269 @@
|
||||
package com.rehome.meetingbook;
|
||||
|
||||
import android.app.DownloadManager;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.GridView;
|
||||
|
||||
|
||||
import com.rehome.meetingbook.adapter.GridViewAdapter;
|
||||
import com.rehome.meetingbook.base.BaseActivity2;
|
||||
import com.rehome.meetingbook.bean.GridViewBean;
|
||||
import com.rehome.meetingbook.databinding.ActivityMainBinding;
|
||||
import com.rehome.meetingbook.ui.activity.LoginActivity;
|
||||
import com.rehome.meetingbook.ui.activity.SimpleActivity;
|
||||
import com.rehome.meetingbook.utils.ControllerActivity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class MainActivity extends BaseActivity2<ActivityMainBinding> {
|
||||
|
||||
GridView gv;
|
||||
private List<GridViewBean> beanList = new ArrayList<>();
|
||||
private GridViewAdapter adapter;
|
||||
|
||||
private List<String> dialogDatas;
|
||||
private List<String> dialogDatas2;
|
||||
DownloadManager DM, mDownloadManager;
|
||||
private long downloadId;
|
||||
private boolean isTask = false;//是否有任务
|
||||
private long exitTime = 0;
|
||||
// private String[] str = {"考试预约", "预约记录", "安健环巡查", "综合巡查", "行为安全观察", "工单录入", "巡视抄表", "定期工作", "定期工作"};
|
||||
// private int[] imageId = {R.mipmap.appointment,
|
||||
// R.mipmap.appointment_record,
|
||||
// R.mipmap.icon10,
|
||||
// R.mipmap.icon12,
|
||||
// R.mipmap.icon14,
|
||||
// R.mipmap.icon13,
|
||||
// R.mipmap.icon6, R.mipmap.dingqi, R.mipmap.dingqi
|
||||
// };
|
||||
// private int[] colors = {R.drawable.radius_a1, R.drawable.radius_a2,
|
||||
// R.drawable.radius_a3, R.drawable.radius_a4,
|
||||
// R.drawable.radius_d3, R.drawable.radius_c5, R.drawable.radius_e3, R.drawable.radius_a1,
|
||||
// R.drawable.radius_a2};
|
||||
|
||||
private String[] str = {
|
||||
"考试预约", "预约查询", "预约一览"
|
||||
};
|
||||
private int[] imageId = {
|
||||
R.mipmap.appointment,
|
||||
R.mipmap.appointment_record,
|
||||
R.mipmap.icon13
|
||||
};
|
||||
private int[] colors = {
|
||||
R.drawable.radius_a1,
|
||||
R.drawable.radius_a2,
|
||||
R.drawable.radius_a3
|
||||
};
|
||||
private List<Integer> item;
|
||||
|
||||
private String idCardNo;
|
||||
private String xm;
|
||||
|
||||
|
||||
// android:background="@drawable/home_bg"
|
||||
|
||||
|
||||
@Override
|
||||
protected ActivityMainBinding getBinding() {
|
||||
return ActivityMainBinding.inflate(LayoutInflater.from(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Toolbar getToolbar() {
|
||||
return binding.toolbarView.toolbar;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
|
||||
|
||||
binding.toolbarView.title.setText("承包商考试预约");
|
||||
mToolbar.setBackgroundColor(Color.parseColor("#00000000"));
|
||||
gv = findViewById(R.id.gv);
|
||||
setExitZx();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
|
||||
Intent intent = getIntent();
|
||||
idCardNo = intent.getStringExtra("idCardNo");
|
||||
xm = intent.getStringExtra("xm");
|
||||
|
||||
dialogDatas = new ArrayList<>();
|
||||
dialogDatas2 = new ArrayList<>();
|
||||
|
||||
|
||||
item = new ArrayList<>();
|
||||
|
||||
beanList.addAll(getGridViewData(isTask));
|
||||
|
||||
gv.setSelector(new ColorDrawable(Color.TRANSPARENT));
|
||||
adapter = new GridViewAdapter(this, beanList, item, true);
|
||||
gv.setAdapter(adapter);
|
||||
|
||||
|
||||
gv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
|
||||
Intent intent;
|
||||
switch (position) {
|
||||
case 0:
|
||||
|
||||
// intent = new Intent();
|
||||
// intent.setClass(MainActivity.this, ExamAppointmentActivity.class);
|
||||
// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
// intent.putExtra("idCardNo", idCardNo);
|
||||
// startActivity(intent);
|
||||
|
||||
break;
|
||||
case 1:
|
||||
|
||||
// intent = new Intent();
|
||||
// intent.setClass(MainActivity.this, AppointmentListActivity.class);
|
||||
// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
// intent.putExtra("idCardNo", idCardNo);
|
||||
// startActivity(intent);
|
||||
|
||||
break;
|
||||
case 2:
|
||||
|
||||
intent = new Intent();
|
||||
//intent.setClass(MainActivity.this, AppointmentDateActivity.class);
|
||||
intent.setClass(MainActivity.this, SimpleActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
intent.putExtra("idCardNo", idCardNo);
|
||||
startActivity(intent);
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 按两次返回键退出程序
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK
|
||||
&& event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
if ((System.currentTimeMillis() - exitTime) > 2000) {
|
||||
showToast("再按一次退出程序");
|
||||
exitTime = System.currentTimeMillis();
|
||||
} else {
|
||||
ControllerActivity.getAppManager().finishAllActivity();
|
||||
finish();
|
||||
System.exit(0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
private void setExitZx() {
|
||||
mToolbar.setNavigationIcon(R.mipmap.back);
|
||||
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle("提示");
|
||||
builder.setMessage("你确定要退出程序?");
|
||||
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
ControllerActivity.getAppManager().finishAllActivity();
|
||||
finish();
|
||||
System.exit(0);
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
builder.create().show();
|
||||
|
||||
}
|
||||
});
|
||||
mToolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
|
||||
switch (item.getItemId()) {
|
||||
case R.id.zx:
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle("提示");
|
||||
builder.setMessage("您确定要注销吗?");
|
||||
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
ControllerActivity.getAppManager().finishAllActivity();
|
||||
Intent intent = new Intent(MainActivity.this, LoginActivity.class);
|
||||
startActivity(intent);
|
||||
//finish();
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
builder.create().show();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param isTask 是否有行为安全观察任务
|
||||
* @return
|
||||
*/
|
||||
private List<GridViewBean> getGridViewData(boolean isTask) {
|
||||
|
||||
List<GridViewBean> datas = new ArrayList<>();
|
||||
for (int i = 0; i < str.length; i++) {
|
||||
GridViewBean bean = new GridViewBean();
|
||||
bean.setTitle(str[i]);
|
||||
bean.setBackgroup(colors[i]);
|
||||
bean.setImageid(imageId[i]);
|
||||
bean.setShow(isTask);
|
||||
datas.add(bean);
|
||||
}
|
||||
|
||||
return datas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.menu, menu);
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,163 @@
|
||||
package com.rehome.meetingbook.ZKUSBManager;
|
||||
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.hardware.usb.UsbDevice;
|
||||
import android.hardware.usb.UsbManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* usb permission and hotplug
|
||||
*/
|
||||
public class ZKUSBManager {
|
||||
//usb's vendor id
|
||||
private int vid = 0;
|
||||
//usb's product id
|
||||
private int pid = 0;
|
||||
//application context
|
||||
private Context mContext = null;
|
||||
|
||||
/////////////////////////////////////////////
|
||||
//for usb permission
|
||||
private static final String SOURCE_STRING = "0123456789-_abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ";
|
||||
private static final int DEFAULT_LENGTH = 16;
|
||||
private String ACTION_USB_PERMISSION;
|
||||
private boolean mbRegisterFilter = false;
|
||||
private ZKUSBManagerListener zknirusbManagerListener = null;
|
||||
|
||||
private BroadcastReceiver usbMgrReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
if (ACTION_USB_PERMISSION.equals(action))
|
||||
{
|
||||
UsbDevice device = (UsbDevice)intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
|
||||
if (device.getVendorId() == vid && device.getProductId() == pid) {
|
||||
if (intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false)) {
|
||||
zknirusbManagerListener.onCheckPermission(0);
|
||||
} else {
|
||||
zknirusbManagerListener.onCheckPermission(-2);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (UsbManager.ACTION_USB_DEVICE_ATTACHED.equals(action))
|
||||
{
|
||||
UsbDevice device = (UsbDevice)intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
|
||||
if (device.getVendorId() == vid && device.getProductId() == pid) {
|
||||
zknirusbManagerListener.onUSBArrived(device);
|
||||
}
|
||||
}
|
||||
else if (UsbManager.ACTION_USB_DEVICE_DETACHED.equals(action))
|
||||
{
|
||||
UsbDevice device = (UsbDevice)intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
|
||||
if (device.getVendorId() == vid && device.getProductId() == pid) {
|
||||
zknirusbManagerListener.onUSBRemoved(device);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
private boolean isNullOrEmpty(String target) {
|
||||
if (null == target || "".equals(target) || target.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private String createRandomString(String source, int length) {
|
||||
if (this.isNullOrEmpty(source)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
StringBuffer result = new StringBuffer();
|
||||
Random random = new Random();
|
||||
|
||||
for(int index = 0; index < length; index++) {
|
||||
result.append(source.charAt(random.nextInt(source.length())));
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public boolean registerUSBPermissionReceiver()
|
||||
{
|
||||
if (null == mContext || mbRegisterFilter)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(ACTION_USB_PERMISSION);
|
||||
filter.addAction(UsbManager.ACTION_USB_DEVICE_ATTACHED);
|
||||
filter.addAction(UsbManager.ACTION_USB_DEVICE_DETACHED);
|
||||
mContext.registerReceiver(usbMgrReceiver, filter);
|
||||
mbRegisterFilter = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void unRegisterUSBPermissionReceiver()
|
||||
{
|
||||
if (null == mContext || !mbRegisterFilter)
|
||||
{
|
||||
return;
|
||||
}
|
||||
mContext.unregisterReceiver(usbMgrReceiver);
|
||||
mbRegisterFilter = false;
|
||||
}
|
||||
|
||||
|
||||
//End USB Permission
|
||||
/////////////////////////////////////////////
|
||||
|
||||
public ZKUSBManager(@NonNull Context context, @NonNull ZKUSBManagerListener listener)
|
||||
{
|
||||
super();
|
||||
if (null == context || null == listener)
|
||||
{
|
||||
throw new NullPointerException("context or listener is null");
|
||||
}
|
||||
zknirusbManagerListener = listener;
|
||||
ACTION_USB_PERMISSION = createRandomString(SOURCE_STRING, DEFAULT_LENGTH);
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
//0 means success
|
||||
//-1 means device no found
|
||||
//-2 means device no permission
|
||||
public void initUSBPermission(int vid, int pid){
|
||||
UsbManager usbManager = (UsbManager)mContext.getSystemService(Context.USB_SERVICE);
|
||||
UsbDevice usbDevice = null;
|
||||
for (UsbDevice device : usbManager.getDeviceList().values()) {
|
||||
int device_vid = device.getVendorId();
|
||||
int device_pid = device.getProductId();
|
||||
if (device_vid == vid && device_pid == pid)
|
||||
{
|
||||
usbDevice = device;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (null == usbDevice)
|
||||
{
|
||||
zknirusbManagerListener.onCheckPermission(-1);
|
||||
return;
|
||||
}
|
||||
this.vid = vid;
|
||||
this.pid = pid;
|
||||
if (!usbManager.hasPermission(usbDevice))
|
||||
{
|
||||
Intent intent = new Intent(this.ACTION_USB_PERMISSION);
|
||||
PendingIntent pendingIntent = PendingIntent.getBroadcast(mContext, 0, intent, 0);
|
||||
usbManager.requestPermission(usbDevice, pendingIntent);
|
||||
}
|
||||
else {
|
||||
zknirusbManagerListener.onCheckPermission(0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.rehome.meetingbook.ZKUSBManager;
|
||||
|
||||
|
||||
import android.hardware.usb.UsbDevice;
|
||||
|
||||
public interface ZKUSBManagerListener
|
||||
{
|
||||
//0 means success
|
||||
//-1 means device no found
|
||||
//-2 means device no permission
|
||||
void onCheckPermission(int result);
|
||||
|
||||
void onUSBArrived(UsbDevice device);
|
||||
|
||||
void onUSBRemoved(UsbDevice device);
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
package com.rehome.meetingbook.base;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
|
||||
/**
|
||||
* Created by ruihong on 2017/10/28.
|
||||
*/
|
||||
|
||||
public abstract class BaseFragment2 extends Fragment {
|
||||
|
||||
public static final int CX_FLAG = 0;//查询的状态码
|
||||
public static final int SC_FLAG = 1;//上传的状态码
|
||||
|
||||
public abstract int getContentViewId();
|
||||
|
||||
public Activity mActivity;
|
||||
public View view;
|
||||
|
||||
public Context context;
|
||||
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
this.context = context;
|
||||
mActivity = getActivity();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
view = inflater.inflate(getContentViewId(), container, false);
|
||||
//Logger.v("fragment:" + getClass().getSimpleName());
|
||||
initView();
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
initData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化视图
|
||||
*/
|
||||
protected abstract void initView();
|
||||
|
||||
/**
|
||||
* 初始化数据
|
||||
*/
|
||||
public void initData() {
|
||||
|
||||
}
|
||||
|
||||
public void showToast(String text) {
|
||||
if (text != null && !text.trim().equals("")) {
|
||||
Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
package com.rehome.meetingbook.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 预约等级
|
||||
*/
|
||||
public class AppointmentLevelBean {
|
||||
private String Total;
|
||||
private List<RowsBean> Rows;
|
||||
|
||||
public String getTotal() {
|
||||
return Total;
|
||||
}
|
||||
|
||||
public void setTotal(String Total) {
|
||||
this.Total = Total;
|
||||
}
|
||||
|
||||
public List<RowsBean> getRows() {
|
||||
return Rows;
|
||||
}
|
||||
|
||||
public void setRows(List<RowsBean> Rows) {
|
||||
this.Rows = Rows;
|
||||
}
|
||||
|
||||
public static class RowsBean {
|
||||
|
||||
//id
|
||||
private String id;
|
||||
//预约等级
|
||||
private String text;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
package com.rehome.meetingbook.bean;
|
||||
|
||||
/**
|
||||
* 可预约人数
|
||||
*/
|
||||
public class AppointmentMemberCount {
|
||||
private boolean isyy;
|
||||
private int rs;
|
||||
private String msg;
|
||||
private String times;
|
||||
private String timee;
|
||||
|
||||
public boolean isIsyy() {
|
||||
return isyy;
|
||||
}
|
||||
|
||||
public void setIsyy(boolean isyy) {
|
||||
this.isyy = isyy;
|
||||
}
|
||||
|
||||
public int getRs() {
|
||||
return rs;
|
||||
}
|
||||
|
||||
public void setRs(int rs) {
|
||||
this.rs = rs;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public String getTimes() {
|
||||
return times;
|
||||
}
|
||||
|
||||
public void setTimes(String times) {
|
||||
this.times = times;
|
||||
}
|
||||
|
||||
public String getTimee() {
|
||||
return timee;
|
||||
}
|
||||
|
||||
public void setTimee(String timee) {
|
||||
this.timee = timee;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
package com.rehome.meetingbook.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 部门
|
||||
*/
|
||||
public class DeptBean {
|
||||
private String Total;
|
||||
private List<RowsBean> Rows;
|
||||
|
||||
public String getTotal() {
|
||||
return Total;
|
||||
}
|
||||
|
||||
public void setTotal(String Total) {
|
||||
this.Total = Total;
|
||||
}
|
||||
|
||||
public List<RowsBean> getRows() {
|
||||
return Rows;
|
||||
}
|
||||
|
||||
public void setRows(List<RowsBean> Rows) {
|
||||
this.Rows = Rows;
|
||||
}
|
||||
|
||||
public static class RowsBean {
|
||||
|
||||
|
||||
private String deptname;
|
||||
private String deptcode;
|
||||
|
||||
public String getDeptname() {
|
||||
return deptname;
|
||||
}
|
||||
|
||||
public void setDeptname(String deptname) {
|
||||
this.deptname = deptname;
|
||||
}
|
||||
|
||||
public String getDeptcode() {
|
||||
return deptcode;
|
||||
}
|
||||
|
||||
public void setDeptcode(String deptcode) {
|
||||
this.deptcode = deptcode;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
package com.rehome.meetingbook.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 班组
|
||||
*/
|
||||
public class DeptBzBean {
|
||||
private String Total;
|
||||
private List<RowsBean> Rows;
|
||||
|
||||
public String getTotal() {
|
||||
return Total;
|
||||
}
|
||||
|
||||
public void setTotal(String Total) {
|
||||
this.Total = Total;
|
||||
}
|
||||
|
||||
public List<RowsBean> getRows() {
|
||||
return Rows;
|
||||
}
|
||||
|
||||
public void setRows(List<RowsBean> Rows) {
|
||||
this.Rows = Rows;
|
||||
}
|
||||
|
||||
public static class RowsBean {
|
||||
|
||||
|
||||
private String deptname;
|
||||
private String deptcode;
|
||||
|
||||
public String getDeptname() {
|
||||
return deptname;
|
||||
}
|
||||
|
||||
public void setDeptname(String deptname) {
|
||||
this.deptname = deptname;
|
||||
}
|
||||
|
||||
public String getDeptcode() {
|
||||
return deptcode;
|
||||
}
|
||||
|
||||
public void setDeptcode(String deptcode) {
|
||||
this.deptcode = deptcode;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package com.rehome.meetingbook.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 厂内人员信息
|
||||
*/
|
||||
public class WorkMemberBean {
|
||||
private String Total;
|
||||
private List<DeptBean.RowsBean> Rows;
|
||||
|
||||
public String getTotal() {
|
||||
return Total;
|
||||
}
|
||||
|
||||
public void setTotal(String Total) {
|
||||
this.Total = Total;
|
||||
}
|
||||
|
||||
public List<DeptBean.RowsBean> getRows() {
|
||||
return Rows;
|
||||
}
|
||||
|
||||
public void setRows(List<DeptBean.RowsBean> Rows) {
|
||||
this.Rows = Rows;
|
||||
}
|
||||
|
||||
public static class RowsBean {
|
||||
|
||||
|
||||
private String man_id;
|
||||
private String name;
|
||||
private String deptname;
|
||||
private String deptcode;
|
||||
|
||||
public String getMan_id() {
|
||||
return man_id;
|
||||
}
|
||||
|
||||
public void setMan_id(String man_id) {
|
||||
this.man_id = man_id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDeptname() {
|
||||
return deptname;
|
||||
}
|
||||
|
||||
public void setDeptname(String deptname) {
|
||||
this.deptname = deptname;
|
||||
}
|
||||
|
||||
public String getDeptcode() {
|
||||
return deptcode;
|
||||
}
|
||||
|
||||
public void setDeptcode(String deptcode) {
|
||||
this.deptcode = deptcode;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,341 @@
|
||||
package com.rehome.meetingbook.ui.activity;
|
||||
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.haibin.calendarview.Calendar;
|
||||
import com.haibin.calendarview.CalendarView;
|
||||
import com.rehome.meetingbook.Contans;
|
||||
import com.rehome.meetingbook.R;
|
||||
import com.rehome.meetingbook.adapter.AppointmentDateAdapter;
|
||||
import com.rehome.meetingbook.adapter.YunQingExalAdapter;
|
||||
import com.rehome.meetingbook.base.BaseActivity2;
|
||||
import com.rehome.meetingbook.bean.AppointmentDateDetailListBean;
|
||||
import com.rehome.meetingbook.bean.AppointmentDateListBean;
|
||||
import com.rehome.meetingbook.bean.AppointmentLevelBean;
|
||||
import com.rehome.meetingbook.bean.YunQingExalBean;
|
||||
import com.rehome.meetingbook.databinding.ActivitySimpleBinding;
|
||||
import com.rehome.meetingbook.utils.GsonUtils;
|
||||
import com.rehome.meetingbook.utils.HttpListener;
|
||||
import com.rehome.meetingbook.utils.NoProgresshttpUtils;
|
||||
import com.rehome.meetingbook.utils.StatusBarUtil;
|
||||
import com.yolanda.nohttp.NoHttp;
|
||||
import com.yolanda.nohttp.RequestMethod;
|
||||
import com.yolanda.nohttp.rest.Request;
|
||||
import com.yolanda.nohttp.rest.Response;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class SimpleActivity extends BaseActivity2<ActivitySimpleBinding>implements
|
||||
CalendarView.OnCalendarSelectListener,
|
||||
CalendarView.OnYearChangeListener{
|
||||
|
||||
private int mYear;
|
||||
|
||||
//培训考试模式
|
||||
private List<AppointmentLevelBean.RowsBean> appointmentExamModel;
|
||||
//日常培训考试
|
||||
private List<AppointmentDateDetailListBean.RowsBean> daylyExamList;
|
||||
private AppointmentDateAdapter daylyAdapter;
|
||||
//运行部考试
|
||||
private List<YunQingExalBean.RowsBean> yqExalList;
|
||||
private YunQingExalAdapter yqExalAdapter;
|
||||
|
||||
@Override
|
||||
protected ActivitySimpleBinding getBinding() {
|
||||
return ActivitySimpleBinding.inflate(LayoutInflater.from(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Toolbar getToolbar() {
|
||||
return binding.toolbarView.toolbar;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
|
||||
StatusBarUtil.setColor(SimpleActivity.this, Color.parseColor("#138CF2"));
|
||||
binding.toolbarView.title.setText("预约一览");
|
||||
setExitZx();
|
||||
|
||||
appointmentExamModel = new ArrayList<>();
|
||||
daylyExamList = new ArrayList<>();
|
||||
yqExalList = new ArrayList<>();
|
||||
daylyAdapter = new AppointmentDateAdapter(SimpleActivity.this,daylyExamList);
|
||||
yqExalAdapter = new YunQingExalAdapter(SimpleActivity.this,yqExalList);
|
||||
binding.lvAppointmentDayly.setAdapter(daylyAdapter);
|
||||
binding.lvAppointmentYy.setAdapter(yqExalAdapter);
|
||||
|
||||
|
||||
mYear = binding.calendarView.getCurYear();
|
||||
binding.tvYear.setText(String.valueOf(binding.calendarView.getCurYear()));
|
||||
binding.flCurrent.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
binding.calendarView.scrollToCurrent();
|
||||
}
|
||||
});
|
||||
|
||||
binding.tvMonthDay.setText(binding.calendarView.getCurMonth() + "月" + binding.calendarView.getCurDay() + "日");
|
||||
binding.tvLunar.setText("今日");
|
||||
binding.tvCurrentDay.setText(String.valueOf(binding.calendarView.getCurDay()));
|
||||
|
||||
binding.calendarView.setOnYearChangeListener(this);
|
||||
binding.calendarView.setOnCalendarSelectListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
|
||||
// int year = binding.calendarView.getCurYear();
|
||||
// int month = binding.calendarView.getCurMonth();
|
||||
//
|
||||
// Map<String, Calendar> map = new HashMap<>();
|
||||
// map.put(getSchemeCalendar(year, month, 3, 0xFF40db25, "假").toString(),
|
||||
// getSchemeCalendar(year, month, 3, 0xFF40db25, "假"));
|
||||
// map.put(getSchemeCalendar(year, month, 6, 0xFF40db25, "事").toString(),
|
||||
// getSchemeCalendar(year, month, 6, 0xFF40db25, "事"));
|
||||
// map.put(getSchemeCalendar(year, month, 9, 0xFF40db25, "议").toString(),
|
||||
// getSchemeCalendar(year, month, 9, 0xFF40db25, "议"));
|
||||
// map.put(getSchemeCalendar(year, month, 13, 0xFF40db25, "记").toString(),
|
||||
// getSchemeCalendar(year, month, 13, 0xFF40db25, "记"));
|
||||
// map.put(getSchemeCalendar(year, month, 14, 0xFF40db25, "记").toString(),
|
||||
// getSchemeCalendar(year, month, 14, 0xFF40db25, "记"));
|
||||
// map.put(getSchemeCalendar(year, month, 15, 0xFF40db25, "假").toString(),
|
||||
// getSchemeCalendar(year, month, 15, 0xFF40db25, "假"));
|
||||
// map.put(getSchemeCalendar(year, month, 18, 0xFF40db25, "记").toString(),
|
||||
// getSchemeCalendar(year, month, 18, 0xFF40db25, "记"));
|
||||
// map.put(getSchemeCalendar(year, month, 25, 0xFF40db25, "假").toString(),
|
||||
// getSchemeCalendar(year, month, 25, 0xFF40db25, "假"));
|
||||
// map.put(getSchemeCalendar(year, month, 27, 0xFF40db25, "多").toString(),
|
||||
// getSchemeCalendar(year, month, 27, 0xFF40db25, "多"));
|
||||
// //此方法在巨大的数据量上不影响遍历性能,推荐使用
|
||||
// binding.calendarView.setSchemeDate(map);
|
||||
|
||||
//获取培训考试模式
|
||||
getExamModel();
|
||||
}
|
||||
|
||||
private Calendar getSchemeCalendar(int year, int month, int day, int color, String text) {
|
||||
Calendar calendar = new Calendar();
|
||||
calendar.setYear(year);
|
||||
calendar.setMonth(month);
|
||||
calendar.setDay(day);
|
||||
calendar.setSchemeColor(color);//如果单独标记颜色、则会使用这个颜色
|
||||
calendar.setScheme(text);
|
||||
return calendar;
|
||||
}
|
||||
|
||||
private void setExitZx() {
|
||||
mToolbar.setNavigationIcon(R.mipmap.back);
|
||||
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCalendarOutOfRange(Calendar calendar) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCalendarSelect(Calendar calendar, boolean isClick) {
|
||||
binding.tvLunar.setVisibility(View.VISIBLE);
|
||||
binding.tvYear.setVisibility(View.VISIBLE);
|
||||
binding.tvMonthDay.setText(calendar.getMonth() + "月" + calendar.getDay() + "日");
|
||||
binding.tvYear.setText(String.valueOf(calendar.getYear()));
|
||||
binding.tvLunar.setText(calendar.getLunar());
|
||||
mYear = calendar.getYear();
|
||||
Log.i("app","onCalendarSelect");
|
||||
Log.i("app",String.valueOf(calendar.getYear())+"-"+String.valueOf(calendar.getMonth())+"-"+calendar.getDay());
|
||||
|
||||
getDateDetailList(String.valueOf(calendar.getYear())+"-"+String.format("%02d", calendar.getMonth())+"-"+String.format("%02d", calendar.getDay()));
|
||||
//获取生产岗位培训室使用时间
|
||||
getScgwDateDetailList(String.valueOf(calendar.getYear())+"-"+String.format("%02d", calendar.getMonth())+"-"+String.format("%02d", calendar.getDay()));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onYearChange(int year) {
|
||||
binding.tvMonthDay.setText(String.valueOf(year));
|
||||
}
|
||||
|
||||
private void getExamModel() {
|
||||
|
||||
String url = Contans.BASE_URL + Contans.GET_YYTYPEANDEXAMMODEL_URL + "PSKSMS";
|
||||
Log.i("app", url);
|
||||
Request<String> request = NoHttp.createStringRequest(url, RequestMethod.GET);
|
||||
|
||||
NoProgresshttpUtils.getInstance().add(0, request, new HttpListener<String>() {
|
||||
|
||||
@Override
|
||||
public void onSucceed(int what, Response<String> response) {
|
||||
|
||||
Log.i("app", "----------------");
|
||||
String result = response.get();
|
||||
Log.i("app", result);
|
||||
|
||||
AppointmentLevelBean bean = GsonUtils.GsonToBean(result, AppointmentLevelBean.class);
|
||||
if (bean != null && bean.getRows() != null && bean.getRows().size() > 0) {
|
||||
appointmentExamModel.clear();
|
||||
appointmentExamModel.addAll(bean.getRows());
|
||||
//获取有预约的日期(从当前时间起)
|
||||
getDateList();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(int what, Response<String> response) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
//获取有预约的日期(从当前时间起)
|
||||
private void getDateList() {
|
||||
|
||||
String url = Contans.BASE_URL + Contans.GET_YYDATE_URL;
|
||||
Log.i("app", url);
|
||||
Request<String> request = NoHttp.createStringRequest(url, RequestMethod.GET);
|
||||
|
||||
NoProgresshttpUtils.getInstance().add(0, request, new HttpListener<String>() {
|
||||
|
||||
@Override
|
||||
public void onSucceed(int what, Response<String> response) {
|
||||
|
||||
Log.i("app", "----------------");
|
||||
String result = response.get();
|
||||
Log.i("app", result);
|
||||
|
||||
AppointmentDateListBean bean = GsonUtils.GsonToBean(result, AppointmentDateListBean.class);
|
||||
if (bean != null) {
|
||||
if (bean.getRows() != null && bean.getRows().size() > 0) {
|
||||
Map<String, Calendar> map = new HashMap<>();
|
||||
for (AppointmentDateListBean.RowsBean item:bean.getRows()) {
|
||||
if(!TextUtils.isEmpty(item.getYyrq())){
|
||||
String year = item.getYyrq().substring(0,4);
|
||||
String month = item.getYyrq().substring(5,7);
|
||||
String day = item.getYyrq().substring(8,10);
|
||||
map.put(getSchemeCalendar(Integer.parseInt(year),Integer.parseInt(month),Integer.parseInt(day),0xFF40db25,"假").toString(),
|
||||
getSchemeCalendar(Integer.parseInt(year),Integer.parseInt(month),Integer.parseInt(day),0xFF40db25,"假"));
|
||||
}
|
||||
}
|
||||
//此方法在巨大的数据量上不影响遍历性能,推荐使用
|
||||
binding.calendarView.setSchemeDate(map);
|
||||
// //获取每天预约详细
|
||||
// getDateDetailList(bean.getRows().get(0).getYyrq());
|
||||
// //获取生产岗位培训室使用时间
|
||||
// getScgwDateDetailList(bean.getRows().get(0).getYyrq());
|
||||
|
||||
binding.calendarView.scrollToCurrent();
|
||||
}
|
||||
} else {
|
||||
showToast("预约数据");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(int what, Response<String> response) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//获取每天预约详细
|
||||
private void getDateDetailList(String dateStr) {
|
||||
|
||||
binding.tvTimeDay1.setText(dateStr+":");
|
||||
binding.tvTimeDay3.setText(dateStr+":");
|
||||
String url = Contans.BASE_URL + Contans.GET_YYDATEDETAILLIST_URL+dateStr;
|
||||
Log.i("app", url);
|
||||
Request<String> request = NoHttp.createStringRequest(url, RequestMethod.GET);
|
||||
|
||||
NoProgresshttpUtils.getInstance().add(0, request, new HttpListener<String>() {
|
||||
|
||||
@Override
|
||||
public void onSucceed(int what, Response<String> response) {
|
||||
|
||||
Log.i("app", "----------------");
|
||||
String result = response.get();
|
||||
Log.i("app", result);
|
||||
|
||||
AppointmentDateDetailListBean bean = GsonUtils.GsonToBean(result, AppointmentDateDetailListBean.class);
|
||||
if (bean != null) {
|
||||
if (bean.getRows() != null && bean.getRows().size() > 0) {
|
||||
if(appointmentExamModel.size()>0){
|
||||
String idDayly = "";
|
||||
daylyExamList.clear();
|
||||
for (AppointmentLevelBean.RowsBean modelItem:appointmentExamModel) {
|
||||
if(modelItem.getText().equals("日常培训考试")){
|
||||
idDayly = modelItem.getId();
|
||||
}
|
||||
}
|
||||
for (AppointmentDateDetailListBean.RowsBean item:bean.getRows()) {
|
||||
if(item.getPsmodel().equals(idDayly)){
|
||||
daylyExamList.add(item);
|
||||
}
|
||||
}
|
||||
daylyAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}else{
|
||||
daylyExamList.clear();
|
||||
daylyAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(int what, Response<String> response) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
//获取每天预约详细
|
||||
private void getScgwDateDetailList(String dateStr) {
|
||||
|
||||
String url = Contans.BASE_URL + Contans.GET_YYDATESCGW_URL+dateStr;
|
||||
Log.i("app", url);
|
||||
Request<String> request = NoHttp.createStringRequest(url, RequestMethod.GET);
|
||||
|
||||
NoProgresshttpUtils.getInstance().add(0, request, new HttpListener<String>() {
|
||||
|
||||
@Override
|
||||
public void onSucceed(int what, Response<String> response) {
|
||||
|
||||
Log.i("app", "----------------");
|
||||
String result = response.get();
|
||||
Log.i("app", result);
|
||||
|
||||
YunQingExalBean bean = GsonUtils.GsonToBean(result, YunQingExalBean.class);
|
||||
if (bean != null) {
|
||||
if (bean.getRows() != null && bean.getRows().size() > 0) {
|
||||
yqExalList.clear();
|
||||
yqExalList.addAll(bean.getRows());
|
||||
yqExalAdapter.notifyDataSetChanged();
|
||||
}else{
|
||||
yqExalList.clear();
|
||||
yqExalAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(int what, Response<String> response) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,128 @@
|
||||
package com.rehome.meetingbook.weiget;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Display;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.rehome.meetingbook.R;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Rehome-rjb1 on 2017/5/17.
|
||||
* 加载框1
|
||||
*/
|
||||
|
||||
public class LoadDialog extends Dialog {
|
||||
|
||||
|
||||
private static LoadDialog loadDialog;
|
||||
|
||||
private final boolean cancelable;
|
||||
|
||||
private final String tipMsg;
|
||||
|
||||
|
||||
public LoadDialog(final Context ctx, boolean cancelable, String tipMsg) {
|
||||
super(ctx);
|
||||
|
||||
this.cancelable = cancelable;
|
||||
this.tipMsg = tipMsg;
|
||||
|
||||
this.getContext().setTheme(android.R.style.Theme_DeviceDefault_Dialog_NoActionBar_MinWidth);
|
||||
setContentView(R.layout.layout_dialog);
|
||||
// 必须放在加载布局后
|
||||
setparams();
|
||||
TextView tv = findViewById(R.id.tvLoad);
|
||||
if (!TextUtils.isEmpty(tipMsg)) {
|
||||
tv.setVisibility(View.VISIBLE);
|
||||
tv.setText(tipMsg);
|
||||
}
|
||||
}
|
||||
|
||||
private void setparams() {
|
||||
this.setCancelable(cancelable);
|
||||
this.setCanceledOnTouchOutside(false);
|
||||
WindowManager windowManager = getWindow().getWindowManager();
|
||||
Display display = windowManager.getDefaultDisplay();
|
||||
WindowManager.LayoutParams lp = this.getWindow().getAttributes();
|
||||
// Dialog宽度
|
||||
lp.width = (int) (display.getWidth() * 0.7);
|
||||
Window window = getWindow();
|
||||
window.setAttributes(lp);
|
||||
window.getDecorView().getBackground().setAlpha(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
if (!cancelable) {
|
||||
Toast.makeText(getContext(), tipMsg, Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
|
||||
public static void show(Context context) {
|
||||
show(context, null, true);
|
||||
}
|
||||
|
||||
|
||||
public static void show(Context context, String message) {
|
||||
show(context, message, true);
|
||||
}
|
||||
|
||||
|
||||
public static void show(Context context, int resourceId) {
|
||||
show(context, context.getResources().getString(resourceId), true);
|
||||
}
|
||||
|
||||
|
||||
private static void show(Context context, String message, boolean cancelable) {
|
||||
if (context instanceof Activity) {
|
||||
if (((Activity) context).isFinishing()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (loadDialog != null && loadDialog.isShowing()) {
|
||||
return;
|
||||
}
|
||||
loadDialog = new LoadDialog(context, cancelable, message);
|
||||
loadDialog.show();
|
||||
}
|
||||
|
||||
public static void dismiss(Context context) {
|
||||
try {
|
||||
if (context instanceof Activity) {
|
||||
if (((Activity) context).isFinishing()) {
|
||||
loadDialog = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (loadDialog != null && loadDialog.isShowing()) {
|
||||
Context loadContext = loadDialog.getContext();
|
||||
if (loadContext != null && loadContext instanceof Activity) {
|
||||
if (((Activity) loadContext).isFinishing()) {
|
||||
loadDialog = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
loadDialog.dismiss();
|
||||
loadDialog = null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
loadDialog = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set android:shareInterpolator="false" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<rotate
|
||||
android:interpolator="@android:anim/linear_interpolator"
|
||||
android:pivotX="50%"
|
||||
android:pivotY="50%"
|
||||
android:fromDegrees="0"
|
||||
android:toDegrees="+360"
|
||||
android:duration="1500"
|
||||
android:startOffset="-1"
|
||||
android:repeatMode="restart"
|
||||
android:repeatCount="-1"/>
|
||||
</set>
|
||||
@ -0,0 +1,30 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
||||
|
After Width: | Height: | Size: 225 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- 点击背景 -->
|
||||
<item android:state_pressed="true">
|
||||
<shape>
|
||||
<corners android:radius="8dp" />
|
||||
<solid android:color="#111176e8" />
|
||||
<stroke android:width="1dp" android:color="#1176e8" />
|
||||
</shape>
|
||||
</item>
|
||||
<!-- 默认背景 -->
|
||||
<item>
|
||||
<shape>
|
||||
<corners android:radius="8dp" />
|
||||
<solid android:color="#00000000" />
|
||||
<stroke android:width="1px" android:color="#881176e8" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</selector>
|
||||
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true">
|
||||
<shape>
|
||||
<solid android:color="#cfcfcf" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape>
|
||||
<solid android:color="#00000000" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="#fff" />
|
||||
<stroke
|
||||
android:width="1dip"
|
||||
android:color="@color/historyBtnTextColor" />
|
||||
<corners android:radius="3dp" />
|
||||
</shape>
|
||||
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="#ffff00" />
|
||||
<stroke
|
||||
android:width="1dip"
|
||||
android:color="@color/historyBtnTextColor" />
|
||||
<corners android:radius="3dp" />
|
||||
</shape>
|
||||
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- 正常状态 -->
|
||||
<item android:drawable="@drawable/btn_normal" android:state_pressed="false"/>
|
||||
|
||||
<!-- 按下状态 -->
|
||||
<item android:drawable="@drawable/btn_pressed" android:state_pressed="true"/>
|
||||
|
||||
</selector>
|
||||
|
After Width: | Height: | Size: 125 KiB |
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- 禁用状态 -->
|
||||
<item android:color="@color/white" android:state_enabled="false" />
|
||||
|
||||
<!-- 按压状态 -->
|
||||
<item android:color="@color/white" android:state_pressed="true" />
|
||||
|
||||
<!-- 焦点状态 -->
|
||||
<item android:color="@color/white" android:state_focused="true" />
|
||||
|
||||
<!-- 默认状态 -->
|
||||
<item android:color="@color/colorPrimaryDark" />
|
||||
|
||||
</selector>
|
||||
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- 禁用状态 -->
|
||||
<item android:color="@color/white" android:state_enabled="false" />
|
||||
|
||||
<!-- 按压状态 -->
|
||||
<item android:color="@color/white" android:state_pressed="true" />
|
||||
|
||||
<!-- 焦点状态 -->
|
||||
<item android:color="@color/white" android:state_focused="true" />
|
||||
|
||||
<!-- 默认状态 -->
|
||||
<item android:color="@color/colorAccent" />
|
||||
|
||||
</selector>
|
||||
@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 默认获取验证码按钮样式 -->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- 禁用状态 -->
|
||||
<item android:state_enabled="false">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="30dp" />
|
||||
<solid android:color="@color/colorButtonDisable" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<!-- 按压状态 -->
|
||||
<item android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="30dp" />
|
||||
<solid android:color="@color/colorAccent" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<!-- 焦点状态 -->
|
||||
<item android:state_focused="true">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="30dp" />
|
||||
<solid android:color="@color/colorAccent"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<!-- 默认状态 -->
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="30dp" />
|
||||
<stroke android:color="@color/colorPrimaryDark"
|
||||
android:width="1dp"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</selector>
|
||||
@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 默认获取验证码按钮样式 -->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- 禁用状态 -->
|
||||
<item android:state_enabled="false">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="30dp" />
|
||||
<solid android:color="@color/colorButtonDisable" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<!-- 按压状态 -->
|
||||
<item android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="30dp" />
|
||||
<solid android:color="@color/colorAccent" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<!-- 焦点状态 -->
|
||||
<item android:state_focused="true">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="30dp" />
|
||||
<solid android:color="@color/colorAccent"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<!-- 默认状态 -->
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="30dp" />
|
||||
<stroke android:color="@color/colorAccent"
|
||||
android:width="1dp"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</selector>
|
||||
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="1dp" />
|
||||
<padding
|
||||
android:bottom="1dp"
|
||||
android:left="1dp"
|
||||
android:right="1dp"
|
||||
android:top="1dp" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="#CCCCCC" />
|
||||
</shape>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#FFFFFF" />
|
||||
<corners android:radius="5dp" />
|
||||
<padding
|
||||
android:bottom="10px"
|
||||
android:left="10px"
|
||||
android:right="10px"
|
||||
android:top="10px" />
|
||||
</shape>
|
||||
|
After Width: | Height: | Size: 166 B |
|
After Width: | Height: | Size: 969 B |