Browse Source

2024-09-02 新增

修改:
1. 工作台 点击头像 弹出退出登录
2. 完成退出登录功能
zhaiy 7 months ago
parent
commit
08ad6ba86b

+ 40 - 0
app/src/main/java/com/pan_american/android/ui/workspace/WorkspaceFragment.kt

@@ -2,13 +2,17 @@ package com.pan_american.android.ui.workspace
 
 import android.content.Intent
 import android.os.Bundle
+import android.view.Gravity
 import android.view.LayoutInflater
 import android.view.View
 import android.view.View.OnClickListener
 import android.view.ViewGroup
+import android.widget.PopupWindow
+import android.widget.TextView
 import com.pan_american.android.OASystem
 import com.pan_american.android.R
 import com.pan_american.android.base.BaseFragment
+import com.pan_american.android.base.CustomAlertDialog
 import com.pan_american.android.databinding.FragmentWorkspaceBinding
 import com.pan_american.android.ui.customer_resource.company_customer.MarketCustomerActivity
 import com.pan_american.android.ui.customer_resource.market_sales_revenue.MarketSalesRevenueActivity
@@ -28,6 +32,7 @@ import com.pan_american.android.ui.group_management.group_info.GroupInfoActivity
 import com.pan_american.android.ui.group_op.ground_convey_payment_insert.GroundConveyPaymentInsertActivity
 import com.pan_american.android.ui.group_visa.insurance_payment_insert.InsurancePaymentInsertActivity
 import com.pan_american.android.ui.group_visa.visa_payment_insert.VisaPaymentInsertActivity
+import com.pan_american.android.ui.login.LoginActivity
 import com.pan_american.android.ui.resource_management.airplane_three_code.AirplaneThreeCodeActivity
 import com.pan_american.android.ui.resource_management.car_resource.CarResourceActivity
 import com.pan_american.android.ui.resource_management.guide_resource.GuideResourceActivity
@@ -407,6 +412,41 @@ class WorkspaceFragment : BaseFragment<FragmentWorkspaceBinding>(), OnClickListe
     override fun initEvents() {
         super.initEvents()
 
+        binding.userIcon.setOnClickListener {
+
+            val userMenuPopView = View.inflate(OASystem.context, R.layout.popup_user_menu, null)
+            popupWindow = PopupWindow(userMenuPopView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
+
+            showPopupWindow {
+
+                val logoutView = userMenuPopView.findViewById<TextView>(R.id.logout)
+
+                logoutView.setOnClickListener {
+
+                    CustomAlertDialog.Builder(OASystem.context).apply {
+                        setTitle(resources.getString(R.string.alert))
+                        setMessage(resources.getString(R.string.logout_confirm_hint))
+                        setNegativeButtonAndListener(resources.getString(R.string.cancel)) { dialog, _ ->
+                            dialog.dismiss()
+                        }
+                        setPositiveButtonAndListener(resources.getString(R.string.confirm)) { dialog, _ ->
+
+                            dialog.dismiss()
+
+                            val intent = Intent(OASystem.context, LoginActivity::class.java)
+
+                            intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK)
+
+                            startActivity(intent)
+                        }
+                    }.show()
+
+                }
+
+                popupWindow.showAtLocation(binding.root, Gravity.BOTTOM, 0, 0)
+            }
+        }
+
         //全展示,汇率换算
         binding.exchangeTool.setOnClickListener {
             val intent = Intent(OASystem.context, ExchangeToolActivity::class.java)

+ 0 - 1
app/src/main/res/layout/fragment_workspace.xml

@@ -679,7 +679,6 @@
                     android:background="@color/background_color" />
 
                 <LinearLayout
-
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:layout_gravity="center"

+ 31 - 0
app/src/main/res/layout/popup_user_menu.xml

@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="@drawable/shape_corner_white"
+    android:orientation="vertical">
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/line"
+        android:layout_marginTop="@dimen/common_padding_huge"
+        android:background="@color/line_color" />
+
+    <TextView
+        android:id="@+id/logout"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_margin="@dimen/common_padding"
+        android:padding="@dimen/common_padding"
+        android:text="@string/logout"
+        android:gravity="center"
+        android:textColor="@color/color_caution"
+        android:textSize="@dimen/text_size_medium" />
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/line"
+        android:background="@color/line_color"
+        android:layout_marginBottom="@dimen/common_padding_heavy"/>
+
+</LinearLayout>

+ 5 - 1
app/src/main/res/values/strings.xml

@@ -119,6 +119,10 @@
 
     <string name="show_cost">显示成本</string>
 
+    <string name="logout">退出登录</string>
+
+    <string name="logout_confirm_hint">确定要退出登录? </string>
+
     <!-- AlertDialog通用文本 -->
     <string name="alert">警告</string>
     <string name="delete_alert_text">确认要删除:%s ?</string>
@@ -1118,7 +1122,7 @@
     <string name="commission_amount">提成金额</string>
     <string name="commission_detail">提成明细</string>
 
-    <string name="commission_confirm_hint">提成确认: \n\n团组名称: %s\n\n提成明细: %S\n\n点击确认以确认提成无误</string>
+    <string name="commission_confirm_hint">提成确认: \n\n团组名称: %s\n\n提成明细: %S\n\n点击以确认提成无误</string>
 
     <string name="commission_confirm_list_get_error">查询提成确认列表失败</string>
     <string name="commission_confirm_status_change_error">提成个人确认失败</string>