@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(getViewId()); if (PhoneConfiguration.getInstance().uploadLocation && PhoneConfiguration.getInstance().location == null) { ActivityUtil.reflushLocation(this); } /*PullToRefreshViewPager refreshPager = (PullToRefreshViewPager) findViewById(R.id.pull_refresh_viewpager); refreshPager.setMode(Mode.PULL_FROM_START); refreshPager.setOnRefreshListener(new OnRefreshListener<ViewPager>(){ @Override public void onRefresh(PullToRefreshBase<ViewPager> refreshView) { finish(); } }); mViewPager = refreshPager.getRefreshableView(); */ mViewPager = (ViewPager) findViewById(R.id.pager); if (ActivityUtil.isNotLessThan_4_0()) { setNfcCallBack(); } tid = 7; int pageFromUrl = 0; String url = this.getIntent().getDataString(); if (null != url) { tid = this.getUrlParameter(url, "tid"); pid = this.getUrlParameter(url, "pid"); authorid = this.getUrlParameter(url, "authorid"); pageFromUrl = this.getUrlParameter(url, "page"); } else { tid = this.getIntent().getIntExtra("tid", 0); pid = this.getIntent().getIntExtra("pid", 0); authorid = this.getIntent().getIntExtra("authorid", 0); } View v = findViewById(android.R.id.content); // .getChildAt(0); tabhost = (TabHost) findViewById(android.R.id.tabhost); if (tabhost != null) { tabhost.setup(); mTabsAdapter = new TabsAdapter(this, tabhost, mViewPager, ArticleListFragment.class); } else { mTabsAdapter = new ThreadFragmentAdapter( this, getSupportFragmentManager(), mViewPager, ArticleListFragment.class); } mTabsAdapter.setArgument("id", tid); mTabsAdapter.setArgument("pid", pid); mTabsAdapter.setArgument("authorid", authorid); ActivityUtil.getInstance().noticeSaying(this); if (savedInstanceState != null) { int pageCount = savedInstanceState.getInt("pageCount"); if (pageCount != 0) { mTabsAdapter.setCount(pageCount); mViewPager.setCurrentItem(savedInstanceState.getInt("tab")); } } else if (0 != getUrlParameter(url, "page")) { mTabsAdapter.setCount(pageFromUrl); mViewPager.setCurrentItem(pageFromUrl); } }
/* * (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); } }