|
@@ -1,35 +1,30 @@
|
|
|
package jx.cn.escort.ui.activity
|
|
|
|
|
|
|
|
|
+
|
|
|
import android.content.Context
|
|
|
+import android.content.DialogInterface
|
|
|
+import android.content.DialogInterface.OnShowListener
|
|
|
import android.content.SharedPreferences
|
|
|
-import android.content.res.ColorStateList
|
|
|
import android.graphics.Color
|
|
|
import android.os.Bundle
|
|
|
-import android.view.ContextThemeWrapper
|
|
|
-import android.view.MenuItem
|
|
|
import android.view.View
|
|
|
-import android.view.ViewGroup
|
|
|
-import android.view.ViewParent
|
|
|
-import android.widget.Toast
|
|
|
+import android.widget.CompoundButton
|
|
|
import androidx.appcompat.app.AppCompatActivity
|
|
|
-import androidx.appcompat.widget.AppCompatTextView
|
|
|
-import androidx.fragment.app.Fragment
|
|
|
-import androidx.fragment.app.FragmentContainerView
|
|
|
-import androidx.fragment.app.FragmentTransaction
|
|
|
+import androidx.lifecycle.lifecycleScope
|
|
|
import androidx.viewpager.widget.ViewPager
|
|
|
-import androidx.viewpager2.widget.ViewPager2
|
|
|
-import com.google.android.material.bottomnavigation.BottomNavigationView
|
|
|
-import com.google.android.material.navigation.NavigationBarView
|
|
|
+import com.google.android.material.radiobutton.MaterialRadioButton
|
|
|
import com.xuexiang.xui.XUI
|
|
|
-import com.xuexiang.xui.widget.actionbar.TitleBar
|
|
|
+import com.xuexiang.xui.utils.WidgetUtils
|
|
|
+import com.xuexiang.xui.widget.dialog.materialdialog.GravityEnum
|
|
|
+import com.xuexiang.xui.widget.dialog.materialdialog.MaterialDialog
|
|
|
import com.xuexiang.xui.widget.tabbar.TabSegment
|
|
|
import jx.cn.escort.R
|
|
|
-import jx.cn.escort.databinding.ActivityMainBinding
|
|
|
import jx.cn.escort.databinding.ActivitySysSettingBinding
|
|
|
import jx.cn.escort.extension.ExtensionBinding.Companion.binding
|
|
|
-import jx.cn.escort.ui.fragment.BaseNavFragment
|
|
|
import jx.cn.escort.utils.ActivityUtils
|
|
|
+import kotlinx.coroutines.delay
|
|
|
+import kotlinx.coroutines.launch
|
|
|
import org.koin.core.component.KoinComponent
|
|
|
import org.koin.core.component.inject
|
|
|
|
|
@@ -71,17 +66,42 @@ class SysSettingActivity : AppCompatActivity(), KoinComponent {
|
|
|
tabSegment.setupWithViewPager(ViewPager(this@SysSettingActivity), false);
|
|
|
tabSegment.setMode(TabSegment.MODE_FIXED);
|
|
|
tabSegment.notifyDataChanged();
|
|
|
- tabSegment.selectTab(0)
|
|
|
-
|
|
|
tabSegment.addOnTabSelectedListener(object :TabSegment.OnTabSelectedListener{
|
|
|
+
|
|
|
override fun onTabSelected(index: Int) {
|
|
|
- if(index != 0){
|
|
|
+ val setsCommonSave = mBinding.setsCommonSave
|
|
|
+ val setsCommonCancel = mBinding.setsCommonCancel
|
|
|
+
|
|
|
+ if(index != 1){
|
|
|
val setsUserInfo = mBinding.setsUserInfo
|
|
|
setsUserInfo.visibility= View.VISIBLE
|
|
|
|
|
|
val setUserPass = mBinding.setsUserPass
|
|
|
setUserPass.visibility= View.GONE
|
|
|
|
|
|
+
|
|
|
+ val setSexMale = setsUserInfo.findViewById<MaterialRadioButton>(jx.cn.escort.R.id.sets_sex_male)
|
|
|
+ val setSexFeMale = setsUserInfo.findViewById<MaterialRadioButton>(jx.cn.escort.R.id.sets_sex_female)
|
|
|
+ setSexMale.setOnCheckedChangeListener(object : CompoundButton.OnCheckedChangeListener{
|
|
|
+ override fun onCheckedChanged(buttonView: CompoundButton?, isChecked: Boolean) {
|
|
|
+ if(isChecked){
|
|
|
+ setSexFeMale.isChecked=false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ setSexFeMale.setOnCheckedChangeListener(object : CompoundButton.OnCheckedChangeListener{
|
|
|
+ override fun onCheckedChanged(buttonView: CompoundButton?, isChecked: Boolean) {
|
|
|
+ if(isChecked){
|
|
|
+ setSexMale.isChecked=false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}else{
|
|
|
val setsUserInfo = mBinding.setsUserInfo
|
|
|
setsUserInfo.visibility= View.GONE
|
|
@@ -89,10 +109,65 @@ class SysSettingActivity : AppCompatActivity(), KoinComponent {
|
|
|
val setUserPass = mBinding.setsUserPass
|
|
|
setUserPass.visibility= View.VISIBLE
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ setsCommonSave.setOnClickListener(object:View.OnClickListener{
|
|
|
+ override fun onClick(v: View?) {
|
|
|
+ lifecycleScope.launch {
|
|
|
+ MaterialDialog.Builder(this@SysSettingActivity)
|
|
|
+ .content("保存中...")
|
|
|
+ .contentGravity(GravityEnum.CENTER)
|
|
|
+ .progress(false, 150, true)
|
|
|
+ .showListener(OnShowListener {
|
|
|
+ dialog: DialogInterface? ->
|
|
|
+ run {
|
|
|
+ var materialDialog = dialog as MaterialDialog
|
|
|
+ while (materialDialog.currentProgress != materialDialog.maxProgress) {
|
|
|
+ materialDialog.incrementProgress(10);
|
|
|
+ }
|
|
|
+ if(materialDialog.currentProgress ==materialDialog.maxProgress){
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }).show()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ setsCommonCancel.setOnClickListener(object:View.OnClickListener{
|
|
|
+ override fun onClick(v: View?) {
|
|
|
+ lifecycleScope.launch {
|
|
|
+ MaterialDialog.Builder(this@SysSettingActivity)
|
|
|
+ .content("恢复中...")
|
|
|
+ .contentGravity(GravityEnum.CENTER)
|
|
|
+ .progress(false, 150, true)
|
|
|
+ .showListener(OnShowListener {
|
|
|
+ dialog: DialogInterface? ->
|
|
|
+ run {
|
|
|
+ var materialDialog = dialog as MaterialDialog
|
|
|
+ while (materialDialog.currentProgress != materialDialog.maxProgress) {
|
|
|
+ materialDialog.incrementProgress(10);
|
|
|
+ }
|
|
|
+ if(materialDialog.currentProgress ==materialDialog.maxProgress){
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }).show()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
override fun onTabUnselected(index: Int) {
|
|
|
- //ignore
|
|
|
+ //ignore
|
|
|
}
|
|
|
|
|
|
override fun onTabReselected(index: Int) {
|
|
@@ -103,7 +178,7 @@ class SysSettingActivity : AppCompatActivity(), KoinComponent {
|
|
|
//ignore
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
+ tabSegment.selectTab(0)
|
|
|
}
|
|
|
|
|
|
|