| | |
| | | import android.os.Handler; |
| | | import android.os.Message; |
| | | import android.util.Log; |
| | | import android.view.Gravity; |
| | | import android.view.KeyEvent; |
| | | import android.view.View; |
| | | import android.view.View.OnClickListener; |
| | | import android.widget.CheckBox; |
| | | import android.widget.EditText; |
| | | import android.widget.ImageView; |
| | | import android.widget.LinearLayout; |
| | | import android.widget.LinearLayout.LayoutParams; |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.lcjian.library.util.SingleToast; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.tencent.mm.opensdk.modelmsg.SendAuth; |
| | |
| | | import com.umeng.socialize.UMAuthListener; |
| | | import com.umeng.socialize.UMShareAPI; |
| | | import com.umeng.socialize.bean.SHARE_MEDIA; |
| | | import com.umeng.socialize.utils.SocializeUtils; |
| | | import com.weikou.beibeivideo.BasicTextHttpResponseHandler; |
| | | import com.weikou.beibeivideo.BeibeiVideoAPI; |
| | | import com.weikou.beibeivideo.BeibeiVideoApplication; |
| | | import com.weikou.beibeivideo.R; |
| | | import com.weikou.beibeivideo.ui.BaseActivity; |
| | | import com.weikou.beibeivideo.ui.mine.BrowserActivity; |
| | | import com.weikou.beibeivideo.util.BeibeiConstant; |
| | | import com.weikou.beibeivideo.util.XGPush; |
| | | import com.weikou.beibeivideo.R; |
| | | import com.weikou.beibeivideo.util.novel.NovelJNZUtil; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONException; |
| | |
| | | findViewById(R.id.login_tv_cancel).setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | finish(); |
| | | onResult(RESULT_CANCELED); |
| | | } |
| | | }); |
| | | |
| | |
| | | public void onClick(View v) { |
| | | switch (v.getId()) { |
| | | case R.id.login_tv_cancel:// 取消 |
| | | finish(); |
| | | onResult(RESULT_CANCELED); |
| | | break; |
| | | case R.id.ll_login_qq:// QQ登录 |
| | | if (!cb_user_agreement.isChecked()) { |
| | | SingleToast.showToast(LoginActivity.this, "选择同意用户协议后方可登录"); |
| | | break; |
| | | } |
| | | if (isQQClientAvailable()) { |
| | | loginType = "1"; |
| | | // qq登录逻辑处理 点击登录后需要暂时锁定返回键和返回功能 不然会报错 |
| | |
| | | break; |
| | | |
| | | case R.id.ll_login_wx://微信登录 |
| | | if (!cb_user_agreement.isChecked()) { |
| | | SingleToast.showToast(LoginActivity.this, "选择同意用户协议后方可登录"); |
| | | break; |
| | | } |
| | | if (isWXClientAvailable()) { |
| | | loginType = "2"; |
| | | SendAuth.Req req = new SendAuth.Req(); |
| | |
| | | data.get("gender")); |
| | | edit.commit(); |
| | | |
| | | NovelJNZUtil.setUid(getApplicationContext()); |
| | | |
| | | SingleToast.showToast(LoginActivity.this, |
| | | "登录成功"); |
| | | XGPush.registerPush(LoginActivity.this); |
| | | finish(); |
| | | onResult(RESULT_OK); |
| | | } |
| | | |
| | | @Override |
| | |
| | | jsonObject.optJSONObject("Data").optString("Nickname")); |
| | | edit.commit(); |
| | | SingleToast.showToast(LoginActivity.this, "登录成功" + "昵称为:" + jsonObject.optJSONObject("Data").optString("Nickname")); |
| | | finish(); |
| | | onResult(RESULT_OK); |
| | | } else { |
| | | SingleToast.showToast(LoginActivity.this, "登录失败"); |
| | | } |
| | |
| | | public void onResume() { |
| | | super.onResume(); |
| | | if (!StringUtils.isEmpty(getSharedPreferences("user", Context.MODE_PRIVATE).getString("LoginUid", ""))) { |
| | | finish(); |
| | | onResult(RESULT_OK); |
| | | } |
| | | MobclickAgent.onPageStart("登录页"); |
| | | } |
| | |
| | | response.getString("gender")); |
| | | edit.commit(); |
| | | |
| | | NovelJNZUtil.setUid(getApplicationContext()); |
| | | |
| | | SingleToast.showToast(LoginActivity.this, |
| | | "登录成功"); |
| | | XGPush.registerPush(LoginActivity.this); |
| | | finish(); |
| | | onResult(RESULT_OK); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | } |
| | | }; |
| | | |
| | | |
| | | private void onResult(int resultCode) { |
| | | boolean result = getIntent().getBooleanExtra("result", false); |
| | | if (result) { |
| | | Intent intent = new Intent(); |
| | | //把返回数据存入Intent |
| | | setResult(resultCode, intent); |
| | | //关闭Activity |
| | | finish(); |
| | | } else { |
| | | //关闭Activity |
| | | finish(); |
| | | } |
| | | } |
| | | } |