diff --git a/content/res/TypedArray.md b/content/res/TypedArray.md index 8110e62422b2dc138dd9d38909ebfc5edc4be7b3..33cf4408624f1f717ce8516b2f9b0f029afb9e6f 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 0000000000000000000000000000000000000000..cc97e01bbd402cef99bf1cd16358402f8bcfc3a2 --- /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 0000000000000000000000000000000000000000..238e30f3bc1c313c6280c0da0ed36962183c3105 --- /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 0000000000000000000000000000000000000000..dbe34d7acc915f0fd06c8bc4a1ed20bc4cb35c50 --- /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