浏览代码

分享框

liuzhenxing1118 2 年之前
父节点
当前提交
81008ee071

+ 17 - 4
app/src/main/java/com/xplora/xpchat/activity/MemberShareActivity.java

@@ -5,6 +5,7 @@ import android.content.Intent;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.RelativeLayout;
+import android.widget.TextView;
 
 import androidx.recyclerview.widget.GridLayoutManager;
 import androidx.recyclerview.widget.RecyclerView;
@@ -13,6 +14,7 @@ import com.xplora.xpchat.R;
 import com.xplora.xpchat.adapter.RecyclerAdapter;
 import com.xplora.xpchat.manager.DataManager;
 import com.xplora.xpchat.manager.DatabaseUtils;
+import com.xplora.xpchat.model.BaseBean;
 import com.xplora.xpchat.model.ContactBean;
 import com.xplora.xpchat.model.GridModel;
 import com.xplora.xpchat.utils.Constant;
@@ -24,6 +26,8 @@ import java.util.List;
 public class MemberShareActivity extends BaseActivity {
     private List<GridModel> mDataList = new ArrayList<>();
     private RecyclerAdapter mRecyclerAdapter = null;
+    private RelativeLayout mShareLayout = null;
+    private TextView mShareNameTv = null;
 
     @Override
     protected void onCreateBase() {
@@ -41,32 +45,41 @@ public class MemberShareActivity extends BaseActivity {
     @Override
     protected void initView() {
         super.initView();
-
         RecyclerView mRecyclerView = findViewById(R.id.recyclerView);
         RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(this, 2);
         mRecyclerView.setHasFixedSize(true);
         mRecyclerView.setLayoutManager(mLayoutManager);
 
-//        View footerView = (RelativeLayout) LayoutInflater.from(this).inflate(R.layout.chat_list_footer, null);
-//        mRecyclerView.addFooterView(footerView);
-
         mRecyclerAdapter = new RecyclerAdapter(this, mDataList, Constant.E_PAGER.CONTACT, 0);
         mRecyclerAdapter.setListOnClickListener(mGridItemOnClickListener);
         mRecyclerView.setAdapter(mRecyclerAdapter);
+
+        mShareLayout = findViewById(R.id.shareLayout);
+        mShareNameTv = (TextView) findViewById(R.id.shareNameTv);
     }
 
     RecyclerAdapter.GridItemOnClickListener mGridItemOnClickListener = new RecyclerAdapter.GridItemOnClickListener() {
         @SuppressLint("NotifyDataSetChanged")
         @Override
         public void onClick(Constant.E_PAGER pagerType, int mViewIndex, int itemIndex, GridModel gridModel) {
+
+            ContactBean shareBean = new ContactBean();
             for (int i = 0; i < mDataList.size(); i++) {
                 GridModel model = mDataList.get(i);
                 model.isSelected = i == itemIndex;
+                if (i == itemIndex) {
+                    shareBean = (ContactBean) model.bean;
+                }
             }
             if (mRecyclerAdapter != null) {
                 //mRecyclerAdapter.setDataList(mDataList);
                 mRecyclerAdapter.notifyDataSetChanged();
             }
+
+            if (mShareLayout != null) {
+                mShareLayout.setVisibility(View.VISIBLE);
+                mShareNameTv.setText(shareBean.name);
+            }
         }
     };
 

+ 1 - 0
app/src/main/java/com/xplora/xpchat/manager/DataManager.java

@@ -377,6 +377,7 @@ public class DataManager {
             model.resId = R.drawable.default_contact;
             model.filePath = bean.profilePath;
             model.type = Constant.E_FUNCTION.SINGLE;
+            model.bean = bean;
             retList.add(model);
         }
         return retList;

二进制
app/src/main/res/drawable-xhdpi/share_send.png


二进制
app/src/main/res/drawable-xhdpi/share_to.png


+ 39 - 0
app/src/main/res/layout/activity_itemlist_share.xml

@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout 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:background="@color/black"
@@ -16,4 +17,42 @@
         android:scrollbarThumbVertical="@color/xp_yellow"
         />
 
+    <RelativeLayout
+        android:id="@+id/shareLayout"
+        android:layout_width="match_parent"
+        android:layout_height="45dp"
+        android:layout_alignParentBottom="true"
+        android:background="#FF403E3E"
+        android:visibility="gone"
+        >
+
+        <ImageView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_centerVertical="true"
+            android:layout_marginStart="12dp"
+            android:background="@drawable/share_to" />
+
+        <TextView
+            android:id="@+id/shareNameTv"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_centerVertical="true"
+            android:layout_marginStart="25dp"
+            android:textColor="@color/white"
+            android:textSize="12sp"
+            android:textStyle="bold"
+            android:text="adfafdsaf"
+            />
+
+        <ImageView
+            android:id="@+id/shareSendButton"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignParentEnd="true"
+            android:layout_centerVertical="true"
+            android:layout_marginEnd="12dp"
+            android:background="@drawable/share_send" />
+    </RelativeLayout>
+
 </RelativeLayout>