完成请求数据获取下拉框的问题
This commit is contained in:
@@ -46,21 +46,15 @@ android {
|
|||||||
/**
|
/**
|
||||||
* 服务器连接
|
* 服务器连接
|
||||||
*/
|
*/
|
||||||
buildConfigField("String", "SERVER_IP", "\"120.27.209.4\"")
|
// buildConfigField("String", "SERVER_IP", "\"120.27.209.4\"")
|
||||||
buildConfigField("String", "SERVER_PORT", "\"56791\"")
|
// buildConfigField("String", "SERVER_PORT", "\"56792\"")
|
||||||
// buildConfigField("String", "SERVER_IP", "\"192.168.1.200\"")
|
buildConfigField("String", "SERVER_IP", "\"127.0.0.1\"")
|
||||||
// buildConfigField("String", "SERVER_PORT", "\"56794\"")
|
buildConfigField("String", "SERVER_PORT", "\"56792\"")
|
||||||
/**
|
|
||||||
* face++连接地址
|
|
||||||
*/
|
|
||||||
buildConfigField("String", "FACEID_WS_URL", "\"ws://192.168.1.111:9000/video?url=\"")
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 门禁连接地址
|
* 门禁连接地址
|
||||||
*/
|
*/
|
||||||
buildConfigField("String", "DOOR_SERVER_IP", "\"192.168.1.150\"")
|
buildConfigField("String", "DOOR_SERVER_IP", "\"192.168.1.150\"")
|
||||||
buildConfigField("String", "DOOR_SERVER_PORT", "\"8000\"")
|
buildConfigField("String", "DOOR_SERVER_PORT", "\"8000\"")
|
||||||
|
|
||||||
buildConfigField("String", "DOOR_SN", "\"MC-5824T28085603\"")
|
buildConfigField("String", "DOOR_SN", "\"MC-5824T28085603\"")
|
||||||
buildConfigField("String", "DOOR_PWD", "\"FFFFFFFF\"")
|
buildConfigField("String", "DOOR_PWD", "\"FFFFFFFF\"")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.ydd.sportfaceid;
|
|||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.widget.ContentLoadingProgressBar;
|
import android.support.v4.widget.ContentLoadingProgressBar;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
@@ -18,10 +19,14 @@ import com.tencent.bugly.crashreport.CrashReport;
|
|||||||
import com.ydd.sportfaceid.config.SDAppConfig;
|
import com.ydd.sportfaceid.config.SDAppConfig;
|
||||||
import com.ydd.sportfaceid.event.QRCodeEvent;
|
import com.ydd.sportfaceid.event.QRCodeEvent;
|
||||||
import com.ydd.sportfaceid.main.SDBaseActivity;
|
import com.ydd.sportfaceid.main.SDBaseActivity;
|
||||||
|
import com.ydd.sportfaceid.netty.config.Constant;
|
||||||
|
import com.ydd.sportfaceid.netty.message.DeviceType;
|
||||||
import com.ydd.sportfaceid.service.ClientService;
|
import com.ydd.sportfaceid.service.ClientService;
|
||||||
import com.ydd.sportfaceid.setting.SDSettingActivity;
|
import com.ydd.sportfaceid.setting.SDSettingActivity;
|
||||||
|
import com.ydd.sportfaceid.utils.DeviceIdUtil;
|
||||||
import com.ydd.sportfaceid.utils.EggClickUtil;
|
import com.ydd.sportfaceid.utils.EggClickUtil;
|
||||||
import com.ydd.sportfaceid.utils.QRCodeUtil;
|
import com.ydd.sportfaceid.utils.QRCodeUtil;
|
||||||
|
import com.ydd.sportfaceid.utils.TimeUtil;
|
||||||
import com.ydd.sportfaceid.view.SDGustInfoView;
|
import com.ydd.sportfaceid.view.SDGustInfoView;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
@@ -31,7 +36,6 @@ import org.greenrobot.eventbus.ThreadMode;
|
|||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import butterknife.OnClick;
|
import butterknife.OnClick;
|
||||||
|
|
||||||
import static com.ydd.sportfaceid.event.QRCodeEvent.QR_EVENT_ACTION_FAILED;
|
import static com.ydd.sportfaceid.event.QRCodeEvent.QR_EVENT_ACTION_FAILED;
|
||||||
import static com.ydd.sportfaceid.event.QRCodeEvent.QR_EVENT_ACTION_LOADING;
|
import static com.ydd.sportfaceid.event.QRCodeEvent.QR_EVENT_ACTION_LOADING;
|
||||||
import static com.ydd.sportfaceid.event.QRCodeEvent.QR_EVENT_ACTION_OPEN_DOOR;
|
import static com.ydd.sportfaceid.event.QRCodeEvent.QR_EVENT_ACTION_OPEN_DOOR;
|
||||||
@@ -39,6 +43,8 @@ import static com.ydd.sportfaceid.event.QRCodeEvent.QR_EVENT_ACTION_OPEN_DOOR;
|
|||||||
public class MainActivity extends SDBaseActivity {
|
public class MainActivity extends SDBaseActivity {
|
||||||
|
|
||||||
private final String TAG = "MainActivity";
|
private final String TAG = "MainActivity";
|
||||||
|
// private final String URL_PARTEN = "https://api.hongyutiyu.top/getLessonOrder/";
|
||||||
|
private final String URL_PARTEN = "https://lmqhznn.goho.co/getLessonOrder/";
|
||||||
|
|
||||||
@BindView(R.id.order_view)
|
@BindView(R.id.order_view)
|
||||||
WebView order_view;
|
WebView order_view;
|
||||||
@@ -53,6 +59,8 @@ public class MainActivity extends SDBaseActivity {
|
|||||||
@BindView(R.id.qr_code_pb_cover)
|
@BindView(R.id.qr_code_pb_cover)
|
||||||
ContentLoadingProgressBar qrCodePbCover;
|
ContentLoadingProgressBar qrCodePbCover;
|
||||||
|
|
||||||
|
private String current_date;
|
||||||
|
|
||||||
private EggClickUtil eggClickUtil;
|
private EggClickUtil eggClickUtil;
|
||||||
private SDErrorDialog errorDialog;
|
private SDErrorDialog errorDialog;
|
||||||
|
|
||||||
@@ -70,7 +78,8 @@ public class MainActivity extends SDBaseActivity {
|
|||||||
// 应该是原来的保持屏幕常亮的代码
|
// 应该是原来的保持屏幕常亮的代码
|
||||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||||
order_view.setWebViewClient(new WebViewClient());
|
order_view.setWebViewClient(new WebViewClient());
|
||||||
order_view.loadUrl("http://www.baidu.com");
|
current_date = TimeUtil.getCurrentDate();
|
||||||
|
refreshWebView();
|
||||||
// 启动Service
|
// 启动Service
|
||||||
Intent socketService = new Intent(this, ClientService.class);
|
Intent socketService = new Intent(this, ClientService.class);
|
||||||
startService(socketService);
|
startService(socketService);
|
||||||
@@ -78,6 +87,15 @@ public class MainActivity extends SDBaseActivity {
|
|||||||
initQrIcon();
|
initQrIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取预订信息的字符串
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private void refreshWebView() {
|
||||||
|
String url = URL_PARTEN + SDAppConfig.getInstance().getVenueId() + "?date=" + current_date;
|
||||||
|
order_view.loadUrl(url);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
@@ -137,15 +155,17 @@ public class MainActivity extends SDBaseActivity {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case R.id.btn_refresh:
|
case R.id.btn_refresh:
|
||||||
// TODO: wyb, 2020-07-29, 刷新逻辑.
|
configView();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case R.id.btn_last_day:
|
case R.id.btn_last_day:
|
||||||
// TODO: wyb, 2020-07-29, 上一天 需要重新加载新的url.
|
current_date = TimeUtil.getSpecifiedDayAfter(current_date,1);
|
||||||
|
configView();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case R.id.btn_next_day:
|
case R.id.btn_next_day:
|
||||||
// TODO: wyb, 2020-07-29, 下一天 需要重新加载新的url.
|
current_date = TimeUtil.getSpecifiedDayAfter(current_date,-1);
|
||||||
|
configView();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -164,9 +184,11 @@ public class MainActivity extends SDBaseActivity {
|
|||||||
|
|
||||||
private void initQrIcon() {
|
private void initQrIcon() {
|
||||||
Integer venueId = SDAppConfig.getInstance().getVenueId();
|
Integer venueId = SDAppConfig.getInstance().getVenueId();
|
||||||
|
String deviceName = DeviceIdUtil.generateDeviceId(this);
|
||||||
|
DeviceType deviceType = SDAppConfig.getInstance().getDeviceType();
|
||||||
|
String qrCert = deviceName + Constant.QRCODE_WORD + venueId + Constant.QRCODE_WORD + deviceType;
|
||||||
if (venueId != 0) {
|
if (venueId != 0) {
|
||||||
Bitmap qrImage = QRCodeUtil.createQRImage(venueId + "", qrCodeIvEnter.getWidth(), qrCodeIvEnter.getHeight());
|
Bitmap qrImage = QRCodeUtil.createQRImage(qrCert, qrCodeIvEnter.getWidth(), qrCodeIvEnter.getHeight());
|
||||||
qrCodeIvEnter.setImageBitmap(qrImage);
|
qrCodeIvEnter.setImageBitmap(qrImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
package com.ydd.sportfaceid.event;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 消息事件
|
|
||||||
*
|
|
||||||
* @author peakren
|
|
||||||
* @date 08/12/2017 11:16 PM
|
|
||||||
*/
|
|
||||||
public class MessageEvent {
|
|
||||||
|
|
||||||
private String message;
|
|
||||||
|
|
||||||
public MessageEvent(String message) {
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMessage() {
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMessage(String message) {
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,6 @@ import android.app.Activity;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.ydd.sportfaceid.BuildConfig;
|
import com.ydd.sportfaceid.BuildConfig;
|
||||||
import com.ydd.sportfaceid.event.MessageEvent;
|
|
||||||
import com.ydd.sportfaceid.utils.SharedPreferencesUtil;
|
import com.ydd.sportfaceid.utils.SharedPreferencesUtil;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
@@ -84,10 +83,8 @@ public class ClientThread {
|
|||||||
future.addListener((ChannelFutureListener) f -> f.channel().eventLoop().schedule(() -> {
|
future.addListener((ChannelFutureListener) f -> f.channel().eventLoop().schedule(() -> {
|
||||||
if (!f.isSuccess()) {
|
if (!f.isSuccess()) {
|
||||||
doConnect();
|
doConnect();
|
||||||
EventBus.getDefault().post(new MessageEvent("等待连接"));
|
|
||||||
Log.e(TAG, "连接失败!");
|
Log.e(TAG, "连接失败!");
|
||||||
} else {
|
} else {
|
||||||
EventBus.getDefault().post(new MessageEvent("已连接"));
|
|
||||||
Log.i(TAG, "连接成功!");
|
Log.i(TAG, "连接成功!");
|
||||||
}
|
}
|
||||||
}, 2, TimeUnit.SECONDS));
|
}, 2, TimeUnit.SECONDS));
|
||||||
|
|||||||
@@ -3,5 +3,6 @@ package com.ydd.sportfaceid.netty.config;
|
|||||||
public class Constant {
|
public class Constant {
|
||||||
|
|
||||||
public final static String DELIMITER_WORD = "$_$";
|
public final static String DELIMITER_WORD = "$_$";
|
||||||
|
public final static String QRCODE_WORD = "#";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
package com.ydd.sportfaceid.setting;
|
package com.ydd.sportfaceid.setting;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Message;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.util.Base64;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
@@ -10,6 +13,7 @@ import android.widget.RadioButton;
|
|||||||
import android.widget.RadioGroup;
|
import android.widget.RadioGroup;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
|
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.ydd.sportfaceid.R;
|
import com.ydd.sportfaceid.R;
|
||||||
import com.ydd.sportfaceid.config.SDAppConfig;
|
import com.ydd.sportfaceid.config.SDAppConfig;
|
||||||
import com.ydd.sportfaceid.main.SDBaseActivity;
|
import com.ydd.sportfaceid.main.SDBaseActivity;
|
||||||
@@ -18,6 +22,16 @@ import com.ydd.sportfaceid.netty.message.DeviceType;
|
|||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import butterknife.OnClick;
|
import butterknife.OnClick;
|
||||||
|
import com.ydd.sportfaceid.utils.JsonMapper;
|
||||||
|
import com.ydd.sportfaceid.utils.TimeUntil;
|
||||||
|
import okhttp3.*;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class SDSettingActivity extends SDBaseActivity {
|
public class SDSettingActivity extends SDBaseActivity {
|
||||||
public static final String TAG = "SDSettingActivity_TAG";
|
public static final String TAG = "SDSettingActivity_TAG";
|
||||||
@@ -28,14 +42,62 @@ public class SDSettingActivity extends SDBaseActivity {
|
|||||||
@BindView(R.id.venue_action)
|
@BindView(R.id.venue_action)
|
||||||
RadioGroup venueActionView;
|
RadioGroup venueActionView;
|
||||||
|
|
||||||
private String spinnerValue;
|
private Integer spinnerValue;
|
||||||
|
|
||||||
|
List<VenueItem> resultList = null;
|
||||||
|
|
||||||
|
boolean init = false;
|
||||||
|
|
||||||
|
Handler handler = new Handler(){
|
||||||
|
|
||||||
|
public void handleMessage(Message msg) {
|
||||||
|
switch (msg.what) {
|
||||||
|
case 1:
|
||||||
|
init = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_sdsetting);
|
setContentView(R.layout.activity_sdsetting);
|
||||||
ButterKnife.bind(this);
|
ButterKnife.bind(this);
|
||||||
|
new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
String url = "https://lmqhznn.goho.co/getVenueList";
|
||||||
|
OkHttpClient client = new OkHttpClient();
|
||||||
|
Request request = new Request.Builder()
|
||||||
|
.url(url)
|
||||||
|
.build();
|
||||||
|
Response response = null;
|
||||||
|
try {
|
||||||
|
response = client.newCall(request).execute();
|
||||||
|
} catch (IOException e) {
|
||||||
|
Log.e(TAG, "setConfigError: ", e);
|
||||||
|
showToast("网络异常,请稍候再试!");
|
||||||
|
}
|
||||||
|
if (!response.isSuccessful()) {
|
||||||
|
}
|
||||||
|
String result = null;
|
||||||
|
try {
|
||||||
|
result = response.body().string();
|
||||||
|
System.out.println("result ================" + result);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
resultList = JsonMapper.fromJson(result,new TypeToken<List<VenueItem>>(){}.getType());
|
||||||
|
Message message = new Message();
|
||||||
|
message.what = 1;
|
||||||
|
handler.sendMessage(message);
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
while (init){
|
||||||
initSpinner();
|
initSpinner();
|
||||||
|
init = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -60,12 +122,12 @@ public class SDSettingActivity extends SDBaseActivity {
|
|||||||
|
|
||||||
private void setConfig() {
|
private void setConfig() {
|
||||||
try {
|
try {
|
||||||
if (TextUtils.isEmpty(spinnerValue)) {
|
if (spinnerValue == null) {
|
||||||
showToast("未选择场馆!");
|
showToast("未选择场馆!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer venueId = Integer.parseInt(spinnerValue);
|
Integer venueId = spinnerValue;
|
||||||
RadioButton radioButton = findCheckedRadioButton();
|
RadioButton radioButton = findCheckedRadioButton();
|
||||||
|
|
||||||
if (radioButton == null) {
|
if (radioButton == null) {
|
||||||
@@ -100,16 +162,13 @@ public class SDSettingActivity extends SDBaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initSpinner() {
|
private void initSpinner() {
|
||||||
// TESTCODE: wyb, 2020-07-29, 测试Spinner列表.
|
ArrayAdapter<VenueItem> adapter = new ArrayAdapter<>(this, R.layout.item_setting_spinner, resultList);
|
||||||
// TODO: wyb, 2020-07-29, 需要请求场馆列表.
|
|
||||||
String[] stringArray = getResources().getStringArray(R.array.setting_spinner_test_list);
|
|
||||||
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, R.layout.item_setting_spinner, stringArray);
|
|
||||||
|
|
||||||
venueCellView.setAdapter(adapter);
|
venueCellView.setAdapter(adapter);
|
||||||
venueCellView.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
venueCellView.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||||
spinnerValue = stringArray[position];
|
VenueItem venueItem = (VenueItem) venueCellView.getSelectedItem();
|
||||||
|
spinnerValue = venueItem.getVenueId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -118,7 +177,14 @@ public class SDSettingActivity extends SDBaseActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
// TODO: wyb, 2020-07-29, 这里可以设置为当前场馆的index.
|
// TODO: wyb, 2020-07-29, 这里可以设置为当前场馆的index.
|
||||||
venueCellView.setSelection(0, false);
|
int position = 0;
|
||||||
|
for (VenueItem venueItem : resultList){
|
||||||
|
if (spinnerValue.equals(venueItem.getVenueId())){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
position ++ ;
|
||||||
|
}
|
||||||
|
venueCellView.setSelection(position, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
29
app/src/main/java/com/ydd/sportfaceid/setting/VenueItem.java
Normal file
29
app/src/main/java/com/ydd/sportfaceid/setting/VenueItem.java
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
package com.ydd.sportfaceid.setting;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class VenueItem implements Serializable {
|
||||||
|
private Integer venueId;
|
||||||
|
private String venueName;
|
||||||
|
|
||||||
|
public VenueItem(Integer venueId, String venueName) {
|
||||||
|
this.venueId = venueId;
|
||||||
|
this.venueName = venueName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getVenueId() {
|
||||||
|
return venueId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVenueId(Integer venueId) {
|
||||||
|
this.venueId = venueId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVenueName() {
|
||||||
|
return venueName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVenueName(String venueName) {
|
||||||
|
this.venueName = venueName;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -52,26 +52,6 @@ public class SharedPreferencesUtil {
|
|||||||
return serverShare.getInt("serverPort", Integer.parseInt(BuildConfig.SERVER_PORT));
|
return serverShare.getInt("serverPort", Integer.parseInt(BuildConfig.SERVER_PORT));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置face++的连接地址和端口
|
|
||||||
*
|
|
||||||
* @param url
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static boolean setFaceidWsUrl(String url) {
|
|
||||||
initServerShare();
|
|
||||||
if (getFaceidWsUrl().equals(url)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
serverShare.edit().putString("faceidWsUrl", url).apply();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getFaceidWsUrl() {
|
|
||||||
initServerShare();
|
|
||||||
return serverShare.getString("faceidWsUrl", BuildConfig.FACEID_WS_URL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置门禁的连接地址和端口
|
* 设置门禁的连接地址和端口
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
package com.ydd.sportfaceid.utils;
|
package com.ydd.sportfaceid.utils;
|
||||||
|
|
||||||
|
import android.text.format.DateUtils;
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -13,6 +17,8 @@ public class TimeUtil {
|
|||||||
static final private SimpleDateFormat sFormat = new SimpleDateFormat("yyMMddHHmmssSSS");
|
static final private SimpleDateFormat sFormat = new SimpleDateFormat("yyMMddHHmmssSSS");
|
||||||
static final private SimpleDateFormat sLogFormat = new SimpleDateFormat("MM-dd HH:mm:ss.SSS");
|
static final private SimpleDateFormat sLogFormat = new SimpleDateFormat("MM-dd HH:mm:ss.SSS");
|
||||||
|
|
||||||
|
static final private SimpleDateFormat initOrderFormat = new SimpleDateFormat("YYYY-MM-dd");
|
||||||
|
|
||||||
static public String getNowTimeStr() {
|
static public String getNowTimeStr() {
|
||||||
return sFormat.format(new Date());
|
return sFormat.format(new Date());
|
||||||
}
|
}
|
||||||
@@ -20,4 +26,30 @@ public class TimeUtil {
|
|||||||
static public String getLogStr() {
|
static public String getLogStr() {
|
||||||
return sLogFormat.format(new Date());
|
return sLogFormat.format(new Date());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static public String getCurrentDate(){
|
||||||
|
return initOrderFormat.format(new Date());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取与指定日期间隔给定天数的日期.
|
||||||
|
* @param specifiedDay
|
||||||
|
* @param num 间隔天数
|
||||||
|
* @return String 间隔指定天数之后的日期
|
||||||
|
*/
|
||||||
|
public static String getSpecifiedDayAfter(String specifiedDay, int num){
|
||||||
|
Date specifiedDate = null;
|
||||||
|
try {
|
||||||
|
specifiedDate = initOrderFormat.parse(specifiedDay);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
return getCurrentDate();
|
||||||
|
}
|
||||||
|
Calendar c = Calendar.getInstance();
|
||||||
|
c.setTime(specifiedDate);
|
||||||
|
int day = c.get(Calendar.DATE);
|
||||||
|
c.set(Calendar.DATE, day + num);
|
||||||
|
String dayAfter = initOrderFormat.format(c.getTime());
|
||||||
|
return dayAfter;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ public class SDGustInfoView extends RelativeLayout {
|
|||||||
date_label.setText(date_string + " " + weak_string);
|
date_label.setText(date_string + " " + weak_string);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
super.handleMessage(msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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:background="@color/bg_color"
|
||||||
|
android:orientation="vertical">
|
||||||
<TextView
|
<TextView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
@@ -9,3 +15,4 @@
|
|||||||
tools:text="测试场馆1"
|
tools:text="测试场馆1"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"/>
|
android:layout_height="match_parent"/>
|
||||||
|
</LinearLayout>
|
||||||
@@ -6,13 +6,4 @@
|
|||||||
<string name="camera_setting_type_title">请选择场馆,以及门禁类型</string>
|
<string name="camera_setting_type_title">请选择场馆,以及门禁类型</string>
|
||||||
<string name="stranger_info_string">您好 \n 您尚未注册成为本智能运动场用户 \n请扫描门禁上张贴的场馆二维码进行注册后再试</string>
|
<string name="stranger_info_string">您好 \n 您尚未注册成为本智能运动场用户 \n请扫描门禁上张贴的场馆二维码进行注册后再试</string>
|
||||||
<string name="stranger_info_detail_string">如遇注册用户无法识别请联系场馆管理人员</string>
|
<string name="stranger_info_detail_string">如遇注册用户无法识别请联系场馆管理人员</string>
|
||||||
|
|
||||||
<string-array name="setting_spinner_test_list">
|
|
||||||
<item>00001</item>
|
|
||||||
<item>00002</item>
|
|
||||||
<item>00003</item>
|
|
||||||
<item>00004</item>
|
|
||||||
<item>00005</item>
|
|
||||||
<item>00006</item>
|
|
||||||
</string-array>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user