Skip to content

Commit

Permalink
修复界面显示相关问题
Browse files Browse the repository at this point in the history
1、地图过渡时间明显
2、快捷入口精度不够
3、忘记密码的界面尺寸

Change-Id: I5c8775599ef073bf460789532d27429d9fef9d00
  • Loading branch information
sevenhhe authored and archurcode committed Apr 8, 2021
1 parent c51cd84 commit fcdd6a7
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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) {
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
8 changes: 4 additions & 4 deletions app/src/main/res/layout/activity_forgot_password.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@
<com.tencent.iot.explorer.link.customview.check.ClickButton
android:id="@+id/btn_forgot_get_code"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginStart="24dp"
android:layout_height="40dp"
android:layout_marginStart="16dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="24dp"
android:layout_marginEnd="16dp"
android:background="@drawable/background_circle_bule_gradient"
android:gravity="center"
android:text="@string/register_get_code"
android:textColor="@color/white"
android:textSize="@dimen/ts_18"
android:textSize="@dimen/ts_16"
app:layout_constraintTop_toBottomOf="@+id/tv_register_tip_click" />

</androidx.constraintlayout.widget.ConstraintLayout>
8 changes: 4 additions & 4 deletions app/src/main/res/layout/item_country_code_key.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tv_country_code_key"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@color/gray_F7F9FA"
android:layout_height="28dp"
android:background="@color/gray_29787880"
android:gravity="center_vertical"
android:paddingStart="20dp"
android:paddingEnd="20dp"
android:textColor="@color/black_333333"
android:textSize="18sp"
android:textColor="@color/black_15161A"
android:textSize="@dimen/ts_16"
android:textStyle="bold">

</TextView>
14 changes: 7 additions & 7 deletions app/src/main/res/layout/item_country_code_value.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_height="44dp"
android:background="@color/white">

<TextView
Expand All @@ -10,8 +10,8 @@
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="20dp"
android:textColor="@color/black_333333"
android:textSize="18sp" />
android:textColor="@color/black_15161A"
android:textSize="@dimen/ts_16" />

<TextView
android:id="@+id/tv_country_code"
Expand All @@ -21,15 +21,15 @@
android:layout_centerVertical="true"
android:layout_marginEnd="30dp"
android:textColor="@color/blue_0052d9"
android:textSize="18sp"
android:textSize="@dimen/ts_16"
android:textStyle="bold" />

<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:layout_marginStart="@dimen/margin_start_20"
android:layout_marginEnd="@dimen/margin_end_20"
android:background="@color/gray_F2F4F5" />
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:background="@color/gray_E7E8EB" />

</RelativeLayout>
10 changes: 5 additions & 5 deletions app/src/main/res/layout/layout_email_forgot_pwd.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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" />

<TextView
Expand Down
20 changes: 10 additions & 10 deletions app/src/main/res/layout/layout_phone_forgot_pwd.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
android:layout_height="0dp"
android:layout_marginStart="20dp"
android:text="@string/country_or_place"
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/tv_forgot_to_country"
app:layout_constraintStart_toStartOf="parent"
Expand All @@ -26,8 +26,8 @@
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:text="@string/default_country"
android:textColor="@color/black_333333"
android:textSize="@dimen/ts_16"
android:textColor="@color/black_15161A"
android:textSize="@dimen/ts_14"
android:layout_marginStart="24dp"
app:layout_constraintEnd_toStartOf="@+id/iv_forgot_to_country"
app:layout_constraintLeft_toLeftOf="parent"
Expand All @@ -52,7 +52,7 @@
android:layout_height="1dp"
android:layout_marginStart="20dp"
android:layout_marginTop="134dp"
android:background="@color/gray_dddddd"
android:background="@color/gray_E7E8EB"
app:layout_constraintBottom_toBottomOf="@id/tv_forgot_to_country" />

<TextView
Expand All @@ -61,8 +61,8 @@
android:layout_height="0dp"
android:layout_marginStart="20dp"
android:text="@string/mobile_num"
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_phone"
app:layout_constraintStart_toStartOf="parent"
Expand All @@ -76,9 +76,9 @@
android:background="@color/white"
android:hint="@string/mobile_number"
android:inputType="phone"
android:textColor="@color/black_333333"
android:textColor="@color/black_15161A"
android:textCursorDrawable="@drawable/edit_blue_cursor"
android:textSize="@dimen/ts_16"
android:textSize="@dimen/ts_14"
app:layout_constraintBottom_toBottomOf="@+id/line_forgot_phone"
app:layout_constraintEnd_toStartOf="@+id/iv_forgot_phone_clear"
app:layout_constraintLeft_toLeftOf="parent"
Expand All @@ -103,7 +103,7 @@
android:layout_height="1dp"
android:layout_marginStart="20dp"
android:layout_marginTop="49dp"
android:background="@color/gray_dddddd"
android:background="@color/gray_E7E8EB"
app:layout_constraintTop_toBottomOf="@id/line_forgot_to_country" />

<TextView
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values-en-rUS/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,8 @@
<string name="scanning_retry">Retry</string>
<string name="connect">Connect</string>
<string name="all_device">All</string>
<string name="all_dev_num">所有设备(%s)</string>
<string name="all_share_dev_num">共享设备(%s)</string>
<string name="all_dev_num">所有设备(%s)</string>
<string name="all_share_dev_num">共享设备(%s)</string>
<string name="no_dev_to_show_add_now">当前暂无设备,请添加设备</string>
<string name="living_room">Living room</string>
<string name="bedroom">Bedroom</string>
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,8 @@
<string name="scanning_retry">重试</string>
<string name="connect">连接</string>
<string name="all_device">全部</string>
<string name="all_dev_num">所有设备(%s)</string>
<string name="all_share_dev_num">共享设备(%s)</string>
<string name="all_dev_num">所有设备(%s)</string>
<string name="all_share_dev_num">共享设备(%s)</string>
<string name="no_dev_to_show_add_now">当前暂无设备,请添加设备</string>
<string name="living_room">客厅</string>
<string name="bedroom">卧室</string>
Expand Down

0 comments on commit fcdd6a7

Please sign in to comment.