大理电子班牌(会议签到)程序
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..ed71b20
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,60 @@
+apply plugin: 'com.android.application'
+
+android {
+ signingConfigs {
+ release {
+ storeFile file("$rootDir/keys-app.jks")
+ storePassword '123456'
+ keyAlias = 'sup'
+ keyPassword '123456'
+ }
+ }
+ compileSdkVersion 28
+ defaultConfig {
+ applicationId "com.supwisdom.conferencecheck"
+ minSdkVersion 19
+ targetSdkVersion 25
+ versionCode 1
+ versionName "1.0"
+ ndk {
+ abiFilters 'armeabi-v7a', 'armeabi', 'x86'
+ }
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+ buildToolsVersion = '28.0.3'
+ compileOptions {
+ sourceCompatibility = '1.8'
+ targetCompatibility = '1.8'
+ }
+ android.applicationVariants.all { variant ->
+ variant.outputs.all { output ->
+ def apkName = "conference-v${defaultConfig.versionName}-${defaultConfig.versionCode}.apk"
+ outputFileName = apkName
+ }
+ }
+ lintOptions {
+ checkReleaseBuilds false
+ // Or, if you prefer, you can continue to check for errors in release builds,
+ // but continue the build even when errors are found:
+ abortOnError false
+ }
+}
+
+dependencies {
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ implementation 'com.android.support:appcompat-v7:28.0.0'
+ implementation 'com.android.support.constraint:constraint-layout:1.1.3'
+ testImplementation 'junit:junit:4.12'
+ androidTestImplementation 'com.android.support.test:runner:1.0.2'
+ androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
+ compile 'com.squareup.okhttp3:okhttp:3.10.0'
+ compile 'org.apache.httpcomponents:httpcore:4.4.10'
+ compile 'com.alibaba:fastjson:1.1.70.android'
+ implementation files('libs/smdt.jar')
+ implementation files('libs/zxinglibsl.jar')
+}
diff --git a/app/libs/smdt.jar b/app/libs/smdt.jar
new file mode 100644
index 0000000..102cf05
--- /dev/null
+++ b/app/libs/smdt.jar
Binary files differ
diff --git a/app/libs/zxinglibsl.jar b/app/libs/zxinglibsl.jar
new file mode 100644
index 0000000..c645c93
--- /dev/null
+++ b/app/libs/zxinglibsl.jar
Binary files differ
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..f1b4245
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -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
diff --git a/app/release/conference-v1.0-1.apk b/app/release/conference-v1.0-1.apk
new file mode 100644
index 0000000..248ae27
--- /dev/null
+++ b/app/release/conference-v1.0-1.apk
Binary files differ
diff --git a/app/release/output.json b/app/release/output.json
new file mode 100644
index 0000000..43e4cda
--- /dev/null
+++ b/app/release/output.json
@@ -0,0 +1 @@
+[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0","enabled":true,"outputFile":"conference-v1.0-1.apk","fullName":"release","baseName":"release"},"path":"conference-v1.0-1.apk","properties":{}}]
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..6277142
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:serviceandroid="http://schemas.android.com/tools"
+ package="com.supwisdom.conferencecheck">
+
+ <uses-permission android:name="android.permission.VIBRATE" />
+ <uses-permission
+ android:name="android.permission.WRITE_SETTINGS"
+ serviceandroid:ignore="ProtectedPermissions" />
+ <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
+ <uses-permission
+ android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
+ serviceandroid:ignore="ProtectedPermissions" />
+
+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
+ <uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ <uses-permission android:name="android.permission.CAMERA" />
+ <uses-permission android:name="android.permission.NFC" />
+ <uses-permission android:name="android.permission.READ_PROFILE" />
+ <uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
+ <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
+ <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
+ <uses-permission android:name="android.permission.RECORD_AUDIO" />
+ <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
+ <uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" />
+ <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
+ <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
+ <uses-permission android:name="android.permission.USE_CREDENTIALS" />
+ <uses-permission android:name="android.permission.FLASHLIGHT" />
+ <uses-permission android:name="android.permission.WEITE_EXTERNAL_STORAGE" />
+ <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
+ <uses-permission android:name="android.permission.WAKE_LOCK" />
+
+ <uses-permission
+ android:name="android.permission.WRITE_SECURE_SETTINGS"
+ serviceandroid:ignore="ProtectedPermissions" />
+
+ <uses-feature android:name="android.hardware.camera" />
+ <uses-feature android:name="android.hardware.camera.autofocus" />
+
+ <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
+ <uses-permission
+ android:name="android.permission.READ_LOGS"
+ serviceandroid:ignore="ProtectedPermissions" />
+
+ <application
+ android:name=".SPApplication"
+ android:allowBackup="true"
+ android:icon="@drawable/app_logo"
+ android:label="@string/app_name"
+ android:supportsRtl="true"
+ android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
+ <activity
+ android:name=".activity.SplashActivity"
+ android:launchMode="singleTask">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.HOME" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity
+ android:name=".activity.MainActivity"
+ android:label="会议签到"
+ android:launchMode="singleInstance"
+ />
+
+ <activity
+ android:name=".activity.CheckDetailActivity"
+ android:label="签到详情"
+ android:launchMode="singleTask"
+ />
+
+ <activity
+ android:name=".activity.ManageActivity"
+ android:label="维护管理"
+ android:launchMode="singleTask"
+ />
+
+ <activity
+ android:name=".activity.ConferenceQueryActivity"
+ android:label="本地会议查询"
+ android:launchMode="singleTask"
+ />
+
+ <activity
+ android:name=".activity.ConfigActivity"
+ android:label="配置"
+ android:launchMode="singleTask"
+ />
+
+ </application>
+
+</manifest>
\ No newline at end of file
diff --git a/app/src/main/assets/news_content01.html b/app/src/main/assets/news_content01.html
new file mode 100644
index 0000000..08f55e4
--- /dev/null
+++ b/app/src/main/assets/news_content01.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title></title>
+</head>
+<body bgcolor="#434E5F" oncontextmenu="return false;" onselectstart="return false;">
+<p align="center"> <span
+ style="font-size: 55px;"><strong style='color: rgb(187,187,187);'>苍山洱海</strong></span></p>
+<p> <span
+ style='color: rgb(187,187,187); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: "Microsoft YaHei"; font-size: 46px; font-style: normal; font-weight: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;'></span><span
+ style='color: rgb(187,187,187); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: "Microsoft YaHei"; font-size: 36px; font-style: normal; font-weight: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;'>大理市是大理白族自治州州府所在地,是集国家级历史文化名城、风景名胜区、自然保护区于一身的城市,市内设有省级经济开发区和省级旅游度假区。境内苍山洱海珠联璧合,相映成趣。素有“高原明珠”、“东方瑞士”之美誉。</span>
+</p>
+</p>
+</body>
+</html>
\ No newline at end of file
diff --git a/app/src/main/assets/news_content02.html b/app/src/main/assets/news_content02.html
new file mode 100644
index 0000000..0558b6c
--- /dev/null
+++ b/app/src/main/assets/news_content02.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title></title>
+</head>
+<body bgcolor="#434E5F" oncontextmenu="return false;" onselectstart="return false;">
+<p align="center"> <span
+ style="font-size: 55px;"><strong style='color: rgb(187,187,187);'>苍山洱海</strong></span></p>
+<p> <span
+ style='color: rgb(187,187,187); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: "Microsoft YaHei"; font-size: 26px; font-style: normal; font-weight: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;'></span><span
+ style='color: rgb(187,187,187); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: "Microsoft YaHei"; font-size: 36px; font-style: normal; font-weight: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;'>自1983年县市合并以来,大理市先后荣获“全国双拥模范城”、“全国科技工作先进市”、“全国文化先进市”、“全国体育先进市”、“中国优秀旅游城市”、“最佳中国魅力城市”等多项荣誉称号。</span>
+</p>
+</p>
+</body>
+</html>
\ No newline at end of file
diff --git a/app/src/main/assets/news_content03.html b/app/src/main/assets/news_content03.html
new file mode 100644
index 0000000..a4f0002
--- /dev/null
+++ b/app/src/main/assets/news_content03.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title></title>
+</head>
+<body bgcolor="#434E5F" oncontextmenu="return false;" onselectstart="return false;">
+<p align="center"> <span
+ style="font-size: 55px;"><strong style='color: rgb(187,187,187);'>大理欢迎您</strong></span></p>
+<p> <span
+ style='color: rgb(187,187,187); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: "Microsoft YaHei"; font-size: 26px; font-style: normal; font-weight: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;'></span><span
+ style='color: rgb(187,187,187); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: "Microsoft YaHei"; font-size: 36px; font-style: normal; font-weight: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;'>大理市地处云南省滇西中部,东与宾川、祥云相连,南与巍山、弥渡毗邻,西接漾濞以点苍山为界,北与洱源接壤。下关是大理白族自治州和大理市人民政府所在地,为全州政治、经济、文化中心。距省会昆明350千米。全市总面积1815平方千米。年末常用耕地面积12002公顷。</span>
+</p>
+</p>
+</body>
+</html>
\ No newline at end of file
diff --git a/app/src/main/assets/news_content04.html b/app/src/main/assets/news_content04.html
new file mode 100644
index 0000000..bd8d4be
--- /dev/null
+++ b/app/src/main/assets/news_content04.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title></title>
+</head>
+<body bgcolor="#434E5F" oncontextmenu="return false;" onselectstart="return false;">
+<p align="center"> <span
+ style="font-size: 55px;"><strong style='color: rgb(187,187,187);'>云南要闻</strong></span></p>
+<p> <span
+ style='color: rgb(187,187,187); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: "Microsoft YaHei"; font-size: 26px; font-style: normal; font-weight: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;'></span><span
+ style='color: rgb(187,187,187); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: "Microsoft YaHei"; font-size: 36px; font-style: normal; font-weight: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;'>省政府党组(扩大)会议传达学习习近平总书记重要指示批示和重要讲话精神时强调
+坚决打好森林草原防灭火攻坚战和境外疫情输入防控阻击战 全力保障人民群众生命健康和财产安全</span>
+</p>
+</p>
+</body>
+</html>
\ No newline at end of file
diff --git a/app/src/main/assets/news_content05.html b/app/src/main/assets/news_content05.html
new file mode 100644
index 0000000..de56131
--- /dev/null
+++ b/app/src/main/assets/news_content05.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title></title>
+</head>
+<body bgcolor="#434E5F" oncontextmenu="return false;" onselectstart="return false;">
+<p align="center"> <span
+ style="font-size: 55px;"><strong style='color: rgb(187,187,187);'>大理要闻</strong></span></p>
+<p> <span
+ style='color: rgb(187,187,187); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: "Microsoft YaHei"; font-size: 26px; font-style: normal; font-weight: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;'></span><span
+ style='color: rgb(187,187,187); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: "Microsoft YaHei"; font-size: 36px; font-style: normal; font-weight: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;'>3月24日,中共大理市纪委九届五次全体会议召开。州委常委、市委书记罗永斌出席会议并讲话。他强调,要以习近平新时代中国特色社会主义思想为指导,全面贯彻党的十九届四中全会、十九届中央纪委四次全会、省委十届九次全会、省纪委十届五次全会、州委八届五次全会、州纪委八届五次全会和市委九届九次全会精神,坚持稳中求进工作总基调,深化全面从严治党,坚持和完善党和国家监督体系,强化对权力运行的制约和监督,进一步肃清秦光荣等流毒影响,一体推进不敢腐、不能腐、不想腐,在坚持和完善中国特色社会主义制度、推进国家治理体系和治理能力现代化中,充分发挥监督保障执行、促进完善发展作用,建设高素质专业化纪检监察干部队伍,坚定不移将全面从严治党向纵深推进,为推动大理市高质量可持续发展、决胜全面建成小康社会提供坚强的纪律保障。</span>
+</p>
+</p>
+</body>
+</html>
\ No newline at end of file
diff --git a/app/src/main/assets/news_pic01.html b/app/src/main/assets/news_pic01.html
new file mode 100644
index 0000000..43181bb
--- /dev/null
+++ b/app/src/main/assets/news_pic01.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title></title>
+</head>
+<body>
+ <img src="file:///android_asset/pic1.jpg" width="1200" height="665"/>
+</body>
+</html>
\ No newline at end of file
diff --git a/app/src/main/assets/news_pic02.html b/app/src/main/assets/news_pic02.html
new file mode 100644
index 0000000..6949bf8
--- /dev/null
+++ b/app/src/main/assets/news_pic02.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title></title>
+</head>
+<body>
+ <img src="file:///android_asset/pic2.jpg" width="1200" height="665"/>
+</body>
+</html>
\ No newline at end of file
diff --git a/app/src/main/assets/news_pic03.html b/app/src/main/assets/news_pic03.html
new file mode 100644
index 0000000..afb0902
--- /dev/null
+++ b/app/src/main/assets/news_pic03.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title></title>
+</head>
+<body>
+ <img src="file:///android_asset/pic3.jpg" width="1200" height="665"/>
+</body>
+</html>
\ No newline at end of file
diff --git a/app/src/main/assets/news_pic04.html b/app/src/main/assets/news_pic04.html
new file mode 100644
index 0000000..698f2ef
--- /dev/null
+++ b/app/src/main/assets/news_pic04.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title></title>
+</head>
+<body>
+ <img src="file:///android_asset/pic4.jpg" width="1200" height="665"/>
+</body>
+</html>
\ No newline at end of file
diff --git a/app/src/main/assets/news_pic05.html b/app/src/main/assets/news_pic05.html
new file mode 100644
index 0000000..9c55621
--- /dev/null
+++ b/app/src/main/assets/news_pic05.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title></title>
+</head>
+<body>
+ <img src="file:///android_asset/pic5.jpg" width="1200" height="665"/>
+</body>
+</html>
\ No newline at end of file
diff --git a/app/src/main/assets/pic1.jpg b/app/src/main/assets/pic1.jpg
new file mode 100644
index 0000000..325cc2b
--- /dev/null
+++ b/app/src/main/assets/pic1.jpg
Binary files differ
diff --git a/app/src/main/assets/pic2.jpg b/app/src/main/assets/pic2.jpg
new file mode 100644
index 0000000..af560dc
--- /dev/null
+++ b/app/src/main/assets/pic2.jpg
Binary files differ
diff --git a/app/src/main/assets/pic3.jpg b/app/src/main/assets/pic3.jpg
new file mode 100644
index 0000000..b76dd67
--- /dev/null
+++ b/app/src/main/assets/pic3.jpg
Binary files differ
diff --git a/app/src/main/assets/pic4.jpg b/app/src/main/assets/pic4.jpg
new file mode 100644
index 0000000..f014122
--- /dev/null
+++ b/app/src/main/assets/pic4.jpg
Binary files differ
diff --git a/app/src/main/assets/pic5.jpg b/app/src/main/assets/pic5.jpg
new file mode 100644
index 0000000..7adb1fe
--- /dev/null
+++ b/app/src/main/assets/pic5.jpg
Binary files differ
diff --git a/app/src/main/java/com/supwisdom/bean/AttRateBean.java b/app/src/main/java/com/supwisdom/bean/AttRateBean.java
new file mode 100644
index 0000000..978259f
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/bean/AttRateBean.java
@@ -0,0 +1,31 @@
+package com.supwisdom.bean;
+
+public class AttRateBean extends BaseResp {
+ private int totcnt;
+ private int actualcnt;
+ private double attrate;
+
+ public int getTotcnt() {
+ return totcnt;
+ }
+
+ public void setTotcnt(int totcnt) {
+ this.totcnt = totcnt;
+ }
+
+ public int getActualcnt() {
+ return actualcnt;
+ }
+
+ public void setActualcnt(int actualcnt) {
+ this.actualcnt = actualcnt;
+ }
+
+ public double getAttrate() {
+ return attrate;
+ }
+
+ public void setAttrate(double attrate) {
+ this.attrate = attrate;
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/bean/BaseResp.java b/app/src/main/java/com/supwisdom/bean/BaseResp.java
new file mode 100644
index 0000000..a2fda13
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/bean/BaseResp.java
@@ -0,0 +1,40 @@
+package com.supwisdom.bean;
+
+public class BaseResp {
+ private int retcode;
+ private String retmsg;
+ private String exception;
+
+ public BaseResp() {
+
+ }
+
+ public BaseResp(int retcode, String retmsg) {
+ this.retcode = retcode;
+ this.retmsg = retmsg;
+ }
+
+ public int getRetcode() {
+ return retcode;
+ }
+
+ public void setRetcode(int retcode) {
+ this.retcode = retcode;
+ }
+
+ public String getRetmsg() {
+ return retmsg;
+ }
+
+ public void setRetmsg(String retmsg) {
+ this.retmsg = retmsg;
+ }
+
+ public String getException() {
+ return exception;
+ }
+
+ public void setException(String exception) {
+ this.exception = exception;
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/bean/CheckDtlBean.java b/app/src/main/java/com/supwisdom/bean/CheckDtlBean.java
new file mode 100644
index 0000000..0b78070
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/bean/CheckDtlBean.java
@@ -0,0 +1,49 @@
+package com.supwisdom.bean;
+
+public class CheckDtlBean{
+ private String custname;
+ private String attstatus;
+ private String atttime;
+ private String deptname;
+ private String custtypename;
+
+ public String getCustname() {
+ return custname;
+ }
+
+ public void setCustname(String custname) {
+ this.custname = custname;
+ }
+
+ public String getAttstatus() {
+ return attstatus;
+ }
+
+ public void setAttstatus(String attstatus) {
+ this.attstatus = attstatus;
+ }
+
+ public String getAtttime() {
+ return atttime;
+ }
+
+ public void setAtttime(String atttime) {
+ this.atttime = atttime;
+ }
+
+ public String getDeptname() {
+ return deptname;
+ }
+
+ public void setDeptname(String deptname) {
+ this.deptname = deptname;
+ }
+
+ public String getCusttypename() {
+ return custtypename;
+ }
+
+ public void setCusttypename(String custtypename) {
+ this.custtypename = custtypename;
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/bean/CheckDtlResp.java b/app/src/main/java/com/supwisdom/bean/CheckDtlResp.java
new file mode 100644
index 0000000..5cc27a5
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/bean/CheckDtlResp.java
@@ -0,0 +1,24 @@
+package com.supwisdom.bean;
+
+import java.util.List;
+
+public class CheckDtlResp extends BaseResp {
+ private int count;
+ private List<CheckDtlBean> peoplelist;
+
+ public int getCount() {
+ return count;
+ }
+
+ public void setCount(int count) {
+ this.count = count;
+ }
+
+ public List<CheckDtlBean> getPeoplelist() {
+ return peoplelist;
+ }
+
+ public void setPeoplelist(List<CheckDtlBean> peoplelist) {
+ this.peoplelist = peoplelist;
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/bean/ConferenceBean.java b/app/src/main/java/com/supwisdom/bean/ConferenceBean.java
new file mode 100644
index 0000000..0eb7d22
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/bean/ConferenceBean.java
@@ -0,0 +1,85 @@
+package com.supwisdom.bean;
+
+public class ConferenceBean {
+ private int confid;
+ private String confname;
+ private String conftype;
+ private String confdate;
+ private String status;
+ private String starttime;
+ private String endtime;
+ private String attendtime;
+ private String confarea;
+
+ public int getConfid() {
+ return confid;
+ }
+
+ public void setConfid(int confid) {
+ this.confid = confid;
+ }
+
+ public String getConfname() {
+ return confname;
+ }
+
+ public void setConfname(String confname) {
+ this.confname = confname;
+ }
+
+ public String getConftype() {
+ return conftype;
+ }
+
+ public void setConftype(String conftype) {
+ this.conftype = conftype;
+ }
+
+ public String getConfdate() {
+ return confdate;
+ }
+
+ public void setConfdate(String confdate) {
+ this.confdate = confdate;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getStarttime() {
+ return starttime;
+ }
+
+ public void setStarttime(String starttime) {
+ this.starttime = starttime;
+ }
+
+ public String getEndtime() {
+ return endtime;
+ }
+
+ public void setEndtime(String endtime) {
+ this.endtime = endtime;
+ }
+
+ public String getAttendtime() {
+ return attendtime;
+ }
+
+ public void setAttendtime(String attendtime) {
+ this.attendtime = attendtime;
+ }
+
+ public String getConfarea() {
+ return confarea;
+ }
+
+ public void setConfarea(String confarea) {
+ this.confarea = confarea;
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/bean/ConferenceResp.java b/app/src/main/java/com/supwisdom/bean/ConferenceResp.java
new file mode 100644
index 0000000..2ed9163
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/bean/ConferenceResp.java
@@ -0,0 +1,24 @@
+package com.supwisdom.bean;
+
+import java.util.List;
+
+public class ConferenceResp extends BaseResp {
+ private int count;
+ private List<ConferenceBean> conflist;
+
+ public int getCount() {
+ return count;
+ }
+
+ public void setCount(int count) {
+ this.count = count;
+ }
+
+ public List<ConferenceBean> getConflist() {
+ return conflist;
+ }
+
+ public void setConflist(List<ConferenceBean> conflist) {
+ this.conflist = conflist;
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/conferencecheck/CrashHandler.java b/app/src/main/java/com/supwisdom/conferencecheck/CrashHandler.java
new file mode 100644
index 0000000..5e22aad
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/conferencecheck/CrashHandler.java
@@ -0,0 +1,126 @@
+package com.supwisdom.conferencecheck;
+
+import android.content.Context;
+import android.os.Build;
+import android.os.Looper;
+
+import com.supwisdom.util.AppExitUtil;
+import com.supwisdom.util.CommonUtil;
+import com.supwisdom.util.FileUtil;
+import com.supwisdom.util.ThreadPool;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Created by zzq on 2016-11-22.
+ */
+
+public class CrashHandler implements Thread.UncaughtExceptionHandler {
+ private static CrashHandler INSTANCE = new CrashHandler();
+ private Context context;
+ private Thread.UncaughtExceptionHandler mDefaultHandler;
+ private Map<String, String> info = new HashMap<String, String>();
+
+ private CrashHandler() {
+
+ }
+
+ public static CrashHandler getInstance() {
+ return INSTANCE;
+ }
+
+ public void init(Context context) {
+ this.context = context;
+ // 获取系统默认的 UncaughtException 处理器
+ mDefaultHandler = Thread.getDefaultUncaughtExceptionHandler();
+ // 设置该 CrashHandler 为程序的默认处理器
+ Thread.setDefaultUncaughtExceptionHandler(this);
+ }
+
+ @Override
+ public void uncaughtException(Thread thread, Throwable ex) {
+ if (!handleException(ex) && mDefaultHandler != null) {
+ // 如果自定义的没有处理则让系统默认的异常处理器来处理
+ mDefaultHandler.uncaughtException(thread, ex);
+ } else {
+ AppExitUtil.exit();
+ }
+ }
+
+ /**
+ * 自定义错误处理,收集错误信息 发送错误报告等操作均在此完成.
+ *
+ * @param ex 异常信息
+ * @return true 如果处理了该异常信息;否则返回false.
+ */
+ private boolean handleException(Throwable ex) {
+ if (ex == null)
+ return false;
+ ThreadPool.getShortPool().execute(new Runnable() {
+ @Override
+ public void run() {
+ CommonUtil.doSleep(500);
+ try {
+ Looper.prepare();
+ //SWToast.show(context, "很抱歉,程序运行异常", PublicDef.TOAST_SHOW_CRY);
+ Looper.loop();
+ } catch (Exception e) {
+ }
+ }
+ });
+ // 收集设备参数信息
+ collectDeviceInfo();
+ // 保存日志文件
+ saveCrashInfo2File(ex);
+ return true;
+ }
+
+ /**
+ * 收集设备参数信息
+ */
+
+ public void collectDeviceInfo() {
+ info.put("versionName", CommonUtil.getVersionName(context));
+
+ Field[] fields = Build.class.getDeclaredFields();// 反射机制
+ for (Field field : fields) {
+ try {
+ field.setAccessible(true);
+ info.put(field.getName(), field.get("").toString());
+ } catch (IllegalArgumentException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private boolean saveCrashInfo2File(Throwable ex) {
+ StringBuffer sb = new StringBuffer();
+ sb.append("\r\n crash time : ").append(CommonUtil.getNowDate()).append("\r\n");
+ for (Map.Entry<String, String> entry : info.entrySet()) {
+ String key = entry.getKey();
+ String value = entry.getValue();
+ sb.append(key + "=" + value + "\r\n");
+ }
+ Writer writer = new StringWriter();
+ PrintWriter pw = new PrintWriter(writer);
+ ex.printStackTrace(pw);
+ Throwable cause = ex.getCause();
+ // 循环着把所有的异常信息写入writer中
+ while (cause != null) {
+ cause.printStackTrace(pw);
+ cause = cause.getCause();
+ }
+ pw.close();// 记得关闭
+ String result = writer.toString();
+ sb.append(result);
+ FileUtil.writeCrashFile(sb.toString());
+ return true;
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/conferencecheck/SPApplication.java b/app/src/main/java/com/supwisdom/conferencecheck/SPApplication.java
new file mode 100644
index 0000000..1ab696a
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/conferencecheck/SPApplication.java
@@ -0,0 +1,53 @@
+package com.supwisdom.conferencecheck;
+
+import android.app.Application;
+
+import com.supwisdom.service.ConferenceApi;
+import com.supwisdom.swterm.Pos;
+
+public class SPApplication extends Application {
+ private static SPApplication sInstance;
+ private ConferenceApi conferenceApi;
+ private Pos mPos;
+ private boolean epayLinking; //链路状态 true 联机
+
+ public static SPApplication getsInstance() {
+ return sInstance;
+ }
+
+ public boolean isEpayLinking() {
+ return epayLinking;
+ }
+
+ public void setEpayLinking(boolean online) {
+ if (online) {
+ this.epayLinking = true;
+ } else {
+ this.epayLinking = false;
+ }
+ }
+
+ public ConferenceApi getApi(){
+ return conferenceApi;
+ }
+
+ public Pos getPos() {
+ if (mPos == null) {
+ synchronized (SPApplication.class) {
+ if (mPos == null) {
+ mPos = new Pos(getApplicationContext());
+ }
+ }
+ }
+ return mPos;
+ }
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ sInstance = this;
+ conferenceApi = new ConferenceApi();
+ CrashHandler.getInstance().init(getApplicationContext());
+ }
+
+}
diff --git a/app/src/main/java/com/supwisdom/conferencecheck/YktSession.java b/app/src/main/java/com/supwisdom/conferencecheck/YktSession.java
new file mode 100644
index 0000000..68cb391
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/conferencecheck/YktSession.java
@@ -0,0 +1,112 @@
+package com.supwisdom.conferencecheck;
+
+import com.supwisdom.okhttp.NetworkHandler;
+import com.supwisdom.okhttp.TransResp;
+import com.supwisdom.okhttp.WebAPISession;
+import com.supwisdom.okhttp.WebParams;
+import com.supwisdom.util.CommonUtil;
+import com.supwisdom.util.Encrypt;
+import com.supwisdom.util.PublicDef;
+
+/**
+ * Copyright (C), 2000-2013, Supwisdom Co., Ltd.
+ * File custname: com.supwisdom.ecardterm
+ * Description: TODO Modify History(或Change Log):
+ * 操作类型(创建、修改等) 操作日期 操作者 操作内容简述
+ * 创建 13-4-22 tangcheng
+ * <p/>
+ *
+ * @author tangcheng
+ * @version 1.0
+ * @since 1.0
+ */
+public class YktSession {
+ /**
+ * YktSession 实例
+ */
+ private static YktSession yktSession = null;
+ private WebAPISession mSession;
+
+ private YktSession() {
+ mSession = new WebAPISession();
+ }
+
+ /**
+ * Create YktSession instance
+ *
+ * @return YktSession object
+ */
+ public static synchronized YktSession getInstance() {
+ if (null == yktSession) {
+ synchronized (YktSession.class) {
+ if (null == yktSession) {
+ yktSession = new YktSession();
+ }
+ }
+ }
+ return yktSession;
+ }
+
+ public void setSessionKey(String sessionKey) {
+ mSession.setSessionKey(sessionKey);
+ }
+
+
+ // 设置通信参数
+ public void setWebAPISession(String epayIP, int epayPort, String uri, String termid, int commTime) {
+ StringBuilder sb = new StringBuilder();
+ if (epayIP.startsWith("http")) {
+ sb.append(epayIP);
+ } else {
+ sb.append("http://").append(epayIP);
+ }
+ sb.append(":").append(epayPort).append("/").append(uri).append("/api");
+
+ mSession.setEpayurl(sb.toString());
+ mSession.setTermId(termid);
+ NetworkHandler.getInstance().setCommTime(commTime);
+ }
+
+ public WebAPISession getWebAPISession() {
+ return mSession;
+ }
+
+ public TransResp sendYktRequestPost(String uri, WebParams params) {
+ String url = mSession.getEpayurl() + uri;
+ return NetworkHandler.getInstance().post(url, params);
+ }
+
+ // post
+ public TransResp sendYktRequestPost2(String uri, String signdata, WebParams params) {
+ String timestamp = CommonUtil.getNowDateTimeNoFormat();
+ String temp = signdata.replaceAll("null", "");
+ String mysign = calcSignForCardPay(temp, timestamp);
+ params.setParameter("sign", mysign)
+ .setParameter("sign_method", PublicDef.signMethod)
+ .setParameter("term_id", mSession.getTermId())
+ .setParameter("app_id", mSession.getAppId())
+ .setParameter("timestamp", timestamp);
+ String url = mSession.getEpayurl() + uri;
+ return NetworkHandler.getInstance().post(url, params);
+ }
+
+ public TransResp sendYktRequestLongPost(String uri, String signdata, WebParams params) {
+ String timestamp = CommonUtil.getNowDateTimeNoFormat();
+ String temp = signdata.replaceAll("null", "");
+ String mysign = calcSignForCardPay(temp, timestamp);
+ params.setParameter("sign", mysign)
+ .setParameter("sign_method", PublicDef.signMethod)
+ .setParameter("term_id", mSession.getTermId())
+ .setParameter("app_id", mSession.getAppId())
+ .setParameter("timestamp", timestamp);
+ String url = mSession.getEpayurl() + uri;
+ return NetworkHandler.getInstance().longPost(url, params);
+ }
+
+ private String calcSignForCardPay(String extdata, String nTimestamp) {
+ String signData = extdata + nTimestamp + mSession.getSessionKey();
+ String mySign = Encrypt.HMACSHA1(signData, mSession.getAppSecret());
+ return mySign.toLowerCase();
+ }
+}
+
diff --git a/app/src/main/java/com/supwisdom/conferencecheck/activity/BackgroundProcess.java b/app/src/main/java/com/supwisdom/conferencecheck/activity/BackgroundProcess.java
new file mode 100644
index 0000000..2082052
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/conferencecheck/activity/BackgroundProcess.java
@@ -0,0 +1,8 @@
+package com.supwisdom.conferencecheck.activity;
+
+public class BackgroundProcess extends Thread {
+ @Override
+ public void run(){
+
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/conferencecheck/activity/BaseActivity.java b/app/src/main/java/com/supwisdom/conferencecheck/activity/BaseActivity.java
new file mode 100644
index 0000000..4c2a036
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/conferencecheck/activity/BaseActivity.java
@@ -0,0 +1,30 @@
+package com.supwisdom.conferencecheck.activity;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+
+import com.supwisdom.util.AppExitUtil;
+
+public class BaseActivity extends Activity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState){
+ super.onCreate(savedInstanceState);
+ AppExitUtil.add(this);
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ AppExitUtil.remove(this);
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ }
+
+ public <T> void jumpActivity(Class<T> cls) {
+ startActivity(new Intent(getApplicationContext(), cls));
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/conferencecheck/activity/CheckDetailActivity.java b/app/src/main/java/com/supwisdom/conferencecheck/activity/CheckDetailActivity.java
new file mode 100644
index 0000000..7ec21ed
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/conferencecheck/activity/CheckDetailActivity.java
@@ -0,0 +1,182 @@
+package com.supwisdom.conferencecheck.activity;
+
+import android.content.Context;
+import android.graphics.Color;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.ListView;
+import android.widget.TextView;
+import com.supwisdom.bean.BaseResp;
+import com.supwisdom.bean.CheckDtlBean;
+import com.supwisdom.bean.CheckDtlResp;
+import com.supwisdom.conferencecheck.R;
+import com.supwisdom.conferencecheck.SPApplication;
+import com.supwisdom.util.CommonUtil;
+import com.supwisdom.util.Constants;
+import com.supwisdom.util.PublicDef;
+import java.util.List;
+
+public class CheckDetailActivity extends BaseActivity{
+ private PaginationAdapter adapter;
+ private ListView listView;
+ private List<CheckDtlBean> checkRecordList;
+ private View v_back;
+ private TextView v_msg;
+ private String now = "";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_checkdetail);
+ listView = findViewById(R.id.check_list);
+ v_msg = findViewById(R.id.vmsg);
+ v_back = findViewById(R.id.back_btn);
+ v_back.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ jumpActivity(MainActivity.class);
+ }
+ });
+ now = CommonUtil.getNowDateNoFormat();
+ adapter = new PaginationAdapter(this);
+ listView.setAdapter(adapter);
+ }
+
+ protected void onResume(){
+ new AsyncGetDtl().execute();
+ super.onResume();
+ }
+
+ private class AsyncGetDtl extends AsyncTask<Void, Void, BaseResp> {
+ @Override
+ protected void onPreExecute(){
+ v_msg.setText("正在查询,请稍后");
+ v_msg.setVisibility(View.VISIBLE);
+ super.onPreExecute();
+ }
+ @Override
+ protected BaseResp doInBackground(Void... voids){
+ CheckDtlResp checkDtlResp = SPApplication.getsInstance().getApi().getCheckDtl(Constants.CURRENTCONFID);
+ if(checkDtlResp.getRetcode() == PublicDef.SUCCESS){
+ checkRecordList = checkDtlResp.getPeoplelist();
+ return new BaseResp(PublicDef.SUCCESS, "success");
+ }else{
+ checkRecordList = null;
+ return new BaseResp(PublicDef.ERROR, "failure");
+ }
+ }
+
+ @Override
+ protected void onPostExecute(BaseResp resp){
+ if(resp.getRetcode() == PublicDef.SUCCESS){
+ if(null == checkRecordList || checkRecordList.size() == 0){
+ v_msg.setText("没有签到流水");
+ }else{
+ v_msg.setVisibility(View.GONE);
+ }
+ }else{
+ v_msg.setText("查询失败,请稍后重试");
+ }
+ adapter.notifyDataSetChanged();
+ super.onPostExecute(resp);
+ }
+ }
+
+ /**
+ * 自定义adapter
+ */
+ private class PaginationAdapter extends BaseAdapter {
+ private Context context;
+
+ public PaginationAdapter(Context context){
+ this.context = context;
+ }
+
+ @Override
+ public int getCount() {
+ if(null != checkRecordList)
+ return checkRecordList.size();
+ else
+ return 0;
+ }
+
+ @Override
+ public Object getItem(int position) {
+ if(null != checkRecordList)
+ return checkRecordList.get(position);
+ else
+ return null;
+ }
+
+ @Override
+ public long getItemId(int position) {
+ return position;
+ }
+
+ @Override
+ public View getView(int position, View view, ViewGroup parent) {
+ Holder holder;
+ if(view == null){
+ view = View.inflate(context, R.layout.list_item, null);
+ holder = new Holder();
+ holder.custname = (TextView) view.findViewById(R.id.classitem1);
+ holder.custtypename = (TextView) view.findViewById(R.id.classitem2);
+ holder.deptname = (TextView) view.findViewById(R.id.classitem3);
+ holder.date = (TextView) view.findViewById(R.id.classitem4);
+ holder.time = (TextView) view.findViewById(R.id.classitem5);
+ holder.status = (TextView) view.findViewById(R.id.classitem6);
+ view.setTag(holder);
+ }else{
+ holder = (Holder) view.getTag();
+ }
+ if(null != checkRecordList && checkRecordList.size() > 0){
+ if(position % 2 == 0) {
+ view.setBackgroundColor(Color.parseColor("#434E5F"));
+ }
+ CheckDtlBean record = checkRecordList.get(position);
+ holder.custname.setText(record.getCustname());
+ holder.custtypename.setText(record.getCusttypename());
+ holder.deptname.setText(record.getDeptname());
+ holder.date.setText(CommonUtil.formatDate(now));
+ holder.time.setText(CommonUtil.formatTime(record.getAtttime()));
+ if(record.getAttstatus().equals(PublicDef.ATTENDSTATUS_CHECKED)){
+ holder.status.setTextColor(getResources().getColor(R.color.class_status1));
+ holder.status.setText("正常签到");
+ } else if(record.getAttstatus().equals(PublicDef.ATTENDSTATUS_UNCHECK)){
+ holder.status.setTextColor(getResources().getColor(R.color.red_1));
+ holder.status.setText("未签到");
+ } else if(record.getAttstatus().equals(PublicDef.ATTENDSTATUS_LATE)){
+ holder.status.setTextColor(getResources().getColor(R.color.red_1));
+ holder.status.setText("迟到");
+ } else if(record.getAttstatus().equals(PublicDef.ATTENDSTATUS_INSTEAD)){
+ holder.status.setTextColor(getResources().getColor(R.color.class_status1));
+ holder.status.setText("代签");
+ } else if(record.getAttstatus().equals(PublicDef.ATTENDSTATUS_CLOSED)){
+ holder.status.setTextColor(getResources().getColor(R.color.red_1));
+ holder.status.setText("关闭");
+ } else if(record.getAttstatus().equals(PublicDef.ATTENDSTATUS_HAND)){
+ holder.status.setTextColor(getResources().getColor(R.color.class_status1));
+ holder.status.setText("手工签到");
+ }else{
+ holder.status.setTextColor(getResources().getColor(R.color.red_1));
+ holder.status.setText("未知");
+ }
+
+ }
+ return view;
+ }
+
+ private class Holder {
+ public TextView custname;
+ public TextView custtypename;
+ public TextView deptname;
+ public TextView date;
+ public TextView time;
+ public TextView status;
+ }
+ }
+
+}
diff --git a/app/src/main/java/com/supwisdom/conferencecheck/activity/ConferenceQueryActivity.java b/app/src/main/java/com/supwisdom/conferencecheck/activity/ConferenceQueryActivity.java
new file mode 100644
index 0000000..c1924cf
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/conferencecheck/activity/ConferenceQueryActivity.java
@@ -0,0 +1,144 @@
+package com.supwisdom.conferencecheck.activity;
+
+import android.content.Context;
+import android.graphics.Color;
+import android.os.Bundle;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.DatePicker;
+import android.widget.ListView;
+import android.widget.TextView;
+import com.supwisdom.conferencecheck.R;
+import com.supwisdom.conferencecheck.SPApplication;
+import com.supwisdom.swterm.ConferenceRecord;
+import com.supwisdom.swterm.Pos;
+import com.supwisdom.util.CommonUtil;
+import com.supwisdom.util.PublicDef;
+
+import java.util.List;
+
+public class ConferenceQueryActivity extends BaseActivity{
+ private Pos pos = SPApplication.getsInstance().getPos();
+ private DatePicker datePicker;
+ private PaginationAdapter adapter;
+ private ListView listView;
+ private List<ConferenceRecord> list = null;
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_conference);
+ initView();
+ }
+
+ private void initView(){
+ datePicker = findViewById(R.id.date);
+ listView = findViewById(R.id.conference_list);
+ View exit = findViewById(R.id.back_btn);
+ exit.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ jumpActivity(ManageActivity.class);
+ }
+ });
+ View query = findViewById(R.id.query);
+ query.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ query();
+ }
+ });
+ adapter = new PaginationAdapter(this);
+ listView.setAdapter(adapter);
+ }
+
+ private void query(){
+ String year = datePicker.getYear()+"";
+ String month = format(datePicker.getMonth()+1);
+ String day = format(datePicker.getDayOfMonth());
+ list = pos.getConferences(year + month + day);
+ adapter.notifyDataSetChanged();
+
+ }
+
+ private String format(int in){
+ if(in < 10)
+ return "0"+in;
+ return in+"";
+ }
+
+ /**
+ * 自定义adapter
+ */
+ private class PaginationAdapter extends BaseAdapter {
+ private Context context;
+
+ public PaginationAdapter(Context context){
+ this.context = context;
+ }
+
+ @Override
+ public int getCount() {
+ if(null != list)
+ return list.size();
+ else
+ return 0;
+ }
+
+ @Override
+ public Object getItem(int position) {
+ if(null != list)
+ return list.get(position);
+ else
+ return null;
+ }
+
+ @Override
+ public long getItemId(int position) {
+ return position;
+ }
+
+ @Override
+ public View getView(int position, View view, ViewGroup parent) {
+ Holder holder;
+ if(view == null){
+ view = View.inflate(context, R.layout.list_item_2, null);
+ holder = new Holder();
+ holder.confname = (TextView) view.findViewById(R.id.classitem1);
+ holder.confdate = (TextView) view.findViewById(R.id.classitem2);
+ holder.conftime = (TextView) view.findViewById(R.id.classitem3);
+ holder.confsigntime = (TextView) view.findViewById(R.id.classitem4);
+ holder.confaddr = (TextView) view.findViewById(R.id.classitem5);
+ holder.conftype = (TextView) view.findViewById(R.id.classitem6);
+ view.setTag(holder);
+ }else{
+ holder = (Holder) view.getTag();
+ }
+ if(null != list && list.size() > 0){
+ if(position % 2 == 0) {
+ view.setBackgroundColor(Color.parseColor("#434E5F"));
+ }
+ ConferenceRecord record = list.get(position);
+ holder.confname.setText(record.getConfname());
+ holder.confdate.setText(CommonUtil.formatDate(record.getConfdate()));
+ holder.conftime.setText(CommonUtil.formatTime(record.getConfbegintime())+"-"+CommonUtil.formatTime(record.getConfendtime()));
+ holder.confsigntime.setText(CommonUtil.formatTime(record.getConfsigntime()));
+ holder.confaddr.setText(record.getConfaddr());
+ if(record.getConftype().equals(PublicDef.LIST_TYPE))
+ holder.conftype.setText("有名单会议");
+ else
+ holder.conftype.setText("无名单会议");
+ }
+ return view;
+ }
+
+ private class Holder {
+ public TextView confname;
+ public TextView confdate;
+ public TextView conftime;
+ public TextView confsigntime;
+ public TextView confaddr;
+ public TextView conftype;
+ }
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/conferencecheck/activity/ConfigActivity.java b/app/src/main/java/com/supwisdom/conferencecheck/activity/ConfigActivity.java
new file mode 100644
index 0000000..9fb6dd9
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/conferencecheck/activity/ConfigActivity.java
@@ -0,0 +1,161 @@
+package com.supwisdom.conferencecheck.activity;
+
+import android.content.ComponentName;
+import android.content.Intent;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.EditText;
+import android.widget.TextView;
+
+import com.supwisdom.bean.BaseResp;
+import com.supwisdom.conferencecheck.R;
+import com.supwisdom.conferencecheck.SPApplication;
+import com.supwisdom.conferencecheck.YktSession;
+import com.supwisdom.swterm.ConfigParaRecord;
+import com.supwisdom.swterm.ControlParaRecord;
+import com.supwisdom.swterm.Pos;
+import com.supwisdom.util.CommonUtil;
+import com.supwisdom.util.PublicDef;
+import com.supwisdom.view.SWToast;
+
+public class ConfigActivity extends BaseActivity{
+ private EditText vDevphyid;
+ private EditText vServerIp;
+ private EditText vUri;
+ private EditText vPort;
+ private TextView vSave, vSet, vMsg;
+ private Pos pos = SPApplication.getsInstance().getPos();
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_config);
+ initView();
+ initData();
+ }
+
+ private void initView(){
+ vMsg = findViewById(R.id.tv_msg);
+ vDevphyid = findViewById(R.id.tv_devphyid);
+ vServerIp = findViewById(R.id.tv_server_ip);
+ vUri = findViewById(R.id.tv_uri_root);
+ vPort = findViewById(R.id.tv_server_port);
+ vSave = findViewById(R.id.btn_save);
+ vSave.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ saveConfig(CommonUtil.getEditView(vDevphyid), CommonUtil.getEditView(vServerIp),
+ CommonUtil.getEditView(vUri), CommonUtil.getEditView(vPort));
+ }
+ });
+ vSet = findViewById(R.id.btn_set);
+ vSet.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ Intent intent = new Intent("/");
+ ComponentName cm = new ComponentName("com.android.settings","com.android.settings.Settings");
+ intent.setComponent(cm);
+ intent.setAction("android.intent.action.VIEW");
+ startActivityForResult(intent, 0);
+ }
+ });
+ }
+
+ private void initData(){
+ ConfigParaRecord record = pos.getConfigPara();
+ if(null == record){
+ record = new ConfigParaRecord();
+ record.setMode(1);
+ record.setDevphyid("12345678ABCD");
+ record.setEpayIP("127.0.0.1");
+ record.setEpayUri("door");
+ record.setEpayPort(8080);
+ }
+ record.setInitOK(false);
+ pos.replaceConfigPara(record);
+ ConfigParaRecord cfgRecord = pos.getConfigPara();
+ vDevphyid.setText(cfgRecord.getDevphyid());
+ vServerIp.setText(cfgRecord.getEpayIP());
+ vUri.setText(cfgRecord.getEpayUri());
+ vPort.setText(cfgRecord.getEpayPort()+"");
+ }
+
+ private void saveConfig(String devphyid, String serverip, String uri, String port){
+ ConfigParaRecord record = pos.getConfigPara();
+ record.setMode(1);
+ record.setDevphyid(devphyid);
+ if(CommonUtil.isEmpty(devphyid)){
+ SWToast.show(this, "终端机编号不能为空!", PublicDef.TOAST_SHOW_DOUBT);
+ return;
+ }
+ record.setDevphyid(devphyid.replace(" ", ""));
+ if(CommonUtil.isEmpty(serverip)){
+ SWToast.show(this, "服务器IP不能为空!", PublicDef.TOAST_SHOW_DOUBT);
+ return;
+ }
+ record.setEpayIP(serverip.replace(" ", ""));
+ try {
+ int tmpPort = Integer.valueOf(port);
+ if (tmpPort > 65535) {
+ SWToast.show(this, "端口不能大于65535!", PublicDef.TOAST_SHOW_DOUBT);
+ return;
+ }
+ record.setEpayPort(tmpPort);
+ } catch (Exception e) {
+ SWToast.show(this, "端口不合法,请确认!", PublicDef.TOAST_SHOW_DOUBT);
+ return;
+ }
+ if (CommonUtil.isEmpty(uri)) {
+ SWToast.show(this, "URI不能为空!", PublicDef.TOAST_SHOW_DOUBT);
+ return;
+ }
+ record.setInitOK(false);
+ record.setEpayUri(uri.replace(" ", ""));
+ pos.replaceConfigPara(record);
+ YktSession.getInstance().setWebAPISession(record.getEpayIP(), record.getEpayPort(), record.getEpayUri(), record.getDevphyid(), 2);
+ LinkTask link = new LinkTask();
+ link.execute();
+ }
+
+ private class LinkTask extends AsyncTask<Void, Void, BaseResp>{
+ @Override
+ protected void onPreExecute() {
+ vMsg.setText("正在加载");
+ super.onPreExecute();
+ }
+
+ @Override
+ protected BaseResp doInBackground(Void... params){
+ BaseResp resp = SPApplication.getsInstance().getApi().checkLink();
+ if(resp.getRetcode() != PublicDef.SUCCESS){
+ return resp;
+ }
+ resp = SPApplication.getsInstance().getApi().syncConference(CommonUtil.getNowDateNoFormat());
+ if(resp.getRetcode() != PublicDef.SUCCESS){
+ return resp;
+ }
+ ConfigParaRecord record = pos.getConfigPara();
+ record.setInitOK(true);
+ pos.replaceConfigPara(record);
+ ControlParaRecord controlParaRecord = pos.getControlPara(PublicDef.CONTROL_HAS_REGISTER);
+ if(null == controlParaRecord){
+ controlParaRecord = new ControlParaRecord(PublicDef.CONTROL_HAS_REGISTER, "1");
+ }
+ controlParaRecord.setValue("1");
+ pos.replaceControlPara(controlParaRecord);
+ return resp;
+ }
+
+ @Override
+ protected void onPostExecute(BaseResp result){
+ if(result.getRetcode() == PublicDef.SUCCESS){
+ vMsg.setText("加载成功");
+ jumpActivity(MainActivity.class);
+ }else{
+ vMsg.setText(result.getRetcode() + ":" +result.getRetmsg());
+ }
+ super.onPostExecute(result);
+ }
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/conferencecheck/activity/MainActivity.java b/app/src/main/java/com/supwisdom/conferencecheck/activity/MainActivity.java
new file mode 100644
index 0000000..c55ea5d
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/conferencecheck/activity/MainActivity.java
@@ -0,0 +1,446 @@
+package com.supwisdom.conferencecheck.activity;
+
+import android.content.ComponentName;
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.util.Log;
+import android.view.View;
+import android.view.ViewGroup;
+import android.webkit.WebSettings;
+import android.webkit.WebView;
+import android.webkit.WebViewClient;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.supwisdom.bean.AttRateBean;
+import com.supwisdom.bean.BaseResp;
+import com.supwisdom.conferencecheck.R;
+import com.supwisdom.conferencecheck.SPApplication;
+import com.supwisdom.conferencecheck.YktSession;
+import com.supwisdom.conferencecheck.view.PasswdDialog;
+import com.supwisdom.swterm.ConferenceRecord;
+import com.supwisdom.swterm.ConfigParaRecord;
+import com.supwisdom.swterm.Pos;
+import com.supwisdom.util.CommonUtil;
+import com.supwisdom.util.Constants;
+import com.supwisdom.util.LogUtil;
+import com.supwisdom.util.PublicDef;
+import com.supwisdom.util.QRCodeUtil;
+
+public class MainActivity extends BaseActivity{
+ private String TAG = "Conference";
+
+ private WebView webView_Pic_1, webView_Content_1;
+ private WebView webView_Pic_2, webView_Content_2;
+ private WebView webView_Pic_3, webView_Content_3;
+
+ private TextView vConfname, vConftime, vConfaddr, vConfSigntime, vConftype, vNetStatus, v_yd,v_sd,v_rate,v_qrcode_hint;
+ private ImageView vNetLogo, vQrcode;
+
+ private PasswdDialog dialogPasswd = null;
+
+ private View v_detail,v_tip;
+ private TextView v_week,v_date,v_time;
+
+ private boolean hasHeart = false; // 心跳线程
+ private Handler handler;
+
+ private Bitmap bitmap;
+
+ private Pos pos;
+ private String qrcode_url = "";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+ initView();
+ initData();
+ }
+
+ private class UpdateService extends Thread{
+ @Override
+ public void run(){
+ while(hasHeart){
+ String now = CommonUtil.getNowDateNoFormat();
+ sendMsgDefault(PublicDef.MSG_SHOWTIME);
+ if(CommonUtil.isNetWorkConnected(MainActivity.this)){
+ BaseResp resp = SPApplication.getsInstance().getApi().checkLink();
+ if(resp.getRetcode() == PublicDef.SUCCESS){
+ SPApplication.getsInstance().setEpayLinking(true);
+ SPApplication.getsInstance().getApi().syncConference(now);
+ }else{
+ SPApplication.getsInstance().setEpayLinking(false);
+ }
+ }else{
+ SPApplication.getsInstance().setEpayLinking(false);
+ }
+ sendMsgDefault(PublicDef.MSG_SHOWNETSTATUS);
+ ConferenceRecord confRecord = pos.getConference(now, CommonUtil.getNowTimeNoFormat2());
+ if(null != confRecord){
+ Constants.CURRENTCONFID = confRecord.getConfid();
+ try{
+ bitmap = QRCodeUtil.CreateTwoDCode(qrcode_url+"/conference/doattend?confid="+confRecord.getConfid()+"&devphyid="+pos.getConfigPara().getDevphyid()+"×tamp="+CommonUtil.getNowDateTimeNoFormat(), 250);
+ }catch (Exception e){
+ bitmap = null;
+ e.printStackTrace();
+ LogUtil.d(TAG, "CreateTwoDCode Exception: "+ e.getMessage());
+ }
+ if(SPApplication.getsInstance().isEpayLinking()){
+ AttRateBean attRateBean = SPApplication.getsInstance().getApi().getAttrate(confRecord.getConfid());
+ if(attRateBean.getRetcode() == PublicDef.SUCCESS){
+ if(confRecord.getConftype().equals(PublicDef.LIST_TYPE))
+ sendMsgDefault(PublicDef.MSG_SHOWRATE_LIST, attRateBean);
+ else
+ sendMsgDefault(PublicDef.MSG_SHOWRATE_NOLIST, attRateBean);
+ }
+ }
+ }else{
+ Constants.CURRENTCONFID = 0;
+ }
+ sendMsgDefault(PublicDef.MSG_SHOWCONFERENCE, confRecord);
+ CommonUtil.doSleep(60 * 1000);
+ }
+ }
+ }
+
+ private void sendMsgDefault(int code) {
+ Message msg = new Message();
+ msg.what = code;
+ handler.sendMessage(msg);
+ }
+
+ private void sendMsgDefault(int code, Object obj) {
+ Message msg = new Message();
+ msg.what = code;
+ msg.obj = obj;
+ handler.sendMessage(msg);
+ }
+
+ private void createHandle(){
+ handler = new Handler(){
+ @Override
+ public void handleMessage(Message msg){
+ switch (msg.what){
+ case PublicDef.MSG_SHOWTIME:
+ String now = CommonUtil.getNowDate();
+ v_date.setText(now.substring(0, 10));
+ v_time.setText(now.substring(11, 16));
+ v_week.setText(CommonUtil.getWeek());
+ break;
+ case PublicDef.MSG_SHOWCONFERENCE:
+ ConferenceRecord confRecord = (ConferenceRecord) msg.obj;
+ if(confRecord != null){
+ vConfname.setText(confRecord.getConfname());
+ vConftime.setText(CommonUtil.formatDate(confRecord.getConfdate()) + " "
+ + CommonUtil.formatTime(confRecord.getConfbegintime()) + "-"
+ + CommonUtil.formatTime(confRecord.getConfendtime()));
+ vConfaddr.setText(confRecord.getConfaddr());
+ vConfSigntime.setText("签到时间:"+CommonUtil.formatTime(confRecord.getConfsigntime()));
+ if(confRecord.getConftype().equals(PublicDef.LIST_TYPE))
+ vConftype.setText("会议类型:有名单会议");
+ else
+ vConftype.setText("会议类型:无名单会议");
+ if(bitmap != null)
+ vQrcode.setImageBitmap(bitmap);
+ else
+ vQrcode.setImageResource(R.drawable.qr_none320);
+ v_qrcode_hint.setText("请扫描右侧会议码进行签到");
+ }else{
+ vConfname.setText("当前无会议进行!");
+ v_qrcode_hint.setText("当前没有会议不能扫码签到");
+ vQrcode.setImageResource(R.drawable.qr_none320);
+ vConftime.setText("");
+ vConfaddr.setText("");
+ vConfSigntime.setText("");
+ vConftype.setText("");
+ v_yd.setText("");
+ v_sd.setText("");
+ v_rate.setText("");
+ }
+ break;
+ case PublicDef.MSG_SHOWNETSTATUS:
+ if(SPApplication.getsInstance().isEpayLinking()){
+ vNetLogo.setImageResource(R.drawable.wireless_on);
+ vNetStatus.setText("已联网");
+ vNetStatus.setTextColor(getResources().getColor(R.color.main_blue1));
+ //v_detail.setBackgroundResource(R.drawable.select_bg_red);
+ //v_detail.setEnabled(true);
+ }else {
+ vNetLogo.setImageResource(R.drawable.wireless_off);
+ vNetStatus.setText("脱机");
+ vNetStatus.setTextColor(getResources().getColor(R.color.orignRed));
+ //v_detail.setBackgroundResource(R.drawable.corner_bg_gray_focus);
+ //v_detail.setEnabled(false);
+ }
+ break;
+ case PublicDef.MSG_SHOWRATE_LIST:
+ AttRateBean arb = (AttRateBean) msg.obj;
+ if(null != arb){
+ try{
+ v_yd.setText(arb.getTotcnt()+"");
+ v_sd.setText(arb.getActualcnt()+"");
+ v_rate.setText(String.format("%.2f %s", arb.getAttrate(), "%"));
+ }catch (Exception e){
+ v_yd.setText("-");
+ v_sd.setText("-");
+ v_rate.setText("-");
+ e.printStackTrace();
+ LogUtil.d(TAG, "show rate exception:"+e.getMessage());
+ }
+ }
+ break;
+ case PublicDef.MSG_SHOWRATE_NOLIST:
+ AttRateBean arb2 = (AttRateBean) msg.obj;
+ if(null != arb2){
+ try{
+ v_yd.setText("无");
+ v_sd.setText(arb2.getActualcnt()+"");
+ v_rate.setText("无");
+ }catch (Exception e){
+ v_yd.setText("-");
+ v_sd.setText("-");
+ v_rate.setText("-");
+ e.printStackTrace();
+ LogUtil.d(TAG, "show rate exception:"+e.getMessage());
+ }
+ }
+ break;
+ }
+ super.handleMessage(msg);
+ }
+ };
+ }
+
+ @Override
+ protected void onResume(){
+ hasHeart = true;
+ UpdateService updateService = new UpdateService();
+ updateService.start();
+ super.onResume();
+ }
+
+ @Override
+ protected void onStop(){
+ super.onStop();
+ }
+
+ @Override
+ protected void onDestroy() {
+ hasHeart = false;
+ releaseWebViews();
+ CommonUtil.releaseMusic();
+ super.onDestroy();
+ }
+
+ private void initData(){
+ createHandle();
+ pos = SPApplication.getsInstance().getPos();
+ ConfigParaRecord configParaRecord = pos.getConfigPara();
+ YktSession.getInstance().setWebAPISession(configParaRecord.getEpayIP(), configParaRecord.getEpayPort(), configParaRecord.getEpayUri(), configParaRecord.getDevphyid(), 2);
+ qrcode_url = YktSession.getInstance().getWebAPISession().getEpayurl();
+ }
+
+ private void initView(){
+ vQrcode = findViewById(R.id.vqrcode);
+ v_qrcode_hint = findViewById(R.id.qrcodehint);
+ vConfname = findViewById(R.id.conference_name);
+ vConftime = findViewById(R.id.conference_time);
+ vConfaddr = findViewById(R.id.conference_addr);
+ vConfSigntime = findViewById(R.id.conference_signtime);
+ vConftype = findViewById(R.id.conference_type);
+ vNetStatus = findViewById(R.id.linkstat);
+ vNetLogo = findViewById(R.id.linklogo);
+ v_yd = findViewById(R.id.yd);
+ v_sd = findViewById(R.id.sd);
+ v_rate = findViewById(R.id.rate);
+ v_week = findViewById(R.id.week);
+ v_date = findViewById(R.id.ymd);
+ v_time = findViewById(R.id.hm);
+ v_detail = findViewById(R.id.detail);
+ v_detail.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ jumpActivity(CheckDetailActivity.class);
+ }
+ });
+ v_tip = findViewById(R.id.tip);
+ v_tip.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ if(dialogPasswd == null){
+ dialogPasswd = new PasswdDialog(MainActivity.this, new PasswdDialog.ICallBack(){
+ @Override
+ public void callback(String pwd){
+ if("cancel".equals(pwd)){
+ dialogPasswd.dismiss();
+ }else if(PublicDef.MANAGER_PWD.equals(pwd)){
+ dialogPasswd.dismiss();
+ jumpActivity(ManageActivity.class);
+ }else{
+ dialogPasswd.resetPwd("请输入维护密码");
+ }
+ }
+ });
+ }
+ dialogPasswd.resetDialog("请输入维护密码");
+ dialogPasswd.show();
+ }
+ });
+ webView_Pic_1 = (WebView) findViewById(R.id.webview_1);
+ webView_Content_1 = (WebView) findViewById(R.id.webview_top_1);
+ webView_Pic_2 = (WebView) findViewById(R.id.webview_2);
+ webView_Content_2 = (WebView) findViewById(R.id.webview_top_2);
+ webView_Pic_3 = (WebView) findViewById(R.id.webview_3);
+ webView_Content_3 = (WebView) findViewById(R.id.webview_top_3);
+ setWebViews();
+ webView_Pic_1.loadUrl("file:///android_asset/news_pic04.html");
+ webView_Content_1.loadUrl("file:///android_asset/news_content04.html");
+ webView_Pic_2.loadUrl("file:///android_asset/news_pic05.html");
+ webView_Content_2.loadUrl("file:///android_asset/news_content05.html");
+ webView_Pic_3.loadUrl("file:///android_asset/news_pic03.html");
+ webView_Content_3.loadUrl("file:///android_asset/news_content03.html");
+ }
+
+ private void releaseWebViews(){
+ if(webView_Pic_1 != null){
+ ((ViewGroup)webView_Pic_1.getParent()).removeView(webView_Pic_1);
+ webView_Pic_1.destroy();
+ }
+ if(webView_Content_1 != null){
+ ((ViewGroup)webView_Content_1.getParent()).removeView(webView_Content_1);
+ webView_Content_1.destroy();
+ }
+ if(webView_Pic_2 != null){
+ ((ViewGroup)webView_Pic_2.getParent()).removeView(webView_Pic_2);
+ webView_Pic_2.destroy();
+ }
+ if(webView_Content_2 != null){
+ ((ViewGroup)webView_Content_2.getParent()).removeView(webView_Content_2);
+ webView_Content_2.destroy();
+ }
+ if(webView_Pic_3 != null){
+ ((ViewGroup)webView_Pic_3.getParent()).removeView(webView_Pic_3);
+ webView_Pic_3.destroy();
+ }
+ if(webView_Content_3 != null){
+ ((ViewGroup)webView_Content_3.getParent()).removeView(webView_Content_3);
+ webView_Content_3.destroy();
+ }
+ }
+
+ private void setWebViews(){
+ webView_Pic_1.getSettings().setSupportZoom(false);
+ webView_Pic_1.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); //优先使用缓存
+ String cacheDirPath = getFilesDir().getAbsolutePath()+"/webCache";
+ webView_Pic_1.getSettings().setAppCachePath(cacheDirPath); // h5缓存
+ webView_Pic_1.getSettings().setAppCacheEnabled(true);
+ //设置自适应屏幕,两者合用
+ webView_Pic_1.getSettings().setUseWideViewPort(true); //将图片调整到适合webview的大小
+ webView_Pic_1.getSettings().setLoadWithOverviewMode(true); // 缩放至屏幕的大小
+
+ webView_Pic_2.getSettings().setSupportZoom(false);
+ webView_Pic_2.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); //优先使用缓存
+ webView_Pic_2.getSettings().setAppCachePath(cacheDirPath); // h5缓存
+ webView_Pic_2.getSettings().setAppCacheEnabled(true);
+ //设置自适应屏幕,两者合用
+ webView_Pic_2.getSettings().setUseWideViewPort(true); //将图片调整到适合webview的大小
+ webView_Pic_2.getSettings().setLoadWithOverviewMode(true); // 缩放至屏幕的大小
+
+ webView_Pic_3.getSettings().setSupportZoom(false);
+ webView_Pic_3.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); //优先使用缓存
+ webView_Pic_3.getSettings().setAppCachePath(cacheDirPath); // h5缓存
+ webView_Pic_3.getSettings().setAppCacheEnabled(true);
+ //设置自适应屏幕,两者合用
+ webView_Pic_3.getSettings().setUseWideViewPort(true); //将图片调整到适合webview的大小
+ webView_Pic_3.getSettings().setLoadWithOverviewMode(true); // 缩放至屏幕的大小
+
+ webView_Content_1.getSettings().setSupportZoom(false);
+ webView_Content_1.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); //优先使用缓存
+ webView_Content_1.getSettings().setAppCachePath(cacheDirPath); // h5缓存
+ webView_Content_1.getSettings().setAppCacheEnabled(true);
+ //设置自适应屏幕,两者合用
+ webView_Content_1.getSettings().setUseWideViewPort(true); //将图片调整到适合webview的大小
+ webView_Content_1.getSettings().setLoadWithOverviewMode(true); // 缩放至屏幕的大小
+
+ webView_Content_2.getSettings().setSupportZoom(false);
+ webView_Content_2.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); //优先使用缓存
+ webView_Content_2.getSettings().setAppCachePath(cacheDirPath); // h5缓存
+ webView_Content_2.getSettings().setAppCacheEnabled(true);
+ //设置自适应屏幕,两者合用
+ webView_Content_2.getSettings().setUseWideViewPort(true); //将图片调整到适合webview的大小
+ webView_Content_2.getSettings().setLoadWithOverviewMode(true); // 缩放至屏幕的大小
+
+ webView_Content_3.getSettings().setSupportZoom(false);
+ webView_Content_3.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); //优先使用缓存
+ webView_Content_3.getSettings().setAppCachePath(cacheDirPath); // h5缓存
+ webView_Content_3.getSettings().setAppCacheEnabled(true);
+ //设置自适应屏幕,两者合用
+ webView_Content_3.getSettings().setUseWideViewPort(true); //将图片调整到适合webview的大小
+ webView_Content_3.getSettings().setLoadWithOverviewMode(true); // 缩放至屏幕的大小
+
+ webView_Pic_1.setWebViewClient(new WebViewClient(){
+ @Override
+ public boolean shouldOverrideUrlLoading(WebView view, String url){
+ webView_Pic_1.loadUrl(url);
+ return true;
+ }
+ });
+ webView_Pic_2.setWebViewClient(new WebViewClient(){
+ @Override
+ public boolean shouldOverrideUrlLoading(WebView view, String url){
+ webView_Pic_2.loadUrl(url);
+ return true;
+ }
+ });
+ webView_Pic_3.setWebViewClient(new WebViewClient(){
+ @Override
+ public boolean shouldOverrideUrlLoading(WebView view, String url){
+ webView_Pic_3.loadUrl(url);
+ return true;
+ }
+ });
+ webView_Content_1.setWebViewClient(new WebViewClient(){
+ @Override
+ public boolean shouldOverrideUrlLoading(WebView view, String url){
+ webView_Content_1.loadUrl(url);
+ return true;
+ }
+ });
+ webView_Content_1.setOnLongClickListener(new View.OnLongClickListener() {
+ @Override
+ public boolean onLongClick(View v) {
+ return true;
+ }
+ });
+ webView_Content_2.setWebViewClient(new WebViewClient(){
+ @Override
+ public boolean shouldOverrideUrlLoading(WebView view, String url){
+ webView_Content_2.loadUrl(url);
+ return true;
+ }
+ });
+ webView_Content_2.setOnLongClickListener(new View.OnLongClickListener() {
+ @Override
+ public boolean onLongClick(View v) {
+ return true;
+ }
+ });
+ webView_Content_3.setWebViewClient(new WebViewClient(){
+ @Override
+ public boolean shouldOverrideUrlLoading(WebView view, String url){
+ webView_Content_3.loadUrl(url);
+ return true;
+ }
+ });
+ webView_Content_3.setOnLongClickListener(new View.OnLongClickListener() {
+ @Override
+ public boolean onLongClick(View v) {
+ return true;
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/conferencecheck/activity/ManageActivity.java b/app/src/main/java/com/supwisdom/conferencecheck/activity/ManageActivity.java
new file mode 100644
index 0000000..e753d54
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/conferencecheck/activity/ManageActivity.java
@@ -0,0 +1,129 @@
+package com.supwisdom.conferencecheck.activity;
+
+import android.content.ComponentName;
+import android.content.Intent;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.TextView;
+
+import com.supwisdom.bean.BaseResp;
+import com.supwisdom.conferencecheck.R;
+import com.supwisdom.conferencecheck.SPApplication;
+import com.supwisdom.service.ConferenceApi;
+import com.supwisdom.swterm.Pos;
+import com.supwisdom.util.CommonUtil;
+import com.supwisdom.util.PublicDef;
+import com.supwisdom.view.SWToast;
+
+public class ManageActivity extends BaseActivity{
+
+ private TextView v_syncmsg, v_linkmsg;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_set);
+ initView();
+ }
+
+ private void initView(){
+ v_syncmsg = findViewById(R.id.sync_msg);
+ v_linkmsg = findViewById(R.id.link_msg);
+ View set = findViewById(R.id.set);
+ set.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ Intent intent = new Intent("/");
+ ComponentName cm = new ComponentName("com.android.settings","com.android.settings.Settings");
+ intent.setComponent(cm);
+ intent.setAction("android.intent.action.VIEW");
+ startActivityForResult(intent, 0);
+ }
+ });
+ View conf = findViewById(R.id.conference);
+ conf.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ jumpActivity(ConferenceQueryActivity.class);
+ }
+ });
+ View sysnConf = findViewById(R.id.syncconf);
+ sysnConf.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ new AsyncGetConference().execute();
+ }
+ });
+ View link = findViewById(R.id.link);
+ link.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ new AsyncLink().execute();
+ }
+ });
+ View exit = findViewById(R.id.exit);
+ exit.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ jumpActivity(MainActivity.class);
+ }
+ });
+ }
+
+ private class AsyncGetConference extends AsyncTask<Void, Void, BaseResp>{
+ @Override
+ protected void onPreExecute(){
+ v_syncmsg.setVisibility(View.VISIBLE);
+ super.onPreExecute();
+ }
+ @Override
+ protected BaseResp doInBackground(Void... voids){
+ return SPApplication.getsInstance().getApi().syncConference(CommonUtil.getNowDateNoFormat());
+ }
+
+ @Override
+ protected void onPostExecute(BaseResp resp){
+ v_syncmsg.setVisibility(View.GONE);
+ if(resp != null){
+ if(resp.getRetcode() == PublicDef.SUCCESS)
+ SWToast.show(ManageActivity.this, resp.getRetmsg(), PublicDef.TOAST_SHOW_SMILE);
+ else
+ SWToast.show(ManageActivity.this, resp.getRetmsg(), PublicDef.TOAST_SHOW_CRY);
+ }else{
+ SWToast.show(ManageActivity.this, "请求超时", PublicDef.TOAST_SHOW_CRY);
+ }
+ super.onPostExecute(resp);
+ }
+ }
+
+ private class AsyncLink extends AsyncTask<Void, Void, BaseResp>{
+ @Override
+ protected void onPreExecute(){
+ v_linkmsg.setVisibility(View.VISIBLE);
+ super.onPreExecute();
+ }
+ @Override
+ protected BaseResp doInBackground(Void... voids){
+ return SPApplication.getsInstance().getApi().checkLink();
+ }
+
+ @Override
+ protected void onPostExecute(BaseResp resp){
+ v_linkmsg.setVisibility(View.GONE);
+ if(resp != null){
+ if(resp.getRetcode() == PublicDef.SUCCESS){
+ SPApplication.getsInstance().setEpayLinking(true);
+ SWToast.show(ManageActivity.this, resp.getRetmsg(), PublicDef.TOAST_SHOW_SMILE);
+ }else{
+ SPApplication.getsInstance().setEpayLinking(false);
+ SWToast.show(ManageActivity.this, resp.getRetmsg(), PublicDef.TOAST_SHOW_CRY);
+ }
+ }else{
+ SPApplication.getsInstance().setEpayLinking(false);
+ SWToast.show(ManageActivity.this, "请求超时", PublicDef.TOAST_SHOW_CRY);
+ }
+ super.onPostExecute(resp);
+ }
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/conferencecheck/activity/SplashActivity.java b/app/src/main/java/com/supwisdom/conferencecheck/activity/SplashActivity.java
new file mode 100644
index 0000000..3e5e93f
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/conferencecheck/activity/SplashActivity.java
@@ -0,0 +1,87 @@
+package com.supwisdom.conferencecheck.activity;
+
+import android.Manifest;
+import android.content.pm.PackageManager;
+import android.os.Build;
+import android.os.Bundle;
+import android.widget.TextView;
+
+import com.supwisdom.conferencecheck.R;
+import com.supwisdom.conferencecheck.SPApplication;
+import com.supwisdom.swterm.ConfigParaRecord;
+import com.supwisdom.swterm.ControlParaRecord;
+import com.supwisdom.util.CommonUtil;
+import com.supwisdom.util.PublicDef;
+
+/**
+ * 设备启动页面
+ */
+public class SplashActivity extends BaseActivity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_splash);
+ initView();
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ if (hasSdcardPermession()) {
+ processStart();
+ }
+ }
+
+ private void initView() {
+ TextView tv = (TextView) findViewById(R.id.versionNumber);
+ tv.setText(CommonUtil.getVersionName(getApplicationContext()));
+ }
+
+ private void processStart() {
+ ControlParaRecord ctlRecord = SPApplication.getsInstance().getPos().getControlPara(PublicDef.CONTROL_HAS_REGISTER);
+ if(ctlRecord == null){
+ jumpActivity(ConfigActivity.class);
+ }else{
+ ConfigParaRecord record = SPApplication.getsInstance().getPos().getConfigPara();
+ if(null != record && record.isInitOK()){
+ jumpActivity(MainActivity.class);
+ }else{
+ jumpActivity(ConfigActivity.class);
+ }
+ }
+ }
+
+ private final static int REQUEST_RETCODE = 99;
+
+ private boolean hasSdcardPermession() {
+ /**
+ * 动态获取权限,Android 6.0 新特性,一些保护权限,除了要在AndroidManifest中声明权限,还要使用如下代码动态获取
+ */
+ if (Build.VERSION.SDK_INT >= 23) {
+ String[] permissions = {Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA};
+ //验证是否许可权限
+ for (String str : permissions) {
+ if (this.checkSelfPermission(str) != PackageManager.PERMISSION_GRANTED) {
+ //申请权限
+ this.requestPermissions(permissions, REQUEST_RETCODE);
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
+ super.onRequestPermissionsResult(requestCode, permissions, grantResults);
+ if (requestCode == REQUEST_RETCODE) {
+ for (int i = 0; i < grantResults.length; i++) {
+ if (grantResults[i] != PackageManager.PERMISSION_GRANTED) {
+ return;
+ }
+ }
+ // 请求权限的结果 true代表用户同意了
+ processStart();
+ }
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/conferencecheck/view/PasswdDialog.java b/app/src/main/java/com/supwisdom/conferencecheck/view/PasswdDialog.java
new file mode 100644
index 0000000..91b27de
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/conferencecheck/view/PasswdDialog.java
@@ -0,0 +1,220 @@
+package com.supwisdom.conferencecheck.view;
+
+import android.app.Dialog;
+import android.content.Context;
+import android.graphics.Color;
+import android.support.annotation.NonNull;
+import android.view.KeyEvent;
+import android.view.MotionEvent;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.supwisdom.conferencecheck.R;
+
+/**
+ * Created by shuwei on 15/9/28.
+ */
+public class PasswdDialog extends Dialog {
+ private final ImageView vPassd1;
+ private final ImageView vPassd2;
+ private final ImageView vPassd3;
+ private final ImageView vPassd4;
+ private final ImageView vPassd5;
+ private final ImageView vPassd6;
+ private final TextView vTitle;
+ private String passwd;
+ private ICallBack icb;
+
+ public PasswdDialog(Context context, ICallBack cb) {
+ super(context, R.style.FloatingDialog);
+ this.setContentView(R.layout.dialog_passwd);
+ setCanceledOnTouchOutside(false);
+ setCancelable(false);
+
+ this.icb = cb;
+ handleClickNumber(R.id.float_password_btn0, 0, R.drawable.pass_zero_normal, R.drawable.pass_zero_click);
+ handleClickNumber(R.id.float_password_btn1, 1, R.drawable.pass_one_normal, R.drawable.pass_one_click);
+ handleClickNumber(R.id.float_password_btn2, 2, R.drawable.pass_two_normal, R.drawable.pass_two_click);
+ handleClickNumber(R.id.float_password_btn3, 3, R.drawable.pass_three_normal, R.drawable.pass_three_click);
+ handleClickNumber(R.id.float_password_btn4, 4, R.drawable.pass_four_normal, R.drawable.pass_four_click);
+ handleClickNumber(R.id.float_password_btn5, 5, R.drawable.pass_five_normal, R.drawable.pass_five_click);
+ handleClickNumber(R.id.float_password_btn6, 6, R.drawable.pass_six_normal, R.drawable.pass_six_click);
+ handleClickNumber(R.id.float_password_btn7, 7, R.drawable.pass_seven_normal, R.drawable.pass_seven_click);
+ handleClickNumber(R.id.float_password_btn8, 8, R.drawable.pass_eight_normal, R.drawable.pass_eight_click);
+ handleClickNumber(R.id.float_password_btn9, 9, R.drawable.pass_nine_normal, R.drawable.pass_nine_click);
+ handleClickNumber(R.id.float_password_btn_delete, -1, R.drawable.pass_delete_normal, R.drawable.pass_delete_click);
+ final TextView btn = (TextView) this.findViewById(R.id.float_password_cancel);
+ btn.setOnTouchListener(new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View view, MotionEvent event) {
+ int what = event.getAction();
+ switch (what) {
+ case MotionEvent.ACTION_DOWN: //按下
+ btn.setBackground(getContext().getResources().getDrawable(R.drawable.btn_red_click));
+ break;
+ case MotionEvent.ACTION_UP:
+ btn.setBackground(getContext().getResources().getDrawable(R.drawable.btn_red_normal));
+ PasswdDialog.this.dismiss();
+ icb.callback("cancel");
+ }
+ return true;
+ }
+ });
+
+ vPassd1 = (ImageView) this.findViewById(R.id.float_password_img1);
+ vPassd2 = (ImageView) this.findViewById(R.id.float_password_img2);
+ vPassd3 = (ImageView) this.findViewById(R.id.float_password_img3);
+ vPassd4 = (ImageView) this.findViewById(R.id.float_password_img4);
+ vPassd5 = (ImageView) this.findViewById(R.id.float_password_img5);
+ vPassd6 = (ImageView) this.findViewById(R.id.float_password_img6);
+ vTitle = (TextView) this.findViewById(R.id.tv_float_password_title);
+ showPasswd(0);
+ passwd = "";
+ }
+
+ public void resetDialog(String msg) {
+ passwd = "";
+// vTitle.setText("请输入卡密码");
+ vTitle.setText(msg);
+ vTitle.setTextColor(Color.BLACK);
+ showPasswd(0);
+ }
+
+ public void resetPwd(String msg) {
+ passwd = "";
+// vTitle.setText("请重新输入密码");
+ vTitle.setText(msg);
+ vTitle.setTextColor(Color.RED);
+ showPasswd(0);
+ }
+
+ @Override
+ public boolean dispatchKeyEvent(@NonNull KeyEvent event) {
+ if (event.getAction() == KeyEvent.ACTION_DOWN) {
+ int keyCode = event.getKeyCode();
+ switch (keyCode) {
+ case KeyEvent.KEYCODE_NUMPAD_0:
+ case KeyEvent.KEYCODE_NUMPAD_1:
+ case KeyEvent.KEYCODE_NUMPAD_2:
+ case KeyEvent.KEYCODE_NUMPAD_3:
+ case KeyEvent.KEYCODE_NUMPAD_4:
+ case KeyEvent.KEYCODE_NUMPAD_5:
+ case KeyEvent.KEYCODE_NUMPAD_6:
+ case KeyEvent.KEYCODE_NUMPAD_7:
+ case KeyEvent.KEYCODE_NUMPAD_8:
+ case KeyEvent.KEYCODE_NUMPAD_9:
+ addValueToEdit(keyCode - KeyEvent.KEYCODE_NUMPAD_0);
+ break;
+ case KeyEvent.KEYCODE_NUMPAD_DOT:
+ case KeyEvent.KEYCODE_DEL:
+ addValueToEdit(-1);
+ break;
+ default:
+ }
+ }
+ return false;
+ }
+
+ private void handleClickNumber(int btnId, final int number, final int picNormal, final int picClick) {
+ final ImageView btn = (ImageView) findViewById(btnId);
+ btn.setOnTouchListener(new ImageView.OnTouchListener() {
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ int what = event.getAction();
+ switch (what) {
+ case MotionEvent.ACTION_DOWN: //按下
+ btn.setImageDrawable(getContext().getResources().getDrawable(picClick));
+ break;
+ case MotionEvent.ACTION_UP:
+ btn.setImageDrawable(getContext().getResources().getDrawable(picNormal));
+ addValueToEdit(number);
+ break;
+ }
+ return true;
+ }
+ });
+ }
+
+ private boolean addValueToEdit(int value) {
+ if (value == -1) {
+ if (passwd.length() > 0) {
+ passwd = passwd.substring(0, passwd.length() - 1);
+ showPasswd(passwd.length());
+ }
+ } else {
+ //如果已经有小数点,则小数点后面不能超过两位
+ passwd += value;
+ showPasswd(passwd.length());
+ }
+ if (passwd.length() > 5) {
+ icb.callback(passwd);
+ }
+ return true;
+ }
+
+ private void showPasswd(int num) {
+ switch (num) {
+ case 0:
+ vPassd1.setVisibility(View.GONE);
+ vPassd2.setVisibility(View.GONE);
+ vPassd3.setVisibility(View.GONE);
+ vPassd4.setVisibility(View.GONE);
+ vPassd5.setVisibility(View.GONE);
+ vPassd6.setVisibility(View.GONE);
+ break;
+ case 1:
+ vPassd1.setVisibility(View.VISIBLE);
+ vPassd2.setVisibility(View.GONE);
+ vPassd3.setVisibility(View.GONE);
+ vPassd4.setVisibility(View.GONE);
+ vPassd5.setVisibility(View.GONE);
+ vPassd6.setVisibility(View.GONE);
+ break;
+ case 2:
+ vPassd1.setVisibility(View.VISIBLE);
+ vPassd2.setVisibility(View.VISIBLE);
+ vPassd3.setVisibility(View.GONE);
+ vPassd4.setVisibility(View.GONE);
+ vPassd5.setVisibility(View.GONE);
+ vPassd6.setVisibility(View.GONE);
+ break;
+ case 3:
+ vPassd1.setVisibility(View.VISIBLE);
+ vPassd2.setVisibility(View.VISIBLE);
+ vPassd3.setVisibility(View.VISIBLE);
+ vPassd4.setVisibility(View.GONE);
+ vPassd5.setVisibility(View.GONE);
+ vPassd6.setVisibility(View.GONE);
+ break;
+ case 4:
+ vPassd1.setVisibility(View.VISIBLE);
+ vPassd2.setVisibility(View.VISIBLE);
+ vPassd3.setVisibility(View.VISIBLE);
+ vPassd4.setVisibility(View.VISIBLE);
+ vPassd5.setVisibility(View.GONE);
+ vPassd6.setVisibility(View.GONE);
+ break;
+ case 5:
+ vPassd1.setVisibility(View.VISIBLE);
+ vPassd2.setVisibility(View.VISIBLE);
+ vPassd3.setVisibility(View.VISIBLE);
+ vPassd4.setVisibility(View.VISIBLE);
+ vPassd5.setVisibility(View.VISIBLE);
+ vPassd6.setVisibility(View.GONE);
+ break;
+ default:
+ vPassd1.setVisibility(View.VISIBLE);
+ vPassd2.setVisibility(View.VISIBLE);
+ vPassd3.setVisibility(View.VISIBLE);
+ vPassd4.setVisibility(View.VISIBLE);
+ vPassd5.setVisibility(View.VISIBLE);
+ vPassd6.setVisibility(View.VISIBLE);
+ break;
+ }
+ }
+
+ public interface ICallBack {
+ void callback(String pwd);
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/db/BeanPropEnum.java b/app/src/main/java/com/supwisdom/db/BeanPropEnum.java
new file mode 100644
index 0000000..2cc3278
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/db/BeanPropEnum.java
@@ -0,0 +1,32 @@
+package com.supwisdom.db;
+
+public class BeanPropEnum {
+ public enum Conference{
+ confid,
+ confname,
+ confaddr,
+ confdate,
+ confbegintime,
+ confendtime,
+ confsigntime,
+ conftype,
+ remark
+ }
+
+ public enum ControlPara {
+ name,
+ val
+ }
+
+ public enum ConfigPara {
+ id,
+ mode,
+ deviceid,
+ devicename,
+ devphyid,
+ epayIP,
+ epayPort,
+ epayUri,
+ initOK
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/db/ConferenceDao.java b/app/src/main/java/com/supwisdom/db/ConferenceDao.java
new file mode 100644
index 0000000..a6136f9
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/db/ConferenceDao.java
@@ -0,0 +1,168 @@
+package com.supwisdom.db;
+
+import android.content.ContentValues;
+import android.content.Context;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+
+import com.supwisdom.swterm.ConferenceRecord;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.locks.Lock;
+
+public class ConferenceDao {
+ private static ConferenceDao dao;
+ private final String TABLE = DBConferenceHelper.TABLE_NAME_CONFERENCE;
+ private DBConferenceHelper dbHelper;
+
+ private ConferenceDao(Context context) {
+ dbHelper = DBConferenceHelper.getInstance(context);
+ }
+
+ public Lock getLock() {
+ return dbHelper.getLock();
+ }
+
+ public static ConferenceDao getInstance(Context context) {
+ if (dao == null) {
+ synchronized (ConferenceDao.class) {
+ if (dao == null) {
+ dao = new ConferenceDao(context);
+ }
+ }
+ }
+ return dao;
+ }
+
+ public boolean save(ConferenceRecord record) {
+ SQLiteDatabase db = dbHelper.getReadableDatabase();
+ ContentValues values = getContentValues(record);
+ try {
+ db.beginTransaction();
+ if (db.insert(TABLE, null, values) > 0) {
+ db.setTransactionSuccessful();
+ return true;
+ }
+ } finally {
+ db.endTransaction();
+ }
+ return false;
+ }
+
+ public boolean replace(ConferenceRecord record) {
+ SQLiteDatabase db = dbHelper.getReadableDatabase();
+ ContentValues values = getContentValues(record);
+ try {
+ db.beginTransaction();
+ if (db.replace(TABLE, null, values) > 0) {
+ db.setTransactionSuccessful();
+ return true;
+ }
+ } finally {
+ db.endTransaction();
+ }
+ return false;
+ }
+
+ public boolean update(ConferenceRecord record) {
+ SQLiteDatabase db = dbHelper.getWritableDatabase();
+ ContentValues values = getContentValues(record);
+ try {
+ db.beginTransaction();
+ if (db.update(TABLE, values, BeanPropEnum.Conference.confid + "=?", new String[]{record.getConfid()+""}) > 0) {
+ db.setTransactionSuccessful();
+ return true;
+ }
+ } finally {
+ db.endTransaction();
+ }
+ return false;
+ }
+
+ public ConferenceRecord get(int confid) {
+ SQLiteDatabase db = dbHelper.getReadableDatabase();
+ Cursor cursor = null;
+ try {
+ cursor = db.query(TABLE, null, BeanPropEnum.Conference.confid.toString() + "=?",
+ new String[]{"" + confid}, null, null, null);
+ if (cursor != null && cursor.moveToNext()) {
+ return getRecord(cursor);
+ }
+ } finally {
+ if (cursor != null) {
+ cursor.close();
+ }
+ }
+ return null;
+ }
+
+ public List<ConferenceRecord> getByDate(String date) {
+ SQLiteDatabase db = dbHelper.getReadableDatabase();
+ Cursor cursor = null;
+ try {
+ cursor = db.query(TABLE, null, BeanPropEnum.Conference.confdate.toString() + "=?",
+ new String[]{date}, null, null, null);
+ List<ConferenceRecord> list = new ArrayList<>();
+ while (cursor != null && cursor.moveToNext()) {
+ list.add(getRecord(cursor));
+ }
+ return list;
+ } finally {
+ if (cursor != null) {
+ cursor.close();
+ }
+ }
+ }
+
+ /**
+ * 获取正在进行的会议,签到时间和结束时间之间
+ * @param date
+ * @param time
+ * @return
+ */
+ public ConferenceRecord getByDateTime(String date, String time) {
+ SQLiteDatabase db = dbHelper.getReadableDatabase();
+ Cursor cursor = null;
+ try {
+ cursor = db.query(TABLE, null, BeanPropEnum.Conference.confdate.toString() + "=? and " + BeanPropEnum.Conference.confsigntime + "<=? and " + BeanPropEnum.Conference.confendtime + ">=?",
+ new String[]{date, time, time}, null, null, null);
+ if (cursor != null && cursor.moveToNext()) {
+ return getRecord(cursor);
+ }
+ } finally {
+ if (cursor != null) {
+ cursor.close();
+ }
+ }
+ return null;
+ }
+
+ private ConferenceRecord getRecord(Cursor cursor){
+ ConferenceRecord record = new ConferenceRecord();
+ record.setConfid(cursor.getInt(cursor.getColumnIndex(BeanPropEnum.Conference.confid.toString())));
+ record.setConfname(cursor.getString(cursor.getColumnIndex(BeanPropEnum.Conference.confname.toString())));
+ record.setConfaddr(cursor.getString(cursor.getColumnIndex(BeanPropEnum.Conference.confaddr.toString())));
+ record.setConfdate(cursor.getString(cursor.getColumnIndex(BeanPropEnum.Conference.confdate.toString())));
+ record.setConfbegintime(cursor.getString(cursor.getColumnIndex(BeanPropEnum.Conference.confbegintime.toString())));
+ record.setConfendtime(cursor.getString(cursor.getColumnIndex(BeanPropEnum.Conference.confendtime.toString())));
+ record.setConfsigntime(cursor.getString(cursor.getColumnIndex(BeanPropEnum.Conference.confsigntime.toString())));
+ record.setConftype(cursor.getString(cursor.getColumnIndex(BeanPropEnum.Conference.conftype.toString())));
+ record.setRemark(cursor.getString(cursor.getColumnIndex(BeanPropEnum.Conference.remark.toString())));
+ return record;
+ }
+
+ private ContentValues getContentValues(ConferenceRecord record){
+ ContentValues values = new ContentValues();
+ values.put(BeanPropEnum.Conference.confid.toString(), record.getConfid());
+ values.put(BeanPropEnum.Conference.confname.toString(), record.getConfname());
+ values.put(BeanPropEnum.Conference.confaddr.toString(), record.getConfaddr());
+ values.put(BeanPropEnum.Conference.confdate.toString(), record.getConfdate());
+ values.put(BeanPropEnum.Conference.confbegintime.toString(), record.getConfbegintime());
+ values.put(BeanPropEnum.Conference.confendtime.toString(), record.getConfendtime());
+ values.put(BeanPropEnum.Conference.confsigntime.toString(), record.getConfsigntime());
+ values.put(BeanPropEnum.Conference.conftype.toString(), record.getConftype());
+ values.put(BeanPropEnum.Conference.remark.toString(), record.getRemark());
+ return values;
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/db/ConfigParaDao.java b/app/src/main/java/com/supwisdom/db/ConfigParaDao.java
new file mode 100644
index 0000000..04b9b06
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/db/ConfigParaDao.java
@@ -0,0 +1,134 @@
+package com.supwisdom.db;
+
+import android.content.ContentValues;
+import android.content.Context;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+import com.supwisdom.swterm.ConfigParaRecord;
+import java.util.concurrent.locks.Lock;
+
+/**
+ * Created by zzq on 2016-04-14.
+ */
+public class ConfigParaDao {
+ private int INDEX = 1;
+ private static ConfigParaDao dao;
+ private final String TABLE = DBConferenceHelper.TABLE_NAME_CONFIGPARA;
+ private DBConferenceHelper dbHelper;
+
+ private ConfigParaDao(Context context) {
+ dbHelper = DBConferenceHelper.getInstance(context);
+ }
+
+ public Lock getLock() {
+ return dbHelper.getLock();
+ }
+
+ public static ConfigParaDao getInstance(Context context) {
+ if (dao == null) {
+ synchronized (ConfigParaDao.class) {
+ if (dao == null) {
+ dao = new ConfigParaDao(context);
+ }
+ }
+ }
+ return dao;
+ }
+
+ public boolean replace(ConfigParaRecord record) {
+ SQLiteDatabase db = dbHelper.getReadableDatabase();
+ ContentValues values = getContentValues(record);
+ try {
+ db.beginTransaction();
+ if (db.replace(TABLE, null, values) > 0) {
+ db.setTransactionSuccessful();
+ return true;
+ }
+ } finally {
+ db.endTransaction();
+ }
+ return false;
+ }
+
+ public boolean update(ConfigParaRecord record) {
+ SQLiteDatabase db = dbHelper.getWritableDatabase();
+ ContentValues values = getContentValues(record);
+ try {
+ db.beginTransaction();
+ if (db.update(TABLE, values, BeanPropEnum.ConfigPara.id + "=?", new String[]{Integer.toString(INDEX)}) > 0) {
+ db.setTransactionSuccessful();
+ return true;
+ }
+ } finally {
+ db.endTransaction();
+ }
+ return false;
+ }
+
+ public ConfigParaRecord get() {
+ SQLiteDatabase db = dbHelper.getReadableDatabase();
+ Cursor cursor = null;
+ try {
+ cursor = db.query(TABLE, null, BeanPropEnum.ConfigPara.id.toString() + "=?",
+ new String[]{"" + INDEX}, null, null, null);
+ if (cursor != null && cursor.moveToNext()) {
+ return getRecord(cursor);
+ }
+ } finally {
+ if (cursor != null) {
+ cursor.close();
+ }
+ }
+ return null;
+ }
+
+ private ConfigParaRecord getRecord(Cursor cursor) {
+ ConfigParaRecord record = new ConfigParaRecord();
+ record.setMode(cursor.getInt(cursor.getColumnIndex(BeanPropEnum.ConfigPara.mode.toString())));
+ record.setDeviceid(cursor.getInt(cursor.getColumnIndex(BeanPropEnum.ConfigPara.deviceid.toString())));
+ record.setDevicename(cursor.getString(cursor.getColumnIndex(BeanPropEnum.ConfigPara.devicename.toString())));
+ record.setDevphyid(cursor.getString(cursor.getColumnIndex(BeanPropEnum.ConfigPara.devphyid.toString())));
+ record.setEpayIP(cursor.getString(cursor.getColumnIndex(BeanPropEnum.ConfigPara.epayIP.toString())));
+ record.setEpayPort(cursor.getInt(cursor.getColumnIndex(BeanPropEnum.ConfigPara.epayPort.toString())));
+ record.setEpayUri(cursor.getString(cursor.getColumnIndex(BeanPropEnum.ConfigPara.epayUri.toString())));
+ int value = cursor.getInt(cursor.getColumnIndex(BeanPropEnum.ConfigPara.initOK.toString()));
+ if (value == 1) {
+ record.setInitOK(true);
+ } else {
+ record.setInitOK(false);
+ }
+ return record;
+ }
+
+ public boolean clear() {
+ SQLiteDatabase db = dbHelper.getWritableDatabase();
+ try {
+ db.beginTransaction();
+ if (db.delete(TABLE, null, null) < 0) {
+ return false;
+ }
+ db.setTransactionSuccessful();
+ return true;
+ } finally {
+ db.endTransaction();
+ }
+ }
+
+ private ContentValues getContentValues(ConfigParaRecord record) {
+ ContentValues values = new ContentValues();
+ values.put(BeanPropEnum.ConfigPara.id.toString(), INDEX);
+ values.put(BeanPropEnum.ConfigPara.mode.toString(), record.getMode());
+ values.put(BeanPropEnum.ConfigPara.deviceid.toString(), record.getDeviceid());
+ values.put(BeanPropEnum.ConfigPara.devicename.toString(), record.getDevicename());
+ values.put(BeanPropEnum.ConfigPara.devphyid.toString(), record.getDevphyid());
+ values.put(BeanPropEnum.ConfigPara.epayIP.toString(), record.getEpayIP());
+ values.put(BeanPropEnum.ConfigPara.epayPort.toString(), record.getEpayPort());
+ values.put(BeanPropEnum.ConfigPara.epayUri.toString(), record.getEpayUri());
+ if (record.isInitOK()) {
+ values.put(BeanPropEnum.ConfigPara.initOK.toString(), 1);
+ } else {
+ values.put(BeanPropEnum.ConfigPara.initOK.toString(), 0);
+ }
+ return values;
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/db/ControlParaDao.java b/app/src/main/java/com/supwisdom/db/ControlParaDao.java
new file mode 100644
index 0000000..2adc9cb
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/db/ControlParaDao.java
@@ -0,0 +1,113 @@
+package com.supwisdom.db;
+
+import android.content.ContentValues;
+import android.content.Context;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+
+import com.supwisdom.swterm.ControlParaRecord;
+
+import java.util.concurrent.locks.Lock;
+
+/**
+ * Created by zzq on 2016-06-20.
+ */
+public class ControlParaDao {
+ private static ControlParaDao dao;
+ private DBParaHelper dbHelper;
+ private final String TABLE = DBParaHelper.TABLE_NAME_CONTROLPARA;
+
+ private ControlParaDao(Context context) {
+ dbHelper = DBParaHelper.getInstance(context);
+ }
+
+ public Lock getLock() {
+ return dbHelper.getLock();
+ }
+
+ public static ControlParaDao getInstance(Context context) {
+ if (dao == null) {
+ synchronized (ControlParaDao.class) {
+ if (dao == null) {
+ dao = new ControlParaDao(context);
+ }
+ }
+ }
+ return dao;
+ }
+
+ public boolean replace(ControlParaRecord record) {
+ SQLiteDatabase db = dbHelper.getReadableDatabase();
+ ContentValues values = getContentValues(record);
+ try {
+ db.beginTransaction();
+ if (db.replace(TABLE, null, values) > 0) {
+ db.setTransactionSuccessful();
+ return true;
+ }
+ } finally {
+ db.endTransaction();
+ }
+ return false;
+ }
+
+ public boolean update(ControlParaRecord record) {
+ SQLiteDatabase db = dbHelper.getWritableDatabase();
+ ContentValues values = getContentValues(record);
+ try {
+ db.beginTransaction();
+ if (db.update(TABLE, values, BeanPropEnum.ControlPara.name + "=?", new String[]{record.getName()}) > 0) {
+ db.setTransactionSuccessful();
+ return true;
+ }
+ } finally {
+ db.endTransaction();
+ }
+ return false;
+ }
+
+ public ControlParaRecord get(String name) {
+ SQLiteDatabase db = dbHelper.getReadableDatabase();
+ Cursor cursor = null;
+ try {
+ cursor = db.query(TABLE, null, BeanPropEnum.ControlPara.name.toString() + "=?",
+ new String[]{name}, null, null, null);
+ if (cursor != null && cursor.moveToNext()) {
+ return getRecord(cursor);
+ }
+ } finally {
+ if (cursor != null) {
+ cursor.close();
+ }
+ }
+ return null;
+ }
+
+ private ControlParaRecord getRecord(Cursor cursor) {
+ ControlParaRecord record = new ControlParaRecord();
+ record.setName(cursor.getString(cursor.getColumnIndex(BeanPropEnum.ControlPara.name.toString())));
+ record.setValue(cursor.getString(cursor.getColumnIndex(BeanPropEnum.ControlPara.val.toString())));
+ return record;
+ }
+
+ public boolean clear() {
+ SQLiteDatabase db = dbHelper.getWritableDatabase();
+ try {
+ db.beginTransaction();
+ if (db.delete(DBParaHelper.TABLE_NAME_CONTROLPARA, null, null) < 0) {
+ return false;
+ }
+ db.setTransactionSuccessful();
+ return true;
+ } finally {
+ db.endTransaction();
+ }
+ }
+
+ private ContentValues getContentValues(ControlParaRecord record) {
+ ContentValues values = new ContentValues();
+ values.put(BeanPropEnum.ControlPara.name.toString(), record.getName());
+ values.put(BeanPropEnum.ControlPara.val.toString(), record.getValue());
+ return values;
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/db/DBConferenceHelper.java b/app/src/main/java/com/supwisdom/db/DBConferenceHelper.java
new file mode 100644
index 0000000..3b2c71a
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/db/DBConferenceHelper.java
@@ -0,0 +1,74 @@
+package com.supwisdom.db;
+
+import android.content.Context;
+import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteOpenHelper;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+public class DBConferenceHelper extends SQLiteOpenHelper {
+
+ public static final String TABLE_NAME_CONFERENCE = "tb_conference";
+ public static final String TABLE_NAME_CONFIGPARA = "tb_configpara";
+
+ private static final String CREATE_TABLE_NAME_CONFERENCE = "create table IF NOT EXISTS "
+ + TABLE_NAME_CONFERENCE + " ( "
+ + BeanPropEnum.Conference.confid + " integer primary key, "
+ + BeanPropEnum.Conference.confname + " varchar(64), "
+ + BeanPropEnum.Conference.confaddr + " varchar(64), "
+ + BeanPropEnum.Conference.confdate + " char(8), "
+ + BeanPropEnum.Conference.confbegintime + " char(6), "
+ + BeanPropEnum.Conference.confendtime + " char(6), "
+ + BeanPropEnum.Conference.confsigntime + " char(6), "
+ + BeanPropEnum.Conference.conftype + " char(1), "
+ + BeanPropEnum.Conference.remark + " varchar(100)) ";
+
+ private static final String CREATE_TABLE_NAME_CONFIGPARA = "create table IF NOT EXISTS "
+ + TABLE_NAME_CONFIGPARA + " ( "
+ + BeanPropEnum.ConfigPara.id + " long primary key, "
+ + BeanPropEnum.ConfigPara.mode + " integer, "
+ + BeanPropEnum.ConfigPara.deviceid + " integer, "
+ + BeanPropEnum.ConfigPara.devicename + " varchar(64), "
+ + BeanPropEnum.ConfigPara.devphyid + " char(12), "
+ + BeanPropEnum.ConfigPara.epayIP + " varchar(128), "
+ + BeanPropEnum.ConfigPara.epayPort + " integer, "
+ + BeanPropEnum.ConfigPara.epayUri + " varchar(128), "
+ + BeanPropEnum.ConfigPara.initOK + " integer ) ";
+
+ private static final String DB_NAME = "supwisdom.swpos.dbdtl";
+ private static final int VERSION = 1;
+ private static volatile DBConferenceHelper instance;
+ private static final Lock lock = new ReentrantLock();
+
+ private DBConferenceHelper(Context context){
+ super(context, DB_NAME, null, VERSION);
+ }
+
+ public Lock getLock() {
+ return lock;
+ }
+
+ public static DBConferenceHelper getInstance(Context context) {
+ if (null == instance) {
+ synchronized (DBConferenceHelper.class) {
+ if (null == instance) {
+ instance = new DBConferenceHelper(context);
+ }
+ }
+ }
+ return instance;
+ }
+
+ @Override
+ public void onCreate(SQLiteDatabase db) {
+ db.execSQL(CREATE_TABLE_NAME_CONFERENCE);
+ db.execSQL(CREATE_TABLE_NAME_CONFIGPARA);
+ }
+
+ @Override
+ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
+ if(oldVersion < newVersion){
+
+ }
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/db/DBParaHelper.java b/app/src/main/java/com/supwisdom/db/DBParaHelper.java
new file mode 100644
index 0000000..b575fbb
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/db/DBParaHelper.java
@@ -0,0 +1,52 @@
+package com.supwisdom.db;
+
+import android.content.Context;
+import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteOpenHelper;
+
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+public class DBParaHelper extends SQLiteOpenHelper {
+ public static final String TABLE_NAME_CONTROLPARA = "tb_controlpara";
+
+ private static final String CREATE_TABLE_NAME_CONTROLPARA = "create table IF NOT EXISTS "
+ + TABLE_NAME_CONTROLPARA + " ( "
+ + BeanPropEnum.ControlPara.name + " varchar(64) primary key,"
+ + BeanPropEnum.ControlPara.val + " varchar(64) )";
+
+ private static final String DB_NAME = "supwisdom.swpos.dbpara";
+
+ private static final int VERSION = 1;
+ private volatile static DBParaHelper instance;
+ private static final Lock lock = new ReentrantLock();
+
+ private DBParaHelper(Context context) {
+ super(context, DB_NAME, null, VERSION);
+ }
+
+ public static DBParaHelper getInstance(Context context) {
+ if (null == instance) {
+ synchronized (DBParaHelper.class) {
+ if (null == instance) {
+ instance = new DBParaHelper(context);
+ }
+ }
+ }
+ return instance;
+ }
+
+ public Lock getLock() {
+ return lock;
+ }
+
+ @Override
+ public void onCreate(SQLiteDatabase db) {
+ db.execSQL(CREATE_TABLE_NAME_CONTROLPARA);
+ }
+
+ @Override
+ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
+
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/db/SDCardContext.java b/app/src/main/java/com/supwisdom/db/SDCardContext.java
new file mode 100644
index 0000000..d39a7de
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/db/SDCardContext.java
@@ -0,0 +1,69 @@
+package com.supwisdom.db;
+
+import android.content.Context;
+import android.content.ContextWrapper;
+import android.database.DatabaseErrorHandler;
+import android.database.sqlite.SQLiteDatabase;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Created by zzq on 2016-10-14.
+ */
+public class SDCardContext extends ContextWrapper {
+ public SDCardContext(Context context) {
+ super(context);
+ }
+
+ @Override
+ public File getDatabasePath(String name) {
+ if (android.os.Environment.MEDIA_MOUNTED.equals(android.os.Environment.getExternalStorageState())) {
+ //获取sd卡路径
+ String dbDir = android.os.Environment.getExternalStorageDirectory().getAbsolutePath();
+ dbDir += "/supwisdom";//数据库所在目录
+ String dbPath = dbDir + "/" + name;//数据库路径
+ //判断目录是否存在,不存在则创建该目录
+ File dirFile = new File(dbDir);
+ if (!dirFile.exists()) {
+ dirFile.mkdirs();
+ }
+ File dbFile = new File(dbPath);
+ if (!dbFile.exists()) {
+ try {
+ if (dbFile.createNewFile()) {
+ return dbFile;
+ }
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ } else {
+ return dbFile;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public SQLiteDatabase openOrCreateDatabase(String name, int mode,
+ SQLiteDatabase.CursorFactory factory) {
+ File file = getDatabasePath(name);
+ if (file == null) {
+ return super.openOrCreateDatabase(name, mode, factory);
+ } else {
+ return SQLiteDatabase.openOrCreateDatabase(file, factory);
+ }
+ }
+
+ @Override
+ public SQLiteDatabase openOrCreateDatabase(String name, int mode, SQLiteDatabase.
+ CursorFactory factory, DatabaseErrorHandler errorHandler) {
+ File file = getDatabasePath(name);
+ if (file == null) {
+ return super.openOrCreateDatabase(name, mode, factory, errorHandler);
+ } else {
+ return SQLiteDatabase.openOrCreateDatabase(file, factory);
+ }
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/okhttp/Callbackok.java b/app/src/main/java/com/supwisdom/okhttp/Callbackok.java
new file mode 100644
index 0000000..89f71b2
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/okhttp/Callbackok.java
@@ -0,0 +1,8 @@
+package com.supwisdom.okhttp;
+
+/**
+ * Created by zzq on 2016-05-20.
+ */
+public interface Callbackok<T> {
+ void callbackok(T t);
+}
diff --git a/app/src/main/java/com/supwisdom/okhttp/NetworkHandler.java b/app/src/main/java/com/supwisdom/okhttp/NetworkHandler.java
new file mode 100644
index 0000000..922eca7
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/okhttp/NetworkHandler.java
@@ -0,0 +1,278 @@
+package com.supwisdom.okhttp;
+
+import android.support.annotation.Nullable;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.security.SecureRandom;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+import java.util.concurrent.TimeUnit;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSession;
+import javax.net.ssl.SSLSocketFactory;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+
+import okhttp3.Call;
+import okhttp3.FormBody;
+import okhttp3.MediaType;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.RequestBody;
+import okhttp3.Response;
+
+
+/**
+ * Created by zzq on 2016-04-12.
+ */
+@SuppressWarnings("ALL")
+public class NetworkHandler {
+ private static NetworkHandler instance = null;
+ private OkHttpClient client;
+ private final OkHttpClient clientLong;
+ private static final MediaType JSON = MediaType.parse("application/json; charset=utf-8");
+ private static final MediaType FORM_ENCODE = MediaType.parse("application/x-www-form-urlencoded;charset=utf-8");
+ private int commTime = 2;
+
+ public void setCommTime(int communicateTime) {
+ if (communicateTime != 0 && commTime != communicateTime) {
+ this.commTime = communicateTime;
+ client = new OkHttpClient()
+ .newBuilder()
+ .retryOnConnectionFailure(false)
+ .readTimeout(commTime, TimeUnit.SECONDS)
+ .writeTimeout(1, TimeUnit.SECONDS)
+ .connectTimeout(commTime, TimeUnit.SECONDS)
+ .hostnameVerifier(new TrustAllHostnameVerifier())
+ .sslSocketFactory(createSSLSocketFactory())
+ .build();
+ }
+ }
+
+ private NetworkHandler() {
+ client = new OkHttpClient()
+ .newBuilder()
+ .retryOnConnectionFailure(false)
+ .readTimeout(commTime, TimeUnit.SECONDS)
+ .writeTimeout(1, TimeUnit.SECONDS)
+ .connectTimeout(commTime, TimeUnit.SECONDS)
+ .hostnameVerifier(new TrustAllHostnameVerifier())
+ .sslSocketFactory(createSSLSocketFactory())
+ .build();
+ clientLong = new OkHttpClient()
+ .newBuilder()
+ .retryOnConnectionFailure(false)
+ .readTimeout(35, TimeUnit.SECONDS)
+ .writeTimeout(1, TimeUnit.SECONDS)
+ .connectTimeout(3, TimeUnit.SECONDS)
+ .hostnameVerifier(new TrustAllHostnameVerifier())
+ .sslSocketFactory(createSSLSocketFactory())
+ .build();
+ }
+
+ private static class TrustAllCerts implements X509TrustManager {
+ @Override
+ public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
+ }
+
+ @Override
+ public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
+ }
+
+ @Override
+ public X509Certificate[] getAcceptedIssuers() {
+ return new X509Certificate[0];
+ }
+ }
+
+ private static class TrustAllHostnameVerifier implements HostnameVerifier {
+ @Override
+ public boolean verify(String hostname, SSLSession session) {
+ return true;
+ }
+ }
+
+ private static SSLSocketFactory createSSLSocketFactory() {
+ try {
+ SSLContext sc = SSLContext.getInstance("TLS");
+ sc.init(null, new TrustManager[]{new TrustAllCerts()}, new SecureRandom());
+ return sc.getSocketFactory();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public static NetworkHandler getInstance() {
+ if (instance == null) {
+ synchronized (NetworkHandler.class) {
+ if (instance == null) {
+ instance = new NetworkHandler();
+ }
+ }
+ }
+ return instance;
+ }
+
+ public TransResp get(String url, WebParams params) {
+ Request request = new Request.Builder()
+ .url(geturl(url, params))
+ .addHeader("Accept", "application/json; q=0.5")
+ .addHeader("Connection", "close")
+ .build();
+ return getTransResp(request);
+ }
+
+ public void get(String url, WebParams params, final Callbackok callback) {
+ Request request = new Request.Builder()
+ .url(geturl(url, params))
+ .addHeader("Accept", "application/json; q=0.5")
+ .addHeader("Connection", "close")
+ .build();
+ client.newCall(request).enqueue(new okhttp3.Callback() {
+ @Override
+ public void onFailure(Call call, IOException e) {
+ callback.callbackok(null);
+ }
+
+ @Override
+ public void onResponse(Call call, Response response) {
+ try {
+ String content = response.body().string();
+ TransResp resp = new TransResp(response.code(), response.message());
+ if (response.isSuccessful()) {
+ resp.setRetjson(content);
+ }
+ callback.callbackok(resp);
+ } catch (Exception e) {
+ e.printStackTrace();
+ callback.callbackok(null);
+ }
+ }
+ });
+ }
+
+ public TransResp post(String url, WebParams params) {
+ FormBody.Builder builder = new FormBody.Builder();
+ for (String name : params.allParameterNames()) {
+ builder.add(name, params.getParameterString(name));
+ }
+ Request request = new Request.Builder()
+ .url(url)
+ .addHeader("Accept", "application/json; q=0.5")
+ .addHeader("Content-type", "application/x-www-form-urlencoded")
+ .addHeader("Connection", "close")
+ .post(builder.build())
+ .build();
+ return getTransResp(request);
+ }
+
+ public TransResp longPost(String url, WebParams params) {
+ FormBody.Builder builder = new FormBody.Builder();
+ for (String name : params.allParameterNames()) {
+ builder.add(name, params.getParameterString(name));
+ }
+ Request request = new Request.Builder()
+ .url(url)
+ .addHeader("Accept", "application/json; q=0.5")
+ .addHeader("Content-type", "application/x-www-form-urlencoded")
+ .addHeader("Connection", "close")
+ .post(builder.build())
+ .build();
+ return getLongTransResp(request);
+ }
+
+ public TransResp post(String url, String json) {
+ RequestBody body = RequestBody.create(JSON, json);
+ Request request = new Request.Builder()
+ .url(url)
+ .addHeader("Accept", "application/json; q=0.5")
+ .addHeader("Content-type", "application/x-www-form-urlencoded")
+ .addHeader("Connection", "close")
+ .post(body)
+ .build();
+ return getTransResp(request);
+ }
+
+ public void post(String url, String json, final Callbackok callback) {
+ RequestBody body = RequestBody.create(JSON, json);
+ Request request = new Request.Builder()
+ .url(url)
+ .addHeader("Accept", "application/json; q=0.5")
+ .addHeader("Content-type", "application/x-www-form-urlencoded")
+ .addHeader("Connection", "close")
+ .post(body)
+ .build();
+ client.newCall(request).enqueue(new okhttp3.Callback() {
+ @Override
+ public void onFailure(Call call, IOException e) {
+ callback.callbackok(null);
+ }
+
+ @Override
+ public void onResponse(Call call, Response response) {
+ try {
+ String content = response.body().string();
+ TransResp resp = new TransResp(response.code(), response.message());
+ if (response.isSuccessful()) {
+ resp.setRetjson(content);
+ }
+ callback.callbackok(resp);
+ } catch (Exception e) {
+ callback.callbackok(null);
+ }
+ }
+ });
+ }
+
+ @Nullable
+ private TransResp getLongTransResp(Request request) {
+ try {
+ Response response = clientLong.newCall(request).execute();
+ /*响应主体只能被消耗一次*/
+ String content = response.body().string();
+ TransResp resp = new TransResp(response.code(), response.message());
+ if (response.isSuccessful()) {
+ resp.setRetjson(content);
+ }
+ return resp;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ @Nullable
+ private TransResp getTransResp(Request request) {
+ try {
+ Response response = client.newCall(request).execute();
+ /*响应主体只能被消耗一次*/
+ String content = response.body().string();
+ TransResp resp = new TransResp(response.code(), response.message());
+ if (response.isSuccessful()) {
+ resp.setRetjson(content);
+ }
+ return resp;
+ } catch (Exception e) {
+ e.printStackTrace();
+ //通讯超时
+ return null;
+ }
+ }
+
+ private String geturl(String url, WebParams params) {
+ StringBuilder sb = new StringBuilder();
+ sb.append(url);
+ if (params != null) {
+ try {
+ sb.append(params.encodeURL());
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ }
+ return sb.toString();
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/okhttp/TransResp.java b/app/src/main/java/com/supwisdom/okhttp/TransResp.java
new file mode 100644
index 0000000..6ae8d1c
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/okhttp/TransResp.java
@@ -0,0 +1,57 @@
+package com.supwisdom.okhttp;
+
+/**
+ * Created by linqing.he on 2015/1/12.
+ */
+public class TransResp {
+ /**
+ * HTTP返回码
+ */
+ private int retcode;
+ /**
+ * 返回消息,如果是200 则为空,非200则为返回错误信息
+ */
+ private String retmsg;
+ /**
+ * 返回json信息
+ */
+ private String retjson;
+
+ public TransResp() {
+
+ }
+
+ public TransResp(int retcode, String retmsg) {
+ this.retcode = retcode;
+ this.retmsg = retmsg;
+ }
+
+ public int getRetcode() {
+ return retcode;
+ }
+
+ public void setRetcode(int retcode) {
+ this.retcode = retcode;
+ }
+
+ public String getRetmsg() {
+ return retmsg;
+ }
+
+ public void setRetmsg(String retmsg) {
+ this.retmsg = retmsg;
+ }
+
+ public String getRetjson() {
+ return retjson;
+ }
+
+ public void setRetjson(String retjson) {
+ this.retjson = retjson;
+ }
+
+ @Override
+ public String toString() {
+ return retcode + retmsg + retjson;
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/okhttp/WebAPISession.java b/app/src/main/java/com/supwisdom/okhttp/WebAPISession.java
new file mode 100644
index 0000000..b8abcaa
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/okhttp/WebAPISession.java
@@ -0,0 +1,74 @@
+package com.supwisdom.okhttp;
+
+import com.supwisdom.util.PublicDef;
+
+/**
+ * Copyright (C), 2000-2013, Supwisdom Co., Ltd.
+ * File custname: com.supwisdom.protocol
+ * Description: TODO Modify History(或Change Log):
+ * 操作类型(创建、修改等) 操作日期 操作者 操作内容简述
+ * 创建 13-4-19 tangcheng
+ * <p/>
+ *
+ * @author tangcheng
+ * @version 1.0
+ * @since 1.0
+ */
+public class WebAPISession implements Cloneable {
+ public String getAppId() {
+ return appId;
+ }
+
+ public String getAppSecret() {
+ return appSecret;
+ }
+
+ public String getTermId() {
+ return termId;
+ }
+
+
+ public void setTermId(String termId) {
+ this.termId = termId;
+ }
+
+ /**
+ * appid,appsecret暂时写死在代码
+ */
+ private final String appId = PublicDef.APP_ID;
+ private final String appSecret = PublicDef.APP_SECRET;
+ private String termId = "";
+ public String epayurl = "";
+ private String sessionKey = null;
+
+ public String getEpayurl() {
+ return epayurl;
+ }
+
+ public void setEpayurl(String epayurl) {
+ this.epayurl = epayurl;
+ }
+
+ private boolean isAuthorized;
+
+ public WebAPISession() {
+ isAuthorized = false;
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ WebAPISession another = new WebAPISession();
+ another.termId = this.termId;
+ another.sessionKey = this.sessionKey;
+ another.isAuthorized = isAuthorized;
+ return another;
+ }
+
+ public String getSessionKey() {
+ return sessionKey;
+ }
+
+ public void setSessionKey(String sessionKey) {
+ this.sessionKey = sessionKey;
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/okhttp/WebParams.java b/app/src/main/java/com/supwisdom/okhttp/WebParams.java
new file mode 100644
index 0000000..5b3d3a1
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/okhttp/WebParams.java
@@ -0,0 +1,109 @@
+package com.supwisdom.okhttp;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.net.URLEncoder;
+import java.util.HashMap;
+import java.util.Set;
+
+/**
+ * Copyright (C), 2000-2013, Supwisdom Co., Ltd.
+ * File custname: com.supwisdom.protocol
+ * Description: TODO Modify History(或Change Log):
+ * 操作类型(创建、修改等) 操作日期 操作者 操作内容简述
+ * 创建 13-4-19 tangcheng
+ * <p/>
+ *
+ * @author tangcheng
+ * @version 1.0
+ * @since 1.0
+ */
+public class WebParams {
+ private HashMap<String, Object> mParameters = new HashMap<String, Object>();
+
+ public WebParams() {
+ }
+
+ public WebParams setParameter(String name, String value) {
+ mParameters.put(name, value);
+ return this;
+ }
+
+ public WebParams setParameter(String name, int value) {
+ mParameters.put(name, value);
+ return this;
+ }
+
+ public WebParams setParameter(String name, float value) {
+ mParameters.put(name, value);
+ return this;
+ }
+
+ public String getParameterString(String name) {
+ Object ret = mParameters.get(name);
+ if (String.class.isInstance(ret)) {
+ return (String) ret;
+ } else if (Integer.class.isInstance(ret)) {
+ return String.valueOf(ret);
+ } else if (Double.class.isInstance(ret)) {
+ return String.valueOf(ret);
+ }
+ return "";
+ }
+
+ public int getParameterInt(String name) {
+ Object ret = mParameters.get(name);
+ if (Integer.class.isInstance(ret)) {
+ return (Integer) ret;
+ }
+ return 0;
+ }
+
+ public float getParameterFloat(String name) {
+ Object ret = mParameters.get(name);
+ if (Float.class.isInstance(ret)) {
+ return (Float) ret;
+ }
+ return 0;
+ }
+
+ public void removeParameter(String name) {
+ if (mParameters.containsKey(name)) {
+ mParameters.remove(name);
+ }
+ }
+
+ public String encodeURL() throws UnsupportedEncodingException {
+ StringBuilder result = new StringBuilder();
+ for (String name : mParameters.keySet()) {
+ Object value = mParameters.get(name);
+ result.append(URLEncoder.encode(name, "utf-8"))
+ .append("=")
+ .append(URLEncoder.encode(value.toString(), "utf-8"))
+ .append("&");
+ }
+ return result.toString();
+ }
+
+ public int encodeURL(OutputStream output) throws IOException {
+ DataOutputStream byteStream = new DataOutputStream(output);
+ Writer writer = new OutputStreamWriter(byteStream, "utf-8");
+ for (String name : mParameters.keySet()) {
+ Object value = mParameters.get(name);
+ writer.write(URLEncoder.encode(name, "utf-8"));
+ writer.write("=");
+ writer.write(URLEncoder.encode(value.toString(), "utf-8"));
+ writer.write("&");
+ }
+ return byteStream.size();
+ }
+
+ public Set<String> allParameterNames() {
+ return mParameters.keySet();
+ }
+
+}
diff --git a/app/src/main/java/com/supwisdom/service/ConferenceApi.java b/app/src/main/java/com/supwisdom/service/ConferenceApi.java
new file mode 100644
index 0000000..1c8c18f
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/service/ConferenceApi.java
@@ -0,0 +1,174 @@
+package com.supwisdom.service;
+
+import com.supwisdom.bean.AttRateBean;
+import com.supwisdom.bean.BaseResp;
+import com.supwisdom.bean.CheckDtlBean;
+import com.supwisdom.bean.CheckDtlResp;
+import com.supwisdom.bean.ConferenceBean;
+import com.supwisdom.bean.ConferenceResp;
+import com.supwisdom.conferencecheck.SPApplication;
+import com.supwisdom.conferencecheck.YktSession;
+import com.supwisdom.okhttp.TransResp;
+import com.supwisdom.okhttp.WebParams;
+import com.supwisdom.swterm.ConferenceRecord;
+import com.supwisdom.swterm.Pos;
+import com.supwisdom.util.GsonUtil;
+import com.supwisdom.util.LogUtil;
+import com.supwisdom.util.PublicDef;
+
+import org.apache.http.HttpStatus;
+
+public class ConferenceApi {
+
+ private String TAG = "ConferenceApi";
+
+ private Pos pos;
+
+ public ConferenceApi(){
+ pos = SPApplication.getsInstance().getPos();
+ }
+
+ public BaseResp checkLink(){
+ try{
+ WebParams params = new WebParams();
+ params.setParameter("devphyid", pos.getConfigPara().getDevphyid());
+ TransResp resp = YktSession.getInstance().sendYktRequestPost("/conference/test", params);
+ if(resp == null){
+ return new BaseResp(PublicDef.ERROR, "通讯超时");
+ }
+ if (resp.getRetcode() != HttpStatus.SC_OK) {
+ return new BaseResp(PublicDef.ERROR, "链接错误码:"+resp.getRetcode()+"-"+resp.getRetmsg());
+ }
+ BaseResp baseResp = GsonUtil.GsonToBean(resp.getRetjson(), BaseResp.class);
+ if(baseResp.getRetcode() != PublicDef.SUCCESS){
+ return new BaseResp(PublicDef.ERROR, "链接失败:"+baseResp.getRetcode() + "-" +baseResp.getRetmsg());
+ }
+ return new BaseResp(PublicDef.SUCCESS, "链接成功");
+ }catch (Exception e){
+ e.printStackTrace();
+ LogUtil.d(TAG, "checkLink exception:" + e.getMessage());
+ return new BaseResp(PublicDef.ERROR, "链接异常");
+ }
+ }
+
+ public BaseResp syncConference(String date){
+ try{
+ WebParams params = new WebParams();
+ params.setParameter("devphyid", pos.getConfigPara().getDevphyid())
+ .setParameter("confdate", date);
+ TransResp resp = YktSession.getInstance().sendYktRequestPost("/conference/getconference", params);
+ if(resp == null){
+ return new BaseResp(PublicDef.ERROR, "通讯超时");
+ }
+ if (resp.getRetcode() != HttpStatus.SC_OK) {
+ return new BaseResp(PublicDef.ERROR, "同步会议错误码:"+resp.getRetcode()+"-"+resp.getRetmsg());
+ }
+ ConferenceResp conferenceResp = GsonUtil.GsonToBean(resp.getRetjson(), ConferenceResp.class);
+ if(conferenceResp.getRetcode() != PublicDef.SUCCESS){
+ return new BaseResp(PublicDef.ERROR, "同步会议失败:"+conferenceResp.getRetcode()+"-"+conferenceResp.getRetmsg());
+ }
+ if(null != conferenceResp.getConflist() && conferenceResp.getConflist().size() > 0){
+ boolean saveResult = true;
+ for(int i=0; i<conferenceResp.getConflist().size(); i++){
+ ConferenceBean cb = conferenceResp.getConflist().get(i);
+ ConferenceRecord cr = pos.getConferenceById(cb.getConfid());
+ if(null == cr){
+ // 本地没有此会议id,保存
+ ConferenceRecord record = new ConferenceRecord();
+ record.setConfid(cb.getConfid());
+ record.setConfname(cb.getConfname());
+ record.setConfdate(cb.getConfdate());
+ record.setConftype(cb.getConftype());
+ record.setConfbegintime(cb.getStarttime());
+ record.setConfendtime(cb.getEndtime());
+ record.setConfsigntime(cb.getAttendtime());
+ record.setConfaddr(cb.getConfarea());
+ if(!pos.insertConference(record)){
+ saveResult = false;
+ break;
+ }
+ }
+ }
+ if(!saveResult)
+ return new BaseResp(PublicDef.ERROR, "保存会议异常");
+ }
+ return new BaseResp(PublicDef.SUCCESS, "同步成功");
+ }catch (Exception e){
+ e.printStackTrace();
+ LogUtil.d(TAG, "syncConference exception:"+e.getMessage());
+ return new BaseResp(PublicDef.ERROR, "同步会议异常");
+ }
+ }
+
+ public AttRateBean getAttrate(int confid){
+ AttRateBean attRateBean = new AttRateBean();
+ try{
+ WebParams params = new WebParams();
+ params.setParameter("confid", confid);
+ TransResp resp = YktSession.getInstance().sendYktRequestPost("/conference/getattrate", params);
+ if(resp == null){
+ attRateBean.setRetcode(PublicDef.ERROR);
+ attRateBean.setRetmsg("通讯超时");
+ return attRateBean;
+ }
+ if (resp.getRetcode() != HttpStatus.SC_OK) {
+ attRateBean.setRetcode(PublicDef.ERROR);
+ attRateBean.setRetmsg("签到率错误码:"+resp.getRetcode()+"-"+resp.getRetmsg());
+ return attRateBean;
+ }
+ AttRateBean baseResp = GsonUtil.GsonToBean(resp.getRetjson(), AttRateBean.class);
+ if(baseResp.getRetcode() != PublicDef.SUCCESS){
+ attRateBean.setRetcode(PublicDef.ERROR);
+ attRateBean.setRetmsg("查询签到率失败:"+baseResp.getRetcode()+"-"+baseResp.getRetmsg());
+ return attRateBean;
+ }
+ attRateBean.setRetcode(PublicDef.SUCCESS);
+ attRateBean.setRetmsg("查询签到率成功");
+ attRateBean.setTotcnt(baseResp.getTotcnt());
+ attRateBean.setActualcnt(baseResp.getActualcnt());
+ attRateBean.setAttrate(baseResp.getAttrate());
+ return attRateBean;
+ }catch (Exception e){
+ e.printStackTrace();
+ LogUtil.d(TAG, "getAttRate exception:" + e.getMessage());
+ attRateBean.setRetcode(PublicDef.ERROR);
+ attRateBean.setRetmsg("查询签到率异常");
+ return attRateBean;
+ }
+ }
+
+ public CheckDtlResp getCheckDtl(int confid){
+ CheckDtlResp checkDtlResp = new CheckDtlResp();
+ try{
+ WebParams params = new WebParams();
+ params.setParameter("confid", confid+"");
+ TransResp resp = YktSession.getInstance().sendYktRequestPost("/conference/getconfpeople", params);
+ if(resp == null){
+ checkDtlResp.setRetcode(PublicDef.ERROR);
+ checkDtlResp.setRetmsg("通讯超时");
+ return checkDtlResp;
+ }
+ if (resp.getRetcode() != HttpStatus.SC_OK) {
+ checkDtlResp.setRetcode(PublicDef.ERROR);
+ checkDtlResp.setRetmsg("签到流水错误码:"+resp.getRetcode()+"-"+resp.getRetmsg());
+ return checkDtlResp;
+ }
+ CheckDtlResp baseResp = GsonUtil.GsonToBean(resp.getRetjson(), CheckDtlResp.class);
+ if(baseResp.getRetcode() != PublicDef.SUCCESS){
+ checkDtlResp.setRetcode(PublicDef.ERROR);
+ checkDtlResp.setRetmsg("查询签到流水失败:"+baseResp.getRetcode()+"-"+baseResp.getRetmsg());
+ return checkDtlResp;
+ }
+ checkDtlResp.setRetcode(PublicDef.SUCCESS);
+ checkDtlResp.setRetmsg("查询流水成功");
+ checkDtlResp.setPeoplelist(baseResp.getPeoplelist());
+ return checkDtlResp;
+ }catch (Exception e){
+ e.printStackTrace();
+ LogUtil.d(TAG, "getCheckDtl exception:" + e.getMessage());
+ checkDtlResp.setRetcode(PublicDef.ERROR);
+ checkDtlResp.setRetmsg("查询签到流水异常");
+ return checkDtlResp;
+ }
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/swterm/CheckRecord.java b/app/src/main/java/com/supwisdom/swterm/CheckRecord.java
new file mode 100644
index 0000000..47b9894
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/swterm/CheckRecord.java
@@ -0,0 +1,58 @@
+package com.supwisdom.swterm;
+
+public class CheckRecord {
+ private String custname;
+ private String custtypename;
+ private String deptname;
+ private String date;
+ private String time;
+ private String status;
+
+ public String getCustname() {
+ return custname;
+ }
+
+ public void setCustname(String custname) {
+ this.custname = custname;
+ }
+
+ public String getCusttypename() {
+ return custtypename;
+ }
+
+ public void setCusttypename(String custtypename) {
+ this.custtypename = custtypename;
+ }
+
+ public String getDeptname() {
+ return deptname;
+ }
+
+ public void setDeptname(String deptname) {
+ this.deptname = deptname;
+ }
+
+ public String getDate() {
+ return date;
+ }
+
+ public void setDate(String date) {
+ this.date = date;
+ }
+
+ public String getTime() {
+ return time;
+ }
+
+ public void setTime(String time) {
+ this.time = time;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/swterm/ConferenceRecord.java b/app/src/main/java/com/supwisdom/swterm/ConferenceRecord.java
new file mode 100644
index 0000000..89f4557
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/swterm/ConferenceRecord.java
@@ -0,0 +1,85 @@
+package com.supwisdom.swterm;
+
+public class ConferenceRecord {
+ private int confid;
+ private String confname;
+ private String confaddr;
+ private String confdate;
+ private String confbegintime;
+ private String confendtime;
+ private String confsigntime;
+ private String conftype;
+ private String remark;
+
+ public int getConfid() {
+ return confid;
+ }
+
+ public void setConfid(int confid) {
+ this.confid = confid;
+ }
+
+ public String getConfname() {
+ return confname;
+ }
+
+ public void setConfname(String confname) {
+ this.confname = confname;
+ }
+
+ public String getConfaddr() {
+ return confaddr;
+ }
+
+ public void setConfaddr(String confaddr) {
+ this.confaddr = confaddr;
+ }
+
+ public String getConfdate() {
+ return confdate;
+ }
+
+ public void setConfdate(String confdate) {
+ this.confdate = confdate;
+ }
+
+ public String getConfbegintime() {
+ return confbegintime;
+ }
+
+ public void setConfbegintime(String confbegintime) {
+ this.confbegintime = confbegintime;
+ }
+
+ public String getConfendtime() {
+ return confendtime;
+ }
+
+ public void setConfendtime(String confendtime) {
+ this.confendtime = confendtime;
+ }
+
+ public String getConfsigntime() {
+ return confsigntime;
+ }
+
+ public void setConfsigntime(String confsigntime) {
+ this.confsigntime = confsigntime;
+ }
+
+ public String getConftype() {
+ return conftype;
+ }
+
+ public void setConftype(String conftype) {
+ this.conftype = conftype;
+ }
+
+ public String getRemark() {
+ return remark;
+ }
+
+ public void setRemark(String remark) {
+ this.remark = remark;
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/swterm/ConfigParaRecord.java b/app/src/main/java/com/supwisdom/swterm/ConfigParaRecord.java
new file mode 100644
index 0000000..f6a69dd
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/swterm/ConfigParaRecord.java
@@ -0,0 +1,78 @@
+package com.supwisdom.swterm;
+
+public class ConfigParaRecord {
+ private int mode;// 功能模式 1--会议签到
+ private int deviceid; // 设备ID
+ private String devicename;//设备名称
+ private String devphyid;
+
+ private String epayIP;
+ private int epayPort;
+ private String epayUri;
+
+ private boolean initOK; //是否初始化 true--已初始化,false--未初始化
+
+ public int getMode() {
+ return mode;
+ }
+
+ public void setMode(int mode) {
+ this.mode = mode;
+ }
+
+ public int getDeviceid() {
+ return deviceid;
+ }
+
+ public void setDeviceid(int deviceid) {
+ this.deviceid = deviceid;
+ }
+
+ public String getDevicename() {
+ return devicename;
+ }
+
+ public void setDevicename(String devicename) {
+ this.devicename = devicename;
+ }
+
+ public String getDevphyid() {
+ return devphyid;
+ }
+
+ public void setDevphyid(String devphyid) {
+ this.devphyid = devphyid;
+ }
+
+ public String getEpayIP() {
+ return epayIP;
+ }
+
+ public void setEpayIP(String epayIP) {
+ this.epayIP = epayIP;
+ }
+
+ public int getEpayPort() {
+ return epayPort;
+ }
+
+ public void setEpayPort(int epayPort) {
+ this.epayPort = epayPort;
+ }
+
+ public String getEpayUri() {
+ return epayUri;
+ }
+
+ public void setEpayUri(String epayUri) {
+ this.epayUri = epayUri;
+ }
+
+ public boolean isInitOK() {
+ return initOK;
+ }
+
+ public void setInitOK(boolean initOK) {
+ this.initOK = initOK;
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/swterm/ControlParaRecord.java b/app/src/main/java/com/supwisdom/swterm/ControlParaRecord.java
new file mode 100644
index 0000000..33e1e11
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/swterm/ControlParaRecord.java
@@ -0,0 +1,30 @@
+package com.supwisdom.swterm;
+
+public class ControlParaRecord {
+ private String name;
+ private String value;
+
+ public ControlParaRecord() {
+ }
+
+ public ControlParaRecord(String name, String value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/swterm/Pos.java b/app/src/main/java/com/supwisdom/swterm/Pos.java
new file mode 100644
index 0000000..77a1dff
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/swterm/Pos.java
@@ -0,0 +1,127 @@
+package com.supwisdom.swterm;
+
+import android.content.Context;
+
+import com.supwisdom.db.ConferenceDao;
+import com.supwisdom.db.ConfigParaDao;
+import com.supwisdom.db.ControlParaDao;
+import com.supwisdom.db.SDCardContext;
+
+import java.util.HashMap;
+import java.util.List;
+
+public class Pos {
+ private final Context context;
+
+ private ConferenceDao conferenceDao;
+
+ private ControlParaDao controlParaDao;
+ private HashMap<String, ControlParaRecord> controlParamap;
+
+ private ConfigParaDao configParaDao;
+ private ConfigParaRecord configParaRecord;
+
+ public Pos(Context context){
+ this.context = context;
+ controlParaDao = ControlParaDao.getInstance(context);
+ controlParamap = new HashMap<>();
+
+ // 存储到SD卡
+ SDCardContext sdContext = new SDCardContext(context);
+ conferenceDao = ConferenceDao.getInstance(sdContext);
+ configParaDao = ConfigParaDao.getInstance(sdContext);
+ }
+
+ public List<ConferenceRecord> getConferences(String date){
+ try {
+ conferenceDao.getLock().lock();
+ return conferenceDao.getByDate(date);
+ } finally {
+ conferenceDao.getLock().unlock();
+ }
+ }
+
+ public ConferenceRecord getConference(String date, String time){
+ try {
+ conferenceDao.getLock().lock();
+ return conferenceDao.getByDateTime(date, time);
+ } finally {
+ conferenceDao.getLock().unlock();
+ }
+ }
+
+ public ConferenceRecord getConferenceById(int conid){
+ try {
+ conferenceDao.getLock().lock();
+ return conferenceDao.get(conid);
+ } finally {
+ conferenceDao.getLock().unlock();
+ }
+ }
+
+ public boolean insertConference(ConferenceRecord record) {
+ try {
+ conferenceDao.getLock().lock();
+ if (conferenceDao.save(record)) {
+ return true;
+ }
+ } finally {
+ conferenceDao.getLock().unlock();
+ }
+ return false;
+ }
+
+ public boolean replaceConfigPara(ConfigParaRecord record) {
+ try {
+ configParaDao.getLock().lock();
+ if (configParaDao.replace(record)) {
+ configParaRecord = record;
+ return true;
+ }
+ } finally {
+ configParaDao.getLock().unlock();
+ }
+ return false;
+ }
+
+ public ConfigParaRecord getConfigPara() {
+ if (configParaRecord == null) {
+ try {
+ configParaDao.getLock().lock();
+ configParaRecord = configParaDao.get();
+ } finally {
+ configParaDao.getLock().unlock();
+ }
+ }
+ return configParaRecord;
+ }
+
+ public boolean replaceControlPara(ControlParaRecord record) {
+ try {
+ controlParaDao.getLock().lock();
+ if (controlParaDao.replace(record)) {
+ controlParamap.put(record.getName(), record);
+ return true;
+ }
+ } finally {
+ controlParaDao.getLock().unlock();
+ }
+ return false;
+ }
+
+ public ControlParaRecord getControlPara(String name) {
+ if (controlParamap.containsKey(name)) {
+ return controlParamap.get(name);
+ }
+ try {
+ controlParaDao.getLock().lock();
+ ControlParaRecord record = controlParaDao.get(name);
+ if (record != null) {
+ controlParamap.put(record.getName(), record);
+ }
+ return record;
+ } finally {
+ controlParaDao.getLock().unlock();
+ }
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/util/AppExitUtil.java b/app/src/main/java/com/supwisdom/util/AppExitUtil.java
new file mode 100644
index 0000000..3e6dedb
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/util/AppExitUtil.java
@@ -0,0 +1,56 @@
+package com.supwisdom.util;
+
+import android.app.Activity;
+
+import java.util.HashSet;
+import java.util.Iterator;
+
+/**
+ * Created by jov on 2015/2/5.
+ */
+public class AppExitUtil {
+ private static HashSet<Activity> acys = new HashSet<>();
+
+ public static void add(Activity acy) {
+ acys.add(acy);
+ }
+
+ public static void remove(Activity acy) {
+ acys.remove(acy);
+ if (!acy.isFinishing()) {
+ acy.finish();
+ }
+ if (acys.size() == 0) {
+ killprocess();
+ }
+ }
+
+ public static void exit() {
+ Iterator iter = acys.iterator();
+ Activity arrs[] = new Activity[acys.size()];
+ int i = 0;
+ while (iter.hasNext()) {
+ Activity tmp = (Activity) iter.next();
+ arrs[i] = tmp;
+ i += 1;
+ }
+ acys.clear();
+ for (int j = 0; j < arrs.length; j++) {
+ if (arrs[j] != null && !arrs[j].isFinishing()) {
+ arrs[j].finish();
+ arrs[j] = null;
+ }
+ }
+ killprocess();
+ }
+
+ private static void killprocess() {
+ ThreadPool.getShortPool().execute(new Runnable() {
+ @Override
+ public void run() {
+ CommonUtil.doSleep(2000);
+ android.os.Process.killProcess(android.os.Process.myPid());
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/util/CommonUtil.java b/app/src/main/java/com/supwisdom/util/CommonUtil.java
new file mode 100644
index 0000000..06b34bd
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/util/CommonUtil.java
@@ -0,0 +1,860 @@
+package com.supwisdom.util;
+
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.media.AudioManager;
+import android.media.SoundPool;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+import android.net.Uri;
+import android.os.Build;
+import android.os.PowerManager;
+import android.provider.Settings;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
+import android.widget.EditText;
+
+import com.google.zxing.common.BitSource;
+import com.google.zxing.qrcode.decoder.Mode;
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.lang.reflect.Method;
+import java.security.InvalidParameterException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.text.DecimalFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import javax.crypto.Cipher;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+
+
+/**
+ * Created by jov on 2015/1/16.
+ */
+@SuppressWarnings("ALL")
+public class CommonUtil {
+ private static FastDateFormat FORMAT_yyyyMMdd = FastDateFormat.getInstance("yyyyMMdd");
+ private static FastDateFormat FORMAT_yyMMdd = FastDateFormat.getInstance("yyMMdd");
+ private static FastDateFormat FORMAT_HHmmss = FastDateFormat.getInstance("HHmmss");
+ private static FastDateFormat FORMAT_HHmm = FastDateFormat.getInstance("HHmm");
+ private static FastDateFormat FORMAT_yyyyMMddHHmmss = FastDateFormat.getInstance("yyyyMMddHHmmss");
+ private static FastDateFormat FORMAT_yyyy_MM_dd_HH_mm_ss = FastDateFormat.getInstance("yyyy-MM-dd HH:mm:ss");
+ private static FastDateFormat FORMAT_yyyy_MM_dd = FastDateFormat.getInstance("yyyy-MM-dd");
+ private static FastDateFormat FORMAT_HH_mm_ss = FastDateFormat.getInstance("HH:mm:ss");
+ private static FastDateFormat FORMAT_HH_mm = FastDateFormat.getInstance("HH:mm");
+ private static FastDateFormat FORMAT_WEEK = FastDateFormat.getInstance("EEEE");
+
+ private static int soundId;
+ private static SoundPool soundPool;
+ private static HashMap<Integer, Integer> soundMap = new HashMap<>();
+
+ public static void DUMP(String classname, String logmsg) {
+ if (isEmpty(logmsg)) {
+ return;
+ }
+ String datetime = getNowDateTimeNoFormat();
+ StringBuilder msg = new StringBuilder();
+ msg.append(classname).append("-").append(datetime.substring(8)).append("\r\n").append(logmsg);
+ FileUtil.writeLogFile(msg.toString());
+ }
+
+ public static String getExceptionStack(Exception e) {
+ if (e == null) {
+ return "null";
+ }
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ e.printStackTrace(pw);
+ return sw.toString();
+ }
+
+ /**
+ * 计算超时时间,精确到毫秒
+ *
+ * @param milliSeconds
+ * @return
+ */
+ public static long getExpireTime(long milliSeconds) {
+ return (new Date().getTime() + milliSeconds);
+ }
+
+ public static long getNowTime() {
+ return new Date().getTime();
+ }
+
+ public static String getNowDate() {
+ return FORMAT_yyyy_MM_dd_HH_mm_ss.format(new Date());
+ }
+
+ public static String getWeek() {
+ return FORMAT_WEEK.format(new Date());
+ }
+
+ public static String getNowDateSpecFormat() {
+ return FORMAT_yyyy_MM_dd.format(new Date());
+ }
+
+ public static String getNowTimeSpecFormat() {
+ return FORMAT_HH_mm_ss.format(new Date());
+ }
+
+ public static String getNowDateTimeNoFormat() {
+ return FORMAT_yyyyMMddHHmmss.format(new Date());
+ }
+
+ public static String getNowShortDateNoFormat() {
+ return FORMAT_yyMMdd.format(new Date());
+ }
+
+ public static String getNowDateNoFormat() {
+ return FORMAT_yyyyMMdd.format(new Date());
+ }
+
+ public static String getNowTimeNoFormat() {
+ return FORMAT_HHmmss.format(new Date());
+ }
+
+ public static String getNowTimeNoFormat2() {
+ return FORMAT_HHmm.format(new Date());
+ }
+
+ public static String getYesterdayDateNoFormat() {
+ return FORMAT_yyyyMMdd.format(new Date(new Date().getTime() - 24 * 60 * 60 * 1000));
+ }
+
+ public static String getDayDateNoFormatBefore(int daynum) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.add(Calendar.DATE, -daynum);
+ return FORMAT_yyyyMMdd.format(calendar.getTime());
+ }
+
+ public static long getNowTimeByDateString(String datetime) {
+ SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
+ try {
+ return format.parse(datetime).getTime();
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ return 0;
+ }
+
+ public static boolean isEmpty(String str) {
+ return str == null || str.trim().length() == 0;
+ }
+
+ public static boolean isNetWorkConnected(Context context) {
+ if (context != null) {
+ ConnectivityManager mConnectivityManager = (ConnectivityManager) context
+ .getSystemService(Context.CONNECTIVITY_SERVICE);
+ NetworkInfo mNetworkInfo = mConnectivityManager
+ .getActiveNetworkInfo();
+ if (mNetworkInfo != null) {
+ return mNetworkInfo.isAvailable();
+ }
+ }
+ return false;
+ }
+
+ public static boolean isNumeric(String str) {
+ Pattern pattern = Pattern.compile("[0-9]*");
+ Matcher isNum = pattern.matcher(str);
+ if (!isNum.matches()) {
+ return false;
+ }
+ return true;
+ }
+
+ public static String formatDate(String date){
+ if(null == date)
+ return "";
+ if(date.length() != 8)
+ return date;
+ return date.substring(0,4) + "-" + date.substring(4, 6) + "-" + date.substring(6);
+ }
+
+ public static String formatTime(String time){
+ if(null == time)
+ return "";
+ if(time.length() == 4){
+ return time.substring(0,2) + ":" + time.substring(2);
+ }else if(time.length() == 6){
+ return time.substring(0,2) + ":" + time.substring(2,4) + ":" + time.substring(4);
+ }else{
+ return time;
+ }
+ }
+
+ public static boolean isIP(String str) {
+ if (str.matches("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}")) {
+ String s[] = str.split("\\.");
+ if (Integer.parseInt(s[0]) < 255)
+ if (Integer.parseInt(s[1]) < 255)
+ if (Integer.parseInt(s[2]) < 255)
+ if (Integer.parseInt(s[3]) < 255)
+ return true;
+ }
+ return false;
+ }
+
+ public static String getSystemMills() {
+ return String.format("%08d", System.currentTimeMillis() % 10000000);
+ }
+
+ /**
+ * 获得指定日期的前一天
+ */
+ public static String getSpecifiedDayBefore(String specifiedDay) {
+ //SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+ Calendar c = Calendar.getInstance();
+ Date date = null;
+ try {
+ date = new SimpleDateFormat("yyyyMMdd").parse(specifiedDay);
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ c.setTime(date);
+ int day = c.get(Calendar.DATE);
+ c.set(Calendar.DATE, day - 1);
+ String dayBefore = new SimpleDateFormat("yyyyMMdd").format(c.getTime());
+ return dayBefore;
+ }
+
+ /**
+ * 获得指定日期的后一天
+ */
+ public static String getSpecifiedDayAfter(String specifiedDay) {
+ Calendar c = Calendar.getInstance();
+ Date date = null;
+ try {
+ date = new SimpleDateFormat("yyyyMMdd").parse(specifiedDay);
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ c.setTime(date);
+ int day = c.get(Calendar.DATE);
+ c.set(Calendar.DATE, day + 1);
+ String dayAfter = new SimpleDateFormat("yyyyMMdd").format(c.getTime());
+ return dayAfter;
+ }
+
+ public static String encodingMD5(String val) {
+ MessageDigest md5 = null;
+ try {
+ md5 = MessageDigest.getInstance("MD5");
+ } catch (NoSuchAlgorithmException e) {
+ throw new RuntimeException("MD5 should be unsupported", e);
+ }
+ md5.update(val.getBytes());
+ byte[] m = md5.digest();//加密
+ return getString(m);
+ }
+
+ private static String getString(byte[] b) {
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < b.length; i++) {
+ sb.append(b[i]);
+ }
+ return sb.toString();
+ }
+
+ public static String showFormatAmount(String preHint, int amount) {
+ return String.format("%s: %.02f元", preHint, amount / 100.0f);
+ }
+
+ /**
+ * 作用:读取该字节某一位的值是否为1
+ * 为1返回true
+ * 为0返回false
+ *
+ * @param data
+ * @param bitOffset
+ * @return
+ */
+ public static boolean checkBit(byte data, int bitOffset) {
+ int result = 0;
+ result = data & (1 << bitOffset);//00011000
+ if (result == 0) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ public static int setBit(int data, int position) {
+ int finalPos = 7 - position;
+ int result = data;
+ result |= (1 << finalPos);
+ return result;
+ }
+
+ public static int clearBit(int data, int position) {
+ int finalPos = 7 - position;
+ int result = data;
+ result &= ~(1 << finalPos);
+ return result;
+ }
+
+ public static void setDatetime(String date, String time) {
+ try {
+ Process process = Runtime.getRuntime().exec("su");
+ String datetime = date + "." + time; //测试的设置的时间【时间格式 yyyyMMdd.HHmmss】
+ DataOutputStream os = new DataOutputStream(process.getOutputStream());
+ os.writeBytes("setprop persist.sys.timezone GMT\n");
+ os.writeBytes("/system/bin/date -s " + datetime + "\n");
+ os.writeBytes("clock -w\n");
+ os.writeBytes("exit\n");
+ os.flush();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void doSleep(long ms) {
+ try {
+ Thread.sleep(ms);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private static String hexStr = "0123456789ABCDEF";
+
+ public static byte[] hexStringToBinary(String hexString) {
+ String tmp = hexString.toUpperCase();
+ //hexString的长度对2取整,作为bytes的长度
+ int len = tmp.length() / 2;
+ byte[] bytes = new byte[len];
+ byte high = 0;//字节高四位
+ byte low = 0;//字节低四位
+
+ for (int i = 0; i < len; i++) {
+ //右移四位得到高位
+ high = (byte) ((hexStr.indexOf(tmp.charAt(2 * i))) << 4);
+ low = (byte) hexStr.indexOf(tmp.charAt(2 * i + 1));
+ bytes[i] = (byte) (high | low);//高地位做或运算
+ }
+ return bytes;
+ }
+
+ public static String getHexStringByBytes(byte[] bytes) {
+ StringBuilder sb = new StringBuilder();
+ int i;
+ for (i = 0; i < bytes.length; i++) {
+ sb.append(hexStr.charAt((bytes[i] >> 4) & 0x0F)).append(hexStr.charAt((bytes[i] & 0x0F)));
+ }
+ return sb.toString();
+ }
+
+ /**
+ * 加密
+ *
+ * @param content 待加密内容
+ * @param key 加密的密钥
+ * @return
+ */
+ private static byte[] mIV = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+ public static byte[] desEncrypt(String content, String key) {
+ String algorithm;
+ byte[] desKey = HexString2Bytes(key);
+ byte[] theKey;
+ if (desKey.length == 8) {
+ algorithm = "DES";
+ theKey = desKey;
+ } else if (desKey.length == 16) {
+ algorithm = "DESede";
+ theKey = new byte[24];
+ System.arraycopy(desKey, 0, theKey, 0, 16);
+ System.arraycopy(desKey, 0, theKey, 16, 8);
+ } else {
+ throw new InvalidParameterException("Key length must be 8 or 16");
+ }
+ try {
+ //8 倍加密数据
+ byte[] tmp = content.getBytes();
+ int size = tmp.length / 8;
+ if (tmp.length % 8 != 0) {
+ size += 1;
+ }
+ byte[] data = new byte[size * 8];
+ System.arraycopy(tmp, 0, data, 0, tmp.length);
+
+ SecretKeySpec enkey = new SecretKeySpec(theKey, algorithm);
+ Cipher cipher = Cipher.getInstance(algorithm + "/CBC/NoPadding");
+ IvParameterSpec zeroIv = new IvParameterSpec(mIV);
+ cipher.init(Cipher.ENCRYPT_MODE, enkey, zeroIv);
+ return cipher.doFinal(data);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ /**
+ * 解密
+ *
+ * @param encData 待解密内容
+ * @param key 解密的密钥
+ * @return
+ */
+ public static byte[] desDecrypt(byte[] encData, String key) {
+ String algorithm;
+ byte[] theKey;
+ byte[] desKey = HexString2Bytes(key);
+ if (desKey.length == 8) {
+ algorithm = "DES";
+ theKey = desKey;
+ } else if (desKey.length == 16) {
+ algorithm = "DESede";
+ theKey = new byte[24];
+ System.arraycopy(desKey, 0, theKey, 0, 16);
+ System.arraycopy(desKey, 0, theKey, 16, 8);
+ } else {
+ throw new InvalidParameterException("Key length must be 8 or 16");
+ }
+
+ try {
+ SecretKeySpec enkey = new SecretKeySpec(theKey, algorithm);
+ Cipher cipher = Cipher.getInstance(algorithm + "/CBC/NoPadding");
+ IvParameterSpec zeroIv = new IvParameterSpec(mIV);
+ cipher.init(Cipher.DECRYPT_MODE, enkey, zeroIv);
+ return cipher.doFinal(encData);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ public static byte[] HexString2Bytes(String src) {
+ byte[] ret = new byte[src.length() / 2];
+ byte[] tmp = src.getBytes();
+ for (int i = 0; i < tmp.length / 2; i++) {
+ ret[i] = uniteBytes(tmp[i * 2], tmp[i * 2 + 1]);
+ }
+ return ret;
+ }
+
+ public static byte uniteBytes(byte src0, byte src1) {
+ byte _b0 = Byte.decode("0x" + new String(new byte[]{src0})).byteValue();
+ _b0 = (byte) (_b0 << 4);
+ byte _b1 = Byte.decode("0x" + new String(new byte[]{src1})).byteValue();
+ byte ret = (byte) (_b0 ^ _b1);
+ return ret;
+ }
+
+ private static java.text.DecimalFormat decimalFormat = new java.text.DecimalFormat("0.00");
+ private static java.text.DecimalFormat decimalFormatNo = new java.text.DecimalFormat("0");
+
+ public static String decialStrFormat(String doubleStr) {
+ try {
+ double temp = Double.valueOf(doubleStr);
+ return decimalFormat.format(temp);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ public static String decialStrFormat(double d) {
+ try {
+ return decimalFormat.format(d);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ public static String decialStrFormatNo(double d) {
+ try {
+ return decimalFormatNo.format(d);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ public static int YuanToFen(double yuan) {
+ return (int) (Math.round(yuan * 100));
+ }
+
+ public static boolean moneyCompare(double x1, double x2) {
+ return YuanToFen(x1) == YuanToFen(x2);
+ }
+
+ public static double formatYuan(double yuan) {
+ DecimalFormat df = new DecimalFormat("##0.00");
+ double money = ((double) YuanToFen(yuan)) / 100;
+ return Double.valueOf(df.format(money));
+ }
+
+ //关闭状态栏
+ public static void closeBar(Context context) {
+ //隐藏虚拟按键,并且全屏
+ if (Build.VERSION.SDK_INT > 11 && Build.VERSION.SDK_INT < 19) { // lower api
+ View v = ((Activity) context).getWindow().getDecorView();
+ v.setSystemUiVisibility(View.GONE);
+ } else if (Build.VERSION.SDK_INT >= 19) {
+ //for new api versions.
+ View decorView = ((Activity) context).getWindow().getDecorView();
+ int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_FULLSCREEN;
+ decorView.setSystemUiVisibility(uiOptions);
+ }
+ }
+
+ //打开状态栏
+ public static void showBar(Context context) {
+ if (Build.VERSION.SDK_INT > 11 && Build.VERSION.SDK_INT < 19) { // lower api
+ View v = ((Activity) context).getWindow().getDecorView();
+ v.setSystemUiVisibility(View.VISIBLE);
+ } else if (Build.VERSION.SDK_INT >= 19) {
+ //for new api versions.
+ View decorView = ((Activity) context).getWindow().getDecorView();
+ int uiOptions = View.STATUS_BAR_VISIBLE;
+ decorView.setSystemUiVisibility(uiOptions);
+ }
+ }
+
+ public static void upgrade(Context context, String filename) {
+ Intent intent = new Intent(Intent.ACTION_VIEW);
+ Uri uri = Uri.fromFile(new File(filename));
+ intent.setDataAndType(uri, "application/vnd.android.package-archive");
+ ((Activity) context).startActivityForResult(intent, 0);
+ }
+
+ public static void copyLogToUSB() {
+ try {
+ Process proc = Runtime.getRuntime().exec(new String[]{"su", "-c", "cp -R /mnt/sdcard/Yuexiao/pos /mnt/usb_storage"});
+ proc.waitFor();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static String filterCardErr(String msg) {
+ int index = msg.indexOf("Error:");
+ return msg.substring(index + 7);
+ }
+
+ /*优化a811扫码*/
+ public static void writeLinnuuxParams() {
+ try {
+ FileOutputStream fos = new FileOutputStream("/sys/module/gc0308/parameters/exposure");
+ fos.write("20".getBytes());
+ fos.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * get App versionCode
+ *
+ * @param context
+ * @return
+ */
+ public static String getVersionCode(Context context) {
+ try {
+ PackageManager packageManager = context.getPackageManager();
+ PackageInfo packageInfo = packageManager.getPackageInfo(context.getPackageName(), 0);
+ return packageInfo.versionCode + "";
+ } catch (PackageManager.NameNotFoundException e) {
+ e.printStackTrace();
+ return "error:" + e.getMessage();
+ }
+ }
+
+ /**
+ * get App versionName
+ *
+ * @param context
+ * @return
+ */
+ public static String getVersionName(Context context) {
+ try {
+ PackageManager packageManager = context.getPackageManager();
+ PackageInfo packageInfo = packageManager.getPackageInfo(context.getPackageName(), 0);
+ return packageInfo.versionName;
+ } catch (PackageManager.NameNotFoundException e) {
+ e.printStackTrace();
+ return "error:" + e.getMessage();
+ }
+ }
+
+ /**
+ * 跳转网络设置页;
+ */
+ public static void startNetSetting(Context context) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ context.startActivity(new Intent(Settings.ACTION_SETTINGS));
+ } else {
+ context.startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS));
+ }
+ }
+
+ /**
+ * 软键盘隐藏
+ */
+ public static void softWindowHidden(Activity activity) {
+ activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
+ }
+
+ public static void softWindowVisible(Activity activity) {
+ activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
+ }
+
+ /**
+ * 唤醒屏幕
+ */
+ public static void acquireWakeLock(Context context) {
+ /*FULL_WAKE_LOCK:保持CPU 运转,保持屏幕高亮显示,键盘灯也保持亮度
+ ACQUIRE_CAUSES_WAKEUP:强制使屏幕亮起,这种锁主要针对一些必须通知用户的操作.
+ ON_AFTER_RELEASE:当锁被释放时,保持屏幕亮起一段时间*/
+ try {
+ PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
+ @SuppressLint("InvalidWakeLockTag") PowerManager.WakeLock wakeLock = pm.newWakeLock(PowerManager.ON_AFTER_RELEASE
+ | PowerManager.ACQUIRE_CAUSES_WAKEUP
+ | PowerManager.FULL_WAKE_LOCK, "Tag");
+ wakeLock.acquire();
+ wakeLock.release();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ public static String getPasswordStar(int len) {
+ switch (len) {
+ case 0:
+ return " ";
+ case 1:
+ return "*";
+ case 2:
+ return "**";
+ case 3:
+ return "***";
+ case 4:
+ return "****";
+ case 5:
+ return "*****";
+ case 6:
+ return "******";
+ default:
+ return " ";
+ }
+ }
+
+ /**
+ * @param value 整形
+ * @return 小端数组
+ */
+ public static byte[] decodeInt(int value) {
+ byte[] arr = new byte[4];
+ arr[0] = (byte) (value & 0xFF);
+ arr[1] = (byte) (value >> 8 & 0xFF);
+ arr[2] = (byte) (value >> 16 & 0xFF);
+ arr[3] = (byte) (value >> 24 & 0xFF);
+ return arr;
+ }
+
+ public static String getSerialNumber() {
+ try {
+ Class<?> c = Class.forName("android.os.SystemProperties");
+ Method get = c.getMethod("get", String.class);
+ return (String) get.invoke(c, "ro.product.firmware");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ return null;
+ }
+
+ /**
+ * 系统参数control_flag bit位含义
+ * <p>
+ * **第0bit 1表示从后台获取营业额,0表示取本地记录
+ * **第1bit 1打开扫码头消费 0关闭扫码头消费
+ * **第2bit 1开启虚拟卡消费 0关闭虚拟卡消费
+ * **第3bit 1开启正扫消费 0关闭
+ * **第4bit 1开启支付宝卡代扣 0关闭
+ */
+ public static boolean isSystemRevenue(int controlFlag) {
+ return (controlFlag & 0x01) != 0;
+ }
+
+ public static boolean codeEnable(int controlFlag) {
+ return (controlFlag & 0x02) != 0;
+ }
+
+ public static boolean nfcEnable(int controlFlag) {
+ return (controlFlag & 0x04) != 0;
+ }
+
+ public static boolean scanEnable(int controlFlag) {
+ return (controlFlag & 0x08) != 0;
+ }
+
+ public static boolean alicardEnable(int controlFlag) {
+ return (controlFlag & 0x10) != 0;
+ }
+
+
+ public static String getEditView(EditText et) {
+ return et.getText().toString().trim().replace(" ", "");
+ }
+
+ /**
+ *
+ */
+ public static boolean isAliCode(byte[] rawCode) {
+ if (rawCode == null || rawCode.length < 3) {
+ return false;
+ }
+ BitSource bits = new BitSource(rawCode);// 获取原始字节(带标识码和校验码)
+ Mode mode = Mode.forBits(bits.readBits(4));// 获取qr类型(8bit或者kanji等等)
+ int count = bits.readBits(8);
+ if (count > 100) {
+ byte[] codeb = new byte[4];
+ for (int i = 0; i < 4; i++) {
+ codeb[i] = (byte) bits.readBits(8);
+ }
+ long code = Long.parseLong(getHexStringByBytes(codeb), 16);
+ if (code > 24 && code < 31) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @param activity
+ * @param brightness [1-255]
+ * @desc 根据亮度值修改当前window亮度
+ */
+ public static void setAppBrightness(Activity activity, int brightness) {
+ Window window = activity.getWindow();
+ WindowManager.LayoutParams lp = window.getAttributes();
+ if (brightness == -1) {
+ if (lp.screenBrightness < 0) {
+ /**
+ * 已经是正常亮度
+ */
+ return;
+ }
+ lp.screenBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_NONE;
+ } else {
+ if (lp.screenBrightness > 0) {
+ /**
+ * 已经屏保亮度
+ */
+ return;
+ }
+// stopAutoBrightness(activity);
+ if (brightness <= 0) {
+ lp.screenBrightness = 1 / 255.0f;
+ } else {
+ lp.screenBrightness = brightness / 255.0f;
+ }
+ }
+ window.setAttributes(lp);
+ /**
+ * 生效?
+ */
+// getActivityBrightness(activity)
+ }
+
+ /**
+ * 获取当前activity的屏幕亮度
+ *
+ * @param activity 当前的activity对象
+ * @return 亮度值范围为0-0.1f,如果为-1.0,则亮度与全局同步。
+ */
+ private static Float getActivityBrightness(Activity activity) {
+ return activity.getWindow().getAttributes().screenBrightness;
+ }
+
+ /**
+ * 判断是否开启了自动亮度调节
+ * *
+ * * @param aContext
+ * * @return
+ *
+ */
+ private static boolean isAutoBrightness(ContentResolver aContentResolver) {
+ try {
+ return Settings.System.getInt(aContentResolver, Settings.System.SCREEN_BRIGHTNESS_MODE) == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
+ } catch (Settings.SettingNotFoundException e) {
+ e.printStackTrace();
+ }
+ return false;
+ }
+
+ /**
+ * 停止自动亮度调节
+ *
+ * @param activity
+ */
+ private static void stopAutoBrightness(Activity activity) {
+ Settings.System.putInt(activity.getContentResolver(),
+ Settings.System.SCREEN_BRIGHTNESS_MODE,
+ Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
+ }
+
+ /**
+ * 开启亮度自动调节
+ *
+ * @param activity
+ */
+ private static void startAutoBrightness(Activity activity) {
+ Settings.System.putInt(activity.getContentResolver(),
+ Settings.System.SCREEN_BRIGHTNESS_MODE,
+ Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
+ }
+
+ public static void playMusic(Context context, final int mid) {
+ if (soundPool == null) {
+ soundPool = new SoundPool(10, AudioManager.STREAM_MUSIC, 0); //分别对应声音池数量,AudioManager.STREAM_MUSIC 和 0
+ }
+ try {
+ if (soundMap.containsKey(mid)) {
+ soundPool.play(soundMap.get(mid), 1.0f, 1.0f, 1, 0, 1.0f);
+ } else {
+ soundId = soundPool.load(context, mid, 1);
+ soundPool.setOnLoadCompleteListener(new SoundPool.OnLoadCompleteListener() {
+ @Override
+ public void onLoadComplete(SoundPool pool, int sampleId, int status) {
+ soundMap.put(mid, soundId);
+ // 加载完成
+ try {
+ pool.play(soundId, 1.0f, 1.0f, 1, 0, 1.0f);
+ } catch (Exception e) {
+ }
+ }
+ });
+ }
+ } catch (Exception e) {
+ }
+ }
+
+ public static void releaseMusic() {
+ if (soundPool != null) {
+ soundPool.release();
+ soundPool = null;
+ }
+ if (soundMap != null) {
+ soundMap.clear();
+ }
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/util/Constants.java b/app/src/main/java/com/supwisdom/util/Constants.java
new file mode 100644
index 0000000..5b4f89a
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/util/Constants.java
@@ -0,0 +1,7 @@
+package com.supwisdom.util;
+
+public class Constants {
+ public static final String CALLBACK_URL_QR_PARAM = "QR";
+
+ public static int CURRENTCONFID = 0;
+}
diff --git a/app/src/main/java/com/supwisdom/util/Encrypt.java b/app/src/main/java/com/supwisdom/util/Encrypt.java
new file mode 100644
index 0000000..996a4f1
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/util/Encrypt.java
@@ -0,0 +1,116 @@
+package com.supwisdom.util;
+
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.security.InvalidKeyException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+
+/**
+ * @author zzq
+ * @date 2018/7/23
+ * @desc algorithm
+ */
+public class Encrypt {
+ public static String HASH256(String text) {
+ return algorithm(text, "SHA-256");
+ }
+
+ public static String HASH256(InputStream fis) {
+ return algorithm(fis, "SHA-256");
+ }
+
+ public static String HASH256(InputStream fis, String extData) {
+ return algorithm(fis, "SHA-256", extData);
+ }
+
+ public static String HASH512(String text) {
+ return algorithm(text, "SHA-512");
+ }
+
+ public static String MD5(String text) {
+ return algorithm(text, "MD5");
+ }
+
+ public static String HMACSHA1(String data, String key) {
+ try {
+ String algorithm = "HmacSHA1";
+ Mac mac = Mac.getInstance(algorithm);
+ SecretKeySpec spec = new SecretKeySpec(key.getBytes(), algorithm);
+ mac.init(spec);
+ byte[] byteHMAC = mac.doFinal(data.getBytes());
+ return CommonUtil.getHexStringByBytes(byteHMAC);
+ } catch (InvalidKeyException e) {
+ e.printStackTrace();
+ } catch (NoSuchAlgorithmException ignore) {
+ ignore.printStackTrace();
+ }
+ return null;
+ }
+
+ private static String algorithm(String text, String algorithm) {
+ if (text != null && text.length() > 0) {
+ try {
+ //创建具有指定算法名称的信息摘要
+ MessageDigest md = MessageDigest.getInstance(algorithm);
+ //使用指定的字节数组对摘要进行最后更新,然后完成摘要计算
+ byte[] results = md.digest(text.getBytes("UTF-8"));
+ //将得到的字节数组变成字符串返回
+ String resultString = CommonUtil.getHexStringByBytes(results);
+ return resultString.toUpperCase();
+ } catch (NoSuchAlgorithmException ex) {
+ ex.printStackTrace();
+ } catch (UnsupportedEncodingException ex) {
+ ex.printStackTrace();
+ }
+ }
+ return null;
+ }
+
+ private static String algorithm(InputStream fis, String algorithm) {
+ try {
+ //拿到一个MD5转换器,如果想使用SHA-1或SHA-256,则传入SHA-1,SHA-256
+ MessageDigest md = MessageDigest.getInstance(algorithm);
+
+ //分多次将一个文件读入,对于大型文件而言,比较推荐这种方式,占用内存比较少。
+ byte[] buffer = new byte[1024];
+ int length;
+ while ((length = fis.read(buffer, 0, 1024)) != -1) {
+ md.update(buffer, 0, length);
+ }
+ fis.close();
+ //转换并返回包含16个元素字节数组,返回数值范围为-128到127
+ byte[] results = md.digest();
+ return CommonUtil.getHexStringByBytes(results);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ private static String algorithm(InputStream fis, String algorithm, String extData) {
+ try {
+ //拿到一个MD5转换器,如果想使用SHA-1或SHA-256,则传入SHA-1,SHA-256
+ MessageDigest md = MessageDigest.getInstance(algorithm);
+
+ //分多次将一个文件读入,对于大型文件而言,比较推荐这种方式,占用内存比较少。
+ byte[] buffer = new byte[1024];
+ int length;
+ while ((length = fis.read(buffer, 0, 1024)) != -1) {
+ md.update(buffer, 0, length);
+ }
+ fis.close();
+ md.update(extData.getBytes("UTF-8"));
+
+ //转换并返回包含16个元素字节数组,返回数值范围为-128到127
+ byte[] results = md.digest();
+ return CommonUtil.getHexStringByBytes(results);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/util/FastDateFormat.java b/app/src/main/java/com/supwisdom/util/FastDateFormat.java
new file mode 100644
index 0000000..869ccd4
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/util/FastDateFormat.java
@@ -0,0 +1,1015 @@
+package com.supwisdom.util;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+import java.text.DateFormat;
+import java.text.DateFormatSymbols;
+import java.text.FieldPosition;
+import java.text.Format;
+import java.text.ParsePosition;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.TimeZone;
+
+public class FastDateFormat extends Format {
+ public static final int FULL = 0;
+ public static final int LONG = 1;
+ public static final int MEDIUM = 2;
+ public static final int SHORT = 3;
+ static final double LOG_10 = Math.log(10.0D);
+ private static String cDefaultPattern;
+ private static Map cInstanceCache = new HashMap(7);
+ private static Map cDateInstanceCache = new HashMap(7);
+ private static Map cTimeInstanceCache = new HashMap(7);
+ private static Map cDateTimeInstanceCache = new HashMap(7);
+ private static Map cTimeZoneDisplayCache = new HashMap(7);
+ private final String mPattern;
+ private final TimeZone mTimeZone;
+ private final boolean mTimeZoneForced;
+ private final Locale mLocale;
+ private final boolean mLocaleForced;
+ private FastDateFormat.Rule[] mRules;
+ private int mMaxLengthEstimate;
+
+ protected FastDateFormat(String pattern, TimeZone timeZone, Locale locale) {
+ if (pattern == null) {
+ throw new IllegalArgumentException("The pattern must not be null");
+ } else {
+ this.mPattern = pattern;
+ this.mTimeZoneForced = timeZone != null;
+ if (timeZone == null) {
+ timeZone = TimeZone.getDefault();
+ }
+
+ this.mTimeZone = timeZone;
+ this.mLocaleForced = locale != null;
+ if (locale == null) {
+ locale = Locale.getDefault();
+ }
+
+ this.mLocale = locale;
+ }
+ }
+
+ protected StringBuffer applyRules(Calendar calendar, StringBuffer buf) {
+ FastDateFormat.Rule[] rules = this.mRules;
+ int len = this.mRules.length;
+
+ for (int i = 0; i < len; ++i) {
+ rules[i].appendTo(buf, calendar);
+ }
+
+ return buf;
+ }
+
+ public boolean equals(Object obj) {
+ if (!(obj instanceof FastDateFormat)) {
+ return false;
+ } else {
+ FastDateFormat other = (FastDateFormat) obj;
+ return (this.mPattern == other.mPattern || this.mPattern.equals(other.mPattern)) && (this.mTimeZone == other.mTimeZone || this.mTimeZone.equals(other.mTimeZone)) && (this.mLocale == other.mLocale || this.mLocale.equals(other.mLocale)) && this.mTimeZoneForced == other.mTimeZoneForced && this.mLocaleForced == other.mLocaleForced;
+ }
+ }
+
+ public String format(long millis) {
+ return this.format(new Date(millis));
+ }
+
+ public StringBuffer format(long millis, StringBuffer buf) {
+ return this.format(new Date(millis), buf);
+ }
+
+ public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) {
+ if (obj instanceof Date) {
+ return this.format((Date) obj, toAppendTo);
+ } else if (obj instanceof Calendar) {
+ return this.format((Calendar) obj, toAppendTo);
+ } else if (obj instanceof Long) {
+ return this.format(((Long) obj).longValue(), toAppendTo);
+ } else {
+ throw new IllegalArgumentException("Unknown class: " + (obj == null ? "<null>" : obj.getClass().getName()));
+ }
+ }
+
+ public String format(Calendar calendar) {
+ return this.format(calendar, new StringBuffer(this.mMaxLengthEstimate)).toString();
+ }
+
+ public StringBuffer format(Calendar calendar, StringBuffer buf) {
+ if (this.mTimeZoneForced) {
+ calendar = (Calendar) calendar.clone();
+ calendar.setTimeZone(this.mTimeZone);
+ }
+
+ return this.applyRules(calendar, buf);
+ }
+
+ public String format(Date date) {
+ GregorianCalendar c = new GregorianCalendar(this.mTimeZone);
+ c.setTime(date);
+ return this.applyRules(c, new StringBuffer(this.mMaxLengthEstimate)).toString();
+ }
+
+ public StringBuffer format(Date date, StringBuffer buf) {
+ GregorianCalendar c = new GregorianCalendar(this.mTimeZone);
+ c.setTime(date);
+ return this.applyRules(c, buf);
+ }
+
+ public static FastDateFormat getDateInstance(int style) {
+ return getDateInstance(style, (TimeZone) null, (Locale) null);
+ }
+
+ public static FastDateFormat getDateInstance(int style, Locale locale) {
+ return getDateInstance(style, (TimeZone) null, locale);
+ }
+
+ public static FastDateFormat getDateInstance(int style, TimeZone timeZone) {
+ return getDateInstance(style, timeZone, (Locale) null);
+ }
+
+ public static synchronized FastDateFormat getDateInstance(int style, TimeZone timeZone, Locale locale) {
+ Object key = new Integer(style);
+ if (timeZone != null) {
+ key = new FastDateFormat.Pair(key, timeZone);
+ }
+
+ if (locale != null) {
+ key = new FastDateFormat.Pair(key, locale);
+ }
+
+ FastDateFormat format = (FastDateFormat) cDateInstanceCache.get(key);
+ if (format == null) {
+ if (locale == null) {
+ locale = Locale.getDefault();
+ }
+
+ try {
+ SimpleDateFormat formatter = (SimpleDateFormat) DateFormat.getDateInstance(style, locale);
+ String pattern = formatter.toPattern();
+ format = getInstance(pattern, timeZone, locale);
+ cDateInstanceCache.put(key, format);
+ } catch (ClassCastException var7) {
+ throw new IllegalArgumentException("No date pattern for locale: " + locale);
+ }
+ }
+
+ return format;
+ }
+
+ public static FastDateFormat getDateTimeInstance(int dateStyle, int timeStyle) {
+ return getDateTimeInstance(dateStyle, timeStyle, (TimeZone) null, (Locale) null);
+ }
+
+ public static FastDateFormat getDateTimeInstance(int dateStyle, int timeStyle, Locale locale) {
+ return getDateTimeInstance(dateStyle, timeStyle, (TimeZone) null, locale);
+ }
+
+ public static FastDateFormat getDateTimeInstance(int dateStyle, int timeStyle, TimeZone timeZone) {
+ return getDateTimeInstance(dateStyle, timeStyle, timeZone, (Locale) null);
+ }
+
+ public static synchronized FastDateFormat getDateTimeInstance(int dateStyle, int timeStyle, TimeZone timeZone, Locale locale) {
+ FastDateFormat.Pair key = new FastDateFormat.Pair(new Integer(dateStyle), new Integer(timeStyle));
+ if (timeZone != null) {
+ key = new FastDateFormat.Pair(key, timeZone);
+ }
+
+ if (locale != null) {
+ key = new FastDateFormat.Pair(key, locale);
+ }
+
+ FastDateFormat format = (FastDateFormat) cDateTimeInstanceCache.get(key);
+ if (format == null) {
+ if (locale == null) {
+ locale = Locale.getDefault();
+ }
+
+ try {
+ SimpleDateFormat formatter = (SimpleDateFormat) DateFormat.getDateTimeInstance(dateStyle, timeStyle, locale);
+ String pattern = formatter.toPattern();
+ format = getInstance(pattern, timeZone, locale);
+ cDateTimeInstanceCache.put(key, format);
+ } catch (ClassCastException var8) {
+ throw new IllegalArgumentException("No date time pattern for locale: " + locale);
+ }
+ }
+
+ return format;
+ }
+
+ private static synchronized String getDefaultPattern() {
+ if (cDefaultPattern == null) {
+ cDefaultPattern = (new SimpleDateFormat()).toPattern();
+ }
+
+ return cDefaultPattern;
+ }
+
+ public static FastDateFormat getInstance() {
+ return getInstance(getDefaultPattern(), (TimeZone) null, (Locale) null);
+ }
+
+ public static FastDateFormat getInstance(String pattern) {
+ return getInstance(pattern, (TimeZone) null, (Locale) null);
+ }
+
+ public static FastDateFormat getInstance(String pattern, Locale locale) {
+ return getInstance(pattern, (TimeZone) null, locale);
+ }
+
+ public static FastDateFormat getInstance(String pattern, TimeZone timeZone) {
+ return getInstance(pattern, timeZone, (Locale) null);
+ }
+
+ public static synchronized FastDateFormat getInstance(String pattern, TimeZone timeZone, Locale locale) {
+ FastDateFormat emptyFormat = new FastDateFormat(pattern, timeZone, locale);
+ FastDateFormat format = (FastDateFormat) cInstanceCache.get(emptyFormat);
+ if (format == null) {
+ format = emptyFormat;
+ emptyFormat.init();
+ cInstanceCache.put(emptyFormat, emptyFormat);
+ }
+
+ return format;
+ }
+
+ public Locale getLocale() {
+ return this.mLocale;
+ }
+
+ public int getMaxLengthEstimate() {
+ return this.mMaxLengthEstimate;
+ }
+
+ public String getPattern() {
+ return this.mPattern;
+ }
+
+ public static FastDateFormat getTimeInstance(int style) {
+ return getTimeInstance(style, (TimeZone) null, (Locale) null);
+ }
+
+ public static FastDateFormat getTimeInstance(int style, Locale locale) {
+ return getTimeInstance(style, (TimeZone) null, locale);
+ }
+
+ public static FastDateFormat getTimeInstance(int style, TimeZone timeZone) {
+ return getTimeInstance(style, timeZone, (Locale) null);
+ }
+
+ public static synchronized FastDateFormat getTimeInstance(int style, TimeZone timeZone, Locale locale) {
+ Object key = new Integer(style);
+ if (timeZone != null) {
+ key = new FastDateFormat.Pair(key, timeZone);
+ }
+
+ if (locale != null) {
+ key = new FastDateFormat.Pair(key, locale);
+ }
+
+ FastDateFormat format = (FastDateFormat) cTimeInstanceCache.get(key);
+ if (format == null) {
+ if (locale == null) {
+ locale = Locale.getDefault();
+ }
+
+ try {
+ SimpleDateFormat formatter = (SimpleDateFormat) DateFormat.getTimeInstance(style, locale);
+ String pattern = formatter.toPattern();
+ format = getInstance(pattern, timeZone, locale);
+ cTimeInstanceCache.put(key, format);
+ } catch (ClassCastException var7) {
+ throw new IllegalArgumentException("No date pattern for locale: " + locale);
+ }
+ }
+
+ return format;
+ }
+
+ public TimeZone getTimeZone() {
+ return this.mTimeZone;
+ }
+
+ static synchronized String getTimeZoneDisplay(TimeZone tz, boolean daylight, int style, Locale locale) {
+ FastDateFormat.TimeZoneDisplayKey key = new FastDateFormat.TimeZoneDisplayKey(tz, daylight, style, locale);
+ String value = (String) cTimeZoneDisplayCache.get(key);
+ if (value == null) {
+ value = tz.getDisplayName(daylight, style, locale);
+ cTimeZoneDisplayCache.put(key, value);
+ }
+
+ return value;
+ }
+
+ public boolean getTimeZoneOverridesCalendar() {
+ return this.mTimeZoneForced;
+ }
+
+ public int hashCode() {
+ byte total = 0;
+ int total1 = total + this.mPattern.hashCode();
+ total1 += this.mTimeZone.hashCode();
+ total1 += this.mTimeZoneForced ? 1 : 0;
+ total1 += this.mLocale.hashCode();
+ total1 += this.mLocaleForced ? 1 : 0;
+ return total1;
+ }
+
+ protected void init() {
+ List rulesList = this.parsePattern();
+ this.mRules = (FastDateFormat.Rule[]) rulesList.toArray(new FastDateFormat.Rule[rulesList.size()]);
+ int len = 0;
+ int i = this.mRules.length;
+
+ while (true) {
+ --i;
+ if (i < 0) {
+ this.mMaxLengthEstimate = len;
+ return;
+ }
+
+ len += this.mRules[i].estimateLength();
+ }
+ }
+
+ public Object parseObject(String source, ParsePosition pos) {
+ pos.setIndex(0);
+ pos.setErrorIndex(0);
+ return null;
+ }
+
+ protected List parsePattern() {
+ DateFormatSymbols symbols = new DateFormatSymbols(this.mLocale);
+ ArrayList rules = new ArrayList();
+ String[] ERAs = symbols.getEras();
+ String[] months = symbols.getMonths();
+ String[] shortMonths = symbols.getShortMonths();
+ String[] weekdays = symbols.getWeekdays();
+ String[] shortWeekdays = symbols.getShortWeekdays();
+ String[] AmPmStrings = symbols.getAmPmStrings();
+ int length = this.mPattern.length();
+ int[] indexRef = new int[1];
+
+ for (int i = 0; i < length; ++i) {
+ indexRef[0] = i;
+ String token = this.parseToken(this.mPattern, indexRef);
+ i = indexRef[0];
+ int tokenLen = token.length();
+ if (tokenLen == 0) {
+ break;
+ }
+
+ char c = token.charAt(0);
+ Object rule;
+ switch (c) {
+ case '\'':
+ String sub = token.substring(1);
+ if (sub.length() == 1) {
+ rule = new FastDateFormat.CharacterLiteral(sub.charAt(0));
+ } else {
+ rule = new FastDateFormat.StringLiteral(sub);
+ }
+ break;
+ case 'D':
+ rule = this.selectNumberRule(6, tokenLen);
+ break;
+ case 'E':
+ rule = new FastDateFormat.TextField(7, tokenLen < 4 ? shortWeekdays : weekdays);
+ break;
+ case 'F':
+ rule = this.selectNumberRule(8, tokenLen);
+ break;
+ case 'G':
+ rule = new FastDateFormat.TextField(0, ERAs);
+ break;
+ case 'H':
+ rule = this.selectNumberRule(11, tokenLen);
+ break;
+ case 'K':
+ rule = this.selectNumberRule(10, tokenLen);
+ break;
+ case 'M':
+ if (tokenLen >= 4) {
+ rule = new FastDateFormat.TextField(2, months);
+ } else if (tokenLen == 3) {
+ rule = new FastDateFormat.TextField(2, shortMonths);
+ } else if (tokenLen == 2) {
+ rule = FastDateFormat.TwoDigitMonthField.INSTANCE;
+ } else {
+ rule = FastDateFormat.UnpaddedMonthField.INSTANCE;
+ }
+ break;
+ case 'S':
+ rule = this.selectNumberRule(14, tokenLen);
+ break;
+ case 'W':
+ rule = this.selectNumberRule(4, tokenLen);
+ break;
+ case 'Z':
+ if (tokenLen == 1) {
+ rule = FastDateFormat.TimeZoneNumberRule.INSTANCE_NO_COLON;
+ } else {
+ rule = FastDateFormat.TimeZoneNumberRule.INSTANCE_COLON;
+ }
+ break;
+ case 'a':
+ rule = new FastDateFormat.TextField(9, AmPmStrings);
+ break;
+ case 'd':
+ rule = this.selectNumberRule(5, tokenLen);
+ break;
+ case 'h':
+ rule = new FastDateFormat.TwelveHourField(this.selectNumberRule(10, tokenLen));
+ break;
+ case 'k':
+ rule = new FastDateFormat.TwentyFourHourField(this.selectNumberRule(11, tokenLen));
+ break;
+ case 'm':
+ rule = this.selectNumberRule(12, tokenLen);
+ break;
+ case 's':
+ rule = this.selectNumberRule(13, tokenLen);
+ break;
+ case 'w':
+ rule = this.selectNumberRule(3, tokenLen);
+ break;
+ case 'y':
+ if (tokenLen >= 4) {
+ rule = this.selectNumberRule(1, tokenLen);
+ } else {
+ rule = FastDateFormat.TwoDigitYearField.INSTANCE;
+ }
+ break;
+ case 'z':
+ if (tokenLen >= 4) {
+ rule = new FastDateFormat.TimeZoneNameRule(this.mTimeZone, this.mTimeZoneForced, this.mLocale, 1);
+ } else {
+ rule = new FastDateFormat.TimeZoneNameRule(this.mTimeZone, this.mTimeZoneForced, this.mLocale, 0);
+ }
+ break;
+ default:
+ throw new IllegalArgumentException("Illegal pattern component: " + token);
+ }
+
+ rules.add(rule);
+ }
+
+ return rules;
+ }
+
+ protected String parseToken(String pattern, int[] indexRef) {
+ StringBuffer buf = new StringBuffer();
+ int i = indexRef[0];
+ int length = pattern.length();
+ char c = pattern.charAt(i);
+ if (c >= 65 && c <= 90 || c >= 97 && c <= 122) {
+ buf.append(c);
+
+ while (i + 1 < length) {
+ char var8 = pattern.charAt(i + 1);
+ if (var8 != c) {
+ break;
+ }
+
+ buf.append(c);
+ ++i;
+ }
+ } else {
+ buf.append('\'');
+
+ for (boolean inLiteral = false; i < length; ++i) {
+ c = pattern.charAt(i);
+ if (c == 39) {
+ if (i + 1 < length && pattern.charAt(i + 1) == 39) {
+ ++i;
+ buf.append(c);
+ } else {
+ inLiteral ^= true;
+ }
+ } else {
+ if (!inLiteral && (c >= 65 && c <= 90 || c >= 97 && c <= 122)) {
+ --i;
+ break;
+ }
+
+ buf.append(c);
+ }
+ }
+ }
+
+ indexRef[0] = i;
+ return buf.toString();
+ }
+
+ protected FastDateFormat.NumberRule selectNumberRule(int field, int padding) {
+ switch (padding) {
+ case 1:
+ return new FastDateFormat.UnpaddedNumberField(field);
+ case 2:
+ return new FastDateFormat.TwoDigitNumberField(field);
+ default:
+ return new FastDateFormat.PaddedNumberField(field, padding);
+ }
+ }
+
+ public String toString() {
+ return "FastDateFormat[" + this.mPattern + "]";
+ }
+
+ private interface Rule {
+ void appendTo(StringBuffer var1, Calendar var2);
+
+ int estimateLength();
+ }
+
+ private interface NumberRule extends FastDateFormat.Rule {
+ void appendTo(StringBuffer var1, int var2);
+ }
+
+ private static class CharacterLiteral implements FastDateFormat.Rule {
+ private final char mValue;
+
+ CharacterLiteral(char value) {
+ this.mValue = value;
+ }
+
+ public void appendTo(StringBuffer buffer, Calendar calendar) {
+ buffer.append(this.mValue);
+ }
+
+ public int estimateLength() {
+ return 1;
+ }
+ }
+
+ private static class StringLiteral implements FastDateFormat.Rule {
+ private final String mValue;
+
+ StringLiteral(String value) {
+ this.mValue = value;
+ }
+
+ public void appendTo(StringBuffer buffer, Calendar calendar) {
+ buffer.append(this.mValue);
+ }
+
+ public int estimateLength() {
+ return this.mValue.length();
+ }
+ }
+
+ private static class TextField implements FastDateFormat.Rule {
+ private final int mField;
+ private final String[] mValues;
+
+ TextField(int field, String[] values) {
+ this.mField = field;
+ this.mValues = values;
+ }
+
+ public void appendTo(StringBuffer buffer, Calendar calendar) {
+ buffer.append(this.mValues[calendar.get(this.mField)]);
+ }
+
+ public int estimateLength() {
+ int max = 0;
+ int i = this.mValues.length;
+
+ while (true) {
+ --i;
+ if (i < 0) {
+ return max;
+ }
+
+ int len = this.mValues[i].length();
+ if (len > max) {
+ max = len;
+ }
+ }
+ }
+ }
+
+ private static class UnpaddedNumberField implements FastDateFormat.NumberRule {
+ static final FastDateFormat.UnpaddedNumberField INSTANCE_YEAR = new FastDateFormat.UnpaddedNumberField(1);
+ private final int mField;
+
+ UnpaddedNumberField(int field) {
+ this.mField = field;
+ }
+
+ public final void appendTo(StringBuffer buffer, int value) {
+ if (value < 10) {
+ buffer.append((char) (value + 48));
+ } else if (value < 100) {
+ buffer.append((char) (value / 10 + 48));
+ buffer.append((char) (value % 10 + 48));
+ } else {
+ buffer.append(Integer.toString(value));
+ }
+
+ }
+
+ public void appendTo(StringBuffer buffer, Calendar calendar) {
+ this.appendTo(buffer, calendar.get(this.mField));
+ }
+
+ public int estimateLength() {
+ return 4;
+ }
+ }
+
+ private static class UnpaddedMonthField implements FastDateFormat.NumberRule {
+ static final FastDateFormat.UnpaddedMonthField INSTANCE = new FastDateFormat.UnpaddedMonthField();
+
+ UnpaddedMonthField() {
+ }
+
+ public final void appendTo(StringBuffer buffer, int value) {
+ if (value < 10) {
+ buffer.append((char) (value + 48));
+ } else {
+ buffer.append((char) (value / 10 + 48));
+ buffer.append((char) (value % 10 + 48));
+ }
+
+ }
+
+ public void appendTo(StringBuffer buffer, Calendar calendar) {
+ this.appendTo(buffer, calendar.get(2) + 1);
+ }
+
+ public int estimateLength() {
+ return 2;
+ }
+ }
+
+ private static class PaddedNumberField implements FastDateFormat.NumberRule {
+ private final int mField;
+ private final int mSize;
+
+ PaddedNumberField(int field, int size) {
+ if (size < 3) {
+ throw new IllegalArgumentException();
+ } else {
+ this.mField = field;
+ this.mSize = size;
+ }
+ }
+
+ public final void appendTo(StringBuffer buffer, int value) {
+ int digits;
+ if (value < 100) {
+ digits = this.mSize;
+
+ while (true) {
+ --digits;
+ if (digits < 2) {
+ buffer.append((char) (value / 10 + 48));
+ buffer.append((char) (value % 10 + 48));
+ break;
+ }
+
+ buffer.append('0');
+ }
+ } else {
+ if (value < 1000) {
+ digits = 3;
+ } else {
+ digits = (int) (Math.log((double) value) / FastDateFormat.LOG_10) + 1;
+ }
+
+ int i = this.mSize;
+
+ while (true) {
+ --i;
+ if (i < digits) {
+ buffer.append(Integer.toString(value));
+ break;
+ }
+
+ buffer.append('0');
+ }
+ }
+
+ }
+
+ public void appendTo(StringBuffer buffer, Calendar calendar) {
+ this.appendTo(buffer, calendar.get(this.mField));
+ }
+
+ public int estimateLength() {
+ return 4;
+ }
+ }
+
+ private static class TwoDigitNumberField implements FastDateFormat.NumberRule {
+ private final int mField;
+
+ TwoDigitNumberField(int field) {
+ this.mField = field;
+ }
+
+ public final void appendTo(StringBuffer buffer, int value) {
+ if (value < 100) {
+ buffer.append((char) (value / 10 + 48));
+ buffer.append((char) (value % 10 + 48));
+ } else {
+ buffer.append(Integer.toString(value));
+ }
+
+ }
+
+ public void appendTo(StringBuffer buffer, Calendar calendar) {
+ this.appendTo(buffer, calendar.get(this.mField));
+ }
+
+ public int estimateLength() {
+ return 2;
+ }
+ }
+
+ private static class TwoDigitYearField implements FastDateFormat.NumberRule {
+ static final FastDateFormat.TwoDigitYearField INSTANCE = new FastDateFormat.TwoDigitYearField();
+
+ TwoDigitYearField() {
+ }
+
+ public final void appendTo(StringBuffer buffer, int value) {
+ buffer.append((char) (value / 10 + 48));
+ buffer.append((char) (value % 10 + 48));
+ }
+
+ public void appendTo(StringBuffer buffer, Calendar calendar) {
+ this.appendTo(buffer, calendar.get(1) % 100);
+ }
+
+ public int estimateLength() {
+ return 2;
+ }
+ }
+
+ private static class TwoDigitMonthField implements FastDateFormat.NumberRule {
+ static final FastDateFormat.TwoDigitMonthField INSTANCE = new FastDateFormat.TwoDigitMonthField();
+
+ TwoDigitMonthField() {
+ }
+
+ public final void appendTo(StringBuffer buffer, int value) {
+ buffer.append((char) (value / 10 + 48));
+ buffer.append((char) (value % 10 + 48));
+ }
+
+ public void appendTo(StringBuffer buffer, Calendar calendar) {
+ this.appendTo(buffer, calendar.get(2) + 1);
+ }
+
+ public int estimateLength() {
+ return 2;
+ }
+ }
+
+ private static class TwelveHourField implements FastDateFormat.NumberRule {
+ private final FastDateFormat.NumberRule mRule;
+
+ TwelveHourField(FastDateFormat.NumberRule rule) {
+ this.mRule = rule;
+ }
+
+ public void appendTo(StringBuffer buffer, int value) {
+ this.mRule.appendTo(buffer, value);
+ }
+
+ public void appendTo(StringBuffer buffer, Calendar calendar) {
+ int value = calendar.get(10);
+ if (value == 0) {
+ value = calendar.getLeastMaximum(10) + 1;
+ }
+
+ this.mRule.appendTo(buffer, value);
+ }
+
+ public int estimateLength() {
+ return this.mRule.estimateLength();
+ }
+ }
+
+ private static class TwentyFourHourField implements FastDateFormat.NumberRule {
+ private final FastDateFormat.NumberRule mRule;
+
+ TwentyFourHourField(FastDateFormat.NumberRule rule) {
+ this.mRule = rule;
+ }
+
+ public void appendTo(StringBuffer buffer, int value) {
+ this.mRule.appendTo(buffer, value);
+ }
+
+ public void appendTo(StringBuffer buffer, Calendar calendar) {
+ int value = calendar.get(11);
+ if (value == 0) {
+ value = calendar.getMaximum(11) + 1;
+ }
+
+ this.mRule.appendTo(buffer, value);
+ }
+
+ public int estimateLength() {
+ return this.mRule.estimateLength();
+ }
+ }
+
+ private static class TimeZoneNameRule implements FastDateFormat.Rule {
+ private final TimeZone mTimeZone;
+ private final boolean mTimeZoneForced;
+ private final Locale mLocale;
+ private final int mStyle;
+ private final String mStandard;
+ private final String mDaylight;
+
+ TimeZoneNameRule(TimeZone timeZone, boolean timeZoneForced, Locale locale, int style) {
+ this.mTimeZone = timeZone;
+ this.mTimeZoneForced = timeZoneForced;
+ this.mLocale = locale;
+ this.mStyle = style;
+ if (timeZoneForced) {
+ this.mStandard = FastDateFormat.getTimeZoneDisplay(timeZone, false, style, locale);
+ this.mDaylight = FastDateFormat.getTimeZoneDisplay(timeZone, true, style, locale);
+ } else {
+ this.mStandard = null;
+ this.mDaylight = null;
+ }
+
+ }
+
+ public void appendTo(StringBuffer buffer, Calendar calendar) {
+ if (this.mTimeZoneForced) {
+ if (this.mTimeZone.useDaylightTime() && calendar.get(16) != 0) {
+ buffer.append(this.mDaylight);
+ } else {
+ buffer.append(this.mStandard);
+ }
+ } else {
+ TimeZone timeZone = calendar.getTimeZone();
+ if (timeZone.useDaylightTime() && calendar.get(16) != 0) {
+ buffer.append(FastDateFormat.getTimeZoneDisplay(timeZone, true, this.mStyle, this.mLocale));
+ } else {
+ buffer.append(FastDateFormat.getTimeZoneDisplay(timeZone, false, this.mStyle, this.mLocale));
+ }
+ }
+
+ }
+
+ public int estimateLength() {
+ return this.mTimeZoneForced ? Math.max(this.mStandard.length(), this.mDaylight.length()) : (this.mStyle == 0 ? 4 : 40);
+ }
+ }
+
+ private static class TimeZoneNumberRule implements FastDateFormat.Rule {
+ static final FastDateFormat.TimeZoneNumberRule INSTANCE_COLON = new FastDateFormat.TimeZoneNumberRule(true);
+ static final FastDateFormat.TimeZoneNumberRule INSTANCE_NO_COLON = new FastDateFormat.TimeZoneNumberRule(false);
+ final boolean mColon;
+
+ TimeZoneNumberRule(boolean colon) {
+ this.mColon = colon;
+ }
+
+ public void appendTo(StringBuffer buffer, Calendar calendar) {
+ int offset = calendar.get(15) + calendar.get(16);
+ if (offset < 0) {
+ buffer.append('-');
+ offset = -offset;
+ } else {
+ buffer.append('+');
+ }
+
+ int hours = offset / 3600000;
+ buffer.append((char) (hours / 10 + 48));
+ buffer.append((char) (hours % 10 + 48));
+ if (this.mColon) {
+ buffer.append(':');
+ }
+
+ int minutes = offset / '\uea60' - 60 * hours;
+ buffer.append((char) (minutes / 10 + 48));
+ buffer.append((char) (minutes % 10 + 48));
+ }
+
+ public int estimateLength() {
+ return 5;
+ }
+ }
+
+ private static class TimeZoneDisplayKey {
+ private final TimeZone mTimeZone;
+ private final int mStyle;
+ private final Locale mLocale;
+
+ TimeZoneDisplayKey(TimeZone timeZone, boolean daylight, int style, Locale locale) {
+ this.mTimeZone = timeZone;
+ if (daylight) {
+ style |= -2147483648;
+ }
+
+ this.mStyle = style;
+ this.mLocale = locale;
+ }
+
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ } else if (!(obj instanceof FastDateFormat.TimeZoneDisplayKey)) {
+ return false;
+ } else {
+ FastDateFormat.TimeZoneDisplayKey other = (FastDateFormat.TimeZoneDisplayKey) obj;
+ return this.mTimeZone.equals(other.mTimeZone) && this.mStyle == other.mStyle && this.mLocale.equals(other.mLocale);
+ }
+ }
+
+ public int hashCode() {
+ return this.mStyle * 31 + this.mLocale.hashCode();
+ }
+ }
+
+ private static class Pair {
+ private final Object mObj1;
+ private final Object mObj2;
+
+ public Pair(Object obj1, Object obj2) {
+ this.mObj1 = obj1;
+ this.mObj2 = obj2;
+ }
+
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ } else if (!(obj instanceof FastDateFormat.Pair)) {
+ return false;
+ } else {
+ boolean var10000;
+ label51:
+ {
+ label44:
+ {
+ FastDateFormat.Pair key;
+ label35:
+ {
+ key = (FastDateFormat.Pair) obj;
+ if (this.mObj1 == null) {
+ if (key.mObj1 == null) {
+ break label35;
+ }
+
+ var10000 = false;
+ } else {
+ var10000 = this.mObj1.equals(key.mObj1);
+ }
+
+ if (!var10000) {
+ break label44;
+ }
+ }
+
+ if (this.mObj2 == null) {
+ if (key.mObj2 == null) {
+ break label51;
+ }
+
+ var10000 = false;
+ } else {
+ var10000 = this.mObj2.equals(key.mObj2);
+ }
+
+ if (var10000) {
+ break label51;
+ }
+ }
+
+ var10000 = false;
+ return var10000;
+ }
+
+ var10000 = true;
+ return var10000;
+ }
+ }
+
+ public int hashCode() {
+ return (this.mObj1 == null ? 0 : this.mObj1.hashCode()) + (this.mObj2 == null ? 0 : this.mObj2.hashCode());
+ }
+
+ public String toString() {
+ return "[" + this.mObj1 + ':' + this.mObj2 + ']';
+ }
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/util/FileUtil.java b/app/src/main/java/com/supwisdom/util/FileUtil.java
new file mode 100644
index 0000000..f719abe
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/util/FileUtil.java
@@ -0,0 +1,145 @@
+package com.supwisdom.util;
+
+import android.os.Environment;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+
+/**
+ * Created by zz on 2020-03-30.
+ */
+public class FileUtil {
+ private static final String ROOT_DIR = "/YueXiao/pos/";
+ private static final String ROOT_PRIVATE_DIR = "/supwisdom/";
+ private static final String CACHE_FILE_DIR = ROOT_DIR + "cache/";
+ private static final String CRASH_FILE_DIR = ROOT_DIR + "crash/";
+ private static final String CRASH_FILE_PRE = "crash-";
+ private static final String LOG_FILE_DIR = ROOT_DIR + "log/";
+ private static final String LOG_FILE_PRE = "log-";
+ private static final String DTL_FILE_DIR = ROOT_DIR + "dtl/";
+ private static final String DTL_FILE_PRE = "dtl-";
+
+ public static File getUpdateFile(String fileName) {
+ return createFile(CACHE_FILE_DIR, fileName);
+ }
+
+ public static File getCfgFile(String fileName) {
+ return createFile(ROOT_PRIVATE_DIR, fileName);
+ }
+
+ public static InputStream getCfgFileStream(String fileName) {
+ if (android.os.Environment.MEDIA_MOUNTED.equals(android.os.Environment.getExternalStorageState())) {
+ File rootFile = new File(Environment.getExternalStorageDirectory() + ROOT_PRIVATE_DIR);
+ if (!rootFile.exists()) {
+ return null;
+ }
+ File retFile = new File(rootFile, fileName);
+ if (retFile.exists()) {
+ try {
+ return new FileInputStream(retFile);
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ return null;
+ }
+
+ public static void removeDtlFile(int beforeday) {
+ removeFile(DTL_FILE_DIR, DTL_FILE_PRE, beforeday);
+ }
+
+ public static void removeLogFile(int beforeday) {
+ removeFile(LOG_FILE_DIR, LOG_FILE_PRE, beforeday);
+ }
+
+ public static void removeCrashFile(int beforeday) {
+ removeFile(CRASH_FILE_DIR, CRASH_FILE_PRE, beforeday);
+ }
+
+
+ public static void writeDtlFile(String msg) {
+ String pathfile = DTL_FILE_DIR + DTL_FILE_PRE + CommonUtil.getNowDateNoFormat() + ".txt";
+ writeFile(pathfile, msg, true);
+ }
+
+ public static void writeCrashFile(String msg) {
+ String pathfile = CRASH_FILE_DIR + CRASH_FILE_PRE + CommonUtil.getNowDateNoFormat() + ".txt";
+ writeFile(pathfile, msg, true);
+ }
+
+ public static void writeLogFile(String msg) {
+ String pathfile = LOG_FILE_DIR + LOG_FILE_PRE + CommonUtil.getNowDateNoFormat() + ".txt";
+ writeFile(pathfile, msg, true);
+ }
+
+ private static void writeFile(String targetPath, String msg, boolean append) {
+ if (android.os.Environment.MEDIA_MOUNTED.equals(android.os.Environment.getExternalStorageState())) {
+ File targetFile = new File(Environment.getExternalStorageDirectory() + targetPath);
+ if (!targetFile.getParentFile().exists()) {
+ targetFile.getParentFile().mkdirs();
+ }
+ try {
+ OutputStreamWriter osw = new OutputStreamWriter(
+ new FileOutputStream(targetFile, append), "utf-8");
+ try {
+ osw.write(msg);
+ osw.write("</br>\n");
+ osw.flush();
+ osw.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ } catch (UnsupportedEncodingException e1) {
+ e1.printStackTrace();
+ } catch (FileNotFoundException e1) {
+ e1.printStackTrace();
+ }
+ }
+ }
+
+ private static void removeFile(String targetPath, String prefile, int beforeday) {
+ if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
+ File rootFile = new File(Environment.getExternalStorageDirectory() + targetPath);
+ if (!rootFile.exists()) {
+ return;
+ }
+ String logname = prefile + CommonUtil.getDayDateNoFormatBefore(beforeday) + ".txt";
+ File[] files = rootFile.listFiles();
+ for (File file : files) {
+ String fullfilename = file.getAbsolutePath();
+ String filename = fullfilename.substring(fullfilename.lastIndexOf('/') + 1);
+ if (filename.startsWith(prefile) &&
+ filename.endsWith(".txt")) {
+ if (filename.compareTo(logname) < 0) {
+ file.delete();
+ }
+ }
+ }
+ }
+ }
+
+ private static File createFile(String path, String fileName) {
+ if (android.os.Environment.MEDIA_MOUNTED.equals(android.os.Environment.getExternalStorageState())) {
+ File rootFile = new File(Environment.getExternalStorageDirectory() + path);
+ if (!rootFile.exists()) {
+ rootFile.mkdirs();
+ }
+ File retFile = new File(rootFile, fileName);
+ if (!retFile.exists()) {
+ try {
+ retFile.createNewFile();
+ } catch (IOException e) {
+ return null;
+ }
+ }
+ return retFile;
+ }
+ return null;
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/util/GsonUtil.java b/app/src/main/java/com/supwisdom/util/GsonUtil.java
new file mode 100644
index 0000000..7fad16d
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/util/GsonUtil.java
@@ -0,0 +1,64 @@
+package com.supwisdom.util;
+
+import com.alibaba.fastjson.JSON;
+
+/**
+ * Created by zzq on 2016-01-08.
+ */
+public class GsonUtil {
+ private GsonUtil() {
+ }
+
+ /**
+ * 转成json
+ *
+ * @param object
+ * @return
+ */
+ public static String GsonString(Object object) {
+ return JSON.toJSONString(object);
+ }
+
+ /**
+ * 转成bean
+ *
+ * @param gsonString
+ * @param cls
+ * @return
+ */
+ public static <T> T GsonToBean(String gsonString, Class<T> cls) {
+ return JSON.parseObject(gsonString, cls);
+ }
+
+ /**
+ * 转成list
+ *
+ * @param gsonString
+ * @param cls
+ * @return
+ */
+// public static <T> List<T> GsonToList(String gsonString, Class<T> cls) {
+// return JSON.parseObject(gsonString, new TypeReference<ArrayList<T>>() {
+// });
+// }
+
+ /**
+ * 转成list中有map的
+ *
+ * @param gsonString
+ * @return
+ */
+// public static <T> List<Map<String, T>> GsonToListMaps(String gsonString, Class<T> cls) {
+// return null;
+// }
+
+ /**
+ * 转成map的
+ *
+ * @param gsonString
+ * @return
+ */
+// public static <T> Map<String, T> GsonToMaps(String gsonString, Class<T> cls) {
+// return (Map<String, T>) JSON.parse(gsonString);
+// }
+}
diff --git a/app/src/main/java/com/supwisdom/util/LogUtil.java b/app/src/main/java/com/supwisdom/util/LogUtil.java
new file mode 100644
index 0000000..7691e2c
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/util/LogUtil.java
@@ -0,0 +1,40 @@
+package com.supwisdom.util;
+
+/**
+ * @author zzq
+ * @date 2018/8/19
+ * @desc
+ */
+public class LogUtil {
+ private static int DEBUG = 3;
+ private static int INFO = 2;
+ private static int ERROR = 1;
+ private static int curlevel = DEBUG;
+
+ public static void setLevel(int level) {
+ curlevel = level;
+ }
+
+ public static void d(String tag, String msg) {
+ if (curlevel >= DEBUG) {
+ writeLog(tag, msg);
+ }
+ }
+
+ public static void i(String tag, String msg) {
+ if (curlevel >= INFO) {
+ writeLog(tag, msg);
+ }
+ }
+
+ public static void e(String tag, String msg) {
+ if (curlevel >= ERROR) {
+ writeLog(tag, msg);
+ }
+ }
+
+ private static void writeLog(String tag, String msg) {
+ String time = CommonUtil.getNowDate() + "--";
+ FileUtil.writeLogFile(tag + ":" + time + "--" + msg);
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/util/PublicDef.java b/app/src/main/java/com/supwisdom/util/PublicDef.java
new file mode 100644
index 0000000..2cdac14
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/util/PublicDef.java
@@ -0,0 +1,48 @@
+package com.supwisdom.util;
+
+public class PublicDef {
+ /**
+ * 签名方式
+ */
+ public static final String signMethod = "HMAC";
+
+ public static final String APP_ID = "20001";
+ public static final String APP_SECRET = "nzoqPYMIu91VViA/mEIG5FtJXi8=";
+
+ /**
+ * 维护人员密码
+ */
+ public static final String MANAGER_PWD = "111111";
+
+ public static final int MSG_SHOWTIME = 1;
+ public static final int MSG_SHOWCONFERENCE = 2;
+ public static final int MSG_SHOWNETSTATUS = 3;
+ public static final int MSG_SHOWRATE_LIST = 4;
+ public static final int MSG_SHOWRATE_NOLIST = 5;
+
+ public static final String CONTROL_HAS_REGISTER = "hasregister";
+
+ /**
+ * 状态
+ **/
+ public static final int SUCCESS = 0; // 成功均为 0, 非0失败
+ public static final int ERROR = 1; // 成功均为 0, 非0失败
+
+ /**
+ * Toast show
+ */
+ public static final int TOAST_SHOW_CRY = 800;
+ public static final int TOAST_SHOW_SMILE = 801;
+ public static final int TOAST_SHOW_DOUBT = 802;
+
+ public static final String LIST_TYPE = "list"; // 有名单会议
+ public static final String NOLIST_TYPE = "nolist"; // 无名单会议
+
+ //人员参会状态
+ public static final String ATTENDSTATUS_UNCHECK="uncheck";//未签到
+ public static final String ATTENDSTATUS_CHECKED="checked";//已签到
+ public static final String ATTENDSTATUS_LATE="late";//迟到
+ public static final String ATTENDSTATUS_CLOSED="closed";//关闭
+ public static final String ATTENDSTATUS_INSTEAD="instead";//代签
+ public static final String ATTENDSTATUS_HAND="handcheck";//手工签到
+}
diff --git a/app/src/main/java/com/supwisdom/util/QRCodeUtil.java b/app/src/main/java/com/supwisdom/util/QRCodeUtil.java
new file mode 100644
index 0000000..9ef20eb
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/util/QRCodeUtil.java
@@ -0,0 +1,40 @@
+package com.supwisdom.util;
+
+import android.graphics.Bitmap;
+import com.google.zxing.BarcodeFormat;
+import com.google.zxing.MultiFormatWriter;
+import com.google.zxing.WriterException;
+import com.google.zxing.common.BitMatrix;
+
+public class QRCodeUtil {
+ /**
+ * 将指定的内容生成成二维码
+ *
+ * @param content 将要生成二维码的内容
+ * @return 返回生成好的二维码事件
+ * @throws com.google.zxing.WriterException WriterException异常
+ * @size 二维码的长宽(等距)
+ */
+ public static Bitmap CreateTwoDCode(String content, int size) throws WriterException {
+ // 生成二维矩阵,编码时指定大小,不要生成了图片以后再进行缩放,这样会模糊导致识别失败
+ BitMatrix matrix = new MultiFormatWriter().encode(content,
+ BarcodeFormat.QR_CODE, size, size);
+ int width = matrix.getWidth();
+ int height = matrix.getHeight();
+ // 二维矩阵转为一维像素数组,也就是一直横着排了
+ int[] pixels = new int[width * height];
+ for (int y = 0; y < height; y++) {
+ for (int x = 0; x < width; x++) {
+ if (matrix.get(x, y)) {
+ pixels[y * width + x] = 0xff000000;
+ }
+ }
+ }
+
+ Bitmap bitmap = Bitmap.createBitmap(width, height,
+ Bitmap.Config.ARGB_8888);
+ // 通过像素数组生成bitmap,具体参考api
+ bitmap.setPixels(pixels, 0, width, 0, 0, width, height);
+ return bitmap;
+ }
+}
diff --git a/app/src/main/java/com/supwisdom/util/ThreadPool.java b/app/src/main/java/com/supwisdom/util/ThreadPool.java
new file mode 100644
index 0000000..c5a533b
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/util/ThreadPool.java
@@ -0,0 +1,176 @@
+package com.supwisdom.util;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.Executors;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Created by zzq on 2016-01-11.
+ */
+public class ThreadPool {
+ private static final String DEFAULT_SINGLE_POOL_NAME = "DEFAULT_SINGLE_POOL_NAME";
+
+ private static ThreadPoolProxy mLongPool = null;
+ private static Object mLongLock = new Object();
+
+ private static ThreadPoolProxy mShortPool = null;
+ private static Object mShortLock = new Object();
+
+ private static ThreadPoolProxy mDownloadPool = null;
+ private static Object mDownloadLock = new Object();
+
+ private static Map<String, ThreadPoolProxy> mMap = new HashMap<String, ThreadPoolProxy>();
+ private static Object mSingleLock = new Object();
+ //ExecutorService cachedThreadPool = Executors.newCachedThreadPool();
+
+ /**
+ * 获取下载线程
+ */
+ public static ThreadPoolProxy getDownloadPool() {
+ if (mDownloadPool == null) {
+ synchronized (mDownloadLock) {
+ if (mDownloadPool == null) {
+ //获取CPU核数
+ int num = Runtime.getRuntime().availableProcessors();
+ int corePoolSize = num + 1;
+ int maximumPoolSize = 2 * num + 1;
+ mDownloadPool = new ThreadPoolProxy(corePoolSize, maximumPoolSize, 1L);
+ }
+ }
+ }
+ return mDownloadPool;
+ }
+
+ /**
+ * 获取一个用于执行长耗时任务的线程池,避免和短耗时任务处在同一个队列而阻塞了重要的短耗时任务,通常用来联网操作
+ */
+
+ public static ThreadPoolProxy getLongPool() {
+ if (mLongPool == null) {
+ synchronized (mLongLock) {
+ if (mLongPool == null) {
+ //获取CPU核数
+ int num = Runtime.getRuntime().availableProcessors();
+ int corePoolSize = num + 1;
+ int maximumPoolSize = 2 * num + 1;
+ mLongPool = new ThreadPoolProxy(corePoolSize, maximumPoolSize, 1L);
+ }
+ }
+ }
+ return mLongPool;
+ }
+
+ /**
+ * 获取一个用于执行短耗时任务的线程池,避免因为和耗时长的任务处在同一个队列而长时间得不到执行,通常用来执行本地的IO/SQL
+ */
+ public static ThreadPoolProxy getShortPool() {
+ if (mShortPool == null) {
+ synchronized (mShortLock) {
+ if (mShortPool == null) {
+ //获取CPU核数
+ int num = Runtime.getRuntime().availableProcessors();
+ int corePoolSize = num + 1;
+ int maximumPoolSize = 2 * num + 1;
+ mShortPool = new ThreadPoolProxy(corePoolSize, maximumPoolSize, 1L);
+ }
+ }
+ }
+ return mShortPool;
+ }
+
+ /**
+ * 获取一个单线程池,所有任务将会被按照加入的顺序执行,免除了同步开销的问题
+ */
+ public static ThreadPoolProxy getSinglePool() {
+ return getSinglePool(DEFAULT_SINGLE_POOL_NAME);
+ }
+
+ /**
+ * 获取一个单线程池,所有任务将会被按照加入的顺序执行,免除了同步开销的问题
+ */
+ public static ThreadPoolProxy getSinglePool(String name) {
+ synchronized (mSingleLock) {
+ ThreadPoolProxy singlePool = mMap.get(name);
+ if (singlePool == null) {
+ singlePool = new ThreadPoolProxy(1, 1, 1L);
+ mMap.put(name, singlePool);
+ }
+ return singlePool;
+ }
+ }
+
+ public static class ThreadPoolProxy {
+ private ThreadPoolExecutor mPool;
+ private int mCorePoolSize;
+ private int mMaximumPoolSize;
+ private long mKeepAliveTime;
+
+ private ThreadPoolProxy(int corePoolSize, int maximumPoolSize, long keepAliveTime) {
+ mCorePoolSize = corePoolSize;
+ mMaximumPoolSize = maximumPoolSize;
+ mKeepAliveTime = keepAliveTime;
+ }
+
+ /**
+ * 执行任务,当线程池处于关闭,将会重新创建新的线程池
+ */
+ public synchronized void execute(Runnable run) {
+ if (run == null) {
+ return;
+ }
+ if (mPool == null || mPool.isShutdown()) {
+ //参数说明
+ //当线程池中的线程小于mCorePoolSize,直接创建新的线程加入线程池执行任务
+ //当线程池中的线程数目等于mCorePoolSize,将会把任务放入任务队列BlockingQueue中
+ //当BlockingQueue中的任务放满了,将会创建新的线程去执行,
+ //但是当总线程数大于mMaximumPoolSize时,将会抛出异常,交给RejectedExecutionHandler处理
+ //mKeepAliveTime是线程执行完任务后,且队列中没有可以执行的任务,存活的时间,后面的参数是时间单位
+ //ThreadFactory是每次创建新的线程工厂
+ mPool = new ThreadPoolExecutor(mCorePoolSize, mMaximumPoolSize, mKeepAliveTime, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(), Executors.defaultThreadFactory(), new ThreadPoolExecutor.AbortPolicy());
+ }
+ mPool.execute(run);
+ }
+
+ /**
+ * 取消线程池中某个还未执行的任务
+ */
+ public synchronized void cancel(Runnable run) {
+ if (mPool != null && (!mPool.isShutdown() || mPool.isTerminating())) {
+ mPool.getQueue().remove(run);
+ }
+ }
+
+ /**
+ * 取消线程池中某个还未执行的任务
+ */
+ public synchronized boolean contains(Runnable run) {
+ if (mPool != null && (!mPool.isShutdown() || mPool.isTerminating())) {
+ return mPool.getQueue().contains(run);
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * 立刻关闭线程池,并且正在执行的任务也将会被中断
+ */
+ public void stop() {
+ if (mPool != null && (!mPool.isShutdown() || mPool.isTerminating())) {
+ mPool.shutdownNow();
+ }
+ }
+
+ /**
+ * 平缓关闭单任务线程池,但是会确保所有已经加入的任务都将会被执行完毕才关闭
+ */
+ public synchronized void shutdown() {
+ if (mPool != null && (!mPool.isShutdown() || mPool.isTerminating())) {
+ mPool.shutdownNow();
+ }
+ }
+ }
+
+}
diff --git a/app/src/main/java/com/supwisdom/view/SWToast.java b/app/src/main/java/com/supwisdom/view/SWToast.java
new file mode 100644
index 0000000..73190ab
--- /dev/null
+++ b/app/src/main/java/com/supwisdom/view/SWToast.java
@@ -0,0 +1,53 @@
+package com.supwisdom.view;
+
+import android.content.Context;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.supwisdom.conferencecheck.R;
+import com.supwisdom.util.PublicDef;
+
+/**
+ * Created by zzq on 2016-05-18.
+ */
+public class SWToast {
+ public static void show(Context context, String msg, int showway) {
+ LayoutInflater Inflater = LayoutInflater.from(context);
+ View layout = Inflater.inflate(R.layout.sw_toast, null);
+
+ ImageView cry = (ImageView) layout.findViewById(R.id.pic_cry);
+ ImageView smile = (ImageView) layout.findViewById(R.id.pic_smile);
+ ImageView doubt = (ImageView) layout.findViewById(R.id.pic_doubt);
+ if (showway == PublicDef.TOAST_SHOW_CRY) {
+ cry.setVisibility(View.VISIBLE);
+ smile.setVisibility(View.GONE);
+ doubt.setVisibility(View.GONE);
+ } else if (showway == PublicDef.TOAST_SHOW_SMILE) {
+ cry.setVisibility(View.GONE);
+ smile.setVisibility(View.VISIBLE);
+ doubt.setVisibility(View.GONE);
+ } else if (showway == PublicDef.TOAST_SHOW_DOUBT) {
+ cry.setVisibility(View.GONE);
+ smile.setVisibility(View.GONE);
+ doubt.setVisibility(View.VISIBLE);
+ } else {
+ cry.setVisibility(View.GONE);
+ smile.setVisibility(View.VISIBLE);
+ doubt.setVisibility(View.GONE);
+ }
+
+ // set a message
+ TextView toastText = (TextView) layout.findViewById(R.id.toasttext);
+ toastText.setText(msg);
+ // Toast...
+ Toast toast = new Toast(context);
+ toast.setGravity(Gravity.CENTER, 0, 0);
+ toast.setDuration(Toast.LENGTH_SHORT);
+ toast.setView(layout);
+ toast.show();
+ }
+}
diff --git a/app/src/main/java/com/visionsmarts/VSBarcodeReader.java b/app/src/main/java/com/visionsmarts/VSBarcodeReader.java
new file mode 100644
index 0000000..feb3b33
--- /dev/null
+++ b/app/src/main/java/com/visionsmarts/VSBarcodeReader.java
@@ -0,0 +1,90 @@
+package com.visionsmarts;
+
+public class VSBarcodeReader {
+ public static final int BARCODE_TYPE_CODABAR = 64;
+ public static final int BARCODE_TYPE_CODE128 = 32;
+ public static final int BARCODE_TYPE_CODE39 = 16;
+ public static final int BARCODE_TYPE_CODE93 = 128;
+ public static final int BARCODE_TYPE_EAN_13_UPC_A = 1;
+ public static final int BARCODE_TYPE_EAN_8 = 2;
+ public static final String BARCODE_TYPE_ID_CODABAR = "CODABAR";
+ public static final String BARCODE_TYPE_ID_CODE128 = "CODE128";
+ public static final String BARCODE_TYPE_ID_CODE39 = "CODE39";
+ public static final String BARCODE_TYPE_ID_CODE93 = "CODE93";
+ public static final String BARCODE_TYPE_ID_EAN_13_UPC_A = "EAN13";
+ public static final String BARCODE_TYPE_ID_EAN_8 = "EAN8";
+ public static final String BARCODE_TYPE_ID_ITF = "ITF";
+ public static final String BARCODE_TYPE_ID_STD2OF5 = "STD2OF5";
+ public static final String BARCODE_TYPE_ID_UPC_E = "UPCE";
+ public static final int BARCODE_TYPE_INVALID = -1;
+ public static final int BARCODE_TYPE_ITF = 8;
+ public static final String BARCODE_TYPE_NAME_CODABAR = "Codabar";
+ public static final String BARCODE_TYPE_NAME_CODE128 = "Code 128";
+ public static final String BARCODE_TYPE_NAME_CODE39 = "Code 39";
+ public static final String BARCODE_TYPE_NAME_CODE93 = "Code 93";
+ public static final String BARCODE_TYPE_NAME_EAN_13_UPC_A = "EAN-13/UPC-A";
+ public static final String BARCODE_TYPE_NAME_EAN_8 = "EAN-8";
+ public static final String BARCODE_TYPE_NAME_ITF = "ITF";
+ public static final String BARCODE_TYPE_NAME_STD2OF5 = "STD 2 of 5";
+ public static final String BARCODE_TYPE_NAME_UPC_E = "UPC-E";
+ public static final int BARCODE_TYPE_STD2OF5 = 256;
+ public static final int BARCODE_TYPE_UPC_E = 4;
+
+ public static class DecoderValues {
+ public int evaluationDays;
+ public int left;
+ public Point lineEnd;
+ public Point lineStart;
+ public int right;
+ public int type;
+
+ public DecoderValues() {
+ this.lineStart = new Point();
+ this.lineEnd = new Point();
+ }
+ }
+
+ public static class Point {
+ public int x;
+ public int y;
+ }
+
+ public static native int VSinit();
+
+ public static native String decodeNextImage(byte[] bArr, int i, int i2, DecoderValues decoderValues);
+
+ public static native String decodeNextImageOmnidirectional(byte[] bArr, int i, int i2, int i3, DecoderValues decoderValues);
+
+ public static native int reset();
+
+ public static native int setBlurryAcceptanceThresholdWithAF(double d);
+
+ static {
+ System.loadLibrary("VSBarcodeReader");
+ }
+
+ public static String format(String barcode, int type) {
+ Object[] objArr;
+ switch (type) {
+ case BARCODE_TYPE_EAN_13_UPC_A /*1*/:
+ if (barcode.substring(0, BARCODE_TYPE_EAN_13_UPC_A).equals("0")) {
+ objArr = new Object[BARCODE_TYPE_UPC_E];
+ objArr[0] = barcode.substring(BARCODE_TYPE_EAN_13_UPC_A, BARCODE_TYPE_EAN_8);
+ objArr[BARCODE_TYPE_EAN_13_UPC_A] = barcode.substring(BARCODE_TYPE_EAN_8, 7);
+ objArr[BARCODE_TYPE_EAN_8] = barcode.substring(7, 12);
+ objArr[3] = barcode.substring(12, 13);
+ return String.format("%s-%s-%s-%s", objArr);
+ }
+ return String.format("%s-%s-%s", new Object[]{barcode.substring(0, BARCODE_TYPE_EAN_13_UPC_A), barcode.substring(BARCODE_TYPE_EAN_13_UPC_A, 7), barcode.substring(7, 13)});
+ case BARCODE_TYPE_EAN_8 /*2*/:
+ objArr = new Object[BARCODE_TYPE_EAN_8];
+ objArr[0] = barcode.substring(0, BARCODE_TYPE_UPC_E);
+ objArr[BARCODE_TYPE_EAN_13_UPC_A] = barcode.substring(BARCODE_TYPE_UPC_E, BARCODE_TYPE_ITF);
+ return String.format("%s-%s", objArr);
+ case BARCODE_TYPE_UPC_E /*4*/:
+ return String.format("%s-%s-%s", new Object[]{barcode.substring(0, BARCODE_TYPE_EAN_13_UPC_A), barcode.substring(BARCODE_TYPE_EAN_13_UPC_A, 7), barcode.substring(7, BARCODE_TYPE_ITF)});
+ default:
+ return barcode;
+ }
+ }
+}
diff --git a/app/src/main/java/com/visionsmarts/VSReaderQR.java b/app/src/main/java/com/visionsmarts/VSReaderQR.java
new file mode 100644
index 0000000..12acf68
--- /dev/null
+++ b/app/src/main/java/com/visionsmarts/VSReaderQR.java
@@ -0,0 +1,190 @@
+package com.visionsmarts;
+
+import java.nio.ByteBuffer;
+import java.nio.charset.CharacterCodingException;
+import java.nio.charset.Charset;
+
+public class VSReaderQR {
+ public static final int MODE_ALPHANUMERIC = 2;
+ public static final int MODE_BYTE = 4;
+ public static final int MODE_KANJI = 8;
+ public static final int MODE_NUMERIC = 1;
+ public static final String QR_CODE_TYPE_ID = "QR";
+
+ public static class DecoderValues {
+ public Point corner1;
+ public Point corner2;
+ public Point corner3;
+ public Point corner4;
+ public int evaluationDays;
+ public int mode;
+
+ public DecoderValues() {
+ this.corner1 = new Point();
+ this.corner2 = new Point();
+ this.corner3 = new Point();
+ this.corner4 = new Point();
+ }
+ }
+
+ private static class ECIMarker {
+ public int eci;
+ public int position;
+
+ private ECIMarker() {
+ }
+ }
+
+ public static class Point {
+ public int x;
+ public int y;
+ }
+
+ public static native byte[] decodeImage(byte[] bArr, int i, int i2, DecoderValues decoderValues);
+
+ static {
+ System.loadLibrary("VSReaderQR");
+ }
+
+ public static String format(byte[] data, int mode) {
+ Charset charset = Charset.forName("UTF-8");
+ if ((mode & MODE_KANJI) == MODE_KANJI) {
+ charset = Charset.forName("Shift_JIS");
+ }
+ int position = 0;
+ if (data.length > 3 && data[0] == 93 && data[MODE_NUMERIC] == 81) {
+ if (data[MODE_ALPHANUMERIC] == 51 || data[MODE_ALPHANUMERIC] == 52) {
+ position = 0 + 3;
+ }
+ if ((data[MODE_ALPHANUMERIC] == 53 || data[MODE_ALPHANUMERIC] == 54) && data.length > 5) {
+ position += 5;
+ }
+ }
+ StringBuilder result = new StringBuilder(data.length);
+ do {
+ ECIMarker nextMarker = findFirstECIMarker(data, position);
+ String next = decodeData(ByteBuffer.wrap(data, position, Math.min(nextMarker.position, data.length) - position), charset);
+ if (next != null) {
+ result.append(next);
+ }
+ if (nextMarker.position != data.length) {
+ position = nextMarker.position + 7;
+ charset = getCharsetForECI(nextMarker.eci);
+ if (charset == null) {
+ charset = getCharsetForECI(0);
+ }
+ }
+ if (nextMarker.position == data.length) {
+ break;
+ }
+ } while (position < data.length);
+ return result.toString();
+ }
+
+ private static ECIMarker findFirstECIMarker(byte[] data, int fromPosition) {
+ ECIMarker eciMarker = new ECIMarker();
+ eciMarker.position = data.length;
+ int position = fromPosition;
+ while (position < data.length - 6) {
+ if (data[position] == 92 && Character.isDigit(data[position + MODE_NUMERIC]) && Character.isDigit(data[position + MODE_ALPHANUMERIC]) && Character.isDigit(data[position + 3]) && Character.isDigit(data[position + MODE_BYTE]) && Character.isDigit(data[position + 5]) && Character.isDigit(data[position + 6])) {
+ eciMarker.position = position;
+ eciMarker.eci = ((((((data[position + MODE_NUMERIC] - 48) * 100000) + ((data[position + MODE_ALPHANUMERIC] - 48) * 10000)) + ((data[position + 3] - 48) * 1000)) + ((data[position + MODE_BYTE] - 48) * 100)) + ((data[position + 5] - 48) * 10)) + (data[position + 6] - 48);
+ break;
+ }
+ position += MODE_NUMERIC;
+ }
+ return eciMarker;
+ }
+
+ private static Charset getCharsetForECI(int eci) {
+ switch (eci) {
+
+ case MODE_NUMERIC /*1*/:
+ return Charset.forName("ISO-8859-1");
+ case MODE_ALPHANUMERIC /*2*/:
+ return Charset.forName("ISO-8859-1");
+ case MODE_BYTE /*4*/:
+ return Charset.forName("ISO-8859-2");
+ case 5:
+ return Charset.forName("ISO-8859-3");
+ case 6:
+ return Charset.forName("ISO-8859-4");
+ case 7:
+ return Charset.forName("ISO-8859-5");
+ case MODE_KANJI /*8*/:
+ return Charset.forName("ISO-8859-6");
+ case 9:
+ return Charset.forName("ISO-8859-7");
+ case 10:
+ return Charset.forName("ISO-8859-8");
+ case 11:
+ return Charset.forName("ISO-8859-9");
+ case 12:
+ return Charset.forName("ISO-8859-10");
+ case 13:
+ return Charset.forName("ISO-8859-11");
+ case 15:
+ return Charset.forName("ISO-8859-13");
+ case VSBarcodeReader.BARCODE_TYPE_CODE39 /*16*/:
+ return Charset.forName("ISO-8859-14");
+ case 17:
+ return Charset.forName("ISO-8859-15");
+ case 18:
+ return Charset.forName("ISO-8859-16");
+ case 20:
+ return Charset.forName("Shift_JIS");
+ case 21:
+ return Charset.forName("windows-1250");
+ case 22:
+ return Charset.forName("windows-1251");
+ case 23:
+ return Charset.forName("windows-1252");
+ case 24:
+ return Charset.forName("windows-1256");
+ case 25:
+ return Charset.forName("UTF-16BE");
+ case 26:
+ return Charset.forName("UTF-8");
+ case 27:
+ return Charset.forName("EUC-JP");
+ case 28:
+ return Charset.forName("Big5");
+ case 29:
+ return Charset.forName("x-EUC-CN");
+ case 30:
+ return Charset.forName("EUC-KR");
+ case 899:
+ return Charset.forName("UTF-8");
+ default:
+ return null;
+ }
+ }
+
+ public static String decodeData(ByteBuffer data, Charset charset) {
+ try {
+ return charset.newDecoder().decode(data).toString();
+ } catch (CharacterCodingException e) {
+ data.rewind();
+ try {
+ return Charset.forName("Shift_JIS").newDecoder().decode(data).toString();
+ } catch (CharacterCodingException e2) {
+ data.rewind();
+ try {
+ return Charset.forName("UTF-8").newDecoder().decode(data).toString();
+ } catch (CharacterCodingException e3) {
+ data.rewind();
+ try {
+ return Charset.forName("ISO-8859-1").newDecoder().decode(data).toString();
+ } catch (CharacterCodingException e4) {
+ data.rewind();
+ try {
+ return Charset.forName("US-ASCII").newDecoder().decode(data).toString();
+ } catch (CharacterCodingException e5) {
+ return null;
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/visionsmarts/pic2shop/activity/ScannerActivity.java b/app/src/main/java/com/visionsmarts/pic2shop/activity/ScannerActivity.java
new file mode 100644
index 0000000..d83243e
--- /dev/null
+++ b/app/src/main/java/com/visionsmarts/pic2shop/activity/ScannerActivity.java
@@ -0,0 +1,227 @@
+package com.visionsmarts.pic2shop.activity;
+
+import android.app.AlertDialog;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.res.AssetFileDescriptor;
+import android.media.AudioManager;
+import android.media.MediaPlayer;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.util.Log;
+import android.view.KeyEvent;
+import android.view.View;
+import android.view.animation.Animation;
+import android.view.animation.LinearInterpolator;
+import android.view.animation.TranslateAnimation;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.supwisdom.conferencecheck.R;
+import com.supwisdom.conferencecheck.activity.BaseActivity;
+import com.supwisdom.conferencecheck.activity.MainActivity;
+import com.visionsmarts.VSBarcodeReader;
+import com.visionsmarts.pic2shop.view.ScannerLiveView;
+import com.visionsmarts.pic2shop.view.ScannerLiveView.Listener;
+
+import java.io.IOException;
+
+public class ScannerActivity extends BaseActivity implements Listener {
+ private static final float BEEP_VOLUME = 0.9f;
+ private MediaPlayer mBeepMediaPlayer;
+ private ScannerLiveView scannerLiveView;
+ private MediaPlayer mediaPlayer;
+ private boolean playBeep;
+ private View exit, exit2;
+ private TextView timer;
+
+ private boolean isExit_time = false;
+ private final static int SECONDE = 31; // 倒计时时间 -秒
+ private int recLen = SECONDE; // 剩余时间
+
+ private TimerService timerService;
+
+ private Handler timerHandler = new Handler(){
+ @Override
+ public void handleMessage(Message msg) {
+ if(msg.what != -9){
+ timer.setText(msg.what + "");
+ }else{
+ exit();
+ }
+ super.handleMessage(msg);
+ }
+ };
+
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ VSBarcodeReader.VSinit();
+ VSBarcodeReader.setBlurryAcceptanceThresholdWithAF(0.0d);
+ //getWindow().setFlags(1024, 1024);
+ //setRequestedOrientation(0);
+ setContentView(R.layout.activity_scanner_new);
+ timer = (TextView) findViewById(R.id.timer);
+ this.scannerLiveView = (ScannerLiveView) findViewById(R.id.scanner_live_view);
+ exit = findViewById(R.id.exit);
+ exit.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ exit();
+ }
+ });
+ exit2 = findViewById(R.id.back_btn);
+ exit2.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ exit();
+ }
+ });
+ initOther();
+ }
+
+ private void exit(){
+ Intent intent = new Intent();
+ Bundle bundle = new Bundle();
+ bundle.putString("vtoken", "");
+ intent.setClass(ScannerActivity.this, MainActivity.class);
+ intent.putExtras(bundle);
+ startActivity(intent);
+ //finish();
+ }
+
+ class TimerService extends Thread{
+ @Override
+ public void run() {
+ while(!isExit_time){
+ recLen--;
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ Message msg = new Message();
+ if(recLen == 0){
+ msg.what = -9;
+ }else{
+ msg.what = recLen;
+ }
+ timerHandler.sendMessage(msg);
+ }
+ }
+ }
+
+ @Override
+ public boolean dispatchKeyEvent(KeyEvent event){
+ return false;
+ }
+
+ private void initOther() {
+ ImageView mQrLineView = (ImageView) findViewById(R.id.capture_scan_line);
+ TranslateAnimation mAnimation = new TranslateAnimation(TranslateAnimation.ABSOLUTE, 0f, TranslateAnimation.ABSOLUTE, 0f,
+ TranslateAnimation.RELATIVE_TO_PARENT, 0f, TranslateAnimation.RELATIVE_TO_PARENT, 0.9f);
+ mAnimation.setDuration(1500);
+ mAnimation.setRepeatCount(-1);
+ mAnimation.setRepeatMode(Animation.REVERSE);
+ mAnimation.setInterpolator(new LinearInterpolator());
+ mQrLineView.setAnimation(mAnimation);
+
+ }
+
+
+ protected void onResume() {
+ super.onResume();
+ this.scannerLiveView.onResume();
+ this.scannerLiveView.startCamera();
+
+ playBeep = true;
+ AudioManager audioService = (AudioManager) getSystemService(AUDIO_SERVICE);
+ if (audioService.getRingerMode() != AudioManager.RINGER_MODE_NORMAL) {
+ playBeep = false;
+ }
+ initBeepSound();
+ isExit_time = false;
+ timerService = new TimerService();
+ timerService.start();
+ }
+
+ protected void onPause() {
+ super.onPause();
+ isExit_time = true;
+ this.scannerLiveView.stopCamera();
+ this.scannerLiveView.onPause();
+ finish();
+ }
+
+ protected void onDestroy() {
+ super.onDestroy();
+ isExit_time = true;
+ if (this.mBeepMediaPlayer != null) {
+ this.mBeepMediaPlayer.release();
+ this.mBeepMediaPlayer = null;
+ }
+ }
+
+ private void initBeepSound() {
+ if (playBeep && mediaPlayer == null) {
+ setVolumeControlStream(AudioManager.STREAM_MUSIC);
+ mediaPlayer = new MediaPlayer();
+ mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
+ mediaPlayer.setOnCompletionListener(beepListener);
+
+ AssetFileDescriptor file = getResources().openRawResourceFd(R.raw.beep);
+ try {
+ mediaPlayer.setDataSource(file.getFileDescriptor(), file.getStartOffset(), file.getLength());
+ file.close();
+ mediaPlayer.setVolume(BEEP_VOLUME, BEEP_VOLUME);
+ mediaPlayer.prepare();
+ } catch (IOException e) {
+ mediaPlayer = null;
+ }
+ }
+ }
+
+ private void playBeepSoundAndVibrate() {
+ if (playBeep && mediaPlayer != null) {
+ mediaPlayer.start();
+ }
+ }
+
+ private final MediaPlayer.OnCompletionListener beepListener = new MediaPlayer.OnCompletionListener() {
+ public void onCompletion(MediaPlayer mediaPlayer) {
+ mediaPlayer.seekTo(0);
+ }
+ };
+
+ public void onCodeScanned(String codeFormat, String codeData) {
+ //setResultAndFinish(codeFormat, codeData);
+ playBeepSoundAndVibrate();
+ processResult(codeData);
+ }
+ public void onCameraIssue() {
+ Log.e("test", "无法获取相机服务,请重试");
+ showMsgDialogWithCallback("无法获取相机服务,请重试");
+ }
+
+ private void processResult(String ret) {
+ Log.e("test", "-----------result:"+ret);
+ Intent intent = new Intent();
+ Bundle bundle = new Bundle();
+ bundle.putString("vtoken", ret);
+ intent.setClass(ScannerActivity.this, MainActivity.class);
+ intent.putExtras(bundle);
+ startActivity(intent);
+ finish();
+ }
+
+ private void showMsgDialogWithCallback(String msg) {
+ new AlertDialog.Builder(this).setTitle(null).setPositiveButton("确定", new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialogInterface, int i) {
+ finish();
+ }
+ }).setCancelable(false).setMessage(msg).show();
+ }
+
+}
diff --git a/app/src/main/java/com/visionsmarts/pic2shop/activity/ScannerLinerActivity.java b/app/src/main/java/com/visionsmarts/pic2shop/activity/ScannerLinerActivity.java
new file mode 100644
index 0000000..a6201ed
--- /dev/null
+++ b/app/src/main/java/com/visionsmarts/pic2shop/activity/ScannerLinerActivity.java
@@ -0,0 +1,53 @@
+package com.visionsmarts.pic2shop.activity;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+import com.supwisdom.conferencecheck.R;
+import com.visionsmarts.VSBarcodeReader;
+import com.visionsmarts.pic2shop.view.ScannerLiveViewLiner;
+import com.visionsmarts.pic2shop.view.ScannerLiveViewLiner.Listener;
+
+public class ScannerLinerActivity extends Activity implements Listener {
+ private ScannerLiveViewLiner scannerLiveView;
+
+
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ VSBarcodeReader.VSinit();
+ VSBarcodeReader.setBlurryAcceptanceThresholdWithAF(0.0d);
+ int theme = 16973831;
+ setTheme(theme);
+ getWindow().setFlags(1024, 1024);
+ int ori = 0;
+ setRequestedOrientation(ori);
+ setContentView(R.layout.activity_scanner_liner);
+ this.scannerLiveView = (ScannerLiveViewLiner) findViewById(R.id.scanner_live_view);
+ }
+
+ protected void onResume() {
+ super.onResume();
+ this.scannerLiveView.onResume();
+ }
+
+ protected void onPause() {
+ super.onPause();
+ this.scannerLiveView.onPause();
+ if (!isFinishing()) {
+ finish();
+ }
+ }
+
+ protected void onDestroy() {
+ super.onDestroy();
+ }
+
+ public void onCodeScanned(String codeFormat, String codeData) {
+ //showSimpleMessageDialog(codeData);
+ }
+
+ public void onCameraIssue() {
+ //showSimpleMessageDialog("fail");
+ }
+
+}
diff --git a/app/src/main/java/com/visionsmarts/pic2shop/view/BarQrCodeUtil.java b/app/src/main/java/com/visionsmarts/pic2shop/view/BarQrCodeUtil.java
new file mode 100644
index 0000000..a5c72e8
--- /dev/null
+++ b/app/src/main/java/com/visionsmarts/pic2shop/view/BarQrCodeUtil.java
@@ -0,0 +1,18 @@
+package com.visionsmarts.pic2shop.view;
+
+import com.visionsmarts.VSReaderQR;
+
+import java.nio.ByteBuffer;
+import java.nio.charset.Charset;
+
+public class BarQrCodeUtil {
+ public static String qrToString(byte[] qrData) {
+ ByteBuffer qrBuffer;
+ if (qrData[qrData.length - 1] == 0) {
+ qrBuffer = ByteBuffer.wrap(qrData, 0, qrData.length - 1);
+ } else {
+ qrBuffer = ByteBuffer.wrap(qrData);
+ }
+ return VSReaderQR.decodeData(qrBuffer, Charset.forName("UTF-8"));
+ }
+}
diff --git a/app/src/main/java/com/visionsmarts/pic2shop/view/ScannerLiveView.java b/app/src/main/java/com/visionsmarts/pic2shop/view/ScannerLiveView.java
new file mode 100644
index 0000000..ad4bdc1
--- /dev/null
+++ b/app/src/main/java/com/visionsmarts/pic2shop/view/ScannerLiveView.java
@@ -0,0 +1,759 @@
+package com.visionsmarts.pic2shop.view;
+
+import android.app.Activity;
+import android.content.Context;
+import android.graphics.ImageFormat;
+import android.graphics.Point;
+import android.hardware.Camera;
+import android.hardware.Camera.AutoFocusCallback;
+import android.hardware.Camera.Parameters;
+import android.hardware.Camera.PreviewCallback;
+import android.hardware.Camera.Size;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Message;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.Display;
+import android.view.SurfaceHolder;
+import android.view.SurfaceHolder.Callback;
+import android.view.SurfaceView;
+import android.view.WindowManager;
+
+import com.supwisdom.conferencecheck.R;
+import com.supwisdom.util.Constants;
+import com.visionsmarts.VSBarcodeReader;
+import com.visionsmarts.VSBarcodeReader.DecoderValues;
+import com.visionsmarts.VSReaderQR;
+
+import java.io.IOException;
+import java.util.regex.Pattern;
+
+public class ScannerLiveView extends SurfaceView implements Callback {
+ private Point screen;
+ private static final int BARCODE_TYPES_MASK = 7;
+ private static final Pattern COMMA_PATTERN;
+ private static final int DESIRED_ZOOM_X10 = 27;
+ private static final String TAG;
+ private AutoFocusCallback mAutoFocusCallback;
+ private volatile byte[] mCallbackBuffer;
+ private volatile Camera mCamera;
+ private DecodingThread mDecodingThread;
+ volatile boolean mFoundBarcodeOrQRCode;
+ volatile byte[] mFrameData;
+ volatile boolean mFrameDataIsAutoFocusInProgress;
+ volatile boolean mHasCameraAutoFocus;
+ volatile boolean mIsAutoFocusInProgress;
+ volatile boolean mIsPreviewStarted;
+ Listener mListener;
+ private PreviewCallback mPreviewCallback;
+ private int mPreviewFrameSize;
+ volatile Size mPreviewSize;
+ final ScannerHandler mScannerHandler;
+ private volatile int mCameraDisplayOrientation;
+
+ public interface Listener {
+ void onCodeScanned(String str, String str2);
+ void onCameraIssue();
+ }
+
+ /* renamed from: com.visionsmarts.pic2shop.view.ScannerLiveView.1 */
+ class ScanAutoFocusCallback implements AutoFocusCallback {
+ ScanAutoFocusCallback() {
+ }
+
+ public void onAutoFocus(boolean success, Camera camera) {
+ ScannerLiveView.this.mIsAutoFocusInProgress = false;
+ }
+ }
+
+ /* renamed from: com.visionsmarts.pic2shop.view.ScannerLiveView.2 */
+ class ScanPreviewCallback implements PreviewCallback {
+ ScanPreviewCallback() {
+ }
+
+ public synchronized void onPreviewFrame(byte[] frameData, Camera camera) {
+ if (!(!ScannerLiveView.this.mIsPreviewStarted || ScannerLiveView.this.mDecodingThread == null || ScannerLiveView.this.mFoundBarcodeOrQRCode)) {
+ boolean shouldSendDecodeRequest = ScannerLiveView.this.mFrameData == null;
+ ScannerLiveView.this.mFrameData = frameData;
+ ScannerLiveView.this.mFrameDataIsAutoFocusInProgress = ScannerLiveView.this.mIsAutoFocusInProgress;
+ if (shouldSendDecodeRequest) {
+ ScannerLiveView.this.mDecodingThread.getHandler().obtainMessage(R.id.decode).sendToTarget();
+ }
+ }
+ }
+ }
+
+ private class DecodingThread extends Thread {
+ DecoderValues mBarcodeDecoderValues;
+ private Handler mHandler;
+ private int mNumberConsecutiveFailedDecodingSinceFocusEnded;
+ private byte[] mPreviewLine;
+ VSReaderQR.DecoderValues mQRDecoderValues;
+
+ /* renamed from: com.visionsmarts.pic2shop.view.ScannerLiveView.DecodingThread.1 */
+ class DecodeMessageHandler extends Handler {
+ DecodeMessageHandler() {
+ }
+
+ public void handleMessage(Message message) {
+ switch (message.what) {
+ case R.id.decode:
+ if (ScannerLiveView.this.mIsPreviewStarted && !ScannerLiveView.this.mFoundBarcodeOrQRCode) {
+ DecodingThread.this.decode();
+ }
+ break;
+ case R.id.quit:
+ Looper.myLooper().quit();
+ break;
+ default:
+ }
+ }
+ }
+
+ public DecodingThread() {
+ this.mNumberConsecutiveFailedDecodingSinceFocusEnded = 0;
+ this.mBarcodeDecoderValues = new DecoderValues();
+ this.mQRDecoderValues = new VSReaderQR.DecoderValues();
+ setPriority(10);
+ initialize();
+ }
+
+ synchronized Handler getHandler() {
+ if (this.mHandler == null) {
+ try {
+ ScannerLiveView.this.mDecodingThread.wait(1000);
+ } catch (InterruptedException e) {
+ }
+ }
+ return this.mHandler;
+ }
+
+ public void initialize() {
+ if (ScannerLiveView.this.mPreviewSize != null && (this.mPreviewLine == null || this.mPreviewLine.length != ScannerLiveView.this.mPreviewSize.height)) {
+ this.mPreviewLine = new byte[ScannerLiveView.this.mPreviewSize.height];
+ }
+ this.mNumberConsecutiveFailedDecodingSinceFocusEnded = 0;
+ ScannerLiveView.this.mFoundBarcodeOrQRCode = false;
+ VSBarcodeReader.reset();
+ }
+
+ public void run() {
+ Looper.prepare();
+ synchronized (this) {
+ this.mHandler = new DecodeMessageHandler();
+ notify();
+ }
+ Looper.loop();
+ }
+
+ private void decode() {
+ byte[] previewLine = this.mPreviewLine;
+ int width = ScannerLiveView.this.mPreviewSize.width;
+ int height = ScannerLiveView.this.mPreviewSize.height;
+ synchronized (ScannerLiveView.this.mPreviewCallback) {
+ if (ScannerLiveView.this.mFrameData == null) {
+ return;
+ }
+ byte[] frameData = ScannerLiveView.this.mFrameData;
+ boolean wasAutoFocusInProgress = ScannerLiveView.this.mFrameDataIsAutoFocusInProgress;
+ int offset = Math.round((float) (screen.y / 2));
+ Log.e(TAG,"offset="+offset);
+ try {
+ for (int i = previewLine.length - 1; i >= 0; i--) {
+ previewLine[i] = frameData[offset];
+ offset += width;
+ }
+ } catch (ArrayIndexOutOfBoundsException e) {
+ }
+ if (ScannerLiveView.this.mFrameData != null) {
+ String barcode = VSBarcodeReader.decodeNextImage(previewLine, ScannerLiveView.this.mHasCameraAutoFocus ? 1 : 0, ScannerLiveView.BARCODE_TYPES_MASK, this.mBarcodeDecoderValues);
+ if (ScannerLiveView.this.mFrameData != null) {
+ if (barcode.length() > 0) {
+ ScannerLiveView.this.mFoundBarcodeOrQRCode = true;
+ ScannerLiveView.this.mScannerHandler.obtainMessage(R.id.msg_barcode_found, barcode).sendToTarget();
+ } else {
+ try {
+ byte[] qrData = VSReaderQR.decodeImage(frameData, width, height, this.mQRDecoderValues);
+ if (qrData.length > 0) {
+ ScannerLiveView.this.mFoundBarcodeOrQRCode = true;
+ ScannerLiveView.this.mScannerHandler.obtainMessage(R.id.msg_qr_code_found, qrData).sendToTarget();
+ } else if (wasAutoFocusInProgress) {
+ this.mNumberConsecutiveFailedDecodingSinceFocusEnded = 0;
+ } else {
+ this.mNumberConsecutiveFailedDecodingSinceFocusEnded++;
+ if (ScannerLiveView.this.mHasCameraAutoFocus && !ScannerLiveView.this.mIsAutoFocusInProgress && this.mNumberConsecutiveFailedDecodingSinceFocusEnded >= 4) {
+ ScannerLiveView.this.mScannerHandler.obtainMessage(R.id.auto_focus).sendToTarget();
+ }
+ }
+ }catch (Exception e){
+ e.printStackTrace();
+ }
+ }
+ synchronized (ScannerLiveView.this.mPreviewCallback) {
+ ScannerLiveView.this.mFrameData = null;
+ if (!(ScannerLiveView.this.mFoundBarcodeOrQRCode || ScannerLiveView.this.mCallbackBuffer == null)) {
+ ScannerLiveView.this.mCamera.addCallbackBuffer(ScannerLiveView.this.mCallbackBuffer);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private class ScannerHandler extends Handler {
+ private ScannerHandler() {
+ }
+
+ public void handleMessage(Message message) {
+ switch (message.what) {
+ case R.id.auto_focus:
+ ScannerLiveView.this.requestAutoFocus();
+ break;
+ case R.id.msg_barcode_found:
+ if (ScannerLiveView.this.mIsPreviewStarted) {
+ ScannerLiveView.this.stopCamera();
+ ScannerLiveView.this.mListener.onCodeScanned(null, (String)message.obj);
+ }
+ break;
+ case R.id.msg_qr_code_found:
+ if (ScannerLiveView.this.mIsPreviewStarted) {
+ ScannerLiveView.this.stopCamera();
+ ScannerLiveView.this.mListener.onCodeScanned(Constants.CALLBACK_URL_QR_PARAM, BarQrCodeUtil.qrToString((byte[])message.obj));
+ }
+ break;
+ default:
+ }
+ }
+ }
+
+ public ScannerLiveView(Context context) {
+ super(context);
+ this.mPreviewFrameSize = 0;
+ this.mScannerHandler = new ScannerHandler();
+ this.mIsPreviewStarted = false;
+ this.mIsAutoFocusInProgress = false;
+ this.mFrameData = null;
+ this.mFrameDataIsAutoFocusInProgress = false;
+ this.mFoundBarcodeOrQRCode = false;
+ initialize(context);
+ }
+
+ public ScannerLiveView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ this.mPreviewFrameSize = 0;
+ this.mScannerHandler = new ScannerHandler();
+ this.mIsPreviewStarted = false;
+ this.mIsAutoFocusInProgress = false;
+ this.mFrameData = null;
+ this.mFrameDataIsAutoFocusInProgress = false;
+ this.mFoundBarcodeOrQRCode = false;
+ initialize(context);
+ }
+
+ public ScannerLiveView(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ this.mPreviewFrameSize = 0;
+ this.mScannerHandler = new ScannerHandler();
+ this.mIsPreviewStarted = false;
+ this.mIsAutoFocusInProgress = false;
+ this.mFrameData = null;
+ this.mFrameDataIsAutoFocusInProgress = false;
+ this.mFoundBarcodeOrQRCode = false;
+ initialize(context);
+ }
+
+ private void initialize(Context context) {
+ this.mListener = (Listener) context;
+ SurfaceHolder holder = getHolder();
+ holder.addCallback(this);
+ holder.setType(3);
+ holder.setKeepScreenOn(true);
+ this.mAutoFocusCallback = new ScanAutoFocusCallback();
+ this.mPreviewCallback = new ScanPreviewCallback();
+ Display display = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
+ screen = new Point();
+ display.getSize(screen);
+ }
+
+
+ public void surfaceCreated(SurfaceHolder holder) {
+ if (holder == null) {
+ throw new IllegalStateException("No SurfaceHolder provided");
+ } else if (this.mCamera == null) {
+ try {
+ this.mCamera = null;
+ try {
+ Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
+ int camIdx = 1; // 1-前置,0-后置
+ Camera.getCameraInfo(camIdx, cameraInfo);
+ this.mCamera = Camera.open(camIdx);
+ setCameraDisplayOrientation(camIdx);
+ /*int cameraCount = Camera.getNumberOfCameras();
+ for (int camIdx = 0; camIdx < cameraCount; camIdx++) {
+ Camera.getCameraInfo(camIdx, cameraInfo);
+ if (cameraInfo.facing == PublicDef.FRONT_CAMERA) { // 前置 or 后置摄像头
+ this.mCamera = Camera.open(camIdx);
+ //this.mCamera.setDisplayOrientation(90);
+ setCameraDisplayOrientation(camIdx);
+ break;
+ }
+ }*/
+ } catch (LinkageError e) {
+ }
+ if (this.mCamera == null) {
+ try {
+ this.mCamera = Camera.open(0);
+ //this.mCamera.setDisplayOrientation(90);
+ setCameraDisplayOrientation(0);
+ } catch (LinkageError e2) {
+ }
+ }
+ if (this.mCamera == null) {
+ this.mCamera = Camera.open();
+ }
+ this.mCamera.setPreviewDisplay(holder);
+ this.mIsPreviewStarted = false;
+ } catch (IOException e3) {
+ this.mListener.onCameraIssue();
+ } catch (RuntimeException e4) {
+ this.mListener.onCameraIssue();
+ }
+ }
+ }
+
+ public void setCameraDisplayOrientation(int cameraId) {
+ Camera.CameraInfo info = new Camera.CameraInfo();
+ Camera.getCameraInfo(cameraId, info);
+ int degrees = 0;
+ switch (((Activity) getContext()).getWindowManager().getDefaultDisplay().getRotation()) {
+ case 0:
+ degrees = 0;
+ break;
+ case 1:
+ degrees = 90;
+ break;
+ case 2:
+ degrees = 180;
+ break;
+ case 3:
+ degrees = 270;
+ break;
+ }
+ if (info.facing == 1) {
+ this.mCameraDisplayOrientation = (info.orientation + degrees) % 360;
+ this.mCameraDisplayOrientation = (360 - this.mCameraDisplayOrientation) % 360;
+ } else {
+ this.mCameraDisplayOrientation = ((info.orientation - degrees) + 360) % 360;
+ }
+ this.mCamera.setDisplayOrientation(this.mCameraDisplayOrientation);
+ }
+
+ public void surfaceDestroyed(SurfaceHolder holder) {
+ if (this.mCamera != null) {
+ stopCamera();
+ this.mPreviewFrameSize = 0;
+ }
+ }
+
+ public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
+ if (this.mCamera != null) {
+ stopCamera();
+ setCameraParameters(screen.y,screen.x);
+ if (isShown()) {
+ startCamera();
+ }
+ }
+ }
+
+ public void onPause() {
+ stopCamera();
+ if (this.mCamera != null) {
+ this.mCamera.release();
+ this.mCamera = null;
+ }
+ Message.obtain(this.mDecodingThread.getHandler(), R.id.quit).sendToTarget();
+ try {
+ this.mDecodingThread.join();
+ } catch (InterruptedException e) {
+ }
+ this.mScannerHandler.removeMessages(R.id.auto_focus);
+ this.mScannerHandler.removeMessages(R.id.msg_barcode_found);
+ this.mScannerHandler.removeMessages(R.id.msg_qr_code_found);
+ this.mDecodingThread = null;
+ }
+
+ public void onResume() {
+ /*this.mScannerOverlay = (ScannerOverlay) ((Activity) getContext()).findViewById(R.id.scanner_overlay);
+ this.mScannerOverlay.setBarcodeLocation(-1, -1);*/
+ this.mDecodingThread = new DecodingThread();
+ this.mDecodingThread.start();
+ startCamera();
+ }
+
+ public void startCamera() {
+ if (this.mCamera != null && !this.mIsPreviewStarted) {
+ this.mIsAutoFocusInProgress = false;
+ this.mFrameData = null;
+ if (this.mDecodingThread != null) {
+ this.mDecodingThread.initialize();
+ }
+ if (this.mPreviewFrameSize > 0) {
+ try {
+ this.mCallbackBuffer = new byte[this.mPreviewFrameSize];
+ } catch (OutOfMemoryError e) {
+ this.mCallbackBuffer = null;
+ }
+ }
+ if (this.mCallbackBuffer != null) {
+ this.mCamera.setPreviewCallbackWithBuffer(this.mPreviewCallback);
+ this.mCamera.addCallbackBuffer(this.mCallbackBuffer);
+ } else {
+ this.mCamera.setPreviewCallback(this.mPreviewCallback);
+ }
+ try {
+ this.mCamera.startPreview();
+ this.mIsPreviewStarted = true;
+ requestAutoFocus();
+ } catch (RuntimeException e2) {
+ this.mCamera.setPreviewCallback(null);
+ this.mCallbackBuffer = null;
+ this.mListener.onCameraIssue();
+ }
+ }
+ }
+
+ public void stopCamera() {
+ /*if (this.mCamera != null && this.mIsPreviewStarted) {
+ this.mCamera.setPreviewCallback(null);
+ this.mCamera.stopPreview();
+ this.mIsPreviewStarted = false;
+ if (this.mDecodingThread.getHandler() != null) {
+ this.mDecodingThread.getHandler().removeMessages(R.id.decode);
+ }
+ this.mScannerHandler.removeMessages(R.id.auto_focus);
+ this.mScannerHandler.removeMessages(R.id.msg_barcode_found);
+ }*/
+
+ if (this.mCamera != null && this.mIsPreviewStarted) {
+ synchronized (this.mPreviewCallback) {
+ this.mCamera.setPreviewCallback(null);
+ this.mCamera.stopPreview();
+ this.mIsPreviewStarted = false;
+ this.mCamera.cancelAutoFocus();
+ this.mFrameData = null;
+ this.mCallbackBuffer = null;
+ }
+ if (!(this.mDecodingThread == null || this.mDecodingThread.getHandler() == null)) {
+ this.mDecodingThread.getHandler().removeMessages(R.id.decode);
+ }
+ this.mScannerHandler.removeMessages(R.id.auto_focus);
+ this.mScannerHandler.removeMessages(R.id.msg_barcode_found);
+ this.mScannerHandler.removeMessages(R.id.msg_qr_code_found);
+ }
+
+ }
+
+ void requestAutoFocus() {
+ if (this.mCamera != null && this.mHasCameraAutoFocus && this.mIsPreviewStarted && !this.mIsAutoFocusInProgress) {
+ try {
+ this.mCamera.autoFocus(this.mAutoFocusCallback);
+ this.mIsAutoFocusInProgress = true;
+ } catch (RuntimeException e) {
+ Log.e(TAG, "Camera auto-focus failed: " + e.getLocalizedMessage());
+ }
+ }
+ }
+
+
+ private void setCameraParameters(int screenWidth, int screenHeight) {
+ Parameters parameters = this.mCamera.getParameters();
+ Log.e(TAG,"screenWidth="+screenWidth+",screenHeight="+screenHeight);
+ setPreviewSize(screenWidth, screenHeight, parameters);
+ setZoom(parameters);
+ String focusModeValues = parameters.get("focus-mode-values");
+ if (focusModeValues != null && focusModeValues.contains("macro")) {
+ parameters.set("focus-mode", "macro");
+ this.mHasCameraAutoFocus = true;
+ } else if (focusModeValues == null || !focusModeValues.contains("auto")) {
+ this.mHasCameraAutoFocus = false;
+ } else {
+ parameters.set("focus-mode", "auto");
+ this.mHasCameraAutoFocus = true;
+ }
+ try {
+ this.mCamera.setParameters(parameters);
+ } catch (RuntimeException e) {
+ this.mListener.onCameraIssue();
+ }
+ parameters = this.mCamera.getParameters();
+ this.mPreviewSize = parameters.getPreviewSize();
+ this.mPreviewFrameSize = ((this.mPreviewSize.width * this.mPreviewSize.height) * ImageFormat.getBitsPerPixel(parameters.getPreviewFormat())) / 8;
+ }
+
+ private void setPreviewSize(int screenWidth, int screenHeight, Parameters parameters) {
+ String previewSizeValuesString = parameters.get("preview-size-values");
+ if (previewSizeValuesString == null) {
+ previewSizeValuesString = parameters.get("preview-size-value");
+ }
+ Point bestPreviewSize = null;
+ if (previewSizeValuesString != null) {
+ bestPreviewSize = findBestPreviewSize(previewSizeValuesString, screenWidth, screenHeight);
+ }
+ if (bestPreviewSize != null) {
+ parameters.setPreviewSize(bestPreviewSize.x, bestPreviewSize.y);
+ } else {
+ parameters.setPreviewSize((screenWidth >> 4) << 4, (screenHeight >> 1) << 1);
+ }
+ }
+
+ private static Point findBestPreviewSize(CharSequence previewSizeValuesString, int screenWidth, int screenHeight) {
+ int bestPreviewWidth = 0;
+ int bestPreviewHeight = 0;
+ int minDifference = Integer.MAX_VALUE;
+ for (String previewSizeValueString : COMMA_PATTERN.split(previewSizeValuesString)) {
+ String previewSizeValueString2 = previewSizeValueString.trim();
+ int separatorPosition = previewSizeValueString2.indexOf(120);
+ if (separatorPosition >= 0) {
+ try {
+ int previewSizeValueWidth = Integer.parseInt(previewSizeValueString2.substring(0, separatorPosition));
+ int previewSizeValueHeight = Integer.parseInt(previewSizeValueString2.substring(separatorPosition + 1));
+ int difference = Math.abs(previewSizeValueWidth - screenWidth) + Math.abs(previewSizeValueHeight - screenHeight);
+ if (difference == 0) {
+ bestPreviewWidth = previewSizeValueWidth;
+ bestPreviewHeight = previewSizeValueHeight;
+ break;
+ } else if (difference < minDifference) {
+ bestPreviewWidth = previewSizeValueWidth;
+ bestPreviewHeight = previewSizeValueHeight;
+ minDifference = difference;
+ }
+ } catch (NumberFormatException e) {
+ }
+ }
+ }
+ if (bestPreviewWidth <= 0 || bestPreviewHeight <= 0) {
+ return null;
+ }
+ Log.e(TAG,"bestPreviewWidth="+bestPreviewWidth+",bestPreviewHeight="+bestPreviewHeight);
+ return new Point(bestPreviewWidth, bestPreviewHeight);
+ }
+
+ private void setZoom(Parameters parameters) {
+ String zoomSupportedString = parameters.get("zoom-supported");
+ if (zoomSupportedString == null || Boolean.parseBoolean(zoomSupportedString)) {
+ int maxZoomX10;
+ int desiredZoomX10 = DESIRED_ZOOM_X10;
+ String maxZoomString = parameters.get("max-zoom");
+ if (maxZoomString != null) {
+ try {
+ maxZoomX10 = (int) (10.0d * Double.parseDouble(maxZoomString));
+ if (DESIRED_ZOOM_X10 > maxZoomX10) {
+ desiredZoomX10 = maxZoomX10;
+ }
+ } catch (NumberFormatException e) {
+ }
+ }
+ String takingPictureZoomMaxString = parameters.get("taking-picture-zoom-max");
+ if (takingPictureZoomMaxString != null) {
+ try {
+ maxZoomX10 = Integer.parseInt(takingPictureZoomMaxString);
+ if (desiredZoomX10 > maxZoomX10) {
+ desiredZoomX10 = maxZoomX10;
+ }
+ } catch (NumberFormatException e2) {
+ }
+ }
+ String motZoomValuesString = parameters.get("mot-zoom-values");
+ if (motZoomValuesString != null) {
+ desiredZoomX10 = findBestMotZoomX10(motZoomValuesString, desiredZoomX10);
+ }
+ String motZoomStepString = parameters.get("mot-zoom-step");
+ if (motZoomStepString != null) {
+ try {
+ int motZoomStepX10 = (int) (10.0d * Double.parseDouble(motZoomStepString.trim()));
+ if (motZoomStepX10 > 1) {
+ desiredZoomX10 -= desiredZoomX10 % motZoomStepX10;
+ }
+ } catch (NumberFormatException e3) {
+ }
+ }
+ if (!(maxZoomString == null && motZoomValuesString == null)) {
+ parameters.set("zoom", String.valueOf(((double) desiredZoomX10) / 10.0d));
+ }
+ if (takingPictureZoomMaxString != null) {
+ parameters.set("taking-picture-zoom", desiredZoomX10);
+ }
+ }
+ }
+
+ private static int findBestMotZoomX10(CharSequence motZoomValuesString, int desiredZoomX10) {
+ int bestMotZoomX10 = 0;
+ String[] split = COMMA_PATTERN.split(motZoomValuesString);
+ int length = split.length;
+ int i = 0;
+ while (i < length) {
+ try {
+ int motZoomValueX10 = (int) (10.0d * Double.parseDouble(split[i].trim()));
+ if (Math.abs(desiredZoomX10 - motZoomValueX10) < Math.abs(desiredZoomX10 - bestMotZoomX10)) {
+ bestMotZoomX10 = motZoomValueX10;
+ }
+ i++;
+ } catch (NumberFormatException e) {
+ return desiredZoomX10;
+ }
+ }
+ return bestMotZoomX10;
+ }
+ /*private void setCameraParameters(int screenWidth, int screenHeight) {
+ Parameters parameters = this.mCamera.getParameters();
+ setPreviewSize(screenWidth, screenHeight, parameters);
+ parameters.set("flash-mode", "off");
+ parameters.set("flash-value", 2);
+ setZoom(parameters);
+ int apiLevel = Integer.parseInt(VERSION.SDK);
+ if (apiLevel <= 3) {
+ this.mHasCameraAutoFocus = true;
+ } else if (apiLevel >= 5) {
+ String focusModeValues = parameters.get("focus-mode-values");
+ if (focusModeValues != null && focusModeValues.contains("macro")) {
+ parameters.set("focus-mode", "macro");
+ this.mHasCameraAutoFocus = true;
+ } else if (focusModeValues == null || !focusModeValues.contains("auto")) {
+ this.mHasCameraAutoFocus = false;
+ } else {
+ parameters.set("focus-mode", "auto");
+ this.mHasCameraAutoFocus = true;
+ }
+ } else {
+ String model = Build.MODEL.toLowerCase();
+ if (model.contains("devour") || model.contains("tattoo")) {
+ this.mHasCameraAutoFocus = false;
+ } else {
+ this.mHasCameraAutoFocus = true;
+ }
+ }
+ this.mCamera.setParameters(parameters);
+ this.mPreviewSize = parameters.getPreviewSize();
+ }
+
+ private void setPreviewSize(int screenWidth, int screenHeight, Parameters parameters) {
+ String previewSizeValuesString = parameters.get("preview-size-values");
+ if (previewSizeValuesString == null) {
+ previewSizeValuesString = parameters.get("preview-size-value");
+ }
+ Point bestPreviewSize = null;
+ if (previewSizeValuesString != null) {
+ bestPreviewSize = findBestPreviewSize(previewSizeValuesString, screenWidth, screenHeight);
+ }
+ if (bestPreviewSize != null) {
+ parameters.setPreviewSize(bestPreviewSize.x, bestPreviewSize.y);
+ } else {
+ parameters.setPreviewSize((screenWidth >> 3) << 3, (screenHeight >> 3) << 3);
+ }
+ }
+
+ private static Point findBestPreviewSize(CharSequence previewSizeValuesString, int screenWidth, int screenHeight) {
+ int bestPreviewWidth = 0;
+ int bestPreviewHeight = 0;
+ int minDifference = Integer.MAX_VALUE;
+ for (String previewSizeValueString : COMMA_PATTERN.split(previewSizeValuesString)) {
+ String previewSizeValueString2 = previewSizeValueString.trim();
+ int separatorPosition = previewSizeValueString2.indexOf(120);
+ if (separatorPosition >= 0) {
+ try {
+ int previewSizeValueWidth = Integer.parseInt(previewSizeValueString2.substring(0, separatorPosition));
+ int previewSizeValueHeight = Integer.parseInt(previewSizeValueString2.substring(separatorPosition + 1));
+ int difference = Math.abs(previewSizeValueWidth - screenWidth) + Math.abs(previewSizeValueHeight - screenHeight);
+ if (difference == 0) {
+ bestPreviewWidth = previewSizeValueWidth;
+ bestPreviewHeight = previewSizeValueHeight;
+ break;
+ } else if (difference < minDifference) {
+ bestPreviewWidth = previewSizeValueWidth;
+ bestPreviewHeight = previewSizeValueHeight;
+ minDifference = difference;
+ }
+ } catch (NumberFormatException e) {
+ }
+ }
+ }
+ if (bestPreviewWidth <= 0 || bestPreviewHeight <= 0) {
+ return null;
+ }
+ return new Point(bestPreviewWidth, bestPreviewHeight);
+ }
+
+ private void setZoom(Parameters parameters) {
+ String zoomSupportedString = parameters.get("zoom-supported");
+ if (zoomSupportedString == null || Boolean.parseBoolean(zoomSupportedString)) {
+ int maxZoomX10;
+ int desiredZoomX10 = DESIRED_ZOOM_X10;
+ String maxZoomString = parameters.get("max-zoom");
+ if (maxZoomString != null) {
+ try {
+ maxZoomX10 = (int) (10.0d * Double.parseDouble(maxZoomString));
+ if (DESIRED_ZOOM_X10 > maxZoomX10) {
+ desiredZoomX10 = maxZoomX10;
+ }
+ } catch (NumberFormatException e) {
+ }
+ }
+ String takingPictureZoomMaxString = parameters.get("taking-picture-zoom-max");
+ if (takingPictureZoomMaxString != null) {
+ try {
+ maxZoomX10 = Integer.parseInt(takingPictureZoomMaxString);
+ if (desiredZoomX10 > maxZoomX10) {
+ desiredZoomX10 = maxZoomX10;
+ }
+ } catch (NumberFormatException e2) {
+ }
+ }
+ String motZoomValuesString = parameters.get("mot-zoom-values");
+ if (motZoomValuesString != null) {
+ desiredZoomX10 = findBestMotZoomX10(motZoomValuesString, desiredZoomX10);
+ }
+ String motZoomStepString = parameters.get("mot-zoom-step");
+ if (motZoomStepString != null) {
+ try {
+ int motZoomStepX10 = (int) (10.0d * Double.parseDouble(motZoomStepString.trim()));
+ if (motZoomStepX10 > 1) {
+ desiredZoomX10 -= desiredZoomX10 % motZoomStepX10;
+ }
+ } catch (NumberFormatException e3) {
+ }
+ }
+ if (!(maxZoomString == null && motZoomValuesString == null)) {
+ parameters.set("zoom", String.valueOf(((double) desiredZoomX10) / 10.0d));
+ }
+ if (takingPictureZoomMaxString != null) {
+ parameters.set("taking-picture-zoom", desiredZoomX10);
+ }
+ }
+ }
+
+ private static int findBestMotZoomX10(CharSequence motZoomValuesString, int desiredZoomX10) {
+ int bestMotZoomX10 = 0;
+ String[] split = COMMA_PATTERN.split(motZoomValuesString);
+ int length = split.length;
+ int i = 0;
+ while (i < length) {
+ try {
+ int motZoomValueX10 = (int) (10.0d * Double.parseDouble(split[i].trim()));
+ if (Math.abs(desiredZoomX10 - motZoomValueX10) < Math.abs(desiredZoomX10 - bestMotZoomX10)) {
+ bestMotZoomX10 = motZoomValueX10;
+ }
+ i++;
+ } catch (NumberFormatException e) {
+ return desiredZoomX10;
+ }
+ }
+ return bestMotZoomX10;
+ }*/
+
+ static {
+ TAG = ScannerLiveView.class.getSimpleName();
+ COMMA_PATTERN = Pattern.compile(",");
+ }
+}
diff --git a/app/src/main/java/com/visionsmarts/pic2shop/view/ScannerLiveViewLiner.java b/app/src/main/java/com/visionsmarts/pic2shop/view/ScannerLiveViewLiner.java
new file mode 100644
index 0000000..cb5c126
--- /dev/null
+++ b/app/src/main/java/com/visionsmarts/pic2shop/view/ScannerLiveViewLiner.java
@@ -0,0 +1,611 @@
+package com.visionsmarts.pic2shop.view;
+
+import android.annotation.TargetApi;
+import android.app.Activity;
+import android.content.Context;
+import android.graphics.ImageFormat;
+import android.graphics.Point;
+import android.hardware.Camera;
+import android.hardware.Camera.AutoFocusCallback;
+import android.hardware.Camera.CameraInfo;
+import android.hardware.Camera.Parameters;
+import android.hardware.Camera.PreviewCallback;
+import android.hardware.Camera.Size;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Message;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.SurfaceHolder;
+import android.view.SurfaceHolder.Callback;
+import android.view.SurfaceView;
+
+import com.supwisdom.conferencecheck.R;
+import com.supwisdom.util.Constants;
+import com.visionsmarts.VSBarcodeReader;
+import com.visionsmarts.VSBarcodeReader.DecoderValues;
+import com.visionsmarts.VSReaderQR;
+
+import java.io.IOException;
+import java.util.regex.Pattern;
+
+public class ScannerLiveViewLiner extends SurfaceView implements Callback {
+ private static final int BARCODE_TYPES_MASK = 7;
+ private static final Pattern COMMA_PATTERN;
+ private static final int DESIRED_ZOOM_X10 = 27;
+ private static final String TAG;
+ private AutoFocusCallback mAutoFocusCallback;
+ private volatile byte[] mCallbackBuffer;
+ private volatile Camera mCamera;
+ private volatile int mCameraDisplayOrientation;
+ private DecodingThread mDecodingThread;
+ volatile boolean mFoundBarcodeOrQRCode;
+ volatile byte[] mFrameData;
+ volatile boolean mFrameDataIsAutoFocusInProgress;
+ volatile boolean mHasCameraAutoFocus;
+ volatile boolean mIsAutoFocusInProgress;
+ volatile boolean mIsPreviewStarted;
+ Listener mListener;
+ private PreviewCallback mPreviewCallback;
+ private int mPreviewFrameSize;
+ volatile Size mPreviewSize;
+ final ScannerHandler mScannerHandler;
+ ScannerOverlay mScannerOverlay;
+
+ /* renamed from: com.visionsmarts.pic2shop.view.ScannerLiveViewLiner.1 */
+ class C01731 implements AutoFocusCallback {
+ C01731() {
+ }
+
+ public void onAutoFocus(boolean success, Camera camera) {
+ ScannerLiveViewLiner.this.mIsAutoFocusInProgress = false;
+ }
+ }
+
+ /* renamed from: com.visionsmarts.pic2shop.view.ScannerLiveViewLiner.2 */
+ class C01742 implements PreviewCallback {
+ C01742() {
+ }
+
+ public synchronized void onPreviewFrame(byte[] frameData, Camera camera) {
+ if (!(!ScannerLiveViewLiner.this.mIsPreviewStarted || ScannerLiveViewLiner.this.mDecodingThread == null || ScannerLiveViewLiner.this.mFoundBarcodeOrQRCode)) {
+ boolean shouldSendDecodeRequest = ScannerLiveViewLiner.this.mFrameData == null;
+ ScannerLiveViewLiner.this.mFrameData = frameData;
+ ScannerLiveViewLiner.this.mFrameDataIsAutoFocusInProgress = ScannerLiveViewLiner.this.mIsAutoFocusInProgress;
+ if (shouldSendDecodeRequest) {
+ ScannerLiveViewLiner.this.mDecodingThread.getHandler().obtainMessage(R.id.decode).sendToTarget();
+ }
+ }
+ }
+ }
+
+ private class DecodingThread extends Thread {
+ DecoderValues mBarcodeDecoderValues;
+ private Handler mHandler;
+ private int mNumberConsecutiveFailedDecodingSinceFocusEnded;
+ private byte[] mPreviewLine;
+ VSReaderQR.DecoderValues mQRDecoderValues;
+
+ /* renamed from: com.visionsmarts.pic2shop.view.ScannerLiveViewLiner.DecodingThread.1 */
+ class C01751 extends Handler {
+ C01751() {
+ }
+
+ public void handleMessage(Message message) {
+ switch (message.what) {
+ case R.id.decode:
+ if (ScannerLiveViewLiner.this.mIsPreviewStarted && !ScannerLiveViewLiner.this.mFoundBarcodeOrQRCode) {
+ DecodingThread.this.decode();
+ }
+ break;
+ case R.id.quit:
+ Looper.myLooper().quit();
+ break;
+ default:
+ }
+ }
+ }
+
+ public DecodingThread() {
+ this.mNumberConsecutiveFailedDecodingSinceFocusEnded = 0;
+ this.mBarcodeDecoderValues = new DecoderValues();
+ this.mQRDecoderValues = new VSReaderQR.DecoderValues();
+ setPriority(10);
+ initialize();
+ }
+
+ synchronized Handler getHandler() {
+ if (this.mHandler == null) {
+ try {
+ ScannerLiveViewLiner.this.mDecodingThread.wait(1000);
+ } catch (InterruptedException e) {
+ }
+ }
+ return this.mHandler;
+ }
+
+ public void initialize() {
+ if (ScannerLiveViewLiner.this.mPreviewSize != null && (this.mPreviewLine == null || this.mPreviewLine.length != ScannerLiveViewLiner.this.mPreviewSize.height)) {
+ this.mPreviewLine = new byte[ScannerLiveViewLiner.this.mPreviewSize.height];
+ }
+ this.mNumberConsecutiveFailedDecodingSinceFocusEnded = 0;
+ ScannerLiveViewLiner.this.mFoundBarcodeOrQRCode = false;
+ VSBarcodeReader.reset();
+ }
+
+ public void run() {
+ Looper.prepare();
+ synchronized (this) {
+ this.mHandler = new C01751();
+ notify();
+ }
+ Looper.loop();
+ }
+
+ @TargetApi(8)
+ private void decode() {
+ byte[] previewLine = this.mPreviewLine;
+ int width = ScannerLiveViewLiner.this.mPreviewSize.width;
+ int height = ScannerLiveViewLiner.this.mPreviewSize.height;
+ synchronized (ScannerLiveViewLiner.this.mPreviewCallback) {
+ if (ScannerLiveViewLiner.this.mFrameData == null) {
+ return;
+ }
+ byte[] frameData = ScannerLiveViewLiner.this.mFrameData;
+ boolean wasAutoFocusInProgress = ScannerLiveViewLiner.this.mFrameDataIsAutoFocusInProgress;
+ int offset = Math.round(ScannerLiveViewLiner.this.mScannerOverlay.getNormalizedLaserLinePosition() * ((float) width));
+ Log.e(TAG,"offset="+offset);
+ int i = previewLine.length - 1;
+ while (i >= 0) {
+ try {
+ previewLine[i] = frameData[offset];
+ offset += width;
+ i--;
+ } catch (ArrayIndexOutOfBoundsException e) {
+ throw new ArrayIndexOutOfBoundsException(e.getMessage() + "; width=" + width + "; height=" + height + "; previewLine.length=" + previewLine.length + "; initOffset=" + Math.round(ScannerLiveViewLiner.this.mScannerOverlay.getNormalizedLaserLinePosition() * ((float) width)));
+ }
+ }
+ if (ScannerLiveViewLiner.this.mFrameData != null) {
+ String barcode = VSBarcodeReader.decodeNextImage(previewLine, ScannerLiveViewLiner.this.mHasCameraAutoFocus ? 1 : 0, ScannerLiveViewLiner.BARCODE_TYPES_MASK, this.mBarcodeDecoderValues);
+ if (ScannerLiveViewLiner.this.mFrameData != null) {
+ if (this.mBarcodeDecoderValues.left >= 0) {
+ int left = this.mBarcodeDecoderValues.left;
+ int right = this.mBarcodeDecoderValues.right;
+ float lineLength = (float) previewLine.length;
+ if (ScannerLiveViewLiner.this.mCameraDisplayOrientation == 180) {
+ ScannerLiveViewLiner.this.mScannerOverlay.setNormalizedBarcodeLocation(((float) (height - right)) / lineLength, ((float) (height - left)) / lineLength);
+ } else {
+ ScannerLiveViewLiner.this.mScannerOverlay.setNormalizedBarcodeLocation(((float) left) / lineLength, ((float) right) / lineLength);
+ }
+ } else {
+ ScannerLiveViewLiner.this.mScannerOverlay.setNoBarcodeLocation();
+ }
+ if (barcode.length() > 0) {
+ ScannerLiveViewLiner.this.mFoundBarcodeOrQRCode = true;
+ ScannerLiveViewLiner.this.mScannerHandler.obtainMessage(R.id.msg_barcode_found, barcode).sendToTarget();
+ } else {
+ byte[] qrData = VSReaderQR.decodeImage(frameData, width, height, this.mQRDecoderValues);
+ if (qrData.length > 0) {
+ ScannerLiveViewLiner.this.mFoundBarcodeOrQRCode = true;
+ ScannerLiveViewLiner.this.mScannerHandler.obtainMessage(R.id.msg_qr_code_found, qrData).sendToTarget();
+ } else if (wasAutoFocusInProgress) {
+ this.mNumberConsecutiveFailedDecodingSinceFocusEnded = 0;
+ } else {
+ this.mNumberConsecutiveFailedDecodingSinceFocusEnded++;
+ if (ScannerLiveViewLiner.this.mHasCameraAutoFocus && !ScannerLiveViewLiner.this.mIsAutoFocusInProgress && this.mNumberConsecutiveFailedDecodingSinceFocusEnded >= 4) {
+ ScannerLiveViewLiner.this.mScannerHandler.obtainMessage(R.id.auto_focus).sendToTarget();
+ }
+ }
+ }
+ synchronized (ScannerLiveViewLiner.this.mPreviewCallback) {
+ ScannerLiveViewLiner.this.mFrameData = null;
+ if (!(ScannerLiveViewLiner.this.mFoundBarcodeOrQRCode || ScannerLiveViewLiner.this.mCallbackBuffer == null)) {
+ ScannerLiveViewLiner.this.mCamera.addCallbackBuffer(ScannerLiveViewLiner.this.mCallbackBuffer);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public interface Listener {
+ void onCameraIssue();
+
+ void onCodeScanned(String str, String str2);
+ }
+
+ private class ScannerHandler extends Handler {
+ private ScannerHandler() {
+ }
+
+ public void handleMessage(Message message) {
+ switch (message.what) {
+ case R.id.auto_focus:
+ ScannerLiveViewLiner.this.requestAutoFocus();
+ break;
+ case R.id.msg_barcode_found:
+ if (ScannerLiveViewLiner.this.mIsPreviewStarted) {
+ ScannerLiveViewLiner.this.stopCamera();
+ ScannerLiveViewLiner.this.mListener.onCodeScanned(null, (String)message.obj);
+ }
+ break;
+ case R.id.msg_qr_code_found:
+ if (ScannerLiveViewLiner.this.mIsPreviewStarted) {
+ ScannerLiveViewLiner.this.stopCamera();
+ ScannerLiveViewLiner.this.mListener.onCodeScanned(Constants.CALLBACK_URL_QR_PARAM, BarQrCodeUtil.qrToString((byte[])message.obj));
+ }
+ break;
+ default:
+ }
+ }
+ }
+
+ public ScannerLiveViewLiner(Context context) {
+ super(context);
+ this.mPreviewFrameSize = 0;
+ this.mScannerHandler = new ScannerHandler();
+ this.mIsPreviewStarted = false;
+ this.mIsAutoFocusInProgress = false;
+ this.mFrameData = null;
+ this.mFrameDataIsAutoFocusInProgress = false;
+ this.mFoundBarcodeOrQRCode = false;
+ initialize(context);
+ }
+
+ public ScannerLiveViewLiner(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ this.mPreviewFrameSize = 0;
+ this.mScannerHandler = new ScannerHandler();
+ this.mIsPreviewStarted = false;
+ this.mIsAutoFocusInProgress = false;
+ this.mFrameData = null;
+ this.mFrameDataIsAutoFocusInProgress = false;
+ this.mFoundBarcodeOrQRCode = false;
+ initialize(context);
+ }
+
+ public ScannerLiveViewLiner(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ this.mPreviewFrameSize = 0;
+ this.mScannerHandler = new ScannerHandler();
+ this.mIsPreviewStarted = false;
+ this.mIsAutoFocusInProgress = false;
+ this.mFrameData = null;
+ this.mFrameDataIsAutoFocusInProgress = false;
+ this.mFoundBarcodeOrQRCode = false;
+ initialize(context);
+ }
+
+ private void initialize(Context context) {
+ this.mListener = (Listener) context;
+ SurfaceHolder holder = getHolder();
+ holder.addCallback(this);
+ holder.setType(3);
+ holder.setKeepScreenOn(true);
+ this.mAutoFocusCallback = new C01731();
+ this.mPreviewCallback = new C01742();
+ }
+
+ @TargetApi(9)
+ public void surfaceCreated(SurfaceHolder holder) {
+ if (holder == null) {
+ throw new IllegalStateException("No SurfaceHolder provided");
+ } else if (this.mCamera == null) {
+ try {
+ this.mCamera = null;
+ try {
+ CameraInfo cameraInfo = new CameraInfo();
+ int cameraCount = Camera.getNumberOfCameras();
+ for (int camIdx = 0; camIdx < cameraCount; camIdx++) {
+ Camera.getCameraInfo(camIdx, cameraInfo);
+ if (cameraInfo.facing == 0) {
+ this.mCamera = Camera.open(camIdx);
+ setCameraDisplayOrientation(camIdx);
+ break;
+ }
+ }
+ } catch (LinkageError e) {
+ }
+ if (this.mCamera == null) {
+ try {
+ this.mCamera = Camera.open(0);
+ setCameraDisplayOrientation(0);
+ } catch (LinkageError e2) {
+ }
+ }
+ if (this.mCamera == null) {
+ this.mCamera = Camera.open();
+ }
+ this.mCamera.setPreviewDisplay(holder);
+ this.mIsPreviewStarted = false;
+ } catch (IOException e3) {
+ this.mListener.onCameraIssue();
+ } catch (RuntimeException e4) {
+ this.mListener.onCameraIssue();
+ }
+ }
+ }
+
+ public void surfaceDestroyed(SurfaceHolder holder) {
+ if (this.mCamera != null) {
+ stopCamera();
+ this.mPreviewFrameSize = 0;
+ }
+ }
+
+ public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
+ if (this.mCamera != null) {
+ stopCamera();
+ setCameraParameters(width, height);
+ if (isShown()) {
+ startCamera();
+ }
+ }
+ }
+
+ public void onPause() {
+ stopCamera();
+ if (this.mCamera != null) {
+ this.mCamera.release();
+ this.mCamera = null;
+ }
+ Message.obtain(this.mDecodingThread.getHandler(), R.id.quit).sendToTarget();
+ try {
+ this.mDecodingThread.join();
+ } catch (InterruptedException e) {
+ }
+ this.mScannerHandler.removeMessages(R.id.auto_focus);
+ this.mScannerHandler.removeMessages(R.id.msg_barcode_found);
+ this.mScannerHandler.removeMessages(R.id.msg_qr_code_found);
+ this.mDecodingThread = null;
+ }
+
+ public void onResume() {
+ this.mScannerOverlay = (ScannerOverlay) ((Activity) getContext()).findViewById(R.id.scanner_overlay);
+ this.mScannerOverlay.setNoBarcodeLocation();
+ this.mDecodingThread = new DecodingThread();
+ this.mDecodingThread.start();
+ startCamera();
+ }
+
+ @TargetApi(8)
+ public void startCamera() {
+ if (this.mCamera != null && !this.mIsPreviewStarted) {
+ this.mIsAutoFocusInProgress = false;
+ this.mFrameData = null;
+ if (this.mDecodingThread != null) {
+ this.mDecodingThread.initialize();
+ }
+ if (this.mScannerOverlay != null) {
+ this.mScannerOverlay.setNoBarcodeLocation();
+ }
+ if (this.mPreviewFrameSize > 0) {
+ try {
+ this.mCallbackBuffer = new byte[this.mPreviewFrameSize];
+ } catch (OutOfMemoryError e) {
+ this.mCallbackBuffer = null;
+ }
+ }
+ if (this.mCallbackBuffer != null) {
+ this.mCamera.setPreviewCallbackWithBuffer(this.mPreviewCallback);
+ this.mCamera.addCallbackBuffer(this.mCallbackBuffer);
+ } else {
+ this.mCamera.setPreviewCallback(this.mPreviewCallback);
+ }
+ try {
+ this.mCamera.startPreview();
+ this.mIsPreviewStarted = true;
+ requestAutoFocus();
+ } catch (RuntimeException e2) {
+ this.mCamera.setPreviewCallback(null);
+ this.mCallbackBuffer = null;
+ this.mListener.onCameraIssue();
+ }
+ }
+ }
+
+ public void stopCamera() {
+ if (this.mCamera != null && this.mIsPreviewStarted) {
+ synchronized (this.mPreviewCallback) {
+ this.mCamera.setPreviewCallback(null);
+ this.mCamera.stopPreview();
+ this.mIsPreviewStarted = false;
+ this.mCamera.cancelAutoFocus();
+ this.mFrameData = null;
+ this.mCallbackBuffer = null;
+ }
+ if (!(this.mDecodingThread == null || this.mDecodingThread.getHandler() == null)) {
+ this.mDecodingThread.getHandler().removeMessages(R.id.decode);
+ }
+ this.mScannerHandler.removeMessages(R.id.auto_focus);
+ this.mScannerHandler.removeMessages(R.id.msg_barcode_found);
+ this.mScannerHandler.removeMessages(R.id.msg_qr_code_found);
+ }
+ }
+
+ void requestAutoFocus() {
+ if (this.mCamera != null && this.mHasCameraAutoFocus && this.mIsPreviewStarted && !this.mIsAutoFocusInProgress) {
+ try {
+ this.mCamera.autoFocus(this.mAutoFocusCallback);
+ this.mIsAutoFocusInProgress = true;
+ } catch (RuntimeException e) {
+ Log.e(TAG, "Camera auto-focus failed: " + e.getLocalizedMessage());
+ }
+ }
+ }
+
+ @TargetApi(9)
+ public void setCameraDisplayOrientation(int cameraId) {
+ CameraInfo info = new CameraInfo();
+ Camera.getCameraInfo(cameraId, info);
+ int degrees = 0;
+ switch (((Activity) getContext()).getWindowManager().getDefaultDisplay().getRotation()) {
+ case 0 /*0*/:
+ degrees = 0;
+ break;
+ case 1 /*1*/:
+ degrees = 90;
+ break;
+ case 2 /*2*/:
+ degrees = 180;
+ break;
+ case 3 /*3*/:
+ degrees = 270;
+ break;
+ }
+ if (info.facing == 1) {
+ this.mCameraDisplayOrientation = (info.orientation + degrees) % 360;
+ this.mCameraDisplayOrientation = (360 - this.mCameraDisplayOrientation) % 360;
+ } else {
+ this.mCameraDisplayOrientation = ((info.orientation - degrees) + 360) % 360;
+ }
+ this.mCamera.setDisplayOrientation(this.mCameraDisplayOrientation);
+ }
+
+ @TargetApi(8)
+ private void setCameraParameters(int screenWidth, int screenHeight) {
+ Log.e(TAG,"screenWidth="+screenWidth+",screenHeight="+screenHeight);
+ Parameters parameters = this.mCamera.getParameters();
+ setPreviewSize(screenWidth, screenHeight, parameters);
+ setZoom(parameters);
+ String focusModeValues = parameters.get("focus-mode-values");
+ if (focusModeValues != null && focusModeValues.contains("macro")) {
+ parameters.set("focus-mode", "macro");
+ this.mHasCameraAutoFocus = true;
+ } else if (focusModeValues == null || !focusModeValues.contains("auto")) {
+ this.mHasCameraAutoFocus = false;
+ } else {
+ parameters.set("focus-mode", "auto");
+ this.mHasCameraAutoFocus = true;
+ }
+ try {
+ this.mCamera.setParameters(parameters);
+ } catch (RuntimeException e) {
+ this.mListener.onCameraIssue();
+ }
+ parameters = this.mCamera.getParameters();
+ this.mPreviewSize = parameters.getPreviewSize();
+ this.mPreviewFrameSize = ((this.mPreviewSize.width * this.mPreviewSize.height) * ImageFormat.getBitsPerPixel(parameters.getPreviewFormat())) / 8;
+ }
+
+ private void setPreviewSize(int screenWidth, int screenHeight, Parameters parameters) {
+ String previewSizeValuesString = parameters.get("preview-size-values");
+ if (previewSizeValuesString == null) {
+ previewSizeValuesString = parameters.get("preview-size-value");
+ }
+ Point bestPreviewSize = null;
+ if (previewSizeValuesString != null) {
+ bestPreviewSize = findBestPreviewSize(previewSizeValuesString, screenWidth, screenHeight);
+ }
+ if (bestPreviewSize != null) {
+ parameters.setPreviewSize(bestPreviewSize.x, bestPreviewSize.y);
+ } else {
+ parameters.setPreviewSize((screenWidth >> 4) << 4, (screenHeight >> 1) << 1);
+ }
+ }
+
+ private static Point findBestPreviewSize(CharSequence previewSizeValuesString, int screenWidth, int screenHeight) {
+ int bestPreviewWidth = 0;
+ int bestPreviewHeight = 0;
+ int minDifference = Integer.MAX_VALUE;
+ for (String previewSizeValueString : COMMA_PATTERN.split(previewSizeValuesString)) {
+ String previewSizeValueString2 = previewSizeValueString.trim();
+ int separatorPosition = previewSizeValueString2.indexOf(120);
+ if (separatorPosition >= 0) {
+ try {
+ int previewSizeValueWidth = Integer.parseInt(previewSizeValueString2.substring(0, separatorPosition));
+ int previewSizeValueHeight = Integer.parseInt(previewSizeValueString2.substring(separatorPosition + 1));
+ int difference = Math.abs(previewSizeValueWidth - screenWidth) + Math.abs(previewSizeValueHeight - screenHeight);
+ if (difference == 0) {
+ bestPreviewWidth = previewSizeValueWidth;
+ bestPreviewHeight = previewSizeValueHeight;
+ break;
+ } else if (difference < minDifference) {
+ bestPreviewWidth = previewSizeValueWidth;
+ bestPreviewHeight = previewSizeValueHeight;
+ minDifference = difference;
+ }
+ } catch (NumberFormatException e) {
+ }
+ }
+ }
+ if (bestPreviewWidth <= 0 || bestPreviewHeight <= 0) {
+ return null;
+ }
+ Log.e(TAG,"bestPreviewWidth="+bestPreviewWidth+",bestPreviewHeight="+bestPreviewHeight);
+ return new Point(bestPreviewWidth, bestPreviewHeight);
+ }
+
+ private void setZoom(Parameters parameters) {
+ String zoomSupportedString = parameters.get("zoom-supported");
+ if (zoomSupportedString == null || Boolean.parseBoolean(zoomSupportedString)) {
+ int maxZoomX10;
+ int desiredZoomX10 = DESIRED_ZOOM_X10;
+ String maxZoomString = parameters.get("max-zoom");
+ if (maxZoomString != null) {
+ try {
+ maxZoomX10 = (int) (10.0d * Double.parseDouble(maxZoomString));
+ if (DESIRED_ZOOM_X10 > maxZoomX10) {
+ desiredZoomX10 = maxZoomX10;
+ }
+ } catch (NumberFormatException e) {
+ }
+ }
+ String takingPictureZoomMaxString = parameters.get("taking-picture-zoom-max");
+ if (takingPictureZoomMaxString != null) {
+ try {
+ maxZoomX10 = Integer.parseInt(takingPictureZoomMaxString);
+ if (desiredZoomX10 > maxZoomX10) {
+ desiredZoomX10 = maxZoomX10;
+ }
+ } catch (NumberFormatException e2) {
+ }
+ }
+ String motZoomValuesString = parameters.get("mot-zoom-values");
+ if (motZoomValuesString != null) {
+ desiredZoomX10 = findBestMotZoomX10(motZoomValuesString, desiredZoomX10);
+ }
+ String motZoomStepString = parameters.get("mot-zoom-step");
+ if (motZoomStepString != null) {
+ try {
+ int motZoomStepX10 = (int) (10.0d * Double.parseDouble(motZoomStepString.trim()));
+ if (motZoomStepX10 > 1) {
+ desiredZoomX10 -= desiredZoomX10 % motZoomStepX10;
+ }
+ } catch (NumberFormatException e3) {
+ }
+ }
+ if (!(maxZoomString == null && motZoomValuesString == null)) {
+ parameters.set("zoom", String.valueOf(((double) desiredZoomX10) / 10.0d));
+ }
+ if (takingPictureZoomMaxString != null) {
+ parameters.set("taking-picture-zoom", desiredZoomX10);
+ }
+ }
+ }
+
+ private static int findBestMotZoomX10(CharSequence motZoomValuesString, int desiredZoomX10) {
+ int bestMotZoomX10 = 0;
+ String[] split = COMMA_PATTERN.split(motZoomValuesString);
+ int length = split.length;
+ int i = 0;
+ while (i < length) {
+ try {
+ int motZoomValueX10 = (int) (10.0d * Double.parseDouble(split[i].trim()));
+ if (Math.abs(desiredZoomX10 - motZoomValueX10) < Math.abs(desiredZoomX10 - bestMotZoomX10)) {
+ bestMotZoomX10 = motZoomValueX10;
+ }
+ i++;
+ } catch (NumberFormatException e) {
+ return desiredZoomX10;
+ }
+ }
+ return bestMotZoomX10;
+ }
+
+ static {
+ TAG = ScannerLiveViewLiner.class.getSimpleName();
+ COMMA_PATTERN = Pattern.compile(",");
+ }
+}
diff --git a/app/src/main/java/com/visionsmarts/pic2shop/view/ScannerOverlay.java b/app/src/main/java/com/visionsmarts/pic2shop/view/ScannerOverlay.java
new file mode 100644
index 0000000..f4345ab
--- /dev/null
+++ b/app/src/main/java/com/visionsmarts/pic2shop/view/ScannerOverlay.java
@@ -0,0 +1,126 @@
+package com.visionsmarts.pic2shop.view;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.graphics.Paint.Align;
+import android.graphics.Paint.Style;
+import android.graphics.Point;
+import android.graphics.Rect;
+import android.graphics.Typeface;
+import android.text.Layout.Alignment;
+import android.text.StaticLayout;
+import android.text.TextPaint;
+import android.util.AttributeSet;
+import android.view.Display;
+import android.view.View;
+import android.view.WindowManager;
+
+import com.supwisdom.conferencecheck.R;
+
+public class ScannerOverlay extends View {
+ private static final float LASER_LINE_WIDTH_160_DPI = 7.0f;
+ private static final float TEXT_FONT_SIZE = 20.0f;
+ private Paint mBarcodeLinePaint;
+ private Rect mBarcodeLineRect;
+ private Rect mCanvasClipRect;
+ private Paint mLaserLinePaint;
+ private int mLaserLinePosition;
+ private Rect mLaserLineRect;
+ private float mScreenDensity;
+ private Point mScreenResolution;
+ private Paint mTextBackgroundPaint;
+ private StaticLayout mTextLayout;
+
+ public ScannerOverlay(Context context) {
+ super(context);
+ this.mCanvasClipRect = new Rect();
+ this.mLaserLineRect = new Rect();
+ this.mBarcodeLineRect = new Rect(-1, -1, -1, -1);
+ initialize(context);
+ }
+
+ public ScannerOverlay(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ this.mCanvasClipRect = new Rect();
+ this.mLaserLineRect = new Rect();
+ this.mBarcodeLineRect = new Rect(-1, -1, -1, -1);
+ initialize(context);
+ }
+
+ public ScannerOverlay(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ this.mCanvasClipRect = new Rect();
+ this.mLaserLineRect = new Rect();
+ this.mBarcodeLineRect = new Rect(-1, -1, -1, -1);
+ initialize(context);
+ }
+
+ private void initialize(Context context) {
+ this.mTextBackgroundPaint = new Paint();
+ this.mTextBackgroundPaint.setStyle(Style.FILL);
+ this.mTextBackgroundPaint.setColor(Color.GREEN);
+ this.mTextBackgroundPaint.setAlpha(204);
+ TextPaint textPaint = new TextPaint();
+ textPaint.setStyle(Style.FILL);
+ textPaint.setStrokeWidth(1.0f);
+ textPaint.setColor(-1);
+ textPaint.setAlpha(204);
+ textPaint.setAntiAlias(true);
+ textPaint.setTypeface(Typeface.DEFAULT_BOLD);
+ textPaint.setTextSize(TEXT_FONT_SIZE * context.getResources().getDisplayMetrics().scaledDensity);
+ textPaint.setTextAlign(Align.CENTER);
+ this.mTextLayout = new StaticLayout(getContext().getString(R.string.scan_text), textPaint, context.getResources().getDisplayMetrics().heightPixels, Alignment.ALIGN_NORMAL, 1.0f, 0.0f, true);
+ this.mLaserLinePaint = new Paint();
+ this.mLaserLinePaint.setStyle(Style.FILL);
+ this.mLaserLinePaint.setColor(-65536);
+ this.mLaserLinePaint.setAlpha(255);
+ this.mBarcodeLinePaint = new Paint();
+ this.mBarcodeLinePaint.setStyle(Style.FILL);
+ this.mBarcodeLinePaint.setColor(-16711936);
+ this.mBarcodeLinePaint.setAlpha(255);
+ Display display = ((WindowManager) context.getSystemService("window")).getDefaultDisplay();
+ this.mScreenResolution = new Point(display.getWidth(), display.getHeight());
+ this.mScreenDensity = getContext().getResources().getDisplayMetrics().density;
+ this.mLaserLinePosition = Math.round((float) (this.mScreenResolution.x / 2));
+ }
+
+ protected void onDraw(Canvas canvas) {
+ float center = ((float) canvas.getHeight()) / 2.0f;
+ canvas.rotate(-90.0f, center, center);
+ if (canvas.getClipBounds(this.mCanvasClipRect)) {
+ if (this.mCanvasClipRect.height() == canvas.getWidth()) {
+ canvas.drawRect(0.0f, (float) (this.mCanvasClipRect.bottom - this.mTextLayout.getHeight()), (float) this.mCanvasClipRect.right, (float) this.mCanvasClipRect.bottom, this.mTextBackgroundPaint);
+ canvas.save();
+ canvas.translate(this.mCanvasClipRect.exactCenterX(), (float) (this.mCanvasClipRect.bottom - this.mTextLayout.getHeight()));
+ this.mTextLayout.draw(canvas);
+ canvas.restore();
+ int lineWidth = Math.round(LASER_LINE_WIDTH_160_DPI * this.mScreenDensity);
+ this.mLaserLineRect.set(this.mCanvasClipRect.width() / 8, this.mLaserLinePosition - (lineWidth / 2), (this.mCanvasClipRect.width() * 7) / 8, this.mLaserLinePosition + ((lineWidth - 1) / 2));
+ this.mBarcodeLineRect.top = this.mLaserLineRect.top;
+ this.mBarcodeLineRect.bottom = this.mLaserLineRect.bottom;
+ }
+ canvas.drawRect(this.mLaserLineRect, this.mLaserLinePaint);
+ if (this.mBarcodeLineRect.left >= 0 && this.mBarcodeLineRect.right >= 0) {
+ canvas.drawRect(this.mBarcodeLineRect, this.mBarcodeLinePaint);
+ }
+ }
+ }
+
+ public float getNormalizedLaserLinePosition() {
+ return ((float) this.mLaserLinePosition) / ((float) this.mScreenResolution.x);
+ }
+
+ public void setNormalizedBarcodeLocation(float left, float right) {
+ this.mBarcodeLineRect.left = Math.round(((float) this.mScreenResolution.y) * left);
+ this.mBarcodeLineRect.right = Math.round(((float) this.mScreenResolution.y) * right);
+ postInvalidate(this.mLaserLineRect.top, 0, this.mLaserLineRect.bottom, this.mScreenResolution.y - 1);
+ }
+
+ public void setNoBarcodeLocation() {
+ this.mBarcodeLineRect.left = -1;
+ this.mBarcodeLineRect.right = -1;
+ postInvalidate(this.mLaserLineRect.top, 0, this.mLaserLineRect.bottom, this.mScreenResolution.y - 1);
+ }
+}
diff --git a/app/src/main/jniLibs/armeabi-v7a/libVSBarcodeReader.so b/app/src/main/jniLibs/armeabi-v7a/libVSBarcodeReader.so
new file mode 100644
index 0000000..aa3d33b
--- /dev/null
+++ b/app/src/main/jniLibs/armeabi-v7a/libVSBarcodeReader.so
Binary files differ
diff --git a/app/src/main/jniLibs/armeabi-v7a/libVSReaderQR.so b/app/src/main/jniLibs/armeabi-v7a/libVSReaderQR.so
new file mode 100644
index 0000000..f6cd34d
--- /dev/null
+++ b/app/src/main/jniLibs/armeabi-v7a/libVSReaderQR.so
Binary files differ
diff --git a/app/src/main/res/drawable-v24/bg_corner_all_dark.xml b/app/src/main/res/drawable-v24/bg_corner_all_dark.xml
new file mode 100644
index 0000000..ab104a1
--- /dev/null
+++ b/app/src/main/res/drawable-v24/bg_corner_all_dark.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="@color/black_1"/>
+ <corners android:bottomLeftRadius="10dp"
+ android:bottomRightRadius="10dp"
+ android:topLeftRadius="10dip"
+ android:topRightRadius="10dip"/>
+</shape>
\ No newline at end of file
diff --git a/app/src/main/res/drawable-v24/bg_corner_top_blue.xml b/app/src/main/res/drawable-v24/bg_corner_top_blue.xml
new file mode 100644
index 0000000..d63927f
--- /dev/null
+++ b/app/src/main/res/drawable-v24/bg_corner_top_blue.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="@color/main_blue2"/>
+ <corners
+ android:topLeftRadius="10dip"
+ android:topRightRadius="10dip"
+ android:bottomRightRadius="10dip"
+ android:bottomLeftRadius="10dip"/>
+</shape>
\ No newline at end of file
diff --git a/app/src/main/res/drawable-v24/corner_bg_red_normal.xml b/app/src/main/res/drawable-v24/corner_bg_red_normal.xml
new file mode 100644
index 0000000..353e167
--- /dev/null
+++ b/app/src/main/res/drawable-v24/corner_bg_red_normal.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="@color/top_bar_theme_blue" />
+ <corners android:radius="8dip" />
+ <stroke
+ android:width="1.0dip"
+ android:color="@color/top_bar_theme_blue" />
+</shape>
\ No newline at end of file
diff --git a/app/src/main/res/drawable/app_logo.png b/app/src/main/res/drawable/app_logo.png
new file mode 100644
index 0000000..b03cd66
--- /dev/null
+++ b/app/src/main/res/drawable/app_logo.png
Binary files differ
diff --git a/app/src/main/res/drawable/bg_all_darkred.xml b/app/src/main/res/drawable/bg_all_darkred.xml
new file mode 100644
index 0000000..5272a72
--- /dev/null
+++ b/app/src/main/res/drawable/bg_all_darkred.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="@color/dark_red"/>
+ <corners android:bottomLeftRadius="10dp"
+ android:bottomRightRadius="10dp"
+ android:topLeftRadius="10dip"
+ android:topRightRadius="10dip"/>
+</shape>
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_all_lightblue.xml b/app/src/main/res/drawable/bg_all_lightblue.xml
new file mode 100644
index 0000000..d7e0f0c
--- /dev/null
+++ b/app/src/main/res/drawable/bg_all_lightblue.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="@color/light_blue"/>
+ <corners android:bottomLeftRadius="10dp"
+ android:bottomRightRadius="10dp"
+ android:topLeftRadius="10dip"
+ android:topRightRadius="10dip"/>
+</shape>
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_all_lightblue2.xml b/app/src/main/res/drawable/bg_all_lightblue2.xml
new file mode 100644
index 0000000..ccd08be
--- /dev/null
+++ b/app/src/main/res/drawable/bg_all_lightblue2.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="@color/light_blue_2"/>
+ <corners android:bottomLeftRadius="10dp"
+ android:bottomRightRadius="10dp"
+ android:topLeftRadius="10dip"
+ android:topRightRadius="10dip"/>
+</shape>
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_all_lightred.xml b/app/src/main/res/drawable/bg_all_lightred.xml
new file mode 100644
index 0000000..fe16983
--- /dev/null
+++ b/app/src/main/res/drawable/bg_all_lightred.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="@color/light_red"/>
+ <corners android:bottomLeftRadius="10dp"
+ android:bottomRightRadius="10dp"
+ android:topLeftRadius="10dip"
+ android:topRightRadius="10dip"/>
+</shape>
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_left_lightblue2.xml b/app/src/main/res/drawable/bg_left_lightblue2.xml
new file mode 100644
index 0000000..b93065f
--- /dev/null
+++ b/app/src/main/res/drawable/bg_left_lightblue2.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="@color/light_blue_2"/>
+ <corners android:bottomLeftRadius="10dp"
+ android:topLeftRadius="10dip"/>
+</shape>
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_right_lightblue2.xml b/app/src/main/res/drawable/bg_right_lightblue2.xml
new file mode 100644
index 0000000..f6147f3
--- /dev/null
+++ b/app/src/main/res/drawable/bg_right_lightblue2.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="@color/light_blue_2"/>
+ <corners android:bottomRightRadius="10dp"
+ android:topRightRadius="10dip"/>
+</shape>
\ No newline at end of file
diff --git a/app/src/main/res/drawable/btn_red_click.png b/app/src/main/res/drawable/btn_red_click.png
new file mode 100644
index 0000000..580c410
--- /dev/null
+++ b/app/src/main/res/drawable/btn_red_click.png
Binary files differ
diff --git a/app/src/main/res/drawable/btn_red_normal.png b/app/src/main/res/drawable/btn_red_normal.png
new file mode 100644
index 0000000..f447037
--- /dev/null
+++ b/app/src/main/res/drawable/btn_red_normal.png
Binary files differ
diff --git a/app/src/main/res/drawable/capture.9.png b/app/src/main/res/drawable/capture.9.png
new file mode 100644
index 0000000..4cefb98
--- /dev/null
+++ b/app/src/main/res/drawable/capture.9.png
Binary files differ
diff --git a/app/src/main/res/drawable/corner_bg.xml b/app/src/main/res/drawable/corner_bg.xml
new file mode 100644
index 0000000..40c5b82
--- /dev/null
+++ b/app/src/main/res/drawable/corner_bg.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="#80ffffff" />
+ <corners android:radius="8dip" />
+ <stroke
+ android:width="1.0dip"
+ android:color="#ffc5c5c5" />
+</shape>
\ No newline at end of file
diff --git a/app/src/main/res/drawable/corner_bg_gray_focus.xml b/app/src/main/res/drawable/corner_bg_gray_focus.xml
new file mode 100644
index 0000000..a6c45eb
--- /dev/null
+++ b/app/src/main/res/drawable/corner_bg_gray_focus.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="@color/light_gray2" />
+ <corners android:radius="8dip" />
+ <stroke
+ android:width="1.0dip"
+ android:color="@color/light_gray2" />
+</shape>
diff --git a/app/src/main/res/drawable/corner_bg_keyboard_focus.xml b/app/src/main/res/drawable/corner_bg_keyboard_focus.xml
new file mode 100644
index 0000000..0f93672
--- /dev/null
+++ b/app/src/main/res/drawable/corner_bg_keyboard_focus.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="#807c7c"/>
+ <corners android:radius="12dip"/>
+ <stroke
+ android:width="1.0dip"
+ android:color="#807c7c"/>
+</shape>
\ No newline at end of file
diff --git a/app/src/main/res/drawable/corner_bg_keyboard_normal.xml b/app/src/main/res/drawable/corner_bg_keyboard_normal.xml
new file mode 100644
index 0000000..7732d4b
--- /dev/null
+++ b/app/src/main/res/drawable/corner_bg_keyboard_normal.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="#ffffff"/>
+ <corners android:radius="12dip"/>
+ <stroke
+ android:width="1.0dip"
+ android:color="#ffffff"/>
+</shape>
\ No newline at end of file
diff --git a/app/src/main/res/drawable/corner_bg_white.xml b/app/src/main/res/drawable/corner_bg_white.xml
new file mode 100644
index 0000000..48324a8
--- /dev/null
+++ b/app/src/main/res/drawable/corner_bg_white.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="@android:color/white" />
+ <corners android:radius="8dip" />
+ <stroke
+ android:width="1.0dip"
+ android:color="@android:color/white" />
+</shape>
\ No newline at end of file
diff --git a/app/src/main/res/drawable/corner_blue_left.xml b/app/src/main/res/drawable/corner_blue_left.xml
new file mode 100644
index 0000000..7370890
--- /dev/null
+++ b/app/src/main/res/drawable/corner_blue_left.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="@color/main_blue2"/>
+ <corners android:topLeftRadius="10dp"
+ android:bottomLeftRadius="10dp"/>
+</shape>
\ No newline at end of file
diff --git a/app/src/main/res/drawable/corner_blue_right.xml b/app/src/main/res/drawable/corner_blue_right.xml
new file mode 100644
index 0000000..f3b4af9
--- /dev/null
+++ b/app/src/main/res/drawable/corner_blue_right.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="@color/main_blue2"/>
+ <corners android:topRightRadius="10dp"
+ android:bottomRightRadius="10dp"/>
+</shape>
\ No newline at end of file
diff --git a/app/src/main/res/drawable/face_smile.jpg b/app/src/main/res/drawable/face_smile.jpg
new file mode 100644
index 0000000..5ab9972
--- /dev/null
+++ b/app/src/main/res/drawable/face_smile.jpg
Binary files differ
diff --git a/app/src/main/res/drawable/iconfont_back.png b/app/src/main/res/drawable/iconfont_back.png
new file mode 100644
index 0000000..0ba4b36
--- /dev/null
+++ b/app/src/main/res/drawable/iconfont_back.png
Binary files differ
diff --git a/app/src/main/res/drawable/order_btn_purchase.png b/app/src/main/res/drawable/order_btn_purchase.png
new file mode 100644
index 0000000..416af7b
--- /dev/null
+++ b/app/src/main/res/drawable/order_btn_purchase.png
Binary files differ
diff --git a/app/src/main/res/drawable/pass_delete_click.png b/app/src/main/res/drawable/pass_delete_click.png
new file mode 100644
index 0000000..d05207d
--- /dev/null
+++ b/app/src/main/res/drawable/pass_delete_click.png
Binary files differ
diff --git a/app/src/main/res/drawable/pass_delete_normal.png b/app/src/main/res/drawable/pass_delete_normal.png
new file mode 100644
index 0000000..b77fc91
--- /dev/null
+++ b/app/src/main/res/drawable/pass_delete_normal.png
Binary files differ
diff --git a/app/src/main/res/drawable/pass_eight_click.png b/app/src/main/res/drawable/pass_eight_click.png
new file mode 100644
index 0000000..c26ffd8
--- /dev/null
+++ b/app/src/main/res/drawable/pass_eight_click.png
Binary files differ
diff --git a/app/src/main/res/drawable/pass_eight_normal.png b/app/src/main/res/drawable/pass_eight_normal.png
new file mode 100644
index 0000000..9b2ece0
--- /dev/null
+++ b/app/src/main/res/drawable/pass_eight_normal.png
Binary files differ
diff --git a/app/src/main/res/drawable/pass_five_click.png b/app/src/main/res/drawable/pass_five_click.png
new file mode 100644
index 0000000..c555169
--- /dev/null
+++ b/app/src/main/res/drawable/pass_five_click.png
Binary files differ
diff --git a/app/src/main/res/drawable/pass_five_normal.png b/app/src/main/res/drawable/pass_five_normal.png
new file mode 100644
index 0000000..3a6460b
--- /dev/null
+++ b/app/src/main/res/drawable/pass_five_normal.png
Binary files differ
diff --git a/app/src/main/res/drawable/pass_four_click.png b/app/src/main/res/drawable/pass_four_click.png
new file mode 100644
index 0000000..8b2325f
--- /dev/null
+++ b/app/src/main/res/drawable/pass_four_click.png
Binary files differ
diff --git a/app/src/main/res/drawable/pass_four_normal.png b/app/src/main/res/drawable/pass_four_normal.png
new file mode 100644
index 0000000..97bd59f
--- /dev/null
+++ b/app/src/main/res/drawable/pass_four_normal.png
Binary files differ
diff --git a/app/src/main/res/drawable/pass_nine_click.png b/app/src/main/res/drawable/pass_nine_click.png
new file mode 100644
index 0000000..0aec332
--- /dev/null
+++ b/app/src/main/res/drawable/pass_nine_click.png
Binary files differ
diff --git a/app/src/main/res/drawable/pass_nine_normal.png b/app/src/main/res/drawable/pass_nine_normal.png
new file mode 100644
index 0000000..76f2f37
--- /dev/null
+++ b/app/src/main/res/drawable/pass_nine_normal.png
Binary files differ
diff --git a/app/src/main/res/drawable/pass_one_click.png b/app/src/main/res/drawable/pass_one_click.png
new file mode 100644
index 0000000..6dd704f
--- /dev/null
+++ b/app/src/main/res/drawable/pass_one_click.png
Binary files differ
diff --git a/app/src/main/res/drawable/pass_one_normal.png b/app/src/main/res/drawable/pass_one_normal.png
new file mode 100644
index 0000000..ac0beaa
--- /dev/null
+++ b/app/src/main/res/drawable/pass_one_normal.png
Binary files differ
diff --git a/app/src/main/res/drawable/pass_seven_click.png b/app/src/main/res/drawable/pass_seven_click.png
new file mode 100644
index 0000000..b685327
--- /dev/null
+++ b/app/src/main/res/drawable/pass_seven_click.png
Binary files differ
diff --git a/app/src/main/res/drawable/pass_seven_normal.png b/app/src/main/res/drawable/pass_seven_normal.png
new file mode 100644
index 0000000..a1431b1
--- /dev/null
+++ b/app/src/main/res/drawable/pass_seven_normal.png
Binary files differ
diff --git a/app/src/main/res/drawable/pass_six_click.png b/app/src/main/res/drawable/pass_six_click.png
new file mode 100644
index 0000000..c8501e2
--- /dev/null
+++ b/app/src/main/res/drawable/pass_six_click.png
Binary files differ
diff --git a/app/src/main/res/drawable/pass_six_normal.png b/app/src/main/res/drawable/pass_six_normal.png
new file mode 100644
index 0000000..f4df1ff
--- /dev/null
+++ b/app/src/main/res/drawable/pass_six_normal.png
Binary files differ
diff --git a/app/src/main/res/drawable/pass_three_click.png b/app/src/main/res/drawable/pass_three_click.png
new file mode 100644
index 0000000..55959a7
--- /dev/null
+++ b/app/src/main/res/drawable/pass_three_click.png
Binary files differ
diff --git a/app/src/main/res/drawable/pass_three_normal.png b/app/src/main/res/drawable/pass_three_normal.png
new file mode 100644
index 0000000..5a76454
--- /dev/null
+++ b/app/src/main/res/drawable/pass_three_normal.png
Binary files differ
diff --git a/app/src/main/res/drawable/pass_two_click.png b/app/src/main/res/drawable/pass_two_click.png
new file mode 100644
index 0000000..ba99d1d
--- /dev/null
+++ b/app/src/main/res/drawable/pass_two_click.png
Binary files differ
diff --git a/app/src/main/res/drawable/pass_two_normal.png b/app/src/main/res/drawable/pass_two_normal.png
new file mode 100644
index 0000000..1a1e6e3
--- /dev/null
+++ b/app/src/main/res/drawable/pass_two_normal.png
Binary files differ
diff --git a/app/src/main/res/drawable/pass_zero_click.png b/app/src/main/res/drawable/pass_zero_click.png
new file mode 100644
index 0000000..2e72719
--- /dev/null
+++ b/app/src/main/res/drawable/pass_zero_click.png
Binary files differ
diff --git a/app/src/main/res/drawable/pass_zero_normal.png b/app/src/main/res/drawable/pass_zero_normal.png
new file mode 100644
index 0000000..7463c4a
--- /dev/null
+++ b/app/src/main/res/drawable/pass_zero_normal.png
Binary files differ
diff --git a/app/src/main/res/drawable/passwd_invisiable.png b/app/src/main/res/drawable/passwd_invisiable.png
new file mode 100644
index 0000000..4214985
--- /dev/null
+++ b/app/src/main/res/drawable/passwd_invisiable.png
Binary files differ
diff --git a/app/src/main/res/drawable/passwd_visiable.png b/app/src/main/res/drawable/passwd_visiable.png
new file mode 100644
index 0000000..ba78e03
--- /dev/null
+++ b/app/src/main/res/drawable/passwd_visiable.png
Binary files differ
diff --git a/app/src/main/res/drawable/password_pwd_frame.png b/app/src/main/res/drawable/password_pwd_frame.png
new file mode 100644
index 0000000..52bfc7b
--- /dev/null
+++ b/app/src/main/res/drawable/password_pwd_frame.png
Binary files differ
diff --git a/app/src/main/res/drawable/qr_none320.png b/app/src/main/res/drawable/qr_none320.png
new file mode 100644
index 0000000..99b9039
--- /dev/null
+++ b/app/src/main/res/drawable/qr_none320.png
Binary files differ
diff --git a/app/src/main/res/drawable/qrcode.jpg b/app/src/main/res/drawable/qrcode.jpg
new file mode 100644
index 0000000..a547462
--- /dev/null
+++ b/app/src/main/res/drawable/qrcode.jpg
Binary files differ
diff --git a/app/src/main/res/drawable/qrcode_bg.xml b/app/src/main/res/drawable/qrcode_bg.xml
new file mode 100644
index 0000000..bfb1ecf
--- /dev/null
+++ b/app/src/main/res/drawable/qrcode_bg.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="@color/white"/>
+ <corners android:topLeftRadius="10dp"
+ android:bottomLeftRadius="10dp"
+ android:bottomRightRadius="10dp"
+ android:topRightRadius="10dp"/>
+</shape>
\ No newline at end of file
diff --git a/app/src/main/res/drawable/select_bg_blue.xml b/app/src/main/res/drawable/select_bg_blue.xml
new file mode 100644
index 0000000..b0fa5bb
--- /dev/null
+++ b/app/src/main/res/drawable/select_bg_blue.xml
@@ -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/corner_bg_gray_focus" android:state_selected="true"/>
+ <item android:drawable="@drawable/corner_bg_gray_focus" android:state_pressed="true"/>
+ <item android:drawable="@drawable/bg_all_lightblue2"/>
+</selector>
\ No newline at end of file
diff --git a/app/src/main/res/drawable/select_bg_keyboard.xml b/app/src/main/res/drawable/select_bg_keyboard.xml
new file mode 100644
index 0000000..83ae4c5
--- /dev/null
+++ b/app/src/main/res/drawable/select_bg_keyboard.xml
@@ -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/corner_bg_keyboard_normal" android:state_selected="true"/>
+ <item android:drawable="@drawable/corner_bg_keyboard_normal" android:state_pressed="true"/>
+ <item android:drawable="@drawable/corner_bg_keyboard_focus"/>
+</selector>
\ No newline at end of file
diff --git a/app/src/main/res/drawable/select_bg_red.xml b/app/src/main/res/drawable/select_bg_red.xml
new file mode 100644
index 0000000..1544e07
--- /dev/null
+++ b/app/src/main/res/drawable/select_bg_red.xml
@@ -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/corner_bg_gray_focus" android:state_selected="true"/>
+ <item android:drawable="@drawable/corner_bg_gray_focus" android:state_pressed="true"/>
+ <item android:drawable="@drawable/corner_bg_red_normal"/>
+</selector>
\ No newline at end of file
diff --git a/app/src/main/res/drawable/sw_toast.xml b/app/src/main/res/drawable/sw_toast.xml
new file mode 100644
index 0000000..bdc5081
--- /dev/null
+++ b/app/src/main/res/drawable/sw_toast.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@drawable/corner_bg"
+ android:gravity="center"
+ android:orientation="horizontal"
+ android:padding="5dp">
+
+ <ImageView
+ android:id="@+id/pic_cry"
+ android:layout_width="60dp"
+ android:layout_height="60dp"
+ android:layout_gravity="center"
+ android:scaleType="fitXY"
+ android:src="@drawable/toast_cry"
+ android:visibility="gone"/>
+
+ <ImageView
+ android:id="@+id/pic_smile"
+ android:layout_width="60dp"
+ android:layout_height="60dp"
+ android:layout_gravity="center"
+ android:scaleType="fitXY"
+ android:src="@drawable/toast_smile"/>
+
+ <ImageView
+ android:id="@+id/pic_doubt"
+ android:layout_width="60dp"
+ android:layout_height="60dp"
+ android:layout_gravity="center"
+ android:scaleType="fitXY"
+ android:src="@drawable/toast_doubt"
+ android:visibility="gone"/>
+
+ <TextView
+ android:id="@+id/toasttext"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="链路检测失败"
+ android:textColor="@color/black"
+ android:textSize="45dp"
+ android:textStyle="bold"/>
+</LinearLayout>
diff --git a/app/src/main/res/drawable/toast_cry.jpg b/app/src/main/res/drawable/toast_cry.jpg
new file mode 100644
index 0000000..6c54f93
--- /dev/null
+++ b/app/src/main/res/drawable/toast_cry.jpg
Binary files differ
diff --git a/app/src/main/res/drawable/toast_doubt.jpg b/app/src/main/res/drawable/toast_doubt.jpg
new file mode 100644
index 0000000..1ed3097
--- /dev/null
+++ b/app/src/main/res/drawable/toast_doubt.jpg
Binary files differ
diff --git a/app/src/main/res/drawable/toast_smile.jpg b/app/src/main/res/drawable/toast_smile.jpg
new file mode 100644
index 0000000..b74ff81
--- /dev/null
+++ b/app/src/main/res/drawable/toast_smile.jpg
Binary files differ
diff --git a/app/src/main/res/drawable/top_bar_selector.xml b/app/src/main/res/drawable/top_bar_selector.xml
new file mode 100644
index 0000000..ddcf5f6
--- /dev/null
+++ b/app/src/main/res/drawable/top_bar_selector.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="@android:color/white" android:state_enabled="true" android:state_focused="true" android:state_pressed="false"></item>
+ <item android:color="@color/light_gray" android:state_enabled="true" android:state_selected="true"></item>
+ <item android:color="@color/light_gray" android:state_enabled="true" android:state_pressed="true"></item>
+ <item android:color="@android:color/white" android:state_enabled="true" android:state_pressed="false"></item>
+</selector>
diff --git a/app/src/main/res/drawable/wireless_off.png b/app/src/main/res/drawable/wireless_off.png
new file mode 100644
index 0000000..c9e117e
--- /dev/null
+++ b/app/src/main/res/drawable/wireless_off.png
Binary files differ
diff --git a/app/src/main/res/drawable/wireless_on.png b/app/src/main/res/drawable/wireless_on.png
new file mode 100644
index 0000000..61a9506
--- /dev/null
+++ b/app/src/main/res/drawable/wireless_on.png
Binary files differ
diff --git a/app/src/main/res/layout/activity_checkdetail.xml b/app/src/main/res/layout/activity_checkdetail.xml
new file mode 100644
index 0000000..697314e
--- /dev/null
+++ b/app/src/main/res/layout/activity_checkdetail.xml
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:background="@color/black"
+ android:layout_width="match_parent"
+ android:padding="20dp"
+ android:layout_height="match_parent">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:background="@drawable/bg_corner_all_dark">
+ <LinearLayout
+ android:id="@+id/tablehead"
+ android:layout_width="match_parent"
+ android:layout_height="48dp"
+ android:orientation="horizontal" >
+ <TextView
+ android:id="@+id/table_head1"
+ android:layout_width="@dimen/item1_width"
+ android:layout_height="match_parent"
+ android:textSize="@dimen/class_title_size"
+ android:textColor="@color/main_blue1"
+ android:text="姓名"
+ android:gravity="center"/>
+
+ <TextView
+ android:id="@+id/table_head2"
+ android:layout_width="@dimen/item2_width"
+ android:layout_height="match_parent"
+ android:textSize="@dimen/class_title_size"
+ android:text="人员类别"
+ android:textColor="@color/main_blue1"
+ android:gravity="center"/>
+
+ <TextView
+ android:id="@+id/table_head3"
+ android:layout_width="@dimen/item3_width"
+ android:layout_height="match_parent"
+ android:textSize="@dimen/class_title_size"
+ android:text="部门"
+ android:textColor="@color/main_blue1"
+ android:gravity="center"/>
+
+ <TextView
+ android:id="@+id/table_head4"
+ android:layout_width="@dimen/item4_width"
+ android:layout_height="match_parent"
+ android:textSize="@dimen/class_title_size"
+ android:text="签到日期"
+ android:textColor="@color/main_blue1"
+ android:gravity="center"/>
+
+ <TextView
+ android:id="@+id/table_head5"
+ android:layout_width="@dimen/item5_width"
+ android:layout_height="match_parent"
+ android:textSize="@dimen/class_title_size"
+ android:text="签到时间"
+ android:textColor="@color/main_blue1"
+ android:gravity="center"/>
+
+ <TextView
+ android:id="@+id/table_head6"
+ android:layout_width="@dimen/item6_width"
+ android:layout_height="match_parent"
+ android:textSize="@dimen/class_title_size"
+ android:text="签到状态"
+ android:textColor="@color/main_blue1"
+ android:gravity="center"/>
+ </LinearLayout>
+
+ <TextView
+ android:id="@+id/vmsg"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="正在查询,请稍等"
+ android:layout_marginTop="5dp"
+ android:textColor="@color/orignRed"
+ android:textSize="30sp"
+ android:layout_gravity="center"
+ android:visibility="gone"/>
+
+ <ListView
+ android:id="@+id/check_list"
+ android:layout_width="match_parent"
+ android:layout_height="510dp"
+ android:layout_marginTop="10dp"
+ android:divider="@color/main_divide_line"
+ android:dividerHeight="2dp" />
+
+ <TextView
+ android:id="@+id/back_btn"
+ android:layout_width="240dp"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="10dp"
+ android:background="@drawable/select_bg_red"
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:padding="5dp"
+ android:textColor="@color/light_gray4"
+ android:text="返 回"
+ android:textSize="44sp" />
+
+ </LinearLayout>
+</LinearLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_conference.xml b/app/src/main/res/layout/activity_conference.xml
new file mode 100644
index 0000000..1d5d51c
--- /dev/null
+++ b/app/src/main/res/layout/activity_conference.xml
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:background="@color/black"
+ android:layout_width="match_parent"
+ android:padding="20dp"
+ android:layout_height="match_parent">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:background="@drawable/bg_corner_all_dark">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:layout_marginLeft="80dp"
+ android:gravity="center"
+ android:textSize="50sp"
+ android:text="会议日期"/>
+ <DatePicker
+ android:id="@+id/date"
+ android:layout_marginLeft="15dp"
+ android:layout_width="300dp"
+ android:layout_height="160dp"
+ android:layout_gravity="center"/>
+ <TextView
+ android:id="@+id/query"
+ android:layout_width="240dp"
+ android:layout_height="wrap_content"
+ android:background="@drawable/select_bg_red"
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:layout_marginLeft="15dp"
+ android:padding="9dp"
+ android:textColor="@color/light_gray4"
+ android:text="查 询"
+ android:textSize="45sp" />
+ </LinearLayout>
+
+
+ <LinearLayout
+ android:id="@+id/tablehead"
+ android:layout_width="match_parent"
+ android:layout_height="48dp"
+ android:orientation="horizontal" >
+ <TextView
+ android:id="@+id/table_head1"
+ android:layout_width="@dimen/c_item1_width"
+ android:layout_height="match_parent"
+ android:textSize="@dimen/conference_title_size"
+ android:textColor="@color/main_blue1"
+ android:text="会议名称"
+ android:gravity="center"/>
+
+ <TextView
+ android:id="@+id/table_head2"
+ android:layout_width="@dimen/c_item2_width"
+ android:layout_height="match_parent"
+ android:textSize="@dimen/conference_title_size"
+ android:text="会议日期"
+ android:textColor="@color/main_blue1"
+ android:gravity="center"/>
+
+ <TextView
+ android:id="@+id/table_head3"
+ android:layout_width="@dimen/c_item3_width"
+ android:layout_height="match_parent"
+ android:textSize="@dimen/conference_title_size"
+ android:text="会议时间"
+ android:textColor="@color/main_blue1"
+ android:gravity="center"/>
+
+ <TextView
+ android:id="@+id/table_head4"
+ android:layout_width="@dimen/c_item4_width"
+ android:layout_height="match_parent"
+ android:textSize="@dimen/conference_title_size"
+ android:text="签到时间"
+ android:textColor="@color/main_blue1"
+ android:gravity="center"/>
+
+ <TextView
+ android:id="@+id/table_head5"
+ android:layout_width="@dimen/c_item5_width"
+ android:layout_height="match_parent"
+ android:textSize="@dimen/conference_title_size"
+ android:text="会议地点"
+ android:textColor="@color/main_blue1"
+ android:gravity="center"/>
+
+ <TextView
+ android:id="@+id/table_head6"
+ android:layout_width="@dimen/c_item6_width"
+ android:layout_height="match_parent"
+ android:textSize="@dimen/conference_title_size"
+ android:text="会议类型"
+ android:textColor="@color/main_blue1"
+ android:gravity="center"/>
+ </LinearLayout>
+
+ <ListView
+ android:id="@+id/conference_list"
+ android:layout_width="match_parent"
+ android:layout_height="300dp"
+ android:layout_marginTop="10dp"
+ android:divider="@color/main_divide_line"
+ android:dividerHeight="2dp" />
+
+ <TextView
+ android:id="@+id/back_btn"
+ android:layout_width="240dp"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="10dp"
+ android:background="@drawable/select_bg_red"
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:padding="5dp"
+ android:textColor="@color/light_gray4"
+ android:text="返 回"
+ android:textSize="44sp" />
+
+ </LinearLayout>
+</LinearLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_config.xml b/app/src/main/res/layout/activity_config.xml
new file mode 100644
index 0000000..a31146d
--- /dev/null
+++ b/app/src/main/res/layout/activity_config.xml
@@ -0,0 +1,119 @@
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:background="@color/light_blue2"
+ tools:context="com.supwisdom.conferencecheck.activity.ConfigActivity">
+ <!--终端编号输入界面-->
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_margin="20dp"
+ android:background="@drawable/corner_bg_white"
+ android:gravity="center_horizontal"
+ android:orientation="vertical">
+ <!--标题-->
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="10dp"
+ android:gravity="center"
+ android:text="请填写以下信息"
+ android:textColor="@color/light_blue2"
+ android:textSize="35sp" />
+
+ <ScrollView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:scrollbars="none">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:padding="10dp">
+
+ <TextView
+ style="@style/init_param_name_style"
+ android:text="终端物理ID" />
+
+ <EditText
+ android:id="@+id/tv_devphyid"
+ style="@style/init_param_name_style"
+ android:inputType="text"
+ android:maxLength="12"
+ android:text="12345678ABCD" />
+
+ <TextView
+ style="@style/init_param_name_style"
+ android:text="服务器IP" />
+
+ <EditText
+ android:id="@+id/tv_server_ip"
+ style="@style/init_param_name_style"
+ android:text="127.0.0.1" />
+
+ <TextView
+ style="@style/init_param_name_style"
+ android:text="服务器URI" />
+
+ <EditText
+ android:id="@+id/tv_uri_root"
+ style="@style/init_param_name_style"
+ android:maxLines="1"
+ android:text="door" />
+
+
+ <TextView
+ style="@style/init_param_name_style"
+ android:text="服务器PORT" />
+
+ <EditText
+ android:id="@+id/tv_server_port"
+ style="@style/init_param_name_style"
+ android:inputType="numberDecimal"
+ android:maxLength="5"
+ android:maxLines="1"
+ android:text="8080" />
+
+ <TextView
+ android:id="@+id/tv_msg"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="5dp"
+ android:textSize="35sp"
+ android:gravity="center"
+ android:textColor="@color/cl_red"/>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="20dp"
+ android:orientation="horizontal">
+ <TextView
+ android:id="@+id/btn_save"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:background="@drawable/select_bg_keyboard"
+ android:layout_marginLeft="500dp"
+ android:padding="10dp"
+ android:text="保 存"
+ android:textColor="@color/light_blue2"
+ android:textSize="40sp" />
+
+ <TextView
+ android:id="@+id/btn_set"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="20dp"
+ android:padding="10dp"
+ android:background="@drawable/select_bg_keyboard"
+ android:text="进入系统设置"
+ android:textColor="@color/light_blue2"
+ android:textSize="40sp" />
+ </LinearLayout>
+
+ </LinearLayout>
+ </ScrollView>
+ </LinearLayout>
+</LinearLayout>
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..c7d7335
--- /dev/null
+++ b/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,418 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:background="@color/dark_blue"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:padding="10dp"
+ android:orientation="horizontal">
+
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="3"
+ android:orientation="vertical">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:background="@drawable/bg_all_lightblue2">
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:orientation="horizontal">
+ <TextView
+ android:id="@+id/tip"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="会 议 信 息"
+ android:textColor="@color/white"
+ android:textSize="60sp"
+ android:layout_marginLeft="240dp"
+ android:textStyle="bold"/>
+ <ImageView
+ android:id="@+id/linklogo"
+ android:layout_width="40dp"
+ android:layout_height="40dp"
+ android:layout_marginLeft="130dp"
+ android:src="@drawable/wireless_on" />
+
+ <TextView
+ android:id="@+id/linkstat"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:maxLines="1"
+ android:text="已联网"
+ android:layout_marginLeft="5dp"
+ android:textColor="@color/main_blue1"
+ android:textSize="28sp" />
+ </LinearLayout>
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="3"
+ android:layout_marginTop="10dp"
+ android:orientation="vertical"
+ android:background="@drawable/bg_all_lightblue">
+ <TextView
+ android:id="@+id/conference_name"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:textColor="@color/white"
+ android:textSize="45sp"
+ android:layout_marginTop="20dp"
+ android:textStyle="bold"
+ android:text=""/>
+ <TextView
+ android:id="@+id/conference_time"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:textColor="@color/white"
+ android:textSize="38sp"
+ android:layout_marginTop="18dp"
+ android:text=""/>
+ <TextView
+ android:id="@+id/conference_addr"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:layout_marginTop="6dp"
+ android:textColor="@color/white"
+ android:textSize="38sp"
+ android:text=""/>
+ <TextView
+ android:id="@+id/conference_signtime"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:textColor="@color/white"
+ android:textSize="38sp"
+ android:layout_marginTop="6dp"
+ android:text=""/>
+ <TextView
+ android:id="@+id/conference_type"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:textColor="@color/white"
+ android:textSize="38sp"
+ android:layout_marginTop="6dp"
+ android:text=""/>
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="2"
+ android:layout_marginTop="10dp"
+ android:orientation="horizontal">
+
+ <LinearLayout
+ android:layout_width="0dip"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:orientation="vertical">
+ <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <WebView
+ android:id="@+id/webview_1"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ </WebView>
+ </LinearLayout>
+ <WebView
+ android:id="@+id/webview_top_1"
+ android:layout_width="match_parent"
+ android:layout_height="75dp"
+ android:layout_alignParentBottom="true"
+ android:layout_centerInParent="true">
+ </WebView>
+ </RelativeLayout>
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="0dip"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:layout_marginLeft="2dp"
+ android:orientation="vertical">
+ <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <WebView
+ android:id="@+id/webview_2"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ </WebView>
+ </LinearLayout>
+ <WebView
+ android:id="@+id/webview_top_2"
+ android:layout_width="match_parent"
+ android:layout_height="75dp"
+ android:layout_alignParentBottom="true"
+ android:layout_centerInParent="true">
+ </WebView>
+ </RelativeLayout>
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="0dip"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:layout_marginLeft="2dp"
+ android:orientation="vertical">
+ <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <WebView
+ android:id="@+id/webview_3"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ </WebView>
+ </LinearLayout>
+ <WebView
+ android:id="@+id/webview_top_3"
+ android:layout_width="match_parent"
+ android:layout_height="75dp"
+ android:layout_alignParentBottom="true"
+ android:layout_centerInParent="true">
+ </WebView>
+ </RelativeLayout>
+ </LinearLayout>
+
+ </LinearLayout>
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="2"
+ android:layout_marginLeft="10dp"
+ android:orientation="vertical">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:orientation="horizontal">
+
+ <LinearLayout
+ android:layout_width="0dip"
+ android:layout_height="match_parent"
+ android:layout_weight="2.5"
+ android:background="@drawable/bg_left_lightblue2"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/week"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="center"
+ android:text=""
+ android:textColor="@color/white"
+ android:textSize="60sp" />
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="0dip"
+ android:layout_height="match_parent"
+ android:layout_weight="3"
+ android:layout_marginLeft="5dp"
+ android:background="@drawable/bg_right_lightblue2"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/ymd"
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1.5"
+ android:gravity="center"
+ android:textColor="@color/white"
+ android:textSize="38sp"
+ android:text=""/>
+
+ <TextView
+ android:id="@+id/hm"
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="2"
+ android:gravity="center"
+ android:textColor="@color/white"
+ android:textSize="55sp"
+ android:text=""/>
+
+ </LinearLayout>
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="3"
+ android:layout_marginTop="10dp"
+ android:orientation="vertical"
+ android:background="@drawable/bg_all_darkred">
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="联网状态下每分钟更新一次"
+ android:textColor="@color/gray_1"
+ android:layout_marginLeft="10dp"
+ android:layout_marginTop="5dp"
+ android:textSize="25sp" />
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="10dp"
+ android:layout_marginLeft="35dp"
+ android:orientation="horizontal">
+
+ <TextView
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="应到人数:"
+ android:textColor="@color/light_gray4"
+ android:textSize="45sp" />
+ <TextView
+ android:id="@+id/yd"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:textColor="@color/light_gray4"
+ android:text=""
+ android:textStyle="bold"
+ android:textSize="45sp" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="35dp"
+ android:orientation="horizontal">
+ <TextView
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="实到人数:"
+ android:textColor="@color/light_gray4"
+ android:textSize="45sp" />
+ <TextView
+ android:id="@+id/sd"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:textColor="@color/light_gray4"
+ android:text=""
+ android:textStyle="bold"
+ android:textSize="45sp" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="35dp"
+ android:orientation="horizontal">
+ <TextView
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="到 会 率:"
+ android:textColor="@color/light_gray4"
+ android:textSize="45sp" />
+ <TextView
+ android:id="@+id/rate"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:textColor="@color/light_gray4"
+ android:text=""
+ android:textStyle="bold"
+ android:textSize="45sp" />
+ </LinearLayout>
+
+ <TextView
+ android:id="@+id/detail"
+ android:layout_width="233dp"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:layout_marginTop="20dp"
+ android:background="@drawable/select_bg_blue"
+ android:gravity="center"
+ android:padding="5dp"
+ android:text="签到详情"
+ android:textColor="@color/white"
+ android:textSize="44sp" />
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="2"
+ android:layout_marginTop="10dp"
+ android:background="@drawable/bg_all_lightred">
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:layout_marginLeft="30dp"
+ android:orientation="horizontal">
+
+ <TextView
+ android:id="@+id/qrcodehint"
+ android:layout_width="250dp"
+ android:layout_height="wrap_content"
+ android:text="请扫描右侧会议码进行签到"
+ android:textColor="@color/white"
+ android:layout_gravity="center"
+ android:textSize="40sp"/>
+
+ <LinearLayout
+ android:layout_width="220dp"
+ android:layout_height="220dp"
+ android:orientation="vertical"
+ android:gravity="center"
+ android:layout_marginLeft="8dp"
+ android:background="@drawable/qrcode_bg">
+
+ <ImageView
+ android:id="@+id/vqrcode"
+ android:layout_width="250dp"
+ android:layout_height="250dp"
+ android:scaleType="fitXY"
+ android:src="@drawable/qr_none320" />
+
+ </LinearLayout>
+
+ </LinearLayout>
+
+ </LinearLayout>
+
+ </LinearLayout>
+
+ </LinearLayout>
+</LinearLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main_old.xml b/app/src/main/res/layout/activity_main_old.xml
new file mode 100644
index 0000000..97c29b3
--- /dev/null
+++ b/app/src/main/res/layout/activity_main_old.xml
@@ -0,0 +1,409 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:background="@color/black"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:padding="10dp"
+ android:orientation="horizontal">
+
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="3"
+ android:orientation="vertical">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:background="@drawable/bg_corner_top_blue">
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:orientation="horizontal">
+ <TextView
+ android:id="@+id/tip"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="会 议 信 息"
+ android:textColor="@color/gray_1"
+ android:textSize="60sp"
+ android:layout_marginLeft="240dp"
+ android:textStyle="bold"/>
+ <ImageView
+ android:id="@+id/linklogo"
+ android:layout_width="40dp"
+ android:layout_height="40dp"
+ android:layout_marginLeft="130dp"
+ android:src="@drawable/wireless_on" />
+
+ <TextView
+ android:id="@+id/linkstat"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:maxLines="1"
+ android:text="已联网"
+ android:layout_marginLeft="5dp"
+ android:textColor="@color/main_blue1"
+ android:textSize="28sp" />
+ </LinearLayout>
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="3"
+ android:layout_marginTop="10dp"
+ android:orientation="vertical"
+ android:background="@drawable/bg_corner_all_dark">
+ <TextView
+ android:id="@+id/conference_name"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:textColor="@color/main_blue1"
+ android:textSize="45sp"
+ android:layout_marginTop="20dp"
+ android:textStyle="bold"
+ android:text=""/>
+ <TextView
+ android:id="@+id/conference_time"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:textColor="@color/main_blue1"
+ android:textSize="38sp"
+ android:layout_marginTop="18dp"
+ android:text=""/>
+ <TextView
+ android:id="@+id/conference_addr"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:layout_marginTop="6dp"
+ android:textColor="@color/main_blue1"
+ android:textSize="38sp"
+ android:text=""/>
+ <TextView
+ android:id="@+id/conference_signtime"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:textColor="@color/main_blue1"
+ android:textSize="38sp"
+ android:layout_marginTop="6dp"
+ android:text=""/>
+ <TextView
+ android:id="@+id/conference_type"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:textColor="@color/main_blue1"
+ android:textSize="38sp"
+ android:layout_marginTop="6dp"
+ android:text=""/>
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="2"
+ android:layout_marginTop="10dp"
+ android:orientation="horizontal">
+
+ <LinearLayout
+ android:layout_width="0dip"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:orientation="vertical">
+ <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <WebView
+ android:id="@+id/webview_1"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ </WebView>
+ </LinearLayout>
+ <WebView
+ android:id="@+id/webview_top_1"
+ android:layout_width="match_parent"
+ android:layout_height="75dp"
+ android:layout_alignParentBottom="true"
+ android:layout_centerInParent="true">
+ </WebView>
+ </RelativeLayout>
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="0dip"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:layout_marginLeft="2dp"
+ android:orientation="vertical">
+ <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <WebView
+ android:id="@+id/webview_2"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ </WebView>
+ </LinearLayout>
+ <WebView
+ android:id="@+id/webview_top_2"
+ android:layout_width="match_parent"
+ android:layout_height="75dp"
+ android:layout_alignParentBottom="true"
+ android:layout_centerInParent="true">
+ </WebView>
+ </RelativeLayout>
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="0dip"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:layout_marginLeft="2dp"
+ android:orientation="vertical">
+ <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <WebView
+ android:id="@+id/webview_3"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ </WebView>
+ </LinearLayout>
+ <WebView
+ android:id="@+id/webview_top_3"
+ android:layout_width="match_parent"
+ android:layout_height="75dp"
+ android:layout_alignParentBottom="true"
+ android:layout_centerInParent="true">
+ </WebView>
+ </RelativeLayout>
+ </LinearLayout>
+
+ </LinearLayout>
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="2"
+ android:layout_marginLeft="10dp"
+ android:orientation="vertical">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:orientation="horizontal">
+
+ <LinearLayout
+ android:layout_width="0dip"
+ android:layout_height="match_parent"
+ android:layout_weight="2.5"
+ android:background="@drawable/corner_blue_left"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/week"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="center"
+ android:textColor="@color/black"
+ android:textSize="60sp"
+ android:text=""/>
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="0dip"
+ android:layout_height="match_parent"
+ android:layout_weight="3"
+ android:layout_marginLeft="5dp"
+ android:background="@drawable/corner_blue_right"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/ymd"
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1.5"
+ android:gravity="center"
+ android:textColor="@color/black"
+ android:textSize="38sp"
+ android:text=""/>
+
+ <TextView
+ android:id="@+id/hm"
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="2"
+ android:gravity="center"
+ android:textColor="@color/black"
+ android:textSize="55sp"
+ android:text=""/>
+
+ </LinearLayout>
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="3"
+ android:layout_marginTop="10dp"
+ android:orientation="vertical"
+ android:background="@drawable/bg_corner_all_dark">
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="联网状态下每分钟更新一次"
+ android:textColor="@color/main_blue1"
+ android:layout_marginLeft="10dp"
+ android:textSize="30sp" />
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="10dp"
+ android:layout_marginLeft="35dp"
+ android:orientation="horizontal">
+
+ <TextView
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="应到人数:"
+ android:textColor="@color/gray_1"
+ android:textSize="45sp" />
+ <TextView
+ android:id="@+id/yd"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:textColor="@color/yellow_1"
+ android:text=""
+ android:textStyle="bold"
+ android:textSize="45sp" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="35dp"
+ android:orientation="horizontal">
+ <TextView
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="实到人数:"
+ android:textColor="@color/gray_1"
+ android:textSize="45sp" />
+ <TextView
+ android:id="@+id/sd"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:textColor="@color/yellow_1"
+ android:text=""
+ android:textStyle="bold"
+ android:textSize="45sp" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="35dp"
+ android:orientation="horizontal">
+ <TextView
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="到 会 率:"
+ android:textColor="@color/gray_1"
+ android:textSize="45sp" />
+ <TextView
+ android:id="@+id/rate"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:textColor="@color/yellow_1"
+ android:text=""
+ android:textStyle="bold"
+ android:textSize="45sp" />
+ </LinearLayout>
+
+ <TextView
+ android:id="@+id/detail"
+ android:layout_width="240dp"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="20dp"
+ android:background="@drawable/select_bg_red"
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:padding="5dp"
+ android:text="签到详情"
+ android:textColor="@color/light_gray4"
+ android:textSize="44sp" />
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="2"
+ android:layout_marginTop="10dp"
+ android:background="@drawable/corner_bg_white">
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:layout_marginLeft="30dp"
+ android:orientation="horizontal">
+
+ <TextView
+ android:id="@+id/qrcodehint"
+ android:layout_width="250dp"
+ android:layout_height="wrap_content"
+ android:text="请扫描右侧会议码进行签到"
+ android:textColor="@color/gray_1"
+ android:layout_gravity="center"
+ android:textSize="40sp" />
+
+ <ImageView
+ android:id="@+id/vqrcode"
+ android:layout_width="240dp"
+ android:layout_height="240dp"
+ android:layout_marginLeft="10dp"
+ android:layout_gravity="center"
+ android:scaleType="fitXY"
+ android:src="@drawable/qr_none320" />
+
+ </LinearLayout>
+
+ </LinearLayout>
+
+ </LinearLayout>
+
+ </LinearLayout>
+</LinearLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_scanner_liner.xml b/app/src/main/res/layout/activity_scanner_liner.xml
new file mode 100644
index 0000000..3e41987
--- /dev/null
+++ b/app/src/main/res/layout/activity_scanner_liner.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<merge
+ android:id="@+id/scanner"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent">
+
+ <com.visionsmarts.pic2shop.view.ScannerLiveViewLiner
+ android:id="@+id/scanner_live_view"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"/>
+
+ <com.visionsmarts.pic2shop.view.ScannerOverlay
+ android:id="@+id/scanner_overlay"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"/>
+</merge>
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_scanner_new.xml b/app/src/main/res/layout/activity_scanner_new.xml
new file mode 100644
index 0000000..3872b62
--- /dev/null
+++ b/app/src/main/res/layout/activity_scanner_new.xml
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout android:id="@+id/capture_containter"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@color/light_gray4">
+ <RelativeLayout
+ android:id="@+id/two_code_head"
+ android:layout_width="match_parent"
+ android:layout_height="55dp"
+ android:layout_alignParentTop="true"
+ android:background="@drawable/bg_corner_all_dark"
+ android:padding="4dp">
+
+ <TextView
+ android:id="@+id/back_btn"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerVertical="true"
+ android:layout_marginLeft="5dp"
+ android:drawableLeft="@drawable/iconfont_back"
+ android:gravity="center"
+ android:padding="6dp"
+ android:textColor="@drawable/top_bar_selector"
+ android:textSize="20sp"/>
+
+ <TextView
+ android:id="@+id/main_app_name"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerInParent="true"
+ android:text="请出示您的手机二维码进行签到"
+ android:textColor="@color/main_blue1"
+ android:textSize="35sp"/>
+
+ <TextView
+ android:id="@+id/timer"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentRight="true"
+ android:layout_centerVertical="true"
+ android:layout_marginRight="5dp"
+ android:gravity="center"
+ android:padding="6dp"
+ android:textColor="@drawable/top_bar_selector"
+ android:textSize="30sp"/>
+
+ </RelativeLayout>
+ <com.visionsmarts.pic2shop.view.ScannerLiveView
+ android:id="@+id/scanner_live_view"
+ android:layout_width="match_parent"
+ android:layout_height="595dp"
+ android:layout_below="@id/two_code_head"/>
+
+ <RelativeLayout
+ android:id="@+id/capture_crop_layout"
+ android:layout_width="400dp"
+ android:layout_height="400dp"
+ android:layout_centerInParent="true"
+ android:background="@drawable/capture"
+ android:contentDescription="@string/app_name"
+ >
+ <ImageView
+ android:id="@+id/capture_scan_line"
+ android:layout_width="match_parent"
+ android:layout_height="1dp"
+ android:layout_margin="5dp"
+ android:background="@color/top_bar_theme_blue"
+ android:contentDescription="@string/app_name"/>
+ </RelativeLayout>
+
+ <TextView
+ android:id="@+id/conf_info"
+ android:layout_below="@id/scanner_live_view"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:textSize="2sp"
+ android:text=""
+ android:textColor="@color/cl_red"/>
+
+ <TextView
+ android:id="@+id/exit"
+ android:layout_width="250dp"
+ android:layout_height="90dp"
+ android:layout_below="@id/conf_info"
+ android:background="@drawable/select_bg_red"
+ android:gravity="center"
+ android:layout_marginTop="5dp"
+ android:layout_centerInParent="true"
+ android:padding="2dp"
+ android:text="取 消"
+ android:textColor="@color/light_gray4"
+ android:textSize="45sp"
+ android:textStyle="bold" />
+</RelativeLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_set.xml b/app/src/main/res/layout/activity_set.xml
new file mode 100644
index 0000000..1796884
--- /dev/null
+++ b/app/src/main/res/layout/activity_set.xml
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:background="@color/black"
+ tools:context="com.supwisdom.conferencecheck.activity.ManageActivity">
+
+ <ScrollView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="20dp"
+ android:gravity="center_horizontal"
+ android:isScrollContainer="true"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/set"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@drawable/bg_corner_all_dark"
+ android:gravity="center"
+ android:padding="5dp"
+ android:text="系统设置"
+ android:textColor="@color/main_blue1"
+ android:textSize="40sp"/>
+
+ <TextView
+ android:id="@+id/sync_msg"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="正在同步,请稍等..."
+ android:textSize="30sp"
+ android:textColor="@color/cl_red"
+ android:visibility="gone"/>
+
+ <TextView
+ android:id="@+id/syncconf"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@drawable/bg_corner_all_dark"
+ android:gravity="center"
+ android:layout_marginTop="20dp"
+ android:padding="5dp"
+ android:text="手工同步会议"
+ android:textColor="@color/main_blue1"
+ android:textSize="40sp"/>
+
+ <TextView
+ android:id="@+id/link_msg"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="正在签到,请稍等..."
+ android:textSize="30sp"
+ android:textColor="@color/cl_red"
+ android:visibility="gone"/>
+
+ <TextView
+ android:id="@+id/link"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@drawable/bg_corner_all_dark"
+ android:gravity="center"
+ android:layout_marginTop="20dp"
+ android:padding="5dp"
+ android:text="手工签到"
+ android:textColor="@color/main_blue1"
+ android:textSize="40sp"/>
+
+ <TextView
+ android:id="@+id/conference"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@drawable/bg_corner_all_dark"
+ android:gravity="center"
+ android:layout_marginTop="20dp"
+ android:padding="5dp"
+ android:text="本地会议查询"
+ android:textColor="@color/main_blue1"
+ android:textSize="40sp"/>
+
+ <TextView
+ android:id="@+id/exit"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@drawable/bg_corner_all_dark"
+ android:gravity="center"
+ android:layout_marginTop="20dp"
+ android:padding="5dp"
+ android:text="返 回"
+ android:textColor="@color/red_1"
+ android:textSize="40sp"/>
+
+ </LinearLayout>
+ </ScrollView>
+</LinearLayout>
diff --git a/app/src/main/res/layout/activity_splash.xml b/app/src/main/res/layout/activity_splash.xml
new file mode 100644
index 0000000..c89c3e3
--- /dev/null
+++ b/app/src/main/res/layout/activity_splash.xml
@@ -0,0 +1,48 @@
+<!--
+android:gravity是对元素本身说的,元素本身的文本显示在什么地方靠着换个属性设置,不过不设置默认是在左侧的。
+android:layout_gravity是相对与它的父元素说的,说明元素显示在父元素的什么位置
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/LinearLayout01"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:background="@color/light_blue2"
+ android:orientation="vertical">
+ <!--
+ android:scaleType是控制图片如何resized/moved来匹对ImageView的size
+ CENTER_INSIDE / centerInside 将图片的内容完整居中显示,通过按比例缩小或原来的size使得图片长/宽等于或小于View的长/宽
+ -->
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_margin="20dp"
+ android:background="@drawable/corner_bg_white"
+ android:gravity="center|center"
+ android:orientation="vertical">
+
+ <ImageView
+ android:id="@+id/wordpress_logo"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:scaleType="centerInside"
+ android:src="@drawable/app_logo"></ImageView>
+ <!--
+ android:typeface 字体风格
+ -->
+ <TextView
+ android:id="@+id/versionNumber"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="20dip"
+ android:gravity="bottom"
+ android:shadowColor="#FFFFFF"
+ android:shadowDx="0"
+ android:shadowDy="2"
+ android:shadowRadius="1"
+ android:text="0.0.0"
+ android:textColor="@color/pos_theme_color"
+ android:textSize="@dimen/main_caption_size"
+ android:typeface="serif" />
+ </LinearLayout>
+</LinearLayout>
diff --git a/app/src/main/res/layout/dialog_passwd.xml b/app/src/main/res/layout/dialog_passwd.xml
new file mode 100644
index 0000000..e8967e0
--- /dev/null
+++ b/app/src/main/res/layout/dialog_passwd.xml
@@ -0,0 +1,272 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/ll_float_password"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@drawable/order_btn_purchase"
+ android:orientation="vertical">
+ <!--上半部分-->
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:orientation="vertical">
+ <!--提示文字-->
+ <TextView
+ android:id="@+id/tv_float_password_title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="20dp"
+ android:text="请输入维护密码"
+ android:textColor="@color/light_gray3"
+ android:textSize="@dimen/dialog_passwd_hint_size"
+ android:textStyle="bold" />
+ <!--密码输入框-->
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/dialog_passwd_margintop_size"
+ android:orientation="horizontal">
+ <!--密码1-->
+ <RelativeLayout
+ android:layout_width="@dimen/dialog_passwd_text_size"
+ android:layout_height="@dimen/dialog_passwd_text_size">
+
+ <ImageView
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:background="@drawable/password_pwd_frame" />
+
+ <ImageView
+ android:id="@+id/float_password_img1"
+ android:layout_width="@dimen/dialog_passwd_btn_size"
+ android:layout_height="@dimen/dialog_passwd_btn_size"
+ android:layout_margin="@dimen/dialog_passwd_btn_margin"
+ android:scaleType="fitXY"
+ android:src="@drawable/face_smile" />
+ </RelativeLayout>
+ <!--密码2-->
+ <RelativeLayout
+ android:layout_width="@dimen/dialog_passwd_text_size"
+ android:layout_height="@dimen/dialog_passwd_text_size"
+ android:layout_marginLeft="@dimen/dialog_passwd_key_marginleft">
+
+ <ImageView
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:background="@drawable/password_pwd_frame" />
+
+ <ImageView
+ android:id="@+id/float_password_img2"
+ android:layout_width="@dimen/dialog_passwd_btn_size"
+ android:layout_height="@dimen/dialog_passwd_btn_size"
+ android:layout_margin="@dimen/dialog_passwd_btn_margin"
+ android:scaleType="fitXY"
+ android:src="@drawable/face_smile" />
+ </RelativeLayout>
+ <!--密码3-->
+ <RelativeLayout
+ android:layout_width="@dimen/dialog_passwd_text_size"
+ android:layout_height="@dimen/dialog_passwd_text_size"
+ android:layout_marginLeft="@dimen/dialog_passwd_key_marginleft">
+
+ <ImageView
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:background="@drawable/password_pwd_frame" />
+
+ <ImageView
+ android:id="@+id/float_password_img3"
+ android:layout_width="@dimen/dialog_passwd_btn_size"
+ android:layout_height="@dimen/dialog_passwd_btn_size"
+ android:layout_margin="@dimen/dialog_passwd_btn_margin"
+ android:scaleType="fitXY"
+ android:src="@drawable/face_smile" />
+ </RelativeLayout>
+ <!--密码4-->
+ <RelativeLayout
+ android:layout_width="@dimen/dialog_passwd_text_size"
+ android:layout_height="@dimen/dialog_passwd_text_size"
+ android:layout_marginLeft="@dimen/dialog_passwd_key_marginleft">
+
+ <ImageView
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:background="@drawable/password_pwd_frame" />
+
+ <ImageView
+ android:id="@+id/float_password_img4"
+ android:layout_width="@dimen/dialog_passwd_btn_size"
+ android:layout_height="@dimen/dialog_passwd_btn_size"
+ android:layout_margin="@dimen/dialog_passwd_btn_margin"
+ android:scaleType="fitXY"
+ android:src="@drawable/face_smile" />
+ </RelativeLayout>
+ <!--密码5-->
+ <RelativeLayout
+ android:layout_width="@dimen/dialog_passwd_text_size"
+ android:layout_height="@dimen/dialog_passwd_text_size"
+ android:layout_marginLeft="@dimen/dialog_passwd_key_marginleft">
+
+ <ImageView
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:background="@drawable/password_pwd_frame" />
+
+ <ImageView
+ android:id="@+id/float_password_img5"
+ android:layout_width="@dimen/dialog_passwd_btn_size"
+ android:layout_height="@dimen/dialog_passwd_btn_size"
+ android:layout_margin="@dimen/dialog_passwd_btn_margin"
+ android:scaleType="fitXY"
+ android:src="@drawable/face_smile" />
+ </RelativeLayout>
+ <!--密码6-->
+ <RelativeLayout
+ android:layout_width="@dimen/dialog_passwd_text_size"
+ android:layout_height="@dimen/dialog_passwd_text_size"
+ android:layout_marginLeft="@dimen/dialog_passwd_key_marginleft">
+
+ <ImageView
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:background="@drawable/password_pwd_frame" />
+
+ <ImageView
+ android:id="@+id/float_password_img6"
+ android:layout_width="@dimen/dialog_passwd_btn_size"
+ android:layout_height="@dimen/dialog_passwd_btn_size"
+ android:layout_margin="@dimen/dialog_passwd_btn_margin"
+ android:scaleType="fitXY"
+ android:src="@drawable/face_smile" />
+ </RelativeLayout>
+ </LinearLayout>
+ </LinearLayout>
+
+ <!--下半部分-->
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="10dp"
+ android:layout_marginTop="@dimen/dialog_passwd_key_margintop"
+ android:gravity="center_horizontal"
+ android:orientation="vertical">
+ <!--第一行按键-->
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="@dimen/dialog_passwd_key_size"
+ android:orientation="horizontal">
+
+ <ImageView
+ android:id="@+id/float_password_btn1"
+ android:layout_width="@dimen/dialog_passwd_key_size"
+ android:layout_height="@dimen/dialog_passwd_key_size"
+ android:src="@drawable/pass_one_normal" />
+
+ <ImageView
+ android:id="@+id/float_password_btn2"
+ android:layout_width="@dimen/dialog_passwd_key_size"
+ android:layout_height="@dimen/dialog_passwd_key_size"
+ android:layout_marginLeft="@dimen/dialog_passwd_key_margin"
+ android:src="@drawable/pass_two_normal" />
+
+ <ImageView
+ android:id="@+id/float_password_btn3"
+ android:layout_width="@dimen/dialog_passwd_key_size"
+ android:layout_height="@dimen/dialog_passwd_key_size"
+ android:layout_marginLeft="@dimen/dialog_passwd_key_margin"
+ android:src="@drawable/pass_three_normal" />
+ </LinearLayout>
+ <!--第二行按钮-->
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="@dimen/dialog_passwd_key_size"
+ android:layout_marginTop="@dimen/dialog_passwd_key_margin"
+ android:orientation="horizontal">
+
+ <ImageView
+ android:id="@+id/float_password_btn4"
+ android:layout_width="@dimen/dialog_passwd_key_size"
+ android:layout_height="@dimen/dialog_passwd_key_size"
+ android:src="@drawable/pass_four_normal" />
+
+ <ImageView
+ android:id="@+id/float_password_btn5"
+ android:layout_width="@dimen/dialog_passwd_key_size"
+ android:layout_height="@dimen/dialog_passwd_key_size"
+ android:layout_marginLeft="@dimen/dialog_passwd_key_margin"
+ android:src="@drawable/pass_five_normal" />
+
+ <ImageView
+ android:id="@+id/float_password_btn6"
+ android:layout_width="@dimen/dialog_passwd_key_size"
+ android:layout_height="@dimen/dialog_passwd_key_size"
+ android:layout_marginLeft="@dimen/dialog_passwd_key_margin"
+ android:src="@drawable/pass_six_normal" />
+ </LinearLayout>
+ <!--第三行按钮-->
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="@dimen/dialog_passwd_key_size"
+ android:layout_marginTop="@dimen/dialog_passwd_key_margin"
+ android:orientation="horizontal">
+
+ <ImageView
+ android:id="@+id/float_password_btn7"
+ android:layout_width="@dimen/dialog_passwd_key_size"
+ android:layout_height="@dimen/dialog_passwd_key_size"
+ android:src="@drawable/pass_seven_normal" />
+
+ <ImageView
+ android:id="@+id/float_password_btn8"
+ android:layout_width="@dimen/dialog_passwd_key_size"
+ android:layout_height="@dimen/dialog_passwd_key_size"
+ android:layout_marginLeft="@dimen/dialog_passwd_key_margin"
+ android:src="@drawable/pass_eight_normal" />
+
+ <ImageView
+ android:id="@+id/float_password_btn9"
+ android:layout_width="@dimen/dialog_passwd_key_size"
+ android:layout_height="@dimen/dialog_passwd_key_size"
+ android:layout_marginLeft="@dimen/dialog_passwd_key_margin"
+ android:src="@drawable/pass_nine_normal" />
+ </LinearLayout>
+ <!--第四行按钮-->
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="@dimen/dialog_passwd_key_size"
+ android:layout_marginBottom="10dp"
+ android:layout_marginTop="@dimen/dialog_passwd_key_margin"
+ android:orientation="horizontal">
+
+ <TextView
+ android:id="@+id/float_password_cancel"
+ android:layout_width="@dimen/dialog_passwd_key_size"
+ android:layout_height="@dimen/dialog_passwd_key_size"
+ android:background="@drawable/btn_red_normal"
+ android:gravity="center"
+ android:text="取消"
+ android:textColor="@color/white"
+ android:textSize="30sp" />
+
+ <ImageView
+ android:id="@+id/float_password_btn0"
+ android:layout_width="@dimen/dialog_passwd_key_size"
+ android:layout_height="@dimen/dialog_passwd_key_size"
+ android:layout_marginLeft="@dimen/dialog_passwd_key_margin"
+ android:src="@drawable/pass_zero_normal" />
+
+ <ImageView
+ android:id="@+id/float_password_btn_delete"
+ android:layout_width="@dimen/dialog_passwd_key_size"
+ android:layout_height="@dimen/dialog_passwd_key_size"
+ android:layout_marginLeft="@dimen/dialog_passwd_key_margin"
+ android:src="@drawable/pass_delete_normal" />
+ </LinearLayout>
+ </LinearLayout>
+ </LinearLayout>
+</RelativeLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/list_item.xml b/app/src/main/res/layout/list_item.xml
new file mode 100644
index 0000000..78b5f0d
--- /dev/null
+++ b/app/src/main/res/layout/list_item.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:background="@drawable/bg_corner_all_dark"
+ android:orientation="horizontal">
+
+ <TextView
+ android:id="@+id/classitem1"
+ android:layout_width="@dimen/item1_width"
+ android:layout_height="wrap_content"
+ android:textSize="@dimen/class_size"
+ android:textColor="@color/gray_1"
+ android:layout_gravity="center_vertical"
+ android:gravity="center" />
+
+ <TextView
+ android:id="@+id/classitem2"
+ android:layout_width="@dimen/item2_width"
+ android:layout_height="wrap_content"
+ android:textSize="@dimen/class_size"
+ android:layout_gravity="center_vertical"
+ android:textColor="@color/gray_1"
+ android:gravity="center"/>
+
+ <TextView
+ android:id="@+id/classitem3"
+ android:layout_width="@dimen/item3_width"
+ android:layout_height="wrap_content"
+ android:textSize="@dimen/class_size"
+ android:layout_gravity="center_vertical"
+ android:textColor="@color/gray_1"
+ android:gravity="center"/>
+
+ <TextView
+ android:id="@+id/classitem4"
+ android:layout_width="@dimen/item4_width"
+ android:layout_height="wrap_content"
+ android:textSize="@dimen/class_size"
+ android:layout_gravity="center_vertical"
+ android:textColor="@color/gray_1"
+ android:gravity="center"/>
+
+ <TextView
+ android:id="@+id/classitem5"
+ android:layout_width="@dimen/item5_width"
+ android:layout_height="wrap_content"
+ android:textSize="@dimen/class_size"
+ android:layout_gravity="center_vertical"
+ android:textColor="@color/gray_1"
+ android:gravity="center"/>
+
+ <TextView
+ android:id="@+id/classitem6"
+ android:layout_width="@dimen/item6_width"
+ android:layout_height="wrap_content"
+ android:textColor="@color/gray_1"
+ android:layout_gravity="center_vertical"
+ android:textSize="@dimen/class_size"
+ android:gravity="center"/>
+
+</LinearLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/list_item_2.xml b/app/src/main/res/layout/list_item_2.xml
new file mode 100644
index 0000000..62bcad4
--- /dev/null
+++ b/app/src/main/res/layout/list_item_2.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:background="@drawable/bg_corner_all_dark"
+ android:orientation="horizontal">
+
+ <TextView
+ android:id="@+id/classitem1"
+ android:layout_width="@dimen/c_item1_width"
+ android:layout_height="wrap_content"
+ android:textSize="@dimen/conference_size"
+ android:textColor="@color/gray_1"
+ android:layout_gravity="center_vertical"
+ android:gravity="center" />
+
+ <TextView
+ android:id="@+id/classitem2"
+ android:layout_width="@dimen/c_item2_width"
+ android:layout_height="wrap_content"
+ android:textSize="@dimen/conference_size"
+ android:layout_gravity="center_vertical"
+ android:textColor="@color/gray_1"
+ android:gravity="center"/>
+
+ <TextView
+ android:id="@+id/classitem3"
+ android:layout_width="@dimen/c_item3_width"
+ android:layout_height="wrap_content"
+ android:textSize="@dimen/conference_size"
+ android:layout_gravity="center_vertical"
+ android:textColor="@color/gray_1"
+ android:gravity="center"/>
+
+ <TextView
+ android:id="@+id/classitem4"
+ android:layout_width="@dimen/c_item4_width"
+ android:layout_height="wrap_content"
+ android:textSize="@dimen/conference_size"
+ android:layout_gravity="center_vertical"
+ android:textColor="@color/gray_1"
+ android:gravity="center"/>
+
+ <TextView
+ android:id="@+id/classitem5"
+ android:layout_width="@dimen/c_item5_width"
+ android:layout_height="wrap_content"
+ android:textSize="@dimen/conference_size"
+ android:layout_gravity="center_vertical"
+ android:textColor="@color/gray_1"
+ android:gravity="center"/>
+
+ <TextView
+ android:id="@+id/classitem6"
+ android:layout_width="@dimen/c_item6_width"
+ android:layout_height="wrap_content"
+ android:textColor="@color/gray_1"
+ android:layout_gravity="center_vertical"
+ android:textSize="@dimen/conference_size"
+ android:gravity="center"/>
+
+</LinearLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/sw_toast.xml b/app/src/main/res/layout/sw_toast.xml
new file mode 100644
index 0000000..69df1ec
--- /dev/null
+++ b/app/src/main/res/layout/sw_toast.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@drawable/corner_bg"
+ android:gravity="center"
+ android:orientation="horizontal"
+ android:padding="5dp">
+
+ <ImageView
+ android:id="@+id/pic_cry"
+ android:layout_width="60dp"
+ android:layout_height="60dp"
+ android:layout_gravity="center"
+ android:scaleType="fitXY"
+ android:src="@drawable/toast_cry"
+ android:visibility="gone"/>
+
+ <ImageView
+ android:id="@+id/pic_smile"
+ android:layout_width="60dp"
+ android:layout_height="60dp"
+ android:layout_gravity="center"
+ android:scaleType="fitXY"
+ android:src="@drawable/toast_smile"/>
+
+ <ImageView
+ android:id="@+id/pic_doubt"
+ android:layout_width="60dp"
+ android:layout_height="60dp"
+ android:layout_gravity="center"
+ android:scaleType="fitXY"
+ android:src="@drawable/toast_doubt"
+ android:visibility="gone"/>
+
+ <TextView
+ android:id="@+id/toasttext"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="链路检测失败"
+ android:textColor="@color/orignRed"
+ android:textSize="45dp"
+ android:textStyle="bold"/>
+</LinearLayout>
diff --git a/app/src/main/res/raw/beep.ogg b/app/src/main/res/raw/beep.ogg
new file mode 100644
index 0000000..dc6e719
--- /dev/null
+++ b/app/src/main/res/raw/beep.ogg
Binary files differ
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..4f3dcc1
--- /dev/null
+++ b/app/src/main/res/values/colors.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <color name="colorPrimary">#008577</color>
+ <color name="colorPrimaryDark">#00574B</color>
+ <color name="colorAccent">#D81B60</color>
+ <color name="light_blue2">#2D95E0</color>
+ <color name="pos_theme_color">#08ae9e</color>
+ <color name="black">#ADADAD</color>
+ <color name="white">#FFFFFF</color>
+
+ <color name="black_1">#3C3F41</color>
+ <color name="main_blue2">#434E5F</color>
+ <color name="gray_1">#BBBBBB</color>
+ <color name="main_blue1">#0DA7E7</color>
+ <color name="yellow_1">#BE9117</color>
+ <color name="red_1">#F15D5D</color>
+ <color name="light_gray2">#717171</color>
+ <color name="orignRed">#FF4500</color>
+ <color name="light_gray4">#e0e0e0e0</color>
+ <color name="light_gray">#ffa2a2a2</color>
+ <color name="top_bar_theme_blue">#50c3ee</color>
+ <color name="cl_red">#FF0000</color>
+ <color name="light_purple_13">#7C4CC5</color>
+ <color name="light_gray3">#666666</color>
+ <color name="main_divide_line">#ADADAD</color>
+ <color name="class_status1">#FF399E40</color>
+
+ <color name="dark_blue">#0F2645</color>
+ <color name="light_blue">#347AB6</color>
+ <color name="dark_red">#8D4A3A</color>
+ <color name="light_red">#AD5138</color>
+ <color name="light_blue_2">#047D86</color>
+</resources>
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..27aa0c5
--- /dev/null
+++ b/app/src/main/res/values/dimens.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <dimen name="main_caption_size">26sp</dimen>
+
+ <dimen name="dialog_passwd_hint_size">30sp</dimen>
+ <dimen name="dialog_passwd_margintop_size">10dp</dimen>
+ <dimen name="dialog_passwd_text_size">36dp</dimen>
+ <dimen name="dialog_passwd_key_size">85dp</dimen>
+ <dimen name="dialog_passwd_key_marginleft">15dp</dimen>
+ <dimen name="dialog_passwd_key_margintop">10dp</dimen>
+ <dimen name="dialog_passwd_key_margin">10dp</dimen>
+ <dimen name="dialog_passwd_btn_size">30dp</dimen>
+ <dimen name="dialog_passwd_btn_margin">10dp</dimen>
+
+ <dimen name="item1_width">170dp</dimen>
+ <dimen name="item2_width">180dp</dimen>
+ <dimen name="item3_width">350dp</dimen>
+ <dimen name="item4_width">200dp</dimen>
+ <dimen name="item5_width">200dp</dimen>
+ <dimen name="item6_width">180dp</dimen>
+
+ <dimen name="class_title_size">40sp</dimen>
+ <dimen name="class_size">35sp</dimen>
+
+ <dimen name="c_item1_width">300dp</dimen>
+ <dimen name="c_item2_width">150dp</dimen>
+ <dimen name="c_item3_width">210dp</dimen>
+ <dimen name="c_item4_width">150dp</dimen>
+ <dimen name="c_item5_width">300dp</dimen>
+ <dimen name="c_item6_width">150dp</dimen>
+
+ <dimen name="conference_title_size">30sp</dimen>
+ <dimen name="conference_size">25sp</dimen>
+</resources>
\ No newline at end of file
diff --git a/app/src/main/res/values/ids.xml b/app/src/main/res/values/ids.xml
new file mode 100644
index 0000000..d8a7693
--- /dev/null
+++ b/app/src/main/res/values/ids.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?><!--
+ Copyright (C) 2008 ZXing authors
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<resources>
+ <!-- Messages IDs -->
+ <item name="auto_focus" type="id" />
+ <item name="decode" type="id" />
+ <item name="decode_failed" type="id" />
+ <item name="decode_succeeded" type="id" />
+ <item name="encode_failed" type="id" />
+ <item name="encode_succeeded" type="id" />
+ <item name="launch_product_query" type="id" />
+ <item name="quit" type="id" />
+ <item name="restart_preview" type="id" />
+ <item name="return_scan_result" type="id" />
+ <item name="search_book_contents_failed" type="id" />
+ <item name="search_book_contents_succeeded" type="id" />
+ <item name="msg_barcode_found" type="id" />
+ <item name="msg_qr_code_found" type="id" />
+
+ <item name="gridview" type="id" />
+ <item name="webview" type="id" />
+
+ <item name="about_version_code" type="id"></item>
+ <item name="split" type="id"></item>
+</resources>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..31bcbd2
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,4 @@
+<resources>
+ <string name="app_name">会议签到</string>
+ <string name="scan_text">将二维码放入框内, 即可自动扫描</string>
+</resources>
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..64660fe
--- /dev/null
+++ b/app/src/main/res/values/styles.xml
@@ -0,0 +1,42 @@
+<resources>
+
+ <!-- Base application theme. -->
+ <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
+ <!-- Customize your theme here. -->
+ <item name="colorPrimary">@color/colorPrimary</item>
+ <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
+ <item name="colorAccent">@color/colorAccent</item>
+ </style>
+
+ <style name="FloatingDialog" parent="@android:style/Theme.Dialog">
+ <item name="android:windowFrame">@null</item>
+ <item name="android:windowIsFloating">true</item>
+ <item name="android:windowContentOverlay">@null</item>
+ <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
+ <item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
+ <item name="android:windowBackground">@android:color/transparent</item>
+ <item name="android:background">@android:color/transparent</item>
+ <item name="android:windowNoTitle">true</item>
+ <item name="android:windowCloseOnTouchOutside">false</item>
+ <item name="android:windowIsTranslucent">true</item>
+ </style>
+
+ <style name="init_param_name_style">
+ <item name="android:layout_width">match_parent</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:layout_marginTop">10dp</item>
+ <item name="android:gravity">start|center</item>
+ <item name="android:textColor">@color/light_blue2</item>
+ <item name="android:textSize">28sp</item>
+ </style>
+
+ <style name="load_info_text_style">
+ <item name="android:layout_width">match_parent</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:gravity">start</item>
+ <item name="android:padding">10dp</item>
+ <item name="android:textColor">@color/light_blue2</item>
+ <item name="android:textSize">30sp</item>
+ </style>
+
+</resources>