@@ -43,4 +43,5 @@ dependencies {
|
||
| 43 | 43 |
apt 'com.jakewharton:butterknife-compiler:8.2.1' |
| 44 | 44 |
compile 'com.google.code.gson:gson:2.7' |
| 45 | 45 |
compile files('libs/universal-image-loader-1.9.4.jar')
|
| 46 |
+ compile files('libs/libammsdk.jar')
|
|
| 46 | 47 |
} |
@@ -26,9 +26,9 @@ |
||
| 26 | 26 |
<activity |
| 27 | 27 |
android:name=".splash.SplashActivity" |
| 28 | 28 |
android:configChanges="keyboardHidden|orientation|screenSize" |
| 29 |
- android:theme="@android:style/Theme.NoTitleBar.Fullscreen" |
|
| 30 | 29 |
android:label="@string/app_name" |
| 31 |
- android:screenOrientation="portrait"> |
|
| 30 |
+ android:screenOrientation="portrait" |
|
| 31 |
+ android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> |
|
| 32 | 32 |
|
| 33 | 33 |
<intent-filter> |
| 34 | 34 |
<action android:name="android.intent.action.MAIN" /> |
@@ -40,9 +40,9 @@ |
||
| 40 | 40 |
<activity |
| 41 | 41 |
android:name=".login.LoginActivity" |
| 42 | 42 |
android:configChanges="keyboardHidden|orientation|screenSize" |
| 43 |
- android:theme="@android:style/Theme.NoTitleBar.Fullscreen" |
|
| 44 | 43 |
android:label="@string/app_name" |
| 45 |
- android:screenOrientation="portrait"> |
|
| 44 |
+ android:screenOrientation="portrait" |
|
| 45 |
+ android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> |
|
| 46 | 46 |
|
| 47 | 47 |
</activity> |
| 48 | 48 |
|
@@ -78,6 +78,12 @@ |
||
| 78 | 78 |
android:label="@string/app_name" |
| 79 | 79 |
android:screenOrientation="portrait"></activity> |
| 80 | 80 |
|
| 81 |
+ <activity |
|
| 82 |
+ android:name=".wxapi.WXEntryActivity" |
|
| 83 |
+ android:exported="true" |
|
| 84 |
+ android:launchMode="singleTop" |
|
| 85 |
+ android:theme="@android:style/Theme.NoDisplay" /> |
|
| 86 |
+ |
|
| 81 | 87 |
<service android:name=".service.UpgradeService" /> |
| 82 | 88 |
|
| 83 | 89 |
<service android:name=".service.UploadService" /> |
@@ -5,14 +5,11 @@ import android.os.Bundle; |
||
| 5 | 5 |
import android.support.v4.app.FragmentActivity; |
| 6 | 6 |
import android.text.TextUtils; |
| 7 | 7 |
import android.view.View; |
| 8 |
-import android.widget.EditText; |
|
| 9 | 8 |
import android.widget.Toast; |
| 10 | 9 |
|
| 11 | 10 |
import com.android.views.progressbar.ProgressWheel; |
| 12 | 11 |
|
| 13 | 12 |
import ai.pai.lensman.R; |
| 14 |
-import ai.pai.lensman.base.BaseActivity; |
|
| 15 |
-import ai.pai.lensman.db.Preferences; |
|
| 16 | 13 |
import ai.pai.lensman.upload.UploadActivity; |
| 17 | 14 |
import butterknife.BindView; |
| 18 | 15 |
import butterknife.ButterKnife; |
@@ -35,7 +32,7 @@ public class LoginActivity extends FragmentActivity implements LoginContract.Vie |
||
| 35 | 32 |
|
| 36 | 33 |
@OnClick(R.id.btn_login) |
| 37 | 34 |
public void login(){
|
| 38 |
- presenter.login(); |
|
| 35 |
+ presenter.start(); |
|
| 39 | 36 |
} |
| 40 | 37 |
|
| 41 | 38 |
@Override |
@@ -2,6 +2,10 @@ package ai.pai.lensman.login; |
||
| 2 | 2 |
|
| 3 | 3 |
import android.content.Context; |
| 4 | 4 |
|
| 5 |
+import com.tencent.mm.sdk.modelmsg.SendAuth; |
|
| 6 |
+import com.tencent.mm.sdk.openapi.IWXAPI; |
|
| 7 |
+import com.tencent.mm.sdk.openapi.WXAPIFactory; |
|
| 8 |
+ |
|
| 5 | 9 |
import ai.pai.lensman.base.BaseInteractor; |
| 6 | 10 |
import ai.pai.lensman.db.Preferences; |
| 7 | 11 |
|
@@ -13,6 +17,7 @@ public class LoginPresenter implements LoginContract.Presenter,BaseInteractor.In |
||
| 13 | 17 |
private Context context; |
| 14 | 18 |
private LoginContract.View view; |
| 15 | 19 |
private LoginInteractor interactor; |
| 20 |
+ private static final String APP_ID = ""; |
|
| 16 | 21 |
|
| 17 | 22 |
public LoginPresenter(Context context,LoginContract.View view){
|
| 18 | 23 |
this.view = view; |
@@ -28,7 +33,12 @@ public class LoginPresenter implements LoginContract.Presenter,BaseInteractor.In |
||
| 28 | 33 |
|
| 29 | 34 |
@Override |
| 30 | 35 |
public void start() {
|
| 31 |
- |
|
| 36 |
+ IWXAPI api = WXAPIFactory.createWXAPI(context, APP_ID, true); |
|
| 37 |
+ api.registerApp(APP_ID); |
|
| 38 |
+ SendAuth.Req req = new SendAuth.Req(); |
|
| 39 |
+ req.scope = "snsapi_userinfo"; |
|
| 40 |
+ req.state = "paiai_for_lensman"; |
|
| 41 |
+ api.sendReq(req); |
|
| 32 | 42 |
} |
| 33 | 43 |
|
| 34 | 44 |
@Override |
@@ -0,0 +1,48 @@ |
||
| 1 |
+package ai.pai.lensman.wxapi; |
|
| 2 |
+ |
|
| 3 |
+import android.app.Activity; |
|
| 4 |
+import android.content.Intent; |
|
| 5 |
+import android.os.Bundle; |
|
| 6 |
+ |
|
| 7 |
+import com.tencent.mm.sdk.modelbase.BaseReq; |
|
| 8 |
+import com.tencent.mm.sdk.modelbase.BaseResp; |
|
| 9 |
+import com.tencent.mm.sdk.modelmsg.SendAuth; |
|
| 10 |
+import com.tencent.mm.sdk.openapi.IWXAPI; |
|
| 11 |
+import com.tencent.mm.sdk.openapi.IWXAPIEventHandler; |
|
| 12 |
+import com.tencent.mm.sdk.openapi.WXAPIFactory; |
|
| 13 |
+ |
|
| 14 |
+public class WXEntryActivity extends Activity implements IWXAPIEventHandler {
|
|
| 15 |
+ |
|
| 16 |
+ private IWXAPI api; |
|
| 17 |
+ |
|
| 18 |
+ @Override |
|
| 19 |
+ public void onCreate(Bundle savedInstanceState) {
|
|
| 20 |
+ super.onCreate(savedInstanceState); |
|
| 21 |
+ api = WXAPIFactory.createWXAPI(this, "APP_ID"); |
|
| 22 |
+ api.handleIntent(getIntent(), this); |
|
| 23 |
+ } |
|
| 24 |
+ |
|
| 25 |
+ |
|
| 26 |
+ @Override |
|
| 27 |
+ protected void onNewIntent(Intent intent) {
|
|
| 28 |
+ super.onNewIntent(intent); |
|
| 29 |
+ setIntent(intent); |
|
| 30 |
+ api.handleIntent(intent, this); |
|
| 31 |
+ finish(); |
|
| 32 |
+ } |
|
| 33 |
+ |
|
| 34 |
+ @Override |
|
| 35 |
+ public void onReq(BaseReq baseReq) {
|
|
| 36 |
+ |
|
| 37 |
+ } |
|
| 38 |
+ |
|
| 39 |
+ @Override |
|
| 40 |
+ public void onResp(BaseResp resp) {
|
|
| 41 |
+ |
|
| 42 |
+ if(resp instanceof SendAuth.Resp){
|
|
| 43 |
+ SendAuth.Resp newResp = (SendAuth.Resp) resp; |
|
| 44 |
+ String code = newResp.code; |
|
| 45 |
+ } |
|
| 46 |
+ } |
|
| 47 |
+ |
|
| 48 |
+} |