[add] HeaderView不随list滑动
This commit is contained in:
@@ -48,45 +48,29 @@ public class CheckInfoAdapter extends RecyclerView.Adapter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||||
if (position == 0 || position == 2) {
|
try {
|
||||||
((CheckInfoViewHolder) holder).checkIcon.setVisibility(View.GONE);
|
if (position < showData.size() * 2) {
|
||||||
((CheckInfoViewHolder) holder).mTextView.setText("模块名称");
|
int index = position / 2;
|
||||||
TextPaint tp = ((CheckInfoViewHolder) holder).mTextView.getPaint();
|
CheckResultData.CheckListItem positionItem = showData.get(index);
|
||||||
tp.setFakeBoldText(true);
|
if (isEven(position) == true) {//偶数隐藏图片显示检测指标
|
||||||
((CheckInfoViewHolder) holder).backImage.setVisibility(View.VISIBLE);
|
((CheckInfoViewHolder) holder).checkIcon.setVisibility(View.GONE);
|
||||||
|
((CheckInfoViewHolder) holder).mTextView.setText(positionItem.getName());
|
||||||
} else if (position == 1 || position == 3) {
|
} else {//奇数显示图片和检测指标结果
|
||||||
((CheckInfoViewHolder) holder).checkIcon.setVisibility(View.GONE);
|
((CheckInfoViewHolder) holder).checkIcon.setVisibility(View.VISIBLE);
|
||||||
((CheckInfoViewHolder) holder).mTextView.setText("运行状态");
|
String state = (String) positionItem.getStateValue();
|
||||||
TextPaint tp = ((CheckInfoViewHolder) holder).mTextView.getPaint();
|
if (state.equals("1")) {
|
||||||
tp.setFakeBoldText(true);
|
((CheckInfoViewHolder) holder).mTextView.setText("正常");
|
||||||
((CheckInfoViewHolder) holder).backImage.setVisibility(View.VISIBLE);
|
((CheckInfoViewHolder) holder).checkIcon.setImageResource(R.drawable.check_right);
|
||||||
} else {
|
} else if ((state.equals("0"))) {
|
||||||
((CheckInfoViewHolder) holder).backImage.setVisibility(View.INVISIBLE);
|
((CheckInfoViewHolder) holder).mTextView.setText("异常");
|
||||||
try {
|
((CheckInfoViewHolder) holder).checkIcon.setImageResource(R.drawable.check_wrong);
|
||||||
if ((position - 4) < showData.size() * 2) {
|
} else {
|
||||||
int index = (position - 4) / 2;
|
((CheckInfoViewHolder) holder).mTextView.setText(state);
|
||||||
CheckResultData.CheckListItem positionItem = showData.get(index);
|
|
||||||
if (isEven(position) == true) {//偶数隐藏图片显示检测指标
|
|
||||||
((CheckInfoViewHolder) holder).checkIcon.setVisibility(View.GONE);
|
|
||||||
((CheckInfoViewHolder) holder).mTextView.setText(positionItem.getName());
|
|
||||||
} else {//奇数显示图片和检测指标结果
|
|
||||||
((CheckInfoViewHolder) holder).checkIcon.setVisibility(View.VISIBLE);
|
|
||||||
String state = (String) positionItem.getStateValue();
|
|
||||||
if (state.equals("1")) {
|
|
||||||
((CheckInfoViewHolder) holder).mTextView.setText("正常");
|
|
||||||
((CheckInfoViewHolder) holder).checkIcon.setImageResource(R.drawable.check_right);
|
|
||||||
} else if ((state.equals("0"))) {
|
|
||||||
((CheckInfoViewHolder) holder).mTextView.setText("异常");
|
|
||||||
((CheckInfoViewHolder) holder).checkIcon.setImageResource(R.drawable.check_wrong);
|
|
||||||
} else {
|
|
||||||
((CheckInfoViewHolder) holder).mTextView.setText(state);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -102,19 +86,18 @@ public class CheckInfoAdapter extends RecyclerView.Adapter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return showData.size() * 2 + 4;
|
return showData.size() * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CheckInfoViewHolder extends RecyclerView.ViewHolder {
|
public class CheckInfoViewHolder extends RecyclerView.ViewHolder {
|
||||||
private ImageView checkIcon;
|
private ImageView checkIcon;
|
||||||
private TextView mTextView;
|
private TextView mTextView;
|
||||||
private View backImage;
|
|
||||||
|
|
||||||
public CheckInfoViewHolder(View v) {
|
public CheckInfoViewHolder(View v) {
|
||||||
super(v);
|
super(v);
|
||||||
checkIcon = v.findViewById(R.id.info_check_icon);
|
checkIcon = v.findViewById(R.id.info_check_icon);
|
||||||
mTextView = v.findViewById(R.id.info_result_tx);
|
mTextView = v.findViewById(R.id.info_result_tx);
|
||||||
backImage = v.findViewById(R.id.backImage);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,8 @@ public class CheckInfoListDialog extends BaseFloatDialog {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
List resultData = showInfoResult();
|
List resultData = showInfoResult();
|
||||||
mRecyclerView.setAdapter(new CheckInfoAdapter(mContext, mStyle, resultData));
|
CheckInfoAdapter adapter = new CheckInfoAdapter(mContext, mStyle, resultData);
|
||||||
|
mRecyclerView.setAdapter(adapter);
|
||||||
//关闭按钮
|
//关闭按钮
|
||||||
findViewById(R.id.cancel_info_list_button).setOnClickListener(v -> {
|
findViewById(R.id.cancel_info_list_button).setOnClickListener(v -> {
|
||||||
dismiss();
|
dismiss();
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import com.mogo.eagle.core.function.check.R;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author liujing
|
* @author liujing
|
||||||
* @description 描述
|
* @description 列表自适应高+限高
|
||||||
* @since: 9/29/21
|
* @since: 9/29/21
|
||||||
*/
|
*/
|
||||||
public class CheckInfoRecyclerView extends RecyclerView {
|
public class CheckInfoRecyclerView extends RecyclerView {
|
||||||
|
|||||||
@@ -5,16 +5,6 @@
|
|||||||
android:layout_height="@dimen/dp_127"
|
android:layout_height="@dimen/dp_127"
|
||||||
android:layout_gravity="left">
|
android:layout_gravity="left">
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/backImage"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@drawable/check_driver"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="1900px"
|
android:layout_width="1900px"
|
||||||
android:layout_height="1140px"
|
android:layout_height="1140px"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
@@ -29,18 +30,29 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/check_title_item"
|
||||||
|
layout="@layout/check_info_title_item"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/dp_127"
|
||||||
|
android:layout_marginLeft="@dimen/dp_143"
|
||||||
|
android:layout_marginTop="@dimen/dp_66"
|
||||||
|
android:layout_marginRight="@dimen/dp_143"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/check_info_title"></include>
|
||||||
|
|
||||||
<com.mogo.eagle.core.function.check.view.CheckInfoRecyclerView
|
<com.mogo.eagle.core.function.check.view.CheckInfoRecyclerView
|
||||||
android:id="@+id/check_list_recycler"
|
android:id="@+id/check_list_recycler"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="@dimen/dp_143"
|
android:layout_marginLeft="@dimen/dp_143"
|
||||||
android:layout_marginTop="@dimen/dp_66"
|
|
||||||
android:layout_marginRight="@dimen/dp_143"
|
android:layout_marginRight="@dimen/dp_143"
|
||||||
android:layout_marginBottom="@dimen/dp_80"
|
android:layout_marginBottom="@dimen/dp_80"
|
||||||
android:background="@drawable/check_recycler_shape"
|
android:background="@drawable/check_recycler_shape"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/check_info_title" />
|
app:layout_constraintTop_toBottomOf="@+id/check_title_item" />
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="@dimen/check_width"
|
||||||
|
android:layout_height="@dimen/dp_127"
|
||||||
|
android:background="@drawable/check_driver"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/title_one"
|
||||||
|
android:layout_width="0px"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="模块名称"
|
||||||
|
android:textSize="@dimen/dp_38"
|
||||||
|
app:layout_constraintHorizontal_chainStyle="spread"
|
||||||
|
app:layout_constraintHorizontal_weight="1"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toLeftOf="@+id/title_two"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/title_two"
|
||||||
|
android:layout_width="0px"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="运行状态"
|
||||||
|
android:textSize="@dimen/dp_38"
|
||||||
|
app:layout_constraintHorizontal_chainStyle="spread"
|
||||||
|
app:layout_constraintHorizontal_weight="1"
|
||||||
|
app:layout_constraintLeft_toRightOf="@+id/title_one"
|
||||||
|
app:layout_constraintRight_toLeftOf="@+id/title_thr"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/title_thr"
|
||||||
|
android:layout_width="0px"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="模块名称"
|
||||||
|
android:textSize="@dimen/dp_38"
|
||||||
|
app:layout_constraintHorizontal_chainStyle="spread"
|
||||||
|
app:layout_constraintHorizontal_weight="1"
|
||||||
|
app:layout_constraintRight_toLeftOf="@+id/title_for"
|
||||||
|
app:layout_constraintLeft_toRightOf="@+id/title_two"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/title_for"
|
||||||
|
android:layout_width="0px"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="运行状态"
|
||||||
|
android:textSize="@dimen/dp_38"
|
||||||
|
app:layout_constraintHorizontal_chainStyle="spread"
|
||||||
|
app:layout_constraintHorizontal_weight="1"
|
||||||
|
app:layout_constraintLeft_toRightOf="@+id/title_thr"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<dimen name="check_width">1900px</dimen>
|
<dimen name="check_width">1900px</dimen>
|
||||||
<dimen name="check_height">876px</dimen>
|
<dimen name="check_height">770px</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user