private void handleJsonList(ViewHolder holder, int position) { ThreadPageInfo entry = getEntry(position); // this.topicListInfo.getArticleEntryList().get(position); if (entry == null) { return; } Resources res = inflater.getContext().getResources(); ThemeManager theme = ThemeManager.getInstance(); boolean night = false; int nightLinkColor = res.getColor(R.color.night_link_color); if (theme.getMode() == ThemeManager.MODE_NIGHT) night = true; holder.author.setText(entry.getAuthor()); if (night) holder.author.setTextColor(nightLinkColor); String lastPoster = entry.getLastposter_org(); if (StringUtil.isEmpty(lastPoster)) lastPoster = entry.getLastposter(); holder.lastReply.setText(lastPoster); holder.num.setText("" + entry.getReplies()); if (night) { holder.lastReply.setTextColor(nightLinkColor); holder.num.setTextColor(nightLinkColor); } holder.title.setTextColor(res.getColor(theme.getForegroundColor())); float size = PhoneConfiguration.getInstance().getTextSize(); String titile = entry.getContent(); if (StringUtil.isEmpty(titile)) { titile = entry.getSubject(); holder.title.setText(StringUtil.unEscapeHtml(titile)); } else { holder.title.setText(StringUtil.removeBrTag(StringUtil.unEscapeHtml(titile))); } holder.title.setTextSize(size); final TextPaint tp = holder.title.getPaint(); tp.setFakeBoldText(false); if (!StringUtil.isEmpty(entry.getTitlefont())) { final String font = entry.getTitlefont(); if (font.equals("~1~~") || font.equals("~~~1")) { tp.setFakeBoldText(true); } else if (font.startsWith("green")) { holder.title.setTextColor(res.getColor(R.color.title_green)); } else if (font.startsWith("blue")) { holder.title.setTextColor(res.getColor(R.color.title_blue)); } else if (font.startsWith("red")) { holder.title.setTextColor(res.getColor(R.color.title_red)); } else if (font.startsWith("orange")) { holder.title.setTextColor(res.getColor(R.color.title_orange)); } } }
/* * (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); } }