部分id新增复制按钮
This commit is contained in:
@@ -14,6 +14,7 @@ import androidx.fragment.app.viewModels
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.viewpager.widget.PagerAdapter
|
||||
import com.netease.nim.uikit.common.util.sys.ClipboardUtil
|
||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil
|
||||
import com.netease.nim.uikit.common.util.sys.TimeUtil
|
||||
import com.nnbc123.app.R
|
||||
@@ -59,6 +60,7 @@ import com.nnbc123.core.user.bean.UserInfo
|
||||
import com.nnbc123.core.user.event.LoginUserInfoUpdateEvent
|
||||
import com.nnbc123.core.utils.CurrentTimeUtils
|
||||
import com.nnbc123.core.utils.StarUtils
|
||||
import com.nnbc123.core.utils.toast
|
||||
import com.trello.rxlifecycle3.android.FragmentEvent
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
@@ -417,6 +419,14 @@ class MeFragment : BaseFragment(), View.OnClickListener {
|
||||
R.id.tv_me_service -> {
|
||||
CustomerServerHelper.contactCustomerServer(mContext)
|
||||
}
|
||||
R.id.tv_user_id -> {
|
||||
mUserInfo?.let {
|
||||
ClipboardUtil.clipboardCopyText(it.erbanNo.toString())
|
||||
|
||||
} ?: run {
|
||||
"数据加载中,请稍后再试!".toast()
|
||||
}
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
@@ -23,11 +23,9 @@ class RoomNewFriendsFragment : BaseViewBindingFragment<FragmentRoomHotBinding>()
|
||||
}
|
||||
}
|
||||
|
||||
private lateinit var roomHotAdapter : RoomNewFriendsAdapter
|
||||
private lateinit var roomHotAdapter: RoomNewFriendsAdapter
|
||||
private lateinit var rvDelegate: RVDelegate<UserInfo>
|
||||
|
||||
private var page = 1
|
||||
private val pageSize = Int.MAX_VALUE
|
||||
private val homeViewModel: HomeViewModel by activityViewModels()
|
||||
|
||||
override fun init() {
|
||||
@@ -37,21 +35,11 @@ class RoomNewFriendsFragment : BaseViewBindingFragment<FragmentRoomHotBinding>()
|
||||
.setRecyclerView(binding.recyclerView)
|
||||
.setEmptyView(EmptyViewHelper.createEmptyView(context, "暂无新朋友"))
|
||||
.setLayoutManager(LinearLayoutManager(mContext))
|
||||
.setPageSize(pageSize)
|
||||
.build()
|
||||
|
||||
homeViewModel.getNewFriendList()
|
||||
homeViewModel.newFriendLiveData.observe(this) {
|
||||
rvDelegate.loadData(it)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
loadData(true)
|
||||
}
|
||||
|
||||
private fun loadData(isRefresh: Boolean) {
|
||||
homeViewModel.getNewFriendList()
|
||||
}
|
||||
|
||||
}
|
@@ -22,6 +22,7 @@ import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.netease.nim.uikit.StatusBarUtil;
|
||||
import com.netease.nim.uikit.common.util.sys.ClipboardUtil;
|
||||
import com.netease.nim.uikit.impl.cache.NimUserInfoCache;
|
||||
import com.netease.nimlib.sdk.RequestCallbackWrapper;
|
||||
import com.netease.nimlib.sdk.uinfo.model.NimUserInfo;
|
||||
@@ -197,6 +198,7 @@ public class UserInfoActivity extends BaseBindingActivity<ActivityUserInfoBindin
|
||||
mBinding.ivUserBack.setOnClickListener(this);
|
||||
mBinding.ivEdit.setOnClickListener(this);
|
||||
mBinding.flAvatar.setOnClickListener(this);
|
||||
mBinding.tvErbanId.setOnClickListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -568,6 +570,13 @@ public class UserInfoActivity extends BaseBindingActivity<ActivityUserInfoBindin
|
||||
AVRoomActivity.FROM_TYPE_USER, userInfo.getNick(), String.valueOf(userInfo.getUid()));
|
||||
}
|
||||
break;
|
||||
case R.id.tv_erban_id:
|
||||
if (userInfo == null) {
|
||||
toast("数据加载中,请稍后再试!");
|
||||
return;
|
||||
}
|
||||
ClipboardUtil.clipboardCopyText(String.valueOf(userInfo.getErbanNo()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -25,6 +25,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.google.android.flexbox.FlexboxLayout;
|
||||
import com.netease.nim.uikit.common.util.sys.ClipboardUtil;
|
||||
import com.nnbc123.core.Constants;
|
||||
import com.nnbc123.core.auth.AuthModel;
|
||||
import com.nnbc123.core.bean.RoomMicInfo;
|
||||
@@ -230,6 +231,7 @@ public class UserInfoDialog extends AppCompatDialog implements View.OnClickListe
|
||||
ivAvatarBg = findViewById(R.id.iv_avatar_bg);
|
||||
nick = findViewById(R.id.nick);
|
||||
erbanId = findViewById(R.id.tv_erban_id);
|
||||
erbanId.setOnClickListener(this);
|
||||
ivGender = findViewById(R.id.iv_gender);
|
||||
ivVipIcon = findViewById(R.id.iv_vip_icon);
|
||||
fansNumber = findViewById(R.id.fans_number);
|
||||
@@ -253,7 +255,6 @@ public class UserInfoDialog extends AppCompatDialog implements View.OnClickListe
|
||||
tvSelectHim = findViewById(R.id.tv_select_him);
|
||||
avatarLayout.setOnClickListener(this);
|
||||
closeImage.setOnClickListener(this);
|
||||
|
||||
recyclerViewSkill = findViewById(R.id.recyclerview_skill_card);
|
||||
picsAdapter = new SkillPicsAdapter();
|
||||
recyclerViewSkill.setAdapter(picsAdapter);
|
||||
@@ -680,8 +681,8 @@ public class UserInfoDialog extends AppCompatDialog implements View.OnClickListe
|
||||
|
||||
private void loadSimpleFamilyInfo(String familyId) {
|
||||
FamilyModel.Instance().loadFamilySimpleInfo(
|
||||
familyId
|
||||
)
|
||||
familyId
|
||||
)
|
||||
.subscribe(new SingleObserver<FamilyInfo>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
@@ -772,7 +773,11 @@ public class UserInfoDialog extends AppCompatDialog implements View.OnClickListe
|
||||
UserInfoActivity.Companion.start(context, uid);
|
||||
dismiss();
|
||||
break;
|
||||
case R.id.tv_erban_id:
|
||||
ClipboardUtil.clipboardCopyText(String.valueOf(userInfo.getErbanNo()));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1107,7 +1112,7 @@ public class UserInfoDialog extends AppCompatDialog implements View.OnClickListe
|
||||
return;
|
||||
}
|
||||
|
||||
if (AvRoomDataManager.get().haveStartDragon) {
|
||||
if (AvRoomDataManager.get().haveStartDragon) {
|
||||
new DialogManager(context).showOkCancelDialog("你正在交友匹配中,此操作代表你放弃本局匹配展示,确定进行此操作?", false, new DialogManager.OkCancelDialogListener() {
|
||||
@Override
|
||||
public void onCancel() {
|
||||
|
BIN
app/src/main/res/drawable-xhdpi/ic_copy_id.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_copy_id.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 454 B |
BIN
app/src/main/res/drawable-xhdpi/ic_copy_id_white.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_copy_id_white.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 544 B |
@@ -161,6 +161,47 @@
|
||||
app:layout_constraintStart_toEndOf="@id/tv_nick"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_nick"
|
||||
tools:text="金牛座" />
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_id"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_nick"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_new_user"
|
||||
android:layout_width="@dimen/dp_13"
|
||||
android:layout_height="@dimen/dp_13"
|
||||
android:layout_marginEnd="3dp"
|
||||
android:src="@mipmap/ic_user_new_13dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_good_number"
|
||||
android:layout_width="@dimen/dp_13"
|
||||
android:layout_height="@dimen/dp_13"
|
||||
android:src="@mipmap/ic_good_num"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_erban_id"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="3dp"
|
||||
android:gravity="center_vertical"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:drawablePadding="3dp"
|
||||
android:drawableEnd="@drawable/ic_copy_id"
|
||||
android:textColor="#BDBFD0"
|
||||
android:textSize="12dp"
|
||||
tools:text="ID:7958626" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_level"
|
||||
@@ -168,7 +209,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_nick">
|
||||
app:layout_constraintTop_toBottomOf="@id/ll_id">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_user_level"
|
||||
@@ -294,43 +335,6 @@
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="106dp"
|
||||
android:layout_marginTop="189dp"
|
||||
android:gravity="center">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_new_user"
|
||||
android:layout_width="@dimen/dp_13"
|
||||
android:layout_height="@dimen/dp_13"
|
||||
android:layout_marginEnd="3dp"
|
||||
android:src="@mipmap/ic_user_new_13dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_good_number"
|
||||
android:layout_width="@dimen/dp_13"
|
||||
android:layout_height="@dimen/dp_13"
|
||||
android:src="@mipmap/ic_good_num"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_erban_id"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="3dp"
|
||||
android:gravity="center_vertical"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12dp"
|
||||
tools:text="ID:7958626" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
|
@@ -57,8 +57,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingTop="@dimen/dp_10"
|
||||
android:layout_marginStart="@dimen/dp_10">
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:paddingTop="@dimen/dp_10">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/avatar"
|
||||
@@ -79,9 +79,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="2dp"
|
||||
android:paddingTop="@dimen/dp_10"
|
||||
android:layout_toEndOf="@id/fl_avatar_layout"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="@dimen/dp_10">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
@@ -244,7 +244,9 @@
|
||||
android:id="@+id/tv_erban_id"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/white_transparent_50"
|
||||
android:drawableEnd="@drawable/ic_copy_id_white"
|
||||
android:drawablePadding="3dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_12"
|
||||
tools:text="ID123456" />
|
||||
</LinearLayout>
|
||||
@@ -330,14 +332,13 @@
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerview_skill_card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
android:id="@+id/recyclerview_skill_card"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:layout_marginBottom="@dimen/dp_8"
|
||||
/>
|
||||
android:layout_marginRight="12dp"
|
||||
android:layout_marginBottom="@dimen/dp_8" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_grid_button"
|
||||
|
@@ -99,10 +99,10 @@
|
||||
android:id="@+id/tv_user_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:drawablePadding="5dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLength="10"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:maxLines="1"
|
||||
android:text="@{userInfo.nick}"
|
||||
android:textColor="@color/text_title_282828"
|
||||
@@ -129,9 +129,11 @@
|
||||
android:id="@+id/tv_user_id"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawablePadding="4dp"
|
||||
android:drawableEnd="@drawable/ic_copy_id"
|
||||
android:drawablePadding="3dp"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:onClick="@{click}"
|
||||
android:textColor="@color/text_secondary_878b9c"
|
||||
android:textSize="@dimen/dp_13"
|
||||
tools:ignore="SpUsage"
|
||||
@@ -220,12 +222,12 @@
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_me_arrow_userinfo"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -591,8 +593,8 @@
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:visibility="gone"
|
||||
android:background="@drawable/shape_me_indicator_bg" />
|
||||
android:background="@drawable/shape_me_indicator_bg"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@@ -1,8 +1,14 @@
|
||||
package com.netease.nim.uikit.common.util.sys;
|
||||
|
||||
import static android.content.Context.CLIPBOARD_SERVICE;
|
||||
|
||||
import android.content.ClipData;
|
||||
import android.content.Context;
|
||||
import android.text.ClipboardManager;
|
||||
|
||||
import com.nnbc123.library.utils.SingleToastUtil;
|
||||
import com.nnbc123.library.utils.config.BasicConfig;
|
||||
|
||||
public class ClipboardUtil {
|
||||
public static final void clipboardCopyText(Context context, CharSequence text) {
|
||||
ClipboardManager cm = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
@@ -11,9 +17,13 @@ public class ClipboardUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static final int clipboardTextLength(Context context) {
|
||||
ClipboardManager cm = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
CharSequence text = cm != null ? cm.getText() : null;
|
||||
return text != null ? text.length() : 0;
|
||||
public static void clipboardCopyText(CharSequence text) {
|
||||
android.content.ClipboardManager myClipboard;
|
||||
myClipboard = (android.content.ClipboardManager) BasicConfig.INSTANCE.getAppContext().getSystemService(CLIPBOARD_SERVICE);
|
||||
ClipData myClip;
|
||||
myClip = ClipData.newPlainText("text", text);
|
||||
if (myClipboard != null)
|
||||
myClipboard.setPrimaryClip(myClip);
|
||||
SingleToastUtil.showToast("复制成功");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user