1、新增首页三个按钮。
2、新增首页二维码图片显示逻辑。 3、新增设置页下拉框和单选按钮。
This commit is contained in:
@@ -1,74 +1,66 @@
|
||||
package com.ydd.sportfaceid;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.CountDownTimer;
|
||||
import android.os.Handler;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.support.v4.widget.ContentLoadingProgressBar;
|
||||
import android.text.Html;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
import com.tencent.bugly.crashreport.CrashReport;
|
||||
import com.ydd.sportfaceid.config.SDAppConfig;
|
||||
import com.ydd.sportfaceid.event.QRCodeEvent;
|
||||
import com.ydd.sportfaceid.main.SDBaseActivity;
|
||||
import com.ydd.sportfaceid.service.ClientService;
|
||||
import com.ydd.sportfaceid.setting.SDSettingActivity;
|
||||
import com.ydd.sportfaceid.utils.EggClickUtil;
|
||||
import com.ydd.sportfaceid.utils.QRCodeUtil;
|
||||
import com.ydd.sportfaceid.view.SDGustInfoView;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.OnClick;
|
||||
import de.hdodenhof.circleimageview.CircleImageView;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
||||
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_OPEN_DOOR;
|
||||
|
||||
public class MainActivity extends SDBaseActivity {
|
||||
|
||||
private final String TAG = "MainActivity";
|
||||
|
||||
@BindView(R.id.welcome_label)
|
||||
TextView welcome_label;
|
||||
|
||||
@BindView(R.id.topInfoTextView)
|
||||
TextView topInfoTextView;
|
||||
|
||||
@BindView(R.id.order_view)
|
||||
WebView order_view;
|
||||
@BindView(R.id.gust_info_view)
|
||||
SDGustInfoView gustInfoView;
|
||||
@BindView(R.id.tv_tip)
|
||||
TextView tvTip;
|
||||
@BindView(R.id.qr_code_iv_small)
|
||||
ImageView qrCodeIvSmall;
|
||||
@BindView(R.id.qr_code_iv_enter)
|
||||
ImageView qrCodeIvEnter;
|
||||
@BindView(R.id.qr_code_pb_cover)
|
||||
ContentLoadingProgressBar qrCodePbCover;
|
||||
|
||||
@BindView(R.id.sb_string_label)
|
||||
TextView sb_string_label;
|
||||
|
||||
@BindView(R.id.count_down_label)
|
||||
TextView count_down_label;
|
||||
|
||||
public EggClickUtil eggClickUtil;
|
||||
|
||||
public void setMaxCountDownTime(int maxCountDownTime) {
|
||||
if (maxCountDownTime < 0) {
|
||||
return;
|
||||
}
|
||||
this.maxCountDownTime = maxCountDownTime;
|
||||
count_down_label.setVisibility(View.VISIBLE);
|
||||
String downString = String.format("请注意门禁将于 %ds 后关闭", this.maxCountDownTime);
|
||||
count_down_label.setText(downString);
|
||||
}
|
||||
|
||||
public static final int maxTime = 15;
|
||||
public int maxCountDownTime = 15;
|
||||
|
||||
private EggClickUtil eggClickUtil;
|
||||
private SDErrorDialog errorDialog;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
ButterKnife.bind(this);
|
||||
// 不做什么事情,只是计算屏幕的高宽
|
||||
initScreen();
|
||||
// 注册消息bus
|
||||
@@ -77,10 +69,13 @@ public class MainActivity extends SDBaseActivity {
|
||||
configView();
|
||||
// 应该是原来的保持屏幕常亮的代码
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
order_view.loadUrl("https://www.baidu.com");
|
||||
order_view.setWebViewClient(new WebViewClient());
|
||||
order_view.loadUrl("http://www.baidu.com");
|
||||
// 启动Service
|
||||
Intent socketService = new Intent(this, ClientService.class);
|
||||
startService(socketService);
|
||||
// 初始化二维码图片
|
||||
initQrIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -88,50 +83,6 @@ public class MainActivity extends SDBaseActivity {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
private void initScreen() {
|
||||
WindowManager manager = getWindowManager();
|
||||
DisplayMetrics outMetrics = new DisplayMetrics();
|
||||
manager.getDefaultDisplay().getMetrics(outMetrics);
|
||||
int mScreenW = outMetrics.widthPixels;
|
||||
int mScreenH = outMetrics.heightPixels;
|
||||
Log.d("sander", mScreenW + "==== " + mScreenH);
|
||||
}
|
||||
|
||||
public void setCurrentStatus(int current_status) {
|
||||
// 控制样式
|
||||
if(1 == current_status){
|
||||
this.sb_string_label.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
public void configView() {
|
||||
this.setCurrentStatus(1);
|
||||
eggClickUtil = new EggClickUtil(() -> {
|
||||
Intent intent = new Intent(MainActivity.this, SDSettingActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载人脸识别信息
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void getQRResult(QRCodeEvent qrCodeEvent) {
|
||||
if (qrCodeEvent.getMsg().equals("不是会员")){
|
||||
// 这个是非会员进入现场
|
||||
this.showStrangerDialog();
|
||||
return;
|
||||
}
|
||||
CrashReport.postCatchedException(new Throwable("接受到命令 " + qrCodeEvent.getMsg()));
|
||||
// 监听到头像
|
||||
welcome_label.setText(String.format("欢迎%s进场", "张三"));
|
||||
int code = qrCodeEvent.getAction();
|
||||
switch (code){
|
||||
case 1:
|
||||
// TODO 通过处理结果调整页面显示
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
@@ -145,16 +96,93 @@ public class MainActivity extends SDBaseActivity {
|
||||
}
|
||||
}
|
||||
|
||||
public void showStrangerDialog(){
|
||||
/**
|
||||
* 加载人脸识别信息
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void getQRResult(QRCodeEvent qrCodeEvent) {
|
||||
if (qrCodeEvent.getMsg().equals("不是会员")) {
|
||||
// 这个是非会员进入现场
|
||||
this.showStrangerDialog();
|
||||
return;
|
||||
}
|
||||
CrashReport.postCatchedException(new Throwable("接受到命令 " + qrCodeEvent.getMsg()));
|
||||
// 监听到头像
|
||||
int code = qrCodeEvent.getAction();
|
||||
try {
|
||||
tvTip.setText(Html.fromHtml(qrCodeEvent.getMsg()));
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "getQRResultError: ", e);
|
||||
}
|
||||
switch (code) {
|
||||
case QR_EVENT_ACTION_LOADING:
|
||||
qrCodePbCover.setVisibility(View.VISIBLE);
|
||||
qrCodePbCover.show();
|
||||
break;
|
||||
case QR_EVENT_ACTION_OPEN_DOOR:
|
||||
case QR_EVENT_ACTION_FAILED:
|
||||
qrCodePbCover.setVisibility(View.GONE);
|
||||
qrCodePbCover.hide();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@OnClick({R.id.gust_info_view, R.id.btn_refresh, R.id.btn_last_day, R.id.btn_next_day})
|
||||
void onClick(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.gust_info_view:
|
||||
eggClickUtil.checkoutHideFunction();
|
||||
break;
|
||||
|
||||
case R.id.btn_refresh:
|
||||
// TODO: wyb, 2020-07-29, 刷新逻辑.
|
||||
break;
|
||||
|
||||
case R.id.btn_last_day:
|
||||
// TODO: wyb, 2020-07-29, 上一天 需要重新加载新的url.
|
||||
break;
|
||||
|
||||
case R.id.btn_next_day:
|
||||
// TODO: wyb, 2020-07-29, 下一天 需要重新加载新的url.
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void initScreen() {
|
||||
WindowManager manager = getWindowManager();
|
||||
DisplayMetrics outMetrics = new DisplayMetrics();
|
||||
manager.getDefaultDisplay().getMetrics(outMetrics);
|
||||
int mScreenW = outMetrics.widthPixels;
|
||||
int mScreenH = outMetrics.heightPixels;
|
||||
Log.d("sander", mScreenW + "==== " + mScreenH);
|
||||
}
|
||||
|
||||
private void initQrIcon() {
|
||||
Integer venueId = SDAppConfig.getInstance().getVenueId();
|
||||
|
||||
if (venueId != 0) {
|
||||
Bitmap qrImage = QRCodeUtil.createQRImage(venueId + "", qrCodeIvEnter.getWidth(), qrCodeIvEnter.getHeight());
|
||||
qrCodeIvEnter.setImageBitmap(qrImage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void configView() {
|
||||
eggClickUtil = new EggClickUtil(() -> {
|
||||
Intent intent = new Intent(MainActivity.this, SDSettingActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
}
|
||||
|
||||
private void showStrangerDialog() {
|
||||
if (errorDialog == null) {
|
||||
errorDialog = new SDErrorDialog(this);
|
||||
}
|
||||
errorDialog.showDialog();
|
||||
}
|
||||
|
||||
@OnClick({R.id.gust_info_view}) void onClick(View view){
|
||||
if (view.getId() == R.id.gust_info_view){
|
||||
eggClickUtil.checkoutHideFunction();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,25 +3,28 @@ package com.ydd.sportfaceid.config;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.ydd.sportfaceid.netty.message.DeviceType;
|
||||
|
||||
public class SDAppConfig {
|
||||
|
||||
public static SDAppConfig config = null;
|
||||
private Context mContext;
|
||||
private static SDAppConfig config;
|
||||
|
||||
private final String KEY_CACHE = "KEY_CACHE";
|
||||
private final String STORE_VENUE = "STORE_VENUE";
|
||||
private final String STORE_DEVICE_TYPE = "STORE_DEVICE_TYPE";
|
||||
|
||||
private SharedPreferences sp;
|
||||
private SharedPreferences.Editor sp_editor;
|
||||
|
||||
private String KEY_CACHE = "KEY_CACHE";
|
||||
|
||||
private String STORE_VENUE = "STORE_VENUE";
|
||||
private String STORE_DEVICE_TYPE = "STORE_DEVICE_TYPE";
|
||||
private SharedPreferences.Editor spEditor;
|
||||
/**
|
||||
* 场馆ID
|
||||
*/
|
||||
private Integer venueId;
|
||||
private DeviceType deviceType;
|
||||
|
||||
private SDAppConfig() {
|
||||
}
|
||||
|
||||
public static SDAppConfig getInstance() {
|
||||
synchronized (SDAppConfig.class) {
|
||||
if (config == null) {
|
||||
@@ -32,21 +35,17 @@ public class SDAppConfig {
|
||||
}
|
||||
|
||||
public void init(Context context) {
|
||||
this.mContext = context;
|
||||
synchronized (SDAppConfig.class) {
|
||||
if (sp == null) {
|
||||
sp = this.mContext.getSharedPreferences(KEY_CACHE, Context.MODE_PRIVATE);
|
||||
sp_editor = sp.edit();
|
||||
sp = context.getSharedPreferences(KEY_CACHE, Context.MODE_PRIVATE);
|
||||
spEditor = sp.edit();
|
||||
configData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void configData() {
|
||||
Integer storeVenueId = sp.getInt(STORE_VENUE, 0);
|
||||
if (storeVenueId != null){
|
||||
this.venueId = storeVenueId;
|
||||
}
|
||||
this.venueId = sp.getInt(STORE_VENUE, 0);
|
||||
String storeType = sp.getString(STORE_DEVICE_TYPE, "ENTER");
|
||||
if (!TextUtils.isEmpty(storeType)) {
|
||||
this.deviceType = DeviceType.valueOf(storeType);
|
||||
@@ -57,9 +56,9 @@ public class SDAppConfig {
|
||||
public void configSet(Integer venueId, DeviceType deviceType) {
|
||||
this.venueId = venueId;
|
||||
this.deviceType = deviceType;
|
||||
sp_editor.putInt(STORE_VENUE,venueId);
|
||||
sp_editor.putString(STORE_DEVICE_TYPE,deviceType.name());
|
||||
sp_editor.commit();
|
||||
spEditor.putInt(STORE_VENUE, venueId);
|
||||
spEditor.putString(STORE_DEVICE_TYPE, deviceType.name());
|
||||
spEditor.commit();
|
||||
}
|
||||
|
||||
public Integer getVenueId() {
|
||||
|
||||
@@ -6,6 +6,10 @@ package com.ydd.sportfaceid.event;
|
||||
* @date 08/12/2017 11:16 PM
|
||||
*/
|
||||
public class QRCodeEvent {
|
||||
public static final int QR_EVENT_ACTION_LOADING = 1;
|
||||
public static final int QR_EVENT_ACTION_OPEN_DOOR = 2;
|
||||
public static final int QR_EVENT_ACTION_FAILED = 3;
|
||||
|
||||
private int action;
|
||||
private String msg;
|
||||
|
||||
|
||||
@@ -2,10 +2,11 @@ package com.ydd.sportfaceid.netty.message;
|
||||
|
||||
public enum MessageType {
|
||||
LOAD("加载"),
|
||||
OPENDOOR("开门"),
|
||||
OPEN_DOOR("开门"),
|
||||
FAILED("开门校验失败");
|
||||
|
||||
private String message;
|
||||
|
||||
MessageType(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@@ -2,14 +2,18 @@ package com.ydd.sportfaceid.service;
|
||||
|
||||
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
|
||||
import com.ydd.sportfaceid.BuildConfig;
|
||||
import com.ydd.sportfaceid.event.MessageEvent;
|
||||
import com.ydd.sportfaceid.event.QRCodeEvent;
|
||||
import com.ydd.sportfaceid.netty.message.MessageDTO;
|
||||
import com.ydd.sportfaceid.utils.AppLogger;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
import Net.PC15.Command.CommandDetial;
|
||||
import Net.PC15.Connector.ConnectorAllocator;
|
||||
import Net.PC15.Connector.E_ControllerType;
|
||||
@@ -24,7 +28,6 @@ import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
import okhttp3.ResponseBody;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
/**
|
||||
* 消息服务
|
||||
@@ -37,7 +40,6 @@ public class MessageService {
|
||||
|
||||
private final static String TAG = "MessageService";
|
||||
|
||||
|
||||
static private MessageService sInstance;
|
||||
|
||||
static public MessageService getInstance() {
|
||||
@@ -60,22 +62,22 @@ public class MessageService {
|
||||
switch (message.getMessageType()) {
|
||||
case LOAD:
|
||||
// TODO 安卓获取通知加载页面 (进入加载页面,显示欢迎用户的消息)
|
||||
System.out.println("LOADING" + message.getMessage());
|
||||
EventBus.getDefault().post(new QRCodeEvent(1,message.getMessage()));
|
||||
Log.d(TAG, "LOADING" + message.getMessage());
|
||||
EventBus.getDefault().post(new QRCodeEvent(QRCodeEvent.QR_EVENT_ACTION_LOADING, message.getMessage()));
|
||||
break;
|
||||
case OPENDOOR:
|
||||
case OPEN_DOOR:
|
||||
// TODO 安卓获取通知开门的消息 无需校验,直接操作开门
|
||||
// 进入一个页面,然后显示倒计时,回到主页
|
||||
EventBus.getDefault().post(new QRCodeEvent(2,message.getMessage()));
|
||||
System.out.println("OPENDOOR" + message.getMessage());
|
||||
Log.d(TAG, "OPEN_DOOR" + message.getMessage());
|
||||
EventBus.getDefault().post(new QRCodeEvent(QRCodeEvent.QR_EVENT_ACTION_OPEN_DOOR, message.getMessage()));
|
||||
break;
|
||||
case FAILED:
|
||||
// TODO 安卓获取通知开门失败消息 进入一个页面,然后显示倒计时,回到主页
|
||||
EventBus.getDefault().post(new QRCodeEvent(3,message.getMessage()));
|
||||
System.out.println("FAILED" + message.getMessage());
|
||||
Log.d(TAG, "FAILED" + message.getMessage());
|
||||
EventBus.getDefault().post(new QRCodeEvent(QRCodeEvent.QR_EVENT_ACTION_FAILED, message.getMessage()));
|
||||
break;
|
||||
default:
|
||||
System.out.println("default");
|
||||
Log.d(TAG, "default");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,9 +94,9 @@ public class MessageService {
|
||||
CommandDetial detial = new CommandDetial();
|
||||
detial.Connector = tcpClientDetial;
|
||||
detial.Identity = new FC8800Identity(BuildConfig.DOOR_SN, BuildConfig.DOOR_PWD, E_ControllerType.FC8900);
|
||||
OpenDoor_Parameter openDoor_parameter = new OpenDoor_Parameter(detial);
|
||||
openDoor_parameter.Door.SetDoor(ivalue, 1);
|
||||
OpenDoor openDoor = new OpenDoor(openDoor_parameter);
|
||||
OpenDoor_Parameter openDoorParameter = new OpenDoor_Parameter(detial);
|
||||
openDoorParameter.Door.SetDoor(ivalue, 1);
|
||||
OpenDoor openDoor = new OpenDoor(openDoorParameter);
|
||||
boolean command = connector.AddCommand(openDoor);
|
||||
if (openDoor.getIsTimeout()) {
|
||||
AppLogger.getInstance().writeLog("----open door timeout ----");
|
||||
|
||||
@@ -1,53 +1,41 @@
|
||||
package com.ydd.sportfaceid.setting;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import com.ydd.sportfaceid.R;
|
||||
import com.ydd.sportfaceid.config.SDAppConfig;
|
||||
import com.ydd.sportfaceid.main.SDBaseActivity;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.OnClick;
|
||||
import com.ydd.sportfaceid.netty.message.DeviceType;
|
||||
|
||||
public class SDSettingActivity extends SDBaseActivity {
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
||||
public class SDSettingActivity extends SDBaseActivity {
|
||||
public static final String TAG = "SDSettingActivity_TAG";
|
||||
|
||||
@BindView(R.id.venue_cell)
|
||||
TextView venue_cell;
|
||||
Spinner venueCellView;
|
||||
|
||||
@BindView(R.id.device_type_cell)
|
||||
TextView device_type_cell;
|
||||
@BindView(R.id.venue_action)
|
||||
RadioGroup venueActionView;
|
||||
|
||||
private String spinnerValue;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_sdsetting);
|
||||
}
|
||||
|
||||
private void setConfig(){
|
||||
Integer venueId = Integer.parseInt(venue_cell.getText().toString());
|
||||
DeviceType deviceType = DeviceType.valueOf(device_type_cell.getText().toString());
|
||||
SDAppConfig.getInstance().configSet(venueId,deviceType);
|
||||
showToast("设置成功!");
|
||||
onGoToMainAction();
|
||||
}
|
||||
|
||||
public void onGoToMainAction(){
|
||||
finish();
|
||||
}
|
||||
|
||||
@OnClick({R.id.back_button,R.id.confirm_button}) void OnClick(View view){
|
||||
switch (view.getId()){
|
||||
case R.id.back_button:
|
||||
this.onGoToMainAction();
|
||||
break;
|
||||
case R.id.confirm_button:
|
||||
setConfig();
|
||||
}
|
||||
ButterKnife.bind(this);
|
||||
initSpinner();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -55,4 +43,82 @@ public class SDSettingActivity extends SDBaseActivity {
|
||||
super.onBackPressed();
|
||||
this.onGoToMainAction();
|
||||
}
|
||||
|
||||
@OnClick({R.id.iv_back, R.id.confirm_button})
|
||||
public void OnClick(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.iv_back:
|
||||
this.onGoToMainAction();
|
||||
break;
|
||||
case R.id.confirm_button:
|
||||
setConfig();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void setConfig() {
|
||||
try {
|
||||
if (TextUtils.isEmpty(spinnerValue)) {
|
||||
showToast("未选择场馆!");
|
||||
return;
|
||||
}
|
||||
|
||||
Integer venueId = Integer.parseInt(spinnerValue);
|
||||
RadioButton radioButton = findCheckedRadioButton();
|
||||
|
||||
if (radioButton == null) {
|
||||
showToast("设置失败!请稍后尝试!");
|
||||
return;
|
||||
}
|
||||
|
||||
String deviceTypeStr = (String) radioButton.getTag();
|
||||
DeviceType deviceType = DeviceType.valueOf(deviceTypeStr);
|
||||
|
||||
SDAppConfig.getInstance().configSet(venueId, deviceType);
|
||||
showToast("设置成功!");
|
||||
onGoToMainAction();
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "setConfigError: ", e);
|
||||
showToast("设置失败!请稍后尝试!");
|
||||
}
|
||||
}
|
||||
|
||||
private RadioButton findCheckedRadioButton() {
|
||||
for (int i = 0; i < venueActionView.getChildCount(); i++) {
|
||||
RadioButton child = (RadioButton) venueActionView.getChildAt(i);
|
||||
if (child.isChecked()) {
|
||||
return child;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void onGoToMainAction() {
|
||||
finish();
|
||||
}
|
||||
|
||||
private void initSpinner() {
|
||||
// TESTCODE: wyb, 2020-07-29, 测试Spinner列表.
|
||||
// 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.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
spinnerValue = stringArray[position];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
});
|
||||
// TODO: wyb, 2020-07-29, 这里可以设置为当前场馆的index.
|
||||
venueCellView.setSelection(0, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,78 +13,126 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="65dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="15dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
|
||||
<WebView
|
||||
android:id="@+id/order_view"
|
||||
android:layout_margin="15dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_centerInParent="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginRight="15dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_refresh"
|
||||
android:text="刷新"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_last_day"
|
||||
android:layout_gravity="center"
|
||||
android:text="上一天"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_next_day"
|
||||
android:layout_gravity="right"
|
||||
android:text="下一天"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_margin="15dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/memberwitebgview"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
<TextView
|
||||
android:id="@+id/tv_tip"
|
||||
android:padding="15dp"
|
||||
android:gravity="center"
|
||||
android:lineSpacingExtra="10dp"
|
||||
tools:text="测试测试测试\n测试测试测试\n测试测试"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<FrameLayout
|
||||
android:paddingLeft="15dp"
|
||||
android:paddingRight="15dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:gravity="center"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="37dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/topInfoTextView"
|
||||
android:text="小程序二维码"
|
||||
android:textColor="@color/black"
|
||||
android:gravity="center"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/qr_code_iv_small"
|
||||
android:layout_marginTop="15dp"
|
||||
tools:src="@color/topInfoRed"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_gravity="right"
|
||||
android:gravity="center"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/top_line_info"
|
||||
android:textColor="@color/topInfoRed"
|
||||
android:textSize="18sp" />
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/welcome_label"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginRight="40dp"
|
||||
android:text="欢迎进场"
|
||||
android:textAlignment="center"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/count_down_label"
|
||||
android:text="进场二维码"
|
||||
android:textColor="@color/black"
|
||||
android:gravity="center"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:textSize="18sp" />
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sb_string_label"
|
||||
<FrameLayout
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/qr_code_iv_enter"
|
||||
android:layout_gravity="center"
|
||||
tools:src="@color/topInfoRed"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginRight="40dp"
|
||||
android:text="请注意,无出门记录再次申请入场本日内仅有一次机会"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#ff0000"
|
||||
android:textSize="15sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<android.support.v4.widget.ContentLoadingProgressBar
|
||||
android:id="@+id/qr_code_pb_cover"
|
||||
tools:visibility="visible"
|
||||
android:visibility="gone"
|
||||
android:background="#99000000"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -1,101 +1,101 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".setting.SDSettingActivity"
|
||||
android:background="@color/bg_color"
|
||||
android:orientation="vertical">
|
||||
<RelativeLayout
|
||||
android:orientation="vertical"
|
||||
tools:context=".setting.SDSettingActivity">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:background="@color/white">
|
||||
<RelativeLayout
|
||||
android:id="@+id/back_button"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="15dp"
|
||||
android:layout_height="25dp"
|
||||
android:src="@mipmap/app_img_ico_back"
|
||||
android:layout_centerInParent="true"/>
|
||||
</RelativeLayout>
|
||||
android:id="@+id/iv_back"
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:src="@mipmap/app_img_ico_back" />
|
||||
|
||||
<TextView
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/setting"
|
||||
android:layout_centerInParent="true"
|
||||
android:textSize="18sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="30dp"
|
||||
android:paddingLeft="10dp">
|
||||
<TextView
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/camera_setting_type_title"
|
||||
android:layout_centerVertical="true"/>
|
||||
</RelativeLayout>
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:id="@+id/venue_cell"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="52"
|
||||
android:textSize="20dp"
|
||||
android:textStyle="bold"
|
||||
android:layout_weight="1"/>
|
||||
</LinearLayout>
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="@string/camera_setting_type_title" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/venue_cell"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:spinnerMode="dropdown"
|
||||
tools:entries="@array/setting_spinner_test_list" />
|
||||
|
||||
</RelativeLayout>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:background="@color/color_gray"></View>
|
||||
<RelativeLayout
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/color_gray"/>
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/venue_action"
|
||||
android:layout_margin="10dp"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:gravity="center_vertical">
|
||||
<TextView
|
||||
android:id="@+id/device_type_cell"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="ENTER"
|
||||
android:textSize="20dp"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<RadioButton
|
||||
android:textColor="@color/black"
|
||||
android:tag="ENTER"
|
||||
android:textStyle="bold"
|
||||
android:layout_weight="1"/>
|
||||
</LinearLayout>
|
||||
android:textSize="20sp"
|
||||
android:text="进场"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</RelativeLayout>
|
||||
<RadioButton
|
||||
android:textColor="@color/black"
|
||||
android:tag="OUT"
|
||||
android:textStyle="bold"
|
||||
android:textSize="20sp"
|
||||
android:text="出场"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</RadioGroup>
|
||||
|
||||
</LinearLayout>
|
||||
<Button
|
||||
android:text="确定变更"
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:id="@+id/confirm_button"/>
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/color_gray"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/confirm_button"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="@color/color_gray"
|
||||
android:text="确定变更" />
|
||||
|
||||
</LinearLayout>
|
||||
11
app/src/main/res/layout/item_setting_spinner.xml
Normal file
11
app/src/main/res/layout/item_setting_spinner.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:gravity="left"
|
||||
android:textSize="20sp"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="bold"
|
||||
tools:text="测试场馆1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
@@ -6,4 +6,13 @@
|
||||
<string name="camera_setting_type_title">请选择场馆,以及门禁类型</string>
|
||||
<string name="stranger_info_string">您好 \n 您尚未注册成为本智能运动场用户 \n请扫描门禁上张贴的场馆二维码进行注册后再试</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>
|
||||
|
||||
Reference in New Issue
Block a user