|
@@ -58,6 +58,7 @@ import com.sunzee.ui.view.CustomViewSketchMapGrounp;
|
|
|
import com.sunzee.utils.AdvacedUtil;
|
|
|
import com.sunzee.utils.GeTuiUtil;
|
|
|
import com.sunzee.utils.HexadecimalUtil;
|
|
|
+import com.sunzee.utils.LogUtils;
|
|
|
import com.sunzee.utils.LongClickUtils;
|
|
|
import com.sunzee.utils.PreventSpeedClickUtil;
|
|
|
import com.sunzee.utils.ToastUtil;
|
|
@@ -82,7 +83,7 @@ import java.util.TimerTask;
|
|
|
*/
|
|
|
public class HomePageAActivity extends MvpActivity<HomePageAPresenter> implements HomePageAView {
|
|
|
|
|
|
- private static final String TAG = "AdvertisingActivity";
|
|
|
+ private static final String TAG = "HomePageAActivity";
|
|
|
private GeTuiUtil mGeTuiUtil;
|
|
|
private TextView mTvTime;
|
|
|
private MyHandler myHandler;
|
|
@@ -117,14 +118,16 @@ public class HomePageAActivity extends MvpActivity<HomePageAPresenter> implement
|
|
|
private LinearLayout llSigninCodeError;
|
|
|
private Button btnFlushCheckCode;
|
|
|
private TextView mTvCommit;
|
|
|
- private static boolean sIsLocation = false;
|
|
|
private Boolean wcLocaltion;
|
|
|
+ private ImageView ivSketChmap;
|
|
|
|
|
|
@Override
|
|
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
|
super.onCreate(savedInstanceState);
|
|
|
setContentView(R.layout.activity_homeactivity25d);
|
|
|
- EventBus.getDefault().register(this);
|
|
|
+// setContentView(R.layout.activity_homeactivity);
|
|
|
+ if (!EventBus.getDefault().isRegistered(this))
|
|
|
+ EventBus.getDefault().register(this);
|
|
|
//打开个推
|
|
|
mGeTuiUtil = new GeTuiUtil(this);
|
|
|
mGeTuiUtil.geTui();
|
|
@@ -136,14 +139,22 @@ public class HomePageAActivity extends MvpActivity<HomePageAPresenter> implement
|
|
|
DisplayMetrics outMetrics = new DisplayMetrics();
|
|
|
manager.getDefaultDisplay().getMetrics(outMetrics);
|
|
|
mvpPresenter.getCheckCode();
|
|
|
+ Log.d(TAG, "on1Create: ");
|
|
|
}
|
|
|
|
|
|
private CustomViewSketchMapGrounp mCustomViewGrounp;
|
|
|
|
|
|
+ @Override
|
|
|
+ protected void onStart() {
|
|
|
+ super.onStart();
|
|
|
+ Log.d(TAG, "on1Start: ");
|
|
|
+ }
|
|
|
+
|
|
|
private void initViewCV() {
|
|
|
//为控件设置数据
|
|
|
mCustomViewGrounp = findViewById(R.id.cv_custom);
|
|
|
List<String> list = new ArrayList<>();
|
|
|
+ Log.d(TAG, "initViewCV111: "+MyService.TOTAL_SUM);
|
|
|
for (int i = 0; i < MyService.TOTAL_SUM + 1; i++) {//厕所个数可控。
|
|
|
list.add(i + 1 + "");
|
|
|
}
|
|
@@ -314,8 +325,12 @@ public class HomePageAActivity extends MvpActivity<HomePageAPresenter> implement
|
|
|
tvContacts = findViewById(R.id.tv_contacts);
|
|
|
llSigin = findViewById(R.id.ll_sigin);
|
|
|
ivSigninCode = findViewById(R.id.iv_signin_code);
|
|
|
+ ivSketChmap = findViewById(R.id.iv_sketchmap);
|
|
|
llSigninCodeError = findViewById(R.id.ll_signin_code_error);
|
|
|
mTvCommit = findViewById(R.id.tv_commit);
|
|
|
+ Log.d(TAG, "sketchmapinitView: " + UiUtil.getResId(Hawk.get(Name.WCTHEMENAME, "sketchmap"), R.drawable.class));
|
|
|
+ Log.d(TAG, "sketchmapinitView: " + R.drawable.sketchmap);
|
|
|
+ ivSketChmap.setImageResource(UiUtil.getResId(Hawk.get(Name.WCTHEMENAME, "sketchmap"), R.drawable.class));
|
|
|
wcLocaltion = Hawk.get(Name.WCLOCALTION, false);
|
|
|
if (wcLocaltion) {
|
|
|
mTvCommit.setVisibility(View.VISIBLE);
|
|
@@ -420,19 +435,19 @@ public class HomePageAActivity extends MvpActivity<HomePageAPresenter> implement
|
|
|
@Override
|
|
|
protected void onStop() {
|
|
|
super.onStop();
|
|
|
- Log.d(TAG, "onStoponStop: ");
|
|
|
-
|
|
|
+ Log.d(TAG, "on1StoponStop: ");
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
protected void onDestroy() {
|
|
|
super.onDestroy();
|
|
|
- EventBus.getDefault().unregister(this);
|
|
|
stopRefreshTime();
|
|
|
mPoolAdvanceParameter.stopAll();
|
|
|
threadPoolHomepageA.stopALLRead();
|
|
|
myHandler.removeCallbacksAndMessages(null);
|
|
|
myHandler = null;
|
|
|
+ Log.d(TAG, "on1Destroy: ");
|
|
|
+ EventBus.getDefault().unregister(this);
|
|
|
}
|
|
|
|
|
|
private long mPressTime = 0L;
|
|
@@ -501,16 +516,16 @@ public class HomePageAActivity extends MvpActivity<HomePageAPresenter> implement
|
|
|
tvHumidity.setText(Heartbeat.cabinetHd + "%");
|
|
|
} else if ("D172".equals(name)) {
|
|
|
try {
|
|
|
- Integer integer = Integer.valueOf(getRealData(results));
|
|
|
- if (integer < 0) {
|
|
|
- Heartbeat.odorConcentration = 0;
|
|
|
+ String realData = getRealData(results);
|
|
|
+// Integer integer = Integer.valueOf(getRealData(results));
|
|
|
+ if ("0".equals(realData)) {
|
|
|
+ Heartbeat.odorConcentration = "0";
|
|
|
} else {
|
|
|
- Heartbeat.odorConcentration = integer;
|
|
|
+ Heartbeat.odorConcentration = realData;
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
}
|
|
|
- ;
|
|
|
- tvAmmonia.setText(Heartbeat.odorConcentration + "");
|
|
|
+ tvAmmonia.setText(Heartbeat.odorConcentration);
|
|
|
} else {
|
|
|
mvpPresenter.setAdvanced(name, results, mPoolAdvanceParameter);
|
|
|
}
|
|
@@ -525,11 +540,13 @@ public class HomePageAActivity extends MvpActivity<HomePageAPresenter> implement
|
|
|
String s = String.valueOf(HexadecimalUtil.hex2dec(results.get(0)));
|
|
|
Integer integer = Integer.valueOf(s);
|
|
|
long l = HexadecimalUtil.hex2dec(results.get(0));
|
|
|
+ double d = l / 10.0D;//得出小数点
|
|
|
//2进制
|
|
|
String s1 = Integer.toBinaryString(integer);
|
|
|
if (s1.length() < 16) {
|
|
|
//正数
|
|
|
- realData = String.valueOf(Math.round((l / Global.num) * 10));
|
|
|
+ // realData = String.valueOf(Math.round((l / Global.num) * 10));错误的
|
|
|
+ realData = String.valueOf(d);
|
|
|
} else {
|
|
|
//负数
|
|
|
realData = AdvacedUtil.getRealData(s1);
|
|
@@ -573,11 +590,27 @@ public class HomePageAActivity extends MvpActivity<HomePageAPresenter> implement
|
|
|
activity.tvWcUser.setText(activity.use + "");
|
|
|
activity.tvWcEmpty.setText(activity.empty + "");
|
|
|
//厕所示意图
|
|
|
- for (int i = 0; i < MyService.sHoleInformationList.size(); i++) {
|
|
|
- getXValue(MyService.sHoleInformationList.get(i), i, activity.rvToiletState);
|
|
|
+// for (int i = 0; i < MyService.sHoleInformationList.size(); i++) {
|
|
|
+// getXValue(MyService.sHoleInformationList.get(i), i, activity.rvToiletState);
|
|
|
+// }
|
|
|
+ for (int i = 0; i < MyService.sHomePageLocationList.size(); i++) {
|
|
|
+ getXValue(MyService.sHomePageLocationList.get(i),i,activity.rvToiletState);
|
|
|
}
|
|
|
if (!wcLocaltion) {
|
|
|
- for (int i = 0; i < MyService.sHoleInformationList.size(); i++) {
|
|
|
+ Log.d(TAG, "handleMessage111: "+MyService.sHomePageLocationList.size());
|
|
|
+ for (int i = 0; i < MyService.sHomePageLocationList.size(); i++) {
|
|
|
+ CustomSketchMapView childAt = (CustomSketchMapView) mCustomViewGrounp.getChildAt(i);
|
|
|
+ String s = MyService.sHomePageLocationList.get(i);
|
|
|
+ if ("1".equals(s)) {
|
|
|
+ childAt.setText("有");
|
|
|
+ childAt.setVisibility(View.VISIBLE);
|
|
|
+ } else {
|
|
|
+ childAt.setText("无");
|
|
|
+ childAt.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /* for (int i = 0; i < MyService.sHoleInformationList.size(); i++) {
|
|
|
CustomSketchMapView childAt = (CustomSketchMapView) mCustomViewGrounp.getChildAt(i);
|
|
|
HoleInformation holeInformation = MyService.sHoleInformationList.get(i);
|
|
|
if (holeInformation.isUserAndEmpty()) {
|
|
@@ -587,7 +620,7 @@ public class HomePageAActivity extends MvpActivity<HomePageAPresenter> implement
|
|
|
childAt.setText("无");
|
|
|
childAt.setVisibility(View.GONE);
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
}
|
|
|
|
|
|
break;
|
|
@@ -631,6 +664,30 @@ public class HomePageAActivity extends MvpActivity<HomePageAPresenter> implement
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 改变对应的状态
|
|
|
+ *
|
|
|
+ * @param position 要改变的图片的位置
|
|
|
+ */
|
|
|
+ private void getXValue(String holeInformation, int position, RecyclerView recyclerView) {
|
|
|
+ View view = recyclerView.getLayoutManager().findViewByPosition(position);
|
|
|
+ if (view == null) {
|
|
|
+ Log.d("空1", "getXYValue: p=" + position + " index=" + position);
|
|
|
+ } else {
|
|
|
+ HomePageAAdapter.TitleViewHolder viewHolder = (HomePageAAdapter.TitleViewHolder) recyclerView.getChildViewHolder(view);
|
|
|
+ if ("1".equals(holeInformation)) {
|
|
|
+ viewHolder.getTv_toiletdiagram().setBackgroundResource(R.drawable.shape_home_mannedtoilet);
|
|
|
+ viewHolder.getTv_toiletdiagram().setText("有人");
|
|
|
+ viewHolder.getTv_toiletdiagram().setTextColor(Color.WHITE);
|
|
|
+ } else {
|
|
|
+ viewHolder.getTv_toiletdiagram().setBackgroundResource(R.drawable.icon9);
|
|
|
+ viewHolder.getTv_toiletdiagram().setText("无人");
|
|
|
+ viewHolder.getTv_toiletdiagram().setTextColor(getResources().getColor(R.color.state_green));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private Timer timerGetTime;
|
|
@@ -723,14 +780,14 @@ public class HomePageAActivity extends MvpActivity<HomePageAPresenter> implement
|
|
|
* 查看使用状态和空置状态
|
|
|
*/
|
|
|
private void showUseEmptyWC() {
|
|
|
- if (MyService.sHoleInformationList != null) {
|
|
|
- use = 0;
|
|
|
- empty = 0;
|
|
|
+ if (MyService.sHomePageLocationList != null) {
|
|
|
if (MyService.sCleaningLocationList != null) {
|
|
|
+ use = 0;
|
|
|
+ empty = 0;
|
|
|
synchronized (MyService.sCleaningLocationList) {
|
|
|
- for (int i = 0; i < MyService.sHoleInformationList.size(); i++) {
|
|
|
- HoleInformation holeInformation = MyService.sHoleInformationList.get(i);
|
|
|
- if (holeInformation.isUserAndEmpty()) {//有人
|
|
|
+ for (int i = 0; i < MyService.sHomePageLocationList.size(); i++) {
|
|
|
+ String s = MyService.sHomePageLocationList.get(i);
|
|
|
+ if ("1".equals(s)) {//有人
|
|
|
use++;
|
|
|
} else { //无人
|
|
|
empty++;
|
|
@@ -742,6 +799,25 @@ public class HomePageAActivity extends MvpActivity<HomePageAPresenter> implement
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+// if (MyService.sHomePageLocationList != null) {
|
|
|
+// if (MyService.sCleaningLocationList != null) {
|
|
|
+// use = 0;
|
|
|
+// empty = 0;
|
|
|
+// synchronized (MyService.sCleaningLocationList) {
|
|
|
+// for (int i = 0; i < MyService.sHoleInformationList.size(); i++) {
|
|
|
+// HoleInformation holeInformation = MyService.sHoleInformationList.get(i);
|
|
|
+// if (holeInformation.isUserAndEmpty()) {//有人
|
|
|
+// use++;
|
|
|
+// } else { //无人
|
|
|
+// empty++;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if (myHandler != null) {
|
|
|
+// myHandler.sendEmptyMessage(2);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
|