-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
liujinwei
committed
Sep 27, 2018
1 parent
a39f081
commit 0921698
Showing
16 changed files
with
268 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 5 additions & 55 deletions
60
app/src/main/java/net/arvin/socialhelper/sample/wxapi/WXEntryActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,18 @@ | ||
package net.arvin.socialhelper.sample.wxapi; | ||
|
||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.util.Log; | ||
|
||
import com.tencent.mm.opensdk.constants.ConstantsAPI; | ||
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.IWXAPI; | ||
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler; | ||
import com.tencent.mm.opensdk.openapi.WXAPIFactory; | ||
|
||
import net.arvin.socialhelper.SocialHelper; | ||
import net.arvin.socialhelper.WXHelperActivity; | ||
import net.arvin.socialhelper.sample.utils.SocialUtil; | ||
|
||
/** | ||
* Created by arvinljw on 17/7/6 14:43 | ||
* Function: | ||
* Desc: | ||
*/ | ||
public class WXEntryActivity extends AppCompatActivity implements IWXAPIEventHandler { | ||
private IWXAPI api; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
String wxAppId = SocialUtil.INSTANCE.socialHelper.getBuilder().getWxAppId(); | ||
api = WXAPIFactory.createWXAPI(this, wxAppId, true); | ||
api.registerApp(wxAppId); | ||
|
||
api.handleIntent(getIntent(), this); | ||
} | ||
|
||
@Override | ||
protected void onNewIntent(Intent intent) { | ||
super.onNewIntent(intent); | ||
setIntent(intent); | ||
api.handleIntent(intent, this); | ||
} | ||
|
||
@Override | ||
public void onReq(BaseReq baseReq) { | ||
} | ||
public class WXEntryActivity extends WXHelperActivity { | ||
|
||
@Override | ||
public void onResp(BaseResp baseResp) { | ||
//登录 | ||
Log.d("WXEntryActivity", baseResp.errCode + baseResp.errStr); | ||
if (baseResp.getType() == ConstantsAPI.COMMAND_SENDAUTH) { | ||
if (baseResp.errCode == BaseResp.ErrCode.ERR_OK) { | ||
String code = ((SendAuth.Resp) baseResp).code; | ||
SocialUtil.INSTANCE.socialHelper.sendAuthBackBroadcast(this, code); | ||
} else { | ||
SocialUtil.INSTANCE.socialHelper.sendAuthBackBroadcast(this, null); | ||
} | ||
} else if (baseResp.getType() == ConstantsAPI.COMMAND_SENDMESSAGE_TO_WX) { | ||
if (baseResp.errCode == BaseResp.ErrCode.ERR_OK) { | ||
SocialUtil.INSTANCE.socialHelper.sendShareBackBroadcast(this, true); | ||
} else { | ||
SocialUtil.INSTANCE.socialHelper.sendShareBackBroadcast(this, false); | ||
} | ||
} | ||
onBackPressed(); | ||
protected SocialHelper getSocialHelper() { | ||
return SocialUtil.INSTANCE.socialHelper; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Wed May 09 20:18:08 CST 2018 | ||
#Thu Sep 27 14:54:57 CST 2018 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
socialhelper/src/main/java/net/arvin/socialhelper/INeedLoginResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package net.arvin.socialhelper; | ||
|
||
/** | ||
* Created by arvinljw on 2018/9/27 15:26 | ||
* Function: | ||
* Desc: | ||
*/ | ||
public interface INeedLoginResult { | ||
void setNeedLoginResult(boolean needLoginResult); | ||
|
||
boolean isNeedLoginResult(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.