|
@@ -1,8 +1,11 @@
|
|
package com.sunzee.ui.activity;
|
|
package com.sunzee.ui.activity;
|
|
|
|
|
|
import android.annotation.SuppressLint;
|
|
import android.annotation.SuppressLint;
|
|
|
|
+import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.content.Intent;
|
|
|
|
+import android.graphics.Bitmap;
|
|
import android.graphics.Color;
|
|
import android.graphics.Color;
|
|
|
|
+import android.graphics.Typeface;
|
|
import android.os.Bundle;
|
|
import android.os.Bundle;
|
|
import android.os.Handler;
|
|
import android.os.Handler;
|
|
import android.support.annotation.Nullable;
|
|
import android.support.annotation.Nullable;
|
|
@@ -18,16 +21,21 @@ import android.view.Gravity;
|
|
import android.view.KeyEvent;
|
|
import android.view.KeyEvent;
|
|
import android.view.MenuItem;
|
|
import android.view.MenuItem;
|
|
import android.view.View;
|
|
import android.view.View;
|
|
|
|
+import android.view.ViewGroup;
|
|
import android.view.WindowManager;
|
|
import android.view.WindowManager;
|
|
|
|
+import android.widget.Button;
|
|
|
|
+import android.widget.ImageView;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.TextView;
|
|
import android.widget.TextView;
|
|
|
|
|
|
|
|
+import com.bumptech.glide.Glide;
|
|
|
|
+import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
|
|
|
+import com.bumptech.glide.request.RequestOptions;
|
|
import com.hboxs.serialport.frame.ResponseFrame;
|
|
import com.hboxs.serialport.frame.ResponseFrame;
|
|
import com.hboxs.serialport.message.Message;
|
|
import com.hboxs.serialport.message.Message;
|
|
import com.hboxs.serialport.util.AsciiUtils;
|
|
import com.hboxs.serialport.util.AsciiUtils;
|
|
import com.orhanobut.hawk.Hawk;
|
|
import com.orhanobut.hawk.Hawk;
|
|
import com.sunzee.R;
|
|
import com.sunzee.R;
|
|
-import com.sunzee.adapter.DebugParameterXAdapter;
|
|
|
|
import com.sunzee.adapter.HomePageAAdapter;
|
|
import com.sunzee.adapter.HomePageAAdapter;
|
|
import com.sunzee.base.BaseApplication;
|
|
import com.sunzee.base.BaseApplication;
|
|
import com.sunzee.base.MvpActivity;
|
|
import com.sunzee.base.MvpActivity;
|
|
@@ -37,26 +45,35 @@ import com.sunzee.model.HoleInformation;
|
|
import com.sunzee.model.domain.CleaningBean;
|
|
import com.sunzee.model.domain.CleaningBean;
|
|
import com.sunzee.model.domain.Name;
|
|
import com.sunzee.model.domain.Name;
|
|
import com.sunzee.model.domain.ParameterBean;
|
|
import com.sunzee.model.domain.ParameterBean;
|
|
|
|
+import com.sunzee.model.message.ApiMessageEvent;
|
|
import com.sunzee.mvp.homeactivity.HomePageAPresenter;
|
|
import com.sunzee.mvp.homeactivity.HomePageAPresenter;
|
|
import com.sunzee.mvp.homeactivity.HomePageAView;
|
|
import com.sunzee.mvp.homeactivity.HomePageAView;
|
|
import com.sunzee.service.MyService;
|
|
import com.sunzee.service.MyService;
|
|
import com.sunzee.thread.advanceparameter.ThreadPoolAdvanceParameter;
|
|
import com.sunzee.thread.advanceparameter.ThreadPoolAdvanceParameter;
|
|
import com.sunzee.thread.homepageA.homepage.ThreadPoolHomepageA;
|
|
import com.sunzee.thread.homepageA.homepage.ThreadPoolHomepageA;
|
|
|
|
+import com.sunzee.ui.view.CustomSketchMapView;
|
|
|
|
+import com.sunzee.ui.view.CustomView;
|
|
|
|
+import com.sunzee.ui.view.CustomViewGrounp;
|
|
|
|
+import com.sunzee.ui.view.CustomViewSketchMapGrounp;
|
|
import com.sunzee.utils.AdvacedUtil;
|
|
import com.sunzee.utils.AdvacedUtil;
|
|
import com.sunzee.utils.GeTuiUtil;
|
|
import com.sunzee.utils.GeTuiUtil;
|
|
import com.sunzee.utils.HexadecimalUtil;
|
|
import com.sunzee.utils.HexadecimalUtil;
|
|
import com.sunzee.utils.LongClickUtils;
|
|
import com.sunzee.utils.LongClickUtils;
|
|
|
|
+import com.sunzee.utils.PreventSpeedClickUtil;
|
|
import com.sunzee.utils.ToastUtil;
|
|
import com.sunzee.utils.ToastUtil;
|
|
import com.sunzee.utils.UiUtil;
|
|
import com.sunzee.utils.UiUtil;
|
|
|
|
+import com.wuxiaolong.androidutils.library.LogUtil;
|
|
|
|
|
|
import org.greenrobot.eventbus.EventBus;
|
|
import org.greenrobot.eventbus.EventBus;
|
|
import org.greenrobot.eventbus.Subscribe;
|
|
import org.greenrobot.eventbus.Subscribe;
|
|
import org.greenrobot.eventbus.ThreadMode;
|
|
import org.greenrobot.eventbus.ThreadMode;
|
|
|
|
|
|
|
|
+import java.io.ByteArrayOutputStream;
|
|
import java.lang.ref.WeakReference;
|
|
import java.lang.ref.WeakReference;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
import java.util.Timer;
|
|
import java.util.Timer;
|
|
import java.util.TimerTask;
|
|
import java.util.TimerTask;
|
|
|
|
|
|
@@ -96,23 +113,56 @@ public class HomePageAActivity extends MvpActivity<HomePageAPresenter> implement
|
|
private LinearLayout llSigin;
|
|
private LinearLayout llSigin;
|
|
private RecyclerView rvToiletState;
|
|
private RecyclerView rvToiletState;
|
|
private HomePageAAdapter homePageAAdapter;
|
|
private HomePageAAdapter homePageAAdapter;
|
|
|
|
+ private ImageView ivSigninCode;
|
|
|
|
+ private LinearLayout llSigninCodeError;
|
|
|
|
+ private Button btnFlushCheckCode;
|
|
|
|
+ private TextView mTvCommit;
|
|
|
|
+ private static boolean sIsLocation = false;
|
|
|
|
+ private Boolean wcLocaltion;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
super.onCreate(savedInstanceState);
|
|
super.onCreate(savedInstanceState);
|
|
- setContentView(R.layout.activity_homeactivity);
|
|
|
|
|
|
+ setContentView(R.layout.activity_homeactivity25d);
|
|
EventBus.getDefault().register(this);
|
|
EventBus.getDefault().register(this);
|
|
//打开个推
|
|
//打开个推
|
|
mGeTuiUtil = new GeTuiUtil(this);
|
|
mGeTuiUtil = new GeTuiUtil(this);
|
|
mGeTuiUtil.geTui();
|
|
mGeTuiUtil.geTui();
|
|
initView();
|
|
initView();
|
|
|
|
+ initViewCV();
|
|
initEvent();
|
|
initEvent();
|
|
//获取实际屏幕参数
|
|
//获取实际屏幕参数
|
|
WindowManager manager = this.getWindowManager();
|
|
WindowManager manager = this.getWindowManager();
|
|
DisplayMetrics outMetrics = new DisplayMetrics();
|
|
DisplayMetrics outMetrics = new DisplayMetrics();
|
|
manager.getDefaultDisplay().getMetrics(outMetrics);
|
|
manager.getDefaultDisplay().getMetrics(outMetrics);
|
|
|
|
+ mvpPresenter.getCheckCode();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private CustomViewSketchMapGrounp mCustomViewGrounp;
|
|
|
|
+
|
|
|
|
+ private void initViewCV() {
|
|
|
|
+ //为控件设置数据
|
|
|
|
+ mCustomViewGrounp = findViewById(R.id.cv_custom);
|
|
|
|
+ List<String> list = new ArrayList<>();
|
|
|
|
+ for (int i = 0; i < MyService.TOTAL_SUM + 1; i++) {//厕所个数可控。
|
|
|
|
+ list.add(i + 1 + "");
|
|
|
|
+ }
|
|
|
|
+ mCustomViewGrounp.setTextList(list);
|
|
|
|
+ Map<String, List<Float>> location = Hawk.get("wc_location", null);
|
|
|
|
+ if (location != null) {
|
|
|
|
+ for (int i = 0; i < mCustomViewGrounp.getChildCount(); i++) {
|
|
|
|
+ List list1 = location.get(i + "");
|
|
|
|
+ if (list1 == null) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ View childAt = mCustomViewGrounp.getChildAt(i);
|
|
|
|
+ childAt.setX(Float.valueOf(String.valueOf(list1.get(0))));
|
|
|
|
+ childAt.setY(Float.valueOf(String.valueOf(list1.get(1))));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
private void initEvent() {
|
|
private void initEvent() {
|
|
//长按事件
|
|
//长按事件
|
|
LongClickUtils.setLongClick(new Handler(), tvDate, 2000, new View.OnLongClickListener() {
|
|
LongClickUtils.setLongClick(new Handler(), tvDate, 2000, new View.OnLongClickListener() {
|
|
@@ -137,7 +187,7 @@ public class HomePageAActivity extends MvpActivity<HomePageAPresenter> implement
|
|
@Override
|
|
@Override
|
|
public void onClick(View v) {
|
|
public void onClick(View v) {
|
|
drawerLayout.openDrawer(Gravity.LEFT);
|
|
drawerLayout.openDrawer(Gravity.LEFT);
|
|
- Log.d(TAG, "openDrawer: "+navigationView.isSelected());
|
|
|
|
|
|
+ Log.d(TAG, "openDrawer: " + navigationView.isSelected());
|
|
}
|
|
}
|
|
});
|
|
});
|
|
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawerLayout,
|
|
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawerLayout,
|
|
@@ -158,6 +208,47 @@ public class HomePageAActivity extends MvpActivity<HomePageAPresenter> implement
|
|
}
|
|
}
|
|
};
|
|
};
|
|
drawerLayout.addDrawerListener(toggle);
|
|
drawerLayout.addDrawerListener(toggle);
|
|
|
|
+ btnFlushCheckCode.setOnClickListener(new View.OnClickListener() {
|
|
|
|
+ @Override
|
|
|
|
+ public void onClick(View v) {
|
|
|
|
+ //防止快速点击
|
|
|
|
+ if (!PreventSpeedClickUtil.isFastClick()) {
|
|
|
|
+ ToastUtil.showToast("点击过快!!!");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ mvpPresenter.getCheckCode();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ mTvCommit.setOnClickListener(new View.OnClickListener() {
|
|
|
|
+ @Override
|
|
|
|
+ public void onClick(View v) {
|
|
|
|
+ //保存位置
|
|
|
|
+ Map<String, List<Float>> integerMap = mCustomViewGrounp.getIntegerMap1();
|
|
|
|
+ if (integerMap.size() == 0) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ Map<String, List<Float>> location = Hawk.get("wc_location", null);
|
|
|
|
+ if (location != null) {
|
|
|
|
+ //给控件新位置,替换之前的位置。
|
|
|
|
+ for (String s : location.keySet()) {
|
|
|
|
+ if (integerMap.containsKey(s)) {
|
|
|
|
+ location.put(s, integerMap.get(s));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //没有变化过位置的也加进去。
|
|
|
|
+ for (String s : integerMap.keySet()) {
|
|
|
|
+ if (!location.containsKey(s)) {
|
|
|
|
+ location.put(s, integerMap.get(s));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Hawk.put("wc_location", location);
|
|
|
|
+ } else {
|
|
|
|
+ Hawk.put("wc_location", integerMap);
|
|
|
|
+ }
|
|
|
|
+ ToastUtil.showToast("保存成功");
|
|
|
|
+ }
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
private Timer timerSigin;
|
|
private Timer timerSigin;
|
|
@@ -172,10 +263,10 @@ public class HomePageAActivity extends MvpActivity<HomePageAPresenter> implement
|
|
myHandler.sendEmptyMessage(4);
|
|
myHandler.sendEmptyMessage(4);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
- timerSigin.schedule(timeSiginTimerTak,60*1000);
|
|
|
|
|
|
+ timerSigin.schedule(timeSiginTimerTak, 60 * 1000);
|
|
}
|
|
}
|
|
|
|
|
|
- private void stopSigin(){
|
|
|
|
|
|
+ private void stopSigin() {
|
|
if (timerSigin != null) {
|
|
if (timerSigin != null) {
|
|
timerSigin.cancel();
|
|
timerSigin.cancel();
|
|
timerSigin = null;
|
|
timerSigin = null;
|
|
@@ -186,9 +277,23 @@ public class HomePageAActivity extends MvpActivity<HomePageAPresenter> implement
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public static void applyFont(final Context context, final View root, final String fontName) {
|
|
|
|
+ try {
|
|
|
|
+ if (root instanceof ViewGroup) {
|
|
|
|
+ ViewGroup viewGroup = (ViewGroup) root;
|
|
|
|
+ for (int i = 0; i < viewGroup.getChildCount(); i++)
|
|
|
|
+ applyFont(context, viewGroup.getChildAt(i), fontName);
|
|
|
|
+ } else if (root instanceof TextView)
|
|
|
|
+ ((TextView) root).setTypeface(Typeface.createFromAsset(context.getAssets(), fontName));
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ Log.e(TAG, String.format("Error occured when trying to apply %s font for %s view", fontName, root));
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
private void initView() {
|
|
private void initView() {
|
|
|
|
+ btnFlushCheckCode = findViewById(R.id.btn_refresh_signin_code);
|
|
myHandler = new MyHandler(this);
|
|
myHandler = new MyHandler(this);
|
|
mTvTime = findViewById(R.id.tv_time1);
|
|
mTvTime = findViewById(R.id.tv_time1);
|
|
tvDate = findViewById(R.id.tv_date);
|
|
tvDate = findViewById(R.id.tv_date);
|
|
@@ -197,6 +302,7 @@ public class HomePageAActivity extends MvpActivity<HomePageAPresenter> implement
|
|
tvWcUser = findViewById(R.id.tv_wcuser);
|
|
tvWcUser = findViewById(R.id.tv_wcuser);
|
|
tvWcEmpty = findViewById(R.id.tv_wcempty);
|
|
tvWcEmpty = findViewById(R.id.tv_wcempty);
|
|
tvWashingTime = findViewById(R.id.tv_washingtime);
|
|
tvWashingTime = findViewById(R.id.tv_washingtime);
|
|
|
|
+
|
|
tvIn = findViewById(R.id.tv_in);
|
|
tvIn = findViewById(R.id.tv_in);
|
|
tvYesterday = findViewById(R.id.tv_yesterday);
|
|
tvYesterday = findViewById(R.id.tv_yesterday);
|
|
tvOut = findViewById(R.id.tv_out);
|
|
tvOut = findViewById(R.id.tv_out);
|
|
@@ -207,6 +313,15 @@ public class HomePageAActivity extends MvpActivity<HomePageAPresenter> implement
|
|
tvCompany = findViewById(R.id.tv_company);
|
|
tvCompany = findViewById(R.id.tv_company);
|
|
tvContacts = findViewById(R.id.tv_contacts);
|
|
tvContacts = findViewById(R.id.tv_contacts);
|
|
llSigin = findViewById(R.id.ll_sigin);
|
|
llSigin = findViewById(R.id.ll_sigin);
|
|
|
|
+ ivSigninCode = findViewById(R.id.iv_signin_code);
|
|
|
|
+ llSigninCodeError = findViewById(R.id.ll_signin_code_error);
|
|
|
|
+ mTvCommit = findViewById(R.id.tv_commit);
|
|
|
|
+ wcLocaltion = Hawk.get(Name.WCLOCALTION, false);
|
|
|
|
+ if (wcLocaltion) {
|
|
|
|
+ mTvCommit.setVisibility(View.VISIBLE);
|
|
|
|
+ } else {
|
|
|
|
+ mTvCommit.setVisibility(View.GONE);
|
|
|
|
+ }
|
|
//设备编号只显示6位
|
|
//设备编号只显示6位
|
|
mTvEquipmentNo = findViewById(R.id.tv_equipment_no1);
|
|
mTvEquipmentNo = findViewById(R.id.tv_equipment_no1);
|
|
if (Heartbeat.deviceId != null && Heartbeat.deviceId.length() > 7) {
|
|
if (Heartbeat.deviceId != null && Heartbeat.deviceId.length() > 7) {
|
|
@@ -225,8 +340,8 @@ public class HomePageAActivity extends MvpActivity<HomePageAPresenter> implement
|
|
threadPoolHomepageA.stopAll();
|
|
threadPoolHomepageA.stopAll();
|
|
threadPoolHomepageA.startAll();
|
|
threadPoolHomepageA.startAll();
|
|
mvpPresenter.createBox(MyService.TOTAL_SUM);
|
|
mvpPresenter.createBox(MyService.TOTAL_SUM);
|
|
- tvCompany.setText("公司:"+Hawk.get(Name.COMPANY,""));
|
|
|
|
- tvContacts.setText("联系人:"+Hawk.get(Name.WAYCONTACTS,""));
|
|
|
|
|
|
+ tvCompany.setText("公司:" + Hawk.get(Name.COMPANY, ""));
|
|
|
|
+ tvContacts.setText("联系人:" + Hawk.get(Name.WAYCONTACTS, ""));
|
|
|
|
|
|
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
|
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
|
navigationView = (NavigationView) findViewById(R.id.navigation_view);
|
|
navigationView = (NavigationView) findViewById(R.id.navigation_view);
|
|
@@ -243,10 +358,19 @@ public class HomePageAActivity extends MvpActivity<HomePageAPresenter> implement
|
|
homePageAAdapter = new HomePageAAdapter(MyService.sHoleInformationList);
|
|
homePageAAdapter = new HomePageAAdapter(MyService.sHoleInformationList);
|
|
rvToiletState.setAdapter(homePageAAdapter);
|
|
rvToiletState.setAdapter(homePageAAdapter);
|
|
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ //设置字体
|
|
|
|
+ applyFont(this, tvWashingTime, "fonts/impact.ttf");
|
|
|
|
+ applyFont(this, tvIn, "fonts/impact.ttf");
|
|
|
|
+ applyFont(this, tvOut, "fonts/impact.ttf");
|
|
|
|
+ applyFont(this, tvAmmonia, "fonts/impact.ttf");
|
|
|
|
+ applyFont(this, tvWcUser, "fonts/impact.ttf");
|
|
|
|
+ applyFont(this, tvWcEmpty, "fonts/impact.ttf");
|
|
|
|
+ applyFont(this, tvWcToilets, "fonts/impact.ttf");
|
|
|
|
+ applyFont(this, tvHumidity, "fonts/impact.ttf");
|
|
|
|
+ applyFont(this, tvTemperature, "fonts/impact.ttf");
|
|
|
|
+ applyFont(this, tvDate, "fonts/impact.ttf");
|
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -268,6 +392,32 @@ public class HomePageAActivity extends MvpActivity<HomePageAPresenter> implement
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
+ public void showCheckCode(String data) {
|
|
|
|
+ if (mvpPresenter.isBase64Img(data)) {
|
|
|
|
+ Bitmap bitmap = mvpPresenter.stringToBitmap(data);
|
|
|
|
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
|
|
|
+ bitmap.compress(Bitmap.CompressFormat.PNG, 100, baos);
|
|
|
|
+ byte[] bytes = baos.toByteArray();
|
|
|
|
+ //禁止缓存
|
|
|
|
+ RequestOptions options = new RequestOptions()
|
|
|
|
+ .diskCacheStrategy(DiskCacheStrategy.NONE)
|
|
|
|
+ .skipMemoryCache(true);
|
|
|
|
+ Glide.with(BaseApplication.getContext())
|
|
|
|
+ .load(bytes)
|
|
|
|
+ .apply(options)
|
|
|
|
+ .into(ivSigninCode);
|
|
|
|
+ ivSigninCode.setVisibility(View.VISIBLE);
|
|
|
|
+ llSigninCodeError.setVisibility(View.GONE);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void getCheckCodeError() {
|
|
|
|
+ ivSigninCode.setVisibility(View.GONE);
|
|
|
|
+ llSigninCodeError.setVisibility(View.VISIBLE);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
protected void onStop() {
|
|
protected void onStop() {
|
|
super.onStop();
|
|
super.onStop();
|
|
Log.d(TAG, "onStoponStop: ");
|
|
Log.d(TAG, "onStoponStop: ");
|
|
@@ -309,6 +459,15 @@ public class HomePageAActivity extends MvpActivity<HomePageAPresenter> implement
|
|
}
|
|
}
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
|
+ public void event(ApiMessageEvent messageEvent) {
|
|
|
|
+ switch (messageEvent.getName()) {
|
|
|
|
+ case "signed":
|
|
|
|
+ mvpPresenter.getCheckCode();
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Subscribe(threadMode = ThreadMode.MAIN)
|
|
public void event(Message messageEvent) {
|
|
public void event(Message messageEvent) {
|
|
switch (messageEvent.getType()) {
|
|
switch (messageEvent.getType()) {
|
|
case connected:
|
|
case connected:
|
|
@@ -386,6 +545,7 @@ public class HomePageAActivity extends MvpActivity<HomePageAPresenter> implement
|
|
return advertisingPresenter;
|
|
return advertisingPresenter;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 主要用于更新系统时间
|
|
* 主要用于更新系统时间
|
|
*/
|
|
*/
|
|
@@ -413,11 +573,23 @@ public class HomePageAActivity extends MvpActivity<HomePageAPresenter> implement
|
|
activity.tvWcUser.setText(activity.use + "");
|
|
activity.tvWcUser.setText(activity.use + "");
|
|
activity.tvWcEmpty.setText(activity.empty + "");
|
|
activity.tvWcEmpty.setText(activity.empty + "");
|
|
//厕所示意图
|
|
//厕所示意图
|
|
- if (MyService.sHoleInformationList.size() >= 0) {
|
|
|
|
|
|
+ for (int i = 0; i < MyService.sHoleInformationList.size(); i++) {
|
|
|
|
+ getXValue(MyService.sHoleInformationList.get(i), i, activity.rvToiletState);
|
|
|
|
+ }
|
|
|
|
+ if (!wcLocaltion) {
|
|
for (int i = 0; i < MyService.sHoleInformationList.size(); i++) {
|
|
for (int i = 0; i < MyService.sHoleInformationList.size(); i++) {
|
|
- getXValue(MyService.sHoleInformationList.get(i),i,activity.rvToiletState);
|
|
|
|
|
|
+ CustomSketchMapView childAt = (CustomSketchMapView) mCustomViewGrounp.getChildAt(i);
|
|
|
|
+ HoleInformation holeInformation = MyService.sHoleInformationList.get(i);
|
|
|
|
+ if (holeInformation.isUserAndEmpty()) {
|
|
|
|
+ childAt.setText("有");
|
|
|
|
+ childAt.setVisibility(View.VISIBLE);
|
|
|
|
+ } else {
|
|
|
|
+ childAt.setText("无");
|
|
|
|
+ childAt.setVisibility(View.GONE);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
break;
|
|
break;
|
|
case 3://清洗次数的读取。
|
|
case 3://清洗次数的读取。
|
|
activity.tvIn.setText(activity.cleaningBean.getInCount());
|
|
activity.tvIn.setText(activity.cleaningBean.getInCount());
|
|
@@ -429,7 +601,7 @@ public class HomePageAActivity extends MvpActivity<HomePageAPresenter> implement
|
|
break;
|
|
break;
|
|
case 4:
|
|
case 4:
|
|
if (activity.drawerLayout != null) {
|
|
if (activity.drawerLayout != null) {
|
|
- activity. drawerLayout.closeDrawer(GravityCompat.START);
|
|
|
|
|
|
+ activity.drawerLayout.closeDrawer(GravityCompat.START);
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -440,7 +612,8 @@ public class HomePageAActivity extends MvpActivity<HomePageAPresenter> implement
|
|
*
|
|
*
|
|
* @param position 要改变的图片的位置
|
|
* @param position 要改变的图片的位置
|
|
*/
|
|
*/
|
|
- private void getXValue(HoleInformation holeInformation,int position, RecyclerView recyclerView) {
|
|
|
|
|
|
+ private void getXValue(HoleInformation holeInformation, int position, RecyclerView recyclerView) {
|
|
|
|
+ Log.d(TAG, "厕所" + position + "号," + (holeInformation.isUserAndEmpty() ? "有人" : "无人"));
|
|
View view = recyclerView.getLayoutManager().findViewByPosition(position);
|
|
View view = recyclerView.getLayoutManager().findViewByPosition(position);
|
|
if (view == null) {
|
|
if (view == null) {
|
|
Log.d("空1", "getXYValue: p=" + position + " index=" + position);
|
|
Log.d("空1", "getXYValue: p=" + position + " index=" + position);
|
|
@@ -507,20 +680,20 @@ public class HomePageAActivity extends MvpActivity<HomePageAPresenter> implement
|
|
@Override
|
|
@Override
|
|
public void run() {
|
|
public void run() {
|
|
//上传厕所状态
|
|
//上传厕所状态
|
|
- if (useLastToiletsStatus==null) {
|
|
|
|
|
|
+ if (useLastToiletsStatus == null) {
|
|
useLastToiletsStatus = new ArrayList<>();
|
|
useLastToiletsStatus = new ArrayList<>();
|
|
for (int i = 0; i < MyService.TOTAL_SUM; i++) {
|
|
for (int i = 0; i < MyService.TOTAL_SUM; i++) {
|
|
useLastToiletsStatus.add("5");
|
|
useLastToiletsStatus.add("5");
|
|
}
|
|
}
|
|
- return;
|
|
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
synchronized (MyService.sCleaningLocationList) {
|
|
synchronized (MyService.sCleaningLocationList) {
|
|
- if (MyService.sHoleInformationList != null&& MyService.sHoleInformationList.size()>0) {
|
|
|
|
|
|
+ if (MyService.sHoleInformationList != null && MyService.sHoleInformationList.size() > 0) {
|
|
for (int i = 0; i < MyService.TOTAL_SUM; i++) {
|
|
for (int i = 0; i < MyService.TOTAL_SUM; i++) {
|
|
String userStates = MyService.sHoleInformationList.get(i).getUserStates();
|
|
String userStates = MyService.sHoleInformationList.get(i).getUserStates();
|
|
if (!useLastToiletsStatus.get(i).equals(userStates)) {
|
|
if (!useLastToiletsStatus.get(i).equals(userStates)) {
|
|
- mvpPresenter.sendStatusOfToiletUse((i+1)+"号",userStates);
|
|
|
|
- useLastToiletsStatus.add(i,userStates);
|
|
|
|
|
|
+ mvpPresenter.sendStatusOfToiletUse((i + 1) + "号", userStates);
|
|
|
|
+ useLastToiletsStatus.add(i, userStates);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|