Add dependencies of build.gradle under the module:
implementation 'com.tuya.smart:tuyasmart-timebar:1.0.1'
Time Bar View, the function is as follows:
<com.tuya.smart.timebarview.TimeBarView
android:id="@+id/time_bar"
android:layout_width="match_parent"
android:layout_height="120dp"/>
<com.tuya.smart.timebarview.TimeBarView
android:id="@+id/time_bar"
android:layout_width="match_parent"
android:layout_height="120dp"
app:bottomTextMargin="4dp"
app:smallRulerHeight="56dp"
app:topTextMargin="6dp"/>
public synchronized void setCurrentTimeInMillisecond(long currentTimeInMillisecond)
Parameter Description
Parameter | Description |
---|---|
currentTimeInMillisecond | Hour, minute, and second levels |
Sample code
mTimeBarView.setCurrentTimeInMillisecond(System.currentTimeMillis());
public void setMode(int scalMode)
Parameter Description
Parameter | Description |
---|---|
model | Hour, minute, and second levels |
Sample code
mTimeBarView.setMode(2);
public void setRecordDataExistTimeClipsList(List<TimePieceBean> recordDataExistTimeClipsList)
Parameter Description
Parameter | Description |
---|---|
recordDataExistTimeClipsList | Time-slice dataset |
Sample code
List<TimePieceBean> times = new ArrayList<>();
TimePieceBean timePieceBean = new TimePieceBean();
timePieceBean.setStartTime((int) (CalendarUtils.getTodayStart(System.currentTimeMillis())/1000 + 60 * 60));
timePieceBean.setEndTime((int) (CalendarUtils.getTodayStart(System.currentTimeMillis())/1000 + 120 * 60));
TimePieceBean timePieceBean2 = new TimePieceBean();
timePieceBean2.setStartTime((int) (CalendarUtils.getTodayStart(System.currentTimeMillis())/1000 + 120 * 60));
timePieceBean2.setEndTime((int) (CalendarUtils.getTodayStart(System.currentTimeMillis())/1000 + 180 * 60));
times.add(timePieceBean);
times.add(timePieceBean2);
mTimeBarView.setRecordDataExistTimeClipsList(times);
public void setChangeOrientation(int orientation)
Parameter Description
Parameter | Description |
---|---|
orientation | Android view orientation value |
Sample code
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
mTimeBarView.setChangeOrientation(newConfig.orientation);
}
All properties have default values and can be left unset
Parameter Description
Attribute | Description |
---|---|
bottomTextMargin | bottom text margin |
smallRulerHeight | small rule height |
topTextMargin | top text margin |
#timebarview
-keep class com.tuya.smart.**{*;}
-dontwarn com.tuya.smart.**