From f018571914aa63c7cd2ca19dd45e36def208bcf9 Mon Sep 17 00:00:00 2001 From: xuechangfeng <963779172@qq.com> Date: Thu, 8 Jul 2021 20:35:29 +0800 Subject: [PATCH] =?UTF-8?q?7.8=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 3 + .../com/tylersuehr/chips/TypedAttrUtils.java | 108 ------------------ 2 files changed, 3 insertions(+), 108 deletions(-) delete mode 100644 library/src/main/java/com/tylersuehr/chips/TypedAttrUtils.java diff --git a/build.gradle b/build.gradle index bf479ca..a4bbee5 100644 --- a/build.gradle +++ b/build.gradle @@ -26,6 +26,9 @@ buildscript { allprojects { repositories { + maven { + url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' + } maven { url 'https://repo.huaweicloud.com/repository/maven/' } diff --git a/library/src/main/java/com/tylersuehr/chips/TypedAttrUtils.java b/library/src/main/java/com/tylersuehr/chips/TypedAttrUtils.java deleted file mode 100644 index a934236..0000000 --- a/library/src/main/java/com/tylersuehr/chips/TypedAttrUtils.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (C) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.tylersuehr.chips; - -import ohos.agp.components.Attr; -import ohos.agp.components.AttrSet; -import ohos.agp.utils.Color; -import ohos.hiviewdfx.HiLog; -import ohos.hiviewdfx.HiLogLabel; - -import java.util.NoSuchElementException; - -/** - * author zhaoxudong - * Version 1.0 - * ModifiedBy - * date 2021-02-22 10:12 - * description 工具类 - */ -public final class TypedAttrUtils { - static final HiLogLabel label = new HiLogLabel(HiLog.LOG_APP, 0x00201, "jiangbenfu"); - - public static int getIntColor(AttrSet attrs, String attrName, int defValue) { - Attr attr = attrNoSuchElement(attrs, attrName); - if (attr == null) { - return defValue; - } else { - return attr.getColorValue().getValue(); - } - } - - public static Color getColor(AttrSet attrs, String attrName, Color defValue) { - Attr attr = attrNoSuchElement(attrs, attrName); - if (attr == null) { - return defValue; - } else { - return attr.getColorValue(); - } - } - - public static int getInteger(AttrSet attrs, String attrName, int defValue) { - Attr attr = attrNoSuchElement(attrs, attrName); - if (attr == null) { - return defValue; - } else { - return attr.getIntegerValue(); - } - } - - public static float getFloat(AttrSet attrs, String attrName, float defValue) { - Attr attr = attrNoSuchElement(attrs, attrName); - if (attr == null) { - return defValue; - } else { - return attr.getFloatValue(); - } - } - - public static String getString(AttrSet attrs, String attrName, String defValue) { - Attr attr = attrNoSuchElement(attrs, attrName); - if (attr == null) { - return defValue; - } else { - return attr.getStringValue(); - } - } - - public static int getDimensionPixelSize(AttrSet attrs, String attrName, int defValue) { - Attr attr = attrNoSuchElement(attrs, attrName); - if (attr == null) { - return defValue; - } else { - return attr.getIntegerValue(); - } - } - - public static int getLayoutDimension(AttrSet attrs, String attrName, int defValue) { - Attr attr = attrNoSuchElement(attrs, attrName); - if (attr == null) { - return defValue; - } else { - return attr.getDimensionValue(); - } - } - - private static Attr attrNoSuchElement(AttrSet attrs, String attrName) { - Attr attr = null; - try { - attr = attrs.getAttr(attrName).get(); - } catch (NoSuchElementException e) { - HiLog.info(label, "Exception = " + e.toString()); - } - return attr; - } -} -- Gitee