上传代码。

This commit is contained in:
Jay Gao 2022-08-09 14:30:53 +08:00
parent 02e9633de5
commit 7ac9cc1786
1757 changed files with 38483 additions and 0 deletions

View File

@ -0,0 +1,26 @@
package com.yonsz.z1;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.administrator.unikong", appContext.getPackageName());
}
}

View File

@ -0,0 +1,101 @@
package com.ansunxan.z1.wxapi;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.util.Log;
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 com.yonsz.z1.R;
import com.yonsz.z1.database.entity.entitya2.WxLoginEvent;
import java.io.ByteArrayOutputStream;
import de.greenrobot.event.EventBus;
import static com.yonsz.z1.difference.DifferConstans.WX_APP_ID;
public class WXEntryActivity extends Activity implements IWXAPIEventHandler {
private IWXAPI iwxapi;
public static byte[] bmpToByteArray(final Bitmap bmp, final boolean needRecycle) {
ByteArrayOutputStream output = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.PNG, 100, output);
if (needRecycle) {
bmp.recycle();
}
byte[] result = output.toByteArray();
try {
output.close();
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_wxentry);
iwxapi = WXAPIFactory.createWXAPI(this, WX_APP_ID, false);
iwxapi.handleIntent(getIntent(), this);
iwxapi.registerApp(WX_APP_ID);
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
iwxapi.handleIntent(intent, this);
}
@Override
public void onReq(BaseReq baseReq) {
Log.i("BaseReq", "" + baseReq.openId + "---" + baseReq.transaction);
}
@Override
public void onResp(BaseResp resp) {
Log.i("BaseReq", "" + resp.openId + "---" + resp.transaction + "===" + resp.errCode + "==" + resp.errStr);
String result;
switch (resp.errCode) {
case BaseResp.ErrCode.ERR_OK:
result = getString(R.string.Share_success);
if (resp instanceof SendAuth.Resp) {
String code = ((SendAuth.Resp) resp).code;
Log.i("BaseReq", "LoginActivity onResp()" + code);
EventBus.getDefault().post(
new WxLoginEvent(code));
} else {
}
break;
case BaseResp.ErrCode.ERR_USER_CANCEL:
result = "取消分享";
break;
case BaseResp.ErrCode.ERR_AUTH_DENIED:
result = "分享被拒绝";
break;
default:
result = "发送返回";
break;
}
finish();
}
private String buildTransaction(final String type) {
return (type == null) ? String.valueOf(System.currentTimeMillis()) : type + System.currentTimeMillis();
}
enum SHARE_TYPE {Type_WXSceneSession, Type_WXSceneTimeline}
}

View File

@ -0,0 +1,55 @@
package com.ansunxan.z1.wxapi;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.os.Bundle;
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.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
import com.yonsz.z1.R;
import static com.yonsz.z1.difference.DifferConstans.WX_APP_ID;
public class WXPayEntryActivity extends Activity implements IWXAPIEventHandler {
private final String TAG = "WXPayEntryActivity";
private IWXAPI api;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_wxentry);
api = WXAPIFactory.createWXAPI(this, WX_APP_ID);
api.handleIntent(getIntent(), this);
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
api.handleIntent(intent, this);
}
@Override
public void onReq(BaseReq req) {
}
@Override
public void onResp(BaseResp resp) {
Log.i(TAG,"errCode = " + resp.errCode);
//最好依赖于商户后台的查询结果
if (resp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) {
//如果返回-1很大可能是因为应用签名的问题用官方的工具生成
//签名工具下载https://open.weixin.qq.com/zh_CN/htmledition/res/dev/download/sdk/Gen_Signature_Android.apk
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("提示");
builder.setMessage(getString(R.string.pay_result_callback_msg, String.valueOf(resp.errCode)));
builder.show();
}
finish();
}
}

View File

@ -0,0 +1,20 @@
package com.yonsz.z1.difference;
/**
* Created by Administrator on 2018/6/21.
*/
public class DifferConstans {
//后台版本控制
public static final String VERSION_S = "v1";
public static final String APPID_S = "1103";
public static final String APPSECRET_S = "ysz666888";
public static final String APPID_S_VOICE = "110301";
public static final String WX_APP_ID = "wx809b2ddc1b72ecb6";
public static final String SERVER_BACKUP4 = "https://openapi.lechange.cn:443";//乐橙
public static final String TEPRINCIPLE_UPDATE = "teprinciple2.update";
public static String versionUrl = "http://a.app.qq.com/o/simple.jsp?pkgname=com.ansunxan.z1";
public static String LECHENG_KEY = "ysz123456";
public static String LECHENG_APPID = "lcc58705630dd248d1";
public static String LECHENG_APPSECRET = "91ac51eb533b4253ae2b917470ad27";
}

View File

