作者 liming

sss

@@ -2,14 +2,14 @@ apply plugin: 'com.android.application' @@ -2,14 +2,14 @@ apply plugin: 'com.android.application'
2 2
3 android { 3 android {
4 4
5 - /* signingConfigs {  
6 - release {  
7 - keyAlias 'FireControl'  
8 - keyPassword '11111111'  
9 - storeFile file('./FireControl.jks')  
10 - storePassword '11111111'  
11 - }  
12 - }*/ 5 + signingConfigs {
  6 + debug {
  7 + storeFile file('D:\\project\\huahang_project\\app\\xuetubao.jks')
  8 + storePassword '111111'
  9 + keyAlias = 'xuetubao'
  10 + keyPassword '111111'
  11 + }
  12 + }
13 13
14 compileSdkVersion 28 14 compileSdkVersion 28
15 defaultConfig { 15 defaultConfig {
@@ -82,7 +82,7 @@ dependencies { @@ -82,7 +82,7 @@ dependencies {
82 implementation 'com.jakewharton:butterknife:8.8.1' 82 implementation 'com.jakewharton:butterknife:8.8.1'
83 annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1' 83 annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
84 /* implementation 'com.android.support:recyclerview-v7:28.0.0' 84 /* implementation 'com.android.support:recyclerview-v7:28.0.0'
85 - implementation 'com.jcodecraeer:xrecyclerview:1.5.9'*/ 85 + implementation 'com.jcodecraeer:xrecyclerview:1.5.9'*/
86 implementation 'com.android.support:recyclerview-v7:28.1.1' 86 implementation 'com.android.support:recyclerview-v7:28.1.1'
87 implementation 'com.jcodecraeer:xrecyclerview:1.5.9' 87 implementation 'com.jcodecraeer:xrecyclerview:1.5.9'
88 implementation 'fm.jiecao:jiecaovideoplayer:5.5.2' 88 implementation 'fm.jiecao:jiecaovideoplayer:5.5.2'
@@ -92,11 +92,9 @@ dependencies { @@ -92,11 +92,9 @@ dependencies {
92 implementation 'org.greenrobot:eventbus:3.1.1' 92 implementation 'org.greenrobot:eventbus:3.1.1'
93 implementation files('libs/AMap3DMap_7.1.0_AMapSearch_7.1.0_AMapLocation_4.7.2_20191030.jar') 93 implementation files('libs/AMap3DMap_7.1.0_AMapSearch_7.1.0_AMapLocation_4.7.2_20191030.jar')
94 implementation 'com.youth.banner:banner:1.4.10' 94 implementation 'com.youth.banner:banner:1.4.10'
95 -  
96 // 微信 95 // 微信
97 - implementation 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:+'  
98 - implementation 'com.zhy:okhttputils:2.4.1'  
99 - 96 + // implementation 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:+'
  97 + // implementation 'com.zhy:okhttputils:2.4.1'
100 //ijkplayer 98 //ijkplayer
101 implementation 'com.dou361.ijkplayer:jjdxm-ijkplayer:1.0.5' 99 implementation 'com.dou361.ijkplayer:jjdxm-ijkplayer:1.0.5'
102 implementation 'tv.danmaku.ijk.media:ijkplayer-java:0.8.8' 100 implementation 'tv.danmaku.ijk.media:ijkplayer-java:0.8.8'
@@ -106,22 +104,18 @@ dependencies { @@ -106,22 +104,18 @@ dependencies {
106 implementation 'tv.danmaku.ijk.media:ijkplayer-x86:0.8.8' 104 implementation 'tv.danmaku.ijk.media:ijkplayer-x86:0.8.8'
107 implementation 'tv.danmaku.ijk.media:ijkplayer-x86_64:0.8.8' 105 implementation 'tv.danmaku.ijk.media:ijkplayer-x86_64:0.8.8'
108 implementation 'tv.danmaku.ijk.media:ijkplayer-exo:0.8.8' 106 implementation 'tv.danmaku.ijk.media:ijkplayer-exo:0.8.8'
109 -  
110 implementation 'com.hyman:flowlayout-lib:1.1.2' 107 implementation 'com.hyman:flowlayout-lib:1.1.2'
111 -  
112 //顶部导航栏 108 //顶部导航栏
113 implementation 'com.flyco.tablayout:FlycoTabLayout_Lib:2.1.2@aar' 109 implementation 'com.flyco.tablayout:FlycoTabLayout_Lib:2.1.2@aar'
114 -  
115 //ijkplayer 110 //ijkplayer
116 implementation 'com.dou361.ijkplayer:jjdxm-ijkplayer:1.0.5' 111 implementation 'com.dou361.ijkplayer:jjdxm-ijkplayer:1.0.5'
117 -  
118 implementation 'tv.danmaku.ijk.media:ijkplayer-java:0.8.8' 112 implementation 'tv.danmaku.ijk.media:ijkplayer-java:0.8.8'
119 implementation 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.8' 113 implementation 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.8'
120 -  
121 implementation 'tv.danmaku.ijk.media:ijkplayer-armv5:0.8.8' 114 implementation 'tv.danmaku.ijk.media:ijkplayer-armv5:0.8.8'
122 implementation 'tv.danmaku.ijk.media:ijkplayer-arm64:0.8.8' 115 implementation 'tv.danmaku.ijk.media:ijkplayer-arm64:0.8.8'
123 implementation 'tv.danmaku.ijk.media:ijkplayer-x86:0.8.8' 116 implementation 'tv.danmaku.ijk.media:ijkplayer-x86:0.8.8'
124 implementation 'tv.danmaku.ijk.media:ijkplayer-x86_64:0.8.8' 117 implementation 'tv.danmaku.ijk.media:ijkplayer-x86_64:0.8.8'
125 implementation 'tv.danmaku.ijk.media:ijkplayer-exo:0.8.8' 118 implementation 'tv.danmaku.ijk.media:ijkplayer-exo:0.8.8'
  119 + implementation files('libs/umeng-share-wechat-simplify-6.9.2.jar')
126 120
127 } 121 }
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
@@ -43,6 +43,20 @@ @@ -43,6 +43,20 @@
43 #保持泛型 43 #保持泛型
44 -keepattributes Signature 44 -keepattributes Signature
45 45
  46 +#友盟
  47 +-keep class com.umeng.** {*;}
  48 +-keepclassmembers class * {
  49 + public <init> (org.json.JSONObject);
  50 +}
  51 +-keepclassmembers enum * {
  52 + public static **[] values();
  53 + public static ** valueOf(java.lang.String);
  54 +}
  55 +
  56 +-keep public class [com.hh.xuetubao].R$*{
  57 +public static final int *;
  58 +}
  59 +
46 #保持所有实现 Serializable 接口的类成员 60 #保持所有实现 Serializable 接口的类成员
47 -keepclassmembers class * implements java.io.Serializable { 61 -keepclassmembers class * implements java.io.Serializable {
48 static final long serialVersionUID; 62 static final long serialVersionUID;
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <manifest xmlns:android="http://schemas.android.com/apk/res/android" 2 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  3 + xmlns:tools="http://schemas.android.com/tools"
3 package="com.hh.xuetubao"> 4 package="com.hh.xuetubao">
4 5
5 <uses-permission android:name="android.permission.INTERNET" /> 6 <uses-permission android:name="android.permission.INTERNET" />
6 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 7 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
7 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 8 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
8 - <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> 9 + <uses-permission
  10 + android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
  11 + tools:ignore="ProtectedPermissions" />
9 <!-- 允许程序访问WiFi网络信息 --> 12 <!-- 允许程序访问WiFi网络信息 -->
10 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> 13 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
11 <!-- 允许程序读写手机状态和身份 --> 14 <!-- 允许程序读写手机状态和身份 -->
12 <uses-permission android:name="android.permission.READ_PHONE_STATE" /> 15 <uses-permission android:name="android.permission.READ_PHONE_STATE" />
13 <!-- 允许程序访问CellID或WiFi热点来获取粗略的位置 --> 16 <!-- 允许程序访问CellID或WiFi热点来获取粗略的位置 -->
14 <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> 17 <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
  18 + <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  19 +
15 20
16 <application 21 <application
17 android:name=".MyApplication" 22 android:name=".MyApplication"
@@ -150,8 +155,9 @@ @@ -150,8 +155,9 @@
150 <!-- 微信 --> 155 <!-- 微信 -->
151 <activity 156 <activity
152 android:name=".wxapi.WXEntryActivity" 157 android:name=".wxapi.WXEntryActivity"
153 - android:label="WXEntryActivity"  
154 - android:exported="true" /> 158 + android:configChanges="keyboardHidden|orientation|screenSize"
  159 + android:exported="true"
  160 + android:theme="@android:style/Theme.Translucent.NoTitleBar" />
155 161
156 </application> 162 </application>
157 163
@@ -2,8 +2,8 @@ package com.hh.xuetubao; @@ -2,8 +2,8 @@ package com.hh.xuetubao;
2 2
3 import android.app.Application; 3 import android.app.Application;
4 import android.content.Context; 4 import android.content.Context;
5 -  
6 -import com.hh.xuetubao.wxapi.WxLogin; 5 +import com.umeng.commonsdk.UMConfigure;
  6 +import com.umeng.socialize.PlatformConfig;
7 7
8 public class MyApplication extends Application { 8 public class MyApplication extends Application {
9 9
@@ -15,8 +15,18 @@ public class MyApplication extends Application { @@ -15,8 +15,18 @@ public class MyApplication extends Application {
15 super.onCreate(); 15 super.onCreate();
16 sMyApplication = this; 16 sMyApplication = this;
17 17
18 - WxLogin.initWx(this); // wx 18 + /**
  19 + * 设置组件化的Log开关
  20 + * 参数: boolean 默认为false,如需查看LOG设置为true
  21 + */
  22 +
  23 + UMConfigure.setLogEnabled(true);
  24 + UMConfigure.init(this, "5dd8cf883fc195fb8d000b63", "学徒宝", UMConfigure.DEVICE_TYPE_PHONE, null);
  25 +
  26 + }
19 27
  28 + {
  29 + PlatformConfig.setWeixin("wxcf11ff5e6b39916b", "1831891c2fe743e792b2290e822f29cc");
20 } 30 }
21 31
22 public static MyApplication getMyApplication() { 32 public static MyApplication getMyApplication() {
@@ -23,6 +23,7 @@ import com.hh.xuetubao.bean.ResumeDetailBean; @@ -23,6 +23,7 @@ import com.hh.xuetubao.bean.ResumeDetailBean;
23 import com.hh.xuetubao.bean.ResumedJobListBean; 23 import com.hh.xuetubao.bean.ResumedJobListBean;
24 import com.hh.xuetubao.bean.TranscriptBean; 24 import com.hh.xuetubao.bean.TranscriptBean;
25 import com.hh.xuetubao.bean.UserBean; 25 import com.hh.xuetubao.bean.UserBean;
  26 +import com.hh.xuetubao.bean.WeixinBean;
26 27
27 import io.reactivex.Observable; 28 import io.reactivex.Observable;
28 import retrofit2.http.Body; 29 import retrofit2.http.Body;
@@ -169,7 +170,7 @@ public interface MyServer { @@ -169,7 +170,7 @@ public interface MyServer {
169 * @return 170 * @return
170 */ 171 */
171 @GET("WeixinLogin") 172 @GET("WeixinLogin")
172 - Observable<UserBean> WeixinLogin(@Query("wxOpenId") String wxOpenId); 173 + Observable<WeixinBean> WeixinLogin(@Query("wxOpenId") String wxOpenId, int logType);
173 174
174 /** 175 /**
175 * 微信登录绑定接口 176 * 微信登录绑定接口
@@ -190,7 +191,7 @@ public interface MyServer { @@ -190,7 +191,7 @@ public interface MyServer {
190 * @return 191 * @return
191 */ 192 */
192 @GET("AccountLogin") 193 @GET("AccountLogin")
193 - Observable<UserBean> AccountLogin(@Query("account") String account, @Query("password") String password); 194 + Observable<UserBean> AccountLogin(@Query("account") String account, @Query("password") String password,@Query("logType") int logtype);
194 195
195 196
196 @FormUrlEncoded 197 @FormUrlEncoded
1 package com.hh.xuetubao.activity.login; 1 package com.hh.xuetubao.activity.login;
2 2
  3 +import android.content.Intent;
3 import android.os.Bundle; 4 import android.os.Bundle;
4 import android.os.CountDownTimer; 5 import android.os.CountDownTimer;
5 import android.util.Log; 6 import android.util.Log;
@@ -8,7 +9,9 @@ import android.widget.EditText; @@ -8,7 +9,9 @@ import android.widget.EditText;
8 import android.widget.TextView; 9 import android.widget.TextView;
9 import android.widget.Toast; 10 import android.widget.Toast;
10 11
  12 +import com.hh.xuetubao.MainActivity;
11 import com.hh.xuetubao.R; 13 import com.hh.xuetubao.R;
  14 +import com.hh.xuetubao.Utils.SharedPrefrenceUtils;
12 import com.hh.xuetubao.bean.UserBean; 15 import com.hh.xuetubao.bean.UserBean;
13 import com.hh.xuetubao.model.AccountModel; 16 import com.hh.xuetubao.model.AccountModel;
14 import com.hh.xuetubao.mvp.BaseMvpActivity; 17 import com.hh.xuetubao.mvp.BaseMvpActivity;
@@ -38,6 +41,8 @@ public class BdsjActivity extends BaseMvpActivity<CommonPresenter, AccountModel> @@ -38,6 +41,8 @@ public class BdsjActivity extends BaseMvpActivity<CommonPresenter, AccountModel>
38 private CountDownTimer timer; 41 private CountDownTimer timer;
39 private int time = 60; 42 private int time = 60;
40 43
  44 + String openid;
  45 +
41 @Override 46 @Override
42 public void initView() { 47 public void initView() {
43 48
@@ -50,7 +55,7 @@ public class BdsjActivity extends BaseMvpActivity<CommonPresenter, AccountModel> @@ -50,7 +55,7 @@ public class BdsjActivity extends BaseMvpActivity<CommonPresenter, AccountModel>
50 55
51 @Override 56 @Override
52 public void initData() { 57 public void initData() {
53 - 58 + openid = getIntent().getStringExtra("AccountOid");
54 } 59 }
55 60
56 @Override 61 @Override
@@ -107,6 +112,9 @@ public class BdsjActivity extends BaseMvpActivity<CommonPresenter, AccountModel> @@ -107,6 +112,9 @@ public class BdsjActivity extends BaseMvpActivity<CommonPresenter, AccountModel>
107 case 3: // 绑定 112 case 3: // 绑定
108 UserBean bean1 = (UserBean) o; 113 UserBean bean1 = (UserBean) o;
109 if (bean1.getSuccess()) { 114 if (bean1.getSuccess()) {
  115 + String accountOid = bean1.getAccountOid();
  116 + SharedPrefrenceUtils.saveString(this, "AccountOid", accountOid);
  117 + startActivity(new Intent(this, MainActivity.class));
110 Toast.makeText(this, "微信绑定成功", Toast.LENGTH_SHORT).show(); 118 Toast.makeText(this, "微信绑定成功", Toast.LENGTH_SHORT).show();
111 this.finish(); 119 this.finish();
112 } else { 120 } else {
@@ -149,7 +157,7 @@ public class BdsjActivity extends BaseMvpActivity<CommonPresenter, AccountModel> @@ -149,7 +157,7 @@ public class BdsjActivity extends BaseMvpActivity<CommonPresenter, AccountModel>
149 Toast.makeText(this, "手机号和验证码不可为空", Toast.LENGTH_LONG).show(); 157 Toast.makeText(this, "手机号和验证码不可为空", Toast.LENGTH_LONG).show();
150 return; 158 return;
151 } else { 159 } else {
152 - mPresenter.getPresenter(1, 3, edPhone.getText().toString().trim(), edCode.getText().toString().trim()); // - > 绑定 160 + mPresenter.getPresenter(1, 3, openid,edPhone.getText().toString().trim(), edCode.getText().toString().trim()); // - > 绑定
153 } 161 }
154 break; 162 break;
155 case R.id.bdsj_fhdl: // - > 返回登录 163 case R.id.bdsj_fhdl: // - > 返回登录
@@ -112,7 +112,7 @@ public class JgdlActivity extends BaseMvpActivity<CommonPresenter, AccountModel> @@ -112,7 +112,7 @@ public class JgdlActivity extends BaseMvpActivity<CommonPresenter, AccountModel>
112 Toast.makeText(this, "用户名和密码不可为空", Toast.LENGTH_SHORT).show(); 112 Toast.makeText(this, "用户名和密码不可为空", Toast.LENGTH_SHORT).show();
113 return; 113 return;
114 } else { 114 } else {
115 - mPresenter.getPresenter(1, 4, edYhm.getText().toString().trim(), edPas.getText().toString().trim()); 115 + mPresenter.getPresenter(1, 4, edYhm.getText().toString().trim(), edPas.getText().toString().trim(),"2"); // android 为 2
116 } 116 }
117 break; 117 break;
118 case R.id.jgdl_fhdl: // - > 返回登录 118 case R.id.jgdl_fhdl: // - > 返回登录
@@ -15,15 +15,16 @@ import com.hh.xuetubao.MainActivity; @@ -15,15 +15,16 @@ import com.hh.xuetubao.MainActivity;
15 import com.hh.xuetubao.R; 15 import com.hh.xuetubao.R;
16 import com.hh.xuetubao.Utils.SharedPrefrenceUtils; 16 import com.hh.xuetubao.Utils.SharedPrefrenceUtils;
17 import com.hh.xuetubao.bean.UserBean; 17 import com.hh.xuetubao.bean.UserBean;
  18 +import com.hh.xuetubao.bean.WeixinBean;
18 import com.hh.xuetubao.model.AccountModel; 19 import com.hh.xuetubao.model.AccountModel;
19 import com.hh.xuetubao.mvp.BaseMvpActivity; 20 import com.hh.xuetubao.mvp.BaseMvpActivity;
20 import com.hh.xuetubao.mvp.CommonPresenter; 21 import com.hh.xuetubao.mvp.CommonPresenter;
21 import com.hh.xuetubao.mvp.ICommonView; 22 import com.hh.xuetubao.mvp.ICommonView;
22 -import com.hh.xuetubao.wxapi.WxLogin;  
23 -import com.tencent.mm.opensdk.modelmsg.SendAuth;  
24 -import com.tencent.mm.opensdk.openapi.IWXAPI;  
25 -import com.tencent.mm.opensdk.openapi.WXAPIFactory; 23 +import com.umeng.socialize.UMAuthListener;
  24 +import com.umeng.socialize.UMShareAPI;
  25 +import com.umeng.socialize.bean.SHARE_MEDIA;
26 26
  27 +import java.util.Map;
27 import java.util.regex.Matcher; 28 import java.util.regex.Matcher;
28 import java.util.regex.Pattern; 29 import java.util.regex.Pattern;
29 30
@@ -134,7 +135,19 @@ public class LoginActivity extends BaseMvpActivity<CommonPresenter, AccountModel @@ -134,7 +135,19 @@ public class LoginActivity extends BaseMvpActivity<CommonPresenter, AccountModel
134 Toast.makeText(this, bean.getErrorMsg(), Toast.LENGTH_LONG).show(); 135 Toast.makeText(this, bean.getErrorMsg(), Toast.LENGTH_LONG).show();
135 Toast.makeText(this, "登录失败", Toast.LENGTH_LONG).show(); 136 Toast.makeText(this, "登录失败", Toast.LENGTH_LONG).show();
136 } 137 }
  138 + }
137 139
  140 + if (api == 1 && intent == 6) {
  141 + WeixinBean weixinBean = (WeixinBean) o;
  142 + if (weixinBean.isIsBindWx() == true) { // 已经绑定
  143 + String accountOid = weixinBean.getAccountOid();
  144 + SharedPrefrenceUtils.saveString(this, "AccountOid", accountOid);
  145 + startActivity(new Intent(this, MainActivity.class));
  146 + } else {
  147 + Intent intent1 = new Intent(this, BdsjActivity.class);
  148 + intent1.putExtra("AccountOid", weixinBean.getAccountOid());
  149 + startActivity(intent1);
  150 + }
138 } 151 }
139 } 152 }
140 153
@@ -155,14 +168,12 @@ public class LoginActivity extends BaseMvpActivity<CommonPresenter, AccountModel @@ -155,14 +168,12 @@ public class LoginActivity extends BaseMvpActivity<CommonPresenter, AccountModel
155 ButterKnife.bind(this); 168 ButterKnife.bind(this);
156 } 169 }
157 170
158 - IWXAPI api;  
159 -  
160 @Override 171 @Override
161 public void onClick(View v) { 172 public void onClick(View v) {
162 switch (v.getId()) { 173 switch (v.getId()) {
163 case R.id.login: 174 case R.id.login:
164 if (isCellphone(edPhone.getText().toString()) && !TextUtils.isEmpty(edPhone.getText().toString())) 175 if (isCellphone(edPhone.getText().toString()) && !TextUtils.isEmpty(edPhone.getText().toString()))
165 - mPresenter.getPresenter(1, 2, edPhone.getText().toString(), edCode.getText().toString(),String.valueOf(2)); 176 + mPresenter.getPresenter(1, 2, edPhone.getText().toString(), edCode.getText().toString(), String.valueOf(2));
166 else 177 else
167 Toast.makeText(this, "请输入正确的手机号码", Toast.LENGTH_LONG).show(); 178 Toast.makeText(this, "请输入正确的手机号码", Toast.LENGTH_LONG).show();
168 break; 179 break;
@@ -174,8 +185,9 @@ public class LoginActivity extends BaseMvpActivity<CommonPresenter, AccountModel @@ -174,8 +185,9 @@ public class LoginActivity extends BaseMvpActivity<CommonPresenter, AccountModel
174 Toast.makeText(this, "请输入正确的手机号码", Toast.LENGTH_LONG).show(); 185 Toast.makeText(this, "请输入正确的手机号码", Toast.LENGTH_LONG).show();
175 break; 186 break;
176 case R.id.img_wechat: // 微信 187 case R.id.img_wechat: // 微信
177 - WxLogin.longWx();  
178 // startActivity(new Intent(LoginActivity.this, BdsjActivity.class)); 188 // startActivity(new Intent(LoginActivity.this, BdsjActivity.class));
  189 + UMShareAPI.get(this).doOauthVerify(this, SHARE_MEDIA.WEIXIN, authListener);
  190 +
179 break; 191 break;
180 case R.id.img_jigou: // 机构登录 192 case R.id.img_jigou: // 机构登录
181 startActivity(new Intent(LoginActivity.this, JgdlActivity.class)); 193 startActivity(new Intent(LoginActivity.this, JgdlActivity.class));
@@ -189,5 +201,44 @@ public class LoginActivity extends BaseMvpActivity<CommonPresenter, AccountModel @@ -189,5 +201,44 @@ public class LoginActivity extends BaseMvpActivity<CommonPresenter, AccountModel
189 return matcher.matches(); 201 return matcher.matches();
190 } 202 }
191 203
  204 + // // 监听
  205 + UMAuthListener authListener = new UMAuthListener() {
  206 + @Override
  207 + public void onStart(SHARE_MEDIA platform) {
  208 + Toast.makeText(LoginActivity.this, "开始", Toast.LENGTH_LONG).show();
  209 + }
  210 +
  211 + @Override
  212 + public void onComplete(SHARE_MEDIA platform, int action, Map<String, String> map) {
  213 + if (map == null) {
  214 + Toast.makeText(LoginActivity.this, "请检查是否安装该应用", Toast.LENGTH_SHORT).show();
  215 + return;
  216 + }
  217 +
  218 + String openid = map.get("openid"); // openid
  219 + String name = map.get("name"); // name
  220 +
  221 + String gender = map.get("gender"); // 性别
  222 + String sex = "0";
  223 + if (!TextUtils.isEmpty(gender) && gender.equals("男")) {
  224 + sex = "1";
  225 + } else if (!TextUtils.isEmpty(gender) && gender.equals("女")) {
  226 + sex = "2";
  227 + }
  228 +
  229 + //头像
  230 + String iconurl = map.get("iconurl");
  231 +
  232 + mPresenter.getPresenter(1, 6, openid, "2"); // android
  233 + }
  234 +
  235 + @Override
  236 + public void onError(SHARE_MEDIA platform, int action, Throwable t) {
  237 + }
  238 +
  239 + @Override
  240 + public void onCancel(SHARE_MEDIA platform, int action) {
  241 + }
  242 + };
192 243
193 } 244 }
@@ -2,6 +2,7 @@ package com.hh.xuetubao.activity.pratice; @@ -2,6 +2,7 @@ package com.hh.xuetubao.activity.pratice;
2 2
3 import android.content.Intent; 3 import android.content.Intent;
4 import android.os.Bundle; 4 import android.os.Bundle;
  5 +import android.text.TextUtils;
5 import android.util.Log; 6 import android.util.Log;
6 import android.view.KeyEvent; 7 import android.view.KeyEvent;
7 import android.view.View; 8 import android.view.View;
@@ -9,6 +10,7 @@ import android.widget.ImageView; @@ -9,6 +10,7 @@ import android.widget.ImageView;
9 import android.widget.LinearLayout; 10 import android.widget.LinearLayout;
10 import android.widget.TextView; 11 import android.widget.TextView;
11 12
  13 +import com.bumptech.glide.Glide;
12 import com.hh.xuetubao.R; 14 import com.hh.xuetubao.R;
13 import com.hh.xuetubao.Utils.SharedPrefrenceUtils; 15 import com.hh.xuetubao.Utils.SharedPrefrenceUtils;
14 import com.hh.xuetubao.bean.UserBean; 16 import com.hh.xuetubao.bean.UserBean;
@@ -54,6 +56,7 @@ public class MockExamActivity extends BaseMvpActivity<CommonPresenter, ExerciseM @@ -54,6 +56,7 @@ public class MockExamActivity extends BaseMvpActivity<CommonPresenter, ExerciseM
54 resumeOid = SharedPrefrenceUtils.getString(this, "AccountOid"); 56 resumeOid = SharedPrefrenceUtils.getString(this, "AccountOid");
55 catalogOid = getIntent().getStringExtra("catalogOid") + ""; 57 catalogOid = getIntent().getStringExtra("catalogOid") + "";
56 58
  59 + Log.e("resumeOid", resumeOid);
57 Log.e("catalogOid", catalogOid); 60 Log.e("catalogOid", catalogOid);
58 61
59 linTrain.setOnClickListener(this); 62 linTrain.setOnClickListener(this);
@@ -67,6 +70,7 @@ public class MockExamActivity extends BaseMvpActivity<CommonPresenter, ExerciseM @@ -67,6 +70,7 @@ public class MockExamActivity extends BaseMvpActivity<CommonPresenter, ExerciseM
67 @Override 70 @Override
68 public void initData() { 71 public void initData() {
69 mPresenter.getPresenter(3, 1, catalogOid, resumeOid); 72 mPresenter.getPresenter(3, 1, catalogOid, resumeOid);
  73 + mPresenter.getPresenter( 5, 4, resumeOid);
70 } 74 }
71 75
72 @Override 76 @Override
@@ -92,6 +96,27 @@ public class MockExamActivity extends BaseMvpActivity<CommonPresenter, ExerciseM @@ -92,6 +96,27 @@ public class MockExamActivity extends BaseMvpActivity<CommonPresenter, ExerciseM
92 if (bean.getExamType() != null) 96 if (bean.getExamType() != null)
93 content.setText(bean.getExamType()); 97 content.setText(bean.getExamType());
94 98
  99 + }
  100 +
  101 + if (api == 5 && intent == 4) {
  102 + UserBean bean = (UserBean) o;
  103 + String userName = SharedPrefrenceUtils.getString(MockExamActivity.this, "UserName");
  104 + if (bean.getUserName() != null) {
  105 + name.setText(bean.getUserName());
  106 + }else {
  107 + name.setText(userName);
  108 + }
  109 +
  110 + String reallHeader = SharedPrefrenceUtils.getString(MockExamActivity.this, "ReallHeader");
  111 + String headPic = SharedPrefrenceUtils.getString(MockExamActivity.this, "HeadPic");
  112 +
  113 + if (!TextUtils.isEmpty(headPic)) {
  114 + Glide.with(this).load(headPic).into(image);
  115 + } else if (!TextUtils.isEmpty(reallHeader)) {
  116 + Glide.with(this).load(reallHeader).into(image);
  117 + } else if (bean.getHeadPic() != null && !bean.getHeadPic().equals("")) {
  118 + Glide.with(MockExamActivity.this).load(bean.getHeadPic()).into(image);
  119 + }
95 120
96 } 121 }
97 122
1 package com.hh.xuetubao.adapter; 1 package com.hh.xuetubao.adapter;
2 2
3 import android.content.Context; 3 import android.content.Context;
  4 +import android.graphics.Paint;
4 import android.support.annotation.NonNull; 5 import android.support.annotation.NonNull;
5 import android.support.v7.widget.RecyclerView; 6 import android.support.v7.widget.RecyclerView;
  7 +import android.text.TextUtils;
6 import android.view.LayoutInflater; 8 import android.view.LayoutInflater;
7 import android.view.View; 9 import android.view.View;
8 import android.view.ViewGroup; 10 import android.view.ViewGroup;
@@ -39,8 +41,10 @@ public class StudyXrecAdapter extends RecyclerView.Adapter<StudyXrecAdapter.View @@ -39,8 +41,10 @@ public class StudyXrecAdapter extends RecyclerView.Adapter<StudyXrecAdapter.View
39 holder.percent.setText(String.valueOf(list.get(position).getStudyPercent())); 41 holder.percent.setText(String.valueOf(list.get(position).getStudyPercent()));
40 if (list.get(position).getLatelyStudyTime() != null) 42 if (list.get(position).getLatelyStudyTime() != null)
41 holder.time.setText(list.get(position).getLatelyStudyTime()); 43 holder.time.setText(list.get(position).getLatelyStudyTime());
42 - if (list.get(position).getLatelyResourceName() != null) 44 + if (list.get(position).getLatelyResourceName() != null) {
  45 +// holder.resourse.setText(list.get(position).getLatelyResourceName());
43 holder.resourse.setText(list.get(position).getLatelyResourceName()); 46 holder.resourse.setText(list.get(position).getLatelyResourceName());
  47 + }
44 if (list.get(position).getCoverPic() != null) 48 if (list.get(position).getCoverPic() != null)
45 Glide.with(context).load(list.get(position).getCoverPic()).into(holder.img); 49 Glide.with(context).load(list.get(position).getCoverPic()).into(holder.img);
46 50
@@ -73,7 +77,7 @@ public class StudyXrecAdapter extends RecyclerView.Adapter<StudyXrecAdapter.View @@ -73,7 +77,7 @@ public class StudyXrecAdapter extends RecyclerView.Adapter<StudyXrecAdapter.View
73 title = (TextView) itemView.findViewById(R.id.title); 77 title = (TextView) itemView.findViewById(R.id.title);
74 percent = (TextView) itemView.findViewById(R.id.tv_percent); 78 percent = (TextView) itemView.findViewById(R.id.tv_percent);
75 img = (ImageView) itemView.findViewById(R.id.img); 79 img = (ImageView) itemView.findViewById(R.id.img);
76 - resourse = (TextView) itemView.findViewById(R.id.tv_resourse); 80 + resourse = itemView.findViewById(R.id.tv_resourse);
77 } 81 }
78 } 82 }
79 83
@@ -86,4 +90,24 @@ public class StudyXrecAdapter extends RecyclerView.Adapter<StudyXrecAdapter.View @@ -86,4 +90,24 @@ public class StudyXrecAdapter extends RecyclerView.Adapter<StudyXrecAdapter.View
86 public interface TurnTo { 90 public interface TurnTo {
87 void turn(String LessonOid); 91 void turn(String LessonOid);
88 } 92 }
  93 +
  94 + /**
  95 + * 半角转换为全角
  96 + *
  97 + * @param input
  98 + * @return
  99 + */
  100 + public static String ToDBC(String input) {
  101 + char[] c = input.toCharArray();
  102 + for (int i = 0; i < c.length; i++) {
  103 + if (c[i] == 12288) {// 全角空格为12288,半角空格为32
  104 + c[i] = (char) 32;
  105 + continue;
  106 + }
  107 + if (c[i] > 65280 && c[i] < 65375)// 其他字符半角(33-126)与全角(65281-65374)的对应关系是:均相差65248
  108 + c[i] = (char) (c[i] - 65248);
  109 + }
  110 + return new String(c);
  111 + }
  112 +
89 } 113 }
  1 +package com.hh.xuetubao.bean;
  2 +
  3 +public class WeixinBean {
  4 +
  5 +
  6 + /**
  7 + * IsSuccess : true
  8 + * AccountOid : 16EA2C01-20E3-420D-AB4E-4E44F0539349
  9 + * IsBindWx : true
  10 + */
  11 +
  12 + private boolean IsSuccess;
  13 + private String AccountOid;
  14 + private boolean IsBindWx;
  15 +
  16 + public boolean isIsSuccess() {
  17 + return IsSuccess;
  18 + }
  19 +
  20 + public void setIsSuccess(boolean IsSuccess) {
  21 + this.IsSuccess = IsSuccess;
  22 + }
  23 +
  24 + public String getAccountOid() {
  25 + return AccountOid;
  26 + }
  27 +
  28 + public void setAccountOid(String AccountOid) {
  29 + this.AccountOid = AccountOid;
  30 + }
  31 +
  32 + public boolean isIsBindWx() {
  33 + return IsBindWx;
  34 + }
  35 +
  36 + public void setIsBindWx(boolean IsBindWx) {
  37 + this.IsBindWx = IsBindWx;
  38 + }
  39 +}
