From 01e23be6118d68d38a71d186296d440eadcaa197 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期一, 07 六月 2021 18:23:41 +0800 Subject: [PATCH] 特价bug修复 --- app/src/main/java/com/tejia/lijin/app/ui/main/RecommendTopFragment.java | 49 ++++++++++++++++++++++++------------------------- 1 files changed, 24 insertions(+), 25 deletions(-) diff --git a/app/src/main/java/com/tejia/lijin/app/ui/main/RecommendTopFragment.java b/app/src/main/java/com/tejia/lijin/app/ui/main/RecommendTopFragment.java index 559a7e8..ddbefad 100644 --- a/app/src/main/java/com/tejia/lijin/app/ui/main/RecommendTopFragment.java +++ b/app/src/main/java/com/tejia/lijin/app/ui/main/RecommendTopFragment.java @@ -35,6 +35,7 @@ import com.tejia.lijin.app.BasicTextHttpResponseHandler; import com.tejia.lijin.app.R; import com.tejia.lijin.app.ShoppingApi; +import com.tejia.lijin.app.ShoppingApplication; import com.tejia.lijin.app.entity.EntityFather; import com.tejia.lijin.app.entity.FirstCategory; import com.tejia.lijin.app.entity.TrendsType; @@ -51,10 +52,10 @@ import com.tejia.lijin.app.ui.invite.ShareBrowserActivity; import com.tejia.lijin.app.ui.mine.ShoppingTrolleyActivity; import com.tejia.lijin.app.ui.recommend.RecommendCategoryFragment; -import com.tejia.lijin.app.ui.recommend.RecommendFragment; import com.tejia.lijin.app.ui.recommend.SearchActivity; import com.tejia.lijin.app.updateApp.UpdateApp; import com.tejia.lijin.app.util.JumpActivityUtil; +import com.tejia.lijin.app.util.SystemParamsUtil; import com.tejia.lijin.app.util.ToolUtil; import com.tejia.lijin.app.util.ui.HomeUIUtil; import com.tejia.lijin.app.util.umengCustomEvent.CategoryCustomEvent; @@ -70,6 +71,7 @@ import com.wpc.library.util.cache.DiskLruCache; import com.wpc.library.util.common.StorageUtils; import com.wpc.library.util.common.StringUtils; +import com.tejia.lijin.app.ui.recommend.RecommendFragment; import net.lucode.hackware.magicindicator.MagicIndicator; import net.lucode.hackware.magicindicator.ViewPagerHelper; @@ -221,7 +223,7 @@ contentView.findViewById(R.id.v_status_bar).setVisibility(View.GONE); } - + contentView.findViewById(R.id.tv_course).setOnClickListener(this); recommend_top_img = contentView.findViewById(R.id.recommend_top_img);//鐑棬鍔熻兘 fl_search_content = contentView.findViewById(R.id.fl_search_content); fl_search_content.setOnClickListener(this); @@ -327,8 +329,8 @@ }, false);//寮哄埗妫�娴嬫洿鏂�-鍚�. //璁剧疆鑳屾櫙鑹� - contentView.findViewById(R.id.apl_search).setBackground(HomeUIUtil.getHomeTopBg("#FF227B", "#FF2A3E")); - magic_indicator.setBackground(HomeUIUtil.getHomeTopBg("#FF227B", "#FF2A3E")); + contentView.findViewById(R.id.apl_search).setBackground(HomeUIUtil.getHomeTopBg(getContext())); + magic_indicator.setBackground(HomeUIUtil.getHomeTopBg(getContext())); } @@ -479,12 +481,9 @@ } }, 1000); - boolean isLogin = sp.getBoolean("isLogin", false); + boolean isLogin = UserUtil.isLogin(getContext()); if (isLogin) { - String uid = sp.getString("uid", "0"); - if (!uid.equalsIgnoreCase("0")) { - getUserInfo(uid); - } + getUserInfo(UserUtil.getUid(ShoppingApplication.application)); if (accountLogin && floatImgDetail != null) {//寮规闇�瑕佺櫥闄� accountLogin = false; final String showTime = floatImgDetail.optString("showTime"); // everyday-姣忓ぉ鏄剧ず always-姣忔杩涙潵閮芥樉绀� @@ -594,6 +593,10 @@ startActivity(intent1); } } + break; + case R.id.tv_course: + //鏁欑▼ + startActivity(new Intent(getContext(), ShareBrowserActivity.class).putExtra("url", SystemParamsUtil.getNewerCourse(getContext()))); break; default: break; @@ -756,9 +759,9 @@ private void getHomeConfig() { - String uid = getContext().getSharedPreferences("user", Context.MODE_PRIVATE).getString("uid", ""); - if (!StringUtils.isEmpty(uid) && !uid.equalsIgnoreCase("0")) - lastRquestHomeConfigUid = Long.parseLong(uid); + Long uid = UserUtil.getUid(ShoppingApplication.application); + if (uid != null) + lastRquestHomeConfigUid = uid; ShoppingApi.getHomeConfig(ll_recommend_content.getContext(), uid, new BasicTextHttpResponseHandler() { @Override public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { @@ -866,8 +869,7 @@ builder.setPositiveButton(new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - final boolean isLogin = getContext().getSharedPreferences("user", - MODE_PRIVATE).getBoolean("isLogin", false); + final boolean isLogin = UserUtil.isLogin(getContext()); if (accountLogin && !isLogin) { clickState = 3; UserUtil.jumpLogin(getContext()); @@ -978,8 +980,7 @@ builder.setPositiveButton(new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - final boolean isLogin = getContext().getSharedPreferences("user", - MODE_PRIVATE).getBoolean("isLogin", false); + final boolean isLogin = UserUtil.isLogin(getContext()); if (accountLogin && !isLogin) { clickState = 4; UserUtil.jumpLogin(getContext()); @@ -1023,9 +1024,8 @@ } if (mList.size() == 0) pd.show(); - String uid = ll_recommend_content.getContext().getSharedPreferences("user", - MODE_PRIVATE).getString("uid", ""); - ShoppingApi.getHomeNavbar(ll_recommend_content.getContext(), uid, + + ShoppingApi.getHomeNavbar(ll_recommend_content.getContext(), UserUtil.getUid(ShoppingApplication.application), new BasicTextHttpResponseHandler() { @Override @@ -1207,7 +1207,7 @@ String openid; - private void getUserInfo(final String uid) { + private void getUserInfo(final Long uid) { ShoppingApi.getUserInfo2(ll_no_data.getContext(), uid, new BasicTextHttpResponseHandler() { @Override public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { @@ -1218,7 +1218,7 @@ }.getType()); openid = info.getOpenid(); String inviteCode = data.optString("invitCode"); - UserUtil.setInviteCode(getContext(), uid, inviteCode); + UserUtil.setInviteCode(getContext(), inviteCode); } } @@ -1342,7 +1342,7 @@ private void getShopList(String id) { //绮鹃�� SharedPreferences sp = getActivity().getSharedPreferences("user", MODE_PRIVATE); - ShoppingApi.getShopList(ll_recommend_content.getContext(), 1 + "", id, (sp.getBoolean("isLogin", false) ? sp.getString("uid", "0") : null), new BasicTextHttpResponseHandler() { + ShoppingApi.getShopList(ll_recommend_content.getContext(), 1 + "", id, UserUtil.getUid(ShoppingApplication.application), new BasicTextHttpResponseHandler() { @Override public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { @@ -1365,7 +1365,7 @@ //绮鹃�� if (id.equals("0")) { SharedPreferences sp = getActivity().getSharedPreferences("user", MODE_PRIVATE); - ShoppingApi.getHistory(ll_recommend_content.getContext(), "1", (sp.getBoolean("isLogin", false) ? sp.getString("uid", "0") : null), "1", new BasicTextHttpResponseHandler() { + ShoppingApi.getHistory(ll_recommend_content.getContext(), "1", UserUtil.getUid(ShoppingApplication.application), "1", new BasicTextHttpResponseHandler() { @Override public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { if (jsonObject.optString("code").equalsIgnoreCase("0")) { @@ -1385,8 +1385,7 @@ */ private void getMessage() { SharedPreferences sp = ll_recommend_content.getContext().getSharedPreferences("user", MODE_PRIVATE); - String uid = sp.getString("uid", ""); - ShoppingApi.getHomeMsgList(ll_recommend_content.getContext(), uid, 1 + "", new BasicTextHttpResponseHandler() { + ShoppingApi.getHomeMsgList(ll_recommend_content.getContext(), UserUtil.getUid(ShoppingApplication.application), 1 + "", new BasicTextHttpResponseHandler() { @Override public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { DiskLruCache.Editor editor = cache -- Gitblit v1.8.0