everywindchase 4 månader sedan
förälder
incheckning
136921e52b

+ 10 - 0
app/src/main/AndroidManifest.xml

@@ -47,6 +47,16 @@
                 android:windowSoftInputMode="adjustPan|stateHidden"
         >
         </activity>
+
+
+
+        <activity
+                android:name=".ui.activity.SysSettingActivity"
+                android:configChanges="screenSize|keyboardHidden|orientation|keyboard|locale|layoutDirection"
+                android:launchMode="singleTask"
+                android:windowSoftInputMode="adjustPan|stateHidden"
+        >
+        </activity>
     </application>
 
 </manifest>

+ 78 - 0
app/src/main/java/jx/cn/escort/ui/activity/SysSettingActivity.kt

@@ -0,0 +1,78 @@
+package jx.cn.escort.ui.activity
+
+
+import android.content.Context
+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 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.viewpager.widget.ViewPager
+import androidx.viewpager2.widget.ViewPager2
+import com.google.android.material.bottomnavigation.BottomNavigationView
+import com.google.android.material.navigation.NavigationBarView
+import com.xuexiang.xui.XUI
+import com.xuexiang.xui.widget.actionbar.TitleBar
+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 org.koin.core.component.KoinComponent
+import org.koin.core.component.inject
+
+
+class SysSettingActivity : AppCompatActivity(), KoinComponent {
+
+    private val mBinding: ActivitySysSettingBinding by binding<ActivitySysSettingBinding>()
+
+    private val mContext: Context by  inject()
+
+    private val defaultSharedPreferences: SharedPreferences = androidx.preference.PreferenceManager.getDefaultSharedPreferences(mContext)
+
+
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        XUI.initTheme(this@SysSettingActivity);
+        super.onCreate(savedInstanceState)
+        setContentView(mBinding.root)
+        val tabSegmentTitle = mBinding.tabSegmentTitle
+        tabSegmentTitle.setTitle("系统设置")
+        tabSegmentTitle.setLeftClickListener(object:View.OnClickListener{
+            override fun onClick(v: View?) {
+                ActivityUtils.startActivity(this@SysSettingActivity,MainActivity::class.java)
+            }
+        })
+
+        var ckColor=Color.parseColor("#8ad1d2")
+        var unCkColor=Color.BLACK
+        val tabSegment = mBinding.tabSegment
+        val doc = TabSegment.Tab("基本资料")
+        doc.setTextColor(unCkColor,ckColor)
+
+        val doc1 = TabSegment.Tab("修改密码")
+        doc1.setTextColor(unCkColor,ckColor)
+
+        tabSegment.addTab(  doc)
+        tabSegment.addTab(  doc1)
+        tabSegment.setupWithViewPager(ViewPager(this@SysSettingActivity), false);
+        tabSegment.setMode(TabSegment.MODE_FIXED);
+        tabSegment.notifyDataChanged();
+        tabSegment.selectTab(0);
+
+    }
+
+
+}

+ 30 - 4
app/src/main/java/jx/cn/escort/ui/fragment/BaseNavFragment.kt

@@ -31,6 +31,7 @@ import jx.cn.escort.beans.AbilityData
 import jx.cn.escort.beans.StatData
 import jx.cn.escort.beans.TaskData
 import jx.cn.escort.ui.activity.LoginActivity
+import jx.cn.escort.ui.activity.SysSettingActivity
 import jx.cn.escort.utils.ActivityUtils
 import org.koin.core.component.KoinComponent
 import org.koin.core.component.inject
