1
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"minSdkVersion": "21"
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import Paint from 'android.graphics.Paint';
|
||||
import ColorMatrix from 'android.graphics.ColorMatrix';
|
||||
import ColorMatrixColorFilter from 'android.graphics.ColorMatrixColorFilter';
|
||||
import View from 'android.view.View';
|
||||
import ViewGroup from 'android.view.ViewGroup';
|
||||
export function setWindowGrey(ele:any|null=null) {
|
||||
let paint = new Paint()
|
||||
let colorMatrix = new ColorMatrix()
|
||||
colorMatrix.setSaturation((0).toFloat())
|
||||
let decorView = UTSAndroid.getUniActivity()!.window.decorView as ViewGroup
|
||||
|
||||
paint.setColorFilter(new ColorMatrixColorFilter(colorMatrix))
|
||||
|
||||
decorView.setLayerType(View.LAYER_TYPE_HARDWARE,paint)
|
||||
}
|
||||
export function removeWindowGrey(ele:any|null=null) {
|
||||
let paint = new Paint()
|
||||
let colorMatrix = new ColorMatrix()
|
||||
colorMatrix.setSaturation((1).toFloat())
|
||||
let decorView = UTSAndroid.getUniActivity()!.window.decorView as ViewGroup
|
||||
paint.setColorFilter(new ColorMatrixColorFilter(colorMatrix))
|
||||
|
||||
decorView.setLayerType(View.LAYER_TYPE_HARDWARE,paint)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import window from '@ohos.window';
|
||||
|
||||
// window.getLastWindow(UTSHarmony.getUIAbilityContext()).then((win:window.Window)=>{
|
||||
// win.setWindowColorSpace(window.ColorSpace.WIDE_GAMUT)
|
||||
// })
|
||||
|
||||
export function setWindowGrey(ele:any|null=null) {
|
||||
|
||||
|
||||
|
||||
}
|
||||
export function removeWindowGrey(ele:any|null=null) {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSPrivacyAccessedAPITypes</key>
|
||||
<array/>
|
||||
<key>NSPrivacyCollectedDataTypes</key>
|
||||
<array/>
|
||||
<key>NSPrivacyTracking</key>
|
||||
<false/>
|
||||
<key>NSPrivacyTrackingDomains</key>
|
||||
<array/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"deploymentTarget": "12"
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import { UIViewController, UIView, UIWindow, UIScreen, UIColor } from 'UIKit';
|
||||
import { CIFilter } from 'CoreImage';
|
||||
|
||||
let greayUview : UIView | null = null;
|
||||
export function setWindowGrey(ele:any|null=null) {
|
||||
if (UTSiOS.available("iOS 13.0, *")) {
|
||||
let winsize = UIScreen.main.bounds as CGRect;
|
||||
let view = new UIView();
|
||||
view.backgroundColor = UIColor.lightGray
|
||||
|
||||
view.frame = winsize;
|
||||
view.isUserInteractionEnabled = false;
|
||||
view.layer.compositingFilter = "saturationBlendMode"
|
||||
let paret = UTSiOS.getCurrentViewController()
|
||||
greayUview = view;
|
||||
DispatchQueue.main.async(execute = () : void => {
|
||||
paret.view.addSubview(greayUview!)
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
export function removeWindowGrey(ele:any|null=null) {
|
||||
DispatchQueue.main.async(execute = () : void => {
|
||||
if (greayUview != null) {
|
||||
greayUview!.removeFromSuperview();
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
export function setWindowGrey(ele:UniElement) {
|
||||
ele.style.setProperty('filter', 'grayscale(1)')
|
||||
}
|
||||
export function removeWindowGrey(ele:UniElement) {
|
||||
// ele.style.removeProperty('filter')
|
||||
ele.style.setProperty('filter', 'none')
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
export function setWindowGrey(ele:any|null=null) {
|
||||
let dom = document.body;
|
||||
dom.style.setProperty('filter', 'grayscale(1)')
|
||||
}
|
||||
export function removeWindowGrey(ele:any|null=null) {
|
||||
let dom = document.body;
|
||||
dom.style.removeProperty('filter')
|
||||
}
|
||||
Reference in New Issue
Block a user