@ -0,0 +1,509 @@
package com.yonsz.z1.login;
import android.content.Intent;
import android.os.Bundle;
import android.os.Message;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.alibaba.fastjson.JSON;
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 com.yonsz.z1.R;
import com.yonsz.z1.activity.BaseActivity;
import com.yonsz.z1.database.entity.ResponeEntity;
import com.yonsz.z1.database.entity.TokenEntity;
import com.yonsz.z1.database.entity.entitya2.WxLoginEvent;
import com.yonsz.z1.difference.DifferConstans;
import com.yonsz.z1.listener.OnTitleItemClickListener;
import com.yonsz.z1.login.forgetpw.ForgetPWActivity;
import com.yonsz.z1.login.register.RegisterActivity;
import com.yonsz.z1.login.register.WxRegisterActivity;
import com.yonsz.z1.net.Constans;
import com.yonsz.z1.net.NetWorkUrl;
import com.yonsz.z1.net.NetWorkUtil;
import com.yonsz.z1.utils.DensityUtil;
import com.yonsz.z1.utils.KeyboardUtil;
import com.yonsz.z1.utils.SharedpreferencesUtil;
import com.yonsz.z1.utils.ToastUtil;
import com.yonsz.z1.utils.VerificationUtils;
import com.yonsz.z1.version4.MainActivity4;
import com.yonsz.z1.view.TitleView;
import com.yonsz.z1.view.loading.LoadingDialog;
import java.util.HashMap;
import de.greenrobot.event.EventBus;
import static com.yonsz.z1.R.id.clean_password;
import static com.yonsz.z1.R.id.iv_clean_phone;
import static com.yonsz.z1.difference.DifferConstans.APPID_S;
import static com.yonsz.z1.difference.DifferConstans.APPSECRET_S;
import static com.yonsz.z1.difference.DifferConstans.WX_APP_ID;
import static com.yonsz.z1.net.Constans.FAN_LEARN_WHAT;
import static com.yonsz.z1.net.Constans.GET_PHONE_AREA;
import static com.yonsz.z1.net.Constans.GET_TOKEN_FAIL;
import static com.yonsz.z1.net.Constans.LOGIN_FAIL;
import static com.yonsz.z1.net.Constans.LOGIN_SUCCESS;
import static com.yonsz.z1.net.Constans.WX_LOGIN_FAIL;
import static com.yonsz.z1.net.Constans.WX_LOGIN_REGISTER;
import static com.yonsz.z1.net.Constans.WX_LOGIN_SUCCESS;
/**
* Created by Administrator on 2017/5/16.
*/
public class LoginActivity extends BaseActivity implements IWXAPIEventHandler {
private TitleView mTitle;
private Button mLogin;
private TextView mRegister;
private TextView mForgetPw;
private EditText mUserName;
private EditText mPassWord;
private ImageView cleanPhoneIv;
private ImageView cleanPasswordIv;
private LoadingDialog mLoadingDialog;
private RelativeLayout rl_weixin_login;
private LinearLayout phoneAreaLl;
private IWXAPI iwxapi;
private TextView phoneArea;
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
switch (ev.getAction()) {
case MotionEvent.ACTION_DOWN:
View view = getCurrentFocus();
KeyboardUtil.hideKeyboard(ev, view, LoginActivity.this);//调用方法判断是否需要隐藏键盘
break;
default:
break;
}
return super.dispatchTouchEvent(ev);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
initView();
initListener();
iwxapi = WXAPIFactory.createWXAPI(this, WX_APP_ID, true);
iwxapi.handleIntent(this.getIntent(), this);
iwxapi.registerApp(WX_APP_ID);
if (TextUtils.isEmpty(SharedpreferencesUtil.get(Constans.SEESSIONID, ""))) {
getToken();
}
}
private void getToken() {
NetWorkUtil util = NetWorkUtil.instans();
HashMap<String, String> map = new HashMap<>();
map.put("appId", APPID_S);
map.put("appSecret", APPSECRET_S);
util.requestPostByAsynewApi(NetWorkUrl.GET_TOKEN, map, new NetWorkUtil.ReqCallBack() {
@Override
public void onSuccess(String respone) {
Log.i("getToken", "onSuccess: " + respone);
TokenEntity entity = JSON.parseObject(respone, TokenEntity.class);
SharedpreferencesUtil.save(Constans.TOKENID, entity.getData().getToken().toString().trim());
}
@Override
public void onFail(String message) {
Log.i("getToken", "onSuccess: " + message);
Message msg = mHandler.obtainMessage(GET_TOKEN_FAIL);
msg.obj = message;
mHandler.sendMessage(msg);
}
});
}
@Override
public boolean enableSliding() {
return false;
}
public void onEventMainThread(WxLoginEvent event) {
String msg = event.getMsg();
Log.e("nettyUtil", msg);
Message message = new Message();
message.what = FAN_LEARN_WHAT;
message.obj = msg;
mHandler.sendMessage(message);
}
private void initView() {
phoneArea = (TextView) findViewById(R.id.tv_phone_area);
phoneAreaLl = (LinearLayout) findViewById(R.id.ll_phone_area);
cleanPhoneIv = (ImageView) findViewById(iv_clean_phone);
cleanPasswordIv = (ImageView) findViewById(clean_password);
mUserName = (EditText) findViewById(R.id.edit_username);
mUserName.setText(SharedpreferencesUtil.get(Constans.USERPHONE, ""));
if (!TextUtils.isEmpty(mUserName.getText().toString())) {
cleanPhoneIv.setVisibility(View.VISIBLE);
}
mPassWord = (EditText) findViewById(R.id.edit_pw);
mLogin = (Button) findViewById(R.id.bt_sure);
mLogin.setBackgroundDrawable(getResources().getDrawable(R.drawable.btn_round_9cc6f6));
mRegister = (TextView) findViewById(R.id.tv_register);
mForgetPw = (TextView) findViewById(R.id.txt_forget_pw);
rl_weixin_login = (RelativeLayout) findViewById(R.id.rl_weixin_login);
mLoadingDialog = new LoadingDialog(this);
mTitle = (TitleView) findViewById(R.id.title_login);
mTitle.setHead(R.string.login);
mTitle.setHeadBackGone();
mTitle.setHeadFuntionTxt(" ");
mTitle.setTitleListener(new OnTitleItemClickListener() {
@Override
public void onBack() {
}
@Override
public void onFunction() {
}
@Override
public void onFunctionText() {
}
});
}
private void initListener() {
rl_weixin_login.setOnClickListener(this);
mLogin.setOnClickListener(this);
mRegister.setOnClickListener(this);
mForgetPw.setOnClickListener(this);
cleanPasswordIv.setOnClickListener(this);
cleanPhoneIv.setOnClickListener(this);
phoneAreaLl.setOnClickListener(this);
mUserName.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
int i = s.length();
if (i == 0 || TextUtils.isEmpty(mPassWord.getText())) {
mLogin.setBackgroundDrawable(getResources().getDrawable(R.drawable.btn_round_9cc6f6));
mLogin.setEnabled(false);
} else {
mLogin.setBackgroundDrawable(getResources().getDrawable(R.drawable.btn_round_398dee));
mLogin.setEnabled(true);
}
}
@Override
public void afterTextChanged(Editable s) {
if (!TextUtils.isEmpty(s) && cleanPhoneIv.getVisibility() == View.GONE) {
cleanPhoneIv.setVisibility(View.VISIBLE);
} else if (TextUtils.isEmpty(s)) {
cleanPhoneIv.setVisibility(View.GONE);
}
}
});
mPassWord.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
int i = s.length();
if (i == 0 || TextUtils.isEmpty(mUserName.getText())) {
mLogin.setBackgroundDrawable(getResources().getDrawable(R.drawable.btn_round_9cc6f6));
mLogin.setEnabled(false);
} else {
mLogin.setBackgroundDrawable(getResources().getDrawable(R.drawable.btn_round_398dee));
mLogin.setEnabled(true);
}
}
@Override
public void afterTextChanged(Editable s) {
if (!TextUtils.isEmpty(s) && cleanPasswordIv.getVisibility() == View.GONE) {
cleanPasswordIv.setVisibility(View.VISIBLE);
} else if (TextUtils.isEmpty(s)) {
cleanPasswordIv.setVisibility(View.GONE);
}
if (s.toString().isEmpty())
return;
if (!s.toString().matches("[A-Za-z0-9]+")) {
String temp = s.toString();
Toast.makeText(LoginActivity.this, R.string.Enter_a_number, Toast.LENGTH_SHORT).show();
s.delete(temp.length() - 1, temp.length());
mPassWord.setSelection(s.length());
}
}
});
}
@Override
public void onClick(View v) {
super.onClick(v);
switch (v.getId()) {
case R.id.bt_sure:
if (DensityUtil.isNetworkConnected(this)) {
login();
} else {
ToastUtil.show(this, R.string.no_network_connection);
}
break;
case R.id.tv_register:
startActivity(new Intent(LoginActivity.this, RegisterActivity.class));
break;
case R.id.txt_forget_pw:
Intent intent = new Intent(LoginActivity.this, ForgetPWActivity.class);
intent.putExtra("tag", "LoginActivity");
startActivity(intent);
break;
case R.id.iv_clean_phone:
mUserName.setText("");
break;
case R.id.clean_password:
mPassWord.setText("");
break;
case R.id.rl_weixin_login:
if (!iwxapi.isWXAppInstalled()) {
Toast.makeText(this, getString(R.string.not_installed_Wechat), Toast.LENGTH_SHORT).show();
return;
}
wxLogin();
break;
case R.id.ll_phone_area:
Intent intent1 = new Intent(LoginActivity.this, PhoneAreaActivity.class);
intent1.putExtra("type", "login");
startActivityForResult(intent1, GET_PHONE_AREA);
break;
}
}
private void wxLogin() {
SendAuth.Req req1 = new SendAuth.Req();
req1.scope = "snsapi_userinfo";
req1.state = "wechat_sdk_demo_test";
iwxapi.sendReq(req1);
}
private void login() {
String name = mUserName.getText().toString();
String phoneCode = phoneArea.getText().toString();
SharedpreferencesUtil.save(Constans.USERPHONE, mUserName.getText().toString());
if (!VerificationUtils.isMobile(name.trim())) {
ToastUtil.show(this, R.string.phone_error);
return;
}
String password = mPassWord.getText().toString();
if (TextUtils.isEmpty(password.trim()) || password.length() < 6) {
ToastUtil.show(this, R.string.password_error);
return;
}
NetWorkUtil util = NetWorkUtil.instans();
HashMap<String, String> map = new HashMap<>();
// mobileLogin=true&isValidatjeesiteLogin=false&username=admin&password=admin
map.put("appId", DifferConstans.APPID_S);
map.put("mobile", name);
map.put("password", password);
map.put("telAreaCode", phoneCode.substring(phoneCode.indexOf("+") + 1, phoneCode.length()));
map.put("mobileLogin", "true");
map.put("clientType", "1");
// map.put("isValidatjeesiteLogin", "false");
mLoadingDialog.show();
util.requestPostByAsynewApi(NetWorkUrl.LOGIN_URL, map, new NetWorkUtil.ReqCallBack() {
@Override
public void onSuccess(String respone) {
ResponeEntity entity = JSON.parseObject(respone, ResponeEntity.class);
Log.i("login111", "onSuccess: " + respone);
if (1 == entity.getFlag()) {
Message msg = mHandler.obtainMessage(LOGIN_SUCCESS);
msg.obj = entity;
mHandler.sendMessage(msg);
} else {
Message msg = mHandler.obtainMessage(LOGIN_FAIL);
msg.obj = entity.getMsg();
mHandler.sendMessage(msg);
}
}
@Override
public void onFail(String message) {
Message msg = mHandler.obtainMessage(LOGIN_FAIL);
msg.obj = message;
mHandler.sendMessage(msg);
}
});
}
@Override
public void callBackUiThread(Message msg) {
mLoadingDialog.dismiss();
switch (msg.what) {
case LOGIN_FAIL:
ToastUtil.show(this, (String) msg.obj);
break;
case WX_LOGIN_FAIL:
if (null != mLoadingDialog) {
mLoadingDialog.dismiss();
}
ToastUtil.show(this, (String) msg.obj);
break;
case LOGIN_SUCCESS:
ResponeEntity entity = (ResponeEntity) msg.obj;
// ToastUtil.show(this, entity.getMsg());
Toast.makeText(LoginActivity.this, R.string.login_success, Toast.LENGTH_SHORT).show();
SharedpreferencesUtil.save(Constans.SEESSIONID, entity.getData().getSession());
SharedpreferencesUtil.save(Constans.USERID, entity.getData().getUserId());
// SharedpreferencesUtil.save(Constans.USERNAME, entity.getObj().getUser().getName());
SharedpreferencesUtil.save(Constans.PASSWORD, mPassWord.getText().toString());
boolean isSetting = TextUtils.isEmpty(SharedpreferencesUtil.
get(SharedpreferencesUtil.get(Constans.USERID, ""), ""));
startActivity(new Intent(this, MainActivity4.class));
finish();
/*if (isSetting) {
Intent intent = new Intent(this, SetGestureCodeActivity.class);
intent.putExtra("isset", true);
intent.putExtra("SEESSIONID", entity.getObj().getLogininfo().getSessionId());
startActivity(intent);
} else {
startActivity(new Intent(this, MainActivity.class));
}*/
break;
case WX_LOGIN_SUCCESS:
ResponeEntity wxLoginEntity = (ResponeEntity) msg.obj;
Toast.makeText(LoginActivity.this, R.string.login_success, Toast.LENGTH_SHORT).show();
// SharedpreferencesUtil.save(Constans.USERPHONE, wxLoginEntity.getObj().getUserInfo().getLoginName());
SharedpreferencesUtil.save(Constans.SEESSIONID, wxLoginEntity.getData().getSession());
SharedpreferencesUtil.save(Constans.USERID, wxLoginEntity.getData().getUserId());
// SharedpreferencesUtil.save(Constans.USERNAME, wxLoginEntity.getObj().getUserInfo().getName());
startActivity(new Intent(this, MainActivity4.class));
finish();
break;
case WX_LOGIN_REGISTER:
//去注册
ResponeEntity entity1 = (ResponeEntity) msg.obj;
Intent intent = new Intent(LoginActivity.this, WxRegisterActivity.class);
intent.putExtra("wxId", entity1.getObj().getWxId());
intent.putExtra("headUrl", entity1.getObj().getHeadUrl());
intent.putExtra("userName", entity1.getObj().getUserName());
startActivity(intent);
break;
case FAN_LEARN_WHAT:
String code = (String) msg.obj;
quickLogin(code);
break;
}
}
/**
* 微信登录
*
* @param code
*/
private synchronized void quickLogin(String code) {
if (mLoadingDialog.isShowing()) {
return;
}
mLoadingDialog.show();
NetWorkUtil util = NetWorkUtil.instans();
HashMap<String, String> map = new HashMap<>();
map.put("code", code);
map.put("appId", DifferConstans.APPID_S);
util.requestPostByAsynewApi(NetWorkUrl.WX_QUICK_LOGIN, map, new NetWorkUtil.ReqCallBack() {
@Override
public void onSuccess(String respone) {
Log.i("quickLogin", "onSuccess: " + respone);
ResponeEntity entity = JSON.parseObject(respone, ResponeEntity.class);
if (1 == entity.getFlag()) {
Message msg = mHandler.obtainMessage(WX_LOGIN_SUCCESS);
msg.obj = entity;
mHandler.sendMessage(msg);
} else if (1011 == entity.getFlag()) {
Message msg = mHandler.obtainMessage(WX_LOGIN_REGISTER);
msg.obj = entity;
mHandler.sendMessage(msg);
} else if (1013 == entity.getFlag()) {
Message msg = mHandler.obtainMessage(WX_LOGIN_REGISTER);
msg.obj = entity;
mHandler.sendMessage(msg);
} else {
Message msg = mHandler.obtainMessage(WX_LOGIN_FAIL);
msg.obj = entity.getMsg();
mHandler.sendMessage(msg);
}
}
@Override
public void onFail(String message) {
Message msg = mHandler.obtainMessage(LOGIN_FAIL);
msg.obj = message;
mHandler.sendMessage(msg);
}
});
}
@Override
public void onReq(BaseReq baseReq) {
}
@Override
public void onResp(BaseResp resp) {
Log.i("BaseReq", "" + resp.openId + "---" + resp.transaction + "===" + resp.errCode + "==" + resp.errStr);
String code = ((SendAuth.Resp) resp).code;
Log.i("BaseReq", "LoginActivity onResp()" + code);
String result;
switch (resp.errCode) {
case BaseResp.ErrCode.ERR_OK:
result = getString(R.string.Share_success);
EventBus.getDefault().post(
new WxLoginEvent(code));
break;
case BaseResp.ErrCode.ERR_USER_CANCEL:
result = "取消分享";
break;
case BaseResp.ErrCode.ERR_AUTH_DENIED:
result = "分享被拒绝";
break;
default:
result = "发送返回";
break;
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case GET_PHONE_AREA:
if (data != null && data.getExtras().get("phoneArea") != null) {
phoneArea.setText(data.getExtras().get("phoneArea").toString());
}
break;
}
}
}