@@ -30,9 +30,12 @@ public class AccountModel implements ICommonModel { @@ -30,9 +30,12 @@ public class AccountModel implements ICommonModel {
30 if (api == 1 && intent == 4) { // - > 机构登录 30 if (api == 1 && intent == 4) { // - > 机构登录
31 jg_login(commonView, api, intent, params); 31 jg_login(commonView, api, intent, params);
32 } 32 }
33 - if(api == 1 && intent == 5){ // 忘记密码 33 + if (api == 1 && intent == 5) { // 忘记密码
34 forget_pas(commonView, api, intent, params); 34 forget_pas(commonView, api, intent, params);
35 } 35 }
  36 + if (api == 1 && intent == 6) { // 微信登录
  37 + weixin_login(commonView, api, intent, params);
  38 + }
36 39
37 } 40 }
38 41
@@ -55,7 +58,7 @@ public class AccountModel implements ICommonModel { @@ -55,7 +58,7 @@ public class AccountModel implements ICommonModel {
55 /* 验证码登录 */ 58 /* 验证码登录 */
56 private void mobileLogin(final ICommonView commonView, final int api, final int intent, String... params) { 59 private void mobileLogin(final ICommonView commonView, final int api, final int intent, String... params) {
57 if (api == 1 && intent == 2) 60 if (api == 1 && intent == 2)
58 - mServers.mobileLogin(params[0], params[1],Integer.valueOf(params[2])) 61 + mServers.mobileLogin(params[0], params[1], Integer.valueOf(params[2]))
59 .subscribeOn(Schedulers.io()) 62 .subscribeOn(Schedulers.io())
60 .observeOn(AndroidSchedulers.mainThread()) 63 .observeOn(AndroidSchedulers.mainThread())
61 .subscribe(new BaseObsever() { 64 .subscribe(new BaseObsever() {
@@ -87,7 +90,7 @@ public class AccountModel implements ICommonModel { @@ -87,7 +90,7 @@ public class AccountModel implements ICommonModel {
87 /* 机构登录 */ 90 /* 机构登录 */
88 private void jg_login(final ICommonView commonView, final int api, final int tag, String... params) { 91 private void jg_login(final ICommonView commonView, final int api, final int tag, String... params) {
89 if (api == 1 && tag == 4) { 92 if (api == 1 && tag == 4) {
90 - mServers.AccountLogin(params[0], params[1]) 93 + mServers.AccountLogin(params[0], params[1], Integer.valueOf(params[2]))
91 .subscribeOn(Schedulers.io()) 94 .subscribeOn(Schedulers.io())
92 .observeOn(AndroidSchedulers.mainThread()) 95 .observeOn(AndroidSchedulers.mainThread())
93 .subscribe(new BaseObsever() { 96 .subscribe(new BaseObsever() {
@@ -116,4 +119,20 @@ public class AccountModel implements ICommonModel { @@ -116,4 +119,20 @@ public class AccountModel implements ICommonModel {
116 } 119 }
117 } 120 }
118 121
  122 + /* 微信登录 */
  123 + private void weixin_login(final ICommonView commonView, final int api, final int tag, String... params) {
  124 + if(api ==1 && tag == 6){
  125 + mServers.WeixinLogin(params[0], Integer.valueOf(params[1]))
  126 + .subscribeOn(Schedulers.io())
  127 + .observeOn(AndroidSchedulers.mainThread())
  128 + .subscribe(new BaseObsever() {
  129 + @Override
  130 + public void onNext(Object value) {
  131 + super.onNext(value);
  132 + commonView.getData(value, api, tag);
  133 + }
  134 + });
  135 + }
  136 + }
  137 +
119 } 138 }
@@ -51,6 +51,36 @@ public class ExerciseModel implements ICommonModel { @@ -51,6 +51,36 @@ public class ExerciseModel implements ICommonModel {
51 if (api == 9 && intent == 1) 51 if (api == 9 && intent == 1)
52 DeleteExamRecordInfo(commonView, api, intent, params); 52 DeleteExamRecordInfo(commonView, api, intent, params);
53 53
  54 + if(api == 5 && intent == 4){
  55 + GetHeadInfo(commonView, api, intent, params);
  56 + }
  57 +
  58 + }
  59 +
  60 + private void GetHeadInfo(final ICommonView commonView, final int api, final int intent, String... params) {
  61 + if (api == 5 && intent == 4)
  62 + mServers.GetHeadInfo(params[0])
  63 + .subscribeOn(Schedulers.io())
  64 + .observeOn(AndroidSchedulers.mainThread())
  65 + .subscribe(new BaseObsever() {
  66 + @Override
  67 + public void onNext(Object value) {
  68 + super.onNext(value);
  69 + commonView.getData(value, api, intent);
  70 + }
  71 +
  72 + @Override
  73 + public void onError(Throwable e) {
  74 + super.onError(e);
  75 + commonView.onError(e, api);
  76 + }
  77 +
  78 + @Override
  79 + public void onComplete() {
  80 + super.onComplete();
  81 + commonView.onComplete(api);
  82 + }
  83 + });
54 } 84 }
55 85
56 private void DeleteExamRecordInfo(final ICommonView commonView, final int api, final int intent, String... params) { 86 private void DeleteExamRecordInfo(final ICommonView commonView, final int api, final int intent, String... params) {
1 -package com.hh.xuetubao.wxapi;  
2 -  
3 -import android.content.Context;  
4 -import android.widget.Toast;  
5 -  
6 -/**  
7 - * Created by 14178 on 2018/1/19.  
8 - */  
9 -  
10 -public class UIUtils {  
11 -  
12 - private static Context mContext;  
13 -  
14 - public static void initContext(Context context) {  
15 -  
16 - mContext = context;  
17 - }  
18 -  
19 - public static void runOnUIToast(String str){  
20 - Toast.makeText(mContext, str, Toast.LENGTH_SHORT).show();  
21 -  
22 - }  
23 -}  
1 package com.hh.xuetubao.wxapi; 1 package com.hh.xuetubao.wxapi;
2 2
3 -import android.app.Activity;  
4 -import android.content.Intent;  
5 -import android.os.Bundle;  
6 -import android.os.CountDownTimer;  
7 -import android.util.Log;  
8 -import android.view.View;  
9 -import android.widget.EditText;  
10 -import android.widget.TextView;  
11 -import android.widget.Toast;  
12 3
13 -import com.hh.xuetubao.R;  
14 -import com.hh.xuetubao.bean.UserBean;  
15 -import com.hh.xuetubao.model.AccountModel;  
16 -import com.hh.xuetubao.mvp.BaseMvpActivity;  
17 -import com.hh.xuetubao.mvp.CommonPresenter;  
18 -import com.hh.xuetubao.mvp.ICommonView;  
19 -import com.tencent.mm.opensdk.modelbase.BaseReq;  
20 -import com.tencent.mm.opensdk.modelbase.BaseResp;  
21 -import com.tencent.mm.opensdk.modelmsg.SendAuth;  
22 -import com.tencent.mm.opensdk.openapi.IWXAPI;  
23 -import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler;  
24 -import com.tencent.mm.opensdk.openapi.WXAPIFactory;  
25 -import com.zhy.http.okhttp.OkHttpUtils;  
26 -import com.zhy.http.okhttp.callback.StringCallback; 4 +import com.umeng.socialize.weixin.view.WXCallbackActivity;
27 5
28 -import org.json.JSONException;  
29 -import org.json.JSONObject; 6 +public class WXEntryActivity extends WXCallbackActivity {
30 7
31 -import java.util.regex.Matcher;  
32 -import java.util.regex.Pattern;  
33 -  
34 -import butterknife.BindView;  
35 -import butterknife.ButterKnife;  
36 -import butterknife.OnClick;  
37 -  
38 -public class WXEntryActivity extends BaseMvpActivity<CommonPresenter, AccountModel> implements ICommonView, IWXAPIEventHandler {  
39 - private static final int RETURN_MSG_TYPE_LOGIN = 1;  
40 - private static final int RETURN_MSG_TYPE_SHARE = 2;  
41 - private IWXAPI mWeixinAPI;  
42 -  
43 - @BindView(R.id.ed_phone)  
44 - EditText edPhone;  
45 - @BindView(R.id.ed_code)  
46 - EditText edCode;  
47 - @BindView(R.id.tv_yanzheng)  
48 - TextView tvYanzheng;  
49 - @BindView(R.id.bdsj_sure)  
50 - TextView bdsjSure;  
51 - @BindView(R.id.bdsj_fhdl)  
52 - TextView bdsjFhdl;  
53 -  
54 - private CountDownTimer timer;  
55 - private int time = 60;  
56 -  
57 - @Override  
58 - public void initView() {  
59 - ButterKnife.bind(this);  
60 - mWeixinAPI = WXAPIFactory.createWXAPI(this, WxData.WEIXIN_APP_ID, true);  
61 - mWeixinAPI.handleIntent(this.getIntent(), this);  
62 - }  
63 -  
64 - @Override  
65 - public int initLayout() {  
66 - return R.layout.activity_bdsj; // R.layout.activity_wxentry  
67 - }  
68 -  
69 - @Override  
70 - public void initData() {  
71 -  
72 - }  
73 -  
74 - @Override  
75 - public CommonPresenter getPresenter() {  
76 - return new CommonPresenter();  
77 - }  
78 -  
79 - @Override  
80 - public AccountModel getModel() {  
81 - return new AccountModel();  
82 - }  
83 -  
84 - @Override  
85 - public void getData(Object o, int api, int intent) {  
86 - if (api != 1) {  
87 - return;  
88 - }  
89 - switch (intent) {  
90 - case 1: // 验证码  
91 - UserBean bean = (UserBean) o;  
92 - if (bean.getSuccess()) {  
93 - Toast.makeText(this, "验证码发送成功", Toast.LENGTH_LONG).show();  
94 - time = 60;  
95 -  
96 - timer = new CountDownTimer(60000, 1000) {  
97 - @Override  
98 - public void onTick(long millisUntilFinished) {  
99 - time--;  
100 - tvYanzheng.setText(String.valueOf(time) + "s");  
101 - tvYanzheng.setFocusable(false);  
102 - tvYanzheng.setFocusableInTouchMode(false);  
103 - tvYanzheng.setClickable(false);  
104 - try {  
105 - tvYanzheng.setText(String.valueOf(time) + "s");  
106 - tvYanzheng.setFocusable(false);  
107 - } catch (Exception e) {  
108 - Log.e("zhangtao", e.toString());  
109 - }  
110 - }  
111 -  
112 - @Override  
113 - public void onFinish() {  
114 - tvYanzheng.setText("获取验证码");  
115 - tvYanzheng.setFocusable(true);  
116 - tvYanzheng.setFocusableInTouchMode(true);  
117 - tvYanzheng.setClickable(true);  
118 - time = 60;  
119 - }  
120 - }.start();  
121 - } else {  
122 - Toast.makeText(this, "验证码发送失败", Toast.LENGTH_SHORT).show();  
123 - }  
124 - break;  
125 - case 3: // 绑定  
126 - UserBean bean1 = (UserBean) o;  
127 - if (bean1.getSuccess()) {  
128 - Toast.makeText(this, "微信绑定成功", Toast.LENGTH_SHORT).show();  
129 - this.finish();  
130 - } else {  
131 - Toast.makeText(this, "微信绑定失败", Toast.LENGTH_SHORT).show();  
132 - }  
133 - break;  
134 - }  
135 - }  
136 -  
137 - @OnClick({R.id.tv_yanzheng, R.id.bdsj_sure, R.id.bdsj_fhdl})  
138 - public void onViewClicked(View view) {  
139 - switch (view.getId()) {  
140 - case R.id.tv_yanzheng: // - > 验证码  
141 - if (isCellphone(edPhone.getText().toString()))  
142 - mPresenter.getPresenter(1, 1, edPhone.getText().toString(), String.valueOf(1)); // 1 -> 微信或手机号码绑定时发送  
143 - else  
144 - Toast.makeText(this, "请输入正确的手机号码", Toast.LENGTH_LONG).show();  
145 - break;  
146 - case R.id.bdsj_sure: // - > 确定  
147 - if (isCellphone(edPhone.getText().toString())) {  
148 - Toast.makeText(this, "请输入正确的手机号码", Toast.LENGTH_LONG).show();  
149 - return;  
150 - } else if (edPhone.getText().length() > 0 && edCode.getText().length() > 0) {  
151 - Toast.makeText(this, "手机号和验证码不可为空", Toast.LENGTH_LONG).show();  
152 - return;  
153 - } else {  
154 - mPresenter.getPresenter(1, 3, edPhone.getText().toString().trim(), edCode.getText().toString().trim()); // - > 绑定  
155 - }  
156 - break;  
157 - case R.id.bdsj_fhdl: // - > 返回登录  
158 - this.finish();  
159 - break;  
160 - }  
161 - }  
162 -  
163 - public static boolean isCellphone(String str) {  
164 - Pattern pattern = Pattern.compile("^((13[0-9])|(14[5,7,9])|(15[^4])|(18[0-9])|(17[0,1,3,5,6,7,8]))\\d{8}$");  
165 - Matcher matcher = pattern.matcher(str);  
166 - return matcher.matches();  
167 - }  
168 -  
169 -  
170 -  
171 -  
172 -  
173 - @Override  
174 - protected void onNewIntent(Intent intent) {  
175 - super.onNewIntent(intent);  
176 - setIntent(intent);  
177 - mWeixinAPI.handleIntent(intent, this);//必须调用此句话  
178 - }  
179 -  
180 - @Override  
181 - public void onReq(BaseReq baseReq) {  
182 - Log.e("-----", "onReq: " + baseReq);  
183 - finish();  
184 - }  
185 -  
186 -  
187 - @Override  
188 - public void onResp(BaseResp baseResp) {  
189 - Log.e("-----", "errStr: " + baseResp.errStr);  
190 - Log.e("-----", "openId: " + baseResp.openId);  
191 - Log.e("-----", "transaction: " + baseResp.transaction);  
192 - Log.e("-----", "errCode: " + baseResp.errCode);  
193 - Log.e("-----", "getType: " + baseResp.getType());  
194 - Log.e("-----", "checkArgs: " + baseResp.checkArgs());  
195 -  
196 -  
197 - switch (baseResp.errCode) {  
198 -  
199 - case BaseResp.ErrCode.ERR_AUTH_DENIED:  
200 - case BaseResp.ErrCode.ERR_USER_CANCEL:  
201 - if (RETURN_MSG_TYPE_SHARE == baseResp.getType()) UIUtils.runOnUIToast("分享失败");  
202 - else UIUtils.runOnUIToast("登录失败");  
203 - break;  
204 - case BaseResp.ErrCode.ERR_OK:  
205 - switch (baseResp.getType()) {  
206 - case RETURN_MSG_TYPE_LOGIN:  
207 - //拿到了微信返回的code,立马再去请求access_token  
208 - String code = ((SendAuth.Resp) baseResp).code;  
209 - getAccess_token(code);  
210 - //就在这个地方,用网络库什么的或者自己封的网络api,发请求去咯,注意是get请求  
211 -  
212 - Log.e("--------", "code: " + code);  
213 -// id_tv.setText("code: " + code); //  
214 - break;  
215 -  
216 - case RETURN_MSG_TYPE_SHARE:  
217 - UIUtils.runOnUIToast("微信分享成功");  
218 - finish();  
219 - break;  
220 - }  
221 - break;  
222 - }  
223 - }  
224 -  
225 -  
226 - /**  
227 - * 获取openid accessToken值用于后期操作  
228 - *  
229 - * @param code 请求码  
230 - */  
231 - private void getAccess_token(final String code) {  
232 - String path = "https://api.weixin.qq.com/sns/oauth2/access_token?appid="  
233 - + WxData.WEIXIN_APP_ID  
234 - + "&secret="  
235 - + WxData.APP_SECRET  
236 - + "&code="  
237 - + code  
238 - + "&grant_type=authorization_code";  
239 - OkHttpUtils.get().url(path).build().execute(new StringCallback() {  
240 -  
241 - @Override  
242 - public void onError(okhttp3.Call call, Exception e) {  
243 -  
244 - }  
245 -  
246 - @Override  
247 - public void onResponse(String response) {  
248 -  
249 - Log.e("-----", "onResponse: " + response);  
250 - JSONObject jsonObject = null;  
251 - try {  
252 - jsonObject = new JSONObject(response);  
253 - String openid = jsonObject.getString("openid").toString().trim();  
254 - String access_token = jsonObject.getString("access_token").toString().trim();  
255 - getUserMesg(access_token, openid);  
256 - } catch (JSONException e) {  
257 - e.printStackTrace();  
258 - }  
259 -  
260 - }  
261 - });  
262 -  
263 - }  
264 -  
265 -  
266 - /**  
267 - * 获取微信的个人信息  
268 - *  
269 - * @param access_token  
270 - * @param openid  
271 - */  
272 - private void getUserMesg(final String access_token, final String openid) {  
273 - String path = "https://api.weixin.qq.com/sns/userinfo?access_token="  
274 - + access_token  
275 - + "&openid="  
276 - + openid;  
277 -  
278 -  
279 - OkHttpUtils.get().url(path).build().execute(new StringCallback() {  
280 -  
281 -  
282 - @Override  
283 - public void onError(okhttp3.Call call, Exception e) {  
284 -  
285 - }  
286 -  
287 - @Override  
288 - public void onResponse(String response) {  
289 - Log.e("------", "全部数据: " + response);  
290 - JSONObject jsonObject = null;  
291 - try {  
292 - jsonObject = new JSONObject(response);  
293 - String nickname = jsonObject.getString("nickname");  
294 - int sex = Integer.parseInt(jsonObject.get("sex").toString());  
295 - String headimgurl = jsonObject.getString("headimgurl");  
296 - String openid1 = jsonObject.getString("openid");  
297 - Log.e("---", "用户基本信息:");  
298 - Log.e("---", "nickname:" + nickname);  
299 -// nickname_tv.setText("nickname: " +nickname);  
300 - Log.e("---", "sex: " + sex);  
301 -// sex_tv.setText("sex: " + sex + "");  
302 - Log.e("---", "headimgurl:" + headimgurl);  
303 - // startLoca(nickname, openid1);  
304 - } catch (JSONException e) {  
305 - e.printStackTrace();  
306 - UIUtils.runOnUIToast("登陆错误,请重新再试");  
307 -  
308 - }  
309 - // finish();  
310 - }  
311 - });  
312 -  
313 - }  
314 -  
315 -  
316 -  
317 - @Override  
318 - public void onComplete(int api) {  
319 -  
320 - }  
321 -  
322 - @Override  
323 - public void onError(Throwable e, int api) {  
324 -  
325 - }  
326 } 8 }
1 -package com.hh.xuetubao.wxapi;  
2 -  
3 -/**  
4 - * XINHAO_HAN存储信息  
5 - */  
6 -  
7 -public class WxData {  
8 -  
9 -  
10 - /**  
11 - * 你的AppID  
12 - *  
13 - * 在此特别注意,本Demo只适用微信的登陆功能,并不能用到微信支付功能  
14 - *  
15 - * 在此注意,必须要和微信官网签名一致,否则调用不起来微信APP,  
16 - *  
17 - * 如果在你调用出错的情况下(微信APP死活不出来的情况下),请参阅作者简书网址 : https://www.jianshu.com/p/04ed0b65f3df  
18 - *  
19 - * 微信APP掉不出来:有以下原因:  
20 - *  
21 - * 1.签名不正确(APK所使用签名的MD5码) 签名MD5码不要有 : 如A0:5B:12:63.... ,要全部是小写(推荐)a05b1263...,这种形式的  
22 - *  
23 - * 2.APP_ID不正确  
24 - *  
25 - * 3.密匙不正确  
26 - *  
27 - * 4.包名不正确  
28 - *  
29 - * 不走回调WXEntryActivity  
30 - *  
31 - * 1.AndroidManifest.xml里没有配置  
32 - *  
33 - * <activity  
34 - * android:name=".wxapi.WXEntryActivity"  
35 - * android:exported="true"  
36 - * android:label="WXEntryActivity" />  
37 - * 2.必须是 你的包名.wxapi  
38 - * 如果你的所有信息填写正确,还是掉不起来微信,那就可能是微信服务器问题,请稍等3-5分钟,在尝试调用,否则就重复以上选项  
39 - * 大兄弟,记得细心一点哟~~~  
40 - *  
41 - *  
42 - *  
43 - *  
44 - */  
45 - public static final String WEIXIN_APP_ID = "";  
46 - public static final String APP_SECRET = "";  
47 -  
48 - /**  
49 - * 固定的  
50 - *  
51 - */  
52 -  
53 - public static final String SCOPE = "snsapi_userinfo";  
54 - public static final String STATE = "wechat_sdk_demo_test_neng";  
55 -  
56 -  
57 -}  
1 -package com.hh.xuetubao.wxapi;  
2 -  
3 -import android.content.Context;  
4 -import android.widget.Toast;  
5 -  
6 -import com.tencent.mm.opensdk.modelmsg.SendAuth;  
7 -import com.tencent.mm.opensdk.openapi.IWXAPI;  
8 -import com.tencent.mm.opensdk.openapi.WXAPIFactory;  
9 -  
10 -/**  
11 - * Created by 14178 on 2018/1/19.  
12 - */  
13 -  
14 -public class WxLogin {  
15 -  
16 - public static IWXAPI api;  
17 - public static Context mContext;  
18 -  
19 - /**  
20 - * 急的初始化  
21 - *  
22 - * @param context  
23 - */  
24 - public static void initWx(Context context) {  
25 - UIUtils.initContext(context);  
26 - mContext = context;  
27 - api = WXAPIFactory.createWXAPI(context, WxData.WEIXIN_APP_ID, true);  
28 - api.registerApp(WxData.WEIXIN_APP_ID);  
29 -  
30 - final IWXAPI msgApi = WXAPIFactory.createWXAPI(context, null);  
31 - // 将该app注册到微信  
32 - msgApi.registerApp(WxData.WEIXIN_APP_ID);  
33 - }  
34 -  
35 - public static void longWx() {  
36 - if (mContext == null) {  
37 - Toast.makeText(mContext, "你没有初始化,请在Application中做初始化动作,请调用 initWx(context)方法", Toast.LENGTH_SHORT).show();  
38 - return;  
39 - }  
40 - if (!api.isWXAppInstalled()) {  
41 - Toast.makeText(mContext, "您还未安装微信客户端", Toast.LENGTH_SHORT).show();  
42 - return;  
43 - }  
44 - final SendAuth.Req req = new SendAuth.Req();  
45 - req.scope = WxData.SCOPE;  
46 - req.state = WxData.STATE;  
47 - api.sendReq(req);  
48 -  
49 - }  
50 -  
51 -  
52 -}  
@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
9 android:layout_height="@dimen/dp_90" 9 android:layout_height="@dimen/dp_90"
10 android:src="@mipmap/ic_launcher" 10 android:src="@mipmap/ic_launcher"
11 android:scaleType="fitXY" 11 android:scaleType="fitXY"
  12 + android:layout_marginTop="@dimen/dp_20"
12 /> 13 />
13 14
14 <LinearLayout 15 <LinearLayout
@@ -16,6 +17,7 @@ @@ -16,6 +17,7 @@
16 android:layout_height="@dimen/dp_90" 17 android:layout_height="@dimen/dp_90"
17 android:orientation="vertical" 18 android:orientation="vertical"
18 android:layout_toRightOf="@id/img" 19 android:layout_toRightOf="@id/img"
  20 + android:layout_marginTop="@dimen/dp_20"
19 > 21 >
20 22
21 <TextView 23 <TextView
@@ -24,7 +26,7 @@ @@ -24,7 +26,7 @@
24 android:layout_height="wrap_content" 26 android:layout_height="wrap_content"
25 android:layout_alignTop="@id/img" 27 android:layout_alignTop="@id/img"
26 android:layout_marginLeft="@dimen/dp_25" 28 android:layout_marginLeft="@dimen/dp_25"
27 - android:layout_marginTop="@dimen/dp_25" 29 + android:layout_marginTop="@dimen/dp_24"
28 android:text="ABB初级工程师证书" 30 android:text="ABB初级工程师证书"
29 android:textColor="#555555" 31 android:textColor="#555555"
30 android:textSize="15sp" 32 android:textSize="15sp"
@@ -36,14 +38,12 @@ @@ -36,14 +38,12 @@
36 android:layout_height="wrap_content" 38 android:layout_height="wrap_content"
37 android:layout_below="@id/tv_title" 39 android:layout_below="@id/tv_title"
38 android:layout_marginLeft="@dimen/dp_25" 40 android:layout_marginLeft="@dimen/dp_25"
39 - android:layout_marginTop="@dimen/dp_15" 41 + android:layout_marginTop="@dimen/dp_13"
40 android:layout_toRightOf="@+id/img" 42 android:layout_toRightOf="@+id/img"
41 android:text="2010.07-2018.06" 43 android:text="2010.07-2018.06"
42 android:textColor="#AAAAAA" 44 android:textColor="#AAAAAA"
43 android:textSize="12sp" /> 45 android:textSize="12sp" />
44 46
45 -  
46 -  
47 </LinearLayout> 47 </LinearLayout>
48 48
49 <View 49 <View
@@ -6,7 +6,9 @@ @@ -6,7 +6,9 @@
6 <FrameLayout 6 <FrameLayout
7 android:id="@+id/frame" 7 android:id="@+id/frame"
8 android:layout_width="@dimen/dp_165" 8 android:layout_width="@dimen/dp_165"
9 - android:layout_height="@dimen/dp_93"> 9 + android:layout_height="@dimen/dp_93"
  10 + android:layout_marginRight="@dimen/dp_15"
  11 + >
10 12
11 <ImageView 13 <ImageView
12 android:id="@+id/img" 14 android:id="@+id/img"
@@ -96,13 +98,15 @@ @@ -96,13 +98,15 @@
96 android:layout_toRightOf="@id/tv_free" 98 android:layout_toRightOf="@id/tv_free"
97 android:text="机器人编程方式 拷贝" 99 android:text="机器人编程方式 拷贝"
98 android:textColor="#349DFF" 100 android:textColor="#349DFF"
99 - android:textSize="13sp" /> 101 + android:textSize="13sp"
  102 + android:maxLines="2"
  103 + />
100 104
101 <TextView 105 <TextView
102 android:id="@+id/tv_recently" 106 android:id="@+id/tv_recently"
103 android:layout_width="wrap_content" 107 android:layout_width="wrap_content"
104 android:layout_height="wrap_content" 108 android:layout_height="wrap_content"
105 - android:layout_below="@id/tv_free" 109 + android:layout_below="@id/tv_resourse"
106 android:layout_marginLeft="@dimen/dp_9" 110 android:layout_marginLeft="@dimen/dp_9"
107 android:layout_marginTop="@dimen/dp_13" 111 android:layout_marginTop="@dimen/dp_13"
108 android:layout_toRightOf="@id/frame" 112 android:layout_toRightOf="@id/frame"
@@ -114,7 +118,7 @@ @@ -114,7 +118,7 @@
114 android:id="@+id/tv_time" 118 android:id="@+id/tv_time"
115 android:layout_width="wrap_content" 119 android:layout_width="wrap_content"
116 android:layout_height="wrap_content" 120 android:layout_height="wrap_content"
117 - android:layout_below="@id/tv_free" 121 + android:layout_below="@id/tv_resourse"
118 android:layout_marginLeft="@dimen/dp_5" 122 android:layout_marginLeft="@dimen/dp_5"
119 android:layout_marginTop="@dimen/dp_13" 123 android:layout_marginTop="@dimen/dp_13"
120 android:layout_toRightOf="@id/tv_recently" 124 android:layout_toRightOf="@id/tv_recently"
不能预览此文件类型
@@ -7,9 +7,9 @@ buildscript { @@ -7,9 +7,9 @@ buildscript {
7 jcenter() 7 jcenter()
8 } 8 }
9 dependencies { 9 dependencies {
10 - classpath 'com.android.tools.build:gradle:3.2.0'  
11 -  
12 - 10 + classpath 'com.android.tools.build:gradle:3.4.1'
  11 + classpath 'com.novoda:bintray-release:0.9'
  12 + classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
13 // NOTE: Do not place your application dependencies here; they belong 13 // NOTE: Do not place your application dependencies here; they belong
14 // in the individual module build.gradle files 14 // in the individual module build.gradle files
15 } 15 }
@@ -19,6 +19,7 @@ allprojects { @@ -19,6 +19,7 @@ allprojects {
19 repositories { 19 repositories {
20 google() 20 google()
21 jcenter() 21 jcenter()
  22 +
22 } 23 }
23 } 24 }
24 25
1 distributionBase=GRADLE_USER_HOME 1 distributionBase=GRADLE_USER_HOME
2 distributionPath=wrapper/dists 2 distributionPath=wrapper/dists
3 -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip 3 +#distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
4 zipStoreBase=GRADLE_USER_HOME 4 zipStoreBase=GRADLE_USER_HOME
5 zipStorePath=wrapper/dists 5 zipStorePath=wrapper/dists
6 - 6 +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip