Skip to content

Commit

Permalink
Merge branch 'master' into v2.3.x
Browse files Browse the repository at this point in the history
Change-Id: I18da92a16da4ac000977e77c3e47a222705e48f1
  • Loading branch information
SundoggyNew committed Oct 28, 2021
2 parents 391635d + 1363e8b commit f21ec5d
Show file tree
Hide file tree
Showing 101 changed files with 4,827 additions and 1,106 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tencent_official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
sed -i 's#def versionAppName.*#def versionAppName = \"'$rt'\"#g' config.gradle
sed -i 's#def sdkVersion.*#def sdkVersion = \"'$rt'\"#g' config.gradle
sed -i "s#xxx#$rb+git.$rc#g" config.gradle
sed -i '/snapshots/, +d' build.gradle
- name: Common-->Update Values of Signing
run: |
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
<activity android:name=".kitlink.activity.AddTimerActivity" />
<activity android:name=".kitlink.activity.FamilyActivity" />
<activity android:name=".kitlink.activity.RoomListActivity" />
<activity android:name=".kitlink.activity.ControlPermissionActivity" />
<activity android:name=".kitlink.activity.AddRoomActivity" />
<activity android:name=".kitlink.activity.AddFamilyActivity" />
<activity android:name=".kitlink.activity.CommentDetailsActivity" />
Expand Down Expand Up @@ -163,6 +164,7 @@
<activity android:name=".kitlink.activity.ForgotPasswordActivity" />
<activity android:name=".kitlink.activity.CountryCodeActivity" />
<activity android:name=".kitlink.activity.RegisterActivity" />
<activity android:name=".kitlink.activity.ChooseCountryActivity" />
<activity android:name=".kitlink.activity.MessageActivity" /> <!-- 微信回调 -->
<activity android:name=".kitlink.activity.DevicePanelActivity" />
<activity android:name=".kitlink.activity.FeedbackForH5Activity" />
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/tencent/iot/explorer/link/AppData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class AppData private constructor() {
var userInfo = UserInfo()
var userSetting = UserSetting()
var regionId = "1"
var conutryCode = "1" // 当前的登录的国家码
var conutryCode = "86" // 当前的登录的国家码
var bleDevice: BleDevice? = null // 用于标记将要被索引的蓝牙设备
var region = "ap-guangzhou"
var appLifeCircleId = "0"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package com.tencent.iot.explorer.link.customview.dialog;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import androidx.constraintlayout.widget.ConstraintLayout;

import com.tencent.iot.explorer.link.R;
import com.tencent.iot.explorer.link.customview.dialog.entity.UpgradeInfo;

public class PermissionDialog extends IosCenterStyleDialog implements View.OnClickListener {

private TextView detail;
private TextView detailLips;
private TextView btnRefuse;
private TextView btnOK;
private ConstraintLayout outLayout;
private String detailString;
private String detailLipsString;

public PermissionDialog(Context context, String detail, String detailLips) {
super(context, R.layout.popup_permission_layout);
this.detailString = detail;
this.detailLipsString = detailLips;
}

@Override
public void initView() {
outLayout = view.findViewById(R.id.permission_dialog_layout);
detail = view.findViewById(R.id.tv_detail);
detailLips = view.findViewById(R.id.tv_detail_lips);
btnRefuse = view.findViewById(R.id.tv_refuse);
btnOK = view.findViewById(R.id.tv_ok);

btnRefuse.setOnClickListener(this);
btnOK.setOnClickListener(this);

detail.setText(detailString);
detailLips.setText(detailLipsString);
outLayout.setBackgroundColor(getContext().getResources().getColor(R.color.dialog_background));
}

@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.tv_refuse:
dismiss();
if (onDismisListener != null) {
onDismisListener.OnClickRefuse();
}
break;
case R.id.tv_ok:
dismiss();
if (onDismisListener != null) {
onDismisListener.OnClickOK();
}
break;
default:
break;
}
}

private volatile OnDismisListener onDismisListener;

