| | |
| | | import android.graphics.Color; |
| | | import android.os.Build; |
| | | import android.os.Bundle; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.viewpager.widget.PagerAdapter; |
| | | import androidx.viewpager.widget.ViewPager; |
| | | import androidx.appcompat.widget.LinearLayoutCompat; |
| | | |
| | | import android.text.Spannable; |
| | | import android.text.SpannableString; |
| | | import android.text.Spanned; |
| | |
| | | import com.nostra13.universalimageloader.core.ImageLoader; |
| | | import com.nostra13.universalimageloader.core.assist.ImageScaleType; |
| | | import com.nostra13.universalimageloader.core.display.CircleBitmapDisplayer; |
| | | import com.tejia.lijin.app.ShoppingApplication; |
| | | import com.tejia.lijin.app.ui.message.UserMessageActivity; |
| | | import com.tejia.lijin.app.ui.recommend.GoodsDetailActivity; |
| | | import com.tejia.lijin.app.ui.sellwellcommodity.SellWellGoods; |
| | | import com.tejia.lijin.app.util.ui.HomeUIUtil; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.viewpagerindicator.CirclePageIndicator; |
| | | import com.wpc.library.RetainViewFragment; |
| | |
| | | import com.tejia.lijin.app.ui.mine.SettingActivity; |
| | | import com.tejia.lijin.app.ui.mine.ShareHistoryActivity31; |
| | | import com.tejia.lijin.app.ui.mine.WelfareCenterActivity; |
| | | import com.tejia.lijin.app.ui.recommend.GoodsDetailActivityJD; |
| | | import com.tejia.lijin.app.ui.recommend.GoodsDetailActivityPDD; |
| | | import com.tejia.lijin.app.ui.recommend.GoodsDetailActivityTB; |
| | | import com.tejia.lijin.app.ui.recommend.RecommendTopAdapter2; |
| | | import com.tejia.lijin.app.updateApp.UpdateApp; |
| | | import com.tejia.lijin.app.util.JumpActivityUtil; |
| | |
| | | */ |
| | | |
| | | public class MineFragment extends RetainViewFragment implements View.OnClickListener, PermissionInterface { |
| | | private TextView tv_user_num, |
| | | tv_share_reward_hint, tv_fanli_reward_hint; |
| | | private ImageView iv_portrait; |
| | | private TextView tv_nickName, tv_mine_login; |
| | | private TextView tv_user_num; |
| | | private ImageView iv_portrait, iv_rank; |
| | | private TextView tv_nickName; |
| | | |
| | | //用户昵称与邀请码 |
| | | private LinearLayout ll_nick_name_vip; |
| | | |
| | | private TextView tv_balance; |
| | | private FrameLayout fl_reward_today, fl_reward_yestoday, fl_reward_current_month, fl_reward_last_month; |
| | | private ImageView fl_reward_today_ic, fl_reward_yestoday_ic, fl_reward_current_month_ic, fl_reward_last_month_ic; |
| | | private TextView tv_reward_today, tv_reward_yestoday, tv_reward_current_month, tv_reward_last_month; |
| | | private TextView tv_share_estimate_reward, tv_fanli_reward; |
| | | |
| | | private LinearLayout ll_count; |
| | | private RelativeLayout ll_title_face; |
| | | private LinearLayout ll_title; |
| | | private ScListerScrollView sv_mine; |
| | | private DisplayImageOptions options; |
| | | |
| | | private LinearLayoutCompat tv_user_numlayout;//开启通知 |
| | |
| | | private CirclePageIndicator indicator_category; |
| | | private ImageView vp_close; |
| | | |
| | | //会员升级提醒 |
| | | private ImageView iv_icon; |
| | | private TextView tv_vip_upgrade_content, tv_vip_upgrade; |
| | | LinearLayout ll_top; |
| | | View view_mine_end_bg; |
| | | |
| | | FrameLayout fl_msg; |
| | | TextView tv_msg_count; |
| | | |
| | | //专属邀请码申请 |
| | | private LinearLayout ll_special_invitecode_apply; |
| | | |
| | | //云发单 |
| | | private LinearLayout ll_send_order; |
| | | |
| | | String tag1 = "help/getAppPageNotification"; |
| | | String tag2 = "integral/getTaskList"; |
| | |
| | | @Override |
| | | public void onCreateView(View contentView, Bundle savedInstanceState) { |
| | | mineFunctionsManager = new MineFunctionsManager(getContext()); |
| | | String inviteCode = UserUtil.getInviteCode(getContext(), null); |
| | | String inviteCode = UserUtil.getInviteCode(getContext()); |
| | | init(contentView); |
| | | listener(contentView); |
| | | app = new UpdateApp(getActivity(), getResources().getString(R.string.update_key)); |
| | | mPermissionsChecker = new PermissionHelper(getActivity(), this); |
| | | // startActivity(new Intent(getContext(),ShareBrowserActivity.class).putExtra("url","http://192.168.3.16:52330/index.html")); |
| | | } |
| | | |
| | | private void init(View contentView) { |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { |
| | | Window window = getActivity().getWindow(); |
| | | window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); |
| | | window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
| | | | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); |
| | | window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); |
| | | window.setStatusBarColor(Color.TRANSPARENT); |
| | | //设置状态栏文字颜色及图标为深色 |
| | | // getActivity().getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); |
| | | } |
| | | //设置状态栏文字颜色及图标为深色 |
| | | getActivity().getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); |
| | | this.options = new DisplayImageOptions.Builder() |
| | | .showImageForEmptyUri(R.drawable.ic_default_portrait) |
| | | .showImageOnFail(R.drawable.ic_default_portrait) |
| | | .showImageOnLoading(R.drawable.ic_default_portrait) |
| | | .showImageForEmptyUri(R.drawable.ic_mine_default_portrait) |
| | | .showImageOnFail(R.drawable.ic_mine_default_portrait) |
| | | .showImageOnLoading(R.drawable.ic_mine_default_portrait) |
| | | .resetViewBeforeLoading(true) |
| | | .cacheInMemory(true) |
| | | .cacheOnDisk(true) |
| | |
| | | .considerExifParams(true) |
| | | .displayer(new CircleBitmapDisplayer(300)) |
| | | .build(); |
| | | |
| | | iv_rank = contentView.findViewById(R.id.iv_rank); |
| | | fl_msg = contentView.findViewById(R.id.fl_msg); |
| | | tv_msg_count = contentView.findViewById(R.id.tv_msg_count); |
| | | |
| | | |
| | | tv_user_num = contentView.findViewById(R.id.tv_user_num); |
| | | iv_portrait = contentView.findViewById(R.id.iv_portrait); |
| | | tv_nickName = contentView.findViewById(R.id.tv_nickname); |
| | | tv_mine_login = contentView.findViewById(R.id.tv_mine_login); |
| | | |
| | | ll_count = contentView.findViewById(R.id.ll_count); |
| | | tv_balance = contentView.findViewById(R.id.tv_balance); |
| | | ll_title_face = contentView.findViewById(R.id.ll_title_face); |
| | | ll_title = contentView.findViewById(R.id.ll_title); |
| | | ll_title_face.setVisibility(View.INVISIBLE); |
| | | ll_title.setVisibility(View.VISIBLE); |
| | | sv_mine = contentView.findViewById(R.id.sv_mine); |
| | | tv_notice_content = contentView.findViewById(R.id.tv_notice_content); |
| | | ll_notice = contentView.findViewById(R.id.ll_notice); |
| | | iv_close = contentView.findViewById(R.id.iv_close); |
| | | fl_reward_today = contentView.findViewById(R.id.fl_reward_today); |
| | | fl_reward_yestoday = contentView.findViewById(R.id.fl_reward_yestoday); |
| | | fl_reward_current_month = contentView.findViewById(R.id.fl_reward_current_month); |
| | | fl_reward_last_month = contentView.findViewById(R.id.fl_reward_last_month); |
| | | fl_reward_today_ic = contentView.findViewById(R.id.fl_reward_today_ic); |
| | | fl_reward_yestoday_ic = contentView.findViewById(R.id.fl_reward_yestoday_ic); |
| | | fl_reward_current_month_ic = contentView.findViewById(R.id.fl_reward_current_month_ic); |
| | | fl_reward_last_month_ic = contentView.findViewById(R.id.fl_reward_last_month_ic); |
| | | tv_reward_today = contentView.findViewById(R.id.tv_reward_today); |
| | | tv_reward_yestoday = contentView.findViewById(R.id.tv_reward_yestoday); |
| | | tv_reward_current_month = contentView.findViewById(R.id.tv_reward_current_month); |
| | | tv_reward_last_month = contentView.findViewById(R.id.tv_reward_last_month); |
| | | tv_share_estimate_reward = contentView.findViewById(R.id.tv_share_estimate_reward); |
| | | ll_top = contentView.findViewById(R.id.ll_top); |
| | | view_mine_end_bg = contentView.findViewById(R.id.view_mine_end_bg); |
| | | |
| | | |
| | | tv_fanli_reward = contentView.findViewById(R.id.tv_fanli_reward); |
| | | |
| | | tv_share_reward_hint = contentView.findViewById(R.id.tv_share_reward_hint); |
| | | tv_fanli_reward_hint = contentView.findViewById(R.id.tv_fanli_reward_hint); |
| | | ll_top.setBackground(HomeUIUtil.getHomeTopBg(getContext())); |
| | | view_mine_end_bg.setBackground(HomeUIUtil.getHomeTopBg(getContext())); |
| | | |
| | | |
| | | tv_user_numlayout = contentView.findViewById(R.id.tv_user_numlayout); |
| | |
| | | vp_close = contentView.findViewById(R.id.vp_close); |
| | | ll_nick_name_vip = contentView.findViewById(R.id.ll_nick_name_vip); |
| | | |
| | | iv_icon = contentView.findViewById(R.id.iv_icon); |
| | | tv_vip_upgrade_content = contentView.findViewById(R.id.tv_vip_upgrade_content); |
| | | tv_vip_upgrade = contentView.findViewById(R.id.tv_vip_upgrade); |
| | | |
| | | |
| | | ll_special_invitecode_apply = contentView.findViewById(R.id.ll_special_invitecode_apply); |
| | | |
| | | ll_send_order = contentView.findViewById(R.id.ll_send_order); |
| | | |
| | | getAppPageNotification(); |
| | | |
| | |
| | | |
| | | private List<Functions> getFunctions() { |
| | | List<Functions> list = new ArrayList<>(); |
| | | list.add(new Functions("礼金红包", R.drawable.icon_mine_hb, "jumpLijinHB")); |
| | | list.add(new Functions("订单", R.drawable.icon_mine_order, "jumpOrder")); |
| | | list.add(new Functions("找回订单", R.drawable.icon_mine_find_order, "jumpFindOrder")); |
| | | list.add(new Functions("收藏", R.drawable.icon_mine_collect, "jumpCollect")); |
| | | list.add(new Functions("足迹", R.drawable.icon_mine_footmark, "jumpFootMark")); |
| | | list.add(new Functions("转链", R.drawable.icon_mine_convert_link, "jumpConvertLink")); |
| | | list.add(new Functions("规范", R.drawable.icon_mine_rule, "jumpPlatformRule")); |
| | | list.add(new Functions("帮助中心", R.drawable.icon_mine_help, "jumpHelp")); |
| | | list.add(new Functions("客服", R.drawable.icon_mine_kefu, "jumpKeFu")); |
| | | list.add(new Functions("设置", R.drawable.icon_mine_settings, "jumpSettings")); |
| | | return list; |
| | |
| | | |
| | | private LinearLayout ll_balance;//余额布局 |
| | | |
| | | private LinearLayout ll_share_reward; |
| | | private LinearLayout ll_fanli; |
| | | |
| | | private void listener(View contentView) { |
| | | ll_balance = contentView.findViewById(R.id.ll_balance); |
| | | ll_balance.setOnClickListener(this); |
| | | contentView.findViewById(R.id.ll_share_history).setOnClickListener(this); |
| | | contentView.findViewById(R.id.ll_order).setOnClickListener(this); |
| | | contentView.findViewById(R.id.ll_find_order).setOnClickListener(this); |
| | | contentView.findViewById(R.id.ll_send_order).setOnClickListener(this); |
| | | |
| | | tv_nickName.setOnClickListener(this); |
| | | tv_mine_login.setOnClickListener(this); |
| | | ll_share_reward = contentView.findViewById(R.id.ll_share_reward); |
| | | ll_fanli = contentView.findViewById(R.id.ll_fanli); |
| | | |
| | | |
| | | ll_share_reward.setOnClickListener(this); |
| | | ll_fanli.setOnClickListener(this); |
| | | |
| | | |
| | | iv_portrait.setOnClickListener(this); |
| | | fl_reward_today.setOnClickListener(this); |
| | | fl_reward_yestoday.setOnClickListener(this); |
| | | fl_reward_current_month.setOnClickListener(this); |
| | | fl_reward_last_month.setOnClickListener(this); |
| | | |
| | | tv_user_num.setOnClickListener(this); |
| | | vp_close.setOnClickListener(this);//关闭热门广告 |
| | | ll_special_invitecode_apply.setOnClickListener(this); |
| | | sv_mine.setOnScollChangedListener(new ScListerScrollView.OnScollChangedListener() { |
| | | @Override |
| | | public void onScrollChanged(ScListerScrollView scrollView, int x, int y, int oldx, int oldy) { |
| | | if (y > 0 && y < DimenUtils.dip2px(tv_nickName.getContext(), 40)) { |
| | | if (oldy > y) { |
| | | ll_title.setVisibility(View.VISIBLE); |
| | | } else { |
| | | ll_title.setVisibility(View.INVISIBLE); |
| | | } |
| | | ll_title_face.setVisibility(View.VISIBLE); |
| | | float alpha = (y + 0.0f) / DimenUtils.dip2px(tv_nickName.getContext(), 40); |
| | | // Log.e("mResult", "" + y + "---" + oldy); |
| | | ll_title_face.setAlpha(alpha); |
| | | } else { |
| | | ll_title_face.setAlpha(1); |
| | | if (y == 0) { |
| | | ll_title.setVisibility(View.VISIBLE); |
| | | ll_title_face.setVisibility(View.INVISIBLE); |
| | | } else { |
| | | ll_title.setVisibility(View.INVISIBLE); |
| | | ll_title_face.setVisibility(View.VISIBLE); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | |
| | | fl_msg.setOnClickListener(this); |
| | | } |
| | | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | initUserView(); |
| | | getUserConfig(); |
| | | MobclickAgent.onPageStart("我的"); |
| | | SharedPreferences sp = tv_nickName.getContext().getSharedPreferences("user", MODE_PRIVATE); |
| | | if (sp.getBoolean("isLogin", false)) { |
| | | getLijinUserLevel(); |
| | | getUnReadMsgCount(UserUtil.getUid(getContext())); |
| | | vp_banner.postDelayed(mAutoScroller, 2000); |
| | | } |
| | | |
| | | private void initUserView() { |
| | | if (UserUtil.isLogin(getContext())) { |
| | | tv_user_numlayout.setVisibility(View.VISIBLE); |
| | | tv_user_num.setVisibility(View.VISIBLE); |
| | | ll_nick_name_vip.setVisibility(View.VISIBLE); |
| | | tv_nickName.setVisibility(View.VISIBLE); |
| | | tv_mine_login.setVisibility(View.GONE); |
| | | String uid = sp.getString("uid", "0"); |
| | | if (lastTime > 0 && (System.currentTimeMillis() - lastTime > 30 * 1000)) { |
| | | clickState = 0; |
| | | } |
| | | if (!uid.equalsIgnoreCase("0")) { |
| | | String userInfo = sp.getString("userinfo", ""); |
| | | if (!StringUtils.isEmpty(userInfo)) { |
| | | try { |
| | | JSONObject jsonObject = new JSONObject(userInfo); |
| | | showInfo(jsonObject); |
| | | } catch (JSONException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | String rewardInfo = sp.getString("estimatereward", ""); |
| | | if (!StringUtils.isEmpty(rewardInfo)) { |
| | | try { |
| | | JSONObject jsonObject = new JSONObject(rewardInfo); |
| | | showRewardInfo(jsonObject); |
| | | } catch (JSONException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | getUserInfo(uid); |
| | | } |
| | | UserInfo user = UserUtil.getUserInfo(getContext()); |
| | | showInfo(user); |
| | | getUserInfo(UserUtil.getUid(getContext())); |
| | | } else { |
| | | noLogin(); |
| | | } |
| | | vp_banner.postDelayed(mAutoScroller, 2000); |
| | | } |
| | | |
| | | /** |
| | | * 展示用户信息 |
| | | */ |
| | | private void showInfo(JSONObject jsonObject) { |
| | | if (jsonObject.optJSONObject("data") == null) { |
| | | return; |
| | | } |
| | | JSONObject data = jsonObject.optJSONObject("data"); |
| | | Gson gson = new GsonBuilder().serializeNulls().create(); |
| | | UserInfo info = gson.fromJson(jsonObject.optJSONObject("data").optJSONObject("user").toString(), new TypeToken<UserInfo>() { |
| | | }.getType()); |
| | | private void showInfo(UserInfo info) { |
| | | if (info == null) { |
| | | return; |
| | | } |
| | | fl_msg.setVisibility(View.VISIBLE); |
| | | ImageLoader.getInstance().displayImage(info.getPortrait(), iv_portrait, options); |
| | | tv_nickName.setText(info.getNickName()); |
| | | |
| | | |
| | | String balance = "¥ " + info.getMyHongBao(); |
| | | Spannable span = new SpannableString(balance); |
| | | span.setSpan(new RelativeSizeSpan(1.5f), 1, balance.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); |
| | | tv_balance.setText(span); |
| | | String balance = info.getMyHongBao(); |
| | | tv_balance.setText(balance); |
| | | tv_user_num.setText("ID:" + info.getId()); |
| | | } |
| | | |
| | | /** |
| | | * 展示奖金信息 |
| | | */ |
| | | private void showRewardInfo(JSONObject jsonObject) { |
| | | |
| | | JSONObject data = jsonObject.optJSONObject("data"); |
| | | final MineRewardStatistic statistic = new Gson().fromJson(data.toString(), MineRewardStatistic.class); |
| | | |
| | | tv_share_estimate_reward.setText("¥ " + statistic.getShareMoney()); |
| | | tv_fanli_reward.setText("¥ " + statistic.getSelfMoney()); |
| | | } |
| | | |
| | | private void clearRewardInfo() { |
| | | tv_share_estimate_reward.setText("¥ 0.00"); |
| | | tv_fanli_reward.setText("¥ 0.00"); |
| | | } |
| | | |
| | | private void noLogin() { |
| | | tv_user_numlayout.setVisibility(View.GONE); |
| | | tv_user_num.setVisibility(View.GONE); |
| | | ll_nick_name_vip.setVisibility(View.GONE); |
| | | tv_nickName.setVisibility(View.GONE); |
| | | tv_mine_login.setVisibility(View.VISIBLE); |
| | | tv_mine_login.setText("登录"); |
| | | ll_nick_name_vip.setVisibility(View.VISIBLE); |
| | | tv_nickName.setVisibility(View.VISIBLE); |
| | | tv_nickName.setText("点击登录"); |
| | | tv_user_num.setText(""); |
| | | // tv_mine_invite.setText("邀请激活"); |
| | | String balance = "¥ 0.00"; |
| | | Spannable span = new SpannableString(balance); |
| | | span.setSpan(new RelativeSizeSpan(1.5f), 2, balance.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); |
| | | tv_balance.setText(span); |
| | | String balance = "0.00"; |
| | | tv_balance.setText(balance); |
| | | ImageLoader.getInstance().displayImage("drawable://" + R.drawable.ic_mine_default_portrait, iv_portrait, options); |
| | | ll_special_invitecode_apply.setVisibility(View.GONE); |
| | | clearRewardInfo(); |
| | | fl_msg.setVisibility(View.INVISIBLE); |
| | | } |
| | | |
| | | /***小黄条*/ |
| | |
| | | |
| | | private int rewardState = 1; |
| | | |
| | | private String getRewardStateDesc(int state) { |
| | | switch (state) { |
| | | case 1: |
| | | return "今日预估"; |
| | | case 2: |
| | | return "昨日预估"; |
| | | case 3: |
| | | return "本月预估"; |
| | | case 4: |
| | | return "上月"; |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | |
| | | private void initMoneyStatisticName() { |
| | | tv_share_reward_hint.setText("佣金"); |
| | | tv_fanli_reward_hint.setText("返利"); |
| | | } |
| | | |
| | | @Override |
| | | public void onClick(View v) { |
| | | final SharedPreferences sp = getActivity().getSharedPreferences("user", Context.MODE_PRIVATE); |
| | | boolean isLogin = sp.getBoolean("isLogin", false); |
| | | boolean isLogin = UserUtil.isLogin(getContext()); |
| | | clickState = 0; |
| | | switch (v.getId()) { |
| | | case R.id.vp_close: |
| | |
| | | case R.id.tv_user_num: |
| | | break; |
| | | |
| | | case R.id.tv_nickname: |
| | | if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true)) |
| | | case R.id.fl_msg: |
| | | if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()), true)) |
| | | return; |
| | | if (!isLogin) {//登录淘宝 |
| | | // loginHint(); |
| | | UserUtil.jumpLogin(tv_nickName.getContext()); |
| | | } else { |
| | | startActivity(new Intent(tv_nickName.getContext(), MyInfoActivity.class)); |
| | | } |
| | | startActivity(new Intent(getContext(), UserMessageActivity.class)); |
| | | break; |
| | | case R.id.tv_mine_login: |
| | | |
| | | case R.id.tv_nickname: |
| | | if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()), true)) |
| | | return; |
| | | if (!isLogin) {//登录淘宝 |
| | | UserUtil.jumpLogin(tv_nickName.getContext()); |
| | | } else { |
| | |
| | | |
| | | //头像 |
| | | case R.id.iv_portrait: |
| | | if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true)) |
| | | if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()), true)) |
| | | return; |
| | | UserCustomEvent.userMyInfo(ll_notice.getContext()); |
| | | if (!isLogin) {//登录 |
| | | // loginHint(); |
| | | clickState = 10; |
| | | UserUtil.jumpLogin(tv_nickName.getContext()); |
| | | } else { |
| | | startActivity(new Intent(tv_nickName.getContext(), MyInfoActivity.class)); |
| | | } |
| | | break; |
| | | |
| | | case R.id.ll_order://订单 |
| | | mineFunctionsManager.jumpOrder(); |
| | | break; |
| | | //账户余额 |
| | | case R.id.ll_balance: |
| | | if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true)) |
| | | if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()), true)) |
| | | return; |
| | | UserCustomEvent.userBalance(tv_user_num.getContext()); |
| | | if (isLogin) { |
| | |
| | | }, 200); |
| | | |
| | | |
| | | ShoppingApi.getUserMoneyInfo(getContext(), getContext().getSharedPreferences("user", Context.MODE_PRIVATE).getString("uid", ""), new BasicTextHttpResponseHandler() { |
| | | ShoppingApi.getUserMoneyInfo(getContext(), UserUtil.getUid(ShoppingApplication.application), new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | ll_balance.setEnabled(true); |
| | |
| | | break; |
| | | |
| | | |
| | | case R.id.fl_reward_today://今日奖金 |
| | | if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true)) |
| | | return; |
| | | rewardState = 1; |
| | | initMoneyStatisticName(); |
| | | |
| | | showRewardStatisticsView(); |
| | | getRewardInfo(); |
| | | break; |
| | | case R.id.fl_reward_yestoday://昨日奖金 |
| | | if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true)) |
| | | return; |
| | | rewardState = 2; |
| | | initMoneyStatisticName(); |
| | | showRewardStatisticsView(); |
| | | getRewardInfo(); |
| | | break; |
| | | case R.id.fl_reward_current_month://当月奖金 |
| | | if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true)) |
| | | return; |
| | | rewardState = 3; |
| | | initMoneyStatisticName(); |
| | | showRewardStatisticsView(); |
| | | getRewardInfo(); |
| | | break; |
| | | case R.id.fl_reward_last_month://上月奖金 |
| | | if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true)) |
| | | return; |
| | | rewardState = 4; |
| | | initMoneyStatisticName(); |
| | | showRewardStatisticsView(); |
| | | getRewardInfo(); |
| | | break; |
| | | //分享记录 |
| | | case R.id.ll_share_history: |
| | | if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true)) |
| | | return; |
| | | UserCustomEvent.userShareHistory(ll_count.getContext()); |
| | | if (isLogin) { |
| | | Intent intent8 = new Intent(tv_nickName.getContext(), ShareHistoryActivity31.class); |
| | | startActivity(intent8); |
| | | } else { |
| | | clickState = 12; |
| | | |
| | | } |
| | | break; |
| | | |
| | | |
| | | case R.id.iv_vip: |
| | | if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true)) |
| | | if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()), true)) |
| | | return; |
| | | //跳转到vip |
| | | if (userInviteLevel != null && !StringUtils.isEmpty(userInviteLevel.getLink())) |
| | | startActivity(new Intent(getContext(), ShareBrowserActivity.class).putExtra("url", userInviteLevel.getLink())); |
| | | break; |
| | | |
| | | case R.id.ll_special_invitecode_apply://专属邀请码申请入口 |
| | | if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true)) |
| | | return; |
| | | startActivity(new Intent(getContext(), ShareBrowserActivity.class).putExtra("url", SystemParamsUtil.getParam(getContext(), "invite_code_apply"))); |
| | | break; |
| | | |
| | | case R.id.ll_fanli: |
| | | if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true)) |
| | | return; |
| | | if (isLogin) { |
| | | Intent intent115 = new Intent(tv_nickName.getContext(), RewardStatisticsOrderActivity33.class); |
| | | intent115.putExtra("type", 1 + ""); |
| | | intent115.putExtra("title", getRewardStateDesc(rewardState) + "自购返利"); |
| | | |
| | | intent115.putExtra("needCount", true); |
| | | intent115.putExtra("dateType", rewardState); |
| | | startActivity(intent115); |
| | | } else { |
| | | UserUtil.jumpLogin(tv_nickName.getContext()); |
| | | Toast.makeText(tv_nickName.getContext(), String.format("请先登录%s账号", getResources().getString(R.string.app_name)), Toast.LENGTH_LONG).show(); |
| | | } |
| | | break; |
| | | |
| | | case R.id.ll_share_reward: |
| | | if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true)) |
| | | return; |
| | | if (isLogin) { |
| | | Intent intent5 = new Intent(tv_nickName.getContext(), RewardStatisticsOrderActivity33.class); |
| | | intent5.putExtra("type", 2 + ""); |
| | | intent5.putExtra("title", getRewardStateDesc(rewardState) + "分享奖金"); |
| | | intent5.putExtra("needCount", true); |
| | | intent5.putExtra("dateType", rewardState); |
| | | startActivity(intent5); |
| | | } else { |
| | | clickState = 13; |
| | | UserUtil.jumpLogin(tv_nickName.getContext()); |
| | | } |
| | | break; |
| | | case R.id.ll_find_order: |
| | | mineFunctionsManager.jumpFindOrder(); |
| | | break; |
| | | case R.id.ll_send_order: |
| | | mineFunctionsManager.jumpCloud(); |
| | | break; |
| | | |
| | | default: |
| | |
| | | if (clickState == 1) { |
| | | if (!StringUtils.isEmpty(trolleyType) && trolleyType.equalsIgnoreCase("baichuan")) { |
| | | if (Tools.isTaobaoAvilible(ll_notice.getContext()) == 0) { |
| | | // startActivity(new Intent(ll_novice.getContext(), ShoppingTrolleyActivity.class)); |
| | | AlibcShowParams alibcShowParams = new AlibcShowParams(); |
| | | alibcShowParams.setOpenType(OpenType.Native); |
| | | Map<String, String> exParams = new HashMap<>(); |
| | |
| | | exParams.put("alibaba", "阿里巴巴");//自定义参数部分,可任意增删改 |
| | | |
| | | AlibcBasePage alibcBasePage = new AlibcMyCartsPage(); |
| | | // AlibcTrade.show(getActivity(), alibcBasePage, alibcShowParams, null, null, new MiDuoTradeCallback("")); |
| | | jumpNoLink(alibcBasePage, alibcShowParams); |
| | | } else { |
| | | Toast.makeText(tv_nickName.getContext(), "未安装淘宝App,该功能无法使用", Toast.LENGTH_LONG).show(); |
| | |
| | | private Long bindPhonetime = 0L; |
| | | private Dialog dialog; |
| | | private int redPackLock = 0;//1: 红包功能关闭 0:开启 |
| | | private boolean applySpecialInviteCode;//是否可以申请专属邀请码 |
| | | private UserInviteLevel userInviteLevel;//用户邀请等级 |
| | | |
| | | /****用户信息*/ |
| | | private void getUserInfo(final String uid) { |
| | | private void getUserInfo(final Long uid) { |
| | | ShoppingApi.getUserInfo2(tv_nickName.getContext(), uid, new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | if (jsonObject.optString("code").equalsIgnoreCase("0")) { |
| | | JSONObject data = jsonObject.optJSONObject("data"); |
| | | String inviteCode = data.optString("invitCode"); |
| | | UserUtil.setInviteCode(getContext(), uid, inviteCode); |
| | | UserUtil.setInviteCode(getContext(), inviteCode); |
| | | vipLink = data.optString("vipLink"); |
| | | moduleState = data.optJSONObject("moduleState"); |
| | | if (mineFunctionsManager != null) |
| | | mineFunctionsManager.setModuleState(moduleState); |
| | | applySpecialInviteCode = data.optBoolean("tailor"); |
| | | //专属邀请码是否显示 |
| | | if (applySpecialInviteCode) { |
| | | ll_special_invitecode_apply.setVisibility(View.VISIBLE); |
| | | } else |
| | | ll_special_invitecode_apply.setVisibility(View.GONE); |
| | | |
| | | |
| | | ll_count.setVisibility(View.VISIBLE); |
| | | |
| | | |
| | | redPackLock = data.optInt("redPackLock");// 红包功能关闭开启 |
| | | Gson gson = new GsonBuilder().serializeNulls().create(); |
| | |
| | | if (inviteLevel != null) { |
| | | userInviteLevel = gson.fromJson(inviteLevel.toString(), UserInviteLevel.class); |
| | | } |
| | | showInfo(jsonObject);//展示用户个人信息 |
| | | final UserInfo info = gson.fromJson(data.optJSONObject("user").toString(), new TypeToken<UserInfo>() { |
| | | }.getType()); |
| | | SharedPreferences sp = tv_nickName.getContext().getSharedPreferences("user", MODE_PRIVATE); |
| | | SharedPreferences.Editor editor = sp.edit(); |
| | | editor.putBoolean("isLogin", true); |
| | | editor.putBoolean("isFirstInput", false); |
| | | editor.putString("uid", info.getId()); |
| | | editor.putString("openid", info.getOpenid()); |
| | | editor.putString("portrait", info.getPortrait()); |
| | | editor.putString("userinfo", jsonObject.toString()); |
| | | if (StringUtils.isEmpty(info.getWxOpenId())) { |
| | | editor.putBoolean("isWxBind", false); |
| | | } else { |
| | | editor.putBoolean("isWxBind", true); |
| | | } |
| | | editor.commit(); |
| | | showInfo(info);//展示用户个人信息 |
| | | UserUtil.loginSuccess(getContext(), info); |
| | | /**bindPhone 绑定手机弹窗*/ |
| | | if (jsonObject.optJSONObject("data").optBoolean("bindPhone", false)) { |
| | | if (System.currentTimeMillis() - bindPhonetime < 1000) {//小于1秒不进入 |
| | |
| | | } |
| | | |
| | | } else if (jsonObject.optInt("code") == 80001) { |
| | | if (tv_nickName.getContext().getSharedPreferences("user", MODE_PRIVATE).getBoolean("isLogin", false)) { |
| | | if (UserUtil.isLogin(getContext())) { |
| | | loginOut(); |
| | | UserUtil.logout(tv_nickName.getContext()); |
| | | noLogin(); |
| | |
| | | @Override |
| | | public void onFinish() { |
| | | super.onFinish(); |
| | | getRewardInfo(); |
| | | // getUserConfig();//获取邀请链接 |
| | | if (clickState == 1) { |
| | | if (!AlibcLogin.getInstance().isLogin()) { |
| | | tbLogin(); |
| | |
| | | clickState = 0; |
| | | if (!StringUtils.isEmpty(trolleyType) && trolleyType.equalsIgnoreCase("baichuan")) { |
| | | if (Tools.isTaobaoAvilible(ll_notice.getContext()) == 0) { |
| | | // Log.e("mResult", "onFinish---淘宝已登录"); |
| | | // startActivity(new Intent(ll_novice.getContext(), ShoppingTrolleyActivity.class)); |
| | | AlibcShowParams alibcShowParams = new AlibcShowParams(); |
| | | alibcShowParams.setOpenType(OpenType.Native); |
| | | Map<String, String> exParams = new HashMap<>(); |
| | |
| | | exParams.put("alibaba", "阿里巴巴");//自定义参数部分,可任意增删改 |
| | | |
| | | AlibcBasePage alibcBasePage = new AlibcMyCartsPage(); |
| | | // AlibcTrade.show(getActivity(), alibcBasePage, alibcShowParams, null, null, new MiDuoTradeCallback("")); |
| | | jumpNoLink(alibcBasePage, alibcShowParams); |
| | | } else { |
| | | Toast.makeText(tv_nickName.getContext(), "未安装淘宝App,该功能无法使用", Toast.LENGTH_LONG).show(); |
| | |
| | | }); |
| | | } |
| | | |
| | | |
| | | private void getLijinUserLevel() { |
| | | if (!UserUtil.isLogin(getContext())) { |
| | | iv_rank.setVisibility(View.GONE); |
| | | return; |
| | | } |
| | | |
| | | ShoppingApi.getLijinUserLevel(getContext(), UserUtil.getUid(getContext()), new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onStart() { |
| | | super.onStart(); |
| | | } |
| | | |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | if (jsonObject.optInt("code") == 0) { |
| | | JSONObject data = jsonObject.optJSONObject("data"); |
| | | String userLevel = data.optString("userLevel"); |
| | | final String vipLink = data.optString("lijinVipLink"); |
| | | try { |
| | | iv_rank.setImageResource(getResources().getIdentifier("icon_rank_" + userLevel, "drawable", getContext().getPackageName())); |
| | | } catch (Exception e) { |
| | | } |
| | | |
| | | iv_rank.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | startActivity(new Intent(getContext(), ShareBrowserActivity.class).putExtra("url", vipLink)); |
| | | } |
| | | }); |
| | | iv_rank.setVisibility(View.VISIBLE); |
| | | } |
| | | super.onSuccessPerfect(statusCode, headers, jsonObject); |
| | | } |
| | | |
| | | @Override |
| | | public void onFinish() { |
| | | super.onFinish(); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 我的信息-提醒记录 |
| | | * |
| | | * @param uid |
| | | */ |
| | | private void user_recordBind(String uid) { |
| | | private void user_recordBind(Long uid) { |
| | | ShoppingApi.setRecordBind(tv_nickName.getContext(), uid, null); |
| | | } |
| | | |
| | |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 获取奖金信息 |
| | | */ |
| | | private void getRewardInfo() { |
| | | String uid = tv_balance.getContext().getSharedPreferences("user", MODE_PRIVATE).getString("uid", ""); |
| | | ShoppingApi.getRewardStatistics(tv_balance.getContext(), uid, rewardState + "", new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | if (jsonObject.optInt("code") == 0) { |
| | | // tv_share_reward_num.setText(jsonObject.optJSONObject("data").optString("shareCount")); |
| | | showRewardInfo(jsonObject); |
| | | if (rewardState == 1) { |
| | | SharedPreferences sp = tv_mine_login.getContext().getSharedPreferences("user", MODE_PRIVATE); |
| | | sp.edit().putString("estimatereward", jsonObject.toString()).apply(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) { |
| | | super.onFailure(statusCode, headers, responseString, throwable); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public void onActivityResult(int requestCode, int resultCode, Intent data) { |
| | |
| | | String content = data.getStringExtra(Constant.CODED_CONTENT); |
| | | if (content.contains("taobao://")) { |
| | | // Intent intent = new Intent(tv_user_num.getContext(), GoodsDetailBrowerActivity.class); |
| | | Intent intent = new Intent(tv_nickName.getContext(), GoodsDetailActivityTB.class); |
| | | Intent intent = new Intent(tv_nickName.getContext(), GoodsDetailActivity.class); |
| | | String id = content.substring(content.indexOf("//") + 2); |
| | | intent.putExtra("id", id); |
| | | intent.putExtra("from", "scan"); |
| | | intent.putExtra("goodsId", id); |
| | | intent.putExtra("goodsType", com.tejia.lijin.app.util.Constant.GOODS_TYPE_TB); |
| | | startActivity(intent); |
| | | } else if (content.contains("jd://")) { |
| | | // Intent intent = new Intent(tv_user_num.getContext(), GoodsDetailBrowerActivity.class); |
| | | Intent intent = new Intent(tv_nickName.getContext(), GoodsDetailActivityJD.class); |
| | | Intent intent = new Intent(tv_nickName.getContext(), GoodsDetailActivity.class); |
| | | String id = content.substring(content.indexOf("//") + 2); |
| | | intent.putExtra("id", id); |
| | | intent.putExtra("goodsId", id); |
| | | intent.putExtra("goodsType", com.tejia.lijin.app.util.Constant.GOODS_TYPE_JD); |
| | | intent.putExtra("from", "scan"); |
| | | startActivity(intent); |
| | | } else if (content.contains("pdd://")) { |
| | | // Intent intent = new Intent(tv_user_num.getContext(), GoodsDetailBrowerActivity.class); |
| | | Intent intent = new Intent(tv_nickName.getContext(), GoodsDetailActivityPDD.class); |
| | | Intent intent = new Intent(tv_nickName.getContext(), GoodsDetailActivity.class); |
| | | String id = content.substring(content.indexOf("//") + 2); |
| | | intent.putExtra("id", id); |
| | | intent.putExtra("goodsId", id); |
| | | intent.putExtra("goodsType", com.tejia.lijin.app.util.Constant.GOODS_TYPE_PDD); |
| | | intent.putExtra("from", "scan"); |
| | | startActivity(intent); |
| | | } else { |
| | |
| | | mineFunctionsManager.setConvertLink(convertLinkUrl); |
| | | mineFunctionsManager.setCloudUrl(cloudSendOrderLink); |
| | | mineFunctionsManager.setpPlateformRule(platformRuleLink); |
| | | } |
| | | |
| | | if (StringUtils.isBlank(cloudSendOrderLink)) { |
| | | ll_send_order.setVisibility(View.GONE); |
| | | } else { |
| | | ll_send_order.setVisibility(View.VISIBLE); |
| | | } |
| | | |
| | | trolleyType = taoBaoCartInfo.getJumpDetail().getType(); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | }); |
| | |
| | | ShoppingApi.closeDialogNotify(getContext(), UserUtil.getUid(getContext()), id, null, type, null); |
| | | } |
| | | |
| | | /** |
| | | * 奖金选择时间变化对应View的状态变化 |
| | | * state==1 今日奖金 2昨日奖金 3本月奖金 4上月奖金 |
| | | */ |
| | | private void showRewardStatisticsView() { |
| | | fl_reward_today.setBackground(rewardState == 1 ? getResources().getDrawable(R.drawable.shape_mine_share_top) |
| | | : null); |
| | | tv_reward_today.setTextColor(rewardState == 1 ? getResources().getColor(R.color.white) : |
| | | getResources().getColor(R.color.theme)); |
| | | fl_reward_today_ic.setVisibility(rewardState == 1 ? View.VISIBLE : View.INVISIBLE);//小箭头 |
| | | // tv_reward_today.setTextSize(TypedValue.COMPLEX_UNIT_SP, rewardState == 1 ? 17 : 15); |
| | | |
| | | fl_reward_yestoday.setBackground(rewardState == 2 ? getResources().getDrawable(R.drawable.shape_mine_share_top) |
| | | : null); |
| | | tv_reward_yestoday.setTextColor(rewardState == 2 ? getResources().getColor(R.color.white) : |
| | | getResources().getColor(R.color.theme)); |
| | | fl_reward_yestoday_ic.setVisibility(rewardState == 2 ? View.VISIBLE : View.INVISIBLE);//小箭头 |
| | | // tv_reward_yestoday.setTextSize(TypedValue.COMPLEX_UNIT_SP, rewardState == 2 ? 17 : 15); |
| | | |
| | | fl_reward_current_month.setBackground(rewardState == 3 ? getResources().getDrawable(R.drawable.shape_mine_share_top) |
| | | : null); |
| | | tv_reward_current_month.setTextColor(rewardState == 3 ? getResources().getColor(R.color.white) : |
| | | getResources().getColor(R.color.theme)); |
| | | fl_reward_current_month_ic.setVisibility(rewardState == 3 ? View.VISIBLE : View.INVISIBLE);//小箭头 |
| | | // tv_reward_current_month.setTextSize(TypedValue.COMPLEX_UNIT_SP, rewardState == 3 ? 17 : 15); |
| | | |
| | | fl_reward_last_month.setBackground(rewardState == 4 ? getResources().getDrawable(R.drawable.shape_mine_share_top) |
| | | : null); |
| | | tv_reward_last_month.setTextColor(rewardState == 4 ? getResources().getColor(R.color.white) : |
| | | getResources().getColor(R.color.theme)); |
| | | fl_reward_last_month_ic.setVisibility(rewardState == 4 ? View.VISIBLE : View.INVISIBLE);//小箭头 |
| | | // tv_reward_last_month.setTextSize(TypedValue.COMPLEX_UNIT_SP, rewardState == 4 ? 17 : 15); |
| | | } |
| | | |
| | | /** |
| | | * 启动美洽客服 |
| | | */ |
| | | private void conversation() { |
| | | KeFuUtil.jumpKeFu(tv_user_num.getContext(), "我的"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("我的"); |
| | | lastTime = System.currentTimeMillis(); |
| | | toast_dialog.dialog_dismiss(); |
| | | ll_balance.setEnabled(true); |
| | |
| | | return v; |
| | | } |
| | | } |
| | | |
| | | int totalMsgCount = 0; |
| | | |
| | | /** |
| | | * 消息 未读数量 |
| | | * |
| | | * @param uid |
| | | */ |
| | | private void getUnReadMsgCount(Long uid) { |
| | | ShoppingApi.getUnReadMsgCount(getContext(), uid, new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | if (jsonObject.optInt("code") == 0) { |
| | | if (jsonObject.optJSONObject("data").optInt("totalCount") > 0) { |
| | | totalMsgCount = jsonObject.optJSONObject("data").optInt("totalCount"); |
| | | } else { |
| | | totalMsgCount = 0; |
| | | } |
| | | } else { |
| | | totalMsgCount = 0; |
| | | } |
| | | if (totalMsgCount > 0) { |
| | | tv_msg_count.setVisibility(View.VISIBLE); |
| | | tv_msg_count.setText(totalMsgCount > 99 ? "99+" : (totalMsgCount + "")); |
| | | } else { |
| | | tv_msg_count.setVisibility(View.GONE); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |