| | |
| | | } |
| | | |
| | | |
| | | |
| | | defaultConfig { |
| | | applicationId "com.tejia.lijin" |
| | | minSdkVersion 17 |
| | |
| | | project.afterEvaluate { |
| | | project.android.applicationVariants.all { variant -> |
| | | variant.outputs.each { output -> |
| | | output.processResources.doFirst { pm-> |
| | | output.processResources.doFirst { pm -> |
| | | String manifestPath = output.processResources.manifestFile; |
| | | def manifestContent = file(manifestPath).getText() |
| | | //删除注释,防止注释里面的中文乱码导致更改后的内容系统无法正常解析 |
| | | manifestContent=manifestContent.replaceAll("<!--[\\s\\S]*?-->","") |
| | | manifestContent = manifestContent.replaceAll("<!--[\\s\\S]*?-->", "") |
| | | manifestContent = manifestContent.replace('<uses-permission android:name="android.permission.CAMERA" />', '') |
| | | manifestContent = manifestContent.replace('<uses-permission android:name="android.permission.BLUETOOTH" />', '') |
| | | |
| | |
| | | // implementation project(':social_sdk_library_project') |
| | | implementation 'androidx.multidex:multidex:2.0.0' |
| | | api files('libs/tbs_sdk_thirdapp_v2.4.0.1073_36840_sharewithdownload_obfs_20161011_194834.jar') |
| | | |
| | | //QQ登录 |
| | | implementation files('libs/open_sdk_3.5.4.11_r3f56456_lite.jar') |
| | | |
| | | //阿里云手机号认证 |
| | | implementation files('libs/crashshield-2.0.0-release.aar') |
| | |
| | | implementation 'com.google.android.material:material:1.0.0' |
| | | |
| | | |
| | | compile 'com.github.wendux:DSBridge-Android:3.0-SNAPSHOT' |
| | | implementation 'com.github.wendux:DSBridge-Android:3.0-SNAPSHOT' |
| | | //support the x5 browser core of tencent |
| | | compile 'com.github.wendux:DSBridge-Android:x5-3.0-SNAPSHOT' |
| | | implementation 'com.github.wendux:DSBridge-Android:x5-3.0-SNAPSHOT' |
| | | |
| | | compile 'com.wang.avi:library:2.1.3' |
| | | implementation 'com.wang.avi:library:2.1.3' |
| | | |
| | | |
| | | } |
| | |
| | | android:screenOrientation="portrait" /> |
| | | |
| | | |
| | | <activity |
| | | android:name="com.tejia.lijin.wxapi.WXEntryActivity" |
| | | android:exported="true" |
| | | android:label="@string/app_name" |
| | | android:launchMode="singleTop" |
| | | android:taskAffinity="net.sourceforge.simcpux" |
| | | android:theme="@android:style/Theme.Translucent.NoTitleBar" /> |
| | | |
| | | <!-- Umeng key --> |
| | | <meta-data |
| | | android:name="UMENG_APPKEY" |
| | |
| | | |
| | | <!-- 穿山甲广告结束 --> |
| | | |
| | | <!-- 阿里云一键登录 --> |
| | | |
| | | <!--联通电信授权⻚开始--> |
| | | <activity |
| | | android:name="com.mobile.auth.gatewayauth.LoginAuthActivity" |
| | | android:configChanges="orientation|keyboardHidden|screenSize" |
| | | android:exported="false" |
| | | android:launchMode="singleTop" |
| | | android:theme="@style/authsdk_activity_dialog" /> |
| | | <!--协议⻚⾯webview--> |
| | | <activity |
| | | android:name="com.mobile.auth.gatewayauth.activity.AuthWebVeiwActivity" |
| | | android:configChanges="orientation|keyboardHidden|screenSize" |
| | | android:exported="false" |
| | | android:launchMode="singleTop" |
| | | android:screenOrientation="behind" /> |
| | | <!--移动授权⻚--> |
| | | <activity |
| | | android:name="com.cmic.sso.sdk.activity.LoginAuthActivity" |
| | | android:configChanges="orientation|keyboardHidden|screenSize" |
| | | android:exported="false" |
| | | android:launchMode="singleTop" /> |
| | | |
| | | |
| | | <!-- QQ登录开始 --> |
| | | <activity |
| | | android:name="com.tencent.tauth.AuthActivity" |
| | | android:launchMode="singleTask" |
| | | android:noHistory="true"> |
| | | <intent-filter> |
| | | <action android:name="android.intent.action.VIEW" /> |
| | | |
| | | <category android:name="android.intent.category.DEFAULT" /> |
| | | <category android:name="android.intent.category.BROWSABLE" /> |
| | | |
| | | <data android:scheme="tencent1111732008" /> |
| | | </intent-filter> |
| | | </activity> |
| | | <activity |
| | | android:name="com.tencent.connect.common.AssistActivity" |
| | | android:configChanges="orientation|keyboardHidden" |
| | | android:screenOrientation="behind" |
| | | android:theme="@android:style/Theme.Translucent.NoTitleBar" /> |
| | | <!-- QQ登录结束 --> |
| | | |
| | | </application> |
| | | |
| | | </manifest> |
| | |
| | | |
| | | public class BuXinConstant { |
| | | |
| | | // public static final String HOST = "http://192.168.1.122:8080";//内网测试 |
| | | public static final String HOST = "http://192.168.3.122:8080";//内网测试 |
| | | // public static final String HOST = "http://192.168.1.253:8080";//内网测试 |
| | | // public static final String HOST = "http://192.168.1.200:8088";//内网测试 |
| | | // public static final String HOST = "http://111.231.250.166:8082";//外网测试 |
| | | public static final String HOST = "http://api.fanliunion.yeshitv.com";//外网正式 |
| | | // public static final String HOST = "http://api.fanliunion.yeshitv.com";//外网正式 |
| | | |
| | | public static boolean isPushMsg = false; |
| | | |
| | |
| | | commonPostWithFailture(context, BASE_URL + "user/bindWeiXin", params, handler); |
| | | } |
| | | |
| | | |
| | | public static void bindQQ(Context context, Long uid, String qqUser, |
| | | BasicTextHttpResponseHandler handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | if (uid != null) params.put("uid", uid + ""); |
| | | params.put("qqUser", qqUser); |
| | | commonPostWithFailture(context, BASE_URL + "user/bindQQ", params, handler); |
| | | } |
| | | |
| | | /** |
| | | * app更新 |
| | | * |
| | |
| | | * @param context vcode短信验证码 phone电话号码 code微信登录的code |
| | | * @param handler loginType 1电话 2微信 |
| | | */ |
| | | public static void loginNew(Context context, String vcode, String phone, String code, String loginType, BasicTextHttpResponseHandler handler) { |
| | | public static void loginNew(Context context, String vcode, String phone, String code, String loginType, String accessToken, String qqUser, BasicTextHttpResponseHandler handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("vcode", vcode); |
| | | params.put("phone", phone); |
| | | params.put("code", code); |
| | | if (vcode != null) |
| | | params.put("vcode", vcode); |
| | | if (phone != null) |
| | | params.put("phone", phone); |
| | | if (code != null) |
| | | params.put("code", code); |
| | | params.put("loginType", loginType); |
| | | if (accessToken != null) { |
| | | params.put("aliAccessToken", accessToken); |
| | | } |
| | | |
| | | if (qqUser != null) { |
| | | params.put("qqUser", qqUser); |
| | | } |
| | | |
| | | commonPostWithFailture(context, BASE_URL2 + "user/login", params, handler); |
| | | } |
| | | |
| | |
| | | * @param context vcode短信验证码 phone电话号码 code微信登录的code |
| | | * @param handler loginType 1电话 2微信 |
| | | */ |
| | | public static void bindPhoneNew(Context context, String vcode, String phone, Long uid, BasicTextHttpResponseHandler handler) { |
| | | public static void bindPhoneNew(Context context, String vcode, String phone, String accessToken, Long uid, BasicTextHttpResponseHandler handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<>(); |
| | | params.put("vcode", vcode); |
| | | params.put("phone", phone); |
| | | if (vcode != null) |
| | | params.put("vcode", vcode); |
| | | if (phone != null) |
| | | params.put("phone", phone); |
| | | if (accessToken != null) |
| | | params.put("aliAccessToken", accessToken); |
| | | if (uid != null) params.put("uid", uid + ""); |
| | | commonPostWithFailture(context, BASE_URL + "user/bindPhoneNew", params, handler); |
| | | } |
| | | |
| | | |
| | | public static void bindPhoneWithOutLogin(Context context, String vcode, String phone, String key, BasicTextHttpResponseHandler handler) { |
| | | public static void bindPhoneWithOutLogin(Context context, String vcode, String phone, String accessToken, String key, BasicTextHttpResponseHandler handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<>(); |
| | | params.put("vcode", vcode); |
| | | params.put("phone", phone); |
| | | if (vcode != null) |
| | | params.put("vcode", vcode); |
| | | if (phone != null) |
| | | params.put("phone", phone); |
| | | params.put("key", key); |
| | | if (accessToken != null) |
| | | params.put("aliAccessToken", accessToken); |
| | | commonPostWithFailture(context, BASE_URL2 + "user/bindPhoneLogin", params, handler); |
| | | } |
| | | |
| | |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | if (uid != null) params.put("uid", uid + ""); |
| | | params.put("auctionId", goodsId); |
| | | params.put("from", from); |
| | | if (from != null) |
| | | params.put("from", from); |
| | | if (!StringUtils.isEmpty(source)) |
| | | params.put("source", source); |
| | | commonPostWithFailture(context, BASE_URL + "goods/gettaobaolink", params, handler); |
| | |
| | | |
| | | |
| | | /** |
| | | * 获取用户礼金的创建信息 |
| | | * |
| | | * @param context |
| | | * @param goodsId |
| | | * @param goodsType |
| | | * @param lijinId |
| | | * @param uid |
| | | * @param from |
| | | * @param handler |
| | | */ |
| | | public static void getUserLijinCreatedInfo(Context context, String goodsId, Integer goodsType, Long uid, |
| | | BasicTextHttpResponseHandler handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<>(); |
| | | if (goodsId != null) |
| | | params.put("goodsId", goodsId); |
| | | if (goodsType != null) |
| | | params.put("goodsType", goodsType + ""); |
| | | if (uid != null) params.put("uid", uid + ""); |
| | | commonPostWithFailture(context, BuXinConstant.HOST + "/fanli/api/lijin/user/getUserLijinCreatedInfo", params, handler); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取礼金的用户等级 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param handler |
| | | */ |
| | | public static void getLijinUserLevel(Context context, Long uid, |
| | | BasicTextHttpResponseHandler handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<>(); |
| | | if (uid != null) params.put("uid", uid + ""); |
| | | commonPostWithFailture(context, BuXinConstant.HOST + "/fanli/api/lijin/user/getUserLevel", params, handler); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 淘宝获取商品信息1.3.9 |
| | | * |
| | | * @param context id 商品ID |
| | |
| | | import com.qq.e.comm.managers.GDTADManager; |
| | | import com.tejia.lijin.app.util.Constant; |
| | | import com.tencent.mm.opensdk.openapi.IWXAPI; |
| | | import com.tencent.mm.opensdk.openapi.WXAPIFactory; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.umeng.commonsdk.UMConfigure; |
| | | import com.wpc.library.util.NetUtils; |
| | |
| | | |
| | | PushUtil.inintPush(this); |
| | | ToolUtil.thirdPartySDK();//初始化第三方SDK |
| | | initWX(); |
| | | if (NetUtils.isNetConnected(getApplicationContext())) { |
| | | initJd(this); |
| | | } else { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 初始化微信SDK |
| | | */ |
| | | private static void initWX() { |
| | | //AppConst.WEIXIN.APP_ID是指你应用在微信开放平台上的AppID,记得替换。 |
| | | ShoppingApplication.application.mWxApi = WXAPIFactory.createWXAPI(ShoppingApplication.application, Constant.WX_APP_ID, false); |
| | | // 将该app注册到微信 |
| | | ShoppingApplication.application.mWxApi.registerApp(Constant.WX_APP_ID); |
| | | } |
| | | |
| | | /** |
| | | * 反射 禁止弹窗 |
| | | */ |
| | | private void disableAPIDialog() { |
New file |
| | |
| | | package com.tejia.lijin.app.entity.user; |
| | | |
| | | public class UserLijinLevelInfoVO { |
| | | //当前的等级 |
| | | private String userLevel; |
| | | //升级权益 |
| | | private UpgradeRights upgradeRights; |
| | | //加载广告信息 |
| | | private ADInfo loadingAdInfo; |
| | | |
| | | |
| | | public String getUserLevel() { |
| | | return userLevel; |
| | | } |
| | | |
| | | public void setUserLevel(String userLevel) { |
| | | this.userLevel = userLevel; |
| | | } |
| | | |
| | | public UpgradeRights getUpgradeRights() { |
| | | return upgradeRights; |
| | | } |
| | | |
| | | public void setUpgradeRights(UpgradeRights upgradeRights) { |
| | | this.upgradeRights = upgradeRights; |
| | | } |
| | | |
| | | public ADInfo getLoadingAdInfo() { |
| | | return loadingAdInfo; |
| | | } |
| | | |
| | | public void setLoadingAdInfo(ADInfo loadingAdInfo) { |
| | | this.loadingAdInfo = loadingAdInfo; |
| | | } |
| | | |
| | | public static class ADInfo { |
| | | //csj gdt2 |
| | | private String type; |
| | | private String pid; |
| | | |
| | | public ADInfo(String type, String pid) { |
| | | this.type = type; |
| | | this.pid = pid; |
| | | } |
| | | |
| | | public String getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(String type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getPid() { |
| | | return pid; |
| | | } |
| | | |
| | | public void setPid(String pid) { |
| | | this.pid = pid; |
| | | } |
| | | } |
| | | |
| | | public static class UpgradeRights { |
| | | private String desc; |
| | | private String link; |
| | | |
| | | public UpgradeRights(String desc, String link) { |
| | | this.desc = desc; |
| | | this.link = link; |
| | | } |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | |
| | | public void setDesc(String desc) { |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public String getLink() { |
| | | return link; |
| | | } |
| | | |
| | | public void setLink(String link) { |
| | | this.link = link; |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | private Activity context; |
| | | boolean hasAd; |
| | | String adPid; |
| | | String adType; |
| | | String notifyDesc; |
| | | String notifyUrl; |
| | | int platform; |
| | |
| | | return this; |
| | | } |
| | | |
| | | public Builder setAdPid(String pid) { |
| | | public Builder setAdInfo(String type, String pid) { |
| | | this.adType=type; |
| | | this.adPid = pid; |
| | | return this; |
| | | } |
| | |
| | | } |
| | | }); |
| | | //填充广告 |
| | | new ExpressAdManager(AdUtil.AD_TYPE.gdt2, context).loadGoodsJumpLoadingAd("", new ExpressAdManager.IAdLoadListener() { |
| | | new ExpressAdManager(AdUtil.AD_TYPE.valueOf(adType), context).loadGoodsJumpLoadingAd(adPid, new ExpressAdManager.IAdLoadListener() { |
| | | @Override |
| | | public void onSuccess(List<ExpressAdContainer> adList) { |
| | | if (adList != null && adList.size() > 0) { |
| | |
| | | import com.tejia.lijin.app.util.ad.ExpressAdManager; |
| | | import com.wpc.library.util.SystemCommon; |
| | | import com.wpc.library.util.common.DimenUtils; |
| | | import com.wpc.library.util.common.StringUtils; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | public static class Builder { |
| | | private Activity context; |
| | | IDialogButtonClick dialogButtonClickListener; |
| | | private String btnName; |
| | | private String link; |
| | | |
| | | public Builder(Activity context) { |
| | | this.context = context; |
| | | } |
| | | |
| | | |
| | | public Builder setLeftBtnInfo(String btnName, String link) { |
| | | this.btnName = btnName; |
| | | this.link = link; |
| | | return this; |
| | | } |
| | | |
| | | public Builder setOnButtonClickListener(IDialogButtonClick dialogCloseListener) { |
| | | this.dialogButtonClickListener = dialogCloseListener; |
| | |
| | | final TextView tv_create = mAquery.id(R.id.tv_create).getTextView(); |
| | | final TextView tv_fanli = mAquery.id(R.id.tv_fanli).getTextView(); |
| | | |
| | | if (!StringUtils.isNullOrEmpty(btnName)) { |
| | | tv_create.setVisibility(View.VISIBLE); |
| | | tv_create.setText(btnName); |
| | | } else { |
| | | tv_create.setVisibility(View.GONE); |
| | | tv_create.setText(btnName); |
| | | } |
| | | |
| | | |
| | | GradientDrawable gradientDrawable = new GradientDrawable(); |
| | | gradientDrawable.setStroke(1, Color.parseColor("#F53245")); |
| | | gradientDrawable.setColor(Color.WHITE); |
| | |
| | | tv_create.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | if (!StringUtils.isNullOrEmpty(link)) { |
| | | context.startActivity(new Intent(context, ShareBrowserActivity.class).putExtra("url", link)); |
| | | } |
| | | if (dialogButtonClickListener != null) |
| | | dialogButtonClickListener.onLeftClick(); |
| | | } |
| | |
| | | import com.tejia.lijin.app.ShoppingApplication; |
| | | import com.tejia.lijin.app.entity.common.GoodsConvertLinkJumpLink; |
| | | import com.tejia.lijin.app.entity.goods.GoodsDetailVO; |
| | | import com.tejia.lijin.app.entity.user.UserLijinLevelInfoVO; |
| | | import com.tejia.lijin.app.ui.dialog.ShapeLoadingDialog; |
| | | import com.tejia.lijin.app.ui.mine.LoginSelectActivity; |
| | | import com.tejia.lijin.app.util.Constant; |
| | | import com.tejia.lijin.app.util.GoodsBuyJumpUtil; |
| | | import com.tejia.lijin.app.util.InitAlibcSdk; |
| | | import com.tejia.lijin.app.util.baichuan.AlibcTradeUtil; |
| | | import com.tejia.lijin.app.util.ui.dialog.DialogUtil; |
| | | import com.tejia.lijin.app.util.user.UserUtil; |
| | | import com.wpc.library.util.common.StringUtils; |
| | | |
| | |
| | | private void getTaoBaoH5AuthInfo(final String source, String goodsId, final boolean needJumpAuth, final IAuthResult authResultListener) { |
| | | if (pd == null) |
| | | pd = new ShapeLoadingDialog.Builder(mActivity).build(); |
| | | if (!pd.isShowing()) |
| | | pd.show(); |
| | | DialogUtil.show(pd); |
| | | Log.e("detail", "getTaoBaoH5AuthInfo--" + source); |
| | | ShoppingApi.getTaoBaoAuthInfo(mContext, UserUtil.getUid(ShoppingApplication.application), goodsId, source, true, new BasicTextHttpResponseHandler() { |
| | | @Override |
| | |
| | | if (jsonObject.optInt("code") == 0) { |
| | | final String authLink = jsonObject.optJSONObject("data").getString("authLink"); |
| | | Log.e("detail", "authLink--" + authLink); |
| | | pd.dismiss(); |
| | | if (!StringUtils.isEmpty(authLink)) { |
| | | if (!needJumpAuth) { |
| | | return; |
| | |
| | | } else if (jsonObject.optInt("code") == 1) { |
| | | authResultListener.onSuccess(); |
| | | } else { |
| | | pd.dismiss(); |
| | | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFinish() { |
| | | super.onFinish(); |
| | | DialogUtil.dismiss(pd); |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) { |
| | | super.onFailure(statusCode, headers, responseString, throwable); |
| | | pd.dismiss(); |
| | | Toast.makeText(mContext, "网络请求失败", Toast.LENGTH_SHORT).show(); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public void onStart() { |
| | | super.onStart(); |
| | | if (pd != null && !pd.isShowing()) |
| | | pd.show(); |
| | | |
| | | DialogUtil.show(pd); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public void onFinish() { |
| | | super.onFinish(); |
| | | if (pd != null && pd.isShowing()) |
| | | pd.dismiss(); |
| | | DialogUtil.dismiss(pd); |
| | | } |
| | | }); |
| | | |
| | |
| | | @Override |
| | | public void onStart() { |
| | | super.onStart(); |
| | | if (pd != null && !pd.isShowing()) |
| | | pd.show(); |
| | | DialogUtil.show(pd); |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (jsonObject.optInt("code") == 0) { |
| | | JSONObject data = jsonObject.optJSONObject("data"); |
| | | GoodsConvertLinkJumpLink pddJumpLink = new Gson().fromJson(data.toString(), GoodsConvertLinkJumpLink.class); |
| | | GoodsBuyJumpUtil.jumpPDD(mContext, pddJumpLink); |
| | | UserLijinLevelInfoVO userLevel = null; |
| | | if (data.optJSONObject("userLevel") != null) { |
| | | userLevel = new Gson().fromJson(data.optJSONObject("userLevel").toString(), UserLijinLevelInfoVO.class); |
| | | } |
| | | GoodsBuyJumpUtil.jumpPDD(mActivity, pddJumpLink, userLevel); |
| | | } else { |
| | | Toast.makeText(mContext, jsonObject.optString("msg"), Toast.LENGTH_SHORT).show(); |
| | | } |
| | |
| | | @Override |
| | | public void onFinish() { |
| | | super.onFinish(); |
| | | if (pd != null && pd.isShowing()) |
| | | pd.dismiss(); |
| | | DialogUtil.dismiss(pd); |
| | | } |
| | | }); |
| | | } |
| | |
| | | setContentView(R.layout.browser_activity); |
| | | AndroidBug5497Workaround.assistActivity(this); |
| | | TopStatusSettings.setStatusViewAndDeepColor(this); |
| | | String url = "http://192.168.3.122:8848/tejia-web/dsbridge-test.html";//getIntent().getStringExtra("url"); |
| | | String url = getIntent().getStringExtra("url"); |
| | | originalUrl = url; |
| | | //是否允许粘贴板推荐 |
| | | String clipboradStr = getIntent().getStringExtra("clipboard"); |
| | |
| | | |
| | | public class MineFragment extends RetainViewFragment implements View.OnClickListener, PermissionInterface { |
| | | private TextView tv_user_num; |
| | | private ImageView iv_portrait; |
| | | private ImageView iv_portrait, iv_rank; |
| | | private TextView tv_nickName; |
| | | |
| | | //用户昵称与邀请码 |
| | |
| | | .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); |
| | | |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | initUserView(); |
| | | getUserConfig(); |
| | | getLijinUserLevel(); |
| | | getUnReadMsgCount(UserUtil.getUid(getContext())); |
| | | MobclickAgent.onPageStart("我的"); |
| | | SharedPreferences sp = tv_nickName.getContext().getSharedPreferences("user", MODE_PRIVATE); |
| | | if (sp.getBoolean("isLogin", false)) { |
| | | 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); |
| | | Long uid = UserUtil.getUid(ShoppingApplication.application); |
| | | if (lastTime > 0 && (System.currentTimeMillis() - lastTime > 30 * 1000)) { |
| | | clickState = 0; |
| | | } |
| | | if (uid != null) { |
| | | 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", ""); |
| | | |
| | | 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; |
| | | } |
| | |
| | | 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秒不进入 |
| | |
| | | }); |
| | | } |
| | | |
| | | |
| | | 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(); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 我的信息-提醒记录 |
| | | * |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.tejia.lijin.app.util.ui.dialog.DialogUtil; |
| | | import com.tejia.lijin.app.util.user.LoginManager; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.wpc.library.util.GetManifestDataUtil; |
| | | import com.wpc.library.util.common.StringUtils; |
| | |
| | | } |
| | | loginPhone(); |
| | | } |
| | | break; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | private void loginPhone() { |
| | | ShoppingApi.loginNew(getApplicationContext(), et_code.getText() + "", et_phone.getText() + "", "", "1", new BasicTextHttpResponseHandler() { |
| | | LoginManager.loginByPhone(et_phone.getText() + "", et_code.getText() + "", null, new LoginManager.LoginAndBindListener() { |
| | | @Override |
| | | public void onStart() { |
| | | super.onStart(); |
| | | if (!pd.isShowing()) |
| | | pd.show(); |
| | | public void onLoginStart() { |
| | | super.onLoginStart(); |
| | | DialogUtil.show(pd); |
| | | } |
| | | |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | if (jsonObject.optString("code").equalsIgnoreCase("0")) { |
| | | Gson gson = new GsonBuilder().serializeNulls().create(); |
| | | JSONObject data = jsonObject.optJSONObject("data"); |
| | | final UserInfo info = gson.fromJson(data.optJSONObject("userInfo").toString(), new TypeToken<UserInfo>() { |
| | | }.getType()); |
| | | SharedPreferences sp = 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.commit(); |
| | | |
| | | MiPushClient.setAlias(getApplicationContext(), info.getId(), null); |
| | | |
| | | //保存邀请码 |
| | | String inviteCode = data.optString("inviteCode"); |
| | | UserUtil.setInviteCode(getApplicationContext(), inviteCode); |
| | | Toast.makeText(getApplicationContext(), "恭喜你,登录成功", Toast.LENGTH_SHORT).show(); |
| | | setResult(100); |
| | | finish(); |
| | | } else { |
| | | Toast.makeText(getApplicationContext(), jsonObject.optString("msg"), Toast.LENGTH_SHORT).show(); |
| | | } |
| | | public void onLoginFinish() { |
| | | super.onLoginFinish(); |
| | | DialogUtil.dismiss(pd); |
| | | } |
| | | |
| | | @Override |
| | | public void onFinish() { |
| | | super.onFinish(); |
| | | if (pd.isShowing()) |
| | | pd.dismiss(); |
| | | public void onLoginSuccess(UserInfo user) { |
| | | super.onLoginSuccess(user); |
| | | UserUtil.loginSuccess(getApplicationContext(), user); |
| | | setResult(100); |
| | | finish(); |
| | | } |
| | | |
| | | @Override |
| | | public void onLoginFail(int code, String msg) { |
| | | super.onLoginFail(code, msg); |
| | | Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show(); |
| | | } |
| | | }); |
| | | |
| | |
| | | package com.tejia.lijin.app.ui.mine; |
| | | |
| | | import android.app.Activity; |
| | | import android.content.DialogInterface; |
| | | import android.content.Intent; |
| | | import android.content.SharedPreferences; |
| | | import android.graphics.Color; |
| | | import android.os.Bundle; |
| | | import android.text.Editable; |
| | | import android.text.TextWatcher; |
| | | import android.util.Log; |
| | | import android.view.View; |
| | | import android.widget.FrameLayout; |
| | | import android.view.animation.AnimationUtils; |
| | | import android.widget.ImageView; |
| | | import android.widget.LinearLayout; |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.androidquery.AQuery; |
| | | import com.mobile.auth.gatewayauth.AuthUIConfig; |
| | | import com.mobile.auth.gatewayauth.PhoneNumberAuthHelper; |
| | | import com.mobile.auth.gatewayauth.TokenResultListener; |
| | | import com.tejia.lijin.app.util.user.AliyunSmsOneKeyLoginManager; |
| | | import com.tencent.mm.opensdk.modelmsg.SendAuth; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.wpc.library.util.common.DimenUtils; |
| | | import com.wpc.library.util.common.StringUtils; |
| | | import com.wpc.library.widget.PhoneNumberClearEditText; |
| | | import com.google.gson.Gson; |
| | | 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.UserInfo; |
| | | import com.tejia.lijin.app.entity.eventbus.WXLoginEvent; |
| | | import com.tejia.lijin.app.ui.BaseActivity; |
| | | import com.tejia.lijin.app.ui.dialog.AddZFBInfoDialog; |
| | | import com.tejia.lijin.app.ui.dialog.ShapeLoadingDialog; |
| | | import com.tejia.lijin.app.ui.dialog.VerifyMobileDialog; |
| | | import com.tejia.lijin.app.ui.invite.ShareBrowserActivity; |
| | | import com.tejia.lijin.app.util.Constant; |
| | | import com.tejia.lijin.app.util.KeFuUtil; |
| | | import com.tejia.lijin.app.util.TopStatusSettings; |
| | | import com.tejia.lijin.app.util.ui.dialog.DialogUtil; |
| | | import com.tejia.lijin.app.util.umengCustomEvent.UserCustomEvent; |
| | | import com.tejia.lijin.app.util.user.AccountBindManager; |
| | | import com.tejia.lijin.app.util.user.AliyunSmsOneKeyLoginManager; |
| | | import com.tejia.lijin.app.util.user.LoginManager; |
| | | import com.tejia.lijin.app.util.user.QQLoginManager; |
| | | import com.tejia.lijin.app.util.user.UserUtil; |
| | | import com.tejia.lijin.wxapi.WXEntryActivity; |
| | | import com.tencent.connect.auth.QQToken; |
| | | import com.tencent.mm.opensdk.modelmsg.SendAuth; |
| | | import com.tencent.tauth.DefaultUiListener; |
| | | import com.tencent.tauth.IUiListener; |
| | | import com.tencent.tauth.Tencent; |
| | | import com.tencent.tauth.UiError; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.wpc.library.util.SingleToast; |
| | | import com.wpc.library.util.common.StringUtils; |
| | | import com.wpc.library.widget.PhoneNumberClearEditText; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONException; |
| | | import org.json.JSONObject; |
| | | |
| | | import de.greenrobot.event.EventBus; |
| | |
| | | * Created by weikou2015 on 2017/12/15. |
| | | */ |
| | | |
| | | public class LoginSelectActivity extends Activity implements View.OnClickListener { |
| | | public class LoginSelectActivity extends BaseActivity implements View.OnClickListener { |
| | | |
| | | public final static int TYPE_LOGIN = 1;//登录 |
| | | public final static int TYPE_BIND = 2;//绑定 |
| | |
| | | String from = getIntent().getStringExtra("from"); |
| | | UserCustomEvent.userLogin(this, StringUtils.isEmpty(from) ? "其它" : from); |
| | | EventBus.getDefault().register(this); |
| | | aliyunSmsOneKeyLoginManager = new AliyunSmsOneKeyLoginManager(this, "zTsQ9uC74C7EsD4h1II3+0CsxtXbz8VikP//49QvybqgZLOsv4pCQ4yW5fz1Ogt4QFuTqHdictmxHm7KvMAd+dl8peJL+xpGFZjjAMcqNkqcSLptS358E+EpbITK4yYjDS1gbQQKuPiODw88UUWlhcCMye7gm3eF9AWNuZ7fQKVONWl/0wube5iXegJ6ZOfhJiYQDZqsKzgmxU/MdPKWOlKCS9NtefDmgCYMM9S6GQODkxPZm+wDqJ89dXMtU5ejBhMMv63t7eug9SfEGfmEnG31JXD9MCQ00t7e8VLeCfanFoZTquLD5w=="); |
| | | |
| | | String secretInfo = "rb6R3o8sx4BVXzip2GLC27gDVtY8EWD3BHYM8dAuvCE1e7Ux/6jHkaZjgOStr/EGvyH0Q2XHZnM6u0tp7mXY3wsHv6+bJaB6hsgzYEu1up3UgmIIrGwNOkDInWe5n6QOnNN+XSc4oF3Od1AJtAgd6oun7JkrbdJCqDN5qTPXF7rS44sYGlh7apz+fJAU9Nn1/Jzt5qdqEWsjmqu07Z3Gasrl+cEeBC9li2+5yqAnnXB+PflFHd/kdN9iCHRuY99qBVUizej95oL/jRMzw4SQKgWDW2PF9llOcSyYWivRGeFAaDISQSmc4g=="; |
| | | aliyunSmsOneKeyLoginManager = new AliyunSmsOneKeyLoginManager(this, secretInfo); |
| | | aliyunSmsOneKeyLoginManager.init(new AliyunSmsOneKeyLoginManager.IOneKeyLoginListener() { |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public void onToken(String token) { |
| | | //获取到Token |
| | | aliyunSmsOneKeyLoginManager.quitLoginPage(); |
| | | //登录 |
| | | if (type == TYPE_LOGIN) { |
| | | LoginManager.loginByPhone(null, null, token, new LoginManager.LoginAndBindListener() { |
| | | @Override |
| | | public void onLoginStart() { |
| | | DialogUtil.show(loadingDialog); |
| | | } |
| | | |
| | | @Override |
| | | public void onLoginFinish() { |
| | | DialogUtil.dismiss(loadingDialog); |
| | | } |
| | | |
| | | @Override |
| | | public void onLoginSuccess(UserInfo user) { |
| | | UserUtil.loginSuccess(getApplicationContext(), user); |
| | | Toast.makeText(getApplicationContext(), "恭喜你,登录成功", Toast.LENGTH_SHORT).show(); |
| | | finish(); |
| | | } |
| | | |
| | | @Override |
| | | public void onLoginFail(int code, String msg) { |
| | | Toast.makeText(LoginSelectActivity.this, msg, Toast.LENGTH_SHORT).show(); |
| | | } |
| | | }); |
| | | } else if (type == TYPE_BIND_WITHOUT_LOGINED) { |
| | | LoginManager.loginWithPhone(null, null, token, key, new LoginManager.LoginAndBindListener() { |
| | | @Override |
| | | public void onBindStart() { |
| | | DialogUtil.show(loadingDialog); |
| | | } |
| | | |
| | | @Override |
| | | public void onBindFinish() { |
| | | DialogUtil.dismiss(loadingDialog); |
| | | } |
| | | |
| | | @Override |
| | | public void onBindSuccess(UserInfo user) { |
| | | UserUtil.loginSuccess(getApplicationContext(), user); |
| | | Toast.makeText(getApplicationContext(), "恭喜你,登录成功", Toast.LENGTH_SHORT).show(); |
| | | finish(); |
| | | } |
| | | |
| | | @Override |
| | | public void onBindFail(int code, String msg) { |
| | | Toast.makeText(LoginSelectActivity.this, msg, Toast.LENGTH_SHORT).show(); |
| | | } |
| | | }); |
| | | } else { |
| | | //电话号码绑定 |
| | | AccountBindManager.bindPhone(getApplicationContext(), null, null, token, new LoginManager.LoginAndBindListener() { |
| | | |
| | | @Override |
| | | public void onBindFail(int code, String msg) { |
| | | super.onBindFail(code, msg); |
| | | if (code == 2) { |
| | | AddZFBInfoDialog.Builder builder = new AddZFBInfoDialog.Builder(LoginSelectActivity.this); |
| | | builder.setTitle("号码已占用提示").setMessage("很抱歉,该手机号已被其他帐号占用," + |
| | | "若要继续完成本帐号手机号更换,请去取消占用或更换其他手机号,谢谢。\n") |
| | | .setPositiveButton("知道了", new DialogInterface.OnClickListener() { |
| | | @Override |
| | | public void onClick(DialogInterface dialog, int which) { |
| | | dialog.dismiss(); |
| | | } |
| | | }).create().show(); |
| | | setResult(100); |
| | | } else { |
| | | Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onBindFinish() { |
| | | super.onBindFinish(); |
| | | } |
| | | |
| | | @Override |
| | | public void onBindStart() { |
| | | super.onBindStart(); |
| | | } |
| | | |
| | | @Override |
| | | public void onBindSuccess(UserInfo user) { |
| | | super.onBindSuccess(user); |
| | | UserUtil.loginSuccess(getApplicationContext(), user); |
| | | Toast.makeText(getApplicationContext(), "绑定成功", Toast.LENGTH_SHORT).show(); |
| | | finish(); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | }); |
| | | |
| | | openOneKeyLogin(showOnkeyLoginToast); |
| | | |
| | | } |
| | | |
| | | private synchronized void openOneKeyLogin(final boolean notify) { |
| | |
| | | tv_user_agreement.setOnClickListener(this); |
| | | tv_other_login.setOnClickListener(this); |
| | | tv_privacy_policies.setOnClickListener(this); |
| | | mAquery.id(R.id.tv_login_onekey).clicked(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | openOneKeyLogin(true); |
| | | } |
| | | }); |
| | | mAquery.id(R.id.iv_close).clicked(this); |
| | | mAquery.id(R.id.tv_login_wx).clicked(this); |
| | | mAquery.id(R.id.tv_login_qq).clicked(this); |
| | | et_mobile_num.addTextChangedListener(new TextWatcher() { |
| | | @Override |
| | | public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { |
| | |
| | | startActivity(intent1); |
| | | break; |
| | | case R.id.tv_login_wx: |
| | | if (!isAgreed()) { |
| | | return; |
| | | } |
| | | UserCustomEvent.userLoginWeixin(LoginSelectActivity.this); |
| | | if (ShoppingApplication.application.mWxApi.isWXAppInstalled()) { |
| | | isWXLogin = true; |
| | |
| | | } |
| | | break; |
| | | case R.id.tv_login_qq: |
| | | //TODO QQ登录 |
| | | if (!isAgreed()) { |
| | | return; |
| | | } |
| | | //QQ登录开始 |
| | | DialogUtil.show(loadingDialog); |
| | | QQLoginManager.getInstance(getApplicationContext()).startLogin(this, new QQLoginManager.QQLoginListener() { |
| | | @Override |
| | | public void onAuthCancel() { |
| | | DialogUtil.dismiss(loadingDialog); |
| | | } |
| | | |
| | | @Override |
| | | public void onAuthSuccess(String openId) { |
| | | } |
| | | |
| | | @Override |
| | | public void onAuthFail(int code, String msg) { |
| | | DialogUtil.dismiss(loadingDialog); |
| | | SingleToast.showToast(getApplicationContext(), "QQ授权失败,请稍后再试"); |
| | | } |
| | | |
| | | @Override |
| | | public void onGetUserInfoSuccess(final QQLoginManager.QQUserInfo user) { |
| | | Log.i(TAG, new Gson().toJson(user)); |
| | | runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | DialogUtil.dismiss(loadingDialog); |
| | | //TODO 做QQ登录 |
| | | LoginManager.loginByQQ(user, new LoginManager.LoginAndBindListener() { |
| | | |
| | | @Override |
| | | public void onLoginStart() { |
| | | super.onLoginStart(); |
| | | DialogUtil.show(loadingDialog); |
| | | } |
| | | |
| | | @Override |
| | | public void onLoginFinish() { |
| | | super.onLoginFinish(); |
| | | DialogUtil.dismiss(loadingDialog); |
| | | } |
| | | |
| | | @Override |
| | | public void onLoginFail(int code, String msg) { |
| | | super.onLoginFail(code, msg); |
| | | Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show(); |
| | | } |
| | | |
| | | @Override |
| | | public void onLoginSuccess(UserInfo user) { |
| | | super.onLoginSuccess(user); |
| | | UserUtil.loginSuccess(getApplicationContext(), user); |
| | | Toast.makeText(getApplicationContext(), "恭喜你,登录成功", Toast.LENGTH_SHORT).show(); |
| | | finish(); |
| | | } |
| | | |
| | | @Override |
| | | public void bindPhone(String key) { |
| | | super.bindPhone(key); |
| | | Intent intent = new Intent(getApplicationContext(), LoginSelectActivity.class); |
| | | intent.putExtra("type", LoginSelectActivity.TYPE_BIND_WITHOUT_LOGINED); |
| | | intent.putExtra("key", key); |
| | | startActivity(intent); |
| | | // finish(); |
| | | } |
| | | |
| | | |
| | | }); |
| | | |
| | | |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onGetUserInfoFail(int code, String msg) { |
| | | runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | SingleToast.showToast(getApplicationContext(), "用户信息获取失败,请稍后再试"); |
| | | DialogUtil.dismiss(loadingDialog); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | }); |
| | | |
| | | |
| | | break; |
| | | case R.id.tv_login_gain_sms: |
| | | if (!isAgreed()) { |
| | | return; |
| | | } |
| | | tv_login_gain_sms.setEnabled(false); |
| | | UserCustomEvent.userLoginSms(LoginSelectActivity.this); |
| | | isWXLogin = false; |
| | |
| | | } |
| | | break; |
| | | |
| | | case R.id.tv_login_onekey: |
| | | //TODO 一键登录 |
| | | openOneKeyLogin(true); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | private boolean isAgreed() { |
| | | if (!mAquery.id(R.id.cb_agree).isChecked()) { |
| | | LinearLayout ll_user_agreement = (LinearLayout) mAquery.id(R.id.ll_user_agreement).getView(); |
| | | ll_user_agreement.startAnimation(AnimationUtils.loadAnimation(this, R.anim.user_agreement)); |
| | | SingleToast.showToast(getApplicationContext(), "请同意用户协议与隐私政策"); |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | private boolean isIntent = false; |
| | |
| | | |
| | | @Override |
| | | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
| | | super.onActivityResult(requestCode, resultCode, data); |
| | | if (requestCode == 99 && resultCode == 100) { |
| | | finish(); |
| | | } |
| | | QQLoginManager.getInstance(getApplicationContext()).onActivityResult(requestCode, resultCode, data); |
| | | super.onActivityResult(requestCode, resultCode, data); |
| | | } |
| | | |
| | | public void onEventMainThread(WXLoginEvent event) { |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.tejia.lijin.app.util.ui.dialog.DialogUtil; |
| | | import com.tejia.lijin.app.util.user.AccountBindManager; |
| | | import com.tejia.lijin.app.util.user.LoginManager; |
| | | import com.xiaomi.mipush.sdk.MiPushClient; |
| | | import com.tejia.lijin.app.BasicTextHttpResponseHandler; |
| | | import com.tejia.lijin.app.R; |
| | |
| | | * 请求服务器匹配验证码后登录 |
| | | */ |
| | | private void loginNew(String code) { |
| | | ShoppingApi.loginNew(LoginVerifyCodeActivity.this, code, mobileNum, "", "1", new BasicTextHttpResponseHandler() { |
| | | |
| | | LoginManager.loginByPhone(mobileNum, code, null, new LoginManager.LoginAndBindListener() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | if (jsonObject.optString("code").equalsIgnoreCase("0")) { |
| | | Gson gson = new GsonBuilder().serializeNulls().create(); |
| | | JSONObject data = jsonObject.optJSONObject("data"); |
| | | final UserInfo info = gson.fromJson(data.optJSONObject("userInfo").toString(), new TypeToken<UserInfo>() { |
| | | }.getType()); |
| | | tv_input_error.setVisibility(View.INVISIBLE); |
| | | SharedPreferences sp = 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.commit(); |
| | | |
| | | MiPushClient.setAlias(LoginVerifyCodeActivity.this, info.getId(), null); |
| | | |
| | | //保存邀请码 |
| | | String inviteCode = data.optString("inviteCode"); |
| | | UserUtil.setInviteCode(getApplicationContext(), inviteCode); |
| | | if (StringUtils.isNullOrEmpty(inviteCode)) { |
| | | startActivity(new Intent(LoginVerifyCodeActivity.this, ActivationInviteCodeAcitvity.class)); |
| | | } else { |
| | | Toast.makeText(LoginVerifyCodeActivity.this, "恭喜你,登录成功", Toast.LENGTH_SHORT).show(); |
| | | } |
| | | setResult(100); |
| | | finish(); |
| | | } else { |
| | | tv_input_error.setVisibility(View.VISIBLE); |
| | | tv_input_error.setText(jsonObject.optString("msg")); |
| | | Toast.makeText(LoginVerifyCodeActivity.this, jsonObject.optString("msg"), Toast.LENGTH_SHORT).show(); |
| | | } |
| | | public void onLoginStart() { |
| | | super.onLoginStart(); |
| | | } |
| | | |
| | | @Override |
| | | public void onFinish() { |
| | | super.onFinish(); |
| | | public void onLoginFinish() { |
| | | super.onLoginFinish(); |
| | | } |
| | | |
| | | @Override |
| | | public void onLoginSuccess(UserInfo user) { |
| | | super.onLoginSuccess(user); |
| | | tv_input_error.setVisibility(View.INVISIBLE); |
| | | UserUtil.loginSuccess(getApplicationContext(), user); |
| | | Toast.makeText(LoginVerifyCodeActivity.this, "恭喜你,登录成功", Toast.LENGTH_SHORT).show(); |
| | | setResult(100); |
| | | finish(); |
| | | } |
| | | |
| | | @Override |
| | | public void onLoginFail(int code, String msg) { |
| | | super.onLoginFail(code, msg); |
| | | tv_input_error.setVisibility(View.VISIBLE); |
| | | tv_input_error.setText(msg); |
| | | Toast.makeText(LoginVerifyCodeActivity.this, msg, Toast.LENGTH_SHORT).show(); |
| | | } |
| | | }); |
| | | } |
| | |
| | | * 请求服务器匹配验证码后修改手机号 |
| | | */ |
| | | private void bindPhoneNew(String code) { |
| | | ShoppingApi.bindPhoneNew(LoginVerifyCodeActivity.this, code, mobileNum, uid, new BasicTextHttpResponseHandler() { |
| | | AccountBindManager.bindPhone(LoginVerifyCodeActivity.this, code, mobileNum, null, new LoginManager.LoginAndBindListener() { |
| | | |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | if (jsonObject.optString("code").equalsIgnoreCase("0")) { |
| | | Gson gson = new GsonBuilder().serializeNulls().create(); |
| | | final UserInfo info = gson.fromJson(jsonObject.optJSONObject("data").optJSONObject("userInfo").toString(), new TypeToken<UserInfo>() { |
| | | }.getType()); |
| | | tv_input_error.setVisibility(View.INVISIBLE); |
| | | SharedPreferences sp = 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.commit(); |
| | | Toast.makeText(LoginVerifyCodeActivity.this, "绑定成功", Toast.LENGTH_SHORT).show(); |
| | | setResult(100); |
| | | finish(); |
| | | } else if (jsonObject.optString("code").equalsIgnoreCase("2")) { |
| | | public void onBindFail(int code, String msg) { |
| | | super.onBindFail(code, msg); |
| | | if (code == 2) { |
| | | AddZFBInfoDialog.Builder builder = new AddZFBInfoDialog.Builder(LoginVerifyCodeActivity.this); |
| | | builder.setTitle("号码已占用提示").setMessage("很抱歉,该手机号已被其他帐号占用," + |
| | | "若要继续完成本帐号手机号更换,请去取消占用或更换其他手机号,谢谢。\n") |
| | |
| | | setResult(100); |
| | | } else { |
| | | tv_input_error.setVisibility(View.VISIBLE); |
| | | tv_input_error.setText(jsonObject.optString("msg")); |
| | | Toast.makeText(LoginVerifyCodeActivity.this, jsonObject.optString("msg"), Toast.LENGTH_SHORT).show(); |
| | | tv_input_error.setText(msg); |
| | | Toast.makeText(LoginVerifyCodeActivity.this, msg, Toast.LENGTH_SHORT).show(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFinish() { |
| | | super.onFinish(); |
| | | public void onBindFinish() { |
| | | super.onBindFinish(); |
| | | } |
| | | |
| | | @Override |
| | | public void onBindStart() { |
| | | super.onBindStart(); |
| | | } |
| | | |
| | | @Override |
| | | public void onBindSuccess(UserInfo user) { |
| | | super.onBindSuccess(user); |
| | | tv_input_error.setVisibility(View.INVISIBLE); |
| | | UserUtil.loginSuccess(getApplicationContext(), user); |
| | | Toast.makeText(LoginVerifyCodeActivity.this, "绑定成功", Toast.LENGTH_SHORT).show(); |
| | | setResult(100); |
| | | finish(); |
| | | } |
| | | }); |
| | | } |
| | |
| | | * @param code |
| | | */ |
| | | private void bindPhoneWithOutLogin(String code, String mobile, String key) { |
| | | ShoppingApi.bindPhoneWithOutLogin(LoginVerifyCodeActivity.this, code, mobile, key, new BasicTextHttpResponseHandler() { |
| | | LoginManager.loginWithPhone(mobile, code, null, key, new LoginManager.LoginAndBindListener() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | if (jsonObject.optString("code").equalsIgnoreCase("0")) { |
| | | Gson gson = new GsonBuilder().serializeNulls().create(); |
| | | final UserInfo info = gson.fromJson(jsonObject.optJSONObject("data").optJSONObject("userInfo").toString(), new TypeToken<UserInfo>() { |
| | | }.getType()); |
| | | tv_input_error.setVisibility(View.INVISIBLE); |
| | | SharedPreferences sp = 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.commit(); |
| | | Toast.makeText(LoginVerifyCodeActivity.this, "绑定成功", Toast.LENGTH_SHORT).show(); |
| | | setResult(100); |
| | | finish(); |
| | | } else if (jsonObject.optString("code").equalsIgnoreCase("2")) { |
| | | public void onBindStart() { |
| | | super.onLoginStart(); |
| | | } |
| | | |
| | | @Override |
| | | public void onBindFinish() { |
| | | super.onLoginFinish(); |
| | | } |
| | | |
| | | @Override |
| | | public void onBindSuccess(UserInfo user) { |
| | | super.onLoginSuccess(user); |
| | | tv_input_error.setVisibility(View.INVISIBLE); |
| | | UserUtil.loginSuccess(getApplicationContext(), user); |
| | | Toast.makeText(LoginVerifyCodeActivity.this, "绑定成功", Toast.LENGTH_SHORT).show(); |
| | | setResult(100); |
| | | finish(); |
| | | } |
| | | |
| | | @Override |
| | | public void onBindFail(int code, String msg) { |
| | | super.onLoginFail(code, msg); |
| | | if (code == 2) { |
| | | AddZFBInfoDialog.Builder builder = new AddZFBInfoDialog.Builder(LoginVerifyCodeActivity.this); |
| | | builder.setTitle("号码已占用提示").setMessage("很抱歉,该手机号已被其他帐号占用," + |
| | | "若要继续完成本帐号手机号更换,请去取消占用或更换其他手机号,谢谢。\n") |
| | |
| | | setResult(100); |
| | | } else { |
| | | tv_input_error.setVisibility(View.VISIBLE); |
| | | tv_input_error.setText(jsonObject.optString("msg")); |
| | | Toast.makeText(LoginVerifyCodeActivity.this, jsonObject.optString("msg"), Toast.LENGTH_SHORT).show(); |
| | | tv_input_error.setText(msg); |
| | | Toast.makeText(LoginVerifyCodeActivity.this, msg, Toast.LENGTH_SHORT).show(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFinish() { |
| | | super.onFinish(); |
| | | } |
| | | }); |
| | | } |
| | |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.tejia.lijin.app.entity.common.GoodsConvertLinkJumpLink; |
| | | import com.tejia.lijin.app.entity.user.UserLijinLevelInfoVO; |
| | | import com.tejia.lijin.app.ui.dialog.ShapeLoadingDialog; |
| | | import com.tejia.lijin.app.util.GoodsBuyJumpUtil; |
| | | import com.tejia.lijin.app.util.ui.dialog.DialogUtil; |
| | | import com.tejia.lijin.app.util.user.AccountBindManager; |
| | | import com.tejia.lijin.app.util.user.LoginManager; |
| | | import com.tejia.lijin.app.util.user.QQLoginManager; |
| | | import com.tejia.lijin.app.util.user.UserUtil; |
| | | import com.tencent.mm.opensdk.modelmsg.SendAuth; |
| | | import com.wpc.library.util.SingleToast; |
| | | import com.wpc.library.util.common.DimenUtils; |
| | | import com.wpc.library.util.common.StringUtils; |
| | | import com.tejia.lijin.app.BasicTextHttpResponseHandler; |
| | |
| | | case R.id.ll_info_pdd_share: |
| | | if (buy == null) |
| | | buy = false; |
| | | ShoppingApi.getPDDAuthInfo(getApplicationContext(), UserUtil.getUid(getApplicationContext()) , buy, new BasicTextHttpResponseHandler() { |
| | | ShoppingApi.getPDDAuthInfo(getApplicationContext(), UserUtil.getUid(getApplicationContext()), buy, new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onStart() { |
| | | super.onStart(); |
| | |
| | | if (jsonObject.optInt("code") == 0) { |
| | | JSONObject data = jsonObject.optJSONObject("data"); |
| | | GoodsConvertLinkJumpLink pddJumpLink = new Gson().fromJson(data.toString(), GoodsConvertLinkJumpLink.class); |
| | | GoodsBuyJumpUtil.jumpPDD(getApplicationContext(), pddJumpLink); |
| | | UserLijinLevelInfoVO userLevel = null; |
| | | if (data.optJSONObject("userLevel") != null) { |
| | | userLevel = new Gson().fromJson(data.optJSONObject("userLevel").toString(), UserLijinLevelInfoVO.class); |
| | | } |
| | | GoodsBuyJumpUtil.jumpPDD(MyInfoActivity.this, pddJumpLink, userLevel); |
| | | } else { |
| | | Toast.makeText(MyInfoActivity.this, jsonObject.optString("msg"), Toast.LENGTH_SHORT).show(); |
| | | } |
| | |
| | | |
| | | |
| | | 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(); |
| | | } |
| | | DialogUtil.show(loadingDialog); |
| | | QQLoginManager.getInstance(getApplicationContext()).startLogin(this, new QQLoginManager.QQLoginListener() { |
| | | @Override |
| | | public void onAuthCancel() { |
| | | DialogUtil.dismiss(loadingDialog); |
| | | } |
| | | |
| | | @Override |
| | | public void onAuthSuccess(String openId) { |
| | | } |
| | | |
| | | @Override |
| | | public void onAuthFail(int code, String msg) { |
| | | DialogUtil.dismiss(loadingDialog); |
| | | SingleToast.showToast(getApplicationContext(), "QQ授权失败,请稍后再试"); |
| | | } |
| | | |
| | | @Override |
| | | public void onGetUserInfoSuccess(final QQLoginManager.QQUserInfo user) { |
| | | runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | DialogUtil.dismiss(loadingDialog); |
| | | AccountBindManager.bindQQ(getApplicationContext(), UserUtil.getUid(getApplicationContext()), user, new LoginManager.LoginAndBindListener() { |
| | | @Override |
| | | public void onBindStart() { |
| | | super.onBindStart(); |
| | | } |
| | | |
| | | @Override |
| | | public void onBindFinish() { |
| | | super.onBindFinish(); |
| | | } |
| | | |
| | | @Override |
| | | public void onBindSuccess(UserInfo user) { |
| | | super.onBindSuccess(user); |
| | | UserUtil.loginSuccess(getApplicationContext(), user); |
| | | Toast.makeText(getApplicationContext(), "绑定成功", Toast.LENGTH_SHORT).show(); |
| | | } |
| | | |
| | | @Override |
| | | public void onBindFail(int code, String msg) { |
| | | super.onBindFail(code, msg); |
| | | Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show(); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onGetUserInfoFail(int code, String msg) { |
| | | runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | SingleToast.showToast(getApplicationContext(), "用户信息获取失败,请稍后再试"); |
| | | DialogUtil.dismiss(loadingDialog); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /* |
| | |
| | | } |
| | | } |
| | | } |
| | | QQLoginManager.getInstance(getApplicationContext()).onActivityResult(requestCode,resultCode,data); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.tejia.lijin.app.entity.TaoBaoGoodsBrief; |
| | | import com.tejia.lijin.app.entity.common.ImageShowEntity; |
| | | import com.tejia.lijin.app.entity.goods.GoodsDetailVO; |
| | | import com.tejia.lijin.app.entity.user.UserLijinLevelInfoVO; |
| | | import com.tejia.lijin.app.ui.BaseActivity; |
| | | import com.tejia.lijin.app.ui.dialog.GoodsDetailHongBaoAndCouponSelectDialog; |
| | | import com.tejia.lijin.app.ui.dialog.GoodsDetailJumpLoaingDialog; |
| | |
| | | |
| | | } |
| | | |
| | | public void showNotifyDialog() { |
| | | if (notifyDialog == null) |
| | | notifyDialog = new GoodsDetailNotifyDialog.Builder(this).setOnButtonClickListener(new GoodsDetailNotifyDialog.Builder.IDialogButtonClick() { |
| | | @Override |
| | | public void onLeftClick() { |
| | | DialogUtil.dismiss(notifyDialog); |
| | | } |
| | | public void showNotifyDialog(String btnName, String link) { |
| | | DialogUtil.dismiss(notifyDialog); |
| | | |
| | | @Override |
| | | public void onRightClick() { |
| | | DialogUtil.dismiss(notifyDialog); |
| | | goFanli(); |
| | | } |
| | | }).create(); |
| | | notifyDialog = new GoodsDetailNotifyDialog.Builder(this).setLeftBtnInfo(btnName, link).setOnButtonClickListener(new GoodsDetailNotifyDialog.Builder.IDialogButtonClick() { |
| | | @Override |
| | | public void onLeftClick() { |
| | | DialogUtil.dismiss(notifyDialog); |
| | | } |
| | | |
| | | @Override |
| | | public void onRightClick() { |
| | | DialogUtil.dismiss(notifyDialog); |
| | | goFanli(); |
| | | } |
| | | }).create(); |
| | | DialogUtil.show(notifyDialog); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public void onStart() { |
| | | super.onStart(); |
| | | if (loadingDialog != null && !loadingDialog.isShowing()) |
| | | loadingDialog.show(); |
| | | DialogUtil.show(loadingDialog); |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (code == 0) { |
| | | JSONObject data = jsonObject.optJSONObject("data"); |
| | | JSONObject link = data.optJSONObject("link"); |
| | | if (link != null) { |
| | | GoodsBuyJumpUtil.jumpTB(GoodsDetailActivity.this, null, link.optString("clickUrl"), null, new GoodsBuyUtil.IBuyGoodsResultListener() { |
| | | |
| | | @Override |
| | | public void onConvertLinkStart() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onConvertLinkSuccess() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onConvertLinkFail(String msg) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onConvertLinkComplete() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onJumpThirdAppStart() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onJumpThirdAppSuccess() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onJumpThirdAppFail() { |
| | | |
| | | } |
| | | }); |
| | | UserLijinLevelInfoVO userLevel = null; |
| | | if (data.optJSONObject("userLevel") != null) { |
| | | userLevel = new Gson().fromJson(data.optJSONObject("userLevel").toString(), UserLijinLevelInfoVO.class); |
| | | } |
| | | |
| | | if (link != null) { |
| | | final String linkUrl = link.optString("clickUrl"); |
| | | GoodsBuyJumpUtil.jumpTB(GoodsDetailActivity.this, null, linkUrl, linkUrl, userLevel, null); |
| | | } |
| | | |
| | | } else { |
| | | if (code == 2001) { |
| | | //用户机会已经用完了 |
| | | showNotifyDialog(); |
| | | getBuyChanceInfoRequest(); |
| | | } else |
| | | Toast.makeText(GoodsDetailActivity.this, jsonObject.optString("msg"), Toast.LENGTH_SHORT).show(); |
| | | } |
| | |
| | | @Override |
| | | public void onFinish() { |
| | | super.onFinish(); |
| | | if (loadingDialog != null && loadingDialog.isShowing()) |
| | | loadingDialog.dismiss(); |
| | | DialogUtil.dismiss(loadingDialog); |
| | | } |
| | | }); |
| | | |
| | |
| | | GoodsBuyUtil.fanli(this, getApplicationContext(), requestInfo, new GoodsBuyUtil.IBuyGoodsResultListener() { |
| | | @Override |
| | | public void onConvertLinkStart() { |
| | | if (loadingDialog != null && !loadingDialog.isShowing()) |
| | | loadingDialog.show(); |
| | | DialogUtil.show(loadingDialog); |
| | | } |
| | | |
| | | @Override |
| | | public void onConvertLinkSuccess() { |
| | | |
| | | DialogUtil.dismiss(loadingDialog); |
| | | } |
| | | |
| | | @Override |
| | | public void onConvertLinkFail(String msg) { |
| | | |
| | | DialogUtil.dismiss(loadingDialog); |
| | | } |
| | | |
| | | @Override |
| | | public void onConvertLinkComplete() { |
| | | if (loadingDialog != null && loadingDialog.isShowing()) |
| | | loadingDialog.dismiss(); |
| | | DialogUtil.dismiss(loadingDialog); |
| | | } |
| | | |
| | | @Override |
| | |
| | | * 获取购买机会信息 |
| | | */ |
| | | private void getBuyChanceInfoRequest() { |
| | | //TODO 判断是否还有机会(返回当前剩余多少次,还能解锁多少次),如果有机会需要看激励视频广告 |
| | | ShoppingApi.getUserLijinCreatedInfo(getApplicationContext(), mInfo.getGoods().getGoodsId(), mInfo.getGoods().getGoodsType(), UserUtil.getUid(getApplicationContext()), new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onStart() { |
| | | super.onStart(); |
| | | } |
| | | |
| | | @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"); |
| | | int leftCount = data.optInt("leftCount"); |
| | | // if (leftCount <= 0) { |
| | | JSONObject openInfo = data.optJSONObject("openInfo"); |
| | | if (openInfo != null) { |
| | | showNotifyDialog(openInfo.optString("btnName"), openInfo.optString("vipLink")); |
| | | } else { |
| | | showNotifyDialog(null, null); |
| | | } |
| | | // } |
| | | |
| | | |
| | | } else { |
| | | Toast.makeText(GoodsDetailActivity.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); |
| | | Toast.makeText(GoodsDetailActivity.this, "网络请求出错", Toast.LENGTH_SHORT).show(); |
| | | } |
| | | |
| | | @Override |
| | | public void onFinish() { |
| | | super.onFinish(); |
| | | DialogUtil.dismiss(loadingDialog); |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | @Override |
| | | public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, final int position) { |
| | | final SpecialOffer2 info = mList.get(position); |
| | | info.setBgColor("#8B4CFF"); |
| | | info.setBgColor("#333333"); |
| | | Holder holder = (Holder) viewHolder; |
| | | holder.tv_name.setText(info.getName() + ""); |
| | | Glide.with(mContext).load(info.getPicture()).transform(new GlideRoundTransform(mContext, 18)).into(holder.iv_icon); |
| | | Glide.with(mContext).load("https://aecpm.alicdn.com/simba/img/TB1X6uHLVXXXXcCXVXXSutbFXXX.jpg").transform(new GlideRoundTransform(mContext, 18)).into(holder.iv_icon); |
| | | if (!StringUtils.isEmpty(info.getIcon())) { |
| | | holder.iv_tag.setVisibility(View.VISIBLE); |
| | | Glide.with(mContext).load(info.getIcon()).into(holder.iv_tag); |
| | |
| | | import com.wpc.library.RetainViewFragment; |
| | | import com.wpc.library.content.ConnectivityChangeHelper; |
| | | import com.wpc.library.util.NetUtils; |
| | | import com.wpc.library.util.ScreenUtils; |
| | | import com.wpc.library.util.SystemCommon; |
| | | import com.wpc.library.util.cache.DiskLruCache; |
| | | import com.wpc.library.util.common.DimenUtils; |
| | |
| | | seekBar = top.findViewById(R.id.slide_indicator_point); |
| | | seekBar.setPadding(0, 0, 0, 0); |
| | | seekBar.setThumbOffset(0); |
| | | seekBar.setVisibility(View.GONE); |
| | | // seekBar.setVisibility(View.GONE); |
| | | |
| | | rv_special_offer.addItemDecoration(circleSpecialItemDecoration); |
| | | |
| | |
| | | gradientDrawable.setSize(DimenUtils.dip2px(getContext(), 50) * 5 / (circleSpecials.size() / 2) |
| | | , DimenUtils.dip2px(getContext(), 4)); |
| | | } |
| | | // seekBar.setVisibility(mSpecial2s.size() <= 10 ? View.GONE : View.VISIBLE); |
| | | seekBar.setVisibility(circleSpecials.size() <= 8 ? View.GONE : View.VISIBLE); |
| | | |
| | | if (list2 == null || list2.size() == 0) { |
| | | rv_special_offer.setVisibility(View.GONE); |
| | |
| | | } |
| | | circleSpecials.addAll(list2); |
| | | specialAdapter2.notifyDataSetChanged(); |
| | | // seekBar.setVisibility(mSpecial2s.size() <= 10 ? View.GONE : View.VISIBLE); |
| | | seekBar.setVisibility(circleSpecials.size() <= 8 ? View.GONE : View.VISIBLE); |
| | | if (circleSpecials.size() > 10) { |
| | | GradientDrawable gradientDrawable = (GradientDrawable) seekBar.getThumb(); |
| | | //根据列表的个数,动态设置游标的大小,设置游标的时候,progress进度的颜色设置为和seekbar的颜色设置的一样的,所以就不显示进度了。 |
| | |
| | | .optJSONArray("list").toString(), |
| | | new TypeToken<List<SpecialOffer2>>() { |
| | | }.getType()); |
| | | list5.clear(); |
| | | showActivity2(list5); |
| | | |
| | | if (list5 == null || list5.size() == 0) { |
| | |
| | | // goodsAdapter.notifyItemRangeChanged(goodsAdapter.getItemCount(), list.size());//倒序批量刷新列表 |
| | | count = jsonObject.optJSONObject("data").optInt("count"); |
| | | // tv_recommend_goods_hint.setVisibility(mList.size() > 0 ? View.VISIBLE : View.GONE); |
| | | v_divider.setVisibility(mList.size() > 0 ? View.VISIBLE : View.GONE); |
| | | |
| | | if (mList.size() == count) { |
| | | bottom.setVisibility(View.VISIBLE); |
| | |
| | | */ |
| | | private void showBigActivity(final List<SpecialOffer2> mList, String bottomPic) { |
| | | if (mList.size() > 0) { |
| | | float screenWidth = SystemCommon.getScreenWidth(vp_banner.getContext()); |
| | | int screenWidth = ScreenUtils.getScreenWidth(getContext()); |
| | | ViewGroup.MarginLayoutParams p1 = (ViewGroup.MarginLayoutParams) ((View) fl_fragment_activity.getParent()).getLayoutParams(); |
| | | |
| | | int rowSpace=DimenUtils.dip2px(getContext(),10); |
| | | int smallImageWidth; |
| | | int bigImageWidth=screenWidth-p1.leftMargin-p1.rightMargin; |
| | | |
| | | float actTotalHeight = (screenWidth - DimenUtils.dip2px(getContext(), 20)) * 7 / 20; |
| | | for (int i = 0; i < mList.size(); i++) { |
| | | if (i > 0 && i % 2 == 0) { |
| | |
| | | |
| | | public final static String CSJ_APP_ID = "5171164"; |
| | | |
| | | public final static String GDT_APP_ID = "1110527324"; |
| | | public final static String GDT_APP_ID = "1111788851"; |
| | | |
| | | public final static String JD_APP_KEY = "b66094a3c2ca85886804be182294be60"; |
| | | public final static String JD_APP_SECRET = "57102d86629243e5845947d10db3fd57"; |
| | |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.net.Uri; |
| | | import android.os.Handler; |
| | | import android.util.Log; |
| | | import android.view.View; |
| | | import android.webkit.WebChromeClient; |
| | |
| | | import com.kepler.jd.sdk.bean.KeplerAttachParameter; |
| | | import com.tejia.lijin.app.entity.TbPidInfo; |
| | | import com.tejia.lijin.app.entity.common.GoodsConvertLinkJumpLink; |
| | | import com.tejia.lijin.app.entity.user.UserLijinLevelInfoVO; |
| | | import com.tejia.lijin.app.ui.dialog.GoodsDetailJumpLoaingDialog; |
| | | import com.tejia.lijin.app.ui.invite.ShareBrowserActivity; |
| | | import com.tejia.lijin.app.ui.recommend.GoodsDetailActivity; |
| | | import com.tejia.lijin.app.util.baichuan.AlibcTradeUtil; |
| | | import com.tejia.lijin.app.util.downutil.StringUtils; |
| | | import com.tejia.lijin.app.util.goods.GoodsBuyUtil; |
| | | import com.tejia.lijin.app.util.ui.dialog.DialogUtil; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | |
| | | public class GoodsBuyJumpUtil { |
| | | |
| | | |
| | | public static void jumpTB(Activity activity, TbPidInfo tInfo, String clickUrl, String couponUrl, final GoodsBuyUtil.IBuyGoodsResultListener buyGoodsResultListener) { |
| | | public static void jumpTB(final Activity activity, final TbPidInfo tInfo, final String clickUrl, final String couponUrl, UserLijinLevelInfoVO userLevel, final GoodsBuyUtil.IBuyGoodsResultListener buyGoodsResultListener) { |
| | | |
| | | if (userLevel != null && userLevel.getUpgradeRights() != null) { |
| | | showADLoading(activity, Constant.GOODS_TYPE_TB, userLevel, new GoodsDetailJumpLoaingDialog.Builder.IDialogClose() { |
| | | @Override |
| | | public void onClose(boolean auto) { |
| | | jumpTB(activity, tInfo, clickUrl, couponUrl, buyGoodsResultListener); |
| | | } |
| | | }); |
| | | } else { |
| | | final Dialog dialog = getLoadingDialog(activity, Constant.GOODS_TYPE_TB); |
| | | jumpTB(activity, tInfo, clickUrl, couponUrl, new GoodsBuyUtil.IBuyGoodsResultListener() { |
| | | @Override |
| | | public void onConvertLinkStart() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onConvertLinkSuccess() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onConvertLinkFail(String msg) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onConvertLinkComplete() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onJumpThirdAppStart() { |
| | | DialogUtil.show(dialog); |
| | | new Handler().postDelayed(new Runnable() { |
| | | public void run() { |
| | | DialogUtil.dismiss(dialog); |
| | | } |
| | | |
| | | }, 3 * 1000); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onJumpThirdAppSuccess() { |
| | | DialogUtil.dismiss(dialog); |
| | | } |
| | | |
| | | @Override |
| | | public void onJumpThirdAppFail() { |
| | | DialogUtil.dismiss(dialog); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |
| | | |
| | | private static void jumpTB(Activity activity, TbPidInfo tInfo, String clickUrl, String couponUrl, final GoodsBuyUtil.IBuyGoodsResultListener buyGoodsResultListener) { |
| | | AlibcShowParams alibcShowParams = new AlibcShowParams(); |
| | | alibcShowParams.setOpenType(OpenType.Auto); |
| | | alibcShowParams.setBackUrl("alisdk://"); |
| | |
| | | if (!com.wpc.library.util.common.StringUtils.isEmpty(clickUrl) || !com.wpc.library.util.common.StringUtils.isEmpty(couponUrl)) { |
| | | String url = (!com.wpc.library.util.common.StringUtils.isEmpty(couponUrl)) ? couponUrl : clickUrl; |
| | | AlibcTradeSDK.setTaokeParams(alibcTaokeParams); |
| | | buyGoodsResultListener.onJumpThirdAppStart(); |
| | | if (buyGoodsResultListener != null) |
| | | buyGoodsResultListener.onJumpThirdAppStart(); |
| | | AlibcTradeUtil.openByUrl(activity, |
| | | url, null, new WebViewClient(), new WebChromeClient(), |
| | | alibcShowParams, alibcTaokeParams, null); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | public static void jumpPDD(Context context, GoodsConvertLinkJumpLink link) { |
| | | public static void jumpPDD(final Activity context, final GoodsConvertLinkJumpLink link, UserLijinLevelInfoVO userLevel) { |
| | | jumpPDD(context, link); |
| | | |
| | | |
| | | if (userLevel != null && userLevel.getUpgradeRights() != null) { |
| | | showADLoading(context, Constant.GOODS_TYPE_PDD, userLevel, new GoodsDetailJumpLoaingDialog.Builder.IDialogClose() { |
| | | @Override |
| | | public void onClose(boolean auto) { |
| | | jumpPDD(context, link); |
| | | } |
| | | }); |
| | | } else { |
| | | final Dialog dialog = getLoadingDialog(context, Constant.GOODS_TYPE_PDD); |
| | | DialogUtil.show(dialog); |
| | | jumpPDD(context, link); |
| | | new Handler().postDelayed(new Runnable() { |
| | | public void run() { |
| | | DialogUtil.dismiss(dialog); |
| | | } |
| | | |
| | | }, 3 * 1000); |
| | | } |
| | | |
| | | } |
| | | |
| | | private static void jumpPDD(Context context, GoodsConvertLinkJumpLink link) { |
| | | if (context == null) |
| | | return; |
| | | if (link == null) |
| | |
| | | if (dialog != null && dialog.isShowing()) |
| | | dialog.dismiss(); |
| | | } |
| | | } |
| | | |
| | | |
| | | public static void jumpJD(final Activity activity, final GoodsConvertLinkJumpLink link, UserLijinLevelInfoVO userLevel, final IJumpResult jumpResult) { |
| | | |
| | | if (userLevel != null && userLevel.getUpgradeRights() != null) { |
| | | showADLoading(activity, Constant.GOODS_TYPE_JD, userLevel, new GoodsDetailJumpLoaingDialog.Builder.IDialogClose() { |
| | | @Override |
| | | public void onClose(boolean auto) { |
| | | jumpJD(activity, link, null); |
| | | } |
| | | }); |
| | | } else { |
| | | final Dialog dialog = getLoadingDialog(activity, Constant.GOODS_TYPE_JD); |
| | | DialogUtil.show(dialog); |
| | | jumpJD(activity, link, new IJumpResult() { |
| | | @Override |
| | | public void onSuccess() { |
| | | } |
| | | |
| | | @Override |
| | | public void onFail(String msg) { |
| | | } |
| | | }); |
| | | new Handler().postDelayed(new Runnable() { |
| | | public void run() { |
| | | DialogUtil.dismiss(dialog); |
| | | } |
| | | |
| | | }, 3 * 1000); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | public static void jumpJD(final Activity activity, GoodsConvertLinkJumpLink link, final IJumpResult jumpResult) { |
| | | private static void jumpJD(final Activity activity, GoodsConvertLinkJumpLink link, final IJumpResult jumpResult) { |
| | | if (link == null) |
| | | return; |
| | | |
| | |
| | | if (status == OpenAppAction.OpenAppAction_result_APP) { |
| | | //呼京东成功 |
| | | Log.e("mResult", "呼京东成功"); |
| | | jumpResult.onSuccess(); |
| | | if (jumpResult != null) |
| | | jumpResult.onSuccess(); |
| | | } else if (status == OpenAppAction.OpenAppAction_start) { |
| | | //开始状态未必一定执行, |
| | | Log.e("mResult", "开始呼起京东"); |
| | |
| | | intent.putExtra("url", url); |
| | | intent.putExtra("interceptGoodsDetail", false); |
| | | activity.startActivity(intent); |
| | | jumpResult.onFail("唤起京东失败"); |
| | | if (jumpResult != null) |
| | | jumpResult.onFail("唤起京东失败"); |
| | | } |
| | | } |
| | | }); |
| | |
| | | intent.putExtra("interceptGoodsDetail", false); |
| | | activity.startActivity(intent); |
| | | } finally { |
| | | jumpResult.onSuccess(); |
| | | if (jumpResult != null) |
| | | jumpResult.onSuccess(); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | public static void jumpVIPShop(Context context, GoodsConvertLinkJumpLink link) { |
| | | public static void jumpVIPShop(final Activity context, final GoodsConvertLinkJumpLink link, UserLijinLevelInfoVO userLevel) { |
| | | if (userLevel != null && userLevel.getUpgradeRights() != null) { |
| | | showADLoading(context, Constant.GOODS_TYPE_VIP, userLevel, new GoodsDetailJumpLoaingDialog.Builder.IDialogClose() { |
| | | @Override |
| | | public void onClose(boolean auto) { |
| | | jumpVIPShop(context, link); |
| | | } |
| | | }); |
| | | } else { |
| | | final Dialog dialog = getLoadingDialog(context, Constant.GOODS_TYPE_VIP); |
| | | DialogUtil.show(dialog); |
| | | jumpVIPShop(context, link); |
| | | new Handler().postDelayed(new Runnable() { |
| | | public void run() { |
| | | DialogUtil.dismiss(dialog); |
| | | } |
| | | }, 3 * 1000); |
| | | } |
| | | } |
| | | |
| | | |
| | | private static void jumpVIPShop(Context context, GoodsConvertLinkJumpLink link) { |
| | | if (context == null) |
| | | return; |
| | | if (link == null) |
| | |
| | | } |
| | | |
| | | |
| | | public static void jumpSuning(Context context, GoodsConvertLinkJumpLink link) { |
| | | public static void jumpSuning(final Activity context, final GoodsConvertLinkJumpLink link, UserLijinLevelInfoVO userLevel) { |
| | | |
| | | if (userLevel != null && userLevel.getUpgradeRights() != null) { |
| | | showADLoading(context, Constant.GOODS_TYPE_SUNING, userLevel, new GoodsDetailJumpLoaingDialog.Builder.IDialogClose() { |
| | | @Override |
| | | public void onClose(boolean auto) { |
| | | jumpSuning(context, link); |
| | | } |
| | | }); |
| | | } else { |
| | | final Dialog dialog = getLoadingDialog(context, Constant.GOODS_TYPE_SUNING); |
| | | DialogUtil.show(dialog); |
| | | jumpSuning(context, link); |
| | | new Handler().postDelayed(new Runnable() { |
| | | public void run() { |
| | | DialogUtil.dismiss(dialog); |
| | | } |
| | | }, 3 * 1000); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | private static void jumpSuning(Context context, GoodsConvertLinkJumpLink link) { |
| | | if (context == null) |
| | | return; |
| | | if (link == null) |
| | |
| | | } |
| | | |
| | | |
| | | private static Dialog showADLoading(Activity activity, int platform, UserLijinLevelInfoVO userLevel, GoodsDetailJumpLoaingDialog.Builder.IDialogClose dialogCloseListener) { |
| | | |
| | | GoodsDetailJumpLoaingDialog.Builder builder = new GoodsDetailJumpLoaingDialog.Builder(activity).setPlatform(platform).setOnCloseListener(dialogCloseListener); |
| | | |
| | | if (userLevel != null) { |
| | | if (userLevel.getLoadingAdInfo() != null) { |
| | | builder = builder.setHasAd(true).setAdInfo(userLevel.getLoadingAdInfo().getType(), userLevel.getLoadingAdInfo().getPid()); |
| | | } |
| | | |
| | | if (userLevel.getUpgradeRights() != null) { |
| | | builder = builder.setNotify(userLevel.getUpgradeRights().getDesc(), userLevel.getUpgradeRights().getLink()); |
| | | } |
| | | } |
| | | Dialog dialog = builder.create(); |
| | | dialog.show(); |
| | | return dialog; |
| | | } |
| | | |
| | | private static Dialog getLoadingDialog(Activity activity, int platform) { |
| | | GoodsDetailJumpLoaingDialog.Builder builder = new GoodsDetailJumpLoaingDialog.Builder(activity).setPlatform(platform); |
| | | Dialog dialog = builder.create(); |
| | | return dialog; |
| | | } |
| | | |
| | | |
| | | public static interface IJumpResult { |
| | | public void onSuccess(); |
| | | |
| | |
| | | import com.tejia.lijin.app.ShoppingApi; |
| | | import com.tejia.lijin.app.entity.TbPidInfo; |
| | | import com.tejia.lijin.app.entity.common.GoodsConvertLinkJumpLink; |
| | | import com.tejia.lijin.app.entity.user.UserLijinLevelInfoVO; |
| | | import com.tejia.lijin.app.util.Constant; |
| | | import com.tejia.lijin.app.util.GoodsBuyJumpUtil; |
| | | import com.tejia.lijin.app.util.baichuan.AlibcTradeUtil; |
| | |
| | | buyJD(activity, requestInfo, resultListener); |
| | | break; |
| | | case Constant.GOODS_TYPE_PDD: |
| | | buyPDD(context, requestInfo, resultListener); |
| | | buyPDD(activity, requestInfo, resultListener); |
| | | break; |
| | | case Constant.GOODS_TYPE_VIP: |
| | | buyVIP(context, requestInfo, resultListener); |
| | | buyVIP(activity, requestInfo, resultListener); |
| | | break; |
| | | case Constant.GOODS_TYPE_SUNING: |
| | | buySuning(context, requestInfo, resultListener); |
| | | buySuning(activity, requestInfo, resultListener); |
| | | break; |
| | | } |
| | | |
| | |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | if (jsonObject.optString("code").equalsIgnoreCase("0")) { |
| | | Gson gson = new GsonBuilder().serializeNulls().create(); |
| | | JSONObject data = jsonObject.optJSONObject("data"); |
| | | TbPidInfo tInfo = null; |
| | | String clickUrl = null; |
| | | String couponUrl = null; |
| | | if (jsonObject.optJSONObject("data").optJSONObject("tbPidInfo") != null) |
| | | tInfo = gson.fromJson(jsonObject.optJSONObject("data").optJSONObject("tbPidInfo").toString(), TbPidInfo.class); |
| | | if (data.optJSONObject("tbPidInfo") != null) |
| | | tInfo = gson.fromJson(data.optJSONObject("tbPidInfo").toString(), TbPidInfo.class); |
| | | |
| | | JSONObject object = jsonObject.optJSONObject("data").optJSONObject("link"); |
| | | JSONObject object = data.optJSONObject("link"); |
| | | if (object != null) { |
| | | clickUrl = object.optString("clickUrl"); |
| | | couponUrl = object.optString("couponUrl"); |
| | | } |
| | | |
| | | buyGoodsResultListener.onConvertLinkSuccess(); |
| | | jumpTB(activity, tInfo, clickUrl, couponUrl, buyGoodsResultListener); |
| | | UserLijinLevelInfoVO userLevel = null; |
| | | if (data.optJSONObject("userLevel") != null) { |
| | | userLevel = new Gson().fromJson(data.optJSONObject("userLevel").toString(), UserLijinLevelInfoVO.class); |
| | | } |
| | | GoodsBuyJumpUtil.jumpTB(activity, tInfo, clickUrl, couponUrl,userLevel, buyGoodsResultListener); |
| | | } else { |
| | | buyGoodsResultListener.onConvertLinkFail(jsonObject.optString("msg")); |
| | | } |
| | |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | if (jsonObject.optString("code").equalsIgnoreCase("0")) { |
| | | GoodsConvertLinkJumpLink jumpLink = new Gson().fromJson(jsonObject.optJSONObject("data").toString(), GoodsConvertLinkJumpLink.class); |
| | | buyGoodsResultListener.onJumpThirdAppStart(); |
| | | GoodsBuyJumpUtil.jumpJD(activity, jumpLink, new GoodsBuyJumpUtil.IJumpResult() { |
| | | |
| | | @Override |
| | | public void onSuccess() { |
| | | buyGoodsResultListener.onJumpThirdAppSuccess(); |
| | | } |
| | | |
| | | @Override |
| | | public void onFail(String msg) { |
| | | buyGoodsResultListener.onJumpThirdAppFail(); |
| | | } |
| | | }); |
| | | JSONObject data = jsonObject.optJSONObject("data"); |
| | | GoodsConvertLinkJumpLink jumpLink = new Gson().fromJson(data.toString(), GoodsConvertLinkJumpLink.class); |
| | | UserLijinLevelInfoVO userLevel = null; |
| | | if (data.optJSONObject("userLevel") != null) { |
| | | userLevel = new Gson().fromJson(data.optJSONObject("userLevel").toString(), UserLijinLevelInfoVO.class); |
| | | } |
| | | GoodsBuyJumpUtil.jumpJD(activity, jumpLink, userLevel, null); |
| | | } else { |
| | | buyGoodsResultListener.onConvertLinkFail(jsonObject.optString("msg")); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | private static void buyPDD(final Context context, GoodsBuyRequestInfo requestInfo, final IBuyGoodsResultListener buyGoodsResultListener) { |
| | | private static void buyPDD(final Activity context, GoodsBuyRequestInfo requestInfo, final IBuyGoodsResultListener buyGoodsResultListener) { |
| | | ShoppingApi.getPDDLinkInfo(context, requestInfo.getUid(), requestInfo.getGoodsId(), requestInfo.getFrom(), "", new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | if (jsonObject.optString("code").equalsIgnoreCase("0")) { |
| | | GoodsConvertLinkJumpLink pddJumpLink = new Gson().fromJson(jsonObject.optJSONObject("data").toString(), GoodsConvertLinkJumpLink.class); |
| | | JSONObject data = jsonObject.optJSONObject("data"); |
| | | GoodsConvertLinkJumpLink pddJumpLink = new Gson().fromJson(data.toString(), GoodsConvertLinkJumpLink.class); |
| | | buyGoodsResultListener.onJumpThirdAppStart(); |
| | | GoodsBuyJumpUtil.jumpPDD(context, pddJumpLink); |
| | | UserLijinLevelInfoVO userLevel = null; |
| | | if (data.optJSONObject("userLevel") != null) { |
| | | userLevel = new Gson().fromJson(data.optJSONObject("userLevel").toString(), UserLijinLevelInfoVO.class); |
| | | } |
| | | GoodsBuyJumpUtil.jumpPDD(context, pddJumpLink, userLevel); |
| | | |
| | | } else { |
| | | buyGoodsResultListener.onConvertLinkFail(jsonObject.optString("msg")); |
| | | } |
| | |
| | | }); |
| | | } |
| | | |
| | | private static void buyVIP(final Context context, GoodsBuyRequestInfo requestInfo, final IBuyGoodsResultListener buyGoodsResultListener) { |
| | | private static void buyVIP(final Activity context, GoodsBuyRequestInfo requestInfo, final IBuyGoodsResultListener buyGoodsResultListener) { |
| | | ShoppingApi.getVIPLinkInfo(context, requestInfo.getUid(), requestInfo.getGoodsId(), requestInfo.getFrom(), "", new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | if (jsonObject.optString("code").equalsIgnoreCase("0")) { |
| | | GoodsConvertLinkJumpLink jumpLink = new Gson().fromJson(jsonObject.optJSONObject("data").toString(), GoodsConvertLinkJumpLink.class); |
| | | JSONObject data = jsonObject.optJSONObject("data"); |
| | | GoodsConvertLinkJumpLink jumpLink = new Gson().fromJson(data.toString(), GoodsConvertLinkJumpLink.class); |
| | | buyGoodsResultListener.onJumpThirdAppStart(); |
| | | GoodsBuyJumpUtil.jumpVIPShop(context, jumpLink); |
| | | UserLijinLevelInfoVO userLevel = null; |
| | | if (data.optJSONObject("userLevel") != null) { |
| | | userLevel = new Gson().fromJson(data.optJSONObject("userLevel").toString(), UserLijinLevelInfoVO.class); |
| | | } |
| | | GoodsBuyJumpUtil.jumpVIPShop(context, jumpLink, userLevel); |
| | | |
| | | } else { |
| | | buyGoodsResultListener.onConvertLinkFail(jsonObject.optString("msg")); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | private static void buySuning(final Context context, GoodsBuyRequestInfo requestInfo, final IBuyGoodsResultListener buyGoodsResultListener) { |
| | | private static void buySuning(final Activity context, GoodsBuyRequestInfo requestInfo, final IBuyGoodsResultListener buyGoodsResultListener) { |
| | | ShoppingApi.getSuningLinkInfo(context, requestInfo.getUid(), requestInfo.getGoodsId(), requestInfo.getFrom(), "", new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | if (jsonObject.optString("code").equalsIgnoreCase("0")) { |
| | | GoodsConvertLinkJumpLink jumpLink = new Gson().fromJson(jsonObject.optJSONObject("data").toString(), GoodsConvertLinkJumpLink.class); |
| | | JSONObject data = jsonObject.optJSONObject("data"); |
| | | GoodsConvertLinkJumpLink jumpLink = new Gson().fromJson(data.toString(), GoodsConvertLinkJumpLink.class); |
| | | buyGoodsResultListener.onJumpThirdAppStart(); |
| | | GoodsBuyJumpUtil.jumpSuning(context, jumpLink); |
| | | UserLijinLevelInfoVO userLevel = null; |
| | | if (data.optJSONObject("userLevel") != null) { |
| | | userLevel = new Gson().fromJson(data.optJSONObject("userLevel").toString(), UserLijinLevelInfoVO.class); |
| | | } |
| | | GoodsBuyJumpUtil.jumpSuning(context, jumpLink, userLevel); |
| | | } else { |
| | | buyGoodsResultListener.onConvertLinkFail(jsonObject.optString("msg")); |
| | | } |
New file |
| | |
| | | package com.tejia.lijin.app.util.user; |
| | | |
| | | import android.content.Context; |
| | | import android.content.DialogInterface; |
| | | import android.content.SharedPreferences; |
| | | import android.util.Base64; |
| | | import android.view.View; |
| | | import android.widget.Toast; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.tejia.lijin.app.BasicTextHttpResponseHandler; |
| | | import com.tejia.lijin.app.ShoppingApi; |
| | | import com.tejia.lijin.app.entity.UserInfo; |
| | | import com.tejia.lijin.app.ui.dialog.AddZFBInfoDialog; |
| | | import com.tejia.lijin.app.ui.mine.LoginVerifyCodeActivity; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.io.UnsupportedEncodingException; |
| | | |
| | | /** |
| | | * 账号绑定 |
| | | */ |
| | | public class AccountBindManager { |
| | | |
| | | |
| | | public static void bindPhone(final Context context, String vCode, String phone, String accessToken, final LoginManager.ILoginAndBindResult bindListener) { |
| | | |
| | | ShoppingApi.bindPhoneNew(context, vCode, phone, accessToken, UserUtil.getUid(context), new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | if (jsonObject.optString("code").equalsIgnoreCase("0")) { |
| | | Gson gson = new GsonBuilder().serializeNulls().create(); |
| | | final UserInfo info = gson.fromJson(jsonObject.optJSONObject("data").optJSONObject("userInfo").toString(), new TypeToken<UserInfo>() { |
| | | }.getType()); |
| | | bindListener.onBindSuccess(info); |
| | | } else { |
| | | bindListener.onBindFail(jsonObject.optInt("code"), jsonObject.optString("msg")); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFinish() { |
| | | super.onFinish(); |
| | | bindListener.onBindFinish(); |
| | | } |
| | | |
| | | @Override |
| | | public void onStart() { |
| | | super.onStart(); |
| | | bindListener.onBindStart(); |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(int statusCode, Header[] headers, String jsonObject, Throwable e) { |
| | | super.onFailure(statusCode, headers, jsonObject, e); |
| | | bindListener.onBindFail(500, "网络请求出错"); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 绑定微信 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param code |
| | | * @param bindListener |
| | | */ |
| | | public static void bindWX(final Context context, Long uid, String code, final LoginManager.ILoginAndBindResult bindListener) { |
| | | ShoppingApi.bindWeiXin(context, uid, code, new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | if (jsonObject.optString("code").equalsIgnoreCase("0")) { |
| | | Gson gson = new GsonBuilder().serializeNulls().create(); |
| | | final UserInfo info = gson.fromJson(jsonObject.optJSONObject("data").optJSONObject("userInfo").toString(), new TypeToken<UserInfo>() { |
| | | }.getType()); |
| | | bindListener.onBindSuccess(info); |
| | | } else { |
| | | bindListener.onBindFail(jsonObject.optInt("code"), jsonObject.optString("msg")); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFinish() { |
| | | super.onFinish(); |
| | | bindListener.onBindFinish(); |
| | | } |
| | | |
| | | @Override |
| | | public void onStart() { |
| | | super.onStart(); |
| | | bindListener.onBindStart(); |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(int statusCode, Header[] headers, String jsonObject, Throwable e) { |
| | | super.onFailure(statusCode, headers, jsonObject, e); |
| | | bindListener.onBindFail(500, "网络请求出错"); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 绑定QQ |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param qqUser |
| | | * @param bindListener |
| | | */ |
| | | public static void bindQQ(final Context context, Long uid, QQLoginManager.QQUserInfo qqUser, final LoginManager.ILoginAndBindResult bindListener) { |
| | | String qqUserInfo = null; |
| | | try { |
| | | qqUserInfo = Base64.encodeToString(new Gson().toJson(qqUser).getBytes("UTF-8"), Base64.NO_WRAP); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | ShoppingApi.bindQQ(context, uid, qqUserInfo, new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | if (jsonObject.optString("code").equalsIgnoreCase("0")) { |
| | | Gson gson = new GsonBuilder().serializeNulls().create(); |
| | | final UserInfo info = gson.fromJson(jsonObject.optJSONObject("data").optJSONObject("userInfo").toString(), new TypeToken<UserInfo>() { |
| | | }.getType()); |
| | | bindListener.onBindSuccess(info); |
| | | } else { |
| | | bindListener.onBindFail(jsonObject.optInt("code"), jsonObject.optString("msg")); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFinish() { |
| | | super.onFinish(); |
| | | bindListener.onBindFinish(); |
| | | } |
| | | |
| | | @Override |
| | | public void onStart() { |
| | | super.onStart(); |
| | | bindListener.onBindStart(); |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(int statusCode, Header[] headers, String jsonObject, Throwable e) { |
| | | super.onFailure(statusCode, headers, jsonObject, e); |
| | | bindListener.onBindFail(500, "网络请求出错"); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.mobile.auth.gatewayauth.ResultCode; |
| | | import com.mobile.auth.gatewayauth.TokenResultListener; |
| | | import com.mobile.auth.gatewayauth.model.TokenRet; |
| | | import com.tejia.lijin.app.util.Constant; |
| | | import com.wpc.library.util.common.DimenUtils; |
| | | |
| | | public class AliyunSmsOneKeyLoginManager { |
| | |
| | | .setNavReturnImgWidth(22) |
| | | .setNavReturnImgHeight(22) |
| | | .setNavReturnScaleType(ImageView.ScaleType.FIT_XY) |
| | | .setWebNavColor(Color.BLACK) |
| | | // .setWebNavReturnImgPath("ic_back_two") |
| | | .setWebViewStatusBarColor(Color.WHITE) |
| | | .setWebNavColor(Color.WHITE) |
| | | .setWebNavTextColor(Color.BLACK) |
| | | // .setWebNavReturnImgPath("ic_back") |
| | | // .setWebViewStatusBarColor(Color.BLACK) |
| | | .setStatusBarColor(Color.WHITE) |
| | | |
| | | .setLogoWidth(147) |
| | | .setLogoHeight(36) |
| | | // .setLogoImgPath("ic_login_logo") |
| | | .setLogoOffsetY(24 - 10) |
| | | // .setLogoWidth(147) |
| | | // .setLogoHeight(36) |
| | | //// .setLogoImgPath("ic_login_logo") |
| | | // .setLogoOffsetY(24 - 10) |
| | | .setLogoHidden(true) |
| | | |
| | | .setSloganOffsetY(171 - 10) |
| | | .setSloganOffsetY(50) |
| | | .setSloganTextSize(12) |
| | | .setSloganTextColor(Color.parseColor("#F804F5")) |
| | | .setSloganTextColor(Color.parseColor("#999999")) |
| | | |
| | | .setLogBtnText("⼀键登录") |
| | | .setLogBtnTextSize(17) |
| | | .setLogBtnTextColor(Color.parseColor("#F4DE4A")) |
| | | .setLogBtnBackgroundPath("shape_login_btn") |
| | | .setLogBtnOffsetY(229 - 10) |
| | | .setLogBtnTextColor(Color.parseColor("#FFFFFF")) |
| | | .setLogBtnBackgroundPath("selector_login_btn") |
| | | .setLogBtnOffsetY(50+45) |
| | | .setLogBtnHeight(44) |
| | | |
| | | |
| | | .setDialogWidth(305 * widthDP / 375) |
| | | .setDialogHeight(454) |
| | | .setNavColor(Color.RED) |
| | | .setDialogHeight(242) |
| | | .setNavColor(Color.parseColor("#999999")) |
| | | .setSwitchAccHidden(true) |
| | | .setNumberColor(Color.parseColor("#0052F6")) |
| | | .setNumberColor(Color.parseColor("#FF2B4B")) |
| | | .setNumberSize(36) |
| | | .setNumFieldOffsetY(128 - 10) |
| | | .setNumFieldOffsetY(0) |
| | | |
| | | // .setAppPrivacyOne("《用户服务协议》", "") |
| | | // .setAppPrivacyTwo("《隐私政策》", BeibeiConstant.PRIVACY_POLICY) |
| | | .setAppPrivacyColor(Color.parseColor("#B3B8D3"), Color.parseColor("#51B3FF")) |
| | | .setAppPrivacyOne("《用户服务协议》", "http://www.baidu.com") |
| | | .setAppPrivacyTwo("《隐私政策》","http://www.baidu.com") |
| | | .setAppPrivacyColor(Color.parseColor("#999999"), Color.parseColor("#3A7CFF")) |
| | | .setPrivacyBefore("登录即表示同意") |
| | | .setPrivacyEnd("") |
| | | .setCheckedImgPath("ic_login_privacy_checked") |
| | | .setCheckedImgPath("icon_login_agreement_check_highlight") |
| | | .setCheckBoxHeight(20) |
| | | .setCheckBoxWidth(20) |
| | | .setUncheckedImgPath("icon_login_agreement_check") |
| | | .setPrivacyTextSize(11) |
| | | .setPrivacyState(true) |
| | | .setPrivacyOffsetY(150) |
| | | .setPrivacyState(false) |
| | | .setVendorPrivacyPrefix("《") |
| | | .setVendorPrivacySuffix("》") |
| | | .create(); |
| | |
| | | |
| | | public void checkEnv() { |
| | | //检测环境 |
| | | sdkInit(); |
| | | mPhoneNumberAuthHelper.checkEnvAvailable(2); |
| | | } |
| | | |
New file |
| | |
| | | package com.tejia.lijin.app.util.user; |
| | | |
| | | import android.util.Base64; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.tejia.lijin.app.BasicTextHttpResponseHandler; |
| | | import com.tejia.lijin.app.ShoppingApi; |
| | | import com.tejia.lijin.app.ShoppingApplication; |
| | | import com.tejia.lijin.app.entity.UserInfo; |
| | | import com.tejia.lijin.app.util.downutil.StringUtils; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.io.UnsupportedEncodingException; |
| | | |
| | | /** |
| | | * 登录管理器 |
| | | */ |
| | | public class LoginManager { |
| | | |
| | | //需要绑定电话号码 |
| | | public final static int CODE_BIND_PHONE = 101; |
| | | |
| | | //登录类型 |
| | | public final static int LOGIN_TYPE_PHONE = 1; |
| | | public final static int LOGIN_TYPE_WX = 2; |
| | | public final static int LOGIN_TYPE_TAOBAO = 3; |
| | | public final static int LOGIN_TYPE_QQ = 4; |
| | | |
| | | private static void login(LoginData loginData, final ILoginAndBindResult loginResultListener) { |
| | | |
| | | if (loginData.loginKey != null) { |
| | | if (loginData.loginType == LOGIN_TYPE_PHONE) { |
| | | //电话号码登录,带有绑定信息 |
| | | ShoppingApi.bindPhoneWithOutLogin(ShoppingApplication.application, loginData.verifyCode, loginData.phone, loginData.accessToken, loginData.loginKey, new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onStart() { |
| | | super.onStart(); |
| | | loginResultListener.onBindStart(); |
| | | } |
| | | |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | super.onSuccessPerfect(statusCode, headers, jsonObject); |
| | | if (jsonObject.optInt("code") == 0) { |
| | | Gson gson = new GsonBuilder().serializeNulls().create(); |
| | | JSONObject data = jsonObject.optJSONObject("data"); |
| | | final UserInfo info = gson.fromJson(data.optJSONObject("userInfo").toString(), new TypeToken<UserInfo>() { |
| | | }.getType()); |
| | | loginResultListener.onBindSuccess(info); |
| | | } else { |
| | | loginResultListener.onBindFail(jsonObject.optInt("code"), jsonObject.optString("msg")); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(int statusCode, Header[] headers, String jsonObject, Throwable e) { |
| | | super.onFailure(statusCode, headers, jsonObject, e); |
| | | loginResultListener.onBindFail(500, "网络请求出错"); |
| | | } |
| | | |
| | | @Override |
| | | public void onFinish() { |
| | | super.onFinish(); |
| | | loginResultListener.onBindFinish(); |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | } else { |
| | | |
| | | ShoppingApi.loginNew(ShoppingApplication.application, loginData.verifyCode, loginData.phone, loginData.wxCode, loginData.loginType + "", loginData.accessToken, loginData.qqUser, new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | int code = jsonObject.optInt("code"); |
| | | if (code == 0) { |
| | | Gson gson = new GsonBuilder().serializeNulls().create(); |
| | | JSONObject data = jsonObject.optJSONObject("data"); |
| | | final UserInfo info = gson.fromJson(data.optJSONObject("userInfo").toString(), new TypeToken<UserInfo>() { |
| | | }.getType()); |
| | | loginResultListener.onLoginSuccess(info); |
| | | } else if (code == CODE_BIND_PHONE) { |
| | | JSONObject data = jsonObject.optJSONObject("data"); |
| | | String key = data.optString("key"); |
| | | loginResultListener.bindPhone(key); |
| | | } else { |
| | | loginResultListener.onLoginFail(code, jsonObject.optString("msg")); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(int statusCode, Header[] headers, String jsonObject, Throwable e) { |
| | | super.onFailure(statusCode, headers, jsonObject, e); |
| | | loginResultListener.onLoginFail(500, "网络请求出错"); |
| | | } |
| | | |
| | | @Override |
| | | public void onStart() { |
| | | super.onStart(); |
| | | loginResultListener.onLoginStart(); |
| | | } |
| | | |
| | | @Override |
| | | public void onFinish() { |
| | | super.onFinish(); |
| | | loginResultListener.onLoginFinish(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 电话号码登录 |
| | | * |
| | | * @param phone |
| | | * @param vcode |
| | | * @param accessToken |
| | | * @param loginResultListener |
| | | */ |
| | | public static void loginByPhone(String phone, String vcode, String accessToken, ILoginAndBindResult loginResultListener) { |
| | | LoginData loginData = new LoginData(); |
| | | loginData.loginType = LOGIN_TYPE_PHONE; |
| | | loginData.phone = phone; |
| | | loginData.verifyCode = vcode; |
| | | loginData.accessToken = accessToken; |
| | | login(loginData, loginResultListener); |
| | | } |
| | | |
| | | /** |
| | | * 绑定电话号码登录(loginKey中带有上次登录信息) |
| | | * |
| | | * @param phone |
| | | * @param vcode |
| | | * @param accessToken |
| | | * @param loginKey |
| | | * @param loginResultListener |
| | | */ |
| | | public static void loginWithPhone(String phone, String vcode, String accessToken, String loginKey, ILoginAndBindResult loginResultListener) { |
| | | LoginData loginData = new LoginData(); |
| | | loginData.phone = phone; |
| | | loginData.verifyCode = vcode; |
| | | loginData.accessToken = accessToken; |
| | | loginData.loginKey = loginKey; |
| | | loginData.loginType=LOGIN_TYPE_PHONE; |
| | | login(loginData, loginResultListener); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信登录 |
| | | * |
| | | * @param code |
| | | * @param loginResultListener |
| | | */ |
| | | public static void loginByWX(String code, ILoginAndBindResult loginResultListener) { |
| | | LoginData loginData = new LoginData(); |
| | | loginData.loginType = LOGIN_TYPE_WX; |
| | | loginData.wxCode = code; |
| | | login(loginData, loginResultListener); |
| | | } |
| | | |
| | | /** |
| | | * QQ登录 |
| | | */ |
| | | public static void loginByQQ(QQLoginManager.QQUserInfo user, ILoginAndBindResult loginResultListener) { |
| | | LoginData loginData = new LoginData(); |
| | | loginData.loginType = LOGIN_TYPE_QQ; |
| | | try { |
| | | loginData.qqUser = Base64.encodeToString(new Gson().toJson(user).getBytes("UTF-8"), Base64.NO_WRAP); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | login(loginData, loginResultListener); |
| | | } |
| | | |
| | | static class LoginData { |
| | | public String verifyCode; |
| | | private String wxCode; |
| | | private String phone; |
| | | private String accessToken; |
| | | public int loginType; |
| | | public String loginKey; |
| | | public String qqUser; |
| | | } |
| | | |
| | | public static interface ILoginAndBindResult { |
| | | public void onLoginStart(); |
| | | |
| | | public void onLoginFinish(); |
| | | |
| | | public void onLoginSuccess(UserInfo user); |
| | | |
| | | public void onLoginFail(int code, String msg); |
| | | |
| | | public void bindPhone(String key); |
| | | |
| | | public void onBindStart(); |
| | | |
| | | public void onBindFinish(); |
| | | |
| | | public void onBindSuccess(UserInfo user); |
| | | |
| | | public void onBindFail(int code, String msg); |
| | | } |
| | | |
| | | public static abstract class LoginAndBindListener implements ILoginAndBindResult { |
| | | public void onLoginStart() { |
| | | } |
| | | |
| | | public void onLoginFinish() { |
| | | |
| | | } |
| | | |
| | | public void onLoginSuccess(UserInfo user) { |
| | | |
| | | } |
| | | |
| | | public void onLoginFail(int code, String msg) { |
| | | |
| | | } |
| | | |
| | | public void bindPhone(String key) { |
| | | |
| | | } |
| | | |
| | | public void onBindStart() { |
| | | |
| | | } |
| | | |
| | | public void onBindFinish() { |
| | | |
| | | } |
| | | |
| | | public void onBindSuccess(UserInfo user) { |
| | | |
| | | } |
| | | |
| | | public void onBindFail(int code, String msg) { |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.tejia.lijin.app.util.user; |
| | | |
| | | import android.app.Activity; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.util.Log; |
| | | import android.widget.Toast; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.tejia.lijin.app.ui.mine.LoginSelectActivity; |
| | | import com.tejia.lijin.app.util.Constant; |
| | | import com.tencent.connect.auth.QQToken; |
| | | import com.tencent.connect.common.Constants; |
| | | import com.tencent.tauth.DefaultUiListener; |
| | | import com.tencent.tauth.IUiListener; |
| | | import com.tencent.tauth.Tencent; |
| | | import com.tencent.tauth.UiError; |
| | | |
| | | import org.json.JSONException; |
| | | import org.json.JSONObject; |
| | | |
| | | public class QQLoginManager { |
| | | private static QQLoginManager instance; |
| | | private Context mContext; |
| | | private Tencent mTencent = null; |
| | | |
| | | private IUiListener qqLoginListener = null; |
| | | |
| | | public QQLoginManager(Context context) { |
| | | this.mContext = context; |
| | | mTencent = Tencent.createInstance(Constant.QQ_APP_ID, mContext, ""); |
| | | } |
| | | |
| | | public static QQLoginManager getInstance(Context context) { |
| | | if (instance == null) { |
| | | instance = new QQLoginManager(context); |
| | | } |
| | | return instance; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 开始登录 |
| | | * |
| | | * @param activity |
| | | * @param loginListener |
| | | */ |
| | | public void startLogin(Activity activity, final QQLoginListener loginListener) { |
| | | this.qqLoginListener = new DefaultUiListener() { |
| | | public void onComplete(Object var1) { |
| | | try { |
| | | JSONObject jsonObject = new JSONObject(var1.toString()); |
| | | if (jsonObject.optInt("ret") != 0) { |
| | | loginListener.onAuthFail(jsonObject.optInt("ret"), jsonObject.optString("msg")); |
| | | return; |
| | | } |
| | | QQToken qqToken = new QQToken(Constant.QQ_APP_ID); |
| | | final String openId = jsonObject.optString("openid"); |
| | | qqToken.setAccessToken(jsonObject.optString("access_token"), jsonObject.optString("expires_in")); |
| | | qqToken.setOpenId(openId); |
| | | com.tencent.connect.UserInfo info = new com.tencent.connect.UserInfo(mContext, qqToken); |
| | | info.getUserInfo(new DefaultUiListener() { |
| | | @Override |
| | | public void onComplete(Object o) { |
| | | super.onComplete(o); |
| | | try { |
| | | JSONObject data = new JSONObject(o.toString()); |
| | | if (data.optInt("ret") != 0) { |
| | | loginListener.onGetUserInfoFail(data.optInt("ret"), data.optString("msg")); |
| | | return; |
| | | } |
| | | QQUserInfo qqUser = new Gson().fromJson(data.toString(), QQUserInfo.class); |
| | | qqUser.setOpenid(openId); |
| | | loginListener.onGetUserInfoSuccess(qqUser); |
| | | } catch (JSONException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onError(UiError uiError) { |
| | | super.onError(uiError); |
| | | loginListener.onGetUserInfoFail(uiError.errorCode,uiError.errorMessage); |
| | | } |
| | | }); |
| | | } catch (JSONException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | public void onError(UiError var1) { |
| | | loginListener.onAuthFail(var1.errorCode, var1.errorMessage); |
| | | } |
| | | |
| | | public void onCancel() { |
| | | loginListener.onAuthCancel(); |
| | | } |
| | | |
| | | public void onWarning(int var1) { |
| | | } |
| | | }; |
| | | |
| | | mTencent.login(activity, "all", qqLoginListener); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * activity 生命周期onActivityResult |
| | | * |
| | | * @param requestCode |
| | | * @param resultCode |
| | | * @param data |
| | | */ |
| | | public void onActivityResult(int requestCode, int resultCode, Intent data) { |
| | | if (qqLoginListener != null) |
| | | if (requestCode == Constants.REQUEST_LOGIN) { |
| | | Tencent.onActivityResultData(requestCode, resultCode, data, qqLoginListener); |
| | | } |
| | | } |
| | | |
| | | |
| | | public interface QQLoginListener { |
| | | public void onAuthCancel(); |
| | | |
| | | public void onAuthSuccess(String openId); |
| | | |
| | | public void onAuthFail(int code, String msg); |
| | | |
| | | public void onGetUserInfoSuccess(QQUserInfo user); |
| | | |
| | | public void onGetUserInfoFail(int code, String msg); |
| | | } |
| | | |
| | | public static class QQUserInfo { |
| | | private String openid; |
| | | private String nickname; |
| | | private String gender; |
| | | private int gender_type; |
| | | private String province; |
| | | private String city; |
| | | private String year; |
| | | private String figureurl; |
| | | private String figureurl_1; |
| | | private String figureurl_2; |
| | | |
| | | public String getOpenid() { |
| | | return openid; |
| | | } |
| | | |
| | | public void setOpenid(String openid) { |
| | | this.openid = openid; |
| | | } |
| | | |
| | | public String getNickname() { |
| | | return nickname; |
| | | } |
| | | |
| | | public void setNickname(String nickname) { |
| | | this.nickname = nickname; |
| | | } |
| | | |
| | | public String getGender() { |
| | | return gender; |
| | | } |
| | | |
| | | public void setGender(String gender) { |
| | | this.gender = gender; |
| | | } |
| | | |
| | | public int getGender_type() { |
| | | return gender_type; |
| | | } |
| | | |
| | | public void setGender_type(int gender_type) { |
| | | this.gender_type = gender_type; |
| | | } |
| | | |
| | | public String getProvince() { |
| | | return province; |
| | | } |
| | | |
| | | public void setProvince(String province) { |
| | | this.province = province; |
| | | } |
| | | |
| | | public String getCity() { |
| | | return city; |
| | | } |
| | | |
| | | public void setCity(String city) { |
| | | this.city = city; |
| | | } |
| | | |
| | | public String getYear() { |
| | | return year; |
| | | } |
| | | |
| | | public void setYear(String year) { |
| | | this.year = year; |
| | | } |
| | | |
| | | public String getFigureurl() { |
| | | return figureurl; |
| | | } |
| | | |
| | | public void setFigureurl(String figureurl) { |
| | | this.figureurl = figureurl; |
| | | } |
| | | |
| | | public String getFigureurl_1() { |
| | | return figureurl_1; |
| | | } |
| | | |
| | | public void setFigureurl_1(String figureurl_1) { |
| | | this.figureurl_1 = figureurl_1; |
| | | } |
| | | |
| | | public String getFigureurl_2() { |
| | | return figureurl_2; |
| | | } |
| | | |
| | | public void setFigureurl_2(String figureurl_2) { |
| | | this.figureurl_2 = figureurl_2; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | */ |
| | | public static UserInfo getUserInfo(Context context) { |
| | | SharedPreferences sp = context.getSharedPreferences("user", MODE_PRIVATE); |
| | | String userInfo = sp.getString("userinfo", ""); |
| | | String userInfo = sp.getString("userinfo_new", ""); |
| | | if (StringUtils.isNullOrEmpty(userInfo)) |
| | | return null; |
| | | JSONObject jsonObject = null; |
| | | try { |
| | | jsonObject = new JSONObject(userInfo); |
| | | } catch (JSONException e) { |
| | | return null; |
| | | } |
| | | UserInfo info = gson.fromJson(jsonObject.optJSONObject("data").optJSONObject("user").toString(), new TypeToken<UserInfo>() { |
| | | UserInfo info = gson.fromJson(userInfo, new TypeToken<UserInfo>() { |
| | | }.getType()); |
| | | return info; |
| | | } |
| | |
| | | editor.putBoolean("isWxBind", false); |
| | | editor.putString("uid", "0"); |
| | | editor.remove("userinfo"); |
| | | editor.remove("userinfo_new"); |
| | | editor.commit(); |
| | | |
| | | //清除个人信息缓存 |
| | |
| | | return resourceId; |
| | | } |
| | | |
| | | /** |
| | | * 登录成功 |
| | | * |
| | | * @param context |
| | | * @param info |
| | | */ |
| | | public static void loginSuccess(Context context, UserInfo info) { |
| | | SharedPreferences sp = context.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_new", new Gson().toJson(info)); |
| | | editor.commit(); |
| | | MiPushClient.setAlias(context, info.getId(), null); |
| | | } |
| | | |
| | | |
| | | public static void jumpLogin(Context context) { |
| | | context.startActivity(new Intent(context, LoginSelectActivity.class)); |
| | |
| | | } |
| | | |
| | | @JavascriptInterface |
| | | public Object getUid() { |
| | | public String getUid(Object obj) { |
| | | return mContext.getSharedPreferences("user", MODE_PRIVATE).getString("uid", ""); |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | @JavascriptInterface |
| | | public void hiddenTopMenuCloseBtn() { |
| | | public void hiddenTopMenuCloseBtn(Object obj) { |
| | | if (!boo) |
| | | tv_top_bar_left2.setVisibility(View.GONE); |
| | | } |
| | | |
| | | |
| | | @JavascriptInterface |
| | | public void hideLoading() { |
| | | public void hideLoading(Object obj) { |
| | | if (!boo) |
| | | iv_right.post(new Runnable() { |
| | | @Override |
| | |
| | | } |
| | | |
| | | @JavascriptInterface |
| | | public void showLoading() { |
| | | public void showLoading(Object obj) { |
| | | if (!boo) |
| | | iv_right.post(new Runnable() { |
| | | @Override |
| | |
| | | } |
| | | |
| | | @JavascriptInterface |
| | | public void finishPage() { |
| | | public void finishPage(Object obj) { |
| | | if (!boo) |
| | | iv_right.post(new Runnable() { |
| | | @Override |
| | |
| | | |
| | | |
| | | @JavascriptInterface |
| | | public void showSharePanel() { |
| | | public void showSharePanel(Object obj) { |
| | | webShareDesc.setShare(); |
| | | } |
| | | |
| | |
| | | //请求广告失败 |
| | | @Override |
| | | public void onError(int code, String message) { |
| | | com.alibaba.fastjson.JSONObject result = new com.alibaba.fastjson.JSONObject(); |
| | | result.put("code", 1); |
| | | result.put("msg", message); |
| | | handler.complete(result); |
| | |
| | | //视频广告加载后,视频资源缓存到本地的回调,在此回调后,播放本地视频,流畅不阻塞。 |
| | | @Override |
| | | public void onRewardVideoCached() { |
| | | |
| | | //开发者做一个标识 |
| | | if (mttRewardVideoAd != null) { |
| | | mttRewardVideoAd.showRewardVideoAd(mContext, TTAdConstant.RitScenes.CUSTOMIZE_SCENES, "scenes_test"); |
| | | mttRewardVideoAd = null; |
| | | } |
| | | com.alibaba.fastjson.JSONObject result = new com.alibaba.fastjson.JSONObject(); |
| | | result.put("code", 100); |
| | | result.put("msg", "缓存成功"); |
| | | handler.setProgressData(result); |
| | | } |
| | | |
| | | //视频广告的素材加载完毕,比如视频url等,在此回调后,可以播放在线视频,网络不好可能出现加载缓冲,影响体验。 |
| | |
| | | |
| | | @Override |
| | | public void onVideoError() { |
| | | com.alibaba.fastjson.JSONObject result = new com.alibaba.fastjson.JSONObject(); |
| | | result.put("code", 2); |
| | | result.put("msg", "视频出错"); |
| | | handler.complete(result); |
| | |
| | | |
| | | @Override |
| | | public void onRewardVerify(boolean b, int i, String s, int i1, String s1) { |
| | | com.alibaba.fastjson.JSONObject result = new com.alibaba.fastjson.JSONObject(); |
| | | result.put("code", 0); |
| | | result.put("msg", "广告展示完成"); |
| | | handler.complete(result); |
| | |
| | | @Override |
| | | public void run() { |
| | | View view = LayoutInflater.from(mContext).inflate(R.layout.item_reward_ad_fail, null); |
| | | LinearLayout.LayoutParams params=new LinearLayout.LayoutParams(DimenUtils.getScreenWidth(mContext)*4/5,LinearLayout.LayoutParams.WRAP_CONTENT); |
| | | LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DimenUtils.getScreenWidth(mContext) * 4 / 5, LinearLayout.LayoutParams.WRAP_CONTENT); |
| | | view.setLayoutParams(params); |
| | | TextView tv_content = view.findViewById(R.id.tv_content); |
| | | tv_content.setText(msg + ""); |
| | |
| | | } |
| | | |
| | | if (urlList.size() > 0) { |
| | | showLoading(); |
| | | showLoading(null); |
| | | shareTempImgEntity = new ArrayList<>(); |
| | | //去下载 |
| | | new DownLoadFile().downloadMultiImages(urlList, filePathList, mContext, new DownLoadFile.FileDownLoadListener() { |
| | | @Override |
| | | public void finish(List<File> fileList) { |
| | | hideLoading(); |
| | | hideLoading(null); |
| | | //完成下载 |
| | | |
| | | if (fileList != null) |
| | |
| | | } |
| | | }); |
| | | } else { |
| | | hideLoading(); |
| | | hideLoading(null); |
| | | if (type == 1) |
| | | shareHandler.sendEmptyMessage(platform); |
| | | else { |
New file |
| | |
| | | package com.tejia.lijin.wxapi; |
| | | |
| | | |
| | | import android.content.DialogInterface; |
| | | import android.content.Intent; |
| | | import android.content.SharedPreferences; |
| | | import android.graphics.Color; |
| | | import android.os.Build; |
| | | import android.os.Bundle; |
| | | import android.view.View; |
| | | import android.view.Window; |
| | | import android.view.WindowManager; |
| | | import android.widget.Toast; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.tejia.lijin.app.BasicTextHttpResponseHandler; |
| | | import com.tejia.lijin.app.ShoppingApi; |
| | | import com.tejia.lijin.app.ShoppingApplication; |
| | | import com.tejia.lijin.app.entity.UserInfo; |
| | | import com.tejia.lijin.app.ui.BaseActivity; |
| | | import com.tejia.lijin.app.ui.dialog.AddZFBInfoDialog2; |
| | | import com.tejia.lijin.app.ui.mine.LoginSelectActivity; |
| | | import com.tejia.lijin.app.util.ui.dialog.DialogUtil; |
| | | import com.tejia.lijin.app.util.user.AccountBindManager; |
| | | import com.tejia.lijin.app.util.user.LoginManager; |
| | | import com.tejia.lijin.app.util.user.UserUtil; |
| | | import com.tencent.mm.opensdk.modelbase.BaseReq; |
| | | import com.tencent.mm.opensdk.modelbase.BaseResp; |
| | | import com.tencent.mm.opensdk.modelmsg.SendAuth; |
| | | import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler; |
| | | import com.xiaomi.mipush.sdk.MiPushClient; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONObject; |
| | | |
| | | import androidx.annotation.Nullable; |
| | | |
| | | |
| | | public class WXEntryActivity extends BaseActivity implements IWXAPIEventHandler { |
| | | |
| | | private static final int RETURN_MSG_TYPE_LOGIN = 1; |
| | | private static final int RETURN_MSG_TYPE_SHARE = 2; |
| | | private static final int RETURN_MSG_TYPE_XCX = 19; |
| | | |
| | | |
| | | @Override |
| | | protected void onCreate(@Nullable Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | View decorView = getWindow().getDecorView();//获取屏幕的decorView |
| | | decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN); |
| | | |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { |
| | | Window window = getWindow(); |
| | | //设置修改状态栏 |
| | | window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); |
| | | //设置状态栏的颜色,和你的app主题或者标题栏颜色设置一致就ok了 |
| | | window.setStatusBarColor(Color.TRANSPARENT); |
| | | } |
| | | //如果没回调onResp,八成是这句没有写 |
| | | ShoppingApplication.application.mWxApi.handleIntent(getIntent(), this); |
| | | } |
| | | |
| | | // 微信发送请求到第三方应用时,会回调到该方法 |
| | | @Override |
| | | public void onReq(BaseReq req) { |
| | | // SingleToast.showToast(WXEntryActivity.this, "发送请求"); |
| | | } |
| | | |
| | | // 第三方应用发送到微信的请求处理后的响应结果,会回调到该方法 |
| | | //app发送消息给微信,处理返回消息的回调 |
| | | @Override |
| | | public void onResp(BaseResp resp) { |
| | | // Log.e("mResult", resp.errCode + ""); |
| | | switch (resp.errCode) { |
| | | case BaseResp.ErrCode.ERR_AUTH_DENIED: |
| | | case BaseResp.ErrCode.ERR_UNSUPPORT: |
| | | case BaseResp.ErrCode.ERR_COMM: |
| | | case BaseResp.ErrCode.ERR_BAN: |
| | | case BaseResp.ErrCode.ERR_USER_CANCEL: |
| | | |
| | | finish(); |
| | | break; |
| | | case BaseResp.ErrCode.ERR_SENT_FAILED: |
| | | |
| | | finish(); |
| | | break; |
| | | case BaseResp.ErrCode.ERR_OK: |
| | | switch (resp.getType()) { |
| | | case RETURN_MSG_TYPE_LOGIN: |
| | | String code = ((SendAuth.Resp) resp).code; |
| | | SharedPreferences sp = getSharedPreferences("user", MODE_PRIVATE); |
| | | Long uid = UserUtil.getUid(getApplicationContext()); |
| | | boolean bindwx = sp.getBoolean("bindwx", false); |
| | | if (bindwx) { |
| | | changeWx(code, uid); |
| | | sp.edit().putBoolean("bindwx", false).commit(); |
| | | break; |
| | | } |
| | | if (!sp.getBoolean("isLogin", false)) { |
| | | //拿到了微信返回的code,立马再去请求access_token |
| | | setLogin(code); |
| | | } else { |
| | | // bindInfo("2", "", "", code, |
| | | // getSharedPreferences("user", MODE_PRIVATE).getString("uid", "0")); |
| | | |
| | | //在 微信激活邀请码的时候 需要一个微信code 用完即删 |
| | | SharedPreferences.Editor editor = sp.edit(); |
| | | editor.putString("wxcodeactivation", code);//记录微信激活code |
| | | editor.commit(); |
| | | |
| | | finish(); |
| | | } |
| | | break; |
| | | |
| | | case RETURN_MSG_TYPE_SHARE: |
| | | // UIUtils.showToast("微信分享成功"); |
| | | |
| | | finish(); |
| | | break; |
| | | case RETURN_MSG_TYPE_XCX: |
| | | // UIUtils.showToast("微信分享成功"); |
| | | |
| | | finish(); |
| | | break; |
| | | } |
| | | |
| | | break; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 请求服务器匹配验证码 |
| | | */ |
| | | private void setLogin(String code) { |
| | | //TODO 做QQ登录 |
| | | LoginManager.loginByWX(code, new LoginManager.LoginAndBindListener() { |
| | | |
| | | @Override |
| | | public void onLoginStart() { |
| | | super.onLoginStart(); |
| | | DialogUtil.show(loadingDialog); |
| | | } |
| | | |
| | | @Override |
| | | public void onLoginFinish() { |
| | | super.onLoginFinish(); |
| | | DialogUtil.dismiss(loadingDialog); |
| | | } |
| | | |
| | | @Override |
| | | public void onLoginSuccess(UserInfo user) { |
| | | super.onLoginSuccess(user); |
| | | UserUtil.loginSuccess(getApplicationContext(), user); |
| | | Toast.makeText(getApplicationContext(), "恭喜你,登录成功", Toast.LENGTH_SHORT).show(); |
| | | finish(); |
| | | } |
| | | |
| | | @Override |
| | | public void onLoginFail(int code, String msg) { |
| | | super.onLoginFail(code, msg); |
| | | Toast.makeText(WXEntryActivity.this, msg, Toast.LENGTH_SHORT).show(); |
| | | finish(); |
| | | } |
| | | |
| | | @Override |
| | | public void bindPhone(String key) { |
| | | super.bindPhone(key); |
| | | Intent intent = new Intent(getApplicationContext(), LoginSelectActivity.class); |
| | | intent.putExtra("type", LoginSelectActivity.TYPE_BIND_WITHOUT_LOGINED); |
| | | intent.putExtra("key", key); |
| | | startActivity(intent); |
| | | finish(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | private void changeWx(String code, Long uid) { |
| | | AccountBindManager.bindWX(getApplicationContext(), uid, code, new LoginManager.LoginAndBindListener() { |
| | | |
| | | @Override |
| | | public void onBindStart() { |
| | | super.onBindStart(); |
| | | DialogUtil.show(loadingDialog); |
| | | } |
| | | |
| | | @Override |
| | | public void onBindFinish() { |
| | | super.onBindFinish(); |
| | | DialogUtil.dismiss(loadingDialog); |
| | | } |
| | | |
| | | @Override |
| | | public void onBindFail(int code, String msg) { |
| | | super.onBindFail(code, msg); |
| | | if (code == 5) { |
| | | AddZFBInfoDialog2.Builder builder = new AddZFBInfoDialog2.Builder(WXEntryActivity.this); |
| | | builder.setTitle("更换提醒").setMessage("该帐号没有绑定手机号,需绑定手机号才能完成微信更换。\n") |
| | | .setPositiveButton("绑定手机号", new DialogInterface.OnClickListener() { |
| | | @Override |
| | | public void onClick(DialogInterface dialog, int which) { |
| | | dialog.dismiss(); |
| | | SharedPreferences sp = getSharedPreferences("user", MODE_PRIVATE); |
| | | String uid = sp.getString("uid", ""); |
| | | Intent intent = new Intent(WXEntryActivity.this, LoginSelectActivity.class); |
| | | intent.putExtra("uid", uid); |
| | | intent.putExtra("type", LoginSelectActivity.TYPE_BIND); |
| | | startActivity(intent); |
| | | |
| | | finish(); |
| | | } |
| | | }).setNegativeButton("不了", new DialogInterface.OnClickListener() { |
| | | @Override |
| | | public void onClick(DialogInterface dialog, int which) { |
| | | dialog.dismiss(); |
| | | |
| | | finish(); |
| | | } |
| | | }).create().show(); |
| | | } else { |
| | | Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show(); |
| | | finish(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onBindSuccess(UserInfo user) { |
| | | super.onBindSuccess(user); |
| | | SharedPreferences sp = getSharedPreferences("user", MODE_PRIVATE); |
| | | SharedPreferences.Editor editor = sp.edit(); |
| | | editor.putBoolean("isWxBind", true); |
| | | Toast.makeText(WXEntryActivity.this, "绑定成功", Toast.LENGTH_SHORT).show(); |
| | | editor.commit(); |
| | | finish(); |
| | | } |
| | | }); |
| | | } |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android" |
| | | |
| | | android:cycles="2"> |
| | | |
| | | </cycleInterpolator> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <translate xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:fromXDelta="0" |
| | | android:toXDelta="40" |
| | | android:duration="250" |
| | | android:interpolator="@anim/ipr_user_agreement"> |
| | | |
| | | |
| | | </translate> |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <shape xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | <corners android:radius="2dp" /> |
| | | <solid android:color="@color/main_text_color" /> |
| | | <solid android:color="@color/white" /> |
| | | </shape> |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <shape xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | <corners android:radius="2dp"/> |
| | | <solid android:color="@color/trends_goods_bg" /> |
| | | <solid android:color="#80FFFFFF" /> |
| | | |
| | | <!--<size--> |
| | | <!--android:width="10px"--> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <selector xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | <item android:drawable="@drawable/icon_login_agreement_check_highlight" android:state_checked="true"></item> |
| | | <item android:drawable="@drawable/icon_login_agreement_check" android:state_checked="false"></item> |
| | | </selector> |
| | |
| | | android:layout_marginBottom="20dp" |
| | | android:orientation="horizontal"> |
| | | |
| | | <CheckBox |
| | | android:id="@+id/cb_agree" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginRight="2.5dp" |
| | | android:button="@drawable/selector_login_agreement"></CheckBox> |
| | | |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | |
| | | |
| | | <ImageView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content"></ImageView> |
| | | android:layout_height="wrap_content" |
| | | android:src="@drawable/ic_goods_detail_jump_loading_to"></ImageView> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_time" |
| | |
| | | android:layout_weight="1" |
| | | android:gravity="center" |
| | | android:text="仍要创建" |
| | | android:layout_marginRight="8dp" |
| | | android:textColor="#fff53245" |
| | | android:textSize="15sp" /> |
| | | |
| | |
| | | android:id="@+id/tv_fanli" |
| | | android:layout_width="0dp" |
| | | android:layout_height="36dp" |
| | | android:layout_marginLeft="8dp" |
| | | |
| | | android:layout_weight="1" |
| | | android:gravity="center" |
| | | android:text="去返利" |
| | |
| | | android:gravity="left" |
| | | android:maxWidth="130dp" |
| | | android:singleLine="true" |
| | | android:text="昵称昵称昵称昵称" |
| | | android:textColor="@color/white" |
| | | android:textSize="18sp" |
| | | android:textStyle="bold" |
| | |
| | | |
| | | </LinearLayout> |
| | | |
| | | <com.tejia.lijin.app.ui.subview.RadiusCardView |
| | | android:layout_width="53.5dp" |
| | | android:layout_height="12.5dp" |
| | | android:layout_marginTop="5dp" |
| | | app:rcv_bottomRightRadiu="12dp" |
| | | app:rcv_topLeftRadiu="12dp"> |
| | | |
| | | <ImageView |
| | | android:id="@+id/iv_rank" |
| | | android:scaleType="fitXY" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent"></ImageView> |
| | | |
| | | </com.tejia.lijin.app.ui.subview.RadiusCardView> |
| | | |
| | | |
| | | <androidx.appcompat.widget.LinearLayoutCompat |
| | | android:id="@+id/tv_user_numlayout" |
| | | android:layout_width="wrap_content" |
| | |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="38dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center_horizontal" |
| | | android:background="@color/transparent" |
| | | android:gravity="center" |
| | |
| | | <FrameLayout |
| | | android:id="@+id/fl_search_content" |
| | | android:layout_width="0dp" |
| | | android:layout_height="match_parent" |
| | | android:layout_height="38dp" |
| | | android:layout_gravity="center_vertical" |
| | | android:layout_weight="1" |
| | | android:background="@drawable/selector_search_bg"> |
| | |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginLeft="20dp" |
| | | android:layout_marginRight="4.5dp" |
| | | android:layout_marginLeft="16dp" |
| | | android:layout_marginTop="2dp" |
| | | android:layout_marginRight="10dp" |
| | | android:drawableTop="@drawable/icon_recommend_course" |
| | | android:drawablePadding="3dp" |
| | | android:gravity="center" |
| | |
| | | |
| | | <FrameLayout |
| | | android:layout_width="0dp" |
| | | android:layout_height="130dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginLeft="10dp" |
| | | android:layout_weight="1"> |
| | | |
| | |
| | | android:id="@+id/fl_content" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_margin="5dp"> |
| | | android:layout_margin="5dp" |
| | | android:paddingLeft="3dp" |
| | | android:paddingTop="2.5dp" |
| | | android:paddingRight="3dp"> |
| | | |
| | | |
| | | <LinearLayout |
| | |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center" |
| | | app:ratio="0.8254"> |
| | | |
| | | <ImageView |
| | | android:id="@+id/iv_icon" |
| | | android:layout_width="match_parent" |
| | |
| | | android:layout_marginRight="10dp" |
| | | android:orientation="vertical"> |
| | | |
| | | <LinearLayout |
| | | <FrameLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:orientation="vertical"> |
| | |
| | | android:id="@+id/slide_indicator_point" |
| | | android:layout_width="50dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center_horizontal" |
| | | android:layout_marginBottom="10dp" |
| | | android:layout_gravity="center_horizontal|bottom" |
| | | android:focusable="true" |
| | | android:maxHeight="4dp" |
| | | android:minHeight="4dp" |
| | | android:layout_marginBottom="5dp" |
| | | android:progressDrawable="@drawable/bg_fast_scroll_bar_track" |
| | | android:thumb="@drawable/bg_fast_scroll_bar_thumb" |
| | | android:visibility="visible" /> |
| | | </LinearLayout> |
| | | </FrameLayout> |
| | | |
| | | |
| | | <FrameLayout |
| | |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center" |
| | | android:gravity="center" |
| | | android:orientation="horizontal" |
| | | android:paddingTop="8dp"> |
| | | android:orientation="horizontal"> |
| | | |
| | | <RadioButton |
| | | android:id="@+id/rb_nav_recommend" |
| | |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center" |
| | | android:orientation="horizontal" |
| | | android:paddingTop="8dp" |
| | | android:paddingBottom="5dp"> |
| | | |
| | | <View |
| | |
| | | android:layout_marginTop="3dp" |
| | | android:layout_marginRight="20dp" |
| | | android:src="@drawable/ic_msg_red_point" |
| | | android:visibility="invisible" /> |
| | | android:visibility="visible" /> |
| | | </LinearLayout> |
| | | </FrameLayout> |
| | |
| | | <color name="register_gray2">#f6f6f6</color> |
| | | <color name="transport_register_gray">#aaf3f3f3</color> |
| | | <color name="transport_register_gray2">#7F7F7F</color> |
| | | <color name="bg">#ffeeeeee</color> |
| | | <color name="bg">#ffF3F3F3</color> |
| | | <color name="mine_reward_statistics_bg">#fff7f7f7</color> |
| | | <color name="trends_goods_bg">#ffe0e0e0</color> |
| | | <color name="collect_gain_coupon_bg2">#ffffd8e8</color> |
| | |
| | | <item name="android:layout_gravity">center</item> |
| | | <item name="android:layout_weight">1</item> |
| | | <item name="android:button">@null</item> |
| | | <item name="android:drawablePadding">5dp</item> |
| | | <item name="android:drawablePadding">4dp</item> |
| | | <item name="android:gravity">center</item> |
| | | <item name="android:textAppearance">?android:attr/textAppearanceSmall</item> |
| | | <item name="android:textColor">@color/selector_bottom_bar_text</item> |
| | |
| | | #Tue Oct 08 13:37:12 CST 2019 |
| | | #Tue May 18 16:33:16 CST 2021 |
| | | distributionBase=GRADLE_USER_HOME |
| | | distributionPath=wrapper/dists |
| | | zipStoreBase=GRADLE_USER_HOME |
| | | zipStorePath=wrapper/dists |
| | | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip |
| | | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip |