气象 历史数据 页面完成部分
parent
d4a66fc7e3
commit
d0a99cd4d1
@ -0,0 +1,60 @@
|
||||
package com.rehome.zhdcoa.adapter;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.rehome.zhdcoa.base.BaseViewBindingAdapter;
|
||||
import com.rehome.zhdcoa.bean.WeatherHistoryBean;
|
||||
import com.rehome.zhdcoa.databinding.AdapterWeatherHistoryBinding;
|
||||
import java.util.List;
|
||||
|
||||
public class WeatherHistoryAdapter extends BaseViewBindingAdapter<AdapterWeatherHistoryBinding> {
|
||||
private List<WeatherHistoryBean.DataBean> datas;
|
||||
|
||||
public WeatherHistoryAdapter(Context context, List<WeatherHistoryBean.DataBean> datas) {
|
||||
super(context);
|
||||
this.datas = datas;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleData(int position, AdapterWeatherHistoryBinding binding) {
|
||||
WeatherHistoryBean.DataBean item = datas.get(position);
|
||||
if (item != null) {
|
||||
binding.tvTime.setText(item.getTime());
|
||||
binding.tvValue.setText(item.getVal());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AdapterWeatherHistoryBinding getBinding(@NonNull LayoutInflater inflater, @Nullable ViewGroup parent) {
|
||||
return AdapterWeatherHistoryBinding.inflate(inflater, parent, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return datas.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return datas.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return Long.valueOf(position);
|
||||
}
|
||||
|
||||
public interface OnWorkRiskLevelClickListener {
|
||||
void onItemClick(int position);
|
||||
}
|
||||
public interface OnWorkRiskContentlickListener {
|
||||
void onItemClick(int position);
|
||||
}
|
||||
public interface OnPaoHaolickListener {
|
||||
void onItemClick(int position);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
package com.rehome.zhdcoa.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class WeatherHistoryBean extends AIBaseBean{
|
||||
private int TotalPage;
|
||||
private int Total;
|
||||
private List<DataBean> data;
|
||||
|
||||
public int getTotalPage() {
|
||||
return TotalPage;
|
||||
}
|
||||
|
||||
public void setTotalPage(int totalPage) {
|
||||
TotalPage = totalPage;
|
||||
}
|
||||
|
||||
public int getTotal() {
|
||||
return Total;
|
||||
}
|
||||
|
||||
public void setTotal(int total) {
|
||||
Total = total;
|
||||
}
|
||||
|
||||
public List<DataBean> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(List<DataBean> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static class DataBean {
|
||||
private String time;
|
||||
private String val;
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public String getVal() {
|
||||
return val;
|
||||
}
|
||||
|
||||
public void setVal(String val) {
|
||||
this.val = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,75 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".ui.activity.WeatherHistoryActivity">
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbarView"
|
||||
layout="@layout/layout_base" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:background="#cccccc"
|
||||
android:minHeight="40dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_st"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="5px"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="点击选择开始时间"
|
||||
android:textSize="18sp" />
|
||||
<TextView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="5px"
|
||||
android:gravity="center"
|
||||
android:textStyle="bold"
|
||||
android:text="-"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_et"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="5px"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="点击选择结束时间"
|
||||
android:textSize="18sp" />
|
||||
</LinearLayout>
|
||||
<include
|
||||
android:id="@+id/item_head"
|
||||
layout="@layout/item_weather_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_height="40dp" />
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="10dp">
|
||||
|
||||
<ListView
|
||||
android:id="@+id/lv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:divider="#00000000"
|
||||
android:dividerHeight="0px"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_nodata"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:textColor="@color/viewfinder_mask"
|
||||
android:gravity="center"
|
||||
android:text="暂无数据"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:id="@+id/head"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:visibility="gone"
|
||||
android:background="#999999"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:id="@+id/tv_time"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="0.7"
|
||||
android:gravity="center"
|
||||
android:textColor="#666666"
|
||||
android:text="2025-09-18 09:45:09" />
|
||||
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#999999" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_value"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:layout_weight="0.7"
|
||||
android:textColor="#333333"
|
||||
android:text="31.6" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:background="#999999" />
|
||||
</LinearLayout>
|
||||
@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:id="@+id/head"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:background="#999999"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:id="@+id/tv_paiHao"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="0.7"
|
||||
android:gravity="center"
|
||||
android:textColor="#666666"
|
||||
android:textSize="18sp"
|
||||
android:text="更新时间" />
|
||||
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#999999" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_data_type"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:layout_weight="0.7"
|
||||
android:textColor="#333333"
|
||||
android:textSize="18sp"
|
||||
android:text="大气温度" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:background="#999999" />
|
||||
</LinearLayout>
|
||||
@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:id="@+id/head"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:background="#999999"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:id="@+id/tv_time"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="0.7"
|
||||
android:gravity="center"
|
||||
android:textColor="#666666"
|
||||
android:text="2025-09-18 09:45:09" />
|
||||
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#999999" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_value"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:layout_weight="0.7"
|
||||
android:textColor="#333333"
|
||||
android:text="31.6" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:background="#999999" />
|
||||
</LinearLayout>
|
||||
Loading…
Reference in New Issue