private void initView() { sub = (TextView) findViewById(R.id.detail_subject); body = (TextView) findViewById(R.id.detail_bodytext); body.setAutoLinkMask(0x0f); // body.setEms(); // body.setMovementMethod(ScrollingMovementMethod.getInstance()); body.setMovementMethod(LinkMovementMethod.getInstance()); times = (TextView) findViewById(R.id.detail_time); froms = (TextView) findViewById(R.id.detail_from); img_reply = (ImageView) findViewById(R.id.mail_img_reply); ed_reply = (EditText) findViewById(R.id.mail_ed_reply); Intent it = getIntent(); subject = it.getStringExtra("SUBJECT"); bodytext = it.getStringExtra("BODYTEXT"); time = it.getStringExtra("TIME"); from = it.getStringExtra("FROM"); sub.setText(subject); String str = cutString(bodytext); body.setText(Html.fromHtml(str, imgGetter, null)); times.setText(time); froms.setText(from); img_reply.setOnClickListener(this); }
@Override protected void onCreate(Bundle bundle) { super.onCreate(bundle); ManagePreferences.setPermissionManager(permMgr); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.popup); getWindow() .addFlags( WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); resizeLayout(); // Find the main textviews fromImage = (ImageView) findViewById(R.id.FromImageView); fromTV = (TextView) findViewById(R.id.FromTextView); messageTV = (TextView) findViewById(R.id.MessageTextView); messageTV.setAutoLinkMask(Linkify.WEB_URLS); messageReceivedTV = (TextView) findViewById(R.id.HeaderTextView); // Enable long-press context menu mainLL = (LinearLayout) findViewById(R.id.MainLinearLayout); registerForContextMenu(mainLL); // We can't hook the current donations status here because it may change // from msg to message. donateStatusBtn = (Button) findViewById(R.id.donate_status_button); // Populate display fields populateViews(getIntent()); }
private void initDisplay() { aspcaAlity_ = cat_.getASPCAality(); final int color = cat_.getASPCAalityColor(); final Bitmap bitmap = cat_.getSmPhoto(); imagePhoto_.setImageBitmap(bitmap); imagePhoto_.setBackgroundColor(color); final ImageView imageAdopted = (ImageView) findViewById(R.id.imageAdopted); final int status = cat_.getStatus(); int visibility = View.INVISIBLE; if (status == AppDBAdapter.STATUS_ADOPTED) { visibility = View.VISIBLE; } imageAdopted.setVisibility(visibility); final TextView textAgeSex = (TextView) findViewById(R.id.textAgeSex); final String age_sex = cat_.getAge() + " " + cat_.getSex(); textAgeSex.setText(age_sex); textAgeSex.setBackgroundColor(color); final int aspcaAlityResId = cat_.getASPCAalityResID(); textASPCAality_.setText(aspcaAlityResId); textASPCAality_.setBackgroundColor(color); final String name = cat_.getName(); textName_.setText(name); textName_.setTextColor(color); final TextView textBio = (TextView) findViewById(R.id.textBio); final int currentapiVersion = android.os.Build.VERSION.SDK_INT; if (currentapiVersion > android.os.Build.VERSION_CODES.DONUT) { textBio.setAutoLinkMask(Linkify.ALL); } final String bio_en = cat_.getBiography(); final String bioText = Util.concatNoTranslation(this, bio_en); textBio.setText(bioText); final TextView textPetID = (TextView) findViewById(R.id.textPetID); final String petID = getString(R.string.pet_id) + ": " + cat_.getPetID(); textPetID.setText(petID); textPetID.setBackgroundColor(color); }
protected void buildRow( final View view, Drawable icon, final String text, final String textPrefix, int textColor, boolean isWiki, boolean isText, boolean needLinks) { boolean light = app.getSettings().isLightContent(); if (!isFirstRow()) { buildRowDivider(view, false); } final String txt; if (!Algorithms.isEmpty(textPrefix)) { txt = textPrefix + ": " + text; } else { txt = text; } LinearLayout ll = new LinearLayout(view.getContext()); ll.setOrientation(LinearLayout.HORIZONTAL); LinearLayout.LayoutParams llParams = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); ll.setLayoutParams(llParams); ll.setBackgroundResource( resolveAttribute(view.getContext(), android.R.attr.selectableItemBackground)); ll.setOnLongClickListener( new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { copyToClipboard(txt, view.getContext()); return true; } }); // Icon LinearLayout llIcon = new LinearLayout(view.getContext()); llIcon.setOrientation(LinearLayout.HORIZONTAL); llIcon.setLayoutParams(new LinearLayout.LayoutParams(dpToPx(72f), dpToPx(48f))); llIcon.setGravity(Gravity.CENTER_VERTICAL); ll.addView(llIcon); ImageView iconView = new ImageView(view.getContext()); LinearLayout.LayoutParams llIconParams = new LinearLayout.LayoutParams(dpToPx(24f), dpToPx(24f)); llIconParams.setMargins(dpToPx(16f), dpToPx(12f), dpToPx(32f), dpToPx(12f)); llIconParams.gravity = Gravity.CENTER_VERTICAL; iconView.setLayoutParams(llIconParams); iconView.setScaleType(ImageView.ScaleType.CENTER_INSIDE); iconView.setImageDrawable(icon); llIcon.addView(iconView); // Text LinearLayout llText = new LinearLayout(view.getContext()); llText.setOrientation(LinearLayout.VERTICAL); ll.addView(llText); TextView textView = new TextView(view.getContext()); LinearLayout.LayoutParams llTextParams = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); llTextParams.setMargins(0, dpToPx(8f), 0, dpToPx(8f)); textView.setLayoutParams(llTextParams); textView.setTextSize(16); textView.setTextColor( app.getResources() .getColor(light ? R.color.ctx_menu_info_text_light : R.color.ctx_menu_info_text_dark)); if (needLinks) { textView.setAutoLinkMask(Linkify.ALL); textView.setLinksClickable(true); } textView.setEllipsize(TextUtils.TruncateAt.END); if (isWiki) { textView.setMinLines(1); textView.setMaxLines(15); } else if (isText) { textView.setMinLines(1); textView.setMaxLines(10); } textView.setText(txt); if (textColor > 0) { textView.setTextColor(view.getResources().getColor(textColor)); } LinearLayout.LayoutParams llTextViewParams = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); llTextViewParams.setMargins(0, 0, dpToPx(10f), 0); llTextViewParams.gravity = Gravity.CENTER_VERTICAL; llText.setLayoutParams(llTextViewParams); llText.addView(textView); ((LinearLayout) view).addView(ll); if (isWiki) { ll.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { POIMapLayer.showWikipediaDialog(view.getContext(), app, amenity); } }); } else if (isText && text.length() > 200) { ll.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { POIMapLayer.showDescriptionDialog(view.getContext(), app, text, textPrefix); } }); } rowBuilt(); }