@AfterViews void crateData() { this.titleButton.setText("用户登录"); this.titleButton.setVisibility(View.VISIBLE); this.rightButton.setVisibility(View.INVISIBLE); this.backButton.setVisibility(View.VISIBLE); this.backButton.setText("返回"); this.backButton.setTextColor(Color.WHITE); SpannableString span = new SpannableString(this.registerButton.getText()); ForegroundColorSpan fgcs = new ForegroundColorSpan(getResources().getColor(R.color.second_red)); span.setSpan(fgcs, span.length() - 2, span.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); this.registerButton.setText(span); mAutoCheck.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { auto = !auto; mAutoCheck.setChecked(auto); } }); mUser = User.lastLoginUser(mContext); if (mUser == null) { mUser = new User(); mUser.setUserName(""); mUser.setPassword(""); } else { } initUI(); initData(); }
@UiThread void requestLogin(final String eMail, final String pwd, Boolean auto) { mLoadingLayout.setVisibility(View.VISIBLE); mUser.setUserName(eMail); mUser.setPassword(pwd); mUser.setRemember(auto); mUser.login( new LoginListener() { @Override public void success(final User user) { new SerializerJSON( new SerializeListener() { @Override public String onSerialize() { ObjectMapper om = new ObjectMapper(); try { return om.writeValueAsString(user); } catch (JsonProcessingException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } @Override public void onComplete(String serializeResult) { if (serializeResult != null) { PreferenceManager.getDefaultSharedPreferences(mContext) .edit() .putString("user", serializeResult) .commit(); saveInfoToSp(serializeResult); } } }) .execute(); mLoadingLayout.setVisibility(View.GONE); com.yoopoon.home.ui.home.FramMainActivity_.intent(mContext).start(); finish(); } @Override public void faild(String msg) { mLoadingLayout.setVisibility(View.GONE); if (isManual) showError(msg); else { com.yoopoon.home.ui.home.FramMainActivity_.intent(mContext).start(); finish(); } } }); }