import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.TextView;
+import android.widget.CheckBox;
import com.enqualcomm.support.R;
+import com.enqualcomm.support.utils.ICLogger;
import java.util.ArrayList;
import java.util.List;
public class ShootItemAdapter extends RecyclerView.Adapter<ShootItemAdapter.InnerHolder> {
private final List<String> dataList = new ArrayList<>();
- private OnItemClickListener mItemClickListener;
+
+ private int currentSelected = -1;
@Override
public InnerHolder onCreateViewHolder(ViewGroup parent, int viewType) {
@Override
public void onBindViewHolder(InnerHolder holder, int position) {
- TextView itemTextView = (TextView) holder.itemView.findViewById(R.id.shoot_item_tv);
+ CheckBox itemTextView = (CheckBox) holder.itemView.findViewById(R.id.shoot_item_tv);
String itemText = dataList.get(position);
itemTextView.setText(itemText);
//设置点击事件
+ itemTextView.setChecked(position == this.currentSelected);
holder.itemView.setOnClickListener(v -> {
- if (mItemClickListener != null) {
- mItemClickListener.onItemClick(itemText);
- }
+ this.currentSelected = position;
+ notifyDataSetChanged();
});
}
}
public void updateData(List<String> dataList) {
+ ICLogger.d("responseText == > " + dataList.size());
this.dataList.clear();
this.dataList.addAll(dataList);
notifyDataSetChanged();
}
- public void setOnItemClickListener(OnItemClickListener listener) {
- this.mItemClickListener = listener;
- }
-
- public interface OnItemClickListener {
- void onItemClick(String text);
- }
-
-
public class InnerHolder extends RecyclerView.ViewHolder {
public InnerHolder(View itemView) {
super(itemView);
import android.widget.TextView;
import com.enqualcomm.support.R;
+import com.enqualcomm.support.utils.ICLogger;
import java.util.List;
if (position == 0) {
item = View.inflate(container.getContext(), R.layout.web_msg_item_content, null);
webMsgView = (TextView) item.findViewById(R.id.web_msg_tv);
- if (TextUtils.isEmpty(mCurrentText)) {
+ if (!TextUtils.isEmpty(mCurrentText)) {
webMsgView.setText(mCurrentText);
}
replyBtn = item.findViewById(R.id.reply_btn);
} else if (position == 1) {
item = View.inflate(container.getContext(), R.layout.web_msg_item_shoot, null);
shootListView = (RecyclerView) item.findViewById(R.id.shoot_list_view);
+ View backBtn = item.findViewById(R.id.back_press);
+ backBtn.setOnClickListener(v -> {
+ if (mViewPager != null) {
+ //回到第一个页面
+ mViewPager.setCurrentItem(0);
+ }
+ });
if (shootItemAdapter == null) {
shootItemAdapter = new ShootItemAdapter();
}
public void updateMsgText(String text) {
this.mCurrentText = text;
+ ICLogger.d("updateMsgText == > " + text + "webMsgView");
if (webMsgView != null) {
webMsgView.setText(text);
}
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/shape_item_bg_press" android:state_pressed="true" />
+ <item android:drawable="@drawable/shape_item_bg_press" android:state_checked="true" />
<item android:drawable="@drawable/shape_item_bg_normal" />
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+<CheckBox xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/shoot_item_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/selector_item_bg"
+ android:button="@null"
android:paddingLeft="10dp"
android:paddingTop="20dp"
android:paddingBottom="20dp"
android:textStyle="bold"
app:layout_constraintTop_toTopOf="parent">
-</TextView>
\ No newline at end of file
+</CheckBox>
\ No newline at end of file
android:padding="10dp"
android:text="@string/web_sms_title_text"
android:textColor="@android:color/black"
- android:textSize="20sp"
+ android:textSize="26sp"
app:layout_constraintBottom_toTopOf="@id/container" />
android:gravity="left|top"
android:padding="10dp"
android:textColor="#000"
- android:textSize="20sp"
+ android:textSize="26sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:orientation="horizontal">
<TextView
- android:id="@+id/reply_btn"
+ android:id="@+id/read_btn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:padding="10dp"
- android:text="@string/reply_text"
+ android:text="@string/read_text"
android:textColor="#fff"
android:textSize="26sp"
android:textStyle="bold" />
+ <View
+ android:layout_width="1dp"
+ android:layout_height="match_parent"
+ android:layout_gravity="center_horizontal"
+ android:background="@color/white" />
+
<TextView
- android:id="@+id/read_btn"
+ android:id="@+id/reply_btn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:padding="10dp"
- android:text="@string/read_text"
+ android:text="@string/reply_text"
android:textColor="#fff"
android:textSize="26sp"
android:textStyle="bold" />
+
</LinearLayout>
</LinearLayout>
android:orientation="horizontal">
<TextView
- android:id="@+id/reply_btn"
+ android:id="@+id/back_press"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="26sp"
android:textStyle="bold" />
+
+ <View
+ android:layout_width="1dp"
+ android:layout_height="match_parent"
+ android:layout_gravity="center_horizontal"
+ android:background="@color/white" />
+
<TextView
- android:id="@+id/read_btn"
+ android:id="@+id/send"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"