@@ -178,12 +179,37 @@ class BaseNavFragment(name:Int,context: Context?):Fragment(),KoinComponent {
             }else   if(name==R.layout.fragment_mine){
                 val view:View=inflater.inflate(name!!,container,false)
                 val logoutView = view.findViewById<SuperTextView>(R.id.top_setting_logout_btn)
+                val settingView = view.findViewById<SuperTextView>(R.id.top_setting_go_btn)
                 logoutView?.setOnClickListener(object:View.OnClickListener{
                     override fun onClick(v: View?) {
-                        var editor=defaultSharedPreferences.edit()
-                        editor.clear()
-                        editor.apply()
-                        context?.let { ActivityUtils.startActivity(it,LoginActivity::class.java) }
+
+                        context?.let {
+                            MaterialDialog.Builder(it)
+                                .title("登出")
+                                .content("是否确认退出")
+                                .positiveText("确定")
+                                .negativeText("取消")
+                                .onPositive(object:MaterialDialog.SingleButtonCallback{
+                                    override fun onClick(dialog: MaterialDialog, which: DialogAction) {
+                                        var editor=defaultSharedPreferences.edit()
+                                        editor.clear()
+                                        editor.apply()
+                                        context?.let { ActivityUtils.startActivity(it,LoginActivity::class.java) }
+                                    }
+
+                                })
+                                .show()
+                        }
+
+
+
+
+                    }
+                })
+
+                settingView?.setOnClickListener(object:View.OnClickListener{
+                    override fun onClick(v: View?) {
+                        context?.let { ActivityUtils.startActivity(it,SysSettingActivity::class.java) }
                     }
                 })
 

+ 188 - 0
app/src/main/res/layout/activity_sys_setting.xml

@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout
+        xmlns:android="http://schemas.android.com/apk/res/android"
+        xmlns:tools="http://schemas.android.com/tools"
+        xmlns:app="http://schemas.android.com/apk/res-auto"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        tools:context=".ui.activity.SysSettingActivity"
+        android:background="#f5f5f5"
+>
+
+
+    <com.xuexiang.xui.widget.actionbar.TitleBar
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+                       android:background="#8ad1d2"
+            app:tb_barHeight="65dp"
+            app:tb_dividerColor="@color/xui_config_color_white"
+            app:tb_leftText="返回"
+            app:tb_sideTextPadding="20dp"
+            app:tb_actionPadding="20dp"
+            app:tb_titleText="标题"
+            android:id="@+id/tab_segment_title"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintTop_toTopOf="parent"
+            app:tb_useThemeColor="false"
+            app:layout_constraintBottom_toTopOf="@id/tabSegment"
+    />
+
+    <com.xuexiang.xui.widget.tabbar.TabSegment
+            android:id="@+id/tabSegment"
+            android:layout_width="match_parent"
+            android:layout_height="60dp"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintTop_toTopOf="parent"
+            app:layout_constraintBottom_toTopOf="@id/tabSegment_content"
+            app:layout_constraintTop_toBottomOf="@id/tab_segment_title"
+            android:textSize="12sp"
+    />
+
+    <androidx.cardview.widget.CardView
+            android:layout_marginTop="1dp"
+            android:layout_marginHorizontal="8dp"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintTop_toBottomOf="@id/tabSegment"
+            android:layout_width="match_parent"
+            android:layout_height="450dp"
+            app:contentPadding="10dp"
+            android:id="@+id/tabSegment_content"
+    >
+
+
+        <androidx.constraintlayout.widget.ConstraintLayout
+                android:layout_width="match_parent"
+                android:layout_height="250dp"
+        >
+        <androidx.appcompat.widget.LinearLayoutCompat
+
+                android:layout_width="match_parent"
+                android:layout_height="50dp"
+                android:layout_marginTop="60dp"
+
+        >
+                <com.xuexiang.xui.widget.textview.supertextview.SuperTextView
+                        android:layout_width="140dp"
+                        android:layout_height="42dp"
+                        app:sLeftTextString="用户昵称:"
+                        app:sLeftTextIsBold="true"
+                        app:sLeftTextSize="20sp"
+               />
+
+        <com.xuexiang.xui.widget.edittext.materialedittext.MaterialEditText
+                android:layout_width="200dp"
+                android:layout_height="42dp"
+                app:met_floatingLabel="normal"/>
+
+
+        </androidx.appcompat.widget.LinearLayoutCompat>
+
+
+        <androidx.appcompat.widget.LinearLayoutCompat
+                android:layout_width="match_parent"
+                android:layout_height="50dp"
+            android:layout_marginTop="100dp"
+        >
+            <com.xuexiang.xui.widget.textview.supertextview.SuperTextView
+                    android:layout_width="140dp"
+                    android:layout_height="42dp"
+                    app:sLeftTextString="手机号码:"
+                    app:sLeftTextIsBold="true"
+                    app:sLeftTextSize="20sp"
+            />
+
+            <com.xuexiang.xui.widget.edittext.materialedittext.MaterialEditText
+                    android:layout_width="200dp"
+                    android:layout_height="42dp"
+                    app:met_floatingLabel="normal"/>
+
+
+        </androidx.appcompat.widget.LinearLayoutCompat>
+
+
+
+        <androidx.appcompat.widget.LinearLayoutCompat
+                android:layout_width="match_parent"
+                android:layout_height="50dp"
+                android:layout_marginTop="140dp"
+        >
+            <com.xuexiang.xui.widget.textview.supertextview.SuperTextView
+                    android:layout_width="140dp"
+                    android:layout_height="42dp"
+                    app:sLeftTextString="用户邮箱:"
+                    app:sLeftTextIsBold="true"
+                    app:sLeftTextSize="20sp"
+            />
+
+            <com.xuexiang.xui.widget.edittext.materialedittext.MaterialEditText
+                    android:layout_width="200dp"
+                    android:layout_height="42dp"
+                    app:met_floatingLabel="normal"/>
+
+        </androidx.appcompat.widget.LinearLayoutCompat>
+
+
+
+
+        <androidx.appcompat.widget.LinearLayoutCompat
+                android:layout_width="match_parent"
+                android:layout_height="50dp"
+                android:layout_marginTop="180dp"
+        >
+            <com.xuexiang.xui.widget.textview.supertextview.SuperTextView
+                    android:layout_width="140dp"
+                    android:layout_height="42dp"
+                    app:sLeftTextString="性别"
+                    app:sLeftTextIsBold="true"
+                    app:sLeftTextSize="20sp"
+            />
+
+            <com.xuexiang.xui.widget.edittext.materialedittext.MaterialEditText
+                    android:layout_width="200dp"
+                    android:layout_height="42dp"
+                    app:met_floatingLabel="normal"/>
+
+
+        </androidx.appcompat.widget.LinearLayoutCompat>
+
+        </androidx.constraintlayout.widget.ConstraintLayout>
+
+
+        <androidx.appcompat.widget.LinearLayoutCompat
+                android:layout_width="match_parent"
+                android:layout_height="50dp"
+                android:layout_marginTop="260dp"
+                android:gravity="center"
+                >
+        >
+
+            <com.xuexiang.xui.widget.button.ButtonView
+                    android:layout_width="90dp"
+                    android:layout_height="match_parent"
+                    style="@style/ButtonView.Green"
+                    app:textRadius="5dp"
+                    android:text="保存"
+            />
+
+            <com.xuexiang.xui.widget.button.ButtonView
+                    android:layout_width="90dp"
+                    android:layout_height="match_parent"
+                    android:layout_marginLeft="60dp"
+                    style="@style/ButtonView.Gray"
+                    app:textRadius="5dp"
+                    android:text="取消"
+            />
+        </androidx.appcompat.widget.LinearLayoutCompat>
+
+
+    </androidx.cardview.widget.CardView>
+
+
+
+
+
+
+</androidx.constraintlayout.widget.ConstraintLayout>