Browse Source

修改部分样式问题

Pq 1 year ago
parent
commit
fbfa50e588

+ 29 - 0
BaseLibrary/src/main/java/com/cooleshow/base/utils/DeviceUtils.java

@@ -1,10 +1,13 @@
 package com.cooleshow.base.utils;
 
 import android.annotation.SuppressLint;
+import android.app.Activity;
 import android.content.Context;
 import android.content.Intent;
 import android.content.res.Configuration;
 import android.content.res.Resources;
+import android.graphics.Point;
+import android.graphics.Rect;
 import android.net.Uri;
 import android.net.wifi.WifiInfo;
 import android.net.wifi.WifiManager;
@@ -12,6 +15,7 @@ import android.os.Build;
 import android.provider.Settings;
 import android.telephony.TelephonyManager;
 import android.text.TextUtils;
+import android.view.WindowManager;
 
 import androidx.annotation.RequiresApi;
 import androidx.annotation.RequiresPermission;
@@ -521,4 +525,29 @@ public final class DeviceUtils {
         }
         return prefix + UUID.nameUUIDFromBytes(id.getBytes()).toString().replace("-", "");
     }
+
+    public static int getWindowVisibleDisplay(Context context) {
+        Rect outRect1 = new Rect();
+        try {
+            ((Activity) context).getWindow().getDecorView().getWindowVisibleDisplayFrame(outRect1);
+        } catch (ClassCastException e) {
+            e.printStackTrace();
+            return getAppScreenHeight(context);
+        }
+        int activityHeight = outRect1.height();
+        return activityHeight;
+    }
+
+    /**
+     * Return the application's height of screen, in pixel.
+     *
+     * @return the application's height of screen, in pixel
+     */
+    public static int getAppScreenHeight(Context context) {
+        WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
+        if (wm == null) return -1;
+        Point point = new Point();
+        wm.getDefaultDisplay().getSize(point);
+        return point.y;
+    }
 }

+ 4 - 11
BaseLibrary/src/main/java/com/cooleshow/base/widgets/CommonPopupWindow.java

@@ -5,10 +5,13 @@ import android.content.Context;
 import android.graphics.Point;
 import android.graphics.Rect;
 import android.os.Build;
+import android.util.Log;
 import android.view.View;
 import android.view.WindowManager;
 import android.widget.PopupWindow;
 
+import com.cooleshow.base.utils.DeviceUtil;
+import com.cooleshow.base.utils.DeviceUtils;
 import com.cooleshow.base.utils.Utils;
 import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
 
@@ -171,17 +174,7 @@ public class CommonPopupWindow extends PopupWindow {
             Rect visibleFrame = new Rect();
             parent.getGlobalVisibleRect(visibleFrame);
             int height;
-            /**
-             * 判断是否有导航栏
-             */
-            if (isShowNavBar(getContentView().getContext())) {
-                height = parent.getResources().getDisplayMetrics().heightPixels - visibleFrame.bottom + Math.abs(offsetY);
-            } else {
-                /**
-                 * 获取物理真实高度 才能在android 7.0以上遮住下面的TabHost
-                 */
-                height = getRealHeight() - visibleFrame.bottom + Math.abs(offsetY);
-            }
+            height = DeviceUtils.getWindowVisibleDisplay(getContentView().getContext())+getStatusBarHeight()  - visibleFrame.bottom + Math.abs(offsetY);
             setHeight(height);
         }
         super.showAsDropDown(parent, xoff, offsetY);

+ 0 - 1
BaseLibrary/src/main/res/layout/list_popu_layout.xml

@@ -8,7 +8,6 @@
         android:id="@+id/recyclerView"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_marginTop="@dimen/dp_2"
         android:background="@color/white"
         android:focusable="true"
         android:focusableInTouchMode="true"

+ 9 - 1
teacher/src/main/java/com/cooleshow/teacher/ui/income/WithdrawalRecordActivity.java

@@ -1,5 +1,6 @@
 package com.cooleshow.teacher.ui.income;
 
+import android.graphics.Color;
 import android.os.Bundle;
 import android.text.TextUtils;
 import android.view.LayoutInflater;
@@ -62,7 +63,7 @@ public class WithdrawalRecordActivity extends BaseMVPActivity<ActivityWithdrawal
                 showTimeSelectPicker();
                 break;
             case R.id.tv_type:
-                initPop(viewBinding.tvType);
+                initPop(viewBinding.rlFilter);
                 break;
         }
     }
@@ -262,8 +263,15 @@ public class WithdrawalRecordActivity extends BaseMVPActivity<ActivityWithdrawal
             withdrawalFilterAdapter.setNewInstance(mFilterStatusBeans);
             mPopupWindow = PopupUtil.createNoBackPopupWindow(popupContentView, this, ViewGroup.LayoutParams.MATCH_PARENT,
                     ViewGroup.LayoutParams.WRAP_CONTENT, true);
+            mPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
+                @Override
+                public void onDismiss() {
+                    viewBinding.rlFilter.setBackgroundColor(Color.TRANSPARENT);
+                }
+            });
         }
         mPopupWindow.showAsDropDown(targetView);
+        viewBinding.rlFilter.setBackgroundColor(Color.WHITE);
     }
 
     @Override

+ 1 - 0
teacher/src/main/res/layout/activity_withdrawal_record.xml

@@ -10,6 +10,7 @@
         layout="@layout/common_toolbar_layout" />
 
     <RelativeLayout
+        android:id="@+id/rl_filter"
         android:layout_width="match_parent"
         android:layout_height="wrap_content">