public interface OnDismisListener {
void OnClickRefuse();
void OnClickOK();
}

public void setOnDismisListener(OnDismisListener onDismisListener) {
this.onDismisListener = onDismisListener;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
package com.tencent.iot.explorer.link.customview.dialog

import android.content.Context
import android.content.DialogInterface
import android.os.Build
import android.text.Spannable
import android.text.SpannableStringBuilder
import android.text.TextPaint
import android.text.method.LinkMovementMethod
import android.text.style.ClickableSpan
import android.util.Log
import android.view.KeyEvent
import android.view.View
import android.widget.ImageView
import android.widget.RelativeLayout
import android.widget.TextView
import androidx.annotation.RequiresApi
import com.tencent.iot.explorer.link.R

class UserAgreeDialog(context: Context) : IosCenterStyleDialog(context, R.layout.popup_user_agree_layout), View.OnClickListener, DialogInterface.OnKeyListener {
private var tip_title: TextView? = null
private var tv_tip_content: TextView? = null
private var tv_register_tip: TextView? = null
private var tv_confirm: TextView? = null
private var tv_cancel: TextView? = null
private var select_tag_layout: RelativeLayout? = null
private var iv_agreement: ImageView? = null
private var iv_agreement_status: ImageView? = null
@Volatile
private var readed = false

private fun freshReadState() {
if (readed) {
iv_agreement?.setImageResource(R.mipmap.dev_mode_sel)
iv_agreement_status?.visibility = View.VISIBLE
} else {
iv_agreement?.setImageResource(R.mipmap.dev_mode_unsel)
iv_agreement_status?.visibility = View.GONE
}
}

override fun initView() {
tip_title = view.findViewById(R.id.tip_title)
tv_tip_content = view.findViewById(R.id.tv_tip_content)
tv_register_tip = view.findViewById(R.id.tv_register_tip)
tv_confirm = view.findViewById(R.id.tv_confirm)
tv_cancel = view.findViewById(R.id.tv_cancel)
select_tag_layout = view.findViewById(R.id.select_tag_layout)

tip_title?.text = context.getString(R.string.register_agree_2) + context.getString(R.string.rule_title_and) + context.getString(R.string.rule_title_private_protect)

val agreeContentStrPrefix = context.getString(R.string.rule_content_prefix)
val partStr1 = "${context.getString(R.string.register_agree_2)}"
val partStr2 = context.getString(R.string.register_agree_3)
val partStr3 = "${context.getString(R.string.register_agree_4)}"
val agreeContentStrMiddle = context.getString(R.string.rule_content_middle)
val partStr4 = "${context.getString(R.string.rule_content_list)}"
val agreeContentStrSuffix = context.getString(R.string.rule_content_suffix)
var agreeContentStr = agreeContentStrPrefix + partStr1 + partStr2 + partStr3 + agreeContentStrMiddle + partStr4 + agreeContentStrSuffix
var agreeContentSpannable = SpannableStringBuilder(agreeContentStr)
agreeContentSpannable.setSpan(IndexClickableSpan(context, 1),
agreeContentStrPrefix.length, agreeContentStrPrefix.length + partStr1.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
val start1 = agreeContentStrPrefix.length + partStr1.length + partStr2.length
agreeContentSpannable.setSpan(IndexClickableSpan(context, 2),
start1, start1 + partStr3.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
val start2 = agreeContentStrPrefix.length + partStr1.length + partStr2.length + partStr3.length + agreeContentStrMiddle.length
agreeContentSpannable.setSpan(IndexClickableSpan(context, 3),
start2, start2 + partStr4.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
tv_tip_content?.movementMethod = LinkMovementMethod.getInstance()
tv_tip_content?.text = agreeContentSpannable

select_tag_layout?.setOnClickListener(this)
tv_cancel?.setOnClickListener(this)
tv_confirm?.setOnClickListener(this)
this.setOnKeyListener(this)
freshReadState()
}

override fun onClick(v: View?) {
when(v) {
select_tag_layout -> {
}

tv_cancel -> {
onDismisListener?.onDismised()
}

tv_confirm -> {
readed = true
freshReadState()
onDismisListener?.onOkClicked()
dismiss()
}
}
}

@Volatile
private var onDismisListener: OnDismisListener? = null

interface OnDismisListener {
fun onDismised()
fun onOkClicked()
fun onOkClickedUserAgreement()
fun onOkClickedPrivacyPolicy()
fun onOkClickedThirdSDKList()
}

fun setOnDismisListener(onDismisListener: OnDismisListener?) {
this.onDismisListener = onDismisListener
}

inner class IndexClickableSpan(context: Context, index: Int): ClickableSpan() {
private var index = 0
private var context: Context? = null

init {
this.index = index
this.context = context
}

@RequiresApi(Build.VERSION_CODES.M)
override fun onClick(widget: View) {
context?.let {
tv_tip_content?.highlightColor = it.getColor(android.R.color.transparent)
tv_register_tip?.highlightColor = it.getColor(android.R.color.transparent)
}
if (index == 1) {
onDismisListener?.onOkClickedUserAgreement()
} else if (index == 2) {
onDismisListener?.onOkClickedPrivacyPolicy()
} else if (index == 3) {
onDismisListener?.onOkClickedThirdSDKList()
}
}

@RequiresApi(Build.VERSION_CODES.M)
override fun updateDrawState(ds: TextPaint) {
super.updateDrawState(ds)
context?.let {
ds.color = it.getColor(R.color.blue_0066FF)
}
ds.isUnderlineText = false
}
}

override fun onKey(dialog: DialogInterface?, keyCode: Int, event: KeyEvent?): Boolean {
if (keyCode == KeyEvent.KEYCODE_BACK) {
onDismisListener?.onDismised()
}
return true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import com.tencent.iot.explorer.link.T
import com.tencent.iot.explorer.link.core.auth.callback.MyCallback
import com.tencent.iot.explorer.link.core.auth.response.BaseResponse
import com.tencent.iot.explorer.link.core.utils.Utils
import com.tencent.iot.explorer.link.customview.dialog.PermissionDialog
import kotlinx.android.synthetic.main.activity_account_and_safety.*
import kotlinx.android.synthetic.main.menu_back_layout.*

Expand Down Expand Up @@ -49,6 +50,7 @@ class AccountAndSafetyActivity : PActivity(), AccountAndSafetyView, View.OnClick
tv_wechat.setOnClickListener(this)
tv_modify_passwd.setOnClickListener(this)
tv_account_logout.setOnClickListener(this)
tv_controller_of_permission.setOnClickListener(this)
}

override fun onClick(v: View?) {
Expand All @@ -71,7 +73,18 @@ class AccountAndSafetyActivity : PActivity(), AccountAndSafetyView, View.OnClick
if (App.data.userInfo.HasWxOpenID == "1") {
T.show(getString(R.string.wechat_bind_already)) //微信已经绑定过了, 请勿重复绑定
} else {
WeChatLogin.getInstance().login(this, this)
var dlg = PermissionDialog(this@AccountAndSafetyActivity, getString(R.string.permission_of_wechat), getString(R.string.permission_of_wechat_lips))
dlg.show()
dlg.setOnDismisListener(object : PermissionDialog.OnDismisListener {
override fun OnClickRefuse() {

}

override fun OnClickOK() {
WeChatLogin.getInstance().login(this@AccountAndSafetyActivity, this@AccountAndSafetyActivity)
}

})
}
}
tv_modify_passwd -> {// 修改密码
Expand All @@ -80,6 +93,9 @@ class AccountAndSafetyActivity : PActivity(), AccountAndSafetyView, View.OnClick
tv_account_logout -> {// 注销账号
jumpActivity(LogoutActivity::class.java)
}
tv_controller_of_permission -> {
jumpActivity(ControlPermissionActivity::class.java)
}
}
}

Expand Down
Loading

0 comments on commit f21ec5d

Please sign in to comment.