切换家庭,我的修改名称,手机号
This commit is contained in:
@@ -21,11 +21,14 @@ class ConnectDeviceActivity : AppCompatActivity() {
|
||||
private lateinit var binding: ConnectDeviceActivityBinding
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
// 每一帧对应的步骤文字和提示
|
||||
private val steps = listOf(
|
||||
StepData("请保持手机蓝牙开启并将手机尽量靠近设备", "向设备传输信息","设备连接网络"),
|
||||
StepData("请保持手机蓝牙开启并将手机尽量靠近设备", "设备连接网络请将设备尽量靠近路由器",""),
|
||||
StepData("请将设备尽量靠近路由器", "","")
|
||||
)
|
||||
// 用 lazy 延迟初始化
|
||||
private val steps: List<StepData> by lazy {
|
||||
listOf(
|
||||
StepData(getString(R.string.bluetooth_keep_enabled), getString(R.string.transmit_info_to_device), getString(R.string.device_connect_network)),
|
||||
StepData(getString(R.string.bluetooth_keep_enabled), getString(R.string.device_connect_near_router), ""),
|
||||
StepData(getString(R.string.keep_device_near_router), "", "")
|
||||
)
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.example.defenseapplication.R
|
||||
import com.example.defenseapplication.databinding.PersonalFragmentBinding
|
||||
import com.example.defenseapplication.personal.PersonalProfileActivity
|
||||
import com.example.defenseapplication.utils.LanguageUtil
|
||||
import com.example.defenseapplication.view.FamilySwitchDialog
|
||||
import com.example.defenseapplication.view.LanguageDialog
|
||||
import com.gyf.immersionbar.ImmersionBar
|
||||
|
||||
@@ -43,6 +44,10 @@ class PersonalFragment : Fragment() {
|
||||
binding.itemLanguage.setOnClickListener {
|
||||
showLanguageDialog()
|
||||
}
|
||||
// 切换家庭点击事件
|
||||
binding.itemSwitchFamily.setOnClickListener {
|
||||
showFamilySwitchDialog()
|
||||
}
|
||||
return binding.root
|
||||
}
|
||||
|
||||
@@ -67,6 +72,16 @@ class PersonalFragment : Fragment() {
|
||||
dialog.show()
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示家庭切换对话框
|
||||
*/
|
||||
private fun showFamilySwitchDialog() {
|
||||
val dialog = FamilySwitchDialog(requireContext()) { familyName ->
|
||||
binding.tvCurrentFamily.text = familyName
|
||||
}
|
||||
dialog.show()
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
_binding = null // 避免内存泄漏
|
||||
|
||||
Reference in New Issue
Block a user