@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 public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.item_refresh: load(); break; case R.id.save_image: final String path = getPath(); DownloadImageTask task = new DownloadImageTask(this); if (ActivityUtil.isGreaterThan_2_3_3()) { runOnExecutor(task, path); } else { task.execute(path); } break; case R.id.item_share: Intent intent = new Intent(Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_STREAM, Uri.parse(getPath())); intent.setType("image/jpeg"); String text = getResources().getString(R.string.share); startActivity(Intent.createChooser(intent, text)); break; default: /*Intent MyIntent = new Intent(Intent.ACTION_MAIN); MyIntent.setClass(this, ArticleListActivity.class); MyIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(MyIntent);*/ this.finish(); } return super.onOptionsItemSelected(item); }
// private final String IPHONE_UA = "Mozilla/5.0 (iPad; CPU OS 5_1 like Mac OS X) // AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B176 Safari/7534.48.3"; @Override protected void onCreate(Bundle arg0) { if (ActivityUtil.isGreaterThan_2_3_3()) requestWindowFeature(Window.FEATURE_PROGRESS); super.onCreate(arg0); View view = LayoutInflater.from(this).inflate(R.layout.webview_layout, null, false); this.setContentView(view); wv = (WebView) findViewById(R.id.webview); wv.getSettings() .setUserAgentString(getString(R.string.clientua) + ((MyApp) getApplication()).version); if (ActivityUtil.isGreaterThan_2_3_3()) wv.setWebChromeClient( new WebChromeClient() { public void onProgressChanged(WebView view, int progress) { ImageViewerActivity.this.setProgress(progress * 100); } }); }
private void loadPage() { if (needLoad) { Activity activity = getActivity(); JsonThreadLoadTask task = new JsonThreadLoadTask(activity, this); String url = HttpUtil.Server + "/read.php?" + "&page=" + page + "&lite=js&noprefix&v2"; if (tid != 0) url = url + "&tid=" + tid; if (pid != 0) { url = url + "&pid=" + pid; } if (authorid != 0) { url = url + "&authorid=" + authorid; } if (ActivityUtil.isGreaterThan_2_3_3()) RunParallen(task, url); else task.execute(url); } else { ActivityUtil.getInstance().dismiss(); } }