@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(); }
public static int showImageQuality() { if (isInWifi()) { return 0; } else { return PhoneConfiguration.getInstance().imageQuality; } }
@Override public boolean onCreateOptionsMenu(Menu menu) { if (PhoneConfiguration.getInstance().HandSide == 1) { // lefthand int flag = PhoneConfiguration.getInstance().getUiFlag(); if (flag >= 4) { // 大于等于4肯定有 getMenuInflater().inflate(R.menu.messagepost_menu_left, menu); } else { getMenuInflater().inflate(R.menu.messagepost_menu, menu); } } else { getMenuInflater().inflate(R.menu.messagepost_menu, menu); } final int flags = ThemeManager.ACTION_BAR_FLAG; /* * ActionBar.DISPLAY_SHOW_HOME;//2 flags |= * ActionBar.DISPLAY_USE_LOGO;//1 flags |= * ActionBar.DISPLAY_HOME_AS_UP;//4 */ ReflectionUtil.actionBar_setDisplayOption(this, flags); return true; }
@Override protected String doInBackground(String... params) { if (params.length < 2) return "parameter error"; String ret = "网络错误"; String url = params[0]; String body = params[1]; HttpPostClient c = new HttpPostClient(url); String cookie = PhoneConfiguration.getInstance().getCookie(); c.setCookie(cookie); try { InputStream input = null; HttpURLConnection conn = c.post_body(body); if (conn != null) { if (conn.getResponseCode() >= 500) { input = null; keepActivity = true; ret = "二哥在用服务器下毛片"; } else { if (conn.getResponseCode() >= 400) { input = conn.getErrorStream(); keepActivity = true; } else input = conn.getInputStream(); } } else keepActivity = true; if (input != null) { String html = IOUtils.toString(input, "gbk"); ret = getReplyResult(html); } else keepActivity = true; } catch (IOException e) { keepActivity = true; Log.e(LOG_TAG, Log.getStackTraceString(e)); } return ret; }
/* * (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); } }
private boolean isShowImage() { return PhoneConfiguration.getInstance().isDownImgNoWifi() || isInWifi(); }