From fcdd6a7847324ead6ddcf3c010b9eeca39ef1ee8 Mon Sep 17 00:00:00 2001
From: heyawei <379135467@qq.com>
Date: Thu, 8 Apr 2021 16:12:48 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=95=8C=E9=9D=A2=E6=98=BE?=
=?UTF-8?q?=E7=A4=BA=E7=9B=B8=E5=85=B3=E9=97=AE=E9=A2=98=201=E3=80=81?=
=?UTF-8?q?=E5=9C=B0=E5=9B=BE=E8=BF=87=E6=B8=A1=E6=97=B6=E9=97=B4=E6=98=8E?=
=?UTF-8?q?=E6=98=BE=202=E3=80=81=E5=BF=AB=E6=8D=B7=E5=85=A5=E5=8F=A3?=
=?UTF-8?q?=E7=B2=BE=E5=BA=A6=E4=B8=8D=E5=A4=9F=203=E3=80=81=E5=BF=98?=
=?UTF-8?q?=E8=AE=B0=E5=AF=86=E7=A0=81=E7=9A=84=E7=95=8C=E9=9D=A2=E5=B0=BA?=
=?UTF-8?q?=E5=AF=B8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Change-Id: I5c8775599ef073bf460789532d27429d9fef9d00
---
.../customview/dialog/DevModeSetDialog.java | 6 ++-
.../kitlink/activity/FamilyAddressActivity.kt | 40 +++++++++----------
.../link/kitlink/fragment/HomeFragment.kt | 3 +-
.../iot/explorer/link/kitlink/util/Utils.kt | 18 +++++++++
.../res/layout/activity_forgot_password.xml | 8 ++--
.../main/res/layout/item_country_code_key.xml | 8 ++--
.../res/layout/item_country_code_value.xml | 14 +++----
.../res/layout/layout_email_forgot_pwd.xml | 10 ++---
.../res/layout/layout_phone_forgot_pwd.xml | 20 +++++-----
app/src/main/res/values-en-rUS/strings.xml | 4 +-
app/src/main/res/values/strings.xml | 4 +-
11 files changed, 77 insertions(+), 58 deletions(-)
diff --git a/app/src/main/java/com/tencent/iot/explorer/link/customview/dialog/DevModeSetDialog.java b/app/src/main/java/com/tencent/iot/explorer/link/customview/dialog/DevModeSetDialog.java
index 2fe1e1462..f46a2e135 100644
--- a/app/src/main/java/com/tencent/iot/explorer/link/customview/dialog/DevModeSetDialog.java
+++ b/app/src/main/java/com/tencent/iot/explorer/link/customview/dialog/DevModeSetDialog.java
@@ -17,6 +17,7 @@
import com.tencent.iot.explorer.link.customview.dialog.adapter.DevModeOptionsAdapter;
import com.tencent.iot.explorer.link.kitlink.entity.ModeInt;
import com.tencent.iot.explorer.link.core.auth.entity.OpValue;
+import com.tencent.iot.explorer.link.kitlink.util.Utils;
import java.util.ArrayList;
import java.util.List;
@@ -154,9 +155,10 @@ private void resetStartEqBtnStatus() {
@Override
public void onRangeChanged(RangeSeekBar view, float leftValue, float rightValue, boolean isFromUser) {
progress = leftValue;
-// String.format("%.2f", leftValue)
if (!modeInt.getIfInteger()) {
- view.getLeftSeekBar().setIndicatorText(String.format("%.1f", leftValue) + modeInt.getUnit());
+
+ int len = Utils.Companion.length(modeInt.getStep());
+ view.getLeftSeekBar().setIndicatorText(String.format("%." + len + "f", leftValue) + modeInt.getUnit());
} else {
view.getLeftSeekBar().setIndicatorText((int)leftValue + modeInt.getUnit());
}
diff --git a/app/src/main/java/com/tencent/iot/explorer/link/kitlink/activity/FamilyAddressActivity.kt b/app/src/main/java/com/tencent/iot/explorer/link/kitlink/activity/FamilyAddressActivity.kt
index 2ce47a856..9bd9fd5ac 100644
--- a/app/src/main/java/com/tencent/iot/explorer/link/kitlink/activity/FamilyAddressActivity.kt
+++ b/app/src/main/java/com/tencent/iot/explorer/link/kitlink/activity/FamilyAddressActivity.kt
@@ -89,26 +89,6 @@ class FamilyAddressActivity : BaseActivity(), TencentLocationListener {
smart_refreshLayout.setRefreshFooter(ClassicsFooter(this@FamilyAddressActivity))
}
- override fun startHere() {
- super.startHere()
-
- Thread {
- Thread.sleep(1000)
- runOnUiThread {
- tencentMap.setOnMapCameraChangeListener(OnMapCameraChangeListener)
- if (checkPermissions(permissions)) {
- if (TextUtils.isEmpty(defaultAddress)) {
- startLocation()
- } else {
- tagPostionByAddress(defaultAddress)
- }
- } else {
- requestPermission(permissions)
- }
- }
- }.start()
- }
-
override fun setListener() {
layout_seach.setOnClickListener {
var postionIntent = Intent(this@FamilyAddressActivity, SelectPointActivity::class.java)
@@ -191,9 +171,10 @@ class FamilyAddressActivity : BaseActivity(), TencentLocationListener {
justMaskTag(target, "")
}
})
+ tencentMap.setOnMapCameraChangeListener(initOnMapCameraChangeListener)
}
- private var OnMapCameraChangeListener = object : TencentMap.OnMapCameraChangeListener {
+ private var onMapCameraChangeListener = object : TencentMap.OnMapCameraChangeListener {
override fun onCameraChangeFinish(cp: CameraPosition) {
L.e("onCameraChangeFinish=${cp.target.latitude},${cp.target.longitude}")
if (requestFlag) {
@@ -207,6 +188,23 @@ class FamilyAddressActivity : BaseActivity(), TencentLocationListener {
override fun onCameraChange(cp: CameraPosition) {}
}
+ private var initOnMapCameraChangeListener = object : TencentMap.OnMapCameraChangeListener {
+ override fun onCameraChangeFinish(cp: CameraPosition) {
+ tencentMap.setOnMapCameraChangeListener(onMapCameraChangeListener)
+ if (checkPermissions(permissions)) {
+ if (TextUtils.isEmpty(defaultAddress)) {
+ startLocation()
+ } else {
+ tagPostionByAddress(defaultAddress)
+ }
+ } else {
+ requestPermission(permissions)
+ }
+ }
+
+ override fun onCameraChange(cp: CameraPosition) {}
+ }
+
private fun initMap() {
locationManager = TencentLocationManager.getInstance(this)
tencentMap = mapView.map
diff --git a/app/src/main/java/com/tencent/iot/explorer/link/kitlink/fragment/HomeFragment.kt b/app/src/main/java/com/tencent/iot/explorer/link/kitlink/fragment/HomeFragment.kt
index d9ba63139..a67c88c6c 100644
--- a/app/src/main/java/com/tencent/iot/explorer/link/kitlink/fragment/HomeFragment.kt
+++ b/app/src/main/java/com/tencent/iot/explorer/link/kitlink/fragment/HomeFragment.kt
@@ -396,7 +396,8 @@ class HomeFragment : BaseFragment(), HomeFragmentView, MyCallback, PayloadMessag
override fun onSaveClicked() {
var value = ""
if (!devOption.modeInt!!.ifInteger) {
- value = String.format("%.1f", dialog.progress)
+ var len = Utils.length(devOption!!.modeInt!!.step)
+ value = String.format("%.${len}f", dialog.progress)
} else {
value = dialog.progress.toInt().toString()
}
diff --git a/app/src/main/java/com/tencent/iot/explorer/link/kitlink/util/Utils.kt b/app/src/main/java/com/tencent/iot/explorer/link/kitlink/util/Utils.kt
index e5ff7f2c8..a5cdf62db 100644
--- a/app/src/main/java/com/tencent/iot/explorer/link/kitlink/util/Utils.kt
+++ b/app/src/main/java/com/tencent/iot/explorer/link/kitlink/util/Utils.kt
@@ -15,5 +15,23 @@ class Utils {
LocalBroadcastManager.getInstance(context).sendBroadcast(intent)
context.sendBroadcast(intent)
}
+
+ fun length(num: Float): Int {
+ var len = 1
+ val str = num.toString()
+ val parts = str.split(".")
+ if (parts != null && parts.size == 2) {
+ for (i in parts[1].length - 1 downTo 1) {
+ if (parts[1][i].toString() != "0") {
+ len = i + 1
+ break
+ }
+ }
+ }
+ if (len <= 0) {
+ len = 1
+ }
+ return len
+ }
}
}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_forgot_password.xml b/app/src/main/res/layout/activity_forgot_password.xml
index 9254d407f..a3d65d839 100644
--- a/app/src/main/res/layout/activity_forgot_password.xml
+++ b/app/src/main/res/layout/activity_forgot_password.xml
@@ -80,15 +80,15 @@
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_country_code_key.xml b/app/src/main/res/layout/item_country_code_key.xml
index d0c87db1a..e20548692 100644
--- a/app/src/main/res/layout/item_country_code_key.xml
+++ b/app/src/main/res/layout/item_country_code_key.xml
@@ -2,13 +2,13 @@
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_country_code_value.xml b/app/src/main/res/layout/item_country_code_value.xml
index 5818d9f8b..f12f41f5e 100644
--- a/app/src/main/res/layout/item_country_code_value.xml
+++ b/app/src/main/res/layout/item_country_code_value.xml
@@ -1,7 +1,7 @@
+ android:textColor="@color/black_15161A"
+ android:textSize="@dimen/ts_16" />
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="16dp"
+ android:background="@color/gray_E7E8EB" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/layout_email_forgot_pwd.xml b/app/src/main/res/layout/layout_email_forgot_pwd.xml
index 9d963d12e..520684807 100644
--- a/app/src/main/res/layout/layout_email_forgot_pwd.xml
+++ b/app/src/main/res/layout/layout_email_forgot_pwd.xml
@@ -10,8 +10,8 @@
android:layout_height="0dp"
android:layout_marginStart="20dp"
android:text="@string/email"
- android:textColor="@color/black"
- android:textSize="@dimen/ts_16"
+ android:textColor="@color/black_15161A"
+ android:textSize="@dimen/ts_14"
android:gravity="center_vertical"
app:layout_constraintBottom_toBottomOf="@id/et_forgot_email"
app:layout_constraintStart_toStartOf="parent"
@@ -25,9 +25,9 @@
android:background="@color/white"
android:hint="@string/email_address"
android:inputType="textEmailAddress"
- android:textColor="@color/black"
+ android:textColor="@color/black_15161A"
android:textCursorDrawable="@drawable/edit_blue_cursor"
- android:textSize="@dimen/ts_16"
+ android:textSize="@dimen/ts_14"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
app:layout_constraintTop_toTopOf="parent"
@@ -51,7 +51,7 @@
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="20dp"
- android:background="@color/gray_dddddd"
+ android:background="@color/gray_E7E8EB"
app:layout_constraintTop_toBottomOf="@id/et_forgot_email" />
Retry
Connect
All
- 所有设备(%s)
- 共享设备(%s)
+ 所有设备(%s)
+ 共享设备(%s)
当前暂无设备,请添加设备
Living room
Bedroom
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 620924647..b634f1788 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -459,8 +459,8 @@
重试
连接
全部
- 所有设备(%s)
- 共享设备(%s)
+ 所有设备(%s)
+ 共享设备(%s)
当前暂无设备,请添加设备
客厅
卧室