From b8a451b124604d4cdb1989067e9f87a4e95fdaaa Mon Sep 17 00:00:00 2001 From: gaojianming108 Date: Wed, 4 Aug 2021 18:12:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=B8=BF=E8=92=99=E7=A7=BB?= =?UTF-8?q?=E6=A4=8D=E5=8C=96=E6=96=B9=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/res/TypedArray.md | 90 ++++++++++++++++++++++++++++- graphics/Color.md | 41 +++++++++++++ graphics/drawable/BitmapDrawable.md | 23 ++++++++ webkit/WebViewClient.md | 31 ++++++++++ 4 files changed, 183 insertions(+), 2 deletions(-) create mode 100644 graphics/Color.md create mode 100644 graphics/drawable/BitmapDrawable.md create mode 100644 webkit/WebViewClient.md diff --git a/content/res/TypedArray.md b/content/res/TypedArray.md index 8110e62..33cf440 100644 --- a/content/res/TypedArray.md +++ b/content/res/TypedArray.md @@ -59,7 +59,93 @@ public class SideBar extends Text { } } - - + ``` + +## getColor +* openharmony API: ohos.agp.components.Attr.getColorValue +* openharmony SDK版本:2.2.0.1以上 +* IDE版本:2.2.0.200 +* 实现方案: + ``` + public static int getColorInt(AttrSet attrSet, String name, int defaultValue) { + int value = defaultValue; + try { + if (attrSet.getAttr(name) != null && attrSet.getAttr(name).isPresent()) { + value = attrSet.getAttr(name).get().getColorValue().getValue(); + } + } catch (Exception e) { + e.printStackTrace(); + } + return value; + } + ``` + +## getInteger +* openharmony API: ohos.agp.components.Attr.getIntegerValue +* openharmony SDK版本:2.2.0.1以上 +* IDE版本:2.2.0.200 +* 实现方案: + ``` + public static Integer getInteger(AttrSet attrSet, String name, Integer defaultValue) { + return attrSet.getAttr(name).map(Attr::getIntegerValue).orElse(defaultValue); + } + ``` + + +## getString +* openharmony API: ohos.agp.components.Attr.getStringValue +* openharmony SDK版本:2.2.0.1以上 +* IDE版本:2.2.0.200 +* 实现方案: + ``` + public static String getString(AttrSet attrSet, String name, String defaultValue) { + return attrSet.getAttr(name).map(Attr::getStringValue).orElse(defaultValue); + } + ``` + + +## getBoolean +* openharmony API: ohos.agp.components.Attr.getBoolValue +* openharmony SDK版本:2.2.0.1以上 +* IDE版本:2.2.0.200 +* 实现方案: + ``` + public static boolean getBoolean(AttrSet attrSet, String name, boolean defaultValue) { + return attrSet.getAttr(name).map(Attr::getBoolValue).orElse(defaultValue); + } + ``` + +## getFloat +* openharmony API: ohos.agp.components.Attr.getFloatValue +* openharmony SDK版本:2.2.0.1以上 +* IDE版本:2.2.0.200 +* 实现方案: + ``` + public static float getFloat(AttrSet attrSet, String name, float defaultValue) { + return attrSet.getAttr(name).map(Attr::getFloatValue).orElse(defaultValue); + } + ``` + + +## getDimension +* openharmony API: ohos.agp.components.Attr.getDimensionValue +* openharmony SDK版本:2.2.0.1以上 +* IDE版本:2.2.0.200 +* 实现方案: + ``` + public static int getDimensionValue(AttrSet attrSet, String name, int defaultValue) { + return attrSet.getAttr(name).map(Attr::getDimensionValue).orElse(defaultValue); + } + ``` + +## getDrawable +* openharmony API: ohos.agp.components.Attr.getElement +* openharmony SDK版本:2.2.0.1以上 +* IDE版本:2.2.0.200 +* 实现方案: + ``` + public static Element getElement(AttrSet attrSet, String name, Element defaultValue) { + return attrSet.getAttr(name).map(Attr::getElement).orElse(defaultValue); + } ``` \ No newline at end of file diff --git a/graphics/Color.md b/graphics/Color.md new file mode 100644 index 0000000..cc97e01 --- /dev/null +++ b/graphics/Color.md @@ -0,0 +1,41 @@ +### **argb(int, int, int, int)** +* openharmony API: ohos.agp.utils.Color.argb(int, int, int, int) +* openharmony SDK版本:2.2.0.1以上 +* IDE版本:2.2.0.200 +* 实现方案:使用方法如下 +```java +// 原库的用法 +mText.setTextColor(Color.argb(255, 38, 171, 95)); + +// 鸿蒙的用法 +mText.setTextColor(new Color(Color.argb(255, 38, 171, 95))); + +``` + +### **rgb(int, int, int)** +* openharmony API: ohos.agp.utils.Color.argb(int, int, int) +* openharmony SDK版本:2.2.0.1以上 +* IDE版本:2.2.0.200 +* 实现方案:使用方法如下 +```java +// 原库的用法 +mText.setTextColor(Color.argb(38, 171, 95)); + +// 鸿蒙的用法 +mText.setTextColor(new Color(Color.argb(38, 171, 95))); + +``` + +### **parseColor(String)** +* openharmony API: ohos.agp.utils.Color.getIntColor(String) +* openharmony SDK版本:2.2.0.1以上 +* IDE版本:2.2.0.200 +* 实现方案:使用方法如下 +```java +// 原库的用法 +mTextView.setTextColor(Color.parseColor("#D81E06")); + +// 鸿蒙的用法 +mText.setTextColor(new Color(Color.getIntColor("#D81E06"))); + +``` \ No newline at end of file diff --git a/graphics/drawable/BitmapDrawable.md b/graphics/drawable/BitmapDrawable.md new file mode 100644 index 0000000..238e30f --- /dev/null +++ b/graphics/drawable/BitmapDrawable.md @@ -0,0 +1,23 @@ +### BitmapDrawable(Bitmap) +* openharmony API: ohos.agp.components.element.PixelMapElement(PixelMap) +* openharmony SDK版本:2.2.0.1以上 +* IDE版本:2.2.0.200 +* 实现方案:直接替换 + +### BitmapDrawable(Resources) +* openharmony API: ohos.agp.components.element.PixelMapElement(Resource) +* openharmony SDK版本:2.2.0.1以上 +* IDE版本:2.2.0.200 +* 实现方案:直接替换 + +### getBitmap +* openharmony API: ohos.agp.components.element.PixelMapElement.getPixelMap +* openharmony SDK版本:2.2.0.1以上 +* IDE版本:2.2.0.200 +* 实现方案:直接替换 + +### setFilterBitmap +* openharmony API: ohos.agp.components.element.PixelMapElement.setFilterPixelMap +* openharmony SDK版本:2.2.0.1以上 +* IDE版本:2.2.0.200 +* 实现方案:直接替换 diff --git a/webkit/WebViewClient.md b/webkit/WebViewClient.md new file mode 100644 index 0000000..dbe34d7 --- /dev/null +++ b/webkit/WebViewClient.md @@ -0,0 +1,31 @@ +### shouldOverrideUrlLoading +* openharmony API: ohos.agp.components.webengine.WebAgent.isNeedLoadUrl +* openharmony SDK版本:2.2.0.1以上 +* IDE版本:2.2.0.200 +* 实现方案:直接替换 + +### onReceivedError +* openharmony API: ohos.agp.components.webengine.WebAgent.onError +* openharmony SDK版本:2.2.0.1以上 +* IDE版本:2.2.0.200 +* 实现方案:直接替换 + +### onPageStarted +* openharmony API: ohos.agp.components.webengine.WebAgent.onLoadingPage +* openharmony SDK版本:2.2.0.1以上 +* IDE版本:2.2.0.200 +* 实现方案:直接替换 + +### onPageFinished +* openharmony API: ohos.agp.components.webengine.WebAgent.onPageLoaded +* openharmony SDK版本:2.2.0.1以上 +* IDE版本:2.2.0.200 +* 实现方案:直接替换 + +### onLoadResource +* openharmony API: ohos.agp.components.webengine.WebAgent.onLoadingContent +* openharmony SDK版本:2.2.0.1以上 +* IDE版本:2.2.0.200 +* 实现方案:直接替换 + + \ No newline at end of file -- Gitee