getItems() {
- if (adapter == null) {
- return null;
- } else {
- return adapter.getItems();
- }
- }
-
/**
* 鏈夋洿鏀 : 璋冩暣寮圭獥鏄剧ず浣嶇疆
* Show the dropdown menu
@@ -483,12 +504,15 @@ public class MaterialSpinner extends Text implements Component.TouchEventListene
nothingSelected = true;
initPopupWindow(mContext);
- popupWindow.setSize(ScreenUtils.getDisplayWidth(mContext) / 5 * 2, adapter.getCount() * ScreenUtils.pxToFp(mContext,36) + 10);
- listView.setComponentSize(ScreenUtils.getDisplayWidth(mContext) / 5 * 2, adapter.getCount() * ScreenUtils.pxToFp(mContext,36) + 10);
- // popupWindow.setSize(ScreenUtils.getDisplayWidth(mContext) / 5 * 2, calculatePopupWindowHeight());
+ popupWindow.setSize(ScreenUtils.getDisplayWidth(mContext) / 5 * 2,
+ adapter.getCount() * ScreenUtils.pxToFp(mContext,36) + 10);
+ listView.setComponentSize(ScreenUtils.getDisplayWidth(mContext) / 5 * 2,
+ adapter.getCount() * ScreenUtils.pxToFp(mContext,36) + 10);
int[] locationOnScreen = this.getLocationOnScreen();
- HiLog.info(LABEL, "locationOnScreen[1] = " + locationOnScreen[1] + ", " + spinnerWidth + ",locationOnScreen[1]" + locationOnScreen[1]);
- popupWindow.showOnCertainPosition(LayoutAlignment.LEFT | LayoutAlignment.TOP, locationOnScreen[0] + 60, locationOnScreen[1] + this.getComponentSize().getSizeYToInt() + 10);
+ HiLog.info(LABEL, "locationOnScreen[1] = " + locationOnScreen[1] + ", "
+ + spinnerWidth + ",locationOnScreen[1]" + locationOnScreen[1]);
+ popupWindow.showOnCertainPosition(LayoutAlignment.LEFT | LayoutAlignment.TOP,
+ locationOnScreen[0] + 60, locationOnScreen[1] + this.getComponentSize().getSizeYToInt() + 10);
isShow = true;
}
}
@@ -600,7 +624,9 @@ public class MaterialSpinner extends Text implements Component.TouchEventListene
HiLog.info(LABEL, e.toString());
}
float listViewHeight = adapter.getCount() * itemHeight;
- HiLog.info(LABEL, "itemHeight = " + itemHeight + ", listViewHeight = " + listViewHeight + ", popupWindowMaxHeight = " + popupWindowMaxHeight + ", popupWindowHeight = " + popupWindowHeight);
+ HiLog.info(LABEL, "itemHeight = " + itemHeight + ", listViewHeight = "
+ + listViewHeight + ", popupWindowMaxHeight = " + popupWindowMaxHeight
+ + ", popupWindowHeight = " + popupWindowHeight);
if (popupWindowMaxHeight > 0 && listViewHeight > popupWindowMaxHeight) {
HiLog.info(LABEL, "if = ");
return popupWindowMaxHeight;
@@ -653,12 +679,14 @@ public class MaterialSpinner extends Text implements Component.TouchEventListene
*
* OnItemSelectedListener
*
+ * @param OnItemSelectedListener
* @since 2021-03-29
*/
public interface OnItemSelectedListener {
/**
- * Callback method to be invoked when an item in this view has been selected. This callback is invoked only when
+ *
Callback method to be invoked when an item in this view has been selected.
+ * This callback is invoked only when
* the newly selected position is different from the previously selected position or if there was no selected
* item.
*
diff --git a/entry/src/main/java/com/chinasoft/ohos/spinner/MaterialSpinnerAdapter.java b/entry/src/main/java/com/chinasoft/ohos/spinner/MaterialSpinnerAdapter.java
index bd675d252046fd205a38bbc1d9221dec8b6770bc..0f270d2fc9f45bdcbf0fdbb45eda00835df0711e 100644
--- a/entry/src/main/java/com/chinasoft/ohos/spinner/MaterialSpinnerAdapter.java
+++ b/entry/src/main/java/com/chinasoft/ohos/spinner/MaterialSpinnerAdapter.java
@@ -29,6 +29,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.chinasoft.ohos.spinner;
import ohos.app.Context;
@@ -38,12 +39,19 @@ import java.util.List;
/**
* MaterialSpinnerAdapter
*
+ * @param MaterialSpinnerAdapter
* @since 2021-03-29
*/
public class MaterialSpinnerAdapter extends MaterialSpinnerBaseAdapter {
private final List items;
+ /**
+ * MaterialSpinnerAdapter
+ *
+ * @param context
+ * @param items
+ */
public MaterialSpinnerAdapter(Context context, List items) {
super(context);
this.items = items;
diff --git a/entry/src/main/java/com/chinasoft/ohos/spinner/MaterialSpinnerBaseAdapter.java b/entry/src/main/java/com/chinasoft/ohos/spinner/MaterialSpinnerBaseAdapter.java
index 6691f9fef024114a42df1f442142b0b500d2dd41..f45c212b035d9bac23455dec770a2c476db07174 100644
--- a/entry/src/main/java/com/chinasoft/ohos/spinner/MaterialSpinnerBaseAdapter.java
+++ b/entry/src/main/java/com/chinasoft/ohos/spinner/MaterialSpinnerBaseAdapter.java
@@ -1,20 +1,3 @@
-/*
- * Copyright (C) 2016 Jared Rummler
- *
- * 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.
- *
- */
-
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -29,9 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.chinasoft.ohos.spinner;
import com.chinasoft.ohos.ResourceTable;
+
import ohos.agp.colors.RgbColor;
import ohos.agp.components.*;
import ohos.agp.components.element.ShapeElement;
@@ -46,6 +31,7 @@ import java.util.List;
/**
* CameraAbilitySlice
*
+ * @param MaterialSpinnerBaseAdapter
* @since 2021-03-29
*/
public abstract class MaterialSpinnerBaseAdapter extends RecycleItemProvider {
@@ -62,6 +48,11 @@ public abstract class MaterialSpinnerBaseAdapter extends RecycleItemProvider
private int popupPaddingRight;
private boolean isHintEnabled;
+ /**
+ * MaterialSpinnerBaseAdapter
+ *
+ * @param context
+ */
public MaterialSpinnerBaseAdapter(Context context) {
this.context = context;
}
@@ -75,7 +66,8 @@ public abstract class MaterialSpinnerBaseAdapter extends RecycleItemProvider
textView = (Text) convertView.findComponentById(ResourceTable.Id_tv_tinted_spinner);
textView.setTextColor(new Color(textColor));
textView.setTextSize(textSize);
- HiLog.info(LOG_LABEL, "getComponent popupPaddingLeft = " + popupPaddingLeft + ", popupPaddingTop = " + popupPaddingTop);
+ HiLog.info(LOG_LABEL, "getComponent popupPaddingLeft = " + popupPaddingLeft
+ + ", popupPaddingTop = " + popupPaddingTop);
textView.setMarginsLeftAndRight(popupPaddingLeft, popupPaddingRight);
textView.setMarginsTopAndBottom(popupPaddingTop, popupPaddingBottom);
@@ -97,6 +89,12 @@ public abstract class MaterialSpinnerBaseAdapter extends RecycleItemProvider
return convertView;
}
+ /**
+ * getItemText
+ *
+ * @param position
+ * @return ItemText
+ */
public String getItemText(int position) {
return getItem(position).toString();
}
@@ -106,8 +104,10 @@ public abstract class MaterialSpinnerBaseAdapter extends RecycleItemProvider
}
/**
- * @javadoc notifyItemSelected
+ * notifyItemSelected
+ *
* @param index
+ * @javadoc notifyItemSelected
*/
public void notifyItemSelected(int index) {
selectedIndex = index;
@@ -124,8 +124,19 @@ public abstract class MaterialSpinnerBaseAdapter extends RecycleItemProvider
@Override
public abstract int getCount();
+ /**
+ * get
+ *
+ * @param position
+ * @return T
+ */
public abstract T get(int position);
+ /**
+ * getItems
+ *
+ * @return List
+ */
public abstract List getItems();
public void setHintEnabled(boolean ishintenabled) {
@@ -136,23 +147,51 @@ public abstract class MaterialSpinnerBaseAdapter extends RecycleItemProvider
return this.isHintEnabled;
}
+ /**
+ * setTextColor
+ *
+ * @param textColor
+ * @return MaterialSpinnerBaseAdapter
+ */
public MaterialSpinnerBaseAdapter setTextColor(int textColor) {
this.textColor = textColor;
return this;
}
+ /**
+ * setTextSize
+ *
+ * @param textSize
+ * @return MaterialSpinnerBaseAdapter
+ */
public MaterialSpinnerBaseAdapter setTextSize(int textSize) {
this.textSize = textSize;
return this;
}
+ /**
+ * setBackgroundSelector
+ *
+ * @param backgroundSelector
+ * @return MaterialSpinnerBaseAdapter
+ */
public MaterialSpinnerBaseAdapter setBackgroundSelector(int backgroundSelector) {
this.backgroundSelector = backgroundSelector;
return this;
}
+ /**
+ * setPopupPadding
+ *
+ * @param left
+ * @param top
+ * @param right
+ * @param bottom
+ * @return MaterialSpinnerBaseAdapter
+ */
public MaterialSpinnerBaseAdapter setPopupPadding(int left, int top, int right, int bottom) {
- HiLog.info(LOG_LABEL, "setPopupPadding popupPaddingLeft = " + popupPaddingLeft + ", popupPaddingTop = " + popupPaddingTop);
+ HiLog.info(LOG_LABEL, "setPopupPadding popupPaddingLeft = "
+ + popupPaddingLeft + ", popupPaddingTop = " + popupPaddingTop);
this.popupPaddingLeft = left;
this.popupPaddingTop = top;
this.popupPaddingRight = right;
@@ -160,8 +199,14 @@ public abstract class MaterialSpinnerBaseAdapter extends RecycleItemProvider
return this;
}
+ /**
+ * ViewHolder
+ *
+ * @since 2021-04-22
+ */
private static class ViewHolder {
private Text textView;
+
private ViewHolder(Text textView) {
this.textView = textView;
}
diff --git a/entry/src/main/java/com/chinasoft/ohos/spinner/TypedAttrUtils.java b/entry/src/main/java/com/chinasoft/ohos/spinner/TypedAttrUtils.java
index c5287e4e590ca0125c542d5fc373278028a92275..c14f1fcf0d13c99a82e49a0fb4048304c82b8f05 100644
--- a/entry/src/main/java/com/chinasoft/ohos/spinner/TypedAttrUtils.java
+++ b/entry/src/main/java/com/chinasoft/ohos/spinner/TypedAttrUtils.java
@@ -1,20 +1,3 @@
-/*
- * Copyright (C) 2016 Jared Rummler
- *
- * 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.
- *
- */
-
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -29,6 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.chinasoft.ohos.spinner;
@@ -48,6 +32,14 @@ import java.util.NoSuchElementException;
public class TypedAttrUtils {
static final HiLogLabel LOG_LABEL = new HiLogLabel(HiLog.LOG_APP, 0x00201, "TypedAttrUtils");
+ /**
+ * getIntColor
+ *
+ * @param attrs
+ * @param attrName
+ * @param defValue
+ * @return int
+ */
public static int getIntColor(AttrSet attrs, String attrName, int defValue) {
Attr attr = attrNoSuchElement(attrs, attrName);
if (attr == null) {
@@ -57,6 +49,14 @@ public class TypedAttrUtils {
}
}
+ /**
+ * getColor
+ *
+ * @param attrs
+ * @param attrName
+ * @param defValue
+ * @return Color
+ */
public static Color getColor(AttrSet attrs, String attrName, Color defValue) {
Attr attr = attrNoSuchElement(attrs, attrName);
if (attr == null) {
@@ -66,6 +66,14 @@ public class TypedAttrUtils {
}
}
+ /**
+ * getBoolean
+ *
+ * @param attrs
+ * @param attrName
+ * @param defValue
+ * @return boolean
+ */
public static boolean getBoolean(AttrSet attrs, String attrName, boolean defValue) {
Attr attr = attrNoSuchElement(attrs, attrName);
if (attr == null) {
@@ -75,6 +83,14 @@ public class TypedAttrUtils {
}
}
+ /**
+ * getString
+ *
+ * @param attrs
+ * @param attrName
+ * @param defValue
+ * @return String
+ */
public static String getString(AttrSet attrs, String attrName, String defValue) {
Attr attr = attrNoSuchElement(attrs, attrName);
if (attr == null) {
@@ -84,6 +100,14 @@ public class TypedAttrUtils {
}
}
+ /**
+ * getFloat
+ *
+ * @param attrs
+ * @param attrName
+ * @param defValue
+ * @return float
+ */
public static float getFloat(AttrSet attrs, String attrName, float defValue) {
Attr attr = attrNoSuchElement(attrs, attrName);
if (attr == null) {
@@ -93,6 +117,14 @@ public class TypedAttrUtils {
}
}
+ /**
+ * getInteger
+ *
+ * @param attrs
+ * @param attrName
+ * @param defValue
+ * @return getInteger
+ */
public static int getInteger(AttrSet attrs, String attrName, int defValue) {
Attr attr = attrNoSuchElement(attrs, attrName);
if (attr == null) {
@@ -102,6 +134,14 @@ public class TypedAttrUtils {
}
}
+ /**
+ * getDimensionPixelSize
+ *
+ * @param attrs
+ * @param attrName
+ * @param defValue
+ * @return int
+ */
public static int getDimensionPixelSize(AttrSet attrs, String attrName, int defValue) {
Attr attr = attrNoSuchElement(attrs, attrName);
if (attr == null) {
@@ -111,6 +151,14 @@ public class TypedAttrUtils {
}
}
+ /**
+ * getLayoutDimension
+ *
+ * @param attrs
+ * @param attrName
+ * @param defValue
+ * @return int
+ */
public static int getLayoutDimension(AttrSet attrs, String attrName, int defValue) {
Attr attr = attrNoSuchElement(attrs, attrName);
if (attr == null) {
diff --git a/entry/src/main/java/com/chinasoft/ohos/spinner/Utils.java b/entry/src/main/java/com/chinasoft/ohos/spinner/Utils.java
index 31ee746b233576ac5f39baa2fe7b2402ae7da6af..080a57d42ac9bb2c80a08b53bb3aaa5068c917a0 100644
--- a/entry/src/main/java/com/chinasoft/ohos/spinner/Utils.java
+++ b/entry/src/main/java/com/chinasoft/ohos/spinner/Utils.java
@@ -15,20 +15,6 @@
*
*/
-/*
- * 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.chinasoft.ohos.spinner;
diff --git a/entry/src/main/java/com/chinasoft/ohos/views/ElasticScrollView.java b/entry/src/main/java/com/chinasoft/ohos/views/ElasticScrollView.java
index 4440fe439c1110fd75f99f6f4619d40846d274a2..e9679889d18ee610d141e766ff480bc65a531f98 100644
--- a/entry/src/main/java/com/chinasoft/ohos/views/ElasticScrollView.java
+++ b/entry/src/main/java/com/chinasoft/ohos/views/ElasticScrollView.java
@@ -23,14 +23,30 @@ public class ElasticScrollView extends ScrollView implements Component.TouchEven
private Rect normal = new Rect();
private boolean animationFinish = true;
+ /**
+ * ElasticScrollView
+ *
+ * @param context
+ */
public ElasticScrollView(Context context) {
super(context);
}
+ /**
+ * ElasticScrollView
+ *
+ * @param context
+ * @param attrs
+ */
public ElasticScrollView(Context context, AttrSet attrs) {
super(context, attrs);
}
+ /**
+ * commOnTouchEvent
+ *
+ * @param ev
+ */
public void commOnTouchEvent(TouchEvent ev) {
if (animationFinish) {
int action = ev.getAction();
diff --git a/entry/src/main/resources/base/layout/ability_base_func.xml b/entry/src/main/resources/base/layout/ability_base_func.xml
index 9642ffc438d9f0689d49c12fcbace6df32b42bc9..e2d4ba397bba58fcc01ef560272e00d1d99e2947 100644
--- a/entry/src/main/resources/base/layout/ability_base_func.xml
+++ b/entry/src/main/resources/base/layout/ability_base_func.xml
@@ -1,36 +1,24 @@
-
+ ohos:height="match_parent"
+ ohos:orientation="vertical">
-
+
+
-
-
+ ohos:height="match_content"/>
-
-
-
+
-
-
-
+
diff --git a/entry/src/main/resources/base/layout/ability_color_pool.xml b/entry/src/main/resources/base/layout/ability_color_pool.xml
index c5b43b50d912283ee89a77653299fe6c8cfe566d..d8a53b0a4e9d07caa9487053106966943aab095a 100644
--- a/entry/src/main/resources/base/layout/ability_color_pool.xml
+++ b/entry/src/main/resources/base/layout/ability_color_pool.xml
@@ -7,8 +7,7 @@
+ ohos:height="50vp"/>
-
-
-
-
-
-
-
-
+
-
-
+ ohos:height="match_parent"
+ ohos:background_element="$color:app_white"
+ >
+
+
+
diff --git a/entry/src/main/resources/base/layout/custom_myscrollview.xml b/entry/src/main/resources/base/layout/custom_myscrollview.xml
index e884b78e3cd27e4d9927950714e2868f84619bb7..56a84280cfa0cc5235e0102bf995262ab71024b7 100644
--- a/entry/src/main/resources/base/layout/custom_myscrollview.xml
+++ b/entry/src/main/resources/base/layout/custom_myscrollview.xml
@@ -2,6 +2,7 @@
diff --git a/timetable/src/main/java/com/zhuangfei/timetable/TimetableView.java b/timetable/src/main/java/com/zhuangfei/timetable/TimetableView.java
index 09b3f2024e0c8e0390e314cb8951c6434f93e0bf..62fbe7dfbe8b6677071e77e1ea9eb11f89a4fbb7 100644
--- a/timetable/src/main/java/com/zhuangfei/timetable/TimetableView.java
+++ b/timetable/src/main/java/com/zhuangfei/timetable/TimetableView.java
@@ -8,6 +8,7 @@ import com.zhuangfei.timetable.model.ScheduleEnable;
import com.zhuangfei.timetable.model.ScheduleSupport;
import com.zhuangfei.timetable.operater.AbsOperater;
import com.zhuangfei.timetable.operater.SimpleOperater;
+
import ohos.agp.colors.RgbColor;
import ohos.agp.components.AttrSet;
import ohos.agp.components.DirectionalLayout;
@@ -138,7 +139,12 @@ public class TimetableView extends DirectionalLayout {
private ISchedule.OnConfigHandleListener onConfigHandleListener;
private boolean isShow;
-
+ /**
+ * callback
+ *
+ * @param onConfigHandleListener
+ * @return
+ */
public TimetableView callback(ISchedule.OnConfigHandleListener onConfigHandleListener) {
this.onConfigHandleListener = onConfigHandleListener;
return this;
diff --git a/timetable/src/main/java/com/zhuangfei/timetable/listener/ISchedule.java b/timetable/src/main/java/com/zhuangfei/timetable/listener/ISchedule.java
index d8147c205e1ecfeb33048f924429ed03040cb358..ccc0787d216c9f962b0aaf816609afed0f59b836 100644
--- a/timetable/src/main/java/com/zhuangfei/timetable/listener/ISchedule.java
+++ b/timetable/src/main/java/com/zhuangfei/timetable/listener/ISchedule.java
@@ -1,8 +1,8 @@
package com.zhuangfei.timetable.listener;
-
import com.zhuangfei.timetable.TimetableView;
import com.zhuangfei.timetable.model.Schedule;
+
import ohos.agp.components.*;
import ohos.agp.components.element.ShapeElement;
diff --git a/timetable/src/main/java/com/zhuangfei/timetable/listener/OnFlaglayoutClickAdapter.java b/timetable/src/main/java/com/zhuangfei/timetable/listener/OnFlaglayoutClickAdapter.java
index 57b8a7983f1022d8698f5d8211b720acaf5c653f..67d3d5159a35ffe1c4eb6a8a6a1a09ae9ec29a27 100644
--- a/timetable/src/main/java/com/zhuangfei/timetable/listener/OnFlaglayoutClickAdapter.java
+++ b/timetable/src/main/java/com/zhuangfei/timetable/listener/OnFlaglayoutClickAdapter.java
@@ -3,7 +3,6 @@ package com.zhuangfei.timetable.listener;
/**
* Created by Liu ZhuangFei on 2018/8/3.
*/
-
public class OnFlaglayoutClickAdapter implements ISchedule.OnFlaglayoutClickListener {
@Override
public void onFlaglayoutClick(int day, int start) {
diff --git a/timetable/src/main/java/com/zhuangfei/timetable/listener/OnItemBuildAdapter.java b/timetable/src/main/java/com/zhuangfei/timetable/listener/OnItemBuildAdapter.java
index 9e4114dc77af4a13ec4c00848c8dc49872b8ed4c..e02c671658b8d62d1ddfc107adddf9118ec2135b 100644
--- a/timetable/src/main/java/com/zhuangfei/timetable/listener/OnItemBuildAdapter.java
+++ b/timetable/src/main/java/com/zhuangfei/timetable/listener/OnItemBuildAdapter.java
@@ -1,7 +1,7 @@
package com.zhuangfei.timetable.listener;
-
import com.zhuangfei.timetable.model.Schedule;
+
import ohos.agp.components.StackLayout;
import ohos.agp.components.Text;
import ohos.agp.components.element.ShapeElement;
diff --git a/timetable/src/main/java/com/zhuangfei/timetable/listener/OnItemClickAdapter.java b/timetable/src/main/java/com/zhuangfei/timetable/listener/OnItemClickAdapter.java
index 175a3c0210a105122a1c047074b2148d94410ee1..bd2bdeda5516da1e62428740aaccc46d21198945 100644
--- a/timetable/src/main/java/com/zhuangfei/timetable/listener/OnItemClickAdapter.java
+++ b/timetable/src/main/java/com/zhuangfei/timetable/listener/OnItemClickAdapter.java
@@ -1,8 +1,7 @@
package com.zhuangfei.timetable.listener;
-
-
import com.zhuangfei.timetable.model.Schedule;
+
import ohos.agp.components.Component;
import java.util.List;
@@ -10,11 +9,9 @@ import java.util.List;
/**
* Item鐐瑰嚮鐨勯粯璁ゅ疄鐜.
*/
-
public class OnItemClickAdapter implements ISchedule.OnItemClickListener {
private static final String TAG = "OnItemClickAdapter";
@Override
public void onItemClick(Component component, List scheduleList) {
-
}
}
diff --git a/timetable/src/main/java/com/zhuangfei/timetable/listener/OnScrollViewBuildAdapter.java b/timetable/src/main/java/com/zhuangfei/timetable/listener/OnScrollViewBuildAdapter.java
index e0e5b4ac767b95cf757b651714420d556d4b6bb2..7095e694821380d4c3fc8b49c18cd0d67e7036c1 100644
--- a/timetable/src/main/java/com/zhuangfei/timetable/listener/OnScrollViewBuildAdapter.java
+++ b/timetable/src/main/java/com/zhuangfei/timetable/listener/OnScrollViewBuildAdapter.java
@@ -2,6 +2,7 @@ package com.zhuangfei.timetable.listener;
import com.zhuangfei.ResourceTable;
+
import ohos.agp.components.Component;
import ohos.agp.components.LayoutScatter;
diff --git a/timetable/src/main/java/com/zhuangfei/timetable/listener/OnSlideBuildAdapter.java b/timetable/src/main/java/com/zhuangfei/timetable/listener/OnSlideBuildAdapter.java
index d757954d98d6f5f58922e006f43aa0276bd2b53d..fd08230caea0339ab6fa7ad3a7179760d6e7ad5f 100644
--- a/timetable/src/main/java/com/zhuangfei/timetable/listener/OnSlideBuildAdapter.java
+++ b/timetable/src/main/java/com/zhuangfei/timetable/listener/OnSlideBuildAdapter.java
@@ -1,7 +1,7 @@
package com.zhuangfei.timetable.listener;
-
import com.zhuangfei.ResourceTable;
+
import ohos.agp.colors.RgbColor;
import ohos.agp.components.*;
import ohos.agp.components.element.ShapeElement;
diff --git a/timetable/src/main/java/com/zhuangfei/timetable/listener/OnSpaceItemClickAdapter.java b/timetable/src/main/java/com/zhuangfei/timetable/listener/OnSpaceItemClickAdapter.java
index 4cd631f06ed5cb2d50d86a1377a094bfe4181828..25d96202ba9991fd42dbea1ee27c92747720e805 100644
--- a/timetable/src/main/java/com/zhuangfei/timetable/listener/OnSpaceItemClickAdapter.java
+++ b/timetable/src/main/java/com/zhuangfei/timetable/listener/OnSpaceItemClickAdapter.java
@@ -1,15 +1,11 @@
package com.zhuangfei.timetable.listener;
-
import ohos.agp.components.DirectionalLayout;
/**
* Created by Liu ZhuangFei on 2018/8/3.
*/
public class OnSpaceItemClickAdapter implements ISchedule.OnSpaceItemClickListener {
-
- private static final String TAG = "OnSpaceItemClickAdapter";
-
protected DirectionalLayout flagLayout;
protected int itemHeight;
protected int itemWidth;
@@ -34,7 +30,8 @@ public class OnSpaceItemClickAdapter implements ISchedule.OnSpaceItemClickListen
}
@Override
- public void onInit(DirectionalLayout directionalLayout, int MonthWidth, int itemWidth, int itemHeight, int marTop, int marLeft) {
+ public void onInit(DirectionalLayout directionalLayout, int MonthWidth, int itemWidth,
+ int itemHeight, int marTop, int marLeft) {
this.flagLayout = directionalLayout;
this.itemHeight = itemHeight;
this.itemWidth = itemWidth;
diff --git a/timetable/src/main/java/com/zhuangfei/timetable/listener/OnWeekChangedAdapter.java b/timetable/src/main/java/com/zhuangfei/timetable/listener/OnWeekChangedAdapter.java
index 053da84021b1a8c96c8d9a7da4401bf831bbb0ef..0965e4ed938e290b761776e5e66093ebbecf18d8 100644
--- a/timetable/src/main/java/com/zhuangfei/timetable/listener/OnWeekChangedAdapter.java
+++ b/timetable/src/main/java/com/zhuangfei/timetable/listener/OnWeekChangedAdapter.java
@@ -1,8 +1,5 @@
package com.zhuangfei.timetable.listener;
-/**
- *
- */
public class OnWeekChangedAdapter implements ISchedule.OnWeekChangedListener {
@Override
public void onWeekChanged(int curWeek) {
diff --git a/timetable/src/main/java/com/zhuangfei/timetable/model/ScheduleColorPool.java b/timetable/src/main/java/com/zhuangfei/timetable/model/ScheduleColorPool.java
index 70944e0b2e69c49a28a79fb21a901895910fc89a..eac4a5ab0164a70dbdfdfce2662d985eaa5892d2 100644
--- a/timetable/src/main/java/com/zhuangfei/timetable/model/ScheduleColorPool.java
+++ b/timetable/src/main/java/com/zhuangfei/timetable/model/ScheduleColorPool.java
@@ -1,7 +1,5 @@
package com.zhuangfei.timetable.model;
-
-import com.zhuangfei.ResourceTable;
import ohos.agp.colors.RgbColor;
import ohos.app.Context;
diff --git a/timetable/src/main/java/com/zhuangfei/timetable/operater/AbsOperater.java b/timetable/src/main/java/com/zhuangfei/timetable/operater/AbsOperater.java
index d608a917ca59957d997fba0f271560bf925e2a49..40a265683c4bb2248945e0d15dd2b53c58dc58d1 100644
--- a/timetable/src/main/java/com/zhuangfei/timetable/operater/AbsOperater.java
+++ b/timetable/src/main/java/com/zhuangfei/timetable/operater/AbsOperater.java
@@ -1,6 +1,7 @@
package com.zhuangfei.timetable.operater;
import com.zhuangfei.timetable.TimetableView;
+
import ohos.agp.components.AttrSet;
import ohos.agp.components.DirectionalLayout;
import ohos.app.Context;
@@ -10,20 +11,41 @@ import ohos.app.Context;
* Created by Liu ZhuangFei on 2018/9/2.
*/
public abstract class AbsOperater {
+ /**
+ * init
+ *
+ * @param context
+ * @param attrs
+ * @param view
+ */
public void init(Context context, AttrSet attrs, TimetableView view) {
}
+ /**
+ * showView
+ */
public void showView() {
}
-
+ /**
+ * updateDateView
+ */
public void updateDateView() {
}
+ /**
+ * updateSlideView
+ */
public void updateSlideView() {
}
+ /**
+ * changeWeek
+ *
+ * @param week
+ * @param isCurWeek
+ */
public void changeWeek(int week, boolean isCurWeek) {
}
@@ -35,6 +57,11 @@ public abstract class AbsOperater {
return null;
}
+ /**
+ * setWeekendsVisiable
+ *
+ * @param isShow
+ */
public void setWeekendsVisiable(boolean isShow) {
}
}
diff --git a/timetable/src/main/java/com/zhuangfei/timetable/operater/SimpleOperater.java b/timetable/src/main/java/com/zhuangfei/timetable/operater/SimpleOperater.java
index a0de5808351f5497dd1d0dd320b0e223441dac4c..eee987108ebb3d3e8554b2de424876370a23bddb 100644
--- a/timetable/src/main/java/com/zhuangfei/timetable/operater/SimpleOperater.java
+++ b/timetable/src/main/java/com/zhuangfei/timetable/operater/SimpleOperater.java
@@ -9,6 +9,7 @@ import com.zhuangfei.timetable.model.ScheduleConfig;
import com.zhuangfei.timetable.model.ScheduleSupport;
import com.zhuangfei.timetable.utils.AttrUtils;
import com.zhuangfei.timetable.utils.ScreenUtils;
+
import ohos.agp.colors.RgbColor;
import ohos.agp.components.*;
import ohos.agp.components.element.ShapeElement;
@@ -23,8 +24,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import static ohos.agp.components.Component.AXIS_Y;
-
/**
* 璇捐〃涓氬姟鎿嶄綔鑰咃紝TimetableView涓彧娑夊強灞炴х殑璁剧疆锛屾柟娉曠殑鍏蜂綋瀹炵幇鍦ㄨ繖閲.
* 甯哥敤鐨勬柟娉曚篃灏卞洓涓紝濡備笅
@@ -81,10 +80,6 @@ public class SimpleOperater extends AbsOperater {
* 鍒濆鏈堜唤闀垮害
*/
protected final static int MONTH_WIDTH = 80;
- /**
- * 甯冨眬婊戝姩楂樺害
- */
- private float scrollY;
@Override
public void init(Context context, AttrSet attrs, TimetableView view) {
@@ -382,7 +377,7 @@ public class SimpleOperater extends AbsOperater {
*/
final int start;
if (mView.isShowWeekView()) {
- start = (int) Math.ceil((y + scrollY) / (mView.itemHeight() + mView.marTop()));
+ start = (int) Math.ceil(y / (mView.itemHeight() + mView.marTop()));
} else {
start = (int) Math.ceil(y / (mView.itemHeight() + mView.marTop()));
}
@@ -585,6 +580,11 @@ public class SimpleOperater extends AbsOperater {
}
}
+ /**
+ * getPerWidth
+ *
+ * @return
+ */
protected float getPerWidth() {
float perWidth = 0;
if (mView.isShowWeekends()) {
diff --git a/timetable/src/main/java/com/zhuangfei/timetable/utils/AttrUtils.java b/timetable/src/main/java/com/zhuangfei/timetable/utils/AttrUtils.java
index a7b5dcec92b45cf4bd7df0d36195e14e0b804108..3b553fdd9fcf8b830fc45922641f9579f296589d 100644
--- a/timetable/src/main/java/com/zhuangfei/timetable/utils/AttrUtils.java
+++ b/timetable/src/main/java/com/zhuangfei/timetable/utils/AttrUtils.java
@@ -24,6 +24,7 @@ import ohos.agp.utils.Color;
import ohos.hiviewdfx.HiLog;
import ohos.hiviewdfx.HiLogLabel;
+import java.util.Locale;
import java.util.NoSuchElementException;
/**
@@ -198,7 +199,7 @@ public class AttrUtils {
return defValue;
} else {
String stringBool = attr.getStringValue();
- return stringBool.toLowerCase().equals("true");
+ return stringBool.toLowerCase(Locale.ENGLISH).equals("true");
}
}
}
diff --git a/timetable/src/main/java/com/zhuangfei/timetable/view/PerWeekView.java b/timetable/src/main/java/com/zhuangfei/timetable/view/PerWeekView.java
index 015b986dfc8dd7e24ab1548ce0df5b5581c52421..adcd5dc0143a42cbaacddc8c2d4ddf48692eb54a 100644
--- a/timetable/src/main/java/com/zhuangfei/timetable/view/PerWeekView.java
+++ b/timetable/src/main/java/com/zhuangfei/timetable/view/PerWeekView.java
@@ -4,6 +4,7 @@ import com.zhuangfei.timetable.model.Schedule;
import com.zhuangfei.timetable.model.ScheduleEnable;
import com.zhuangfei.timetable.model.ScheduleSupport;
import com.zhuangfei.timetable.utils.AttrUtils;
+
import ohos.agp.components.AttrSet;
import ohos.agp.components.Component;
import ohos.agp.render.Canvas;
@@ -101,6 +102,7 @@ public class PerWeekView extends Component {
public PerWeekView setLightColor(int lightColor) {
this.lightColor = lightColor;
invalidate();
+
return this;
}
diff --git a/timetable/src/main/java/com/zhuangfei/timetable/view/WeekView.java b/timetable/src/main/java/com/zhuangfei/timetable/view/WeekView.java
index b1b71254f5b59dbc68268f5632baf3e9ace26a41..d17cadd8b93936da028d3c1de172660d8733a0eb 100644
--- a/timetable/src/main/java/com/zhuangfei/timetable/view/WeekView.java
+++ b/timetable/src/main/java/com/zhuangfei/timetable/view/WeekView.java
@@ -8,6 +8,7 @@ import com.zhuangfei.timetable.model.Schedule;
import com.zhuangfei.timetable.model.ScheduleEnable;
import com.zhuangfei.timetable.model.ScheduleSupport;
import com.zhuangfei.timetable.model.WeekViewEnable;
+
import ohos.agp.colors.RgbColor;
import ohos.agp.components.*;
import ohos.agp.components.element.ShapeElement;
@@ -70,6 +71,11 @@ public class WeekView extends DirectionalLayout implements WeekViewEnable