[go: nahoru, domu]

Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
Revert "* [Android] adapter screen height for full screen (#1981)" (#…
Browse files Browse the repository at this point in the history
…2076)

This reverts commit 32be2e5.
  • Loading branch information
lucky-chen authored and YorkShen committed Jan 24, 2019
1 parent 8e7e650 commit 709e948
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 43 deletions.
10 changes: 0 additions & 10 deletions android/sdk/src/main/java/com/taobao/weex/WXSDKEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Build;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.provider.Settings;
import android.support.v4.content.LocalBroadcastManager;
import android.text.TextUtils;

Expand Down Expand Up @@ -100,7 +96,6 @@
import com.taobao.weex.utils.WXExceptionUtils;
import com.taobao.weex.utils.WXLogUtils;
import com.taobao.weex.utils.WXSoInstallMgrSdk;
import com.taobao.weex.utils.WXViewUtils;
import com.taobao.weex.utils.batch.BatchOperationHelper;

import java.io.Serializable;
Expand Down Expand Up @@ -247,11 +242,6 @@ public void run() {
}
});
register();

//2ms,onepluse2 ,full screen adapter for mix2 ,v2ex link :https://www.v2ex.com/t/470543
if (null!=application && Build.VERSION.SDK_INT > VERSION_CODES.JELLY_BEAN && "xiaomi".equalsIgnoreCase(Build.MANUFACTURER)){
WXViewUtils.isMiUiForceFsgNavBar = Settings.Global.getInt(application.getContentResolver(), "force_fsg_nav_bar", 0) != 0;
}
}

@Deprecated
Expand Down
37 changes: 4 additions & 33 deletions android/sdk/src/main/java/com/taobao/weex/utils/WXViewUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
package com.taobao.weex.utils;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
Expand All @@ -30,17 +28,13 @@
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.os.Build;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.provider.Settings;
import android.support.annotation.IntDef;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.WindowManager;
import com.taobao.weex.WXEnvironment;
import com.taobao.weex.WXSDKInstance;
import com.taobao.weex.WXSDKManager;
Expand Down Expand Up @@ -107,7 +101,7 @@ public static int generateViewId() {
}

private static int mScreenWidth;
private static int mScreenHeight = -1;
private static int mScreenHeight;


public static int getWeexHeight(String instanceId){
Expand Down Expand Up @@ -184,35 +178,12 @@ public static int getScreenHeight() {
return getScreenHeight(WXEnvironment.sApplication);
}

public static boolean isMiUiForceFsgNavBar = false;

public static int getScreenHeight(Context cxt) {
if(cxt!=null){
boolean useNewApiForAdapterFullScreen = false;

if (Build.VERSION.SDK_INT > VERSION_CODES.JELLY_BEAN){
if ("xiaomi".equalsIgnoreCase(Build.MANUFACTURER)){
useNewApiForAdapterFullScreen = isMiUiForceFsgNavBar;
}else {
useNewApiForAdapterFullScreen = true;
}
}

if (useNewApiForAdapterFullScreen){
WindowManager wm = (WindowManager)cxt.getSystemService(Context.WINDOW_SERVICE);
if (null == wm){
mScreenHeight =cxt.getResources().getDisplayMetrics().heightPixels;
}else {
DisplayMetrics size = new DisplayMetrics();
wm.getDefaultDisplay().getRealMetrics(size);
mScreenHeight = size.heightPixels;
}
}else {
mScreenHeight =cxt.getResources().getDisplayMetrics().heightPixels;
}

Resources res = cxt.getResources();
mScreenHeight =cxt.getResources().getDisplayMetrics().heightPixels;
if(WXEnvironment.SETTING_FORCE_VERTICAL_SCREEN){
mScreenWidth = cxt.getResources()
mScreenWidth = res
.getDisplayMetrics()
.widthPixels;
mScreenHeight = mScreenHeight > mScreenWidth ? mScreenHeight : mScreenWidth;
Expand Down

0 comments on commit 709e948

Please sign in to comment.