优化
This commit is contained in:
4
.idea/deploymentTargetSelector.xml
generated
4
.idea/deploymentTargetSelector.xml
generated
@@ -4,10 +4,10 @@
|
|||||||
<selectionStates>
|
<selectionStates>
|
||||||
<SelectionState runConfigName="app">
|
<SelectionState runConfigName="app">
|
||||||
<option name="selectionMode" value="DROPDOWN" />
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
<DropdownSelection timestamp="2026-07-10T01:12:18.170652300Z">
|
<DropdownSelection timestamp="2026-07-14T09:31:19.203364400Z">
|
||||||
<Target type="DEFAULT_BOOT">
|
<Target type="DEFAULT_BOOT">
|
||||||
<handle>
|
<handle>
|
||||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=D122222104A9" />
|
<DeviceId pluginId="Default" identifier="serial=emulator-5554;connection=53435af5" />
|
||||||
</handle>
|
</handle>
|
||||||
</Target>
|
</Target>
|
||||||
</DropdownSelection>
|
</DropdownSelection>
|
||||||
|
|||||||
@@ -156,11 +156,11 @@ public class MyApplication extends Application {
|
|||||||
public void onActivityDestroyed(Activity activity) {}
|
public void onActivityDestroyed(Activity activity) {}
|
||||||
});
|
});
|
||||||
|
|
||||||
AutoSizeConfig.getInstance()
|
// AutoSizeConfig.getInstance()
|
||||||
// 是否使用设备真实尺寸
|
// // 是否使用设备真实尺寸
|
||||||
.setUseDeviceSize(true)
|
// .setUseDeviceSize(true)
|
||||||
// 是否支持 fragment
|
// // 是否支持 fragment
|
||||||
.setCustomFragment(true);
|
// .setCustomFragment(true);
|
||||||
android.util.Log.e("TEST", "hello");
|
android.util.Log.e("TEST", "hello");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ import de.greenrobot.event.ThreadMode;
|
|||||||
public class DeviceControlActivity extends BaseActivity<DeviceControlLayoutBinding, DevicePresenter>
|
public class DeviceControlActivity extends BaseActivity<DeviceControlLayoutBinding, DevicePresenter>
|
||||||
implements DeviceContract.DeviceView {
|
implements DeviceContract.DeviceView {
|
||||||
|
|
||||||
|
private static final long DEVICE_DETAIL_POLL_INTERVAL_MS = 10_000L;
|
||||||
private List<String> mTimeList = new ArrayList<>();
|
private List<String> mTimeList = new ArrayList<>();
|
||||||
private WaterDeviceEntity mDeviceEntity;
|
private WaterDeviceEntity mDeviceEntity;
|
||||||
private WaterDeviceEntity mRemoteDeviceEntity;
|
private WaterDeviceEntity mRemoteDeviceEntity;
|
||||||
@@ -53,6 +54,8 @@ public class DeviceControlActivity extends BaseActivity<DeviceControlLayoutBindi
|
|||||||
//用户自定义的浇水时长
|
//用户自定义的浇水时长
|
||||||
private int mCustomDuration = 0;
|
private int mCustomDuration = 0;
|
||||||
private final Handler mProgressHandler = new Handler(Looper.getMainLooper());
|
private final Handler mProgressHandler = new Handler(Looper.getMainLooper());
|
||||||
|
private final Handler mDeviceDetailPollHandler = new Handler(Looper.getMainLooper());
|
||||||
|
private boolean mIsDeviceDetailPolling;
|
||||||
private long mWorkStartTime = 0L;
|
private long mWorkStartTime = 0L;
|
||||||
private long mWorkEndTime = 0L;
|
private long mWorkEndTime = 0L;
|
||||||
private boolean mHasRefreshAfterWorkFinished = false;
|
private boolean mHasRefreshAfterWorkFinished = false;
|
||||||
@@ -62,6 +65,18 @@ public class DeviceControlActivity extends BaseActivity<DeviceControlLayoutBindi
|
|||||||
updateWorkProgress();
|
updateWorkProgress();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
private final Runnable mDeviceDetailPollRunnable = new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (!mIsDeviceDetailPolling) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (mDeviceEntity != null && !TextUtils.isEmpty(mDeviceEntity.getDeviceNo())) {
|
||||||
|
mPresenter.getDeviceDetailInfo(mDeviceEntity.getDeviceNo());
|
||||||
|
}
|
||||||
|
mDeviceDetailPollHandler.postDelayed(this, DEVICE_DETAIL_POLL_INTERVAL_MS);
|
||||||
|
}
|
||||||
|
};
|
||||||
@Override
|
@Override
|
||||||
public DevicePresenter createPresenter() {
|
public DevicePresenter createPresenter() {
|
||||||
return new DevicePresenter(new DeviceImpl());
|
return new DevicePresenter(new DeviceImpl());
|
||||||
@@ -513,9 +528,33 @@ public class DeviceControlActivity extends BaseActivity<DeviceControlLayoutBindi
|
|||||||
mWorkEndTime = 0L;
|
mWorkEndTime = 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void startDeviceDetailPolling() {
|
||||||
|
mIsDeviceDetailPolling = true;
|
||||||
|
mDeviceDetailPollHandler.removeCallbacks(mDeviceDetailPollRunnable);
|
||||||
|
mDeviceDetailPollHandler.postDelayed(mDeviceDetailPollRunnable, DEVICE_DETAIL_POLL_INTERVAL_MS);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void stopDeviceDetailPolling() {
|
||||||
|
mIsDeviceDetailPolling = false;
|
||||||
|
mDeviceDetailPollHandler.removeCallbacks(mDeviceDetailPollRunnable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
startDeviceDetailPolling();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
stopDeviceDetailPolling();
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
stopWorkProgressUpdate();
|
stopWorkProgressUpdate();
|
||||||
|
stopDeviceDetailPolling();
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -182,6 +182,38 @@
|
|||||||
android:layout_weight="0.5"
|
android:layout_weight="0.5"
|
||||||
android:src="@mipmap/icon_psd_hide"/>
|
android:src="@mipmap/icon_psd_hide"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/dp_30"
|
||||||
|
android:layout_marginLeft="@dimen/dp_20">
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/realtive_read_finish"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/checkbox_read"
|
||||||
|
android:layout_width="@dimen/dp_14"
|
||||||
|
android:layout_height="@dimen/dp_14"
|
||||||
|
android:background="@drawable/select_radio"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:button="@null"
|
||||||
|
android:clickable="false"
|
||||||
|
android:visibility="visible" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_agreement_full"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="@dimen/dp_12"
|
||||||
|
android:layout_marginRight="@dimen/dp_12"
|
||||||
|
android:layout_toRightOf="@+id/checkbox_read"
|
||||||
|
android:autoLink="none"
|
||||||
|
android:lineSpacingExtra="4dp"
|
||||||
|
android:textColor="@color/color_gray_tab"
|
||||||
|
android:textSize="11sp" />
|
||||||
|
</RelativeLayout>
|
||||||
|
</RelativeLayout>
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_login"
|
android:id="@+id/tv_login"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -192,7 +224,7 @@
|
|||||||
android:background="@drawable/shape_green_button_bg"
|
android:background="@drawable/shape_green_button_bg"
|
||||||
android:paddingVertical="10dp"
|
android:paddingVertical="10dp"
|
||||||
android:layout_marginHorizontal="20dp"
|
android:layout_marginHorizontal="20dp"
|
||||||
android:layout_marginTop="40dp"
|
android:layout_marginTop="20dp"
|
||||||
android:gravity="center"/>
|
android:gravity="center"/>
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -232,37 +264,5 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/dp_100"
|
|
||||||
android:layout_alignParentBottom="true">
|
|
||||||
<RelativeLayout
|
|
||||||
android:id="@+id/realtive_read_finish"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:layout_marginHorizontal="@dimen/dp_15"
|
|
||||||
android:layout_marginBottom="@dimen/dp_30">
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/checkbox_read"
|
|
||||||
android:layout_width="@dimen/dp_14"
|
|
||||||
android:layout_height="@dimen/dp_14"
|
|
||||||
android:background="@drawable/select_radio"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:button="@null"
|
|
||||||
android:clickable="false"
|
|
||||||
android:visibility="visible" />
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_agreement_full"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="@dimen/dp_12"
|
|
||||||
android:layout_marginRight="@dimen/dp_12"
|
|
||||||
android:layout_toRightOf="@+id/checkbox_read"
|
|
||||||
android:autoLink="none"
|
|
||||||
android:lineSpacingExtra="4dp"
|
|
||||||
android:textColor="@color/color_gray_tab"
|
|
||||||
android:textSize="11sp" />
|
|
||||||
</RelativeLayout>
|
|
||||||
</RelativeLayout>
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|||||||
Reference in New Issue
Block a user