protected Integer doInBackground(String... params) { if (!Config.LOCAL_DEBUG) { try { DeviceLoadModel.getInstance().getDeviceInfo(); } catch (Exception e) { } } else { Message msg = new Message(); msg.what = Config.DEVICE_LOAD; msg.obj = 1; mHandler.sendMessage(msg); } return 0; }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); this.setContentView(R.layout.login); mEditText = (EditText) findViewById(R.id.phone_editor); View login = findViewById(R.id.do_login); login.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { String phone = mEditText.getEditableText().toString(); if (phone.length() != 11) { Toast.makeText( LoginActivity.this, getString(R.string.tips_phone_number), Toast.LENGTH_SHORT) .show(); return; } if (!TextUtils.isEmpty(mEditText.getEditableText().toString())) { SettingManager.getInstance().setLoginPhone(phone); if (mDialog != null) { mDialog.show(); } mLoginTask = new LoginTask(); mLoginTask.execute(""); } else { Toast.makeText( LoginActivity.this, LoginActivity.this.getString(R.string.empty_phone_bumber), Toast.LENGTH_SHORT) .show(); } } }); initProgressDialog(); DeviceLoadModel.getInstance().getDeviceLoadObserver().addObserver(mHandler); }
@Override public void onDestroy() { super.onDestroy(); DeviceLoadModel.getInstance().getDeviceLoadObserver().removeObserver(mHandler); }