From e5ca87e89fef96c827ec37d1d91082f626cbb17d Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 11 五月 2021 18:50:09 +0800 Subject: [PATCH] 特价新版UI改造 --- app/src/main/java/com/tejia/lijin/app/ui/mine/MyInfoActivity.java | 225 +++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 175 insertions(+), 50 deletions(-) diff --git a/app/src/main/java/com/tejia/lijin/app/ui/mine/MyInfoActivity.java b/app/src/main/java/com/tejia/lijin/app/ui/mine/MyInfoActivity.java index c77a5b5..330917b 100644 --- a/app/src/main/java/com/tejia/lijin/app/ui/mine/MyInfoActivity.java +++ b/app/src/main/java/com/tejia/lijin/app/ui/mine/MyInfoActivity.java @@ -5,8 +5,10 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; + import androidx.databinding.BindingAdapter; import androidx.databinding.DataBindingUtil; + import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.net.Uri; @@ -14,7 +16,9 @@ import android.os.Bundle; import android.os.Environment; import android.provider.MediaStore; + import androidx.annotation.NonNull; + import android.util.Log; import android.view.Gravity; import android.view.View; @@ -31,6 +35,10 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; +import com.tejia.lijin.app.entity.common.GoodsConvertLinkJumpLink; +import com.tejia.lijin.app.ui.dialog.ShapeLoadingDialog; +import com.tejia.lijin.app.util.GoodsBuyJumpUtil; +import com.tejia.lijin.app.util.user.UserUtil; import com.tencent.mm.opensdk.modelmsg.SendAuth; import com.wpc.library.util.common.DimenUtils; import com.wpc.library.util.common.StringUtils; @@ -78,6 +86,12 @@ private String fansCountLink; + //鎷煎澶氭槸鍚﹀妗� + private Boolean pddBuyBind; + private Boolean pddShareBind; + + protected ShapeLoadingDialog loading = null; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -89,7 +103,6 @@ // tv_middle.setText("鎴戠殑淇℃伅"); binding.includeTopBar.tvTopBarLeft.setOnClickListener(this); binding.llInfoSex.setOnClickListener(this); - binding.llInfoWchatNum.setOnClickListener(this); binding.llInfoPortrait.setOnClickListener(this); binding.llInfoNickname.setOnClickListener(this); binding.llInfoRelativeQq.setOnClickListener(this); @@ -97,8 +110,11 @@ binding.llInfoRelativeWechat.setOnClickListener(this); binding.llInfoRelativeMobile.setOnClickListener(this); binding.llInfoInviteCode.setOnClickListener(this); - binding.llInfoVip.setOnClickListener(this); binding.llInfoFans.setOnClickListener(this); + binding.llInfoPddBuy.setOnClickListener(this); + binding.llInfoPddShare.setOnClickListener(this); + + binding.tvInfoUid.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { @@ -110,9 +126,9 @@ return false; } }); - binding.llVipAction.setOnClickListener(this); mPermissionsChecker = new PermissionHelper(this, this);//鏉冮檺 + loading = new ShapeLoadingDialog.Builder(this).build(); } @Override @@ -127,12 +143,13 @@ @Override public void onClick(View view) { + Boolean buy = null; switch (view.getId()) { case R.id.tv_top_bar_left: finish(); break; - case R.id.ll_info_relative_wechat: - if(info==null) + case R.id.ll_info_relative_wechat: { + if (info == null) return; String title = "鏇存崲寰俊甯愬彿"; String message = "纭畾鏇存崲寰俊璐﹀彿"; @@ -167,6 +184,46 @@ } }).create().show(); break; + } + + case R.id.ll_info_relative_qq: { + if (info == null) + return; + String title = "鏇存崲QQ甯愬彿"; + String message = "纭畾鏇存崲QQ甯愬彿"; + String positive = "鏇存崲"; + if (StringUtils.isEmpty(info.getQqOpenId())) {//QQ + title = "缁戝畾QQ甯愬彿"; + message = "纭畾缁戝畾QQ璐﹀彿"; + positive = "缁戝畾"; + } + + if (StringUtils.isEmpty(phoneNum)) { + title = "鏇存崲鎻愰啋"; + message = "璇ュ笎鍙锋病鏈夌粦瀹氭墜鏈哄彿锛岄渶缁戝畾鎵嬫満鍙锋墠鑳藉畬鎴怮Q鏇存崲銆�"; + positive = "缁戝畾鎵嬫満鍙�"; + } + AddZFBInfoDialog2.Builder builder1 = new AddZFBInfoDialog2.Builder(MyInfoActivity.this); + builder1.setTitle(title).setMessage(message) + .setPositiveButton(positive, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + dialog.dismiss(); + if (StringUtils.isEmpty(phoneNum)) { + bindMobile(); + } else { + bindQQ(); + } + } + }).setNegativeButton("涓嶄簡", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + dialog.dismiss(); + } + }).create().show(); + break; + } + case R.id.ll_info_tbaccount: String title1 = "鏇存崲娣樺疂璐﹀彿"; String message1 = "纭畾鏇存崲娣樺疂璐﹀彿"; @@ -176,13 +233,23 @@ message1 = "纭畾缁戝畾娣樺疂璐﹀彿"; positive1 = "缁戝畾"; } + + if (info != null && StringUtils.isEmpty(phoneNum)) { + title1 = "鏇存崲鎻愰啋"; + positive1 = "缁戝畾鎵嬫満鍙�"; + message1 = "璇ュ笎鍙锋病鏈夌粦瀹氭墜鏈哄彿锛岄渶缁戝畾鎵嬫満鍙锋墠鑳藉畬鎴愭窐瀹濇洿鎹€��"; + } AddZFBInfoDialog2.Builder builder2 = new AddZFBInfoDialog2.Builder(MyInfoActivity.this); builder2.setTitle(title1).setMessage(message1) .setPositiveButton(positive1, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); + if (StringUtils.isEmpty(phoneNum)) { + bindMobile(); + } else { bindTB(); + } } }).setNegativeButton("涓嶄簡", new DialogInterface.OnClickListener() { @Override @@ -207,17 +274,9 @@ case R.id.ll_info_sex://璁剧疆鎬у埆 popwindow_sex();//閫夋嫨鐩稿唽 break; - case R.id.ll_info_wchat_num://璁剧疆寰俊鍙� - startActivity(new Intent(this, MyWXNumActivity.class) - .putExtra("weixin", StringUtils.isEmpty(weixin) ? "" : weixin) - .putExtra("weixintip", weixintip).putExtra("erCode", info.getErCode())); - break; - case R.id.ll_info_vip://瓒呯骇浼氬憳淇℃伅 - Intent intent = new Intent(this, ShareBrowserActivity.class); - intent.putExtra("url", vipLink); - startActivity(intent); - break; case R.id.ll_info_invite_code://閭�璇风爜 + if (info == null) + return; if (invitCodeUpdated || StringUtils.isEmpty(inviteCode) || !info.isVip()) return; Intent intent2 = new Intent(this, MyInviteCodeActivity.class); @@ -227,9 +286,45 @@ case R.id.ll_info_fans: startActivity(new Intent(this, ShareBrowserActivity.class).putExtra("url", fansCountLink)); break; - case R.id.ll_vip_action: - if (vipAction != null) - JumpActivityUtil.jumpPage(this, vipAction.getJumpDetail(), vipAction.getParams()); + + case R.id.ll_info_pdd_buy: + buy = true; + case R.id.ll_info_pdd_share: + if (buy == null) + buy = false; + ShoppingApi.getPDDAuthInfo(getApplicationContext(), UserUtil.getUid(getApplicationContext()) + "", buy, new BasicTextHttpResponseHandler() { + @Override + public void onStart() { + super.onStart(); + if (loading != null && !loading.isShowing()) + loading.show(); + } + + @Override + public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { + super.onSuccessPerfect(statusCode, headers, jsonObject); + if (jsonObject.optInt("code") == 0) { + JSONObject data = jsonObject.optJSONObject("data"); + GoodsConvertLinkJumpLink pddJumpLink = new Gson().fromJson(data.toString(), GoodsConvertLinkJumpLink.class); + GoodsBuyJumpUtil.jumpPDD(getApplicationContext(), pddJumpLink); + } else { + Toast.makeText(MyInfoActivity.this, jsonObject.optString("msg"), Toast.LENGTH_SHORT).show(); + } + } + + @Override + public void onFailure(int statusCode, Header[] headers, String jsonObject, Throwable e) { + super.onFailure(statusCode, headers, jsonObject, e); + } + + @Override + public void onFinish() { + super.onFinish(); + if (loading != null && loading.isShowing()) + loading.dismiss(); + } + }); + break; } } @@ -452,6 +547,24 @@ } } + + private void bindQQ() { + if (ShoppingApplication.application.mWxApi.isWXAppInstalled()) { + SharedPreferences sp = getSharedPreferences("user", MODE_PRIVATE); + SharedPreferences.Editor editor = sp.edit(); + editor.putBoolean("closeHint", false); + editor.putBoolean("bindqq", true); + editor.commit(); + SendAuth.Req req = new SendAuth.Req(); + req.scope = "snsapi_userinfo"; + req.state = "rebate"; + ShoppingApplication.application.mWxApi.sendReq(req); + } else { +// SingleToast.showToast(MyInfoActivity.this, "璇峰厛瀹夎寰俊瀹㈡埛绔�"); + Toast.makeText(MyInfoActivity.this, "璇峰厛瀹夎QQ瀹㈡埛绔�", Toast.LENGTH_SHORT).show(); + } + } + /* 缁戝畾娣樺疂鎺堟潈 */ @@ -539,6 +652,8 @@ if (data.optJSONObject("vipAction") != null) { vipAction = new Gson().fromJson(data.optJSONObject("vipAction").toString(), VIPActionInfo.class); } + pddBuyBind = data.optBoolean("pddBuyBind"); + pddShareBind = data.optBoolean("pddShareBind"); String json = data.optJSONObject("user").toString(); @@ -572,6 +687,13 @@ } else { binding.tvInfoRelativeWechat.setText(info.getWxName()); } + + if (StringUtils.isEmpty(info.getQqOpenId())) {//QQ + binding.tvInfoRelativeQq.setText("鍘荤粦瀹�"); + } else { + binding.tvInfoRelativeQq.setText(info.getQqNickName()); + } + if (StringUtils.isEmpty(info.getOpenid())) {//娣樺疂 binding.tvInfoTbaccount.setText("鍘荤粦瀹�"); } else { @@ -583,33 +705,45 @@ binding.tvInfoRelativeMobile.setText(info.getPhone()); } - //淇℃伅璁剧疆 -// if (info.isVip()) { - binding.tvInfoVip.setVisibility(View.GONE); -// } else { -// binding.tvInfoVip.setVisibility(View.VISIBLE); -// } - - //閭�璇风爜璁剧疆 - if (StringUtils.isEmpty(inviteCode) || !info.isVip()) - binding.llInfoInviteCode.setVisibility(View.GONE); - else { - binding.llInfoInviteCode.setVisibility(View.VISIBLE); - binding.tvInfoInviteCode.setText(inviteCode); - if (invitCodeUpdated || !info.isVip()) { - binding.ivInfoInviteCodeEdit.setVisibility(View.GONE); - ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) binding.tvInfoInviteCode.getLayoutParams(); - params.setMargins(0, 0, DimenUtils.dip2px(this, 20), 0); - binding.tvInfoInviteCode.requestLayout(); + if (pddBuyBind != null) { + if (pddBuyBind) { + binding.tvInfoPddBuy.setText("鍘绘洿鏀�"); } else { - binding.ivInfoInviteCodeEdit.setVisibility(View.VISIBLE); - ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) binding.tvInfoInviteCode.getLayoutParams(); - params.setMargins(0, 0, DimenUtils.dip2px(this, 10), 0); - binding.tvInfoInviteCode.requestLayout(); + binding.tvInfoPddBuy.setText("鍘诲妗�"); } + } else { + binding.tvInfoPddBuy.setText(""); } - binding.llInfoInviteCode.setVisibility(View.GONE); + if (pddShareBind != null) { + if (pddShareBind) { + binding.tvInfoPddShare.setText("鍘绘洿鏀�"); + } else { + binding.tvInfoPddShare.setText("鍘诲妗�"); + } + } else { + binding.tvInfoPddShare.setText(""); + } + + + //閭�璇风爜璁剧疆 +// if (StringUtils.isEmpty(inviteCode) || !info.isVip()) +// binding.llInfoInviteCode.setVisibility(View.GONE); +// else { +// binding.llInfoInviteCode.setVisibility(View.VISIBLE); +// binding.tvInfoInviteCode.setText(inviteCode); +// if (invitCodeUpdated || !info.isVip()) { +// binding.ivInfoInviteCodeEdit.setVisibility(View.GONE); +// ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) binding.tvInfoInviteCode.getLayoutParams(); +// params.setMargins(0, 0, DimenUtils.dip2px(this, 20), 0); +// binding.tvInfoInviteCode.requestLayout(); +// } else { +// binding.ivInfoInviteCodeEdit.setVisibility(View.VISIBLE); +// ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) binding.tvInfoInviteCode.getLayoutParams(); +// params.setMargins(0, 0, DimenUtils.dip2px(this, 10), 0); +// binding.tvInfoInviteCode.requestLayout(); +// } +// } //鏄惁鏄剧ず閭�璇蜂汉 // if (StringUtils.isEmpty(fansCountLink)) { @@ -619,15 +753,6 @@ // binding.ivInfoFansEdit.setVisibility(View.VISIBLE); // } - //璁剧疆浼氬憳鍔ㄤ綔 - if (vipAction != null) { - binding.llVipAction.setVisibility(View.VISIBLE); - binding.tvVipActionName.setText(vipAction.getName()); - if (vipAction.getContent() != null) - binding.tvVipActionContent.setText(vipAction.getContent()); - } else { - binding.llVipAction.setVisibility(View.GONE); - } } -- Gitblit v1.8.0