@Override protected void onResume() { if (action.equals("new")) { if (StringUtil.isEmpty(toText.getText().toString())) { toText.requestFocus(); } else { titleText.requestFocus(); } } else { bodyText.requestFocus(); } if (uploadTask != null) { FileUploadTask temp = uploadTask; uploadTask = null; if (ActivityUtil.isGreaterThan_2_3_3()) { RunParallel(temp); } else { temp.execute(); } } if (PhoneConfiguration.getInstance().fullscreen) { ActivityUtil.getInstance().setFullScreen(v); } super.onResume(); }
@Override protected void onCancelled(String result) { synchronized (commit_lock) { loading = false; } ActivityUtil.getInstance().dismiss(); super.onCancelled(); }
@Override protected void onPostExecute(String result) { String success_results[] = {"发送完毕 ...", " @提醒每24小时不能超过50个", "操作成功"}; if (keepActivity == false) { boolean success = false; for (int i = 0; i < success_results.length; ++i) { if (result.contains(success_results[i])) { success = true; break; } } if (!success) keepActivity = true; } if (toast != null) { toast.setText(result); toast.setDuration(Toast.LENGTH_SHORT); toast.show(); } else { toast = Toast.makeText(MessagePostActivity.this, result, Toast.LENGTH_SHORT); toast.show(); } ActivityUtil.getInstance().dismiss(); if (!keepActivity) { if (!action.equals("new")) { MessagePostActivity.this.setResult(123); } else { MessagePostActivity.this.setResult(321); } MessagePostActivity.this.finish(); } synchronized (commit_lock) { loading = false; } super.onPostExecute(result); }
/* * (non-Javadoc) * * @see android.app.Activity#onCreate(android.os.Bundle) */ @Override protected void onCreate(Bundle savedInstanceState) { int orentation = ThemeManager.getInstance().screenOrentation; if (orentation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE || orentation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) { setRequestedOrientation(orentation); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); } super.onCreate(savedInstanceState); v = this.getLayoutInflater().inflate(R.layout.messagereply, null); v.setBackgroundColor(getResources().getColor(ThemeManager.getInstance().getBackgroundColor())); this.setContentView(v); if (PhoneConfiguration.getInstance().uploadLocation && PhoneConfiguration.getInstance().location == null) { ActivityUtil.reflushLocation(this); } Intent intent = this.getIntent(); prefix = intent.getStringExtra("prefix"); // if(prefix!=null){ // prefix=prefix.replaceAll("\\n\\n", "\n"); // } tousername = intent.getStringExtra("to"); action = intent.getStringExtra("action"); mid = intent.getIntExtra("mid", 0); String title = intent.getStringExtra("title"); titleText = (EditText) findViewById(R.id.reply_titile_edittext); toText = (EditText) findViewById(R.id.reply_titile_edittext_to); bodyText = (EditText) findViewById(R.id.reply_body_edittext); if (action.equals("new")) { getSupportActionBar().setTitle(R.string.new_message); } else if (action.equals("reply")) { getSupportActionBar().setTitle(R.string.reply_message); } titleText.setSelected(true); act = new MessagePostAction(mid, "", ""); act.setAction_(action); this.act.set__ngaClientChecksum(FunctionUtil.getngaClientChecksum(this)); loading = false; if (!StringUtil.isEmpty(tousername)) { toText.setText(tousername); if (!StringUtil.isEmpty(title)) { titleText.setText(title); } } else { if (!StringUtil.isEmpty(title)) { titleText.setText(title); } } if (prefix != null) { if (prefix.startsWith("[quote][pid=") && prefix.endsWith("[/quote]\n")) { SpannableString spanString = new SpannableString(prefix); spanString.setSpan( new BackgroundColorSpan(-1513240), 0, prefix.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); spanString.setSpan( new StyleSpan(android.graphics.Typeface.BOLD), prefix.indexOf("[b]Post by"), prefix.indexOf("):[/b]") + 5, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); bodyText.append(spanString); } else { bodyText.append(prefix); } bodyText.setSelection(prefix.length()); } ThemeManager tm = ThemeManager.getInstance(); if (tm.getMode() == ThemeManager.MODE_NIGHT) { bodyText.setBackgroundResource(tm.getBackgroundColor()); toText.setBackgroundResource(tm.getBackgroundColor()); titleText.setBackgroundResource(tm.getBackgroundColor()); int textColor = this.getResources().getColor(tm.getForegroundColor()); bodyText.setTextColor(textColor); titleText.setTextColor(textColor); toText.setTextColor(textColor); } }
@Override protected void onPreExecute() { ActivityUtil.getInstance().noticeSaying(c); super.onPreExecute(); }