设置页面,主页修复
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package com.ydd.sportfaceid;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.net.Uri;
|
||||
import android.os.CountDownTimer;
|
||||
import android.os.Handler;
|
||||
import android.os.Bundle;
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.tencent.bugly.Bugly;
|
||||
import com.ydd.sportfaceid.config.SDAppConfig;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,21 @@
|
||||
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 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";
|
||||
/**
|
||||
* 场馆ID
|
||||
*/
|
||||
@@ -25,10 +34,34 @@ public class SDAppConfig {
|
||||
public void init(Context context){
|
||||
this.mContext = context;
|
||||
synchronized (SDAppConfig.class){
|
||||
// Do SomeThing
|
||||
if (sp == null){
|
||||
sp = this.mContext.getSharedPreferences(KEY_CACHE, Context.MODE_PRIVATE);
|
||||
sp_editor = sp.edit();
|
||||
configData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void configData(){
|
||||
Integer storeVenueId = sp.getInt(STORE_VENUE, 0);
|
||||
if (storeVenueId != null){
|
||||
this.venueId = storeVenueId;
|
||||
}
|
||||
String storeType = sp.getString(STORE_DEVICE_TYPE, "ENTER");
|
||||
if (!TextUtils.isEmpty(storeType)){
|
||||
this.deviceType = DeviceType.valueOf(storeType);
|
||||
}
|
||||
configSet(venueId,deviceType);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
public Integer getVenueId() {
|
||||
return venueId;
|
||||
}
|
||||
|
||||
@@ -21,14 +21,6 @@ public class SDSettingActivity extends SDBaseActivity {
|
||||
@BindView(R.id.device_type_cell)
|
||||
TextView device_type_cell;
|
||||
|
||||
|
||||
private Integer venueId;
|
||||
/**
|
||||
* 设备类型 ENTER / OUT
|
||||
*/
|
||||
private String deviceType;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -38,15 +30,14 @@ public class SDSettingActivity extends SDBaseActivity {
|
||||
private void setConfig(){
|
||||
Integer venueId = Integer.parseInt(venue_cell.getText().toString());
|
||||
DeviceType deviceType = DeviceType.valueOf(device_type_cell.getText().toString());
|
||||
SDAppConfig.getInstance().setVenueId(venueId);
|
||||
SDAppConfig.getInstance().setDeviceType(deviceType);
|
||||
SDAppConfig.getInstance().configSet(venueId,deviceType);
|
||||
}
|
||||
|
||||
public void onGoToMainAction(){
|
||||
finish();
|
||||
}
|
||||
|
||||
@OnClick({R.id.back_button,R.id.confirm_button}) void onCilck(View view){
|
||||
@OnClick({R.id.back_button,R.id.confirm_button}) void OnClick(View view){
|
||||
switch (view.getId()){
|
||||
case R.id.back_button:
|
||||
this.onGoToMainAction();
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
package com.ydd.sportfaceid.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -46,40 +42,18 @@ public class SDGustInfoView extends RelativeLayout {
|
||||
@BindView(R.id.date_label)
|
||||
TextView date_label;
|
||||
|
||||
@BindView(R.id.app_member_name_label)
|
||||
TextView app_member_name_label;
|
||||
|
||||
private Timer mTimerOutput;
|
||||
|
||||
public void setLogo(String logo) {
|
||||
this.logo = logo;
|
||||
|
||||
}
|
||||
|
||||
private String logo;
|
||||
|
||||
public void setMemberName(String memberName) {
|
||||
this.app_member_name_label.setText(memberName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public SDGustInfoView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
this.mContext = context;
|
||||
LayoutInflater.from(context).inflate(R.layout.layout_guest_info_top, this);
|
||||
ButterKnife.bind(this);
|
||||
configView();
|
||||
sdConfigData();
|
||||
startRunUpdateTime();
|
||||
|
||||
}
|
||||
|
||||
public void configView(){
|
||||
|
||||
this.app_member_name_label.setText("");
|
||||
}
|
||||
|
||||
public void sdConfigData(){
|
||||
Date now_date = new Date();
|
||||
SimpleDateFormat time_format =new SimpleDateFormat("HH:mm");
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<com.ydd.sportfaceid.view.SDGustInfoView
|
||||
android:id="@+id/gust_info_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="65dp"></com.ydd.sportfaceid.view.SDGustInfoView>
|
||||
android:layout_height="65dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -49,16 +49,16 @@
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
<LinearLayout
|
||||
android:id="@+id/venue_cell"
|
||||
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="这里整一个下拉框,选场馆"
|
||||
android:text="52"
|
||||
android:textSize="20dp"
|
||||
android:textStyle="bold"
|
||||
android:layout_weight="1"/>
|
||||
@@ -74,15 +74,15 @@
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
<LinearLayout
|
||||
android:id="@+id/device_type_cell"
|
||||
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="这里整一个下拉框,只能选出场、进场"
|
||||
android:text="ENTER"
|
||||
android:textSize="20dp"
|
||||
android:textStyle="bold"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
@@ -16,29 +16,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/ico_app_logo"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/app_member_name_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="###"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="30dp"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=""
|
||||
android:layout_centerInParent="true"
|
||||
android:textColor="@color/white"
|
||||
android:textStyle="bold"
|
||||
android:textSize="20sp"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
Reference in New Issue
Block a user