private void dialogMsg() { RWSharedPreferences shellRW = new RWSharedPreferences(BuyActivity.this, "UserMessage"); messageflage = shellRW.getStringValue("tanchumessage"); messageidflag = shellRW.getStringValue("id"); if (!PublicConst.MESSAGE.equals("")) { try { obj = new JSONObject(PublicConst.MESSAGE); String id = obj.getString("id"); messagetitle = obj.getString("title"); messagedetail = obj.getString("message"); if (messageidflag == null) { shellRW.putStringValue("id", id); Message msg = new Message(); msg.what = 4; handler.sendMessage(msg); } else if (!messageidflag.equals(id)) { shellRW.putStringValue("id", id); Message msg = new Message(); msg.what = 4; handler.sendMessage(msg); } } catch (JSONException e) { } } }
/** * 当选中记住用户密码的按钮时 * * @param isChecked */ private void rem_password_num(boolean isChecked) { EditText password_edit = (EditText) findViewById(R.id.password_edit); String password_string = password_edit.getText().toString(); if (isChecked) { shellRW.putStringValue("remPwd_checkBox", "true"); shellRW.putStringValue("password", password_string); } else { shellRW.putStringValue("remPwd_checkBox", "false"); shellRW.putStringValue("password", ""); } }
private void auto_login(boolean isChecked) { EditText password_edit = (EditText) findViewById(R.id.password_edit); String password_string = password_edit.getText().toString(); if (isChecked) { shellRW.putStringValue("remPwd_checkBox", "true"); shellRW.putBooleanValue(ShellRWConstants.AUTO_LOGIN, true); isAutoLogin = "******"; shellRW.putStringValue("password", password_string); } else { isAutoLogin = "******"; shellRW.putBooleanValue(ShellRWConstants.AUTO_LOGIN, false); } }
/** * 是否下载开奖图片 * * @param image * @throws JSONException */ public void imageJson(JSONObject image) throws JSONException { String errorCode = image.getString("errorCode"); shellRW.putStringValue("errorCode", errorCode); if (errorCode.equals("true")) { String jsonId = image.getString("id"); String imageId = shellRW.getStringValue("imageId"); if (imageId.equals("") || imageId == null || !imageId.equals(jsonId)) { if (isWifi == true) { shellRW.putStringValue("imageId", jsonId); DownLoadImg down = new DownLoadImg(); down.downThread(image.getString("imageUrl")); } } } }
/** 登录联网操作 */ private void beginLogin() { // showDialog(DIALOG_PROGRESS); EditText password_edit = (EditText) findViewById(R.id.password_edit); Editable password = password_edit.getText(); final String password_string = String.valueOf(password); if (remPwd_checkBox.isChecked()) shellRW.putStringValue("password", password_string); // 判断手机号长度是否正确 EditText phone_name_Text = (EditText) findViewById(R.id.phoneNum_edit); Editable editText = phone_name_Text.getText(); // fqc edit 7/3/2010 判断密码长度 必须在6~16之间 EditText password_text = (EditText) findViewById(R.id.password_edit); int passwordLength = password_text.getText().toString().length(); if (editText.toString().equals("")) { Toast.makeText(this, "用户名不能为空!", Toast.LENGTH_LONG).show(); } else if (passwordLength < 6 || passwordLength > 16) { password_edit.startAnimation(shake); Toast.makeText(this, "密码必须为6~16位!", Toast.LENGTH_LONG).show(); } else { // // if(auto_login_checkBox.isChecked()){ // isAutoLogin = "******"; // }else{ // isAutoLogin = "******"; // } regToLogin(String.valueOf(phoneNum_edit.getText()), password_string, isAutoLogin); } }
/** 读取本地渠道号 */ public void getChannel() { String channel = shellRW.getStringValue("channel"); if (channel.equals("") || channel == null) { shellRW.putStringValue("channel", Constants.COOP_ID); } else { Constants.COOP_ID = channel; } }
@Override public void onClick(View v) { String lotnoString = v.getTag(R.id.caizhong_set_checkbox).toString(); if (CheckUtil.isWillSale(lotnoString, shellRW)) { PublicMethod.showMessage( mContext, PublicMethod.getMessageByLoto(mContext, shellRW, lotnoString)); } else if (CheckUtil.isTickedClosed(lotnoString, shellRW)) { PublicMethod.showMessage( mContext, PublicMethod.getMessageByLoto(mContext, shellRW, lotnoString)); } else { String checkOpenOrClosed = shellRW.getStringValue(lotnoString); if (checkOpenOrClosed.equals(Constants.CAIZHONG_OPEN)) { shellRW.putStringValue( v.getTag(R.id.caizhong_set_checkbox).toString(), Constants.CAIZHONG_CLOSE); v.setBackgroundResource(R.drawable.off); } else { shellRW.putStringValue( v.getTag(R.id.caizhong_set_checkbox).toString(), Constants.CAIZHONG_OPEN); v.setBackgroundResource(R.drawable.on); } } }
@Override public void handleMessage(Message msg) { // TODO Auto-generated method stub switch (msg.what) { case 1: // 提交绑定手机号成功 progressDialog.dismiss(); Toast.makeText(BindPhonenumActivity.this, (String) msg.obj, Toast.LENGTH_LONG).show(); initSubmitBindSecurtyCode(); break; case 2: // 提交验证码 progressDialog.dismiss(); Toast.makeText(BindPhonenumActivity.this, (String) msg.obj, Toast.LENGTH_LONG).show(); shellRW.putStringValue("mobileid", bindphonenum); finish(); break; case 3: // 提交绑定手机号失败 progressDialog.dismiss(); Toast.makeText(BindPhonenumActivity.this, (String) msg.obj, Toast.LENGTH_LONG).show(); finish(); break; } }
/** 清空上次的登录信息 */ public void clearLastLoginInfo() { shellRW.putStringValue("sessionid", ""); shellRW.putStringValue("userno", ""); }
/** 开机联网,保存必要信息,判断软件升级 */ public void initSoftwareStartInfomationFromServer() { Constants.isProxyConnect = initProxySetting(); // 初始化代理设置 // 判断是否要上传统计信息到服务器 SharedPreferences sharedPreferences = getSharedPreferences(Constants.APPNAME, MODE_PRIVATE); int gameSumCount = sharedPreferences.getInt(Constants.GAME_CLICK_SUM, 0); // 游戏名称+n , 默认值为0 boolean isUpdateStatInfo = false; // 是否上传了统计信息 JSONObject statJsonObject = null; if (gameSumCount >= Constants.STAT_INFO_CACHE_NUM) { // 用户点的游戏够多了,值得上传一次统计信息 statJsonObject = new JSONObject(); try { for (int i = 0; i < 12; i++) { statJsonObject.put( String.valueOf(i), sharedPreferences.getInt(Constants.GAME_CLASS + i, 0)); // 游戏名称+n , } isUpdateStatInfo = true; } catch (JSONException e) { statJsonObject = null; } } softwareUpdateInfo = SoftwareUpdateInterface.getInstance() .softwareupdate(statJsonObject, shellRW.getStringValue("randomNumber")); try { obj = new JSONObject(softwareUpdateInfo); JSONObject autoLogin = obj.getJSONObject("autoLogin"); if (autoLogin.getString("isAutoLogin").equals("true")) { Constants.isInitTop = true; shellRW.putBooleanValue(ShellRWConstants.AUTO_LOGIN, true); shellRW.putStringValue(ShellRWConstants.USERNO, autoLogin.getString("userno")); shellRW.putStringValue(ShellRWConstants.CERTID, autoLogin.getString("certid")); shellRW.putStringValue(ShellRWConstants.MOBILEID, autoLogin.getString("mobileid")); shellRW.putStringValue(ShellRWConstants.NAME, autoLogin.getString("name")); shellRW.putStringValue(ShellRWConstants.USERNAME, autoLogin.getString("userName")); shellRW.putStringValue(ShellRWConstants.SESSIONID, autoLogin.getString("sessionid")); } else { shellRW.putBooleanValue(ShellRWConstants.AUTO_LOGIN, false); Constants.isInitTop = false; } PublicConst.MESSAGE = obj.getString("broadcastmessage"); if (isUpdateStatInfo == true) { // 上传了统计信息,在这里将统计信息清空 SharedPreferences.Editor editor = getSharedPreferences(Constants.APPNAME, MODE_PRIVATE).edit(); for (int i = 0; i < 12; i++) { editor.putInt(Constants.GAME_CLASS + i, 0); } editor.putInt(Constants.GAME_CLICK_SUM, 0); editor.commit(); } softwareErrorCode = obj.getString("errorCode"); if (softwareErrorCode.equals("true")) { // 需要升级,设置升级相关字段 softwareurl = obj.getString("updateurl"); softwaretitle = obj.getString("title"); softwaremessageStr = obj.getString("message"); } Constants.NEWS = obj.getString("news"); Constants.currentLotnoInfo = obj.getJSONObject("currentBatchCode"); // 获取网络的期号信息 imageJson(obj.getJSONObject("image")); // 是否下载开奖图片 } catch (JSONException e) { e.printStackTrace(); } finally { // ClockThread clock = new ClockThread();// 创建合买大厅倒计时线程 // clock.startThread(); } flag = false; }
@Override public void afterTextChanged(Editable s) { String phoneNumber = phoneNum_edit.getText().toString(); shellRW.putStringValue("phoneNumber", phoneNumber); }
@Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.tableRow_sharetosina: oauthOrShare(); break; case R.id.tableRow_sharetotecent: break; case R.id.tableRow_sharetorenren: StatusDemo st = new StatusDemo(); st.publishStatusOneClick(MoreActivity.this, renren); break; case R.id.tableRow_sharetomsg: shareToMsg(); break; case R.id.tableRow_kaijiangdingyue: orderPrizeDialog.orderPrizeDialog().show(); break; case R.id.tableRow_weibobangding: showsharesettingView(); break; case R.id.auto_login_set_checkbox: boolean is_auto_login = shellRW.getBooleanValue("auto_login"); if (isLogined.equals("") || isLogined.equals("null")) { Toast.makeText(MoreActivity.this, "请先登录!", Toast.LENGTH_SHORT).show(); } else { if (is_auto_login) { cancleAutoLogin(); } else { Toast.makeText(MoreActivity.this, "自动登录只能在登录时设置!", Toast.LENGTH_SHORT).show(); } } break; case R.id.isSharetoSina: isSinaTiaoZhuan = false; token = shellRW.getStringValue("token"); if (token.equals("")) { oauth(); ; } else { shellRW.putStringValue("token", ""); is_sharetosinaweibo.setBackgroundResource(R.drawable.off); } break; case R.id.isSharetoRenren: AccessTokenManager manager = new AccessTokenManager(MoreActivity.this); renren = new Renren(MoreActivity.this); if (manager.getAccessToken() == null || manager.getAccessToken().equals("")) { StatusDemo st1 = new StatusDemo(); st1.publishStatusOneClick(MoreActivity.this, renren); } else { renren.logout(MoreActivity.this); is_sharetorenren.setBackgroundResource(R.drawable.off); } break; case R.id.caizhong_setting: // 彩种设置 Intent intent = new Intent(MoreActivity.this, CaizhongSettingActivity.class); startActivity(intent); break; } }