View File

@ -0,0 +1,319 @@
package com.yonsz.z1.login;
import android.Manifest;
import android.annotation.TargetApi;
import android.content.Intent;
import android.graphics.Rect;
import android.os.Build;
import android.os.Bundle;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.view.DisplayCutout;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowInsets;
import android.widget.Toast;
import com.alibaba.fastjson.JSON;
import com.qw.soul.permission.SoulPermission;
import com.qw.soul.permission.bean.Permission;
import com.qw.soul.permission.bean.Permissions;
import com.qw.soul.permission.callbcak.CheckRequestPermissionsListener;
import com.tencent.android.tpush.XGIOperateCallback;
import com.tencent.android.tpush.XGPushManager;
import com.yonsz.z1.R;
import com.yonsz.z1.activity.BaseActivity;
import com.yonsz.z1.database.entity.TokenEntity;
import com.yonsz.z1.fragment.person.WebViewActivity;
import com.yonsz.z1.net.Constans;
import com.yonsz.z1.net.NetWorkUrl;
import com.yonsz.z1.net.NetWorkUtil;
import com.yonsz.z1.utils.AppGenerUtil;
import com.yonsz.z1.utils.DensityUtil;
import com.yonsz.z1.utils.SharedpreferencesUtil;
import com.yonsz.z1.version4.MainActivity4;
import com.yonsz.z1.view.PrivacyPopupWindow;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import static com.yonsz.z1.UniKongApp.getActivity;
import static com.yonsz.z1.difference.DifferConstans.APPID_S;
import static com.yonsz.z1.difference.DifferConstans.APPSECRET_S;
import static com.yonsz.z1.net.Constans.CLOSE_THIS_ACTIVITY;
import static com.yonsz.z1.net.Constans.GET_TOKEN_FAIL;
import static com.yonsz.z1.net.Constans.GET_TOKEN_SUCCESS;
/**
* Created by Administrator on 2017/5/17.
*/
public class WelcomeActivity extends BaseActivity {
private final static int FLAG_TO_LOGIN = 1001;
private final static int FLAG_TO_GUIDER = 1002;
private final static int FLAG_TO_GESTURE = 1003;
private final static int FLAG_TO_MAIN = 1004;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome);
/*if (Build.VERSION.SDK_INT >= 28) {
getNotchParams();
}*/
}
@Override
public boolean enableSliding() {
return false;
}
@Override
public void onResume() {
super.onResume();
if (DensityUtil.isNetworkConnected(this) && DensityUtil.isNetConnected(this)) {
getToken();
} else {
initNext();
}
}
private void getToken() {
NetWorkUtil util = NetWorkUtil.instans();
HashMap<String, String> map = new HashMap<>();
map.put("appId", APPID_S);
map.put("appSecret", APPSECRET_S);
util.requestPostByAsynewApi(NetWorkUrl.GET_TOKEN, map, new NetWorkUtil.ReqCallBack() {
@Override
public void onSuccess(String respone) {
Log.i("getToken", "onSuccess: " + respone);
TokenEntity entity = JSON.parseObject(respone, TokenEntity.class);
if (1 == entity.getFlag()) {
Message msg = mHandler.obtainMessage(GET_TOKEN_SUCCESS);
msg.obj = entity;
mHandler.sendMessage(msg);
} else {
Message msg = mHandler.obtainMessage(GET_TOKEN_FAIL);
msg.obj = entity.getMsg();
mHandler.sendMessage(msg);
}
}
@Override
public void onFail(String message) {
Log.i("getToken", "onSuccess: " + message);
Message msg = mHandler.obtainMessage(GET_TOKEN_FAIL);
msg.obj = message;
mHandler.sendMessage(msg);
}
});
}
private void initNext() {
/**
* 如果USERID不是空进入手势页面如果已经过了引导页如果SEESSIONID不是空进入主页面如果
* 是空重新登录都不是就进入引导页
*/
if (null != SharedpreferencesUtil.get(Constans.PORT, null) && SharedpreferencesUtil.get(Constans.PORT, null).contains(":")) {
} else {
SharedpreferencesUtil.save(Constans.PORT, "wss.yonsz.net:25533");
}
/*if (!TextUtils.isEmpty(SharedpreferencesUtil.get(Constans.SEESSIONID, ""))) {
mHandler.sendEmptyMessageDelayed(FLAG_TO_MAIN, 1000);
} else {
mHandler.sendEmptyMessageDelayed(FLAG_TO_LOGIN, 1000);
}
boolean isSetting = TextUtils.isEmpty(SharedpreferencesUtil.
get(SharedpreferencesUtil.get(Constans.USERID, ""), ""));*/
SoulPermission.getInstance().checkAndRequestPermissions(
Permissions.build(Manifest.permission.ACCESS_FINE_LOCATION),
//if you want do noting or no need all the callbacks you may use SimplePermissionsAdapter instead
new CheckRequestPermissionsListener() {
@Override
public void onAllPermissionOk(Permission[] allPermissions) {
setPermission();
}
@Override
public void onPermissionDenied(Permission[] refusedPermissions) {
setPermission();
}
});
}
private void setPermission() {
SoulPermission.getInstance().checkAndRequestPermissions(
Permissions.build(Manifest.permission.WRITE_EXTERNAL_STORAGE),
//if you want do noting or no need all the callbacks you may use SimplePermissionsAdapter instead
new CheckRequestPermissionsListener() {
@Override
public void onAllPermissionOk(Permission[] allPermissions) {
if (SharedpreferencesUtil.get(Constans.ISOVER)) {
gotoNext();
} else {
showPrivacy();
}
}
@Override
public void onPermissionDenied(Permission[] refusedPermissions) {
if (SharedpreferencesUtil.get(Constans.ISOVER)) {
gotoNext();
} else {
showPrivacy();
}
}
});
}
private void gotoNext() {
if (!TextUtils.isEmpty(SharedpreferencesUtil.get(Constans.SEESSIONID, ""))) {
if (!TextUtils.isEmpty(SharedpreferencesUtil.get(Constans.ADIMAGEURL, ""))) {
mHandler.sendEmptyMessageDelayed(FLAG_TO_GESTURE, 1000);
} else {
mHandler.sendEmptyMessageDelayed(FLAG_TO_MAIN, 1000);
}
} else {
if (!TextUtils.isEmpty(SharedpreferencesUtil.get(Constans.ADIMAGEURL, ""))) {
mHandler.sendEmptyMessageDelayed(FLAG_TO_GESTURE, 1000);
} else {
mHandler.sendEmptyMessageDelayed(FLAG_TO_LOGIN, 1000);
}
}
}
private void showPrivacy() {
View rootview = LayoutInflater.from(getActivity()).inflate(R.layout.activity_child_device_a2, null);
PrivacyPopupWindow popupWindow = new PrivacyPopupWindow(getActivity(), new PrivacyPopupWindow.OnCompleteListener() {
@Override
public void onComplete() {
SharedpreferencesUtil.save(Constans.ISOVER, true);
gotoNext();
}
@Override
public void onFinish() {
finish();
}
@Override
public void onPrivacy() {
Intent intent = new Intent(getActivity(), WebViewActivity.class);
intent.putExtra("platform", "register");
startActivity(intent);
}
});
popupWindow.showAtLocation(rootview, Gravity.BOTTOM, 0, 0);
}
@Override
public void callBackUiThread(Message msg) {
switch (msg.what) {
case FLAG_TO_LOGIN:
startActivity(new Intent(this, LoginActivity.class));
finish();
break;
case FLAG_TO_GUIDER:
startActivity(new Intent(this, GuiderActivity.class));
overridePendingTransition(R.anim.activity_exit_in, R.anim.activity_exit_out);
finish();
break;
case FLAG_TO_GESTURE:
startActivity(new Intent(this, AdinfoActivity.class));
finish();
break;
case FLAG_TO_MAIN:
startActivity(new Intent(this, MainActivity4.class));
SharedpreferencesUtil.save("isShowMobilePlay", "0");
finish();
break;
case GET_TOKEN_SUCCESS:
TokenEntity entity = (TokenEntity) msg.obj;
if (SharedpreferencesUtil.get(Constans.TOKENID, "").equals(entity.getData().getToken().toString().trim())) {
} else {
SharedpreferencesUtil.save(Constans.SEESSIONID, "");
}
SharedpreferencesUtil.save(Constans.TOKENID, entity.getData().getToken().toString().trim());
// SharedpreferencesUtil.save(Constans.ADIMAGEURL, entity.getData().getStartUpImgUrl());
String androidVersions = entity.getData().getAndroidVersions().toString();
if (null != androidVersions) {
String packageVersion = AppGenerUtil.getPackageVersion(this);
List<String> result = Arrays.asList(androidVersions.split(","));
initNext();
/*if (result.contains(packageVersion)) {
initNext();
} else {
// initNext();
UpdateAppUtils.from(this)
.apkPath(versionUrl)
.downloadBy(DOWNLOAD_BY_BROWSER)
.isForce(true)
.update(true);
}*/
} else {
initNext();
}
/*if (null != SharedpreferencesUtil.get(Constans.TOKENID, "")) {
if (entity.getObj().toString().trim().equals(SharedpreferencesUtil.get(Constans.TOKENID, ""))) {
initNext();
} else {
ToastUtil.show(this, "token已过期");
mHandler.sendEmptyMessageDelayed(CLOSE_THIS_ACTIVITY, 1000);
}
} else {
SharedpreferencesUtil.save(Constans.TOKENID, entity.getObj().toString().trim());
initNext();
}*/
break;
case CLOSE_THIS_ACTIVITY:
finish();
break;
case GET_TOKEN_FAIL:
initNext();
break;
}
}
@TargetApi(28)
public void getNotchParams() {
final View decorView = getWindow().getDecorView();
decorView.post(new Runnable() {
@Override
public void run() {
WindowInsets rootWindowInsets = decorView.getRootWindowInsets();
if (rootWindowInsets == null) {
Log.e("TAG", "rootWindowInsets为空了");
return;
}
DisplayCutout displayCutout = rootWindowInsets.getDisplayCutout();
Log.e("TAG", "安全区域距离屏幕左边的距离 SafeInsetLeft:" + displayCutout.getSafeInsetLeft());
Log.e("TAG", "安全区域距离屏幕右部的距离 SafeInsetRight:" + displayCutout.getSafeInsetRight());
Log.e("TAG", "安全区域距离屏幕顶部的距离 SafeInsetTop:" + displayCutout.getSafeInsetTop());
Log.e("TAG", "安全区域距离屏幕底部的距离 SafeInsetBottom:" + displayCutout.getSafeInsetBottom());
List<Rect> rects = displayCutout.getBoundingRects();
if (rects == null || rects.size() == 0) {
Log.e("TAG", "不是刘海屏");
} else {
if (displayCutout.getSafeInsetTop() > 140) {
SharedpreferencesUtil.save(Constans.ISALLSCREEN, "true");
} else {
SharedpreferencesUtil.save(Constans.ISALLSCREEN, "false");
}
Log.e("TAG", "刘海屏数量:" + rects.size());
for (Rect rect : rects) {
Log.e("TAG", "刘海屏区域:" + rect);
}
}
}
});
}
}

