From 4c4d1e5d8e6422d00b50fb3c56b182b13c43cb0a Mon Sep 17 00:00:00 2001 From: xuechangfeng <963779172@qq.com> Date: Thu, 8 Jul 2021 10:01:43 +0800 Subject: [PATCH] =?UTF-8?q?7.8findBugs=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 + README.md | 4 +- build.gradle | 2 +- .../sample/adapter/ListItemProvider.java | 3 - .../adapter/ListItemProviderCircle.java | 2 +- .../ohos/speeddial/sample/beans/ListBean.java | 5 ++ .../sample/beans/ListBeanCircle.java | 21 ++++- .../sample/custom/CustomAttachDialogFive.java | 3 +- .../custom/CustomAttachDialogFiveItem.java | 6 +- .../CustomAttachDialogFiveItemClose.java | 6 +- .../CustomAttachDialogFiveItemOpen.java | 5 +- .../sample/custom/CustomAttachDialogFour.java | 83 ------------------- 12 files changed, 33 insertions(+), 109 deletions(-) delete mode 100644 entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFour.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 905ae6e..b78d464 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +## 0.0.2-SNAPSHOT +ohos 第二个版本,修复了findbugs问题,更新SDK6 ## 0.0.1-SNAPSHOT ohos第一个版本,完整实现了原库的全部api - 因为鸿蒙暂不支持ListContainer动画展开效果,按钮展开动画未实现,不影响主功能。 \ No newline at end of file diff --git a/README.md b/README.md index 93d267a..eb29df6 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ allprojects { 2.在app模块的build.gradle文件中 ```gradle dependencies { - implementation('com.gitee.chinasoft_ohos:FloatingActionButtonSpeedDial:0.0.1-SNAPSHOT') + implementation('com.gitee.chinasoft_ohos:FloatingActionButtonSpeedDial:0.0.2-SNAPSHOT') ...... } ``` @@ -125,7 +125,7 @@ CloudTest代码测试无异常 #### 版本迭代 -- 0.0.1-SNAPSHOT +- 0.0.2-SNAPSHOT #### 版权和许可信息 ``` diff --git a/build.gradle b/build.gradle index bf479ca..ba694e8 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.huawei.ohos:hap:2.4.5.0' + classpath 'com.huawei.ohos:hap:2.4.4.2' classpath 'com.huawei.ohos:decctest:1.2.4.1' } } diff --git a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/adapter/ListItemProvider.java b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/adapter/ListItemProvider.java index 77661e5..648df61 100644 --- a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/adapter/ListItemProvider.java +++ b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/adapter/ListItemProvider.java @@ -68,11 +68,8 @@ public class ListItemProvider extends BaseItemProvider { cpt = convertComponent; } ListBean mText = list.get(position); - DependentLayout mDirectionalLayout = (DependentLayout) cpt.findComponentById(ResourceTable.Id_item_DirectionalLayout); Text text = (Text) cpt.findComponentById(ResourceTable.Id_item_text); - text.setText(mText.getText()); - return cpt; } } \ No newline at end of file diff --git a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/adapter/ListItemProviderCircle.java b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/adapter/ListItemProviderCircle.java index 7c12b94..6333337 100644 --- a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/adapter/ListItemProviderCircle.java +++ b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/adapter/ListItemProviderCircle.java @@ -184,7 +184,7 @@ public class ListItemProviderCircle extends BaseItemProvider { } // 用于保存列表项中的子组件信息 - public class SettingHolder { + public static class SettingHolder { DependentLayout mDependentLayout; Image mImage; Text mText; diff --git a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/beans/ListBean.java b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/beans/ListBean.java index ba95e63..9629fed 100644 --- a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/beans/ListBean.java +++ b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/beans/ListBean.java @@ -23,6 +23,11 @@ package com.leinardi.ohos.speeddial.sample.beans; public class ListBean { private String text; + /** + * 构造方法 + * + * @param text + */ public ListBean(String text) { this.text = text; } diff --git a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/beans/ListBeanCircle.java b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/beans/ListBeanCircle.java index e2e92b0..3be8159 100644 --- a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/beans/ListBeanCircle.java +++ b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/beans/ListBeanCircle.java @@ -20,10 +20,13 @@ public class ListBeanCircle { private int mImage; private String text; - public ListBeanCircle() { - - } - + /** + * 构造方法 + * + * @param id + * @param mImage + * @param text + */ public ListBeanCircle(int id, int mImage, String text) { this.id = id; this.mImage = mImage; @@ -38,10 +41,20 @@ public class ListBeanCircle { this.id = id; } + /** + * 获取 + * + * @return mImage + */ public int getmImage() { return mImage; } + /** + * 获取 + * + * @param mImage + */ public void setmImage(int mImage) { this.mImage = mImage; } diff --git a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFive.java b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFive.java index a147b20..c5d5ac9 100644 --- a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFive.java +++ b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFive.java @@ -43,7 +43,7 @@ public class CustomAttachDialogFive extends AttachPopupView implements Component } public interface CustomAttachDialogListener { - public void onClick(Component component); + void onClick(Component component); } @Override @@ -59,7 +59,6 @@ public class CustomAttachDialogFive extends AttachPopupView implements Component final DirectionalLayout dl_add_action = (DirectionalLayout) findComponentById(ResourceTable.Id_dl_add_action); final DirectionalLayout dl_remove_action = (DirectionalLayout) findComponentById(ResourceTable.Id_dl_remove_action); final DependentLayout tv_dl_main_fab = (DependentLayout) findComponentById(ResourceTable.Id_dl_main_fab); - final DirectionalLayout dl_layout_dialog_five = (DirectionalLayout) findComponentById(ResourceTable.Id_dl_layout_dialog_five); dl_toggle_list.setClickedListener(this::onClick); dl_reverse_animation.setClickedListener(this::onClick); diff --git a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFiveItem.java b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFiveItem.java index f33709e..70e1170 100644 --- a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFiveItem.java +++ b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFiveItem.java @@ -19,7 +19,6 @@ import com.leinardi.ohos.speeddial.sample.ResourceTable; import com.lxj.xpopup.core.AttachPopupView; import ohos.agp.components.Component; import ohos.agp.components.DependentLayout; -import ohos.agp.components.Text; import ohos.app.Context; /** @@ -48,7 +47,7 @@ public class CustomAttachDialogFiveItem extends AttachPopupView implements Compo } public interface CustomAttachDialogListener { - public void onClick(Component component); + void onClick(Component component); } @Override @@ -59,9 +58,6 @@ public class CustomAttachDialogFiveItem extends AttachPopupView implements Compo @Override protected void onCreate() { super.onCreate(); - final Text tv_main_fab_color = (Text) findComponentById(ResourceTable.Id_tv_main_fab_color); - final Text tv_main_fab_open = (Text) findComponentById(ResourceTable.Id_tv_main_fab_open); - final Text tv_main_fab_close = (Text) findComponentById(ResourceTable.Id_tv_main_fab_close); final DependentLayout mainFabColorOpen = (DependentLayout) findComponentById(ResourceTable.Id_dl_main_fab_color_open); final DependentLayout mainFabColorClose = (DependentLayout) findComponentById(ResourceTable.Id_dl_main_fab_color_close); diff --git a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFiveItemClose.java b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFiveItemClose.java index 4d958f7..19d7e05 100644 --- a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFiveItemClose.java +++ b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFiveItemClose.java @@ -27,12 +27,10 @@ import ohos.app.Context; * @since 2021-06-29 */ public class CustomAttachDialogFiveItemClose extends AttachPopupView implements Component.ClickedListener { - private Context context; private CustomFiveItemCloseListenner customFiveItemCloseListenner; - public CustomAttachDialogFiveItemClose(Context context, CustomFiveItemCloseListenner customFiveItemCloseListenner) { - super(context, null); - this.context = context; + public CustomAttachDialogFiveItemClose(Context mContext, CustomFiveItemCloseListenner customFiveItemCloseListenner) { + super(mContext, null); this.customFiveItemCloseListenner = customFiveItemCloseListenner; } diff --git a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFiveItemOpen.java b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFiveItemOpen.java index 7ef2bfb..8a728b7 100644 --- a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFiveItemOpen.java +++ b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFiveItemOpen.java @@ -27,22 +27,19 @@ import ohos.app.Context; * @since 2021.06.29 */ public class CustomAttachDialogFiveItemOpen extends AttachPopupView implements Component.ClickedListener { - private Context context; private CustomAttachDialogFiveItemListener customAttachDialogFiveItemListener; public CustomAttachDialogFiveItemOpen(Context context, CustomAttachDialogFiveItemListener customAttachDialogFiveItemListener) { super(context, null); - this.context = context; this.customAttachDialogFiveItemListener = customAttachDialogFiveItemListener; } public CustomAttachDialogFiveItemOpen(Context context) { super(context, null); - this.context = context; } public interface CustomAttachDialogFiveItemListener { - public void onClick(Component component); + void onClick(Component component); } @Override diff --git a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFour.java b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFour.java deleted file mode 100644 index 9d887fe..0000000 --- a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFour.java +++ /dev/null @@ -1,83 +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.leinardi.ohos.speeddial.sample.custom; - -import com.leinardi.ohos.speeddial.sample.ResourceTable; -import com.lxj.xpopup.core.AttachPopupView; -import ohos.agp.components.Component; -import ohos.agp.components.Text; -import ohos.app.Context; - -/** - * CustomAttachDialogFour - * - * @since 2021-06-29 - */ -public class CustomAttachDialogFour extends AttachPopupView implements Component.ClickedListener { - private Context context; - private LeaveMyDialogListener leaveMyDialogListener; - - public CustomAttachDialogFour(Context context, LeaveMyDialogListener leaveMyDialogListener) { - super(context, null); - this.context = context; - this.leaveMyDialogListener = leaveMyDialogListener; - } - - public CustomAttachDialogFour(Context context) { - super(context, null); - this.context = context; - } - - @Override - public void onClick(Component component) { - leaveMyDialogListener.onClick(component); - } - - public interface LeaveMyDialogListener { - public void onClick(Component component); - } - - @Override - protected int getImplLayoutId() { - return ResourceTable.Layout_custom_attach_popup_four; - } - - @Override - protected void onCreate() { - super.onCreate(); - final Text tvZeroDegree = (Text) findComponentById(ResourceTable.Id_tv_zero_degree); - final Text tvFourDegree = (Text) findComponentById(ResourceTable.Id_tv_zero_four_degree); - final Text tvNithDegree = (Text) findComponentById(ResourceTable.Id_tv_nith_degree); - final Text tvEiGthDegree = (Text) findComponentById(ResourceTable.Id_tv_eigh_degree); - tvZeroDegree.setText("0 degrees"); - tvFourDegree.setText("45 degrees"); - tvNithDegree.setText("90 degrees"); - tvEiGthDegree.setText("180 degrees"); - - tvZeroDegree.setClickedListener(this::onClick); - tvFourDegree.setClickedListener(this::onClick); - tvNithDegree.setClickedListener(this::onClick); - tvEiGthDegree.setClickedListener(this::onClick); - - //getPopupImplView().setBackground(XPopupUtils.createDrawable(0xFFFFFFFF, popupInfo.borderRadius, 0, popupInfo.borderRadius, 0)); - } - - // 设置状态栏的高度,用以修正自定义位置弹窗的高度 - @Override - protected int setStatusBarHeight() { - return 130; - } -} -- Gitee