瀏覽代碼

搭建设置界面

Administrator 2 年之前
父節點
當前提交
f0c9133493

+ 2 - 0
cpt_parttime/src/main/AndroidManifest.xml

@@ -10,6 +10,8 @@
 
         <activity android:name=".ui.PartJobAlbumActivity" />
 
+        <activity android:name=".ui.SettingsActivity"/>
+
     </application>
 
 </manifest>

+ 7 - 0
cpt_parttime/src/main/java/com/hongyegroup/cpt_parttime/ui/PartJobProfileFragment.kt

@@ -10,6 +10,7 @@ import com.guadou.lib_baselib.utils.StatusBarUtils
 import com.guadou.lib_baselib.view.gloading.GLoadingTitleStatus
 import com.guadou.lib_baselib.view.gloading.Gloading
 import com.guadou.lib_baselib.view.gloading.GloadingGlobalAdapter
+import com.guadou.lib_baselib.view.titlebar.EasyTitleBar
 import com.hongyegroup.cpt_parttime.BR
 import com.hongyegroup.cpt_parttime.R
 import com.hongyegroup.cpt_parttime.databinding.FragmentParttimeJobProfileBinding
@@ -66,6 +67,12 @@ class PartJobProfileFragment : YYBaseVDBLoadingFragment<PartJobProfileViewModel,
 
     private fun initListener() {
 
+        mBinding.titleBarParttimeJobProfile.addRightText("设置", EasyTitleBar.MenuBuilder.OnMenuClickListener {
+
+            SettingsActivity.startInstance()
+
+        })
+
     }
 
     override fun onRefresh(refreshLayout: RefreshLayout) {

+ 39 - 0
cpt_parttime/src/main/java/com/hongyegroup/cpt_parttime/ui/SettingsActivity.kt

@@ -0,0 +1,39 @@
+package com.hongyegroup.cpt_parttime.ui
+
+import android.content.Intent
+import android.os.Bundle
+import androidx.databinding.ViewDataBinding
+import com.guadou.cs_cptservices.base.activity.YYBaseVDBActivity
+import com.guadou.lib_baselib.base.vm.BaseViewModel
+import com.guadou.lib_baselib.bean.DataBindingConfig
+import com.guadou.lib_baselib.utils.CommUtils
+import com.hongyegroup.cpt_parttime.BR
+import com.hongyegroup.cpt_parttime.R
+import com.hongyegroup.cpt_parttime.databinding.ActivitySettingsBinding
+
+class SettingsActivity:YYBaseVDBActivity<BaseViewModel,ActivitySettingsBinding>() {
+
+    companion object {
+        fun startInstance() {
+            val context = CommUtils.getContext()
+            val intent = Intent(context, SettingsActivity::class.java)
+            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+            context.startActivity(intent)
+        }
+    }
+
+    override fun init(savedInstanceState: Bundle?) {
+
+
+    }
+
+    override fun getDataBindingConfig(): DataBindingConfig {
+
+        return DataBindingConfig(R.layout.activity_settings,BR.viewModel,mViewModel)
+
+    }
+
+    override fun startObserve() {
+
+    }
+}

+ 227 - 0
cpt_parttime/src/main/res/layout/activity_settings.xml

@@ -0,0 +1,227 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tool="http://schemas.android.com/tools">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:background="@color/white"
+        android:orientation="vertical">
+
+        <com.guadou.lib_baselib.view.titlebar.EasyTitleBar
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            app:Easy_title="设置"/>
+
+        <!--Enable Notification-->
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_margin="@dimen/d_15dp"
+            android:orientation="horizontal">
+
+            <com.guadou.lib_baselib.font_text_view.TextViewMedium
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:text="开启消息通知"
+                android:textColor="@color/black"
+                android:textSize="@dimen/d_14sp" />
+
+            <androidx.appcompat.widget.SwitchCompat
+                android:id="@+id/switch_notification"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:background="@drawable/selector_switch_bg"
+                app:showText="false"
+                app:splitTrack="false"
+                app:theme="@style/scstyle"
+                app:thumbTint="#00000000"
+                app:trackTint="#00000000" />
+
+        </LinearLayout>
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/d_1dp"
+            android:background="@color/page_bg" />
+
+        <!--FAQ-->
+        <LinearLayout
+            android:id="@+id/ll_setting_faq"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal"
+            android:padding="@dimen/d_15dp"
+            android:visibility="visible">
+
+            <TextView
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:text="常用问题"
+                android:textColor="@color/black"
+                android:textSize="@dimen/d_14sp" />
+
+            <ImageView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginEnd="@dimen/d_10dp"
+                android:layout_marginRight="@dimen/d_10dp"
+                android:src="@drawable/iv_back" />
+
+        </LinearLayout>
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/d_1dp"
+            android:background="@color/page_bg" />
+
+        <!--Privacy Policy-->
+        <LinearLayout
+            android:id="@+id/ll_setting_privacy_policy"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal"
+            android:padding="@dimen/d_15dp">
+
+            <TextView
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:text="隐私条款"
+                android:textColor="@color/black"
+                android:textSize="@dimen/d_14sp" />
+
+            <ImageView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginEnd="@dimen/d_10dp"
+                android:layout_marginRight="@dimen/d_10dp"
+                android:src="@drawable/iv_back" />
+
+        </LinearLayout>
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/d_1dp"
+            android:background="@color/page_bg" />
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal"
+            android:padding="@dimen/d_15dp">
+
+            <TextView
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:text="版本号"
+                android:textColor="@color/black"
+                android:textSize="@dimen/d_14sp" />
+
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginRight="@dimen/d_2dp"
+                android:text="V"
+                android:textColor="@color/profile_red"
+                android:textSize="@dimen/d_14sp" />
+
+            <TextView
+                android:id="@+id/text_view_version_no"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginEnd="@dimen/d_10dp"
+                android:layout_marginRight="@dimen/d_10dp"
+                android:textColor="@color/profile_red"
+                android:textSize="@dimen/d_14sp" />
+
+        </LinearLayout>
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/d_1dp"
+            android:background="@color/page_bg" />
+
+
+        <!--重置密码-->
+        <LinearLayout
+            android:id="@+id/ll_setting_reset_psd"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal"
+            android:padding="@dimen/d_15dp">
+
+            <TextView
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:text="重置密码"
+                android:textColor="@color/black"
+                android:textSize="@dimen/d_14sp" />
+
+            <ImageView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginEnd="@dimen/d_10dp"
+                android:layout_marginRight="@dimen/d_10dp"
+                android:src="@drawable/iv_back" />
+
+        </LinearLayout>
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/d_1dp"
+            android:background="@color/page_bg" />
+
+        <LinearLayout
+            android:id="@+id/ll_clear_cache"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal"
+            android:padding="@dimen/d_15dp">
+
+            <TextView
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:text="帮助中心"
+                android:textColor="@color/black"
+                android:textSize="@dimen/d_14sp" />
+
+            <ImageView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginEnd="@dimen/d_10dp"
+                android:layout_marginRight="@dimen/d_10dp"
+                android:src="@drawable/iv_back" />
+
+
+        </LinearLayout>
+
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/d_1dp"
+            android:background="@color/page_bg" />
+
+        <TextView
+            android:id="@+id/button_logout"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="@dimen/d_30dp"
+            android:layout_marginTop="@dimen/d_45dp"
+            android:layout_marginRight="@dimen/d_30dp"
+            android:background="@drawable/selector_app_blue_button_round2_bg"
+            android:gravity="center"
+            android:padding="@dimen/d_10dp"
+            android:text="退出登录"
+            android:textColor="@color/white"
+            android:textSize="@dimen/d_16sp" />
+
+
+    </LinearLayout>
+
+</layout>

+ 1 - 35
cpt_parttime/src/main/res/layout/fragment_parttime_job_profile.xml

@@ -37,50 +37,16 @@
                 android:layout_height="0dp" />
 
             <com.guadou.lib_baselib.view.titlebar.EasyTitleBar
+                android:id="@+id/title_bar_parttime_job_profile"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:textSize="@dimen/d_18sp"
                 app:Easy_backRes="@null"
-                app:Easy_rightOneText="设置"
                 app:Easy_title="我的"
                 app:Easy_titleColor="@color/white"
                 app:Easy_lineState="gone"
                 app:Easy_titleBarBackground="@color/transparent" />
 
-            <!--            <FrameLayout-->
-            <!--                android:layout_width="match_parent"-->
-            <!--                android:layout_height="@dimen/d_48dp">-->
-
-            <!--                <androidx.appcompat.widget.AppCompatImageView-->
-            <!--                    android:id="@+id/iv_back"-->
-            <!--                    android:layout_width="wrap_content"-->
-            <!--                    android:layout_height="wrap_content"-->
-            <!--                    android:layout_marginLeft="@dimen/d_12dp"-->
-            <!--                    android:layout_marginTop="@dimen/d_7dp"-->
-            <!--                    android:padding="@dimen/d_8dp"-->
-            <!--                    android:src="@drawable/back_white"-->
-            <!--                    android:visibility="visible" />-->
-
-            <!--                <TextView-->
-            <!--                    android:layout_width="wrap_content"-->
-            <!--                    android:layout_height="wrap_content"-->
-            <!--                    android:layout_centerInParent="true"-->
-            <!--                    android:layout_gravity="center"-->
-            <!--                    android:text="@string/profile"-->
-            <!--                    android:textColor="@color/white"-->
-            <!--                    android:textSize="@dimen/d_18sp" />-->
-
-            <!--                <ImageView-->
-            <!--                    android:id="@+id/iv_title_qa"-->
-            <!--                    android:layout_width="wrap_content"-->
-            <!--                    android:layout_height="wrap_content"-->
-            <!--                    android:layout_gravity="right|center_vertical"-->
-            <!--                    android:layout_marginTop="@dimen/d_5dp"-->
-            <!--                    android:layout_marginRight="@dimen/d_16dp"-->
-            <!--                    android:src="@drawable/part_profile_title_qa" />-->
-
-            <!--            </FrameLayout>-->
-
         </LinearLayout>
 
         <com.scwang.smart.refresh.layout.SmartRefreshLayout

二進制
cs_cptServices/src/main/res/drawable-xhdpi/iv_back.webp


二進制
cs_cptServices/src/main/res/drawable-xhdpi/switch_blue.webp


二進制
cs_cptServices/src/main/res/drawable-xhdpi/switch_gary.webp


二進制
cs_cptServices/src/main/res/drawable-xxhdpi/iv_back.webp


二進制
cs_cptServices/src/main/res/drawable-xxhdpi/switch_blue.webp


二進制
cs_cptServices/src/main/res/drawable-xxhdpi/switch_gary.webp


+ 23 - 0
cs_cptServices/src/main/res/drawable/selector_app_blue_button_round2_bg.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <item android:state_pressed="true" >
+        <shape>
+
+            <solid android:color="@color/home_item_title_color"/>
+
+            <corners android:radius="3dp"/>
+
+        </shape>
+    </item>
+
+    <item>
+        <shape>
+            <solid android:color="@color/main_date_unselected"/>
+
+            <corners android:radius="3dp" />
+
+        </shape>
+    </item>
+
+</selector>

+ 6 - 0
cs_cptServices/src/main/res/drawable/selector_switch_bg.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:drawable="@drawable/switch_blue" android:state_checked="true"/>
+    <item android:drawable="@drawable/switch_gary" android:state_checked="false"/>
+
+</selector>

+ 10 - 0
cs_cptServices/src/main/res/values/styles.xml

@@ -16,4 +16,14 @@
         <item name="android:colorControlNormal">@color/app_blue</item>
     </style>
 
+    <!--   自定义Switch样式 -->
+    <style name="scstyle" parent="Theme.AppCompat.Light">
+
+        <item name="colorControlActivated">#00000000</item>
+
+        <item name="colorSwitchThumbNormal">#00000000</item>
+
+        <item name="android:colorForeground">#00000000</item>
+    </style>
+
 </resources>