Skip to content

Commit

Permalink
发布2.9.17
Browse files Browse the repository at this point in the history
  • Loading branch information
junixapp committed Dec 15, 2022
1 parent 4e5041b commit a8a41ca
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ public void onClick(View v) {
new XPopup.Builder(getContext())
.isDestroyOnDismiss(true)
.hasStatusBar(false)
.isRequestFocus(false)
.asCustom(new CustomCenter1(getContext()))
.show();
break;
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.xpopup_version = "2.9.17-beta2"
ext.xpopup_version = "2.9.17"
repositories {
google()
mavenCentral()
Expand Down
37 changes: 2 additions & 35 deletions library/src/main/java/com/lxj/xpopup/core/FullScreenDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.graphics.PixelFormat;
import android.os.Build;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -15,13 +16,12 @@
import com.lxj.xpopup.R;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.enums.PopupStatus;
import com.lxj.xpopup.util.FuckRomUtils;
import com.lxj.xpopup.util.KeyboardUtils;
import com.lxj.xpopup.util.XPermission;
import com.lxj.xpopup.util.XPopupUtils;

/**
* 所有弹窗的宿主
* 弹窗的宿主
*/
public class FullScreenDialog extends Dialog {
public FullScreenDialog(@NonNull Context context) {
Expand Down Expand Up @@ -81,39 +81,14 @@ protected void onCreate(Bundle savedInstanceState) {

setStatusBarLightMode();
setNavBarLightMode();

//处理VIVO手机8.0以上系统部分机型的状态栏问题和弹窗下移问题
boolean isPortrait = getContext().getResources().getConfiguration().orientation
== Configuration.ORIENTATION_PORTRAIT;
if(isFuckVIVORoom() && isPortrait){
getWindow().getDecorView().setTranslationY(-XPopupUtils.getStatusBarHeight(getWindow()));
getWindow().setLayout(XPopupUtils.getAppWidth(getContext()), Math.max(XPopupUtils.getAppHeight(getContext()),
XPopupUtils.getScreenHeight(getContext())));
}
setContentView(contentView);
// contentView.post(new Runnable() {
// @Override
// public void run() {
// if(contentView!=null) contentView.setTranslationX(contentView.getActivityContentLeft());
// }
// });
}

private int getNavigationBarColor(){
return contentView.popupInfo.navigationBarColor==0 ? XPopup.getNavigationBarColor()
: contentView.popupInfo.navigationBarColor;
}

public boolean isFuckVIVORoom(){
//vivo的Y和V开头的8.0和8.1系统特殊(y91 y85 y97):dialog无法覆盖到状态栏,并且坐标系下移了一个状态栏的距离
// boolean isFuckModel = android.os.Build.MODEL.startsWith("Y")
// || android.os.Build.MODEL.startsWith("y")
// || android.os.Build.MODEL.startsWith("V")
// || android.os.Build.MODEL.startsWith("v");
// return FuckRomUtils.isVivo() && (Build.VERSION.SDK_INT == 26 || Build.VERSION.SDK_INT == 27) && isFuckModel;
return false;
}

public void setWindowFlag(final int bits, boolean on) {
WindowManager.LayoutParams winParams = getWindow().getAttributes();
if (on) {
Expand Down Expand Up @@ -214,12 +189,4 @@ public void onWindowFocusChanged(boolean hasFocus) {
}
}

@Override
public boolean dispatchTouchEvent(MotionEvent event) {
if(isFuckVIVORoom()){ //VIVO的部分机型需要做特殊处理,Fuck
event.setLocation(event.getX(), event.getY()+XPopupUtils.getStatusBarHeight(getWindow()));
}
return super.dispatchTouchEvent(event);
}

}

0 comments on commit a8a41ca

Please sign in to comment.