Quellcode durchsuchen

任务交接跳转图标完成

everywindchase vor 4 Monaten
Ursprung
Commit
257dcd4828

+ 5 - 4
app/src/main/java/jx/cn/escort/adapter/IndexAbilityRecycleAdapter.kt

@@ -41,15 +41,16 @@ open class IndexAbilityRecycleAdapter(): RecyclerView.Adapter<IndexAbilityRecycl
     }
 
     override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): IndexAbilityRecycleViewHolder {
-        val view= LayoutInflater.from(context).inflate(R.layout.fragment_stat,parent,false)
+        val view= LayoutInflater.from(context).inflate(R.layout.fragment_action,parent,false)
         return IndexAbilityRecycleViewHolder(view)
 
     }
 
     override fun onBindViewHolder(holder: IndexAbilityRecycleViewHolder, position: Int) {
-        var statListItem=holder.item?.findViewById<SuperTextView>(R.id.stat_list_item)
-        statListItem?.setCenterBottomString("哈哈")
-
+        var statListItem=holder.item?.findViewById<SuperTextView>(R.id.action_list_item)
+       var data=mData.get(holder.getBindingAdapterPosition())
+        statListItem?.setCenterBottomString(data.title)
+        statListItem?.centerTextView?.setBackgroundResource(data.icon)
         val width = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 100f,
             context?.let { getResources(it).getDisplayMetrics() }).toInt()
         val params: ViewGroup.LayoutParams? = statListItem?.layoutParams

+ 2 - 0
app/src/main/java/jx/cn/escort/beans/AbilityData.kt

@@ -1,9 +1,11 @@
 package jx.cn.escort.beans
 
 import android.app.Activity
+import android.graphics.drawable.Drawable
 
 data    class AbilityData(
      var title:String,
+     var icon:Int,
      var link: Class<Activity>?
 )
 

+ 96 - 21
app/src/main/java/jx/cn/escort/ui/activity/SysSettingActivity.kt

@@ -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)
     }
 
 

+ 7 - 12
app/src/main/java/jx/cn/escort/ui/fragment/BaseNavFragment.kt

@@ -18,6 +18,8 @@ import androidx.recyclerview.widget.GridLayoutManager
 import androidx.recyclerview.widget.LinearLayoutManager
 import androidx.recyclerview.widget.RecyclerView
 import com.necer.calendar.Miui9Calendar
+import com.xuexiang.xui.adapter.recyclerview.XGridLayoutManager
+import com.xuexiang.xui.utils.WidgetUtils
 import com.xuexiang.xui.widget.actionbar.TitleBar
 import com.xuexiang.xui.widget.banner.recycler.BannerLayout
 import com.xuexiang.xui.widget.dialog.materialdialog.DialogAction
@@ -161,20 +163,13 @@ class BaseNavFragment(name:Int,context: Context?):Fragment(),KoinComponent {
 
 
                 var abilityDatas=mutableListOf<AbilityData>()
-                for(index in 0..<18 step 1){
-                    var     activity=AbilityData("测试${index}",null)
-                    abilityDatas.add(activity)
-                }
-
-                var layoutManager=GridLayoutManager(context,9,GridLayoutManager.HORIZONTAL,false)
-                layoutManager.spanSizeLookup=object:GridLayoutManager.SpanSizeLookup(){
-                    override fun getSpanSize(p0: Int): Int {
-                        return 9
-                    }
+                var   activity=AbilityData("任务交接",R.drawable.ic_action_task_hand,null)
+                abilityDatas.add(activity)
 
-                }
-                abilityRecycle.layoutManager=layoutManager
+                abilityRecycle.layoutManager= XGridLayoutManager(context,3 ,GridLayoutManager.HORIZONTAL,false)
                 abilityRecycle.adapter = IndexAbilityRecycleAdapter(context,abilityDatas)
+
+
                 return view
             }else   if(name==R.layout.fragment_mine){
                 val view:View=inflater.inflate(name!!,container,false)

BIN
app/src/main/res/drawable-hdpi/ic_action_task_hand.png


+ 40 - 3
app/src/main/res/layout/activity_sys_setting.xml

@@ -137,6 +137,7 @@
                     android:layout_height="42dp"
                     app:met_floatingLabel="normal"/>
 
+
         </androidx.appcompat.widget.LinearLayoutCompat>
 
 
@@ -160,10 +161,44 @@
                     app:sLeftTextSize="16sp"
             />
 
-            <com.xuexiang.xui.widget.edittext.materialedittext.MaterialEditText
-                    android:layout_width="200dp"
+
+
+
+            <com.google.android.material.radiobutton.MaterialRadioButton
+                    android:layout_width="42dp"
                     android:layout_height="42dp"
-                    app:met_floatingLabel="normal"/>
+                    app:met_floatingLabel="normal"
+                    android:id="@+id/sets_sex_male"
+            />
+            <com.xuexiang.xui.widget.textview.supertextview.SuperTextView
+                    android:layout_width="40dp"
+                    android:layout_height="42dp"
+                    app:sRightTextString="男"
+                    app:sLeftTextIsBold="true"
+                    app:sLeftTextSize="16sp"
+
+            />
+
+
+
+
+            <com.google.android.material.radiobutton.MaterialRadioButton
+                    android:layout_width="42dp"
+                    android:layout_height="42dp"
+                    app:met_floatingLabel="normal"
+                    android:id="@+id/sets_sex_female"
+            />
+            <com.xuexiang.xui.widget.textview.supertextview.SuperTextView
+                    android:layout_width="40dp"
+                    android:layout_height="42dp"
+                    app:sRightTextString="女"
+                    app:sLeftTextIsBold="true"
+                    app:sLeftTextSize="16sp"
+
+            />
+
+
+
 
 
         </androidx.appcompat.widget.LinearLayoutCompat>
@@ -288,6 +323,7 @@
                     style="@style/ButtonView.Green"
                     app:textRadius="5dp"
                     android:text="保存"
+                    android:id="@+id/sets_common_save"
             />
 
             <com.xuexiang.xui.widget.button.ButtonView
@@ -297,6 +333,7 @@
                     style="@style/ButtonView.Gray"
                     app:textRadius="5dp"
                     android:text="取消"
+                    android:id="@+id/sets_common_cancel"
             />
         </androidx.appcompat.widget.LinearLayoutCompat>
 

+ 27 - 0
app/src/main/res/layout/fragment_action.xml

@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.appcompat.widget.LinearLayoutCompat
+        xmlns:android="http://schemas.android.com/apk/res/android"
+        xmlns:app="http://schemas.android.com/apk/res-auto"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                app:cardBackgroundColor="#cde2e2"
+        >
+
+
+
+
+        <com.xuexiang.xui.widget.textview.supertextview.SuperTextView
+                                        android:id="@+id/action_list_item"
+                                        app:sCenterTextBackground="@drawable/ic_action_task_hand"
+                                        android:layout_marginStart="2dp"
+                                        app:sDividerLineColor="#F4EFEF"
+                                        app:sDividerLineHeight="2dp"
+                                        app:sCenterBottomTextString="任务交接"
+                                        android:layout_width="match_parent"
+                                        android:layout_height="match_parent"/>
+
+
+
+ </androidx.appcompat.widget.LinearLayoutCompat>
+
+

+ 8 - 2
app/src/main/res/layout/fragment_index.xml

@@ -27,7 +27,13 @@
                         app:layout_constraintBottom_toTopOf="@id/statistics_layout"
                         android:layout_marginBottom="6dp"
                 >
-
+                        <com.xuexiang.xui.widget.textview.MarqueeTextView
+                                android:id="@+id/tv_marquee"
+                                android:layout_width="match_parent"
+                                android:layout_height="wrap_content"
+                                android:background="#88EA4A4A"
+                                app:mtv_isAutoFit="true"
+                                app:mtv_isAutoDisplay="true"/>
 
 
                 </androidx.cardview.widget.CardView>
@@ -75,7 +81,7 @@
                                         android:id="@+id/index_ability_recycle"
                                         android:layout_width="match_parent" android:layout_height="match_parent"
                                         android:scrollbars="horizontal"
-                                        android:background="@color/xui_config_color_red"
+                                        android:background="@color/xui_config_color_white"
                                 />