| | |
| | | implementation files('libs/jd_crash_lib_release_210.jar') |
| | | implementation files('libs/JDSDK_h.jar') |
| | | implementation project(':JdSDK') |
| | | //导航栏 |
| | | implementation 'com.github.hackware1993:MagicIndicator:1.7.0' |
| | | |
| | | //广点通广告 |
| | |
| | | implementation 'com.github.wendux:DSBridge-Android:3.0-SNAPSHOT' |
| | | //support the x5 browser core of tencent |
| | | implementation 'com.github.wendux:DSBridge-Android:x5-3.0-SNAPSHOT' |
| | | |
| | | implementation 'com.wang.avi:library:2.1.3' |
| | | |
| | | //富文本 |
| | | implementation 'com.zzhoujay.richtext:richtext:3.0.7' |
| | |
| | | public static void sendCircle(Context context, Long uid, String id, |
| | | BasicTextHttpResponseHandler handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<>(); |
| | | params.put("uid", uid + ""); |
| | | if (uid != null) |
| | | params.put("uid", uid + ""); |
| | | params.put("id", id + ""); |
| | | commonPostWithFailture(context, BASE_URL2 + "user/cloud/sendCircle", params, handler); |
| | | } |
| | |
| | | if (!LoginAndInviteStatusUtil.acessNext(context, uid, true)) |
| | | return; |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<>(); |
| | | params.put("uid", uid + ""); |
| | | if (uid != null) |
| | | params.put("uid", uid + ""); |
| | | params.put("type", type + ""); |
| | | params.put("id", id); |
| | | if (goodsId != null) |
| | |
| | | */ |
| | | public static void evaluateCopyComment(Context context, Long uid, String id, String cid, BasicTextHttpResponseHandler handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<>(); |
| | | params.put("uid", uid + ""); |
| | | if (uid != null) |
| | | params.put("uid", uid + ""); |
| | | params.put("cid", cid); |
| | | params.put("id", id); |
| | | commonPostWithFailture(context, BASE_URL2 + "dynamic/evaluateComment", params, handler); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 复制推荐语 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param id |
| | | * @param handler |
| | | */ |
| | | public static void evaluateCopyRecommend(Context context, Long uid, String id, BasicTextHttpResponseHandler handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<>(); |
| | | if (uid != null) |
| | | params.put("uid", uid + ""); |
| | | params.put("id", id); |
| | | commonPostWithFailture(context, BASE_URL2 + "dynamic/evaluateCopyRecommend", params, handler); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 转链 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param link |
| | | * @param handler |
| | | */ |
| | | public static void evaluateConvertLink(Context context, Long uid, String link, BasicTextHttpResponseHandler handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<>(); |
| | | if (uid != null) |
| | | params.put("uid", uid + ""); |
| | | params.put("link", link); |
| | | commonPostWithFailture(context, BASE_URL2 + "dynamic/convertLink", params, handler); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 首页顶部分类分类数据 |
| | | * |
New file |
| | |
| | | package com.tejia.lijin.app.entity.trends; |
| | | |
| | | import com.tejia.lijin.app.entity.common.GoodsConvertLinkJumpLink; |
| | | |
| | | public class ConvertLinkJumpVO { |
| | | private GoodsConvertLinkJumpLink jumpLink; |
| | | private Integer sourceType; |
| | | |
| | | public GoodsConvertLinkJumpLink getJumpLink() { |
| | | return jumpLink; |
| | | } |
| | | |
| | | public void setJumpLink(GoodsConvertLinkJumpLink jumpLink) { |
| | | this.jumpLink = jumpLink; |
| | | } |
| | | |
| | | public Integer getSourceType() { |
| | | return sourceType; |
| | | } |
| | | |
| | | public void setSourceType(Integer sourceType) { |
| | | this.sourceType = sourceType; |
| | | } |
| | | } |
| | |
| | | |
| | | import android.Manifest; |
| | | import android.annotation.SuppressLint; |
| | | import android.content.ClipboardManager; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.content.SharedPreferences; |
| | |
| | | import com.tejia.lijin.app.entity.HomeBanner; |
| | | import com.tejia.lijin.app.entity.TrendsCategory; |
| | | import com.tejia.lijin.app.entity.common.ImageShowEntity; |
| | | import com.tejia.lijin.app.entity.trends.ConvertLinkJumpVO; |
| | | import com.tejia.lijin.app.entity.trends.SendCircleCommment; |
| | | import com.tejia.lijin.app.entity.trends.SendCircleContent; |
| | | import com.tejia.lijin.app.entity.trends.SendCircleImage; |
| | |
| | | import com.tejia.lijin.app.ui.dialog.SendCircleShareDialog; |
| | | import com.tejia.lijin.app.ui.dialog.ShapeLoadingDialog; |
| | | import com.tejia.lijin.app.ui.invite.ShareBrowserActivity; |
| | | import com.tejia.lijin.app.ui.mine.LoginSelectActivity; |
| | | import com.tejia.lijin.app.ui.mine.MyInfoActivity; |
| | | import com.tejia.lijin.app.ui.recommend.SearchActivity; |
| | | import com.tejia.lijin.app.ui.recommend.ShareExplosionsGoodsDetailActivity; |
| | | import com.tejia.lijin.app.ui.trends.BigImageActivity; |
| | | import com.tejia.lijin.app.ui.trends.SendCircleAdapter; |
| | | import com.tejia.lijin.app.util.ApkUtil; |
| | | import com.tejia.lijin.app.util.Constant; |
| | | import com.tejia.lijin.app.util.ExceptionConstant; |
| | | import com.tejia.lijin.app.util.GoodsBuyJumpUtil; |
| | | import com.tejia.lijin.app.util.PermissionHelper; |
| | | import com.tejia.lijin.app.util.baichuan.AlibcTradeUtil; |
| | | import com.tejia.lijin.app.util.clipboard.ClipboardUtil; |
| | | import com.tejia.lijin.app.util.ui.HomeUIUtil; |
| | | import com.tejia.lijin.app.util.ui.TextViewUtil; |
| | | import com.tejia.lijin.app.util.ui.dialog.DialogUtil; |
| | | import com.tejia.lijin.app.util.user.UserUtil; |
| | | import com.wpc.library.RetainViewFragment; |
| | | import com.wpc.library.content.ConnectivityChangeHelper; |
| | |
| | | } |
| | | } |
| | | if (adapter == null) { |
| | | adapter = new SendCircleAdapter(getActivity(), mBannerList, mContentList, BetterGoodsFragment.this); |
| | | adapter = new SendCircleAdapter(getActivity(), mBannerList, mContentList, BetterGoodsFragment.this, new TextViewUtil.URLClickListener() { |
| | | @Override |
| | | public void onClick(final String url) { |
| | | prepareAction(new IPrePareSuccessListener() { |
| | | @Override |
| | | public void onSuccess() { |
| | | ShoppingApi.evaluateConvertLink( |
| | | getContext(), UserUtil. |
| | | getUid(getContext()), url, new |
| | | BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onStart() { |
| | | super.onStart(); |
| | | DialogUtil.show(pd); |
| | | } |
| | | |
| | | @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"); |
| | | ConvertLinkJumpVO jumpVO = new Gson().fromJson(data.toString(), ConvertLinkJumpVO.class); |
| | | switch (jumpVO.getSourceType()) { |
| | | case Constant.GOODS_TYPE_TB: |
| | | GoodsBuyJumpUtil.jumpTB(getActivity(), null, jumpVO.getJumpLink().getJumpLink(), jumpVO.getJumpLink().getNativeJumpLink(), null, null); |
| | | break; |
| | | case Constant.GOODS_TYPE_JD: |
| | | GoodsBuyJumpUtil.jumpJD(getActivity(), jumpVO.getJumpLink(), null, null); |
| | | break; |
| | | case Constant.GOODS_TYPE_PDD: |
| | | GoodsBuyJumpUtil.jumpPDD(getActivity(), jumpVO.getJumpLink(), null); |
| | | break; |
| | | case Constant.GOODS_TYPE_VIP: |
| | | GoodsBuyJumpUtil.jumpVIPShop(getActivity(), jumpVO.getJumpLink(), null); |
| | | break; |
| | | case Constant.GOODS_TYPE_SUNING: |
| | | GoodsBuyJumpUtil.jumpSuning(getActivity(), jumpVO.getJumpLink(), null); |
| | | break; |
| | | } |
| | | } else { |
| | | int code = jsonObject.optInt("code"); |
| | | switch (code) { |
| | | case ExceptionConstant.CODE_NOT_LOGIN: |
| | | startActivity(new Intent(getContext(), LoginSelectActivity.class)); |
| | | break; |
| | | case ExceptionConstant.CODE_AUTH_PDD_NO_AUTH: |
| | | Toast.makeText(getContext(), "请备案拼多多账号", Toast.LENGTH_SHORT).show(); |
| | | startActivity(new Intent(getContext(), MyInfoActivity.class)); |
| | | break; |
| | | case ExceptionConstant.CODE_AUTH_TAOBAO_NO_AUTH: |
| | | Toast.makeText(getContext(), "请授权淘宝账号", Toast.LENGTH_SHORT).show(); |
| | | startActivity(new Intent(getContext(), MyInfoActivity.class)); |
| | | break; |
| | | case ExceptionConstant.CODE_JUMP_NO_SUPPORT: |
| | | //不支持跳转 |
| | | JSONObject data = jsonObject.optJSONObject("data"); |
| | | ConvertLinkJumpVO jumpVO = new Gson().fromJson(data.toString(), ConvertLinkJumpVO.class); |
| | | if (jumpVO.getSourceType() != null && jumpVO.getSourceType() == Constant.GOODS_TYPE_TB) { |
| | | //复制口令跳转到淘宝 |
| | | //是否安装淘宝 |
| | | if (ApkUtil.checkAPP(getContext(), "com.taobao.taobao")) { |
| | | ClipboardUtil.copy(getContext(), url); |
| | | startActivity(getContext().getPackageManager().getLaunchIntentForPackage("com.taobao.taobao")); |
| | | } |
| | | } |
| | | break; |
| | | default: |
| | | Toast.makeText(getContext(), 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); |
| | | Toast.makeText(getContext(), "网络请求出错", Toast.LENGTH_SHORT).show(); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onFinish() { |
| | | super.onFinish(); |
| | | DialogUtil.dismiss(pd); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | rv_better_goods.setRecycledViewPool(new RecyclerView.RecycledViewPool()); |
| | | rv_better_goods.setAdapter(adapter); |
| | | |
| | | initLoadingView(); |
| | | } else { |
| | | adapter.notifyDataSetChanged(); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) { |
| | | public void onFailure(int statusCode, Header[] headers, String |
| | | responseString, Throwable throwable) { |
| | | super.onFailure(statusCode, headers, responseString, throwable); |
| | | bottom.setVisibility(View.GONE); |
| | | if (NetUtils.getNetworkState(srl_better_goods.getContext()).equalsIgnoreCase(NetUtils.NETWORK_NONE)) { |
| | |
| | | @Override |
| | | public void onStart() { |
| | | super.onStart(); |
| | | if (!pd.isShowing()) |
| | | pd.show(); |
| | | DialogUtil.show(pd); |
| | | |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void createERCode(SendCircleContent content, List<SendCircleImage> imgList, SendCircleImage img, final int position) { |
| | | public void createERCode(SendCircleContent |
| | | content, List<SendCircleImage> imgList, SendCircleImage img, final int position) { |
| | | actionParams = new ActionParams(content, imgList, img, position); |
| | | actionParams.type = ActionParams.TYPE_CREATE_ERCODE; |
| | | prepareAction(new IPrePareSuccessListener() { |
| | |
| | | |
| | | @Override |
| | | public void copyRecommendText(SendCircleContent content) { |
| | | ClipboardUtil.copy(getContext(), content.getTitle()); |
| | | Toast.makeText(getContext(), "复制成功", Toast.LENGTH_SHORT).show(); |
| | | ShoppingApi.evaluateCopyRecommend(getContext(), UserUtil.getUid(getContext()), content.getId(), new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onStart() { |
| | | super.onStart(); |
| | | DialogUtil.show(pd); |
| | | } |
| | | |
| | | @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"); |
| | | String content = data.optString("content"); |
| | | ClipboardUtil.copy(getContext(), content); |
| | | Toast.makeText(getContext(), "复制成功", Toast.LENGTH_SHORT).show(); |
| | | } else { |
| | | Toast.makeText(getContext(), 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); |
| | | Toast.makeText(getContext(), "网络请求出错", Toast.LENGTH_SHORT).show(); |
| | | } |
| | | |
| | | @Override |
| | | public void onFinish() { |
| | | super.onFinish(); |
| | | DialogUtil.dismiss(pd); |
| | | } |
| | | }); |
| | | |
| | | copyTypeMap.put(content.getId(), 1); |
| | | } |
| | | |
| | |
| | | import android.content.pm.PackageInfo; |
| | | import android.content.pm.PackageManager; |
| | | import android.graphics.Color; |
| | | import android.graphics.Typeface; |
| | | import android.os.Build; |
| | | import android.os.Bundle; |
| | | import android.provider.Settings; |
| | | import android.text.TextPaint; |
| | | import android.view.LayoutInflater; |
| | | import android.view.MotionEvent; |
| | | import android.view.View; |
| | | import android.view.Window; |
| | |
| | | import com.tejia.lijin.app.ui.mine.ShoppingTrolleyActivity; |
| | | import com.tejia.lijin.app.ui.recommend.RecommendCategoryFragment; |
| | | import com.tejia.lijin.app.ui.recommend.SearchActivity; |
| | | import com.tejia.lijin.app.ui.subview.HomeRecommendNavIndicator; |
| | | import com.tejia.lijin.app.updateApp.UpdateApp; |
| | | import com.tejia.lijin.app.util.JumpActivityUtil; |
| | | import com.tejia.lijin.app.util.SystemParamsUtil; |
| | |
| | | import com.wpc.library.util.NetUtils; |
| | | import com.wpc.library.util.SystemCommon; |
| | | import com.wpc.library.util.cache.DiskLruCache; |
| | | import com.wpc.library.util.common.DimenUtils; |
| | | 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; |
| | | import net.lucode.hackware.magicindicator.buildins.UIUtil; |
| | | import net.lucode.hackware.magicindicator.buildins.commonnavigator.CommonNavigator; |
| | | import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.CommonNavigatorAdapter; |
| | | import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerIndicator; |
| | | import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerTitleView; |
| | | import net.lucode.hackware.magicindicator.buildins.commonnavigator.indicators.LinePagerIndicator; |
| | | import net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.ClipPagerTitleView; |
| | | import net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.CommonPagerTitleView; |
| | | |
| | | import org.apache.http.Header; |
| | |
| | | |
| | | } |
| | | |
| | | private CommonNavigatorAdapter n1 = new CommonNavigatorAdapter() { |
| | | |
| | | @Override |
| | | public int getCount() { |
| | | return mList == null ? 0 : mList.size(); |
| | | } |
| | | |
| | | @Override |
| | | public IPagerTitleView getTitleView(final Context context, final int index) { |
| | | CommonPagerTitleView commonPagerTitleView = new CommonPagerTitleView(getContext()); |
| | | //设置自定义布局文件及view赋值 |
| | | commonPagerTitleView.setContentView(R.layout.item_recommend_nav); |
| | | commonPagerTitleView.setHovered(false); |
| | | final TextView tvTitle = commonPagerTitleView.findViewById(R.id.tv_title); |
| | | tvTitle.setHighlightColor(context.getResources().getColor(android.R.color.transparent)); |
| | | tvTitle.setText(mList.get(index).getName()); |
| | | tvTitle.setBackground(null); |
| | | |
| | | //tab切换监听 |
| | | commonPagerTitleView.setOnPagerTitleChangeListener(new CommonPagerTitleView.OnPagerTitleChangeListener() { |
| | | @Override |
| | | public void onSelected(int index, int totalCount) { |
| | | tvTitle.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD)); |
| | | } |
| | | |
| | | @Override |
| | | public void onDeselected(int index, int totalCount) { |
| | | tvTitle.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL)); |
| | | } |
| | | |
| | | @Override |
| | | public void onLeave(int index, int totalCount, float leavePercent, boolean leftToRight) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onEnter(int index, int totalCount, float enterPercent, boolean leftToRight) { |
| | | |
| | | } |
| | | }); |
| | | |
| | | //tab单个item点击事件监听 |
| | | commonPagerTitleView.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View view) { |
| | | pager.setCurrentItem(index); |
| | | } |
| | | }); |
| | | |
| | | return commonPagerTitleView; |
| | | } |
| | | |
| | | //此为tab指示器回调 |
| | | @Override |
| | | public IPagerIndicator getIndicator(Context context) { |
| | | int height = magic_indicator.getLayoutParams().height; //UIUtil.dip2px(context, 40); |
| | | HomeRecommendNavIndicator indicator = new HomeRecommendNavIndicator(context); |
| | | float navigatorHeight = DimenUtils.sp2px(context, 25); //context.getResources().getDimension(R.dimen.dp_130); |
| | | float borderWidth = UIUtil.dip2px(context, 1); |
| | | float lineHeight = navigatorHeight - 2 * borderWidth; |
| | | indicator.setLineHeight(lineHeight); |
| | | indicator.setRoundRadius(lineHeight / 2); |
| | | indicator.setXOffset(UIUtil.dip2px(context, 5)); |
| | | indicator.setYOffset((height - navigatorHeight) / 2); |
| | | indicator.setColors(Color.parseColor("#FFFFFF")); |
| | | return indicator; |
| | | } |
| | | }; |
| | | |
| | | |
| | | private CommonNavigatorAdapter n2 = new CommonNavigatorAdapter() { |
| | | |
| | | @Override |
| | | public int getCount() { |
| | | return mList == null ? 0 : mList.size(); |
| | | } |
| | | |
| | | @Override |
| | | public IPagerTitleView getTitleView(Context context, final int index) { |
| | | ClipPagerTitleView clipPagerTitleView = new ClipPagerTitleView(context); |
| | | clipPagerTitleView.setText(mList.get(index).getName()); |
| | | clipPagerTitleView.setTextColor(Color.parseColor("#FFFFFF")); |
| | | clipPagerTitleView.setClipColor(Color.WHITE); |
| | | clipPagerTitleView.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | pager.setCurrentItem(index); |
| | | } |
| | | }); |
| | | return clipPagerTitleView; |
| | | } |
| | | |
| | | //此为tab指示器回调 |
| | | @Override |
| | | public IPagerIndicator getIndicator(Context context) { |
| | | int height = magic_indicator.getLayoutParams().height; //UIUtil.dip2px(context, 40); |
| | | LinePagerIndicator indicator = new LinePagerIndicator(context); |
| | | float navigatorHeight = DimenUtils.sp2px(context, 25); //context.getResources().getDimension(R.dimen.dp_130); |
| | | float borderWidth = UIUtil.dip2px(context, 1); |
| | | float lineHeight = navigatorHeight - 2 * borderWidth; |
| | | indicator.setLineHeight(lineHeight); |
| | | indicator.setRoundRadius(lineHeight / 2); |
| | | indicator.setYOffset((height - navigatorHeight) / 2); |
| | | indicator.setColors(Color.parseColor("#bc2a2a")); |
| | | return indicator; |
| | | } |
| | | }; |
| | | |
| | | |
| | | private void loadHomeNavData() { |
| | | if (adapter == null) { |
| | |
| | | |
| | | if (commonNavigator == null) { |
| | | commonNavigator = new CommonNavigator(getContext()); |
| | | commonNavigator.setAdapter(new CommonNavigatorAdapter() { |
| | | |
| | | @Override |
| | | public int getCount() { |
| | | return mList == null ? 0 : mList.size(); |
| | | } |
| | | |
| | | @Override |
| | | public IPagerTitleView getTitleView(Context context, final int index) { |
| | | CommonPagerTitleView commonPagerTitleView = new CommonPagerTitleView(getContext()); |
| | | //设置自定义布局文件及view赋值 |
| | | commonPagerTitleView.setContentView(R.layout.item_recommend_nav); |
| | | final TextView tvTitle = commonPagerTitleView.findViewById(R.id.tv_title); |
| | | tvTitle.setText(mList.get(index).getName()); |
| | | |
| | | //tab切换监听 |
| | | commonPagerTitleView.setOnPagerTitleChangeListener(new CommonPagerTitleView.OnPagerTitleChangeListener() { |
| | | @Override |
| | | public void onSelected(int index, int totalCount) { |
| | | tvTitle.setBackground(getResources().getDrawable(R.drawable.shape_recommend_nav_highlight_bg)); |
| | | TextPaint paint = tvTitle.getPaint(); |
| | | paint.setFakeBoldText(true); |
| | | } |
| | | |
| | | @Override |
| | | public void onDeselected(int index, int totalCount) { |
| | | tvTitle.setBackground(null); |
| | | TextPaint paint = tvTitle.getPaint(); |
| | | paint.setFakeBoldText(false); |
| | | } |
| | | |
| | | @Override |
| | | public void onLeave(int index, int totalCount, float leavePercent, boolean leftToRight) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onEnter(int index, int totalCount, float enterPercent, boolean leftToRight) { |
| | | |
| | | } |
| | | }); |
| | | |
| | | //tab单个item点击事件监听 |
| | | commonPagerTitleView.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View view) { |
| | | pager.setCurrentItem(index); |
| | | } |
| | | }); |
| | | |
| | | return commonPagerTitleView; |
| | | } |
| | | |
| | | //此为tab指示器回调 |
| | | @Override |
| | | public IPagerIndicator getIndicator(Context context) { |
| | | // LinePagerIndicator indicator = new LinePagerIndicator(context); |
| | | // indicator.setMode(LinePagerIndicator.MODE_WRAP_CONTENT); |
| | | return null; |
| | | } |
| | | }); |
| | | commonNavigator.setAdapter(n1); |
| | | //设置给magicIndicator |
| | | magic_indicator.setNavigator(commonNavigator); |
| | | ViewPagerHelper.bind(magic_indicator, pager); |
New file |
| | |
| | | package com.tejia.lijin.app.ui.subview; |
| | | |
| | | import android.content.Context; |
| | | import android.graphics.Canvas; |
| | | import android.graphics.Paint; |
| | | import android.graphics.RectF; |
| | | import android.view.View; |
| | | import android.view.animation.Interpolator; |
| | | import android.view.animation.LinearInterpolator; |
| | | |
| | | import com.wpc.library.util.common.DimenUtils; |
| | | |
| | | import net.lucode.hackware.magicindicator.FragmentContainerHelper; |
| | | import net.lucode.hackware.magicindicator.buildins.ArgbEvaluatorHolder; |
| | | import net.lucode.hackware.magicindicator.buildins.UIUtil; |
| | | import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerIndicator; |
| | | import net.lucode.hackware.magicindicator.buildins.commonnavigator.model.PositionData; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | public class HomeRecommendNavIndicator extends View implements IPagerIndicator { |
| | | |
| | | |
| | | public static final int MODE_MATCH_EDGE = 0; // 直线宽度 == title宽度 - 2 * mXOffset |
| | | public static final int MODE_WRAP_CONTENT = 1; // 直线宽度 == title内容宽度 - 2 * mXOffset |
| | | public static final int MODE_EXACTLY = 2; // 直线宽度 == mLineWidth |
| | | |
| | | private int mMode; // 默认为MODE_MATCH_EDGE模式 |
| | | |
| | | // 控制动画 |
| | | private Interpolator mStartInterpolator = new LinearInterpolator(); |
| | | private Interpolator mEndInterpolator = new LinearInterpolator(); |
| | | |
| | | private float mYOffset; // 相对于底部的偏移量,如果你想让直线位于title上方,设置它即可 |
| | | private float mLineHeight; |
| | | private float mXOffset; |
| | | private float mLineWidth; |
| | | private float mRoundRadius; |
| | | |
| | | private Paint mPaint; |
| | | private List<PositionData> mPositionDataList; |
| | | private List<Integer> mColors; |
| | | |
| | | private RectF mLineRect = new RectF(); |
| | | |
| | | public HomeRecommendNavIndicator(Context context) { |
| | | super(context); |
| | | init(context); |
| | | } |
| | | |
| | | private void init(Context context) { |
| | | mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); |
| | | mPaint.setStyle(Paint.Style.STROKE); |
| | | mPaint.setStrokeWidth(UIUtil.dip2px(getContext(),1)); |
| | | mLineHeight = UIUtil.dip2px(context, 3); |
| | | mLineWidth = UIUtil.dip2px(context, 10); |
| | | } |
| | | |
| | | @Override |
| | | protected void onDraw(Canvas canvas) { |
| | | canvas.drawRoundRect(mLineRect, mRoundRadius, mRoundRadius, mPaint); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { |
| | | if (mPositionDataList == null || mPositionDataList.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | // 计算颜色 |
| | | if (mColors != null && mColors.size() > 0) { |
| | | int currentColor = mColors.get(Math.abs(position) % mColors.size()); |
| | | int nextColor = mColors.get(Math.abs(position + 1) % mColors.size()); |
| | | int color = ArgbEvaluatorHolder.eval(positionOffset, currentColor, nextColor); |
| | | mPaint.setColor(color); |
| | | } |
| | | |
| | | // 计算锚点位置 |
| | | PositionData current = FragmentContainerHelper.getImitativePositionData(mPositionDataList, position); |
| | | PositionData next = FragmentContainerHelper.getImitativePositionData(mPositionDataList, position + 1); |
| | | |
| | | float leftX; |
| | | float nextLeftX; |
| | | float rightX; |
| | | float nextRightX; |
| | | if (mMode == MODE_MATCH_EDGE) { |
| | | leftX = current.mLeft + mXOffset; |
| | | nextLeftX = next.mLeft + mXOffset; |
| | | rightX = current.mRight - mXOffset; |
| | | nextRightX = next.mRight - mXOffset; |
| | | } else if (mMode == MODE_WRAP_CONTENT) { |
| | | leftX = current.mContentLeft + mXOffset; |
| | | nextLeftX = next.mContentLeft + mXOffset; |
| | | rightX = current.mContentRight - mXOffset; |
| | | nextRightX = next.mContentRight - mXOffset; |
| | | } else { // MODE_EXACTLY |
| | | leftX = current.mLeft + (current.width() - mLineWidth) / 2; |
| | | nextLeftX = next.mLeft + (next.width() - mLineWidth) / 2; |
| | | rightX = current.mLeft + (current.width() + mLineWidth) / 2; |
| | | nextRightX = next.mLeft + (next.width() + mLineWidth) / 2; |
| | | } |
| | | |
| | | mLineRect.left = leftX + (nextLeftX - leftX) * mStartInterpolator.getInterpolation(positionOffset); |
| | | mLineRect.right = rightX + (nextRightX - rightX) * mEndInterpolator.getInterpolation(positionOffset); |
| | | mLineRect.top = getHeight() - mLineHeight - mYOffset; |
| | | mLineRect.bottom = getHeight() - mYOffset; |
| | | |
| | | invalidate(); |
| | | } |
| | | |
| | | @Override |
| | | public void onPageSelected(int position) { |
| | | } |
| | | |
| | | @Override |
| | | public void onPageScrollStateChanged(int state) { |
| | | } |
| | | |
| | | @Override |
| | | public void onPositionDataProvide(List<PositionData> dataList) { |
| | | mPositionDataList = dataList; |
| | | } |
| | | |
| | | public float getYOffset() { |
| | | return mYOffset; |
| | | } |
| | | |
| | | public void setYOffset(float yOffset) { |
| | | mYOffset = yOffset; |
| | | } |
| | | |
| | | public float getXOffset() { |
| | | return mXOffset; |
| | | } |
| | | |
| | | public void setXOffset(float xOffset) { |
| | | mXOffset = xOffset; |
| | | } |
| | | |
| | | public float getLineHeight() { |
| | | return mLineHeight; |
| | | } |
| | | |
| | | public void setLineHeight(float lineHeight) { |
| | | mLineHeight = lineHeight; |
| | | } |
| | | |
| | | public float getLineWidth() { |
| | | return mLineWidth; |
| | | } |
| | | |
| | | public void setLineWidth(float lineWidth) { |
| | | mLineWidth = lineWidth; |
| | | } |
| | | |
| | | public float getRoundRadius() { |
| | | return mRoundRadius; |
| | | } |
| | | |
| | | public void setRoundRadius(float roundRadius) { |
| | | mRoundRadius = roundRadius; |
| | | } |
| | | |
| | | public int getMode() { |
| | | return mMode; |
| | | } |
| | | |
| | | public void setMode(int mode) { |
| | | if (mode == MODE_EXACTLY || mode == MODE_MATCH_EDGE || mode == MODE_WRAP_CONTENT) { |
| | | mMode = mode; |
| | | } else { |
| | | throw new IllegalArgumentException("mode " + mode + " not supported."); |
| | | } |
| | | } |
| | | |
| | | public Paint getPaint() { |
| | | return mPaint; |
| | | } |
| | | |
| | | public List<Integer> getColors() { |
| | | return mColors; |
| | | } |
| | | |
| | | public void setColors(Integer... colors) { |
| | | mColors = Arrays.asList(colors); |
| | | } |
| | | |
| | | public Interpolator getStartInterpolator() { |
| | | return mStartInterpolator; |
| | | } |
| | | |
| | | public void setStartInterpolator(Interpolator startInterpolator) { |
| | | mStartInterpolator = startInterpolator; |
| | | if (mStartInterpolator == null) { |
| | | mStartInterpolator = new LinearInterpolator(); |
| | | } |
| | | } |
| | | |
| | | public Interpolator getEndInterpolator() { |
| | | return mEndInterpolator; |
| | | } |
| | | |
| | | public void setEndInterpolator(Interpolator endInterpolator) { |
| | | mEndInterpolator = endInterpolator; |
| | | if (mEndInterpolator == null) { |
| | | mEndInterpolator = new LinearInterpolator(); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | private final int TYPE_BANNER = 1; |
| | | private final int TYPE_CIRCLE_CONTENT = 2; |
| | | private Integer maxImgHeight = null; |
| | | private TextViewUtil.URLClickListener mUrlClickListener; |
| | | |
| | | private DisplayImageOptions options; |
| | | |
| | |
| | | }; |
| | | |
| | | |
| | | public SendCircleAdapter(Activity activity, List<HomeBanner> mBannerList, List<SendCircleContent> mContentList, AdapterEventActionListener actionListener) { |
| | | public SendCircleAdapter(Activity activity, List<HomeBanner> mBannerList, List<SendCircleContent> mContentList, AdapterEventActionListener actionListener, TextViewUtil.URLClickListener urlClickListener) { |
| | | this.mContext = activity; |
| | | this.mBannerList = mBannerList; |
| | | this.mContentList = mContentList; |
| | | this.mUrlClickListener = urlClickListener; |
| | | inflater = LayoutInflater.from(mContext); |
| | | this.adapterEventActionListener = actionListener; |
| | | this.options = new DisplayImageOptions.Builder() |
| | |
| | | } |
| | | }); |
| | | |
| | | circleContentHolder.tv_recommend.setMaxLines(8); |
| | | |
| | | circleContentHolder.tv_recommend.setText(TextViewUtil.getClickableHtml(Html.fromHtml(circleContent.getTitle(), imageGetter, null), mContext, Color.parseColor("#586b95"))); |
| | | circleContentHolder.tv_recommend.setMaxLines(6); |
| | | circleContentHolder.tv_recommend.setMovementMethod(LinkMovementMethod.getInstance()); |
| | | circleContentHolder.tv_recommend.setText(TextViewUtil.getClickableHtml(Html.fromHtml(circleContent.getTitle(), imageGetter, null), mContext, Color.parseColor("#586b95"), mUrlClickListener)); |
| | | |
| | | |
| | | circleContentHolder.tv_recommend.post(new Runnable() { |
| | |
| | | if (l != null) { |
| | | int lines = l.getLineCount(); |
| | | if (lines > 0) { |
| | | if (l.getEllipsisCount(lines - 1) > 0) { |
| | | if (lines > circleContentHolder.tv_recommend.getMaxLines()) { |
| | | circleContentHolder.iv_recommend_more.setVisibility(View.VISIBLE); |
| | | } else { |
| | | circleContentHolder.iv_recommend_more.setVisibility(View.GONE); |
| | |
| | | } else { |
| | | holder.ll_content.setVisibility(View.VISIBLE); |
| | | String content = comment.getContent(); |
| | | content += "<img src='icon_common_emoji_link' /> <a href='test:http://www.baidu.com'>这是个可以点击的链接</a> 测试12312312123"; |
| | | holder.tv_content.setText(TextViewUtil.getClickableHtml(Html.fromHtml(content, imageGetter, null), context, Color.parseColor("#586b95"))); |
| | | |
| | | holder.tv_content.setMovementMethod(LinkMovementMethod.getInstance()); |
| | | holder.tv_content.setFocusable(false); |
| | | holder.tv_content.setClickable(false); |
| | | holder.tv_content.setLongClickable(false); |
| | | holder.tv_content.setText(TextViewUtil.getClickableHtml(Html.fromHtml(content, imageGetter, null), context, Color.parseColor("#586b95"), mUrlClickListener)); |
| | | } |
| | | |
| | | holder.tv_content.setMaxLines(6); |
| | |
| | | if (l != null) { |
| | | int lines = l.getLineCount(); |
| | | if (lines > 0) { |
| | | if (l.getEllipsisCount(lines - 1) > 0) { |
| | | if (lines > holder.tv_content.getMaxLines()) { |
| | | holder.iv_comment_more.setVisibility(View.VISIBLE); |
| | | |
| | | } else { |
| | |
| | | } |
| | | } |
| | | if (adapter == null) { |
| | | adapter = new SendCircleAdapter(getActivity(), mBannerList, mContentList, SendCircleFragmet.this); |
| | | adapter = new SendCircleAdapter(getActivity(), mBannerList, mContentList, SendCircleFragmet.this,null); |
| | | rv_send_circle.setRecycledViewPool(new RecyclerView.RecycledViewPool()); |
| | | rv_send_circle.setAdapter(adapter); |
| | | initLoadingView(); |
New file |
| | |
| | | package com.tejia.lijin.app.util; |
| | | |
| | | /** |
| | | * 异常常量 |
| | | */ |
| | | public class ExceptionConstant { |
| | | |
| | | //未登录 |
| | | public final static int CODE_NOT_LOGIN = 1; |
| | | |
| | | //拼多多未授权 |
| | | public final static int CODE_AUTH_PDD_NO_AUTH = 20010; |
| | | |
| | | //淘宝未授权 |
| | | public final static int CODE_AUTH_TAOBAO_NO_AUTH = 20011; |
| | | |
| | | //不支持的跳转 |
| | | public final static int CODE_JUMP_NO_SUPPORT = 50001; |
| | | |
| | | //商品下线 |
| | | public final static int CODE_GOODS_OFFLINE = 40001; |
| | | |
| | | |
| | | } |
| | |
| | | if (status == OpenAppAction.OpenAppAction_result_APP) { |
| | | //呼京东成功 |
| | | Log.e("mResult", "呼京东成功"); |
| | | dialog.dismiss(); |
| | | if (dialog != null) |
| | | dialog.dismiss(); |
| | | } else if (status == OpenAppAction.OpenAppAction_start) { |
| | | //开始状态未必一定执行, |
| | | Log.e("mResult", "开始呼起京东"); |
| | |
| | | intent.putExtra("url", url); |
| | | intent.putExtra("interceptGoodsDetail", false); |
| | | view.getContext().startActivity(intent); |
| | | if (dialog != null) |
| | | dialog.dismiss(); |
| | | } |
| | | } |
| | |
| | | SpannableStringBuilder clickableHtmlBuilder = new SpannableStringBuilder(spannedHtml); |
| | | URLSpan[] urls = clickableHtmlBuilder.getSpans(0, spannedHtml.length(), URLSpan.class); |
| | | for (final URLSpan span : urls) { |
| | | setLinkClickable(clickableHtmlBuilder, span, context, color); |
| | | setLinkClickable(clickableHtmlBuilder, span, context, color, null); |
| | | } |
| | | return clickableHtmlBuilder; |
| | | } |
| | |
| | | SpannableStringBuilder clickableHtmlBuilder = new SpannableStringBuilder(spannedHtml); |
| | | URLSpan[] urls = clickableHtmlBuilder.getSpans(0, spannedHtml.length(), URLSpan.class); |
| | | for (final URLSpan span : urls) { |
| | | setLinkClickable(clickableHtmlBuilder, span, context, color); |
| | | setLinkClickable(clickableHtmlBuilder, span, context, color, null); |
| | | } |
| | | return clickableHtmlBuilder; |
| | | } |
| | | |
| | | public static CharSequence getClickableHtml(Spanned spannedHtml, Context context, Integer color, URLClickListener urlClickListener) { |
| | | SpannableStringBuilder clickableHtmlBuilder = new SpannableStringBuilder(spannedHtml); |
| | | URLSpan[] urls = clickableHtmlBuilder.getSpans(0, spannedHtml.length(), URLSpan.class); |
| | | for (final URLSpan span : urls) { |
| | | setLinkClickable(clickableHtmlBuilder, span, context, color, urlClickListener); |
| | | } |
| | | return clickableHtmlBuilder; |
| | | } |
| | |
| | | /** |
| | | * 设置点击超链接对应的处理内容 |
| | | */ |
| | | private static void setLinkClickable(final SpannableStringBuilder clickableHtmlBuilder, final URLSpan urlSpan, final Context context, final Integer linkColor) { |
| | | private static void setLinkClickable(final SpannableStringBuilder clickableHtmlBuilder, final URLSpan urlSpan, final Context context, final Integer linkColor, final URLClickListener urlClickListener) { |
| | | int start = clickableHtmlBuilder.getSpanStart(urlSpan); |
| | | int end = clickableHtmlBuilder.getSpanEnd(urlSpan); |
| | | int flags = clickableHtmlBuilder.getSpanFlags(urlSpan); |
| | | |
| | | clickableHtmlBuilder.setSpan( new ClickableSpan() { |
| | | clickableHtmlBuilder.setSpan(new ClickableSpan() { |
| | | public void onClick(View view) { |
| | | context.startActivity(new Intent(context, ShareBrowserActivity.class).putExtra("url", urlSpan.getURL())); |
| | | if (urlClickListener != null) { |
| | | urlClickListener.onClick(urlSpan.getURL()); |
| | | } else { |
| | | context.startActivity(new Intent(context, ShareBrowserActivity.class).putExtra("url", urlSpan.getURL())); |
| | | } |
| | | } |
| | | |
| | | public void updateDrawState(TextPaint ds) { |
| | |
| | | ds.clearShadowLayer(); |
| | | } |
| | | }, start, end, flags); |
| | | //防止点击事件不响应 |
| | | clickableHtmlBuilder.removeSpan(urlSpan); |
| | | } |
| | | |
| | | |
| | | public static interface URLClickListener { |
| | | |
| | | public void onClick(String url); |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:gravity="center_vertical" |
| | | android:paddingLeft="2dp"> |
| | | android:gravity="center_vertical"> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_title" |