fixed dialog text show issute.
authorTrillGates <williamtrillgates@gmail.com>
Fri, 6 Aug 2021 08:04:15 +0000 (16:04 +0800)
committerTrillGates <williamtrillgates@gmail.com>
Fri, 6 Aug 2021 08:04:15 +0000 (16:04 +0800)
app/src/main/java/com/ic/view/webmsgresponse/ShootItemAdapter.java
app/src/main/java/com/ic/view/webmsgresponse/WebMessageAdapter.java
app/src/main/res/drawable/selector_item_bg.xml
app/src/main/res/layout/item_shoot.xml
app/src/main/res/layout/web_msg_item_content.xml
app/src/main/res/layout/web_msg_item_shoot.xml

index a81b41a..0bcd010 100644 (file)
@@ -4,9 +4,10 @@ import android.support.v7.widget.RecyclerView;
 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;
@@ -14,7 +15,8 @@ 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) {
@@ -24,14 +26,14 @@ public class ShootItemAdapter extends RecyclerView.Adapter<ShootItemAdapter.Inne
 
     @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();
         });
     }
 
@@ -41,21 +43,13 @@ public class ShootItemAdapter extends RecyclerView.Adapter<ShootItemAdapter.Inne
     }
 
     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);
index 94336fd..fd02883 100644 (file)
@@ -11,6 +11,7 @@ import android.view.ViewGroup;
 import android.widget.TextView;
 
 import com.enqualcomm.support.R;
+import com.enqualcomm.support.utils.ICLogger;
 
 import java.util.List;
 
@@ -35,7 +36,7 @@ public class WebMessageAdapter extends PagerAdapter {
         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);
@@ -50,6 +51,13 @@ public class WebMessageAdapter extends PagerAdapter {
         } 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();
             }
@@ -110,6 +118,7 @@ public class WebMessageAdapter extends PagerAdapter {
 
     public void updateMsgText(String text) {
         this.mCurrentText = text;
+        ICLogger.d("updateMsgText == > " + text + "webMsgView");
         if (webMsgView != null) {
             webMsgView.setText(text);
         }
index c8cbe35..47f1325 100644 (file)
@@ -1,5 +1,6 @@
 <?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
index 0f77299..2301964 100644 (file)
@@ -1,10 +1,11 @@
 <?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"
@@ -13,4 +14,4 @@
     android:textStyle="bold"
     app:layout_constraintTop_toTopOf="parent">
 
-</TextView>
\ No newline at end of file
+</CheckBox>
\ No newline at end of file
index f97e8c5..3f42e67 100644 (file)
@@ -22,7 +22,7 @@
             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" />
 
 
@@ -39,7 +39,7 @@
                 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>
index e92f1d7..bcc58df 100644 (file)
@@ -40,7 +40,7 @@
             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"