From 0172042233cfa41f97863e47a28c5e78d3cf49d1 Mon Sep 17 00:00:00 2001 From: xuhuixiang Date: Thu, 24 Apr 2025 16:52:25 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=ACN+1=E6=AC=A1=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/AndroidManifest.xml | 20 + .../imkit/team/TeamMembersList1Activity.java | 557 +++++++++++ .../team/adapter/TeamMembersAdapter1.java | 315 ++++++ .../lewan/redpack/SendRedPacketActivity.java | 200 +++- .../hbl/lewan/wallet/ChongZhiLogActivity.java | 46 + .../hbl/lewan/wallet/MyWalletActivity.java | 4 +- .../com/hbl/lewan/wallet/TiXianActivity.java | 464 +++++++++ .../hbl/lewan/wallet/TiXianLogActivity.java | 45 + .../com/hbl/lewan/wallet/TopUpActivity.java | 86 +- .../lewan/wallet/WalletInfoRedActivity.java | 103 +- .../lewan/wallet/WalletInfoRedFragment.java | 822 ++++------------ .../lewan/wallet/WalletInfologFragment.java | 659 +++++++++++++ app/src/main/res/drawable/input_bg_t.xml | 4 +- app/src/main/res/drawable/radio_button.xml | 6 + .../main/res/layout/activity_chongzhi_log.xml | 32 + app/src/main/res/layout/activity_mywallet.xml | 53 +- .../res/layout/activity_send_red_packet.xml | 177 +++- app/src/main/res/layout/activity_tixian.xml | 265 +++++ .../main/res/layout/activity_tixian_log.xml | 32 + app/src/main/res/layout/activity_topup.xml | 352 +++---- .../layout/bottom_sheet_red_type_layout.xml | 2 +- app/src/main/res/layout/fragment_mine_new.xml | 2 +- .../res/layout/fragment_wallet_info_log.xml | 69 ++ .../main/res/layout/item_bill_installment.xml | 15 +- app/src/main/res/layout/item_bill_top.xml | 3 +- app/src/main/res/mipmap-xxhdpi/czjl_img.png | Bin 0 -> 3531 bytes app/src/main/res/mipmap-xxhdpi/txjl_img.png | Bin 0 -> 1660 bytes .../res/mipmap-xxhdpi/wallet_jinbi_img.png | Bin 5129 -> 2180 bytes app/src/main/res/values-en-rUS/strings.xml | 8 - app/src/main/res/values-en/call_strings.xml | 59 -- app/src/main/res/values-en/strings.xml | 931 ------------------ app/src/main/res/values-ja-rJP/strings.xml | 7 - app/src/main/res/values-ja/call_strings.xml | 59 -- app/src/main/res/values-ja/strings.xml | 931 ------------------ app/src/main/res/values-zh-rCN/strings.xml | 10 - .../main/res/values-zh-rTW/call_strings.xml | 62 -- app/src/main/res/values-zh-rTW/strings.xml | 928 ----------------- app/src/main/res/values-zh/strings.xml | 921 ----------------- app/src/main/res/values/strings.xml | 26 +- .../view/input/FunBottomActionFactory.java | 14 +- .../view/input/BottomActionFactory.java | 6 +- .../drawable-xxhdpi/ic_single_selected.png | Bin 4599 -> 3328 bytes chatkit-ui/src/main/res/values-zh/strings.xml | 2 +- 43 files changed, 3290 insertions(+), 5007 deletions(-) create mode 100644 app/src/main/java/com/hbl/lewan/imkit/team/TeamMembersList1Activity.java create mode 100644 app/src/main/java/com/hbl/lewan/imkit/team/adapter/TeamMembersAdapter1.java create mode 100644 app/src/main/java/com/hbl/lewan/wallet/ChongZhiLogActivity.java create mode 100644 app/src/main/java/com/hbl/lewan/wallet/TiXianActivity.java create mode 100644 app/src/main/java/com/hbl/lewan/wallet/TiXianLogActivity.java create mode 100644 app/src/main/java/com/hbl/lewan/wallet/WalletInfologFragment.java create mode 100644 app/src/main/res/drawable/radio_button.xml create mode 100644 app/src/main/res/layout/activity_chongzhi_log.xml create mode 100644 app/src/main/res/layout/activity_tixian.xml create mode 100644 app/src/main/res/layout/activity_tixian_log.xml create mode 100644 app/src/main/res/layout/fragment_wallet_info_log.xml create mode 100644 app/src/main/res/mipmap-xxhdpi/czjl_img.png create mode 100644 app/src/main/res/mipmap-xxhdpi/txjl_img.png delete mode 100644 app/src/main/res/values-en-rUS/strings.xml delete mode 100644 app/src/main/res/values-en/call_strings.xml delete mode 100644 app/src/main/res/values-en/strings.xml delete mode 100644 app/src/main/res/values-ja-rJP/strings.xml delete mode 100644 app/src/main/res/values-ja/call_strings.xml delete mode 100644 app/src/main/res/values-ja/strings.xml delete mode 100644 app/src/main/res/values-zh-rCN/strings.xml delete mode 100644 app/src/main/res/values-zh-rTW/call_strings.xml delete mode 100644 app/src/main/res/values-zh-rTW/strings.xml delete mode 100644 app/src/main/res/values-zh/strings.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index cb00418..91ce83e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -494,6 +494,13 @@ android:screenOrientation="portrait" android:theme="@style/TransTheme" android:windowSoftInputMode="adjustResize" /> + + + + listSearch = new ArrayList<>(); + public int isAllowAdd = 1; + + public static void launch(Context context, int isManager, boolean isShowTeamQR, String teamId, List userInfos, Team team, @NonNull ActivityResultLauncher launcher) { + Intent intent = new Intent(context, TeamMembersList1Activity.class); + intent.putExtra(ISMANAGER, isManager); + intent.putExtra(TYPE, 0); + intent.putExtra(TEAMQR, isShowTeamQR); + intent.putExtra(KEY_TEAM_ID, teamId); + intent.putExtra(LISTUSERINFOS, (Serializable) userInfos); + intent.putExtra(TEAMINFO, (Serializable) team); + launcher.launch(intent); + } + + public static void launch(Context context, int isQuit, String teamId, List userInfos, @NonNull ActivityResultLauncher launcher) { + Intent intent = new Intent(context, TeamMembersList1Activity.class); + intent.putExtra(KEY_TEAM_ID, teamId); + intent.putExtra(TYPE, 1); + intent.putExtra(QUITE, isQuit); + intent.putExtra(LISTUSERINFOS, (Serializable) userInfos); + launcher.launch(intent); + } + + + ActivityTeamMembersBinding binding; + private int isManager = 0; // 1 群主 2 管理员 + private Team teamInfo; + private String teamOwnerId; //群主id; + + private TeamMembersAdapter1 membersAdapter; + private TeamExtensionBean extensionBean; + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); + getWindow().setNavigationBarColor(getResources().getColor(com.netease.yunxin.kit.chatkit.ui.R.color.color_white)); + isManager = getIntent().getIntExtra(ISMANAGER, 0); + teamInfo = (Team) getIntent().getSerializableExtra(TEAMINFO); + type = getIntent().getIntExtra(TYPE, 0); + quite = getIntent().getIntExtra(QUITE, 0); + List list = (List) getIntent().getSerializableExtra(LISTUSERINFOS); + teamQr = getIntent().getBooleanExtra(TEAMQR, true); + + if (teamInfo != null) { + teamOwnerId = teamInfo.getCreator(); + if (!TextUtils.isEmpty(teamInfo.getExtension())) { + extensionBean = GsonUtils.getObjFromJSON(teamInfo.getExtension(), TeamExtensionBean.class); + if (extensionBean == null) { + extensionBean = new TeamExtensionBean(Integer.parseInt(teamInfo.getExtension()), 0); + } + } else { + extensionBean = new TeamExtensionBean(1, 0); + } + isAllowAdd = extensionBean.getAllowAddFriends(); + } + if (list != null && list.size() > 0) { + LogUtils.i("走了333333333377777777777777:"); + + listmemebers.clear(); + listmemebers.addAll(list); +// getTeamActiveTime(); + } else { + if (NetworkUtils.isConnected()) { + showLoading(); + //重新获取群成员 + teammodel.getUserInfoData().observe(this, listResultInfo -> { + dismissLoading(); + if (listResultInfo.getSuccess()) { +// getTeamActiveTime(); + List listmember = listResultInfo.getValue(); + listmemebers.clear(); + listmember = sortListMembers(listmember); + for (UserInfoWithTeam userinfo : listmember) { + LogUtils.i("走了333333333355555555555:"+GsonUtils.beanToJSONString(userinfo)); + + UserInfo userInfos = userinfo.getUserInfo(); + userInfos.setSignature(userinfo.getTeamInfo().isMute()?"1":""); + listmemebers.add(userInfos); + } + setData(); + + } + }); + teammodel.requestTeamMembers(teamId); + } + + } + initView(); + initData(); + } + + + @Override + public View getContentView() { + binding = ActivityTeamMembersBinding.inflate(getLayoutInflater()); + return binding.getRoot(); + } + + + Map memberMap; + + public void getTeamActiveTime() { + if (isManager != 0 && type == 0) { + Api.getInstance().teamMemberActiveTime(teamId) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new BaseObserver>>() { + @Override + public void onSuccess(Result> feedbackResp) { + LogUtils.d("dddd" + feedbackResp.data); + LogUtils.i("走了333333333366666666:"); + + memberMap = feedbackResp.data; + listmemebers.remove(0); + listmemebers = sortListByActivieTime(listmemebers); + listmemebers.add(0, IMKitClient.getUserInfo()); + membersAdapter.setData(listmemebers, false, memberMap, teamId); + } + + + @Override + public void onError(int code, String msg) { + ToastX.showShortToast(msg); + + } + }); + } + } + + //排序成员 + public List sortListByActivieTime(List teamMemberlist) { + List resultlist = new ArrayList<>(); + Set keys = memberMap.keySet(); + if (!keys.isEmpty()) { + for (String id : keys) { + for (UserInfo userInfo : teamMemberlist) { + if (userInfo.getAccount().equals(id)) { + resultlist.add(userInfo); + } + } + } + } + return resultlist; + } + + + public void setData() { + if (type == 0) { +// listmemebers.add(0, IMKitClient.getUserInfo()); + membersAdapter.setData(listmemebers, false, memberMap, teamId); + binding.tvteammembers.setText(getString(com.netease.yunxin.kit.contactkit.ui.R.string.fun_creategroup_members, listmemebers.size() - 1)); + } else { //不能编辑 转让 + for (int i = 0; i < listmemebers.size(); i++) { + if (listmemebers.get(i).getAccount().equals(IMKitClient.account())) { + listmemebers.remove(i); + } + } + + binding.tvteammembers.setText(getString(com.netease.yunxin.kit.contactkit.ui.R.string.fun_creategroup_members, listmemebers.size())); + membersAdapter.setEdit(false); + membersAdapter.setData(listmemebers, false, memberMap, teamId); + } + binding.rvMembers.setAdapter(membersAdapter); + } + + public void initView() { + initTitleView(); + + LinearLayoutManager layoutManager = + new LinearLayoutManager(this, RecyclerView.VERTICAL, false); + binding.rvMembers.setLayoutManager(layoutManager); + membersAdapter = new TeamMembersAdapter1(this, type); + setData(); + membersAdapter.setItemClickListener(new TeamMembersAdapter1.ItemClickListener() { + @Override + public void onItemClick(UserInfo item, int position) { + if(item.getAccount().equals(IMKitClient.account())){ + ToastX.showShortToast("不能给自己发红包哦!"); + return; + } + Intent intent = new Intent(); + intent.putExtra(TYPE, type); + intent.putExtra("bean", item); + setResult(RESULT_OK, intent); + finish(); + } + + @Override + public void onAddClick(UserInfo item, int position) { + startUserInfoActivity(item.getAccount(), teamId); + } + + }); + binding.editSelectorFriends.setOnEditorActionListener((textView, actionId, keyEvent) -> + { + if (actionId == EditorInfo.IME_ACTION_SEARCH) { + String search = textView.getEditableText().toString(); + //搜索好友 + List listSearchResult = searchName(search); + listSearch.clear(); + listSearch.addAll(listSearchResult); + if (listSearch.size() > 0) { + membersAdapter.refreshData(listSearch, false); + binding.tvteammembers.setText(getString(com.netease.yunxin.kit.contactkit.ui.R.string.fun_creategroup_members, listSearch.size())); + + } + } + return false; + }); + binding.editSelectorFriends.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void afterTextChanged(Editable editable) { + if (TextUtils.isEmpty(editable.toString())) { + binding.icCleanEdit.setVisibility(View.GONE); +// membersAdapter.setEdit(false); +// binding.title.setActionText(R.string.teammember_edit); +// listmemebers.add(0, IMKitClient.getUserInfo()); + membersAdapter.refreshData(listmemebers, type == 0); + binding.tvteammembers.setText(getString(com.netease.yunxin.kit.contactkit.ui.R.string.fun_creategroup_members, listmemebers.size() - 1)); + } else { + binding.icCleanEdit.setVisibility(View.VISIBLE); + } + } + }); + binding.icCleanEdit.setOnClickListener(view -> binding.editSelectorFriends.setText("")); + } + + public void startUserInfoActivity(String userid, String teamId) { + + if(isManager==1||isManager==2){ + XKitRouter.withKey(RouterConstant.PATH_USER_INFO_PAGE) + .withContext(TeamMembersList1Activity.this) + .withParam(RouterConstant.KEY_ACCOUNT_ID_KEY, IMKitClient.account()) + .withParam("userId", userid) + .withParam("teamId", teamId) + .withParam("isGroup", true) + .navigate(); + return; + } + + + //如果群不允许群内添加好友 当前登录用户不是群主,以及userid 也不是群主 直接跳过 + if (isAllowAdd == 0 && isManager != 1 && !userid.equals(teamOwnerId)) { + + NIMClient.getService(TeamService.class).queryTeamMember(teamId, userid).setCallback(new RequestCallback() { + @Override + public void onSuccess(TeamMember members) { + if(members!=null){ + if(members.getType() == TeamMemberType.Manager){ + XKitRouter.withKey(RouterConstant.PATH_USER_INFO_PAGE) + .withContext(TeamMembersList1Activity.this) + .withParam(RouterConstant.KEY_ACCOUNT_ID_KEY, IMKitClient.account()) + .withParam("userId", userid) + .withParam("teamId", teamId) + .withParam("isGroup", true) + .navigate(); + } + } + + } + + @Override + public void onFailed(int code) { + // 撤销群管理员失败 + + } + + @Override + public void onException(Throwable exception) { + // 错误 + } + }); + + return; + } + + XKitRouter.withKey(RouterConstant.PATH_USER_INFO_PAGE) + .withContext(TeamMembersList1Activity.this) + .withParam(RouterConstant.KEY_ACCOUNT_ID_KEY, IMKitClient.account()) + .withParam("userId", userid) + .withParam("teamId", teamId) + .withParam("isGroup", true) + .navigate(); + } + + public void initData() { + teammodel.getRemoveMembersData().observe( + this, + voidResultInfo -> { + if (voidResultInfo.getSuccess()) { + //移除群成员成功 变量太多 + List userInfos = new ArrayList<>(); + List list = membersAdapter.getSelectedInt(); + for (int i = 0; i < list.size(); i++) { + userInfos.add(membersAdapter.getData().get(list.get(i))); + } + for (int i = 0; i < userInfos.size(); i++) { + UserInfo userInfo = userInfos.get(i); +// int searchIndex = listSearch.indexOf(userInfo); +// if (searchIndex >= 0) { //通过搜索列表删除的 +// listSearch.remove(searchIndex); +// } + int indexSelector = selectorlist.indexOf(userInfo.getAccount()); + int indexMembers = listmemebers.indexOf(userInfo); + if (indexSelector >= 0) { + selectorlist.remove(indexSelector); //成员有变化 ,邀请 选中的人数就有变化(都是好友) + } + if (indexMembers >= 0) { + listmemebers.remove(indexMembers); + } + + } +// LogUtils.d("删除结束 " + listmemebers.size()); + binding.tvteammembers.setText(getString(com.netease.yunxin.kit.contactkit.ui.R.string.fun_creategroup_members, listmemebers.size() - 1)); + isRefresh = true; + setTitleEdit(listmemebers, true, R.string.teammember_edit); + binding.editSelectorFriends.setText(""); + + + //刪除的 +// if (deletePosition >= 0) { +// if (listSearch.size() == deletePosition || listmemebers.size() == deletePosition) { +// deletePosition = deletePosition - 1; +// } +//// if (listSearch.size() == 0 && listmemebers.size() == deletePosition) { +//// deletePosition = deletePosition - 1; +//// } +// UserInfo userInfo; +// if (listSearch.size() > 0) { +// userInfo = listSearch.get(deletePosition); +// listSearch.remove(deletePosition); +// membersAdapter.removeData(deletePosition); +// deletePosition = listmemebers.indexOf(userInfo); +// } else { +// membersAdapter.removeData(deletePosition); +// } +// binding.tvteammembers.setText(getString(com.netease.yunxin.kit.contactkit.ui.R.string.fun_creategroup_members, membersAdapter.getData().size())); +// selectorlist.remove(listmemebers.get(deletePosition).getAccount()); +// listmemebers.remove(deletePosition); +// isRefresh = true; +// } + } + + }); + teammodel.getUserInfoData().observe(this, listResultInfo -> { + if (listResultInfo.getSuccess()) { + memberMap = null; +// getTeamActiveTime(); + List list = listResultInfo.getValue(); + //邀请成功 获取用户信息 + selectorlist.clear(); + listmemebers.clear(); + listmemebers.add(IMKitClient.getUserInfo()); + for (UserInfoWithTeam userinfo : list) { + LogUtils.i("走了3333333333444444444:"+GsonUtils.beanToJSONString(userinfo)); + + selectorlist.add(userinfo.getUserInfo().getAccount()); + UserInfo userInfos = userinfo.getUserInfo(); + userInfos.setSignature(userinfo.getTeamInfo().isMute()?"1":""); + listmemebers.add(userInfos); + +// listmemebers.add(userinfo.getUserInfo()); + } + membersAdapter.setData(listmemebers, false, memberMap, teamId); + isRefresh = true; + binding.tvteammembers.setText(getString(com.netease.yunxin.kit.contactkit.ui.R.string.fun_creategroup_members, listmemebers.size() - 1)); + } + }); + + if (listmemebers != null) { + for (UserInfo userInfo : listmemebers) { + selectorlist.add(userInfo.getAccount()); + } + } + + teammodel.getQuitTeamData().observe(this, voidResultInfo -> { + if (voidResultInfo.getSuccess()) { + //成功 + showTransferDialog(true, ""); + } else { + showTransferDialog(false, voidResultInfo.getMsg().getMessage()); + } + }); + } + + + private boolean isRemove = false; + + + private void initTitleView() { + binding.title.setTitle(com.netease.yunxin.kit.contactkit.ui.R.string.select); + binding.title.getBackImageView().setImageResource(com.netease.yunxin.kit.contactkit.ui.R.drawable.ic_dialog_close); + binding.title.getBackImageView().setOnClickListener(v -> { + finish(); + }); + } + + + public void setTitleEdit(List listmember, boolean isEdit, int actionText) { + binding.title.setActionText(actionText); + membersAdapter.setEdit(!isEdit); + membersAdapter.getSelectedInt().clear(); + membersAdapter.setData(listmember, false, memberMap, teamId); + } + + + public void showTransferDialog(boolean isSuccess, String value) { + + ActionConfirmDialog actionConfirmDialog = new ActionConfirmDialog(this, isSuccess ? getString(R.string.transfer_success) + : (TextUtils.isEmpty(value) ? getString(R.string.transfer_fail) : getString(R.string.transfer_failmsg, value)), false); + + actionConfirmDialog.setOnToActionListener(new ActionConfirmDialog.OnToActionListener() { + @Override + public void toSumbit() { + if (isSuccess) { + //回调结果 + quite = 2; + setActivityResult(); + } else { + actionConfirmDialog.dismiss(); + } + + } + + @Override + public void toCancel() { + } + }); + actionConfirmDialog.show(); + + } + + public void setActivityResult() { + Intent intent = new Intent(); + intent.putExtra(TYPE, type); + intent.putExtra(QUITE, quite); + setResult(RESULT_OK, intent); + finish(); + } + + public List searchName(String key) { + List listSearch = new ArrayList<>(); + List result = new ArrayList<>(); + result.addAll(listmemebers); + if (result.size() >= 2 && (result.get(0).getAccount().equals(result.get(1).getAccount()))) { //因为邀请好友icon + result.remove(result.get(0)); + } + for (UserInfo userInfo : result) { + + String name = getAlias(userInfo); + if (name.contains(key)) { + listSearch.add(userInfo); + } + } + return listSearch; + } + + + public String getAlias(UserInfo userInfo) { + String name = userInfo.getName(); + if (ContactRepo.isFriend(userInfo.getAccount())) { + String alias = ContactRepo.getFriend(userInfo.getAccount()).getAlias(); + return TextUtils.isEmpty(alias) ? name : alias; + } + return name; + } + + +} diff --git a/app/src/main/java/com/hbl/lewan/imkit/team/adapter/TeamMembersAdapter1.java b/app/src/main/java/com/hbl/lewan/imkit/team/adapter/TeamMembersAdapter1.java new file mode 100644 index 0000000..5d90aaa --- /dev/null +++ b/app/src/main/java/com/hbl/lewan/imkit/team/adapter/TeamMembersAdapter1.java @@ -0,0 +1,315 @@ +// Copyright (c) 2022 NetEase, Inc. All rights reserved. +// Use of this source code is governed by a MIT license that can be +// found in the LICENSE file. + +package com.hbl.lewan.imkit.team.adapter; + +import android.content.Context; +import android.graphics.Color; +import android.text.TextUtils; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; +import androidx.viewbinding.ViewBinding; + +import com.hbl.lewan.R; +import com.hbl.lewan.databinding.TeamMembersViewHolderBinding; +import com.netease.nimlib.sdk.NIMClient; +import com.netease.nimlib.sdk.team.TeamService; +import com.netease.nimlib.sdk.team.constant.TeamMemberType; +import com.netease.nimlib.sdk.team.model.TeamMember; +import com.netease.yunxin.kit.chatkit.repo.ContactRepo; +import com.netease.yunxin.kit.corekit.im.model.UserInfo; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.Map; + +// 群组成员列表 +public class TeamMembersAdapter1 extends RecyclerView.Adapter { + + protected List members; + private Context mContext; + private boolean isShowInvited = true; + private boolean isEdit = false; + private int mType; // + private int selectpostion = -1; + private Map mapTime; + private List selectedInt = new ArrayList<>(); //多选position + private String teamId; + + public TeamMembersAdapter1(Context context, int type) { + members = new ArrayList<>(); + mContext = context; + mType = type; + } + + protected TeamMembersAdapter1.ItemClickListener itemClickListener; + + public void setItemClickListener(TeamMembersAdapter1.ItemClickListener itemClickListener) { + this.itemClickListener = itemClickListener; + } + + public void setData(List list, boolean isShow, Map mapActiveTime, String teamId) { + members.clear(); + members.addAll(list); + selectedInt.clear(); + isShowInvited = isShow; + mapTime = mapActiveTime; + this.teamId = teamId; + notifyDataSetChanged(); + } + + public void setEdit(boolean edit) { + isEdit = edit; + } + + public boolean isEdit() { + return isEdit; + } + + + public int getSelectpostion() { + return selectpostion; + } + + + public void refreshData(List list, boolean isInvited) { + isShowInvited = isInvited; + selectpostion = -1; + members.clear(); + members.addAll(list); + notifyDataSetChanged(); + } + + public List getSelectedInt() { + return selectedInt; + } + + // public void addData(List list) { +// int initsize = members.size(); +// members.addAll(list); +// notifyItemRangeChanged(initsize, list.size()); +// } + + public void removeData(int position) { + members.remove(position); + notifyItemRemoved(position); + } + + public List getData() { + return members; + } + + @NonNull + @Override + public TeamMembersViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + return new TeamMembersViewHolder(TeamMembersViewHolderBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); + } + + @Override + public void onBindViewHolder(@NonNull TeamMembersViewHolder holder, int position) { + UserInfo userInfo = members.get(position); + holder.binding.unreadTv.setVisibility(View.GONE); + if (position == 0 && isShowInvited) { + holder.binding.avatarView.setData(com.netease.yunxin.kit.contactkit.ui.R.drawable.ic_creategroup_add, ""); + holder.binding.icDelete.setVisibility(View.GONE); + holder.binding.tvName.setText(mContext.getResources().getString(R.string.invcode_friend_txt)); + holder.binding.tvNameActivetime.setVisibility(View.GONE); + } else { + TeamMember teamMember = NIMClient.getService(TeamService.class).queryTeamMemberBlock(teamId, userInfo.getAccount()); + if(teamMember!=null){ + if(teamMember.getType() == TeamMemberType.Manager){ + holder.binding.unreadTv.setVisibility(View.VISIBLE); + holder.binding.unreadTv.setText(R.string.teamsetting_other_teammanager); + holder.binding.unreadTv.setBackgroundResource(com.netease.yunxin.kit.conversationkit.ui.R.drawable.bg_conversation_red_dot1); + }else if(teamMember.getType() == TeamMemberType.Owner){ + holder.binding.unreadTv.setVisibility(View.VISIBLE); + holder.binding.unreadTv.setText(com.netease.yunxin.kit.teamkit.ui.R.string.team_owner); + holder.binding.unreadTv.setBackgroundResource(com.netease.yunxin.kit.conversationkit.ui.R.drawable.bg_conversation_red_dot); + + + } + } + if (isEdit) { + if (teamMember != null && (teamMember.getType() == TeamMemberType.Manager || teamMember.getType() == TeamMemberType.Owner)) { + holder.binding.icDelete.setVisibility(View.GONE); + } else { + holder.binding.icDelete.setVisibility(View.VISIBLE); + } + if (selectedInt.indexOf(position) >= 0) { + holder.binding.icDelete.setBackgroundResource(R.mipmap.dialog_gou_t); + } else { + holder.binding.icDelete.setBackgroundResource(R.mipmap.dialog_gou_ff); + } +// holder.binding.icDelete.setVisibility(userInfo.getAccount().equals(IMKitClient.account()) ? View.GONE : View.VISIBLE); + } else if (mType == 1) { + + if (selectpostion >= 0 && position == selectpostion) { + holder.binding.icDelete.setBackgroundResource(R.mipmap.dialog_gou_tt); + } else { + holder.binding.icDelete.setBackgroundResource(R.drawable.bg_d8d8d8_singleunselector); + } + holder.binding.icDelete.setVisibility(View.VISIBLE); + } else { + holder.binding.icDelete.setVisibility(View.GONE); + } + String avaterurl = userInfo.getAvatar(); + if (TextUtils.isEmpty(avaterurl)) { + holder.binding.avatarView.setData(R.mipmap.default_head_img, userInfo.getName(), 0); + } else { + holder.binding.avatarView.setData(avaterurl, userInfo.getName()); + } + String name = userInfo.getName(); + if (ContactRepo.isFriend(userInfo.getAccount())) { + String alias = ContactRepo.getFriend(userInfo.getAccount()).getAlias(); + if (!TextUtils.isEmpty(alias)) { + name = alias; + } + } + holder.binding.tvName.setText(name); + if (mapTime != null && mapTime.size() > 0) { + holder.binding.tvNameActivetime.setVisibility(View.VISIBLE); + holder.binding.tvNameActivetime.setTextColor(Color.parseColor("#FE6881")); + holder.binding.tvNameActivetime.setBackgroundResource(R.drawable.cornor_stroke_fe6881_2dp); + String time = parseTimeLong(holder.binding.tvNameActivetime, mapTime.get(userInfo.getAccount())); + holder.binding.tvNameActivetime.setText(time); + } else { + holder.binding.tvNameActivetime.setVisibility(View.GONE); + } + + holder.binding.jinyanIv.setVisibility(View.GONE); + if(!TextUtils.isEmpty(userInfo.getSignature())&&userInfo.getSignature().equals("1")){ + holder.binding.jinyanIv.setVisibility(View.VISIBLE); + } + } + holder.binding.avatarView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (itemClickListener != null) { + itemClickListener.onAddClick(userInfo, position); + } + } + }); + + holder.binding.getRoot().setOnClickListener(view -> { + if (itemClickListener != null) { + if (position == 0 && isShowInvited) { +// itemClickListener.onAddClick(); //邀请好友 + } else { + if (mType == 1) { //转让 + if (selectpostion == position) { + selectpostion = -1; + } else { + selectpostion = position; + } + notifyDataSetChanged(); + } else { + if (isEdit && holder.binding.icDelete.getVisibility() == View.VISIBLE) { + //管理员删除用户选择 + int index = selectedInt.indexOf(position); + if (index >= 0) { + selectedInt.remove(index); + } else { + selectedInt.add(position); + } + notifyItemChanged(position); + + } else { + itemClickListener.onItemClick(userInfo, position); + } + } + + } + + + } + }); + } + + + /* + 相差天数 + */ + public static int differentDays(long timeseconds) { + Date date1 = new Date(timeseconds); + Date date2 = new Date(System.currentTimeMillis()); //当前日期 + Calendar cal1 = Calendar.getInstance(); + cal1.setTime(date1); + + Calendar cal2 = Calendar.getInstance(); + cal2.setTime(date2); + int day1 = cal1.get(Calendar.DAY_OF_YEAR); + int day2 = cal2.get(Calendar.DAY_OF_YEAR); + + int year1 = cal1.get(Calendar.YEAR); + int year2 = cal2.get(Calendar.YEAR); + if (year1 != year2) //不同年 + { + int timeDistance = 0; + for (int i = year1; i < year2; i++) { + if (i % 4 == 0 && i % 100 != 0 || i % 400 == 0) //闰年 + { + timeDistance += 366; + } else //不是闰年 + { + timeDistance += 365; + } + } + + return timeDistance + (day2 - day1); + } else //同年 + { + return day2 - day1; + } + } + + public String parseTimeLong(TextView textView, long timestra) { + int days = differentDays(timestra); + String time; + if (days == 0) { + time = textView.getResources().getString(R.string.today_txt); + } else if (days == 1) { + time = textView.getResources().getString(R.string.yesterday_txt); + } else if (days <= 6) { + time = String.format(textView.getResources().getString(R.string.jinjiri_txt), days + 1); + } else if (days <= 29) { + time = String.format(textView.getResources().getString(R.string.jinjiri_txt), days + 1); + } else { + textView.setTextColor(Color.parseColor("#cbcbcb")); + textView.setBackgroundResource(R.drawable.cornor_stroke_cbcbcb_2dp); + time = String.format(textView.getResources().getString(R.string.jitianqi_txt), days + 1); + } + return time; + } + + @Override + public int getItemCount() { + return members.size(); + } + + + public interface ItemClickListener { + void onItemClick(UserInfo item, int position); + + void onAddClick(UserInfo item, int position); + } + + protected class TeamMembersViewHolder extends RecyclerView.ViewHolder { + + TeamMembersViewHolderBinding binding; + + public TeamMembersViewHolder(@NonNull ViewBinding binding) { + super(binding.getRoot()); + this.binding = (TeamMembersViewHolderBinding) binding; + } + } +} + + diff --git a/app/src/main/java/com/hbl/lewan/redpack/SendRedPacketActivity.java b/app/src/main/java/com/hbl/lewan/redpack/SendRedPacketActivity.java index 4cc51a2..b463847 100644 --- a/app/src/main/java/com/hbl/lewan/redpack/SendRedPacketActivity.java +++ b/app/src/main/java/com/hbl/lewan/redpack/SendRedPacketActivity.java @@ -19,6 +19,8 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; +import androidx.activity.result.ActivityResultLauncher; +import androidx.activity.result.contract.ActivityResultContracts; import androidx.annotation.Nullable; import androidx.annotation.RequiresApi; import androidx.core.content.ContextCompat; @@ -38,8 +40,11 @@ import com.hbl.lewan.dialog.PayCashDialog; import com.hbl.lewan.dialog.PayCashFingerDialog; import com.hbl.lewan.dialog.PayDialog; import com.hbl.lewan.dialog.SelectPayTypeDialog; +import com.hbl.lewan.imkit.team.TeamMembersList1Activity; +import com.hbl.lewan.imkit.team.TeamMembersListActivity; import com.hbl.lewan.model.BindBean; import com.hbl.lewan.model.LoginBean; +import com.hbl.lewan.model.TeamUpdateEvent; import com.hbl.lewan.model.WalletBean; import com.hbl.lewan.network.Api; import com.hbl.lewan.network.BaseObserver; @@ -58,9 +63,12 @@ import com.netease.nimlib.sdk.msg.MessageBuilder; import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum; import com.netease.nimlib.sdk.msg.model.IMMessage; import com.netease.nimlib.sdk.team.TeamService; +import com.netease.nimlib.sdk.team.constant.TeamMemberType; import com.netease.nimlib.sdk.team.model.Team; +import com.netease.nimlib.sdk.team.model.TeamMember; import com.netease.nimlib.sdk.uinfo.UserService; import com.netease.nimlib.sdk.uinfo.model.NimUserInfo; +import com.netease.yunxin.kit.chatkit.model.UserInfoWithTeam; import com.netease.yunxin.kit.chatkit.repo.ChatRepo; import com.netease.yunxin.kit.chatkit.ui.custom.RedPacketAttachment; import com.netease.yunxin.kit.chatkit.ui.model.GrabbersBean; @@ -68,12 +76,18 @@ import com.netease.yunxin.kit.chatkit.ui.model.GrabbersBean1; import com.netease.yunxin.kit.chatkit.ui.model.RedpacketBean; import com.netease.yunxin.kit.chatkit.ui.model.RedpacketGroupBean; import com.netease.yunxin.kit.common.ui.activities.BaseActivity; +import com.netease.yunxin.kit.common.ui.utils.AvatarColor; import com.netease.yunxin.kit.common.ui.utils.ToastX; +import com.netease.yunxin.kit.corekit.event.EventCenter; import com.netease.yunxin.kit.corekit.im.IMKitClient; +import com.netease.yunxin.kit.corekit.im.model.UserInfo; import com.netease.yunxin.kit.corekit.im.provider.FetchCallback; +import com.netease.yunxin.kit.teamkit.ui.utils.viewmodel.TeamSettingViewModel; import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; import java.util.HashMap; import java.util.List; @@ -81,18 +95,22 @@ import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.schedulers.Schedulers; public class SendRedPacketActivity extends BaseActivity { + public final TeamSettingViewModel teammodel = new TeamSettingViewModel(); boolean isGroup = false; private boolean isPinShouQi = true; LoginBean u; WalletBean walletBean; int maxNumber = 100; - + protected Team teamInfo; + protected TeamMember teamMember; private boolean isJinBi = false; private ActivitySendRedPacketBinding viewBinding; PayCashFingerDialog payCashFingerDialog; PayCashDialog payDialog; - + public List listmemebers = new ArrayList<>(); + private ActivityResultLauncher launcher; + UserInfo userInfo; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { getWindow().setStatusBarColor(getResources().getColor(R.color.color_fcfcfc)); @@ -101,9 +119,39 @@ public class SendRedPacketActivity extends BaseActivity { super.onCreate(savedInstanceState); viewBinding = ActivitySendRedPacketBinding.inflate(getLayoutInflater()); setContentView(viewBinding.getRoot()); - + launcher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> { + if (result.getResultCode() == Activity.RESULT_OK) { + int type = result.getData().getIntExtra("type", 0); + if (type == 0) { + userInfo = (UserInfo) result.getData().getSerializableExtra("bean"); + changeUser(); + } + } + }); initView(); initListeners(); + + + } + + private void changeUser() { + if(userInfo!=null){ + viewBinding.userLy.setVisibility(View.VISIBLE); + String name = + TextUtils.isEmpty(userInfo.getName()) ? userInfo.getAccount() : userInfo.getName(); + String avaterurl = userInfo.getAvatar(); + if (TextUtils.isEmpty(avaterurl)) { + viewBinding.avIndexfraHead.setData( + R.mipmap.default_head_img, name, AvatarColor.avatarColor(IMKitClient.account())); + } else { + viewBinding.avIndexfraHead.setData( + userInfo.getAvatar(), name, AvatarColor.avatarColor(IMKitClient.account())); + } + + viewBinding.userNameTv.setText(name); + }else{ + viewBinding.userLy.setVisibility(View.GONE); + } } /** @@ -123,8 +171,7 @@ public class SendRedPacketActivity extends BaseActivity { // 设置标题(自定义标题栏后的title文本设置是不同的哦,见CustomeTitleBar中的说明) // this.setTitle(getString(R.string.fshb_txt)); if (isGroup) { - viewBinding.jintLeftTv.setText(R.string.zjine_txt); - viewBinding.groupRedLy.setVisibility(View.VISIBLE); +// viewBinding.jintLeftTv.setText(R.string.zjine_txt); viewBinding.tipsTv.setVisibility(View.VISIBLE); changeType(); @@ -140,11 +187,76 @@ public class SendRedPacketActivity extends BaseActivity { viewBinding.tipsNamesTv.setText(String.format(getString(R.string.hbq_tips_txt), user.getMemberCount())); maxNumber = user.getMemberCount(); } + + initGroup(); } viewBinding.tipsTv.setOnClickListener(v -> selectType()); + } + //排序我的Team + public List sortListMembers(List teammemberlist) { + Collections.sort(teammemberlist, teammemberComparator); + return teammemberlist; + } + + //按照群主在第一個,后加入的在最後 + public Comparator teammemberComparator = + (bean1, bean2) -> { + int result = 0; + if (bean1 == null) { + result = 1; + } else if (bean2 == null) { + result = -1; + } else if (bean1.getTeamInfo().getType() == TeamMemberType.Owner && bean2.getTeamInfo().getType() != TeamMemberType.Owner) { + result = -1; + } else if (bean1.getTeamInfo().getType() != TeamMemberType.Owner && bean2.getTeamInfo().getType() == TeamMemberType.Owner) { + result = 1; + } else if (bean1.getTeamInfo().getType() != TeamMemberType.Owner && bean2.getTeamInfo().getType() != TeamMemberType.Owner) { + long joinTime = bean1.getTeamInfo().getJoinTime() - bean2.getTeamInfo().getJoinTime(); + result = (joinTime == 0L ? 0 : (joinTime > 0 ? 1 : -1)); + } + return result; + }; + private void initGroup() { + teammodel.requestTeamData(getIntent().getStringExtra("receiverUid")); + teammodel.requestTeamMembers(getIntent().getStringExtra("receiverUid")); + teammodel.getUserInfoData().observe(this, listResultInfo -> { + if (listResultInfo.getSuccess()) { + List list = listResultInfo.getValue(); + listmemebers.clear(); + list = sortListMembers(list); + for (UserInfoWithTeam userinfo : list) { + + UserInfo userInfos = userinfo.getUserInfo(); + userInfos.setSignature(userinfo.getTeamInfo().isMute()?"1":""); + listmemebers.add(userInfos); +// listmemebers.add(userinfo.getUserInfo()); + } + + } + }); + teammodel + .getTeamWithMemberData() + .observe( + this, + teamResultInfo -> { + dismissLoading(); + if (teamResultInfo.getValue() == null || !teamResultInfo.getSuccess()) { + finish(); + return; + } + teamInfo = teamResultInfo.getValue().getTeam(); + teamMember = teamResultInfo.getValue().getTeamMember(); +// if (isUpdateTeam) { +// isUpdateTeam = false; +// TeamUpdateEvent teamUpdateEvent = new TeamUpdateEvent(); +// teamUpdateEvent.setTeam(teamInfo); +// EventCenter.notifyEvent(teamUpdateEvent); +// } +// refreshUI(teamInfo); + }); } private TextView coloseIv; @@ -198,17 +310,17 @@ public class SendRedPacketActivity extends BaseActivity { public void onSuccess(Result feedbackResp) { walletBean = feedbackResp.data; if (walletBean != null) { - if (isJinBi) { +// if (isJinBi) { viewBinding.jinbiTv.setText(String.format(getString(R.string.qbyf_txt), AppUtils.getQian(walletBean.getGoldCoin()))); - } else { - viewBinding.jinbiTv.setText(String.format(getString(R.string.hljfye_txt), AppUtils.getQian(walletBean.getSilverCoin()))); - } +// } else { +// viewBinding.jinbiTv.setText(String.format(getString(R.string.hljfye_txt), AppUtils.getQian(walletBean.getSilverCoin()))); +// } } else { - if (isJinBi) { +// if (isJinBi) { viewBinding.jinbiTv.setText(String.format(getString(R.string.qbyf_txt), "0.00")); - } else { - viewBinding.jinbiTv.setText(String.format(getString(R.string.hljfye_txt), "0.00")); - } +// } else { +// viewBinding.jinbiTv.setText(String.format(getString(R.string.hljfye_txt), "0.00")); +// } // } } @@ -225,24 +337,15 @@ public class SendRedPacketActivity extends BaseActivity { private void changeType() { if (isPinShouQi) { - viewBinding.jintLeftTv.setText(getString(R.string.zjine_txt)); -// tipsTv.setText(String.format(getString(R.string.red_packet_tips_txt), getString(R.string.pinshouqi_txt))); -// tips1Tv.setText(getString(R.string.putong_txt)); viewBinding.tipsTv.setText(getString(R.string.psjhb_txt)); - viewBinding.numberHintEt.setHint(getString(R.string.red_packet_number_hint_txt)); - if (isGroup) { - Drawable drawable = getResources().getDrawable(R.mipmap.left_pin_gift); - drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight()); - viewBinding.jintLeftTv.setCompoundDrawables(drawable, null, null, null); - } - + viewBinding.groupRedLy.setVisibility(View.VISIBLE); + viewBinding.zhuanshuLy.setVisibility(View.GONE); } else { - viewBinding.jintLeftTv.setText(R.string.dangejine_txt); - viewBinding.numberHintEt.setHint(getString(R.string.red_packet_number_hint_txt1)); - viewBinding.tipsTv.setText(getString(R.string.pthb_txt)); - viewBinding.jintLeftTv.setCompoundDrawables(null, null, null, null); - + viewBinding.tipsTv.setText("专属红包"); + viewBinding.groupRedLy.setVisibility(View.GONE); + viewBinding.zhuanshuLy.setVisibility(View.VISIBLE); + changeUser(); } changeInfo(); } @@ -278,6 +381,21 @@ public class SendRedPacketActivity extends BaseActivity { protected void initListeners() { + viewBinding.zhuanshuLy.setOnClickListener(v -> { + if(teamInfo!=null) { + int manager = 0; + if (teamMember.getType() == TeamMemberType.Owner) { + manager = 1; + } + if (teamMember.getType() == TeamMemberType.Manager) { + manager = 2; + } + + TeamMembersList1Activity.launch(SendRedPacketActivity.this, manager, false, getIntent().getStringExtra("receiverUid"), listmemebers, teamInfo, launcher); + } + + }); + viewBinding.tvLogin.setOnClickListener(v -> { // if(true){ // ToastX.showShortToast("敬请期待"); @@ -686,19 +804,19 @@ public class SendRedPacketActivity extends BaseActivity { float number1 = Float.parseFloat(viewBinding.numberHintEt.getText().toString().trim()); String text1 = String.format("%.2f", number1); viewBinding.numberTv.setText(text1); - if (isGroup) { - if (!isPinShouQi) { - if (TextUtils.isEmpty(viewBinding.sizeHintEt.getText().toString().trim())) { - viewBinding.numberTv.setText("0.00"); - } else { - float number = Float.parseFloat(viewBinding.numberHintEt.getText().toString().trim()); - int size = Integer.parseInt(viewBinding.sizeHintEt.getText().toString().trim()); - String text = String.format("%.2f", number * size); - viewBinding.numberTv.setText(text); - - } - } - } +// if (isGroup) { +// if (!isPinShouQi) { +// if (TextUtils.isEmpty(viewBinding.sizeHintEt.getText().toString().trim())) { +// viewBinding.numberTv.setText("0.00"); +// } else { +// float number = Float.parseFloat(viewBinding.numberHintEt.getText().toString().trim()); +// int size = Integer.parseInt(viewBinding.sizeHintEt.getText().toString().trim()); +// String text = String.format("%.2f", number * size); +// viewBinding.numberTv.setText(text); +// +// } +// } +// } } else { viewBinding.numberTv.setText("0.00"); diff --git a/app/src/main/java/com/hbl/lewan/wallet/ChongZhiLogActivity.java b/app/src/main/java/com/hbl/lewan/wallet/ChongZhiLogActivity.java new file mode 100644 index 0000000..e73a78a --- /dev/null +++ b/app/src/main/java/com/hbl/lewan/wallet/ChongZhiLogActivity.java @@ -0,0 +1,46 @@ +package com.hbl.lewan.wallet; + +import android.os.Bundle; +import android.view.View; + +import androidx.annotation.Nullable; + +import com.hbl.lewan.R; +import com.hbl.lewan.databinding.ActivityChongzhiLogBinding; +import com.netease.yunxin.kit.common.ui.activities.BaseActivity; + +public class ChongZhiLogActivity extends BaseActivity { + ActivityChongzhiLogBinding viewBinding; + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + viewBinding = ActivityChongzhiLogBinding.inflate(getLayoutInflater()); + setContentView(viewBinding.getRoot()); + initView(); + } + + protected void initView() { + viewBinding.contactListActivityTitleBar.getBackImageView().setOnClickListener(v -> finish()); + getWindow().setStatusBarColor(getResources().getColor(R.color.white)); + getWindow().setNavigationBarColor(getResources().getColor(R.color.white)); + + viewBinding.contactListActivityTitleBar.setBackgroundColor(getResources().getColor(R.color.white)); + getSupportFragmentManager().beginTransaction() + .replace(R.id.frameLayout, WalletInfologFragment.newInstance(0)) + .commit(); + viewBinding.bigBg.setBackgroundResource(R.color.white); + viewBinding.contactListActivityTitleBar.getTitleTextView().setTextColor(getColor(R.color.black)); + getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + } + + + @Override + protected void onStop() { + super.onStop(); + } + + + + +} diff --git a/app/src/main/java/com/hbl/lewan/wallet/MyWalletActivity.java b/app/src/main/java/com/hbl/lewan/wallet/MyWalletActivity.java index 3363584..9f99ef6 100644 --- a/app/src/main/java/com/hbl/lewan/wallet/MyWalletActivity.java +++ b/app/src/main/java/com/hbl/lewan/wallet/MyWalletActivity.java @@ -85,7 +85,9 @@ public class MyWalletActivity extends BaseActivity { } }); viewBinding.czBt.setOnClickListener(v -> startActivity(new Intent(MyWalletActivity.this, TopUpActivity.class))); - viewBinding.txBt.setOnClickListener(v -> startActivity(new Intent(MyWalletActivity.this, TopUpActivity.class))); + viewBinding.txBt.setOnClickListener(v -> startActivity(new Intent(MyWalletActivity.this, TiXianActivity.class))); + viewBinding.czjlBt.setOnClickListener(v -> startActivity(new Intent(MyWalletActivity.this, ChongZhiLogActivity.class))); + viewBinding.txjlBt.setOnClickListener(v -> startActivity(new Intent(MyWalletActivity.this, TiXianLogActivity.class))); viewBinding.hbjlBt.setOnClickListener(v -> { diff --git a/app/src/main/java/com/hbl/lewan/wallet/TiXianActivity.java b/app/src/main/java/com/hbl/lewan/wallet/TiXianActivity.java new file mode 100644 index 0000000..6921bd6 --- /dev/null +++ b/app/src/main/java/com/hbl/lewan/wallet/TiXianActivity.java @@ -0,0 +1,464 @@ +package com.hbl.lewan.wallet; + +import android.content.Intent; +import android.graphics.Color; +import android.net.Uri; +import android.os.Bundle; +import android.text.Editable; +import android.text.Html; +import android.text.TextUtils; +import android.text.TextWatcher; +import android.view.View; +import android.widget.LinearLayout; +import android.widget.RadioButton; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.annotation.Nullable; +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.LinearLayoutManager; + +import com.blankj.utilcode.util.ToastUtils; +import com.hbl.lewan.IMUIKitConfig; +import com.hbl.lewan.R; +import com.hbl.lewan.adapter.CommonAdapter; +import com.hbl.lewan.adapter.ViewHolder; +import com.hbl.lewan.databinding.ActivityTixianBinding; +import com.hbl.lewan.databinding.ActivityTopupBinding; +import com.hbl.lewan.dialog.ActionConfirmDialog; +import com.hbl.lewan.main.mine.ChangeAccoutActionActivity; +import com.hbl.lewan.model.BindBean; +import com.hbl.lewan.model.ExchangeConfBean; +import com.hbl.lewan.model.InstallmentBean; +import com.hbl.lewan.model.SendOrderBean; +import com.hbl.lewan.model.WalletBean; +import com.hbl.lewan.network.Api; +import com.hbl.lewan.network.BaseObserver; +import com.hbl.lewan.network.Result; +import com.hbl.lewan.utils.AppUtils; +import com.hbl.lewan.utils.GsonUtils; +import com.hbl.lewan.utils.LogUtils; +import com.netease.yunxin.kit.common.ui.activities.BaseActivity; +import com.netease.yunxin.kit.common.ui.activities.BrowseActivity; +import com.netease.yunxin.kit.common.ui.utils.ToastX; +import com.netease.yunxin.kit.corekit.im.IMKitClient; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import io.reactivex.android.schedulers.AndroidSchedulers; +import io.reactivex.schedulers.Schedulers; + +public class TiXianActivity extends BaseActivity { + boolean isG; + ActivityTixianBinding viewBinding; + WalletBean walletBean; + BindBean bindBean; + private List globalAmountList = new ArrayList<>(); + private List installmentBeans = new ArrayList<>(); +// CommonAdapter commonAdapter; + CommonAdapter installmentAdapter; + int defaultIndex = 0; //输入的金额 + private boolean isFenqi = false; + private int installmentNum; //分期數 + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { +// getWindow().setStatusBarColor(getResources().getColor(R.color.color_403d51)); + getWindow().setNavigationBarColor(getResources().getColor(R.color.color_f6f5f7)); +// getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); + + super.onCreate(savedInstanceState); + viewBinding = ActivityTixianBinding.inflate(getLayoutInflater()); + setContentView(viewBinding.getRoot()); + setSelector(false); + setFenqiView(false); + initView(); + bindInfo(); + getConf(); + + } + + public void setFenqiView(boolean show) { +// viewBinding.lineInstall.setVisibility(show ? View.VISIBLE : View.GONE); +// viewBinding.tvPaytypeFenqi.setVisibility(show ? View.VISIBLE : View.GONE); + viewBinding.recyclerInstallment.setVisibility(show ? View.VISIBLE : View.GONE); + } + + public void setSelector(boolean fenqi) { + isFenqi = fenqi; + if (fenqi) { +// viewBinding.tvPaytypeCard.setCompoundDrawablesWithIntrinsicBounds(null, null, getResources().getDrawable(R.mipmap.dialog_gou_ff), null); +// viewBinding.tvPaytypeFenqi.setCompoundDrawablesWithIntrinsicBounds(null, null, getResources().getDrawable(R.mipmap.ic_single_selected), null); + } else { +// viewBinding.tvPaytypeCard.setCompoundDrawablesWithIntrinsicBounds(null, null, getResources().getDrawable(R.mipmap.ic_single_selected), null); +// viewBinding.tvPaytypeFenqi.setCompoundDrawablesWithIntrinsicBounds(null, null, getResources().getDrawable(R.mipmap.dialog_gou_ff), null); + installmentNum = 0; + if (installmentAdapter != null) + installmentAdapter.notifyDataSetChanged(); + } + } + + @Override + protected void onResume() { + super.onResume(); + getWallet(); + } + + private void bindInfo() { + Api.getInstance().bindInfo(IMKitClient.account()) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new BaseObserver<>() { + @Override + public void onSuccess(Result feedbackResp) { + bindBean = feedbackResp.data; + LogUtils.i("获取到的数据:" + GsonUtils.beanToJSONString(bindBean)); + } + + @Override + public void onError(int code, String msg) { + LogUtils.i("获取到的错误:" + code + "" + msg); + } + }); + + } + + private void getFee() { + Map params = new HashMap<>(); + params.put("amount", defaultIndex); + Api.getInstance().getFee(params) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new BaseObserver<>() { + @Override + public void onSuccess(Result> feedbackResp) { + LogUtils.i("获取到的数据:" + feedbackResp.data); + installmentBeans.clear(); + if (feedbackResp.data != null && feedbackResp.data.size() > 0) { + installmentBeans.addAll(feedbackResp.data); + installmentNum = 0; + } + installmentAdapter.notifyDataSetChanged(); + + + } + + @Override + public void onError(int code, String msg) { + LogUtils.i("获取到的错误:" + code + "" + msg); + } + }); + } + + private void payInstallment(int installment) { + if (exchangeConfBean != null) { + if ((defaultIndex < exchangeConfBean.getMinAmount()) || (defaultIndex > exchangeConfBean.getMaxAmount())) { + ToastUtils.showShort(String.format(getString(R.string.taixiao_topup_txt), exchangeConfBean.getMinAmount() / exchangeConfBean.getExchangeRatio(), exchangeConfBean.getMaxAmount() / exchangeConfBean.getExchangeRatio())); + return; + } + Map maps = new HashMap<>(); + maps.put("amount", defaultIndex); + maps.put("type", 5); + maps.put("installment", installment); + Api.getInstance().payInstallment(maps) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new BaseObserver<>() { + @Override + public void onSuccess(Result feedbackResp) { + LogUtils.i("获取到的数据:" + feedbackResp.data); + if (!TextUtils.isEmpty(feedbackResp.data)) { +// String packageName = "com.chailease.tw.app.android.ccfappcust.uat"; // 目标应用的包名 +// PackageManager packageManager = getPackageManager(); +// Intent intent = new Intent(); +// intent = packageManager.getLaunchIntentForPackage(packageName); +// intent.setData(Uri.parse(feedbackResp.data)); +// if (intent == null) { +// ToastUtils.showShort("请安装银角零卡APP"); +// } else { +// startActivity(intent); +// } + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setData(Uri.parse(feedbackResp.data)); + startActivity(intent); +// Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(feedbackResp.data)); +// startActivity(intent); +// BrowseActivity.Companion.launch( +// TopUpActivity.this, getString(R.string.cash_cuzhi_txt), feedbackResp.data); +// startActivity(new Intent(TopUpActivity.this, PayWebActivity.class).putExtra("url", feedbackResp.data)); + + } + } + + @Override + public void onError(int code, String msg) { + LogUtils.i("获取到的错误:" + code + "" + msg); + } + }); + } + + } + + protected void initView() { +// Drawable drawable = viewBinding.titlebar.getBackImageView().getDrawable().mutate();// +// Drawable wrap = DrawableCompat.wrap(drawable); +// DrawableCompat.setTint(wrap, ContextCompat.getColor(this, R.color.color_d4ab90)); +// viewBinding.titlebar.getBackImageView().setImageDrawable(wrap); + viewBinding.titlebar.getBackImageView().setOnClickListener(v -> finish()); + LinearLayoutManager linearLayoutManager = new LinearLayoutManager(TiXianActivity.this); +// linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); + viewBinding.recyclerInstallment.setLayoutManager(linearLayoutManager); + installmentAdapter = new CommonAdapter(TiXianActivity.this, R.layout.item_bill_installment, installmentBeans) { + @Override + public void convert(ViewHolder holder, InstallmentBean s, int index) { + TextView titleTv = holder.getView(R.id.title_tv); + TextView desTv = holder.getView(R.id.des_tv); + titleTv.setText(getString(R.string.str_qi, s.getPeriodCount())); + desTv.setText(getString(R.string.str_installment_tips, s.getAmount())); + LinearLayout big_bg = holder.getView(R.id.big_bg); + if (s.getPeriodCount() == installmentNum) { + titleTv.setTextColor(Color.parseColor("#FF9C32")); + desTv.setTextColor(Color.parseColor("#FF9C32")); + big_bg.setBackgroundResource(R.drawable.logout_btn_main2); + } else { + titleTv.setTextColor(getColor(R.color.color_333333)); + desTv.setTextColor(getColor(R.color.color_333333)); + big_bg.setBackgroundResource(R.drawable.input_bg_t); + } + + big_bg.setOnClickListener(v -> { + installmentNum = s.getPeriodCount(); + notifyDataSetChanged(); +// viewBinding.tvCashvalue.setText("NT$:" + (defaultIndex + s.getAmount())); + setSelector(true); + }); + + } + }; + viewBinding.recyclerInstallment.setAdapter(installmentAdapter); + viewBinding.editQueryEt.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + if (TextUtils.isEmpty(viewBinding.editQueryEt.getText().toString().trim())) { + defaultIndex = 0; + } else { + if (exchangeConfBean != null) { + defaultIndex = Integer.parseInt(viewBinding.editQueryEt.getText().toString().trim()) * exchangeConfBean.getExchangeRatio(); + } else { + defaultIndex = Integer.parseInt(viewBinding.editQueryEt.getText().toString().trim()); + } + } + showBottomType(); + } + + @Override + public void afterTextChanged(Editable s) { +// commonAdapter.notifyDataSetChanged(); + } + }); +// AnimUtil.setAnimViews(viewBinding.topupTv); + +// viewBinding.topupTv.setOnClickListener(v -> { +// if (bindBean != null) { +// if (!bindBean.getPhoneBind()) { +// showDialog(); +// } else if (!bindBean.getPayPasswordSet()) { +// showDialogPay(); +// } else { +// if (isFenqi) { +// if (installmentNum == 0) { +// ToastUtils.showShort(getString(R.string.str_installment_toast)); +// return; +// } +// payInstallment(installmentNum); +// } else { +// sumbit(); +// } +// +// } +// } +// }); +// viewBinding.tvPaytypeCard.setOnClickListener(v -> { +// setSelector(false); +// }); +// viewBinding.tvPaytypeFenqi.setOnClickListener(v -> { +// setSelector(true); +// if (defaultIndex > 0) { +// getFee(); +// } +// }); + viewBinding.tipsTv.setText(Html.fromHtml("单笔提现手续费2
提现费率0.5%
预计到账时间2小时以内")); + + viewBinding.radioRg.setOnCheckedChangeListener(((group, checkedId) -> { + RadioButton radioButton = (RadioButton) findViewById(checkedId); + Toast.makeText(getApplicationContext(),"你选了:"+radioButton.getText(),Toast.LENGTH_LONG).show(); + })); + } + + private void showBottomType() { +// viewBinding.tvCashvalue.setText("NT$:" + defaultIndex); + setFenqiView(false); + if (defaultIndex >= 1000) { + setFenqiView(true); + getFee(); + } + +// if (exchangeConfBean != null) { +// if(TextUtils.isEmpty(viewBinding.editQueryEt.getText().toString().trim())){ +// viewBinding.showZidingyiLy.setVisibility(View.GONE); +// }else{ +// viewBinding.showZidingyiLy.setVisibility(View.VISIBLE); +// viewBinding.zidingyicashTv.setText(defaultIndex+""); +// } +// }else{ +// viewBinding.showZidingyiLy.setVisibility(View.GONE); +// +// } + + } + + private void sumbit() { + if (exchangeConfBean != null) { + if ((defaultIndex < exchangeConfBean.getMinAmount()) || (defaultIndex > exchangeConfBean.getMaxAmount())) { + ToastUtils.showShort(String.format(getString(R.string.taixiao_topup_txt), exchangeConfBean.getMinAmount() / exchangeConfBean.getExchangeRatio(), exchangeConfBean.getMaxAmount() / exchangeConfBean.getExchangeRatio())); + return; + } + + HashMap map = new HashMap<>(); + map.put("amount", defaultIndex); + map.put("type", "3"); //信用卡支付 + Api.getInstance().sendOrderV2(map) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new BaseObserver<>() { + @Override + public void onSuccess(Result feedbackResp) { + startToWeb(feedbackResp.data); + } + + @Override + public void onError(int code, String msg) { + ToastX.showShortToast(msg); + } + }); + } + + } + + private void startToWeb(SendOrderBean sendOrderBean) { + String url = IMUIKitConfig.ONLINE_PAYMENT_URL + "?" + sendOrderBean.getQuery() + "&exchangeRatio=" + exchangeConfBean.getExchangeRatio() + "&type=3"; + LogUtils.i("请求地址:" + url); + BrowseActivity.Companion.launch( + TiXianActivity.this, getString(R.string.cash_cuzhi_txt), url); + } + + + ExchangeConfBean exchangeConfBean; + + private void getConf() { + Api.getInstance().chargeConf() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new BaseObserver>() { + @Override + public void onSuccess(Result feedbackResp) { + exchangeConfBean = feedbackResp.data; + if (feedbackResp != null && feedbackResp.data.getAmountItems() != null) { + globalAmountList = feedbackResp.data.getAmountItems(); +// commonAdapter.setDates(globalAmountList); + } + } + + @Override + public void onError(int code, String msg) { + ToastX.showShortToast(msg); + } + }); + } + + + private void showDialogPay() { + + com.netease.yunxin.kit.chatkit.ui.dialog.ActionConfirmDialog actionDialog = new com.netease.yunxin.kit.chatkit.ui.dialog.ActionConfirmDialog(TiXianActivity.this, + getString(com.netease.yunxin.kit.chatkit.ui.R.string.bind_phone_des_txt1), getString(com.netease.yunxin.kit.chatkit.ui.R.string.cancel_txt), getString(com.netease.yunxin.kit.chatkit.ui.R.string.to_sett_txt)); + actionDialog.setOnToActionListener(new com.netease.yunxin.kit.chatkit.ui.dialog.ActionConfirmDialog.OnToActionListener() { + @Override + public void toSumbit() { +// Intent intent = new Intent(getActivity(), ChangeAccoutActionActivity.class); +// intent.putExtra("type", 5); +// startActivity(intent); + Intent intent = new Intent(TiXianActivity.this, SetPayPasswordActivity.class); + startActivity(intent); + } + + @Override + public void toCancel() { + + } + }); + actionDialog.show(); + } + + + private void showDialog() { + + ActionConfirmDialog actionDialog = new ActionConfirmDialog(TiXianActivity.this, + getString(R.string.bind_phone_des_txt), getString(R.string.nobind_txt), getString(R.string.tobind_txt)); + actionDialog.setOnToActionListener(new ActionConfirmDialog.OnToActionListener() { + @Override + public void toSumbit() { + Intent intent = new Intent(TiXianActivity.this, ChangeAccoutActionActivity.class); + intent.putExtra("type", ChangeAccoutActionActivity.TYPE_BIND_PHONE); + startActivity(intent); + } + + @Override + public void toCancel() { + + } + }); + actionDialog.show(); + } + + private void getWallet() { + Api.getInstance().walletInfo(IMKitClient.account()) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new BaseObserver>() { + + @Override + public void onSuccess(Result feedbackResp) { + walletBean = feedbackResp.data; + changeInfo(); + } + + @Override + public void onError(int code, String msg) { + + } + }); + + + } + + + private void changeInfo() { + viewBinding.dianshuTv.setText("¥ "+AppUtils.getQian(walletBean.getGoldCoin())); + } + + @Override + protected void onStop() { + super.onStop(); + + } + + +} diff --git a/app/src/main/java/com/hbl/lewan/wallet/TiXianLogActivity.java b/app/src/main/java/com/hbl/lewan/wallet/TiXianLogActivity.java new file mode 100644 index 0000000..7eaff33 --- /dev/null +++ b/app/src/main/java/com/hbl/lewan/wallet/TiXianLogActivity.java @@ -0,0 +1,45 @@ +package com.hbl.lewan.wallet; + +import android.os.Bundle; +import android.view.View; + +import androidx.annotation.Nullable; + +import com.hbl.lewan.R; +import com.hbl.lewan.databinding.ActivityTixianLogBinding; +import com.netease.yunxin.kit.common.ui.activities.BaseActivity; + +public class TiXianLogActivity extends BaseActivity { + ActivityTixianLogBinding viewBinding; + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + viewBinding = ActivityTixianLogBinding.inflate(getLayoutInflater()); + setContentView(viewBinding.getRoot()); + initView(); + } + + + protected void initView() { + viewBinding.contactListActivityTitleBar.getBackImageView().setOnClickListener(v -> finish()); + getWindow().setStatusBarColor(getResources().getColor(R.color.white)); + getWindow().setNavigationBarColor(getResources().getColor(R.color.white)); + viewBinding.contactListActivityTitleBar.setBackgroundColor(getResources().getColor(R.color.white)); + getSupportFragmentManager().beginTransaction() + .replace(R.id.frameLayout, WalletInfologFragment.newInstance(0)) + .commit(); + viewBinding.bigBg.setBackgroundResource(R.color.white); + viewBinding.contactListActivityTitleBar.getTitleTextView().setTextColor(getColor(R.color.black)); + getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + } + + + @Override + protected void onStop() { + super.onStop(); + + } + + +} diff --git a/app/src/main/java/com/hbl/lewan/wallet/TopUpActivity.java b/app/src/main/java/com/hbl/lewan/wallet/TopUpActivity.java index 418bfee..d1563ad 100644 --- a/app/src/main/java/com/hbl/lewan/wallet/TopUpActivity.java +++ b/app/src/main/java/com/hbl/lewan/wallet/TopUpActivity.java @@ -67,7 +67,7 @@ public class TopUpActivity extends BaseActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { // getWindow().setStatusBarColor(getResources().getColor(R.color.color_403d51)); -// getWindow().setNavigationBarColor(getResources().getColor(R.color.color_fffbfb)); + getWindow().setNavigationBarColor(getResources().getColor(R.color.color_f6f5f7)); // getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); super.onCreate(savedInstanceState); @@ -82,19 +82,19 @@ public class TopUpActivity extends BaseActivity { } public void setFenqiView(boolean show) { - viewBinding.lineInstall.setVisibility(show ? View.VISIBLE : View.GONE); - viewBinding.tvPaytypeFenqi.setVisibility(show ? View.VISIBLE : View.GONE); +// viewBinding.lineInstall.setVisibility(show ? View.VISIBLE : View.GONE); +// viewBinding.tvPaytypeFenqi.setVisibility(show ? View.VISIBLE : View.GONE); viewBinding.recyclerInstallment.setVisibility(show ? View.VISIBLE : View.GONE); } public void setSelector(boolean fenqi) { isFenqi = fenqi; if (fenqi) { - viewBinding.tvPaytypeCard.setCompoundDrawablesWithIntrinsicBounds(null, null, getResources().getDrawable(R.mipmap.dialog_gou_ff), null); - viewBinding.tvPaytypeFenqi.setCompoundDrawablesWithIntrinsicBounds(null, null, getResources().getDrawable(R.mipmap.ic_single_selected), null); +// viewBinding.tvPaytypeCard.setCompoundDrawablesWithIntrinsicBounds(null, null, getResources().getDrawable(R.mipmap.dialog_gou_ff), null); +// viewBinding.tvPaytypeFenqi.setCompoundDrawablesWithIntrinsicBounds(null, null, getResources().getDrawable(R.mipmap.ic_single_selected), null); } else { - viewBinding.tvPaytypeCard.setCompoundDrawablesWithIntrinsicBounds(null, null, getResources().getDrawable(R.mipmap.ic_single_selected), null); - viewBinding.tvPaytypeFenqi.setCompoundDrawablesWithIntrinsicBounds(null, null, getResources().getDrawable(R.mipmap.dialog_gou_ff), null); +// viewBinding.tvPaytypeCard.setCompoundDrawablesWithIntrinsicBounds(null, null, getResources().getDrawable(R.mipmap.ic_single_selected), null); +// viewBinding.tvPaytypeFenqi.setCompoundDrawablesWithIntrinsicBounds(null, null, getResources().getDrawable(R.mipmap.dialog_gou_ff), null); installmentNum = 0; if (installmentAdapter != null) installmentAdapter.notifyDataSetChanged(); @@ -209,8 +209,8 @@ public class TopUpActivity extends BaseActivity { // viewBinding.titlebar.getBackImageView().setImageDrawable(wrap); viewBinding.titlebar.getBackImageView().setOnClickListener(v -> finish()); iniAdapter(); - LinearLayoutManager linearLayoutManager = new LinearLayoutManager(TopUpActivity.this); - linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); + GridLayoutManager linearLayoutManager = new GridLayoutManager(TopUpActivity.this,3); +// linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); viewBinding.recyclerInstallment.setLayoutManager(linearLayoutManager); installmentAdapter = new CommonAdapter(TopUpActivity.this, R.layout.item_bill_installment, installmentBeans) { @Override @@ -221,8 +221,8 @@ public class TopUpActivity extends BaseActivity { desTv.setText(getString(R.string.str_installment_tips, s.getAmount())); LinearLayout big_bg = holder.getView(R.id.big_bg); if (s.getPeriodCount() == installmentNum) { - titleTv.setTextColor(Color.parseColor("#654C35")); - desTv.setTextColor(Color.parseColor("#654C35")); + titleTv.setTextColor(Color.parseColor("#FF9C32")); + desTv.setTextColor(Color.parseColor("#FF9C32")); big_bg.setBackgroundResource(R.drawable.logout_btn_main2); } else { titleTv.setTextColor(getColor(R.color.color_333333)); @@ -233,7 +233,7 @@ public class TopUpActivity extends BaseActivity { big_bg.setOnClickListener(v -> { installmentNum = s.getPeriodCount(); notifyDataSetChanged(); - viewBinding.tvCashvalue.setText("NT$:" + (defaultIndex + s.getAmount())); +// viewBinding.tvCashvalue.setText("NT$:" + (defaultIndex + s.getAmount())); setSelector(true); }); @@ -265,43 +265,43 @@ public class TopUpActivity extends BaseActivity { commonAdapter.notifyDataSetChanged(); } }); - AnimUtil.setAnimViews(viewBinding.topupTv); +// AnimUtil.setAnimViews(viewBinding.topupTv); - viewBinding.topupTv.setOnClickListener(v -> { - if (bindBean != null) { - if (!bindBean.getPhoneBind()) { - showDialog(); - } else if (!bindBean.getPayPasswordSet()) { - showDialogPay(); - } else { - if (isFenqi) { - if (installmentNum == 0) { - ToastUtils.showShort(getString(R.string.str_installment_toast)); - return; - } - payInstallment(installmentNum); - } else { - sumbit(); - } - - } - } - }); - viewBinding.tvPaytypeCard.setOnClickListener(v -> { - setSelector(false); - }); - viewBinding.tvPaytypeFenqi.setOnClickListener(v -> { - setSelector(true); - if (defaultIndex > 0) { - getFee(); - } - }); +// viewBinding.topupTv.setOnClickListener(v -> { +// if (bindBean != null) { +// if (!bindBean.getPhoneBind()) { +// showDialog(); +// } else if (!bindBean.getPayPasswordSet()) { +// showDialogPay(); +// } else { +// if (isFenqi) { +// if (installmentNum == 0) { +// ToastUtils.showShort(getString(R.string.str_installment_toast)); +// return; +// } +// payInstallment(installmentNum); +// } else { +// sumbit(); +// } +// +// } +// } +// }); +// viewBinding.tvPaytypeCard.setOnClickListener(v -> { +// setSelector(false); +// }); +// viewBinding.tvPaytypeFenqi.setOnClickListener(v -> { +// setSelector(true); +// if (defaultIndex > 0) { +// getFee(); +// } +// }); } private void showBottomType() { - viewBinding.tvCashvalue.setText("NT$:" + defaultIndex); +// viewBinding.tvCashvalue.setText("NT$:" + defaultIndex); setFenqiView(false); if (defaultIndex >= 1000) { setFenqiView(true); diff --git a/app/src/main/java/com/hbl/lewan/wallet/WalletInfoRedActivity.java b/app/src/main/java/com/hbl/lewan/wallet/WalletInfoRedActivity.java index 2daa3fc..d10c18b 100644 --- a/app/src/main/java/com/hbl/lewan/wallet/WalletInfoRedActivity.java +++ b/app/src/main/java/com/hbl/lewan/wallet/WalletInfoRedActivity.java @@ -49,18 +49,16 @@ public class WalletInfoRedActivity extends BaseActivity { BindBean bindBean; List listFragment = new ArrayList<>(); String dataString; + WalletInfoRedFragment shoudaoRedFragment; + WalletInfoRedFragment fachuRedFragment; + @Override protected void onCreate(@Nullable Bundle savedInstanceState) { - - super.onCreate(savedInstanceState); viewBinding = ActivityWalletInfoRedBinding.inflate(getLayoutInflater()); setContentView(viewBinding.getRoot()); isG = getIntent().getBooleanExtra("isG", true); initView(); - getWallet(); - bindInfo(); - initRightChange(); initViewPager(); refrshUser(IMKitClient.account()); @@ -68,8 +66,8 @@ public class WalletInfoRedActivity extends BaseActivity { private void initViewPager() { listFragment.clear(); - listFragment.add(WalletInfoRedFragment.newInstance(0,getIntent().getIntExtra("type",-1),null)); - listFragment.add(WalletInfoRedFragment.newInstance(1,getIntent().getIntExtra("type",-1),null)); + listFragment.add(shoudaoRedFragment = WalletInfoRedFragment.newInstance(0)); + listFragment.add(fachuRedFragment = WalletInfoRedFragment.newInstance(1)); CommunityAdapter adapter = new CommunityAdapter(WalletInfoRedActivity.this, listFragment); viewBinding.viewpager.setAdapter(adapter); @@ -165,24 +163,6 @@ public class WalletInfoRedActivity extends BaseActivity { } } - private void bindInfo() { - Api.getInstance().bindInfo(IMKitClient.account()) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new BaseObserver>() { - @Override - public void onSuccess(Result feedbackResp) { - bindBean = feedbackResp.data; - LogUtils.i("获取到的数据:" + GsonUtils.beanToJSONString(bindBean)); - } - - @Override - public void onError(int code, String msg) { - LogUtils.i("获取到的错误:" + code + "" + msg); - } - }); - - } protected void initView() { viewBinding.contactListActivityTitleBar.getBackImageView().setOnClickListener(v -> finish()); @@ -216,79 +196,6 @@ public class WalletInfoRedActivity extends BaseActivity { mTimerPicker.show(data); } - private void showDialogPay() { - - com.netease.yunxin.kit.chatkit.ui.dialog.ActionConfirmDialog actionDialog = new com.netease.yunxin.kit.chatkit.ui.dialog.ActionConfirmDialog(WalletInfoRedActivity.this, - getString(com.netease.yunxin.kit.chatkit.ui.R.string.bind_phone_des_txt1), getString(com.netease.yunxin.kit.chatkit.ui.R.string.cancel_txt), getString(com.netease.yunxin.kit.chatkit.ui.R.string.to_sett_txt)); - actionDialog.setOnToActionListener(new com.netease.yunxin.kit.chatkit.ui.dialog.ActionConfirmDialog.OnToActionListener() { - @Override - public void toSumbit() { -// Intent intent = new Intent(getActivity(), ChangeAccoutActionActivity.class); -// intent.putExtra("type", 5); -// startActivity(intent); - Intent intent = new Intent(WalletInfoRedActivity.this, SetPayPasswordActivity.class); - startActivity(intent); - } - - @Override - public void toCancel() { - - } - }); - actionDialog.show(); - } - - - private void showDialog() { - - ActionConfirmDialog actionDialog = new ActionConfirmDialog(WalletInfoRedActivity.this, - getString(R.string.bind_phone_des_txt), getString(R.string.nobind_txt), getString(R.string.tobind_txt)); - actionDialog.setOnToActionListener(new ActionConfirmDialog.OnToActionListener() { - @Override - public void toSumbit() { - Intent intent = new Intent(WalletInfoRedActivity.this, ChangeAccoutActionActivity.class); - intent.putExtra("type", ChangeAccoutActionActivity.TYPE_BIND_PHONE); - startActivity(intent); - } - - @Override - public void toCancel() { - - } - }); - actionDialog.show(); - } - - private void getWallet() { - Api.getInstance().walletInfo(IMKitClient.account()) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new BaseObserver>() { - - @Override - public void onSuccess(Result feedbackResp) { - walletBean = feedbackResp.data; - changeInfo(); - - } - - @Override - public void onError(int code, String msg) { - - } - }); - - - } - - - private void changeInfo() { - if (walletBean != null) { - - - } - - } @Override protected void onStop() { super.onStop(); diff --git a/app/src/main/java/com/hbl/lewan/wallet/WalletInfoRedFragment.java b/app/src/main/java/com/hbl/lewan/wallet/WalletInfoRedFragment.java index 7dae454..481e0de 100644 --- a/app/src/main/java/com/hbl/lewan/wallet/WalletInfoRedFragment.java +++ b/app/src/main/java/com/hbl/lewan/wallet/WalletInfoRedFragment.java @@ -69,25 +69,21 @@ import io.reactivex.schedulers.Schedulers; * @author */ public class WalletInfoRedFragment extends BaseFragment { - int status; int pageSize = 1; // private TimePickerView pvTime; String time = "2022-06"; int type = -1; String typeInfo = ""; - String billBean = null; CommonAdapter commonAdapter; private ArrayList titles = new ArrayList<>(); List taskBeans = null; int loc = 0; FragmentWalletInfoNewBinding binding; - public static WalletInfoRedFragment newInstance(int status1, int type, String billBean) { + public static WalletInfoRedFragment newInstance(int type) { Bundle bundle = new Bundle(); - bundle.putInt("type", status1); bundle.putInt("type1", type); - bundle.putString("bean", billBean); WalletInfoRedFragment view = new WalletInfoRedFragment(); view.setArguments(bundle); return view; @@ -112,13 +108,8 @@ public class WalletInfoRedFragment extends BaseFragment { protected void initViews() { - this.status = getArguments().getInt("type"); type = getArguments().getInt("type1"); - billBean = getArguments().getString("bean"); - if (billBean != null) { - taskBeans = GsonUtils.getListFromJSON(billBean, TaskBean.class); - } Calendar selectedDate = Calendar.getInstance();//系统当前时间 time = selectedDate.get(Calendar.YEAR) + "-" + ((selectedDate.get(Calendar.MONTH) + 1) < 10 ? "0" + (selectedDate.get(Calendar.MONTH) + 1) : (selectedDate.get(Calendar.MONTH) + 1)); @@ -132,113 +123,6 @@ public class WalletInfoRedFragment extends BaseFragment { } - private void getStatistics() { - Map map = new HashMap<>(); - if (status == 0) { - map.put("coinType", 0); - } else { - map.put("coinType", 1); - - } - if (TextUtils.isEmpty(typeInfo)) { - - } else { - String statTime = time + "-01 00:00:01"; - String endTime = time + "-" + getMonth(time) + " 23:59:59"; - map.put("timeGe", statTime); - map.put("timeLe", endTime); - } - if (!TextUtils.isEmpty(IMUIKitConfig.SUBSTATIONID)) { - map.put("substationId", IMUIKitConfig.SUBSTATIONID); - } - Api.getInstance().statistics(IMKitClient.account(), map) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new BaseObserver>() { - @Override - public void onSuccess(Result feedbackResp) { - if (feedbackResp.data != null) { -// outTv.setText(String.format("%.2f", Math.abs(feedbackResp.data.getOutgoing()) / 100f)); -// incomeTv.setText(String.format("%.2f", feedbackResp.data.getIncoming() / 100f)); - } - } - - @Override - public void onError(int code, String msg) { - - } - }); - - } - - -// private void initCustomTimePicker() { -// /** -// * @description -// * -// * 注意事项: -// * 1.自定义布局中,id为 optionspicker 或者 timepicker 的布局以及其子控件必须要有,否则会报空指针. -// * 具体可参考demo 里面的两个自定义layout布局。 -// * 2.因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 -// * setRangDate方法控制起始终止时间(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) -// */ -// Calendar selectedDate = Calendar.getInstance();//系统当前时间 -// Calendar startDate = Calendar.getInstance(); -// startDate.set(2023, 3, 1); -// Calendar endDate = Calendar.getInstance(); -//// endDate.set(selectedDate.get(Calendar.YEAR), selectedDate.get(Calendar.MONTH) , 28); -// //时间选择器 ,自定义布局 -// pvTime = new TimePickerBuilder(getActivity(), (date, v) -> {//选中事件回调 -// binding.dateTv.setText(getTime(date)); -// time = getTime(date); -// typeInfo = time; -// refreshLayout.autoRefresh(); -// getStatistics(); -// -// }).setBgColor(getResources().getColor(R.color.white)) -// .setContentTextSize(18) -// .setTextColorCenter(getResources().getColor(R.color.black)) -// .setTextColorOut(getResources().getColor(R.color.common_list_hint_text)) -// .setDividerColor(getResources().getColor(R.color.color_f7f7fc)) -// .setRangDate(startDate, endDate) -// .setDate(selectedDate) -// .setLayoutRes(R.layout.pickerview_time, v -> { -// final TextView tvSubmit = (TextView) v.findViewById(R.id.btnSubmit); -// tvSubmit.setTextColor(getResources().getColor(R.color.colorAccent)); -// TextView ivCancel = (TextView) v.findViewById(R.id.btnCancel); -// ivCancel.setTextColor(getResources().getColor(R.color.colorAccent)); -// -// ivCancel.setText(getString(R.string.all_time_txt)); -// tvSubmit.setOnClickListener(v12 -> { -// pvTime.returnData(); -// pvTime.dismiss(); -// }); -// ivCancel.setOnClickListener(v1 -> { -// typeInfo = ""; -// dateTv.setText(getString(R.string.all_time_txt)); -// pvTime.dismiss(); -// refreshLayout.autoRefresh(); -// getStatistics(); -// -// }); -// }) -// .setType(new boolean[]{true, true, false, false, false, false}) -// .setLabel(getString(R.string.time_year_txt), getString(R.string.time_month_txt), getString(R.string.time_day_txt), -// getString(R.string.time_shi_txt), getString(R.string.time_fen_txt), getString(R.string.time_miao_txt)) -// .setLineSpacingMultiplier(1.6f) -// .setTextXOffset(0, 0, 0, 40, 0, -40) -// .isCenterLabel(false) //是否只显示中间选中项的label文字,false则每项item全部都带有label。 -// .setDividerColor(0x00000000) -// .build(); -// } - - - private String getTime(Date date) {//可根据需要自行截取数据显示 - Log.d("getTime()", "choice date millis: " + date.getTime()); - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM"); - return format.format(date); - } - private void initList() { LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity()); @@ -257,7 +141,7 @@ public class WalletInfoRedFragment extends BaseFragment { } else { textView.setTextColor(getResources().getColor(R.color.black)); } - if (s.getTransferMoneyRecord() != null && s.getTransferMoneyRecord().getFeeAmount() > 0 && s.getAmount()<0) { + if (s.getTransferMoneyRecord() != null && s.getTransferMoneyRecord().getFeeAmount() > 0 && s.getAmount() < 0) { isShowRate = true; textView.setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(R.mipmap.ic_transfer_tips), null, null, null); } else { @@ -266,14 +150,13 @@ public class WalletInfoRedFragment extends BaseFragment { } TextView statusTv = holder.getView(R.id.status_tv); statusTv.setVisibility(View.GONE); - if (status == 0) { - if (s.getType() == 5) { - if (s.getWithdrawCashRecord() != null) { - statusTv.setVisibility(View.VISIBLE); - statusTv.setText(getStatusTxt(s.getWithdrawCashRecord())); - } + if (s.getType() == 5) { + if (s.getWithdrawCashRecord() != null) { + statusTv.setVisibility(View.VISIBLE); + statusTv.setText(getStatusTxt(s.getWithdrawCashRecord())); } } + holder.setText(R.id.balan_tv, getString(R.string.yuee_2f_txt1) + AppUtils.getQian(s.getBalance())); // holder.setText(R.id.title_tv,getUserInfo(s)+getTypeString(s.getType())); holder.setText(R.id.title_tv, getTypeNoteString(s)); @@ -346,330 +229,181 @@ public class WalletInfoRedFragment extends BaseFragment { } } - //赠送给商家 type 31 - private String getAmount(BillBean s, long amount) { - return status == 1 && s.getType() == 31 ? String.valueOf(amount) : AppUtils.getQian(amount); - } - private String getTypeNoteString(BillBean s) { //0 群红包,1 私聊红包,2 赠送,3 金币银币互转 - if (status == 1) { - if (s.getType() == 1) { + if (s.getType() == 1) { - if (s.getIsTimeout() == 1) { - return getString(R.string.yinbi_tuikuan_txt); - } else { - if (s.getAmount() > 0) { - String name = "红包"; -// RosterElementEntity friendInfo = MyApplication.getInstance2().getIMClientManager().getFriendsListProvider().getFriendInfoByUid2(s.getFromUserId() + ""); - NimUserInfo friendInfo = NIMClient.getService(UserService.class).getUserInfo(s.getFromUserId() + ""); - // ** 显示头像和昵称 - if (friendInfo != null) { - name = getString(R.string.yinbihongbao_laizi_txt) + friendInfo.getName(); - } else { - name = getString(R.string.yinbihongbao_laizi_txt) + s.getFromUserId(); - } - return name; - } else { - String name = "红包"; -// RosterElementEntity friendInfo = MyApplication.getInstance2().getIMClientManager().getFriendsListProvider().getFriendInfoByUid2(s.getToUserId() + ""); - NimUserInfo friendInfo = NIMClient.getService(UserService.class).getUserInfo(s.getToUserId() + ""); - - // ** 显示头像和昵称 - if (friendInfo != null) { - name = getString(R.string.yinbihonbao_wofagei_txt) + friendInfo.getName(); - } else { - name = getString(R.string.yinbihonbao_wofagei_txt) + s.getToUserId(); - - } - return name; - } - } - } else if (s.getType() == 2) { - - - if (s.getAmount() > 0) { - if ((s.getFromUserId() + "").equals(IMKitClient.account())) { - return getString(R.string.yinbizhuanzhang_tuikuan_txt); - } - - String name = "赠送"; -// RosterElementEntity friendInfo = MyApplication.getInstance2().getIMClientManager().getFriendsListProvider().getFriendInfoByUid2(s.getFromUserId() + ""); - NimUserInfo friendInfo = NIMClient.getService(UserService.class).getUserInfo(s.getFromUserId() + ""); - - // ** 显示头像和昵称 - if (friendInfo != null) { - name = getString(R.string.yinbizhuanzhang_laizi_txt) + friendInfo.getName(); - } else { - name = getString(R.string.yinbizhuanzhang_laizi_txt) + s.getFromUserId(); - } - return name; - } else { - String name = "红利积分赠送"; - NimUserInfo friendInfo = NIMClient.getService(UserService.class).getUserInfo(s.getToUserId() + ""); - // ** 显示头像和昵称 - if (friendInfo != null) { - name = getString(R.string.yinbizhuanzhang_wofagei_txt) + friendInfo.getName(); - } else { - name = getString(R.string.yinbizhuanzhang_wofagei_txt) + s.getToUserId(); - - } - return name; - } - - } else if (s.getType() == 0) { - if (s.getIsTimeout() != null && s.getIsTimeout() == 1) { - if ((s.getFromUserId() + "").equals(IMKitClient.account())) { - return getString(R.string.yinbiqunhongbao_tuikuan_txt); - } - return getString(R.string.yinbiqunhongbao_txt); - } else { - if (!TextUtils.isEmpty(s.getToGroupId())) { - String name = getString(R.string.yinbiqunhongbao_txt); -// GroupEntity groupEntity = MyApplication.getInstance2().getIMClientManager().getGroupsProvider().getGroupInfoByGid(s.getToGroupId()); - Team groupEntity = NIMClient.getService(TeamService.class).queryTeamBlock(s.getToGroupId() + ""); - if (groupEntity != null) { - name = getString(R.string.ybqhb_wfg_txt) + groupEntity.getName(); - } - return name; - } else { - String name = "群红包"; -// RosterElementEntity friendInfo = MyApplication.getInstance2().getIMClientManager().getFriendsListProvider().getFriendInfoByUid2(s.getFromUserId() + ""); - NimUserInfo friendInfo = NIMClient.getService(UserService.class).getUserInfo(s.getFromUserId() + ""); - - if (friendInfo != null) { - name = getString(R.string.yinbiqhb_laizi_txt) + friendInfo.getName(); - } else { - name = getString(R.string.yinbiqhb_laizi_txt) + s.getFromUserNickname(); - } - return name; - } - } - } else if (s.getType() == 3) { - return s.getAmount() < 0 ? getString(R.string.s_to_g_txt) : getString(R.string.g_to_s_txt); - } else if (s.getType() == 4) { - return getString(R.string.shenqi_topup_txt); - } else if (s.getType() == 5) { - return getString(R.string.shenqi_with_txt); - } else if (s.getType() == 6) { - if (s.getDailyTask() != null) { - switch (loc) { - case 1: - return s.getDailyTask().getTaskNameZhCn() + ""; - case 2: - return s.getDailyTask().getTaskNameEnUs() + ""; - case 3: - return s.getDailyTask().getTaskNameJaJp() + ""; - default: - return s.getDailyTask().getTaskNameZhTw() + ""; - } - - } else { - return getString(R.string.renwujiangli_txt); - } - } else if (s.getType() == 7) { - return getString(R.string.invcode_friend_txt); - } else if (s.getType() == 8) { - return getString(R.string.wawaji_txt); - } else if (s.getType() == 9) { - return getString(R.string.guanliyuanxiugai_txt); - } else if (s.getType() == 11 || s.getType() == 13 || s.getType() == 14) { - return s.getCoinModifyRemark() + ""; - } else if (s.getType() == 12) { - return getString(R.string.caipiaojiduijiang_txt); - } else if (s.getType() == 15) { - return getString(R.string.lipinqiangduihuan_txt); - } else if (s.getType() == 16) { - return getString(R.string.jfscxycj_txt); - } else if (s.getType() == 17) { - return getString(R.string.rgzslpjf_txt); - } else if (s.getType() == 18) { - return s.getCoinModifyRemark() + ""; - } else if (s.getType() == 19) { - return s.getCoinModifyRemark() + ""; - } else if (s.getType() == 20 || s.getType() == 23 || s.getType() == 24) { - return s.getCoinModifyRemark() + ""; - } else if (s.getType() == 22) { - return getString(R.string.lpgdh_txt) + s.getCoinModifyRemark() + ""; - } else if (s.getType() == 28) { - return getString(R.string.xywkcjf_txt); + if (s.getIsTimeout() == 1) { + return getString(R.string.jinbihongbao_tuikuan_txt); } else { - return TextUtils.isEmpty(s.getCoinModifyRemark()) ? getString(R.string.weizhi_txt) : s.getCoinModifyRemark() + ""; - } - } else { - if (s.getType() == 1) { - - if (s.getIsTimeout() == 1) { - return getString(R.string.jinbihongbao_tuikuan_txt); - } else { - if (s.getAmount() > 0) { - String name = "红包"; -// RosterElementEntity friendInfo = MyApplication.getInstance2().getIMClientManager().getFriendsListProvider().getFriendInfoByUid2(s.getFromUserId() + ""); - NimUserInfo friendInfo = NIMClient.getService(UserService.class).getUserInfo(s.getFromUserId() + ""); - - // ** 显示头像和昵称 - if (friendInfo != null) { - name = getString(R.string.jinbihongbao_laizi_txt) + friendInfo.getName(); - } else { - name = getString(R.string.jinbihongbao_laizi_txt) + s.getFromUserId(); - } - return name; - } else { - String name = "红包"; -// RosterElementEntity friendInfo = MyApplication.getInstance2().getIMClientManager().getFriendsListProvider().getFriendInfoByUid2(s.getToUserId() + ""); - NimUserInfo friendInfo = NIMClient.getService(UserService.class).getUserInfo(s.getToUserId() + ""); - - // ** 显示头像和昵称 - if (friendInfo != null) { - name = getString(R.string.jinbihongbao_wfg_txt) + friendInfo.getName(); - } else { - name = getString(R.string.jinbihongbao_wfg_txt) + s.getToUserId(); - - } - return name; - } - } - } else if (s.getType() == 2) { - - if (s.getAmount() > 0) { - if ((s.getFromUserId() + "").equals(IMKitClient.account())) { - return getString(R.string.jinbizhuanzhang_tk_txt); - } - - String name = "赠送"; -// RosterElementEntity friendInfo = MyApplication.getInstance2().getIMClientManager().getFriendsListProvider().getFriendInfoByUid2(s.getFromUserId() + ""); + String name = "红包"; +// RosterElementEntity friendInfo = MyApplication.getInstance2().getIMClientManager().getFriendsListProvider().getFriendInfoByUid2(s.getFromUserId() + ""); NimUserInfo friendInfo = NIMClient.getService(UserService.class).getUserInfo(s.getFromUserId() + ""); // ** 显示头像和昵称 if (friendInfo != null) { - name = getString(R.string.jinbizhuanzhang_laizi_txt) + friendInfo.getName(); + name = getString(R.string.jinbihongbao_laizi_txt) + friendInfo.getName(); } else { - name = getString(R.string.jinbizhuanzhang_laizi_txt) + s.getFromUserId(); + name = getString(R.string.jinbihongbao_laizi_txt) + s.getFromUserId(); } return name; } else { - String name = "赠送"; -// RosterElementEntity friendInfo = MyApplication.getInstance2().getIMClientManager().getFriendsListProvider().getFriendInfoByUid2(s.getToUserId() + ""); + String name = "红包"; +// RosterElementEntity friendInfo = MyApplication.getInstance2().getIMClientManager().getFriendsListProvider().getFriendInfoByUid2(s.getToUserId() + ""); NimUserInfo friendInfo = NIMClient.getService(UserService.class).getUserInfo(s.getToUserId() + ""); // ** 显示头像和昵称 if (friendInfo != null) { - name = getString(R.string.jinbizhuanzhang_wofagei_txt) + friendInfo.getName(); + name = getString(R.string.jinbihongbao_wfg_txt) + friendInfo.getName(); } else { - name = getString(R.string.jinbizhuanzhang_wofagei_txt) + s.getToUserId(); + name = getString(R.string.jinbihongbao_wfg_txt) + s.getToUserId(); } return name; } + } + } else if (s.getType() == 2) { - } else if (s.getType() == 0) { - if (s.getIsTimeout() == 1) { - if ((s.getFromUserId() + "").equals(IMKitClient.account())) { - return getString(R.string.jinbiqunhongbao_tuikuan_txt); - } - return getString(R.string.jinbiqunhongbao_txt); + + if (s.getAmount() > 0) { + if ((s.getFromUserId() + "").equals(IMKitClient.account())) { + return getString(R.string.jinbizhuanzhang_tk_txt); + } + + String name = "赠送"; +// RosterElementEntity friendInfo = MyApplication.getInstance2().getIMClientManager().getFriendsListProvider().getFriendInfoByUid2(s.getFromUserId() + ""); + NimUserInfo friendInfo = NIMClient.getService(UserService.class).getUserInfo(s.getFromUserId() + ""); + + // ** 显示头像和昵称 + if (friendInfo != null) { + name = getString(R.string.jinbizhuanzhang_laizi_txt) + friendInfo.getName(); } else { - if (!TextUtils.isEmpty(s.getToGroupId())) { - String name = getString(R.string.jinbiqunhongbao_txt); + name = getString(R.string.jinbizhuanzhang_laizi_txt) + s.getFromUserId(); + } + return name; + } else { + String name = "赠送"; +// RosterElementEntity friendInfo = MyApplication.getInstance2().getIMClientManager().getFriendsListProvider().getFriendInfoByUid2(s.getToUserId() + ""); + NimUserInfo friendInfo = NIMClient.getService(UserService.class).getUserInfo(s.getToUserId() + ""); + + // ** 显示头像和昵称 + if (friendInfo != null) { + name = getString(R.string.jinbizhuanzhang_wofagei_txt) + friendInfo.getName(); + } else { + name = getString(R.string.jinbizhuanzhang_wofagei_txt) + s.getToUserId(); + + } + return name; + } + + } else if (s.getType() == 0) { + if (s.getIsTimeout() == 1) { + if ((s.getFromUserId() + "").equals(IMKitClient.account())) { + return getString(R.string.jinbiqunhongbao_tuikuan_txt); + } + return getString(R.string.jinbiqunhongbao_txt); + } else { + if (!TextUtils.isEmpty(s.getToGroupId())) { + String name = getString(R.string.jinbiqunhongbao_txt); // GroupEntity groupEntity = MyApplication.getInstance2().getIMClientManager().getGroupsProvider().getGroupInfoByGid(s.getToGroupId()); - Team groupEntity = NIMClient.getService(TeamService.class).queryTeamBlock(s.getToGroupId() + ""); + Team groupEntity = NIMClient.getService(TeamService.class).queryTeamBlock(s.getToGroupId() + ""); - if (groupEntity != null) { - name = getString(R.string.jinbiqunhongbao_wfg_txt) + groupEntity.getName(); - } - return name; - } else { - String name = "群红包"; + if (groupEntity != null) { + name = getString(R.string.jinbiqunhongbao_wfg_txt) + groupEntity.getName(); + } + return name; + } else { + String name = "群红包"; // RosterElementEntity friendInfo = MyApplication.getInstance2().getIMClientManager().getFriendsListProvider().getFriendInfoByUid2(s.getFromUserId() + ""); - NimUserInfo friendInfo = NIMClient.getService(UserService.class).getUserInfo(s.getFromUserId() + ""); + NimUserInfo friendInfo = NIMClient.getService(UserService.class).getUserInfo(s.getFromUserId() + ""); - if (friendInfo != null) { - name = getString(R.string.jinbiqunhb_laizi_txt) + friendInfo.getName(); - } else { - name = getString(R.string.jinbiqunhb_laizi_txt) + s.getFromUserNickname(); - } - return name; - } - } - } else if (s.getType() == 3) { - return s.getAmount() < 0 ? getString(R.string.g_to_s_txt) : getString(R.string.s_to_g_txt); - } else if (s.getType() == 4) { - return getString(R.string.jinbichongzhi_f_bank_txt); - } else if (s.getType() == 21) { - return getString(R.string.jinbichongzhi_f_bank_txt1); - } else if (s.getType() == 22) { - return s.getCoinModifyRemark() + ""; - } else if (s.getType() == 5) { - return getString(R.string.jinbitixian_txt); - } else if (s.getType() == 8) { - if (s.getOauthApp() != null) { - return s.getOauthApp().getAppName() + getString(R.string.zhuanchu_txt); - } else { - return getString(R.string.fffcz_txt); - } - } else if (s.getType() == 9) { - if (s.getOauthApp() != null) { - return s.getOauthApp().getAppName() + getString(R.string.zhuanru_txt); - } else { - return getString(R.string.ffftx_txt); - } - } else if (s.getType() == 7) { - if (s.getOauthApp() != null) { - return getString(R.string.laxinsjf_txt); - } else { - return getString(R.string.fffcz_txt); - } - } else if (s.getType() == 10) { - return getString(R.string.wawaji_txt); - } else if (s.getType() == 12) { - return getString(R.string.guanliyuanxiugai_txt); - } else if (s.getType() == 13) { - return getString(R.string.niuniuxiazhudongjie_txt); - } else if (s.getType() == 14) { - return getString(R.string.niuniujiesuan_txt); - } else if (s.getType() == 15) { - return getString(R.string.niuniulingbaofei_txt); - } else if (s.getType() == 16) { - if (s.getAmount() > 0) { - return getString(R.string.erweimashouklaizi_txt1) + s.getFromUserNickname(); - } else { - NimUserInfo nimUserInfo = NIMClient.getService(UserService.class).getUserInfo(s.getToUserId() + ""); - if (nimUserInfo != null) { - return getString(R.string.saomafukuan_txt2) + nimUserInfo.getName(); + if (friendInfo != null) { + name = getString(R.string.jinbiqunhb_laizi_txt) + friendInfo.getName(); } else { - return getString(R.string.saomafukuan_txt1); + name = getString(R.string.jinbiqunhb_laizi_txt) + s.getFromUserNickname(); } + return name; } - } else if (s.getType() == 18) { + } + } else if (s.getType() == 3) { + return s.getAmount() < 0 ? getString(R.string.g_to_s_txt) : getString(R.string.s_to_g_txt); + } else if (s.getType() == 4) { + return getString(R.string.jinbichongzhi_f_bank_txt); + } else if (s.getType() == 21) { + return getString(R.string.jinbichongzhi_f_bank_txt1); + } else if (s.getType() == 22) { + return s.getCoinModifyRemark() + ""; + } else if (s.getType() == 5) { + return getString(R.string.jinbitixian_txt); + } else if (s.getType() == 8) { + if (s.getOauthApp() != null) { + return s.getOauthApp().getAppName() + getString(R.string.zhuanchu_txt); + } else { + return getString(R.string.fffcz_txt); + } + } else if (s.getType() == 9) { + if (s.getOauthApp() != null) { + return s.getOauthApp().getAppName() + getString(R.string.zhuanru_txt); + } else { + return getString(R.string.ffftx_txt); + } + } else if (s.getType() == 7) { + if (s.getOauthApp() != null) { + return getString(R.string.laxinsjf_txt); + } else { + return getString(R.string.fffcz_txt); + } + } else if (s.getType() == 10) { + return getString(R.string.wawaji_txt); + } else if (s.getType() == 12) { + return getString(R.string.guanliyuanxiugai_txt); + } else if (s.getType() == 13) { + return getString(R.string.niuniuxiazhudongjie_txt); + } else if (s.getType() == 14) { + return getString(R.string.niuniujiesuan_txt); + } else if (s.getType() == 15) { + return getString(R.string.niuniulingbaofei_txt); + } else if (s.getType() == 16) { + if (s.getAmount() > 0) { return getString(R.string.erweimashouklaizi_txt1) + s.getFromUserNickname(); - } else if (s.getType() == 19) { - return getString(R.string.saomaduibi_txt); - } else if (s.getType() == 20) { - return getString(R.string.jinbiduihuanlebi_txt); - } else if (s.getType() == 17) { + } else { NimUserInfo nimUserInfo = NIMClient.getService(UserService.class).getUserInfo(s.getToUserId() + ""); if (nimUserInfo != null) { return getString(R.string.saomafukuan_txt2) + nimUserInfo.getName(); } else { return getString(R.string.saomafukuan_txt1); } - } else if (s.getType() == 11) { - if (s.getAmount() > 0) { - return "Dream Game " + getString(R.string.zhuanru_txt); - } else { - return "Dream Game " + getString(R.string.zhuanchu_txt); - - } - } else if (s.getType() == 27) { - return getString(R.string.danzhujiduizhu_txt); - } else if (s.getType() == 23 || s.getType() == 24) { - return s.getCoinModifyRemark() + ""; - } else { - return TextUtils.isEmpty(s.getCoinModifyRemark()) ? getString(R.string.weizhi_txt) : s.getCoinModifyRemark() + ""; } + } else if (s.getType() == 18) { + return getString(R.string.erweimashouklaizi_txt1) + s.getFromUserNickname(); + } else if (s.getType() == 19) { + return getString(R.string.saomaduibi_txt); + } else if (s.getType() == 20) { + return getString(R.string.jinbiduihuanlebi_txt); + } else if (s.getType() == 17) { + NimUserInfo nimUserInfo = NIMClient.getService(UserService.class).getUserInfo(s.getToUserId() + ""); + if (nimUserInfo != null) { + return getString(R.string.saomafukuan_txt2) + nimUserInfo.getName(); + } else { + return getString(R.string.saomafukuan_txt1); + } + } else if (s.getType() == 11) { + if (s.getAmount() > 0) { + return "Dream Game " + getString(R.string.zhuanru_txt); + } else { + return "Dream Game " + getString(R.string.zhuanchu_txt); + + } + } else if (s.getType() == 27) { + return getString(R.string.danzhujiduizhu_txt); + } else if (s.getType() == 23 || s.getType() == 24) { + return s.getCoinModifyRemark() + ""; + } else { + return TextUtils.isEmpty(s.getCoinModifyRemark()) ? getString(R.string.weizhi_txt) : s.getCoinModifyRemark() + ""; } + } private int getTypeRes(BillBean bean) { @@ -689,141 +423,52 @@ public class WalletInfoRedFragment extends BaseFragment { return R.mipmap.bill_chongzhi_img1; case 22: case 23: - if (status == 1) { - return R.mipmap.duihuan_bill_img; - } else { - return R.mipmap.bill_chongzhi_img; - } + return R.mipmap.bill_chongzhi_img; case 24: - if (status == 1) { - return R.mipmap.duihuan_bill_img; - } else { - return R.mipmap.bill_chongzhi_img; - } + return R.mipmap.bill_chongzhi_img; case 5: return R.mipmap.bill_tixian_img; case 6: - if (status == 1) { - if (bean.getDailyTask() != null) { - if (bean.getDailyTask().getTaskId() == 3) { - return R.mipmap.cir_task_img; - } else if (bean.getDailyTask().getTaskId() == 1) { - return R.mipmap.yaoqing_task_img; - } else { - return R.mipmap.game_task_img; - } - } - } else { - return R.mipmap.default_head_img; - } + return R.mipmap.default_head_img; case 7: - if (status == 1) { - return R.mipmap.yaoqing_task_img; - } else { - return R.mipmap.default_head_img; - } + return R.mipmap.default_head_img; case 8: - if (status == 1) { - return R.mipmap.wawaji_img; - } else { - return R.mipmap.bill_chongzhi_img; - } + return R.mipmap.bill_chongzhi_img; case 9: - if (status == 1) { - return R.mipmap.guanli_xiugai_img; - } else { - return R.mipmap.bill_tixian_img; - } + return R.mipmap.bill_tixian_img; case 10: return R.mipmap.wawaji_img; case 20: - if (status == 1) { - return R.mipmap.yinbi_type_20; - } else { - return R.mipmap.wawaji_img; - } - + return R.mipmap.wawaji_img; case 12: - if (status == 1) { - return R.mipmap.bill_caipiaoji_duijiang_img; - } else { - return R.mipmap.guanli_xiugai_img; - } + return R.mipmap.guanli_xiugai_img; case 11: - if (status == 1) { - - if (bean.getAmount() > 0) { - return R.mipmap.bill_chongzhi_img; - } else { - return R.mipmap.yinbishangcheng_bill_img; - } - } else { - return R.mipmap.bill_tixian_img; - } + return R.mipmap.bill_tixian_img; case 13: - if (status == 1) { - return R.mipmap.duihuan_bill_img; - } else { - return R.mipmap.niuniu_jilu_img; - - } + return R.mipmap.niuniu_jilu_img; case 14: - if (status == 1) { - return R.mipmap.jfcj; - } else { - return R.mipmap.niuniu_jilu_img; - } + return R.mipmap.niuniu_jilu_img; case 15: - if (status == 1) { - return R.mipmap.duihuan_bill_img; - } else { - return R.mipmap.niuniu_jilu_img; - } + return R.mipmap.niuniu_jilu_img; case 16: - if (status == 1) { - return R.mipmap.jfcj; - - } else { - if (bean.getAmount() > 0) { - return R.mipmap.erweishoukuan_bill_img; - } else { - return R.mipmap.erweifukuan_bill_img; - } - } - case 17: - if (status == 1) { - return R.mipmap.rzzs; + if (bean.getAmount() > 0) { + return R.mipmap.erweishoukuan_bill_img; } else { return R.mipmap.erweifukuan_bill_img; } + case 17: + return R.mipmap.erweifukuan_bill_img; case 18: - if (status == 1) { - return R.mipmap.mojiang_img; - } else { - return R.mipmap.erweishoukuan_bill_img; - } + return R.mipmap.erweishoukuan_bill_img; case 19: - if (status == 1) { - return R.mipmap.duihuan_bill_img; - } else { - return R.mipmap.saomaduibi_img; - } + return R.mipmap.saomaduibi_img; case 27: return R.mipmap.type_g_27; case 29: - if (status == 1) { - return R.mipmap.type_s_24; - - } else { - return R.mipmap.type_g_27; - - } + return R.mipmap.type_g_27; case 28: - if (status == 1) { - return R.mipmap.duihuan_bill_img; - } else { - return R.mipmap.erweifukuan_bill_img; - } + return R.mipmap.erweifukuan_bill_img; + case 30: return R.mipmap.type_s_24; default: @@ -851,10 +496,7 @@ public class WalletInfoRedFragment extends BaseFragment { public void onResume() { super.onResume(); String name = DataUtils.get(getActivity(), "wallet_info_" + IMKitClient.account(), ""); - if (status == 1) { - name = DataUtils.get(getActivity(), "wallet_info_s_" + IMKitClient.account(), ""); - } -// binding.typeTv1.setVisibility(View.GONE); + if (TextUtils.isEmpty(name)) { binding.refreshLayout.autoRefresh(); @@ -871,102 +513,52 @@ public class WalletInfoRedFragment extends BaseFragment { private void getDateList() { - if (status == 0) { - Map map = new HashMap<>(); - if (type == -1) { - if (TextUtils.isEmpty(typeInfo)) { - map.put("page", pageSize); - } else { - String statTime = time + "-01 00:00:01"; - String endTime = time + "-" + getMonth(time) + " 23:59:59"; - map.put("page", pageSize); - map.put("timeGe", statTime); - map.put("timeLe", endTime); - } + Map map = new HashMap<>(); + if (type == -1) { + if (TextUtils.isEmpty(typeInfo)) { + map.put("page", pageSize); } else { - if (TextUtils.isEmpty(typeInfo)) { - map.put("page", pageSize); - map.put("type", type); - - } else { - String statTime = time + "-01 00:00:01"; - String endTime = time + "-" + getMonth(time) + " 23:59:59"; - - map.put("page", pageSize); - map.put("timeGe", statTime); - map.put("timeLe", endTime); - map.put("type", type); - } + String statTime = time + "-01 00:00:01"; + String endTime = time + "-" + getMonth(time) + " 23:59:59"; + map.put("page", pageSize); + map.put("timeGe", statTime); + map.put("timeLe", endTime); } - if (!TextUtils.isEmpty(IMUIKitConfig.SUBSTATIONID)) { - map.put("substationId", IMUIKitConfig.SUBSTATIONID); - } - Api.getInstance().goldDetails(IMKitClient.account(), map) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new BaseObserver>>() { - @Override - public void onSuccess(Result> feedbackResp) { - changeDate(feedbackResp.data); - } - - @Override - public void onError(int code, String msg) { - LogUtils.i("获取到的错误:" + code + "" + msg); - binding.refreshLayout.finishRefresh(); - binding.refreshLayout.finishLoadMore(); - changeView(false); - } - }); - } else { - Map map = new HashMap<>(); - if (type == -1) { - if (TextUtils.isEmpty(typeInfo)) { - map.put("page", pageSize); - } else { - String statTime = time + "-01 00:00:01"; - String endTime = time + "-" + getMonth(time) + " 23:59:59"; - map.put("page", pageSize); - map.put("timeGe", statTime); - map.put("timeLe", endTime); - } + if (TextUtils.isEmpty(typeInfo)) { + map.put("page", pageSize); + map.put("type", type); + } else { - if (TextUtils.isEmpty(typeInfo)) { - map.put("page", pageSize); - map.put("type", type); + String statTime = time + "-01 00:00:01"; + String endTime = time + "-" + getMonth(time) + " 23:59:59"; - } else { - String statTime = time + "-01 00:00:01"; - String endTime = time + "-" + getMonth(time) + " 23:59:59"; - - map.put("page", pageSize); - map.put("timeGe", statTime); - map.put("timeLe", endTime); - map.put("type", type); - } + map.put("page", pageSize); + map.put("timeGe", statTime); + map.put("timeLe", endTime); + map.put("type", type); } - if (!TextUtils.isEmpty(IMUIKitConfig.SUBSTATIONID)) { - map.put("substationId", IMUIKitConfig.SUBSTATIONID); - } - Api.getInstance().silverDetails(IMKitClient.account(), map) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new BaseObserver>>() { - @Override - public void onSuccess(Result> feedbackResp) { - changeDate(feedbackResp.data); - } - - @Override - public void onError(int code, String msg) { - LogUtils.i("获取到的错误:" + code + "" + msg); - binding.refreshLayout.finishRefresh(); - binding.refreshLayout.finishLoadMore(); - changeView(false); - } - }); } + if (!TextUtils.isEmpty(IMUIKitConfig.SUBSTATIONID)) { + map.put("substationId", IMUIKitConfig.SUBSTATIONID); + } + Api.getInstance().goldDetails(IMKitClient.account(), map) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new BaseObserver>>() { + @Override + public void onSuccess(Result> feedbackResp) { + changeDate(feedbackResp.data); + } + + @Override + public void onError(int code, String msg) { + LogUtils.i("获取到的错误:" + code + "" + msg); + binding.refreshLayout.finishRefresh(); + binding.refreshLayout.finishLoadMore(); + changeView(false); + } + }); } @@ -999,13 +591,9 @@ public class WalletInfoRedFragment extends BaseFragment { if (pageSize == 1) { titles = (ArrayList) data.getList(); - if (status == 0) { - if (type == -1) - DataUtils.set(getActivity(), "wallet_info_" + IMKitClient.account(), GsonUtils.beanToJSONString(titles)); - } else { - if (type == -1) - DataUtils.set(getActivity(), "wallet_info_s_" + IMKitClient.account(), GsonUtils.beanToJSONString(titles)); - } + if (type == -1) + DataUtils.set(getActivity(), "wallet_info_" + IMKitClient.account(), GsonUtils.beanToJSONString(titles)); + commonAdapter.setDates(titles); } else { commonAdapter.addDates(data.getList()); diff --git a/app/src/main/java/com/hbl/lewan/wallet/WalletInfologFragment.java b/app/src/main/java/com/hbl/lewan/wallet/WalletInfologFragment.java new file mode 100644 index 0000000..21c4095 --- /dev/null +++ b/app/src/main/java/com/hbl/lewan/wallet/WalletInfologFragment.java @@ -0,0 +1,659 @@ +package com.hbl.lewan.wallet; + +import android.graphics.Color; +import android.graphics.drawable.ColorDrawable; +import android.os.Bundle; +import android.text.TextUtils; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.WindowManager; +import android.widget.ImageView; +import android.widget.PopupWindow; +import android.widget.RelativeLayout; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.core.text.HtmlCompat; +import androidx.recyclerview.widget.LinearLayoutManager; + +import com.hbl.lewan.IMApplication; +import com.hbl.lewan.IMUIKitConfig; +import com.hbl.lewan.R; +import com.hbl.lewan.adapter.CommonAdapter; +import com.hbl.lewan.adapter.ViewHolder; +import com.hbl.lewan.custom.CustomDatePickerNew1; +import com.hbl.lewan.databinding.FragmentWalletInfoBinding; +import com.hbl.lewan.databinding.FragmentWalletInfoLogBinding; +import com.hbl.lewan.dialog.SelectTypeDialog; +import com.hbl.lewan.model.BillBean; +import com.hbl.lewan.model.ListBeanResult; +import com.hbl.lewan.model.StatisticsBean; +import com.hbl.lewan.model.TaskBean; +import com.hbl.lewan.model.TypeBean; +import com.hbl.lewan.model.WithdrawCashBean; +import com.hbl.lewan.network.Api; +import com.hbl.lewan.network.BaseObserver; +import com.hbl.lewan.network.Result; +import com.hbl.lewan.utils.AppUtils; +import com.hbl.lewan.utils.DataUtils; +import com.hbl.lewan.utils.GsonUtils; +import com.hbl.lewan.utils.LogUtils; +import com.netease.nimlib.sdk.NIMClient; +import com.netease.nimlib.sdk.team.TeamService; +import com.netease.nimlib.sdk.team.model.Team; +import com.netease.nimlib.sdk.uinfo.UserService; +import com.netease.nimlib.sdk.uinfo.model.NimUserInfo; +import com.netease.yunxin.kit.common.ui.fragments.BaseFragment; +import com.netease.yunxin.kit.common.ui.utils.TimeFormatUtils; +import com.netease.yunxin.kit.common.ui.widgets.datepicker.DateFormatUtils; +import com.netease.yunxin.kit.corekit.im.IMKitClient; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import io.reactivex.android.schedulers.AndroidSchedulers; +import io.reactivex.schedulers.Schedulers; + +//import com.bigkoo.pickerview.builder.TimePickerBuilder; +//import com.bigkoo.pickerview.view.TimePickerView; + +/** + * 主页模块 + * + * @author + */ +public class WalletInfologFragment extends BaseFragment { + + int pageSize = 1; + // private TimePickerView pvTime; + String time = "2022-06"; + int type = -1; + String typeInfo = ""; + CommonAdapter commonAdapter; + private ArrayList titles = new ArrayList<>(); + List taskBeans = null; + int loc = 0; + FragmentWalletInfoLogBinding binding; +// String dataString; + + public static WalletInfologFragment newInstance(int type) { + Bundle bundle = new Bundle(); + bundle.putInt("type1", type); + WalletInfologFragment view = new WalletInfologFragment(); + view.setArguments(bundle); + return view; + } + + + @Nullable + @Override + public View onCreateView( + @NonNull LayoutInflater inflater, + @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { + binding = FragmentWalletInfoLogBinding.inflate(inflater); + return binding.getRoot(); + } + + @Override + public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + initViews(); + } + + + protected void initViews() { + type = getArguments().getInt("type1"); + + Calendar selectedDate = Calendar.getInstance();//系统当前时间 + time = selectedDate.get(Calendar.YEAR) + "-" + ((selectedDate.get(Calendar.MONTH) + 1) < 10 ? "0" + (selectedDate.get(Calendar.MONTH) + 1) : (selectedDate.get(Calendar.MONTH) + 1)); + + + loc = DataUtils.get(IMApplication.getInstance(), "locale", 1); + +// } + + initList(); + initRefreshLayout(); + + time = DataUtils.getCurrentTimeMonth(System.currentTimeMillis()); + + } + + + private void initList() { + LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity()); + binding.recyclerview.setLayoutManager(linearLayoutManager); + commonAdapter = new CommonAdapter(getContext(), R.layout.item_bill_list, titles) { + @Override + public void convert(ViewHolder holder, BillBean s, int index) { + boolean isShowRate; +// holder.setText(R.id.price_tv, AppUtils.getQian(s.getAmount()) + (status == 0 ? getString(R.string.species_txt) : +// getString(R.string.silver_coins_txt))); + TextView textView = holder.getView(R.id.price_tv); + textView.setText(AppUtils.getQian(s.getAmount())); + RelativeLayout layoutroot = holder.getView(R.id.big_bg); + if (s.getAmount() < 0) { + textView.setTextColor(getResources().getColor(R.color.black)); + } else { + textView.setTextColor(getResources().getColor(R.color.black)); + } + if (s.getTransferMoneyRecord() != null && s.getTransferMoneyRecord().getFeeAmount() > 0 && s.getAmount() < 0) { + isShowRate = true; + textView.setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(R.mipmap.ic_transfer_tips), null, null, null); + } else { + isShowRate = false; + textView.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null); + } + TextView statusTv = holder.getView(R.id.status_tv); + statusTv.setVisibility(View.GONE); + if (s.getType() == 5) { + if (s.getWithdrawCashRecord() != null) { + statusTv.setVisibility(View.VISIBLE); + statusTv.setText(getStatusTxt(s.getWithdrawCashRecord())); + } + } + + holder.setText(R.id.balan_tv, getString(R.string.yuee_2f_txt1) + AppUtils.getQian(s.getBalance())); +// holder.setText(R.id.title_tv,getUserInfo(s)+getTypeString(s.getType())); + holder.setText(R.id.title_tv, getTypeNoteString(s)); + + holder.setText(R.id.time_tv, s.getCreateTime()); + if (!TextUtils.isEmpty(s.getCreateTimestamp())) { + holder.setText(R.id.time_tv, TimeFormatUtils.formatMillisecond(getActivity(), Long.parseLong(s.getCreateTimestamp()))); + + } + layoutroot.setOnClickListener(v -> { + //弹窗 + if (isShowRate) { + showPopWindow(textView, s.getTransferMoneyRecord().getFeeAmount(), s.getTransferMoneyRecord().getCoinType()); + } + }); + ((ImageView) holder.getView(R.id.logo_iv)).setImageResource(getTypeRes(s)); + + } + }; + binding.recyclerview.setAdapter(commonAdapter); + } + + private void showPopWindow(TextView itemView, long feeamount, int type) { + View popView = LayoutInflater.from(getContext()).inflate(R.layout.layout_popwindow_feerate, null); + PopupWindow popupWindow = new PopupWindow(popView, + ViewGroup.LayoutParams.WRAP_CONTENT, + ViewGroup.LayoutParams.WRAP_CONTENT, + true); + TextView tvValue = popView.findViewById(R.id.tv_transfer_txt); + ImageView ivTop = popView.findViewById(R.id.iv_poptop); + if (type == 0) { + tvValue.setText(HtmlCompat.fromHtml(String.format(getString(R.string.shouxufeitips_jinbi_txt), feeamount / 100), HtmlCompat.FROM_HTML_MODE_LEGACY)); + } else { + tvValue.setText(HtmlCompat.fromHtml(String.format(getString(R.string.shouxufeitips_yinbi_txt), feeamount / 100), HtmlCompat.FROM_HTML_MODE_LEGACY)); + } + RelativeLayout.LayoutParams paramsiv = (RelativeLayout.LayoutParams) ivTop.getLayoutParams(); + paramsiv.setMargins(0, 0, itemView.getWidth(), 0); + ivTop.setLayoutParams(paramsiv); + // 设置背景来实现阴影效果 + popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); + // 设置阴影的透明度 + WindowManager.LayoutParams layoutParams = getActivity().getWindow().getAttributes(); + layoutParams.alpha = 0.7f; // 设置背景透明度(0.0到1.0,1.0是完全不透明) + getActivity().getWindow().setAttributes(layoutParams); + +// 添加弹窗关闭时恢复透明度的监听器 + popupWindow.setOnDismissListener(() -> { + WindowManager.LayoutParams params = getActivity().getWindow().getAttributes(); + params.alpha = 1.0f; // 恢复为不透明 + getActivity().getWindow().setAttributes(params); + }); + popupWindow.setOutsideTouchable(true); + popupWindow.showAsDropDown(itemView, 0, 0); + + } + + private String getStatusTxt(WithdrawCashBean withdrawCashRecord) { + //0 未处理,1 客服审核通过,2 已打款,3 拒绝 + switch (withdrawCashRecord.getStatus()) { + case 0: + return getString(R.string.weichuli_txt); + case 1: + return getString(R.string.kefushenhetongguo_txt); + case 2: + return getString(R.string.yidakuan_txt); + case 3: + return getString(R.string.yijujue_txt); + default: + return ""; + } + } + + + private String getTypeNoteString(BillBean s) { + //0 群红包,1 私聊红包,2 赠送,3 金币银币互转 + + + if (s.getType() == 1) { + + if (s.getIsTimeout() == 1) { + return getString(R.string.jinbihongbao_tuikuan_txt); + } else { + if (s.getAmount() > 0) { + String name = "红包"; +// RosterElementEntity friendInfo = MyApplication.getInstance2().getIMClientManager().getFriendsListProvider().getFriendInfoByUid2(s.getFromUserId() + ""); + NimUserInfo friendInfo = NIMClient.getService(UserService.class).getUserInfo(s.getFromUserId() + ""); + + // ** 显示头像和昵称 + if (friendInfo != null) { + name = getString(R.string.jinbihongbao_laizi_txt) + friendInfo.getName(); + } else { + name = getString(R.string.jinbihongbao_laizi_txt) + s.getFromUserId(); + } + return name; + } else { + String name = "红包"; +// RosterElementEntity friendInfo = MyApplication.getInstance2().getIMClientManager().getFriendsListProvider().getFriendInfoByUid2(s.getToUserId() + ""); + NimUserInfo friendInfo = NIMClient.getService(UserService.class).getUserInfo(s.getToUserId() + ""); + + // ** 显示头像和昵称 + if (friendInfo != null) { + name = getString(R.string.jinbihongbao_wfg_txt) + friendInfo.getName(); + } else { + name = getString(R.string.jinbihongbao_wfg_txt) + s.getToUserId(); + + } + return name; + } + } + } else if (s.getType() == 2) { + + + if (s.getAmount() > 0) { + if ((s.getFromUserId() + "").equals(IMKitClient.account())) { + return getString(R.string.jinbizhuanzhang_tk_txt); + } + + String name = "赠送"; +// RosterElementEntity friendInfo = MyApplication.getInstance2().getIMClientManager().getFriendsListProvider().getFriendInfoByUid2(s.getFromUserId() + ""); + NimUserInfo friendInfo = NIMClient.getService(UserService.class).getUserInfo(s.getFromUserId() + ""); + + // ** 显示头像和昵称 + if (friendInfo != null) { + name = getString(R.string.jinbizhuanzhang_laizi_txt) + friendInfo.getName(); + } else { + name = getString(R.string.jinbizhuanzhang_laizi_txt) + s.getFromUserId(); + } + return name; + } else { + String name = "赠送"; +// RosterElementEntity friendInfo = MyApplication.getInstance2().getIMClientManager().getFriendsListProvider().getFriendInfoByUid2(s.getToUserId() + ""); + NimUserInfo friendInfo = NIMClient.getService(UserService.class).getUserInfo(s.getToUserId() + ""); + + // ** 显示头像和昵称 + if (friendInfo != null) { + name = getString(R.string.jinbizhuanzhang_wofagei_txt) + friendInfo.getName(); + } else { + name = getString(R.string.jinbizhuanzhang_wofagei_txt) + s.getToUserId(); + + } + return name; + } + + } else if (s.getType() == 0) { + if (s.getIsTimeout() == 1) { + if ((s.getFromUserId() + "").equals(IMKitClient.account())) { + return getString(R.string.jinbiqunhongbao_tuikuan_txt); + } + return getString(R.string.jinbiqunhongbao_txt); + } else { + if (!TextUtils.isEmpty(s.getToGroupId())) { + String name = getString(R.string.jinbiqunhongbao_txt); +// GroupEntity groupEntity = MyApplication.getInstance2().getIMClientManager().getGroupsProvider().getGroupInfoByGid(s.getToGroupId()); + Team groupEntity = NIMClient.getService(TeamService.class).queryTeamBlock(s.getToGroupId() + ""); + + if (groupEntity != null) { + name = getString(R.string.jinbiqunhongbao_wfg_txt) + groupEntity.getName(); + } + return name; + } else { + String name = "群红包"; +// RosterElementEntity friendInfo = MyApplication.getInstance2().getIMClientManager().getFriendsListProvider().getFriendInfoByUid2(s.getFromUserId() + ""); + NimUserInfo friendInfo = NIMClient.getService(UserService.class).getUserInfo(s.getFromUserId() + ""); + + if (friendInfo != null) { + name = getString(R.string.jinbiqunhb_laizi_txt) + friendInfo.getName(); + } else { + name = getString(R.string.jinbiqunhb_laizi_txt) + s.getFromUserNickname(); + } + return name; + } + } + } else if (s.getType() == 3) { + return s.getAmount() < 0 ? getString(R.string.g_to_s_txt) : getString(R.string.s_to_g_txt); + } else if (s.getType() == 4) { + return getString(R.string.jinbichongzhi_f_bank_txt); + } else if (s.getType() == 21) { + return getString(R.string.jinbichongzhi_f_bank_txt1); + } else if (s.getType() == 22) { + return s.getCoinModifyRemark() + ""; + } else if (s.getType() == 5) { + return getString(R.string.jinbitixian_txt); + } else if (s.getType() == 8) { + if (s.getOauthApp() != null) { + return s.getOauthApp().getAppName() + getString(R.string.zhuanchu_txt); + } else { + return getString(R.string.fffcz_txt); + } + } else if (s.getType() == 9) { + if (s.getOauthApp() != null) { + return s.getOauthApp().getAppName() + getString(R.string.zhuanru_txt); + } else { + return getString(R.string.ffftx_txt); + } + } else if (s.getType() == 7) { + if (s.getOauthApp() != null) { + return getString(R.string.laxinsjf_txt); + } else { + return getString(R.string.fffcz_txt); + } + } else if (s.getType() == 10) { + return getString(R.string.wawaji_txt); + } else if (s.getType() == 12) { + return getString(R.string.guanliyuanxiugai_txt); + } else if (s.getType() == 13) { + return getString(R.string.niuniuxiazhudongjie_txt); + } else if (s.getType() == 14) { + return getString(R.string.niuniujiesuan_txt); + } else if (s.getType() == 15) { + return getString(R.string.niuniulingbaofei_txt); + } else if (s.getType() == 16) { + if (s.getAmount() > 0) { + return getString(R.string.erweimashouklaizi_txt1) + s.getFromUserNickname(); + } else { + NimUserInfo nimUserInfo = NIMClient.getService(UserService.class).getUserInfo(s.getToUserId() + ""); + if (nimUserInfo != null) { + return getString(R.string.saomafukuan_txt2) + nimUserInfo.getName(); + } else { + return getString(R.string.saomafukuan_txt1); + } + } + } else if (s.getType() == 18) { + return getString(R.string.erweimashouklaizi_txt1) + s.getFromUserNickname(); + } else if (s.getType() == 19) { + return getString(R.string.saomaduibi_txt); + } else if (s.getType() == 20) { + return getString(R.string.jinbiduihuanlebi_txt); + } else if (s.getType() == 17) { + NimUserInfo nimUserInfo = NIMClient.getService(UserService.class).getUserInfo(s.getToUserId() + ""); + if (nimUserInfo != null) { + return getString(R.string.saomafukuan_txt2) + nimUserInfo.getName(); + } else { + return getString(R.string.saomafukuan_txt1); + } + } else if (s.getType() == 11) { + if (s.getAmount() > 0) { + return "Dream Game " + getString(R.string.zhuanru_txt); + } else { + return "Dream Game " + getString(R.string.zhuanchu_txt); + + } + } else if (s.getType() == 27) { + return getString(R.string.danzhujiduizhu_txt); + } else if (s.getType() == 23 || s.getType() == 24) { + return s.getCoinModifyRemark() + ""; + } else { + return TextUtils.isEmpty(s.getCoinModifyRemark()) ? getString(R.string.weizhi_txt) : s.getCoinModifyRemark() + ""; + } + + } + + private int getTypeRes(BillBean bean) { + int type = bean.getType(); + switch (type) { + case 0: + return R.mipmap.bill_hongbao_img; + case 1: + return R.mipmap.bill_hongbao_img; + case 2: + return R.mipmap.bill_zhuanzhang_img; + case 3: + return R.mipmap.bill_zhuanhan_img; + case 4: + return R.mipmap.bill_chongzhi_img; + case 21: + return R.mipmap.bill_chongzhi_img1; + case 22: + case 23: + return R.mipmap.bill_chongzhi_img; + case 24: + return R.mipmap.bill_chongzhi_img; + case 5: + return R.mipmap.bill_tixian_img; + case 6: + return R.mipmap.default_head_img; + case 7: + return R.mipmap.default_head_img; + case 8: + return R.mipmap.bill_chongzhi_img; + case 9: + return R.mipmap.bill_tixian_img; + case 10: + return R.mipmap.wawaji_img; + case 20: + return R.mipmap.wawaji_img; + case 12: + return R.mipmap.guanli_xiugai_img; + case 11: + return R.mipmap.bill_tixian_img; + case 13: + return R.mipmap.niuniu_jilu_img; + case 14: + return R.mipmap.niuniu_jilu_img; + case 15: + return R.mipmap.niuniu_jilu_img; + case 16: + if (bean.getAmount() > 0) { + return R.mipmap.erweishoukuan_bill_img; + } else { + return R.mipmap.erweifukuan_bill_img; + } + case 17: + return R.mipmap.erweifukuan_bill_img; + case 18: + return R.mipmap.erweishoukuan_bill_img; + case 19: + return R.mipmap.saomaduibi_img; + case 27: + return R.mipmap.type_g_27; + case 29: + return R.mipmap.type_g_27; + case 28: + return R.mipmap.erweifukuan_bill_img; + case 30: + return R.mipmap.type_s_24; + default: + return R.mipmap.guanli_xiugai_img; + } + } + + private void initRefreshLayout() { + binding.refreshLayout.setOnRefreshListener(refreshlayout -> { + pageSize = 1; + binding.refreshLayout.setVisibility(View.VISIBLE); + binding.nodateLy.setVisibility(View.GONE); + binding.refreshLayout.setEnableLoadMore(true); + getDateList(); + + }); + binding.refreshLayout.setOnLoadMoreListener(refreshLayout -> { + pageSize += 1; + getDateList(); + + }); + } + + @Override + public void onResume() { + super.onResume(); + String name = DataUtils.get(getActivity(), "wallet_info_" + IMKitClient.account(), ""); + if (TextUtils.isEmpty(name)) { + binding.refreshLayout.autoRefresh(); + } else { + titles = (ArrayList) GsonUtils.getListFromJSON(name, BillBean.class); + if (titles != null && titles.size() > 0) { + commonAdapter.setDates(titles); + getDateList(); + } else { + binding.refreshLayout.autoRefresh(); + } + } + } + + private void getDateList() { + + Map map = new HashMap<>(); + if (type == -1) { + if (TextUtils.isEmpty(typeInfo)) { + map.put("page", pageSize); + } else { + String statTime = time + "-01 00:00:01"; + String endTime = time + "-" + getMonth(time) + " 23:59:59"; + map.put("page", pageSize); + map.put("timeGe", statTime); + map.put("timeLe", endTime); + } + } else { + if (TextUtils.isEmpty(typeInfo)) { + map.put("page", pageSize); + map.put("type", type); + + } else { + String statTime = time + "-01 00:00:01"; + String endTime = time + "-" + getMonth(time) + " 23:59:59"; + + map.put("page", pageSize); + map.put("timeGe", statTime); + map.put("timeLe", endTime); + map.put("type", type); + } + } + if (!TextUtils.isEmpty(IMUIKitConfig.SUBSTATIONID)) { + map.put("substationId", IMUIKitConfig.SUBSTATIONID); + } + Api.getInstance().goldDetails(IMKitClient.account(), map) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new BaseObserver>>() { + @Override + public void onSuccess(Result> feedbackResp) { + changeDate(feedbackResp.data); + } + + @Override + public void onError(int code, String msg) { + LogUtils.i("获取到的错误:" + code + "" + msg); + binding.refreshLayout.finishRefresh(); + binding.refreshLayout.finishLoadMore(); + changeView(false); + } + }); + + if (!TextUtils.isEmpty(IMUIKitConfig.SUBSTATIONID)) { + map.put("substationId", IMUIKitConfig.SUBSTATIONID); + } + Api.getInstance().silverDetails(IMKitClient.account(), map) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new BaseObserver>>() { + @Override + public void onSuccess(Result> feedbackResp) { + changeDate(feedbackResp.data); + } + + @Override + public void onError(int code, String msg) { + LogUtils.i("获取到的错误:" + code + "" + msg); + binding.refreshLayout.finishRefresh(); + binding.refreshLayout.finishLoadMore(); + changeView(false); + } + }); + + + } + + + private String getMonth(String time) { + if (time.endsWith("01") || time.endsWith("03") || time.endsWith("05") || time.endsWith("07") || time.endsWith("08") || time.endsWith("10") || time.endsWith("12")) { + return "31"; + } else if (time.endsWith("02")) { + Calendar selectedDate = Calendar.getInstance();//系统当前时间 + int year = selectedDate.get(Calendar.YEAR); + if (year % 400 == 0) {// 判断能否被400整除 + return "29"; + } else if (year % 100 == 0) {// 判断能否被100整除 + return "28"; + } else if (year % 4 == 0) {// 判断能否被4整除 + return "29"; + } else { + return "28"; + } + + } else { + return "30"; + } + } + + + private void changeDate(ListBeanResult data) { + if (data.getList() != null) { + if (pageSize == 1) { + titles = (ArrayList) data.getList(); + + if (type == -1) + DataUtils.set(getActivity(), "wallet_info_" + IMKitClient.account(), GsonUtils.beanToJSONString(titles)); + + commonAdapter.setDates(titles); + } else { + commonAdapter.addDates(data.getList()); + titles = (ArrayList) commonAdapter.getDates(); + } + + } + binding.refreshLayout.finishRefresh(); + binding.refreshLayout.finishLoadMore(); + if (titles.size() == data.getTotal()) { + binding.refreshLayout.finishLoadMoreWithNoMoreData(); + } + changeView(true); + } + + private void changeView(boolean isNodate) { + if (titles == null || (titles.size() == 0)) { + binding.nodateLy.setVisibility(View.VISIBLE); + binding.refreshLayout.setVisibility(View.GONE); + if (isNodate) { + binding.nodateTv.setText(getString(R.string.nodate_txt)); + binding.nodateIv.setImageResource(R.mipmap.pyq_nodate); + } else { + binding.nodateTv.setText(getString(R.string.net_error_txt)); + binding.nodateIv.setImageResource(R.mipmap.pyq_nodate); + + } + + } else { + binding.refreshLayout.setVisibility(View.VISIBLE); + binding.nodateLy.setVisibility(View.GONE); + } + binding.nodateLy.setOnClickListener(view -> { + binding.refreshLayout.autoRefresh(); + }); + } + +} diff --git a/app/src/main/res/drawable/input_bg_t.xml b/app/src/main/res/drawable/input_bg_t.xml index e50ab5a..d2db035 100644 --- a/app/src/main/res/drawable/input_bg_t.xml +++ b/app/src/main/res/drawable/input_bg_t.xml @@ -17,8 +17,8 @@ android:type="linear" android:useLevel="true" /> + android:width="1px" + android:color="#1e000000" /> diff --git a/app/src/main/res/drawable/radio_button.xml b/app/src/main/res/drawable/radio_button.xml new file mode 100644 index 0000000..f831d45 --- /dev/null +++ b/app/src/main/res/drawable/radio_button.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/app/src/main/res/layout/activity_chongzhi_log.xml b/app/src/main/res/layout/activity_chongzhi_log.xml new file mode 100644 index 0000000..6cda918 --- /dev/null +++ b/app/src/main/res/layout/activity_chongzhi_log.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_mywallet.xml b/app/src/main/res/layout/activity_mywallet.xml index f592012..f688035 100644 --- a/app/src/main/res/layout/activity_mywallet.xml +++ b/app/src/main/res/layout/activity_mywallet.xml @@ -25,7 +25,7 @@ app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" - app:titleText="@string/wallet_txt" + app:titleText="我的钱包" app:titleTextColor="@android:color/black" /> + + + +