View File

@ -0,0 +1,46 @@
package com.yonsz.z1.login.register;
import android.os.Bundle;
import android.os.Message;
import com.yonsz.z1.R;
import com.yonsz.z1.activity.BaseActivity;
import com.yonsz.z1.listener.OnTitleItemClickListener;
import com.yonsz.z1.view.TitleView;
/**
* Created by Administrator on 2017/6/15.
*/
public class CopyRightActivity extends BaseActivity {
private TitleView mTitleView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_copyright);
mTitleView = (TitleView) findViewById(R.id.title_text);
mTitleView.setHead("用户协议");
mTitleView.setTitleListener(new OnTitleItemClickListener() {
@Override
public void onBack() {
finish();
}
@Override
public void onFunction() {
}
@Override
public void onFunctionText() {
}
});
}
@Override
public void callBackUiThread(Message msg) {
}
}

View File

@ -0,0 +1,353 @@
package com.yonsz.z1.mine.aboutversion;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.os.Message;
import android.support.v4.app.ActivityCompat;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.alibaba.fastjson.JSON;
import com.qw.soul.permission.SoulPermission;
import com.qw.soul.permission.bean.Permission;
import com.qw.soul.permission.bean.Permissions;
import com.qw.soul.permission.callbcak.CheckRequestPermissionsListener;
import com.tencent.mm.opensdk.modelbase.BaseReq;
import com.tencent.mm.opensdk.modelbase.BaseResp;
import com.tencent.mm.opensdk.modelmsg.SendMessageToWX;
import com.tencent.mm.opensdk.modelmsg.WXImageObject;
import com.tencent.mm.opensdk.modelmsg.WXMediaMessage;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
import com.yonsz.z1.R;
import com.yonsz.z1.activity.BaseActivity;
import com.yonsz.z1.database.entity.VersionEntity;
import com.yonsz.z1.listener.NoDoubleClickListener;
import com.yonsz.z1.listener.OnTitleItemClickListener;
import com.yonsz.z1.mine.aboutversion.customview.ConfirmDialog;
import com.yonsz.z1.mine.aboutversion.customview.DeviceBottomDialog;
import com.yonsz.z1.mine.aboutversion.feature.Callback;
import com.yonsz.z1.mine.aboutversion.util.ScoreUtils;
import com.yonsz.z1.mine.aboutversion.util.UpdateAppUtils;
import com.yonsz.z1.net.Constans;
import com.yonsz.z1.net.NetWorkUrl;
import com.yonsz.z1.net.NetWorkUtil;
import com.yonsz.z1.utils.AppGenerUtil;
import com.yonsz.z1.utils.SharedpreferencesUtil;
import com.yonsz.z1.utils.ToastUtil;
import com.yonsz.z1.view.TitleView;
import java.util.ArrayList;
import java.util.HashMap;
import static com.tencent.mm.opensdk.modelmsg.SendMessageToWX.Req.WXSceneSession;
import static com.tencent.mm.opensdk.modelmsg.SendMessageToWX.Req.WXSceneTimeline;
import static com.yonsz.z1.UniKongApp.getActivity;
import static com.yonsz.z1.difference.DifferConstans.APPID_S;
import static com.yonsz.z1.difference.DifferConstans.APPID_S_VOICE;
import static com.yonsz.z1.difference.DifferConstans.WX_APP_ID;
import static com.yonsz.z1.difference.DifferConstans.versionUrl;
import static com.yonsz.z1.fragment.person.PersonFragment.bmpToByteArray;
import static com.yonsz.z1.mine.aboutversion.util.UpdateAppUtils.DOWNLOAD_BY_APP;
import static com.yonsz.z1.net.Constans.GET_USER_SESSION_NULL;
import static com.yonsz.z1.net.Constans.UPDATE_STATE_FAIL;
import static com.yonsz.z1.net.Constans.UPDATE_STATE_SUCCESS;
import static com.yonsz.z1.version4.MainActivity4.versionId;
/**
* Created by Administrator on 2017/5/26.
*/
public class AboutVersionActivity extends BaseActivity implements IWXAPIEventHandler {
private TextView tv_version;
private TextView tv_public_goto;
private ImageView iv_code;
private IWXAPI iwxapi;
private RelativeLayout scoreRl, versionDecalreRl, versionUpdateRl;
private TextView serviceHotlineTv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about_version);
iwxapi = WXAPIFactory.createWXAPI(this, WX_APP_ID, false);
iwxapi.handleIntent(getIntent(), this);
iwxapi.registerApp(WX_APP_ID);
TitleView titleView = (TitleView) findViewById(R.id.title_about_version);
titleView.setHead(R.string.about_version);
titleView.setTitleListener(new OnTitleItemClickListener() {
@Override
public void onBack() {
finish();
}
@Override
public void onFunction() {
}
@Override
public void onFunctionText() {
}
});
scoreRl = (RelativeLayout) findViewById(R.id.rl_to_score);
serviceHotlineTv = (TextView) findViewById(R.id.tv_customer_service_hotline);
versionDecalreRl = (RelativeLayout) findViewById(R.id.rl_version_declare);
versionUpdateRl = (RelativeLayout) findViewById(R.id.rl_version_update);
iv_code = (ImageView) findViewById(R.id.iv_code);
tv_public_goto = (TextView) findViewById(R.id.tv_public_goto);
tv_version = (TextView) findViewById(R.id.tv_version);
tv_version.setText("V" + AppGenerUtil.getPackageVersion(this));
checkUpdate(1);
iv_code.setOnClickListener(new NoDoubleClickListener() {
@Override
protected void onNoDoubleClick(View v) {
// showDioalog();
}
});
tv_public_goto.setOnClickListener(new NoDoubleClickListener() {
@Override
public void onNoDoubleClick(View v) {
super.onClick(v);
// showDioalog();
}
});
scoreRl.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ArrayList<String> strings = ScoreUtils.SelectedInstalledAPPs(getApplicationContext(), ScoreUtils.InstalledAPPs(getApplicationContext()));
ScoreUtils.launchAppDetail(AboutVersionActivity.this, "com.yonsz.z1", strings.get(0));
}
});
versionDecalreRl.setOnClickListener(new NoDoubleClickListener() {
@Override
protected void onNoDoubleClick(View v) {
Intent intent = new Intent(AboutVersionActivity.this, VersionDecalreActivity.class);
intent.putExtra("activity", "AboutVersionActivity");
startActivity(intent);
}
});
versionUpdateRl.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
updataUserState();
}
});
serviceHotlineTv.setOnClickListener(new NoDoubleClickListener() {
@Override
protected void onNoDoubleClick(View v) {
callHotline();
}
});
}
private void callHotline() {
ConfirmDialog dialog = new ConfirmDialog(getActivity(), new Callback() {
@Override
public void callback(int position) {
switch (position) {
case 0:
break;
case 1:
callPhone("4001365663");
break;
}
}
});
dialog.setContent("400 136 5663");
dialog.setCancleBtn(R.string.cancel);
dialog.setSureBtn(R.string.call);
dialog.setCancelable(false);
dialog.show();
}
public void callPhone(String phoneNum) {
SoulPermission.getInstance().checkAndRequestPermissions(
Permissions.build(Manifest.permission.CALL_PHONE,
Manifest.permission.READ_PHONE_STATE,
Manifest.permission.WRITE_EXTERNAL_STORAGE),
//if you want do noting or no need all the callbacks you may use SimplePermissionsAdapter instead
new CheckRequestPermissionsListener() {
@Override
public void onAllPermissionOk(Permission[] allPermissions) {
Intent intent = new Intent(Intent.ACTION_CALL);
Uri data = Uri.parse("tel:" + phoneNum);
intent.setData(data);
if (ActivityCompat.checkSelfPermission(AboutVersionActivity.this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
return;
}
startActivity(intent);
}
@Override
public void onPermissionDenied(Permission[] refusedPermissions) {
ToastUtil.show(AboutVersionActivity.this, "请开启权限");
}
});
}
private void checkUpdate(int tag) {
UpdateAppUtils.from(this)
.checkBy(UpdateAppUtils.CHECK_BY_VERSION_NAME)
.serverVersionName(versionId)
.serverVersionCode(5)
.apkPath(versionUrl)
.downloadBy(DOWNLOAD_BY_APP)
.isForce(false)
.update(tag);
}
private void showDioalog() {
if (!iwxapi.isWXAppInstalled()) {
Toast.makeText(this, getString(R.string.not_installed_Wechat), Toast.LENGTH_SHORT).show();
return;
}
//初始化一个WXImageObject对象
Bitmap thumb = BitmapFactory.decodeResource(getResources(), R.drawable.pic_public_code);
WXImageObject imageObject = new WXImageObject(thumb);
WXMediaMessage msg = new WXMediaMessage(); //这个对象是用来包裹发送信息的对象
msg.mediaObject = imageObject;
//设置缩略图
Bitmap thumbBitmap = Bitmap.createScaledBitmap(thumb, 60, 60, true);
msg.thumbData = bmpToByteArray(thumbBitmap, true);
final SendMessageToWX.Req req = new SendMessageToWX.Req(); //创建一个请求对象
req.message = msg; //把msg放入请求对象中
req.transaction = buildTransaction("Req");
/*WXWebpageObject webpageObject = new WXWebpageObject();
webpageObject.webpageUrl = "http://a.app.qq.com/o/simple.jsp?pkgname=com.yonsz.z1";
WXMediaMessage msg = new WXMediaMessage(webpageObject);
msg.title = "Unikong";
msg.description = "欢迎下载『语音遥控器APP』";
Bitmap thumb = BitmapFactory.decodeResource(getResources(), R.mipmap.app_lan);
msg.thumbData = bmpToByteArray(thumb, true);
final SendMessageToWX.Req req = new SendMessageToWX.Req();
req.transaction = buildTransaction("Req");
req.message = msg;*/
//分享到微信好友或者朋友圈
// startActivity(new Intent(getActivity(), WXEntryActivity.class));
DeviceBottomDialog dialog2 = new DeviceBottomDialog(this, new Callback() {
@Override
public void callback(int position1) {
switch (position1) {
case 0:
//取消
break;
case 1:
//微信朋友圈
req.scene = WXSceneTimeline;
iwxapi.sendReq(req);
break;
case 2:
//重新命名
break;
case 3:
//微信好友
req.scene = WXSceneSession;
iwxapi.sendReq(req);
break;
case 4:
break;
}
}
});
dialog2.setContent();
dialog2.setTop(getString(R.string.WeChat_friends));
dialog2.setBottom(getString(R.string.WeChat_friends_circle));
dialog2.setLearn();
dialog2.setOtherNameGone();
dialog2.setCancelable(false);
Window dialogWindow = dialog2.getWindow();
dialogWindow.setGravity(Gravity.BOTTOM);
//获得窗体的属性
WindowManager.LayoutParams lp = dialogWindow.getAttributes();
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
// 将属性设置给窗体
dialogWindow.setAttributes(lp);
dialog2.show();
}
private String buildTransaction(final String type) {
return (type == null) ? String.valueOf(System.currentTimeMillis()) : type + System.currentTimeMillis();
}
@Override
public void callBackUiThread(Message msg) {
switch (msg.what) {
case UPDATE_STATE_SUCCESS:
VersionEntity.ObjEntity versionEntity = (VersionEntity.ObjEntity) msg.obj;
versionId = versionEntity.getVersionInfo().getVersionId().substring(2, 7);
versionUrl = versionEntity.getVersionInfo().getServiceUrl();
checkUpdate(2);
break;
}
}
@Override
public void onReq(BaseReq baseReq) {
}
@Override
public void onResp(BaseResp baseResp) {
}
//上传用户经纬度信息
private void updataUserState() {
NetWorkUtil util = NetWorkUtil.instans();
HashMap<String, String> map = new HashMap<>();
map.put("userId", SharedpreferencesUtil.get(Constans.USERPHONE, ""));
map.put("appId", APPID_S);
map.put("appBrandId", APPID_S_VOICE);
util.requestPostByAsynewApi(NetWorkUrl.UPDATE_USERINFO_STATE, map, new NetWorkUtil.ReqCallBack() {
@Override
public void onSuccess(String respone) {
Log.i("updataUserState", "onSuccess: " + respone);
if (respone.length() < 100) {
return;
}
VersionEntity entity = JSON.parseObject(respone, VersionEntity.class);
if (-401 == entity.getFlag()) {
Message msg = mHandler.obtainMessage(GET_USER_SESSION_NULL);
msg.obj = entity;
mHandler.sendMessage(msg);
} else if (1 == entity.getFlag()) {
Message msg = mHandler.obtainMessage(UPDATE_STATE_SUCCESS);
msg.obj = entity.getObj();
mHandler.sendMessage(msg);
} else {
Message msg = mHandler.obtainMessage(UPDATE_STATE_FAIL);
msg.obj = entity.getMsg();
mHandler.sendMessage(msg);
}
}
@Override
public void onFail(String message) {
Message msg = mHandler.obtainMessage(UPDATE_STATE_FAIL);
msg.obj = message;
mHandler.sendMessage(msg);
}
});
}
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:duration="300" android:fromXDelta="-100.0%p" android:toXDelta="0.0" />
</set>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:duration="300" android:fromXDelta="0.0" android:toXDelta="-100.0%p" />
</set>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:duration="300" android:fromXDelta="100.0%p" android:toXDelta="0.0" />
</set>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:duration="300" android:fromXDelta="0.0" android:toXDelta="100.0%p" />
</set>

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 554 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 471 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 833 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 723 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 908 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 955 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Some files were not shown because too many files have changed in this diff Show More