List of usage examples for android.widget TextView setOnLongClickListener
public void setOnLongClickListener(@Nullable OnLongClickListener l)
From source file:com.github.kanata3249.ffxieq.android.EquipmentSelectorActivity.java
@Override protected void onStart() { super.onStart(); EquipmentListView elv;/*w ww .j av a 2s .c om*/ elv = (EquipmentListView) findViewById(R.id.ListView); if (elv != null) { elv.setFilterByID(mFilterID); elv.setOrderByName(mOrderByName); elv.setFilterByType(mFilterByType); elv.setParam(getDAO(), mPart, mRace, mJob, mLevel); elv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { Intent result = new Intent(); result.putExtra("From", "EquipmentSelector"); result.putExtra("Part", mPart); result.putExtra("Id", arg3); result.putExtra("AugId", -1); setResult(RESULT_OK, result); finish(); } }); elv.setOnItemLongClickListener(new OnItemLongClickListener() { public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { mLongClickingItemId = arg3; mLongClickingItemIsCurrent = false; EquipmentSelectorActivity.this.openContextMenu(arg0); return true; } }); registerForContextMenu(elv); } { Equipment cur = getDAO().instantiateEquipment(mCurrent, mAugID); if (cur == null) { cur = new Equipment(-1, getString(R.string.EquipmentNotSelected), "", "", "", "", 0, 0, false, false, ""); } if (cur != null) { TextView tv; View.OnLongClickListener listener = new View.OnLongClickListener() { public boolean onLongClick(View v) { mLongClickingItemId = mCurrent; mLongClickingItemIsCurrent = true; EquipmentSelectorActivity.this.openContextMenu(v); return true; } }; tv = (TextView) findViewById(R.id.Name); if (tv != null) { tv.setText(cur.getName()); tv.setOnLongClickListener(listener); registerForContextMenu(tv); } tv = (TextView) findViewById(R.id.Job); if (tv != null) { tv.setText(cur.getJob()); tv.setOnLongClickListener(listener); registerForContextMenu(tv); } tv = (TextView) findViewById(R.id.Description); if (tv != null) { tv.setText(cur.getDescription()); tv.setOnLongClickListener(listener); registerForContextMenu(tv); } tv = (TextView) findViewById(R.id.Augment); if (tv != null) { if (cur.getAugment().length() == 0) { tv.setHeight(0); } else { tv.setText(cur.getAugment()); } tv.setOnLongClickListener(listener); registerForContextMenu(tv); } tv = (TextView) findViewById(R.id.Level); if (tv != null) { int lvl = cur.getLevel(); if (lvl > 0) tv.setText(((Integer) lvl).toString()); else tv.setText(""); tv.setOnLongClickListener(listener); registerForContextMenu(tv); } tv = (TextView) findViewById(R.id.Race); if (tv != null) { tv.setText(cur.getRace()); tv.setOnLongClickListener(listener); registerForContextMenu(tv); } tv = (TextView) findViewById(R.id.Ex); if (tv != null) { if (cur.isEx()) tv.setVisibility(View.VISIBLE); else tv.setVisibility(View.INVISIBLE); tv.setOnLongClickListener(listener); registerForContextMenu(tv); } tv = (TextView) findViewById(R.id.Rare); if (tv != null) { if (cur.isRare()) tv.setVisibility(View.VISIBLE); else tv.setVisibility(View.INVISIBLE); tv.setOnLongClickListener(listener); registerForContextMenu(tv); } } } }
From source file:com.timothy.android.api.fragment.PageFragment.java
public void setAllComponent(List<HtmlCleanAPI.HtmlContent> hcList) { Log.i(LOG_TAG, "setAllComponent()..."); for (HtmlCleanAPI.HtmlContent hc : hcList) { String tag = hc.getTag(); String content = hc.getContent(); String contentRBlank = StringUtil.rmvEnter(StringUtil.trim(StringUtil.mergeBlank(content))); String contentRSpecial = StringUtil.rmvSpecial(contentRBlank); if (StringUtil.isEmpty(content) || StringUtil.isEmpty(contentRBlank) || StringUtil.isEmpty(contentRSpecial)) { continue; }/*w ww . j a v a 2s .c o m*/ Log.i(LOG_TAG, "tag:" + tag); Log.i(LOG_TAG, "content:" + content); if (tag.equalsIgnoreCase("P")) { final TextView tagPTV = new TextView(mContext); tagPTV.setBackgroundResource(R.drawable.tag_p_drawable); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.setMargins(2, 2, 2, 2); tagPTV.setLayoutParams(lp); tagPTV.setPadding(3, 3, 3, 3); tagPTV.setPaddingRelative(3, 3, 3, 3); tagPTV.setMovementMethod(ScrollingMovementMethod.getInstance()); tagPTV.setTextColor(Color.BLACK); tagPTV.setText(contentRSpecial); tagPTV.setTextSize(TEXT_SIZE); tagPTV.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { openDialog(tagPTV.getText().toString()); return false; } }); lineLayout.addView(tagPTV); } else if (tag.equalsIgnoreCase("pre")) { final TextView tagPre = new TextView(mContext); tagPre.setBackgroundColor(Color.parseColor("#D2EADE")); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.setMargins(2, 2, 2, 2); tagPre.setLayoutParams(lp); tagPre.setPadding(2, 2, 2, 2); tagPre.setPaddingRelative(2, 2, 2, 2); tagPre.setMovementMethod(ScrollingMovementMethod.getInstance()); tagPre.setTextColor(Color.BLACK); // String contentRSpecial = StringUtil.rmvSpecial(content); tagPre.setText(StringUtil.rmvSpecial(content)); tagPre.setTextSize(TEXT_SIZE); tagPre.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { openDialog(tagPre.getText().toString()); return false; } }); lineLayout.addView(tagPre); } else if (tag.equalsIgnoreCase("dt") || tag.equalsIgnoreCase("H1") || tag.equalsIgnoreCase("H2") || tag.equalsIgnoreCase("H3")) {//title TextView tagDtHTV = new TextView(mContext); tagDtHTV.setBackgroundColor(Color.DKGRAY); tagDtHTV.setTypeface(null, Typeface.BOLD); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.setMargins(2, 0, 2, 0); tagDtHTV.setLayoutParams(lp); tagDtHTV.setPadding(2, 2, 2, 2); tagDtHTV.setPaddingRelative(2, 2, 2, 2); tagDtHTV.setMovementMethod(ScrollingMovementMethod.getInstance()); tagDtHTV.setTextColor(Color.WHITE); tagDtHTV.setText(contentRSpecial); tagDtHTV.setTextSize(TEXT_SIZE); lineLayout.addView(tagDtHTV); } else if (tag.equalsIgnoreCase("dd")) { final TextView tagDD = new TextView(mContext); tagDD.setBackgroundResource(R.drawable.tag_p_drawable); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.setMargins(2, 2, 2, 2); tagDD.setLayoutParams(lp); tagDD.setPadding(3, 3, 3, 3); tagDD.setPaddingRelative(3, 3, 3, 3); tagDD.setMovementMethod(ScrollingMovementMethod.getInstance()); tagDD.setTextColor(Color.BLACK); tagDD.setText(contentRSpecial); tagDD.setTextSize(TEXT_SIZE); tagDD.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { openDialog(tagDD.getText().toString()); return false; } }); lineLayout.addView(tagDD); } else if (tag.equalsIgnoreCase("li")) { final TextView tagLigTV = new TextView(mContext); tagLigTV.setBackgroundResource(R.drawable.tag_p_drawable); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.setMargins(2, 2, 2, 2); tagLigTV.setLayoutParams(lp); tagLigTV.setPaddingRelative(2, 2, 2, 2); tagLigTV.setMovementMethod(ScrollingMovementMethod.getInstance()); tagLigTV.setTextColor(Color.BLACK); tagLigTV.setText(contentRSpecial); tagLigTV.setTextSize(TEXT_SIZE); tagLigTV.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { openDialog(tagLigTV.getText().toString()); return false; } }); lineLayout.addView(tagLigTV); } else if (tag.equalsIgnoreCase("img")) { final TextView imgTV = new TextView(mContext); imgTV.setBackgroundResource(R.drawable.tag_p_drawable); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.setMargins(2, 2, 2, 2); imgTV.setLayoutParams(lp); imgTV.setPaddingRelative(2, 2, 2, 2); imgTV.setMovementMethod(ScrollingMovementMethod.getInstance()); imgTV.setTextColor(Color.BLACK); imgTV.setText(content); imgTV.setTextSize(TEXT_SIZE); imgTV.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { TextView tv = (TextView) v; String path = tv.getText().toString(); if (path != null && path.trim().length() > 0) { openDialog2(path); } } }); lineLayout.addView(imgTV); } } }
From source file:org.mythdroid.activities.Guide.java
/** * Generate a TableRow from the provided Channel * @param ch Channel to generate a row for * @return populated TableRow representing the channel */// w ww . j a va 2s . c o m @SuppressLint("DefaultLocale") private TableRow getRowFromChannel(Channel ch) { final TableRow row = new TableRow(this); row.setLayoutParams(rowLayout); TextView tv = new TextView(this); tv.setBackgroundColor(0xffe0e0f0); tv.setTextColor(0xff202020); tv.setPadding(4, 4, 4, 4); tv.setMaxLines(2); tv.setTag(ch.ID); tv.setText(ch.num + " " + ch.callSign); //$NON-NLS-1$ tv.setOnClickListener(chanClickListener); tv.setOnLongClickListener(chanLongClickListener); tv.setLayoutParams(chanLayout); row.addView(tv); LayoutParams layout = null; Program[] progs = ch.programs.toArray(new Program[ch.programs.size()]); int numprogs = progs.length; for (int i = 0; i < numprogs; i++) { if (progs[i].StartTime.equals(later)) continue; tv = new TextView(this); layout = new LayoutParams(this, null); layout.topMargin = layout.bottomMargin = layout.leftMargin = layout.rightMargin = 1; layout.height = rowHeight; String cat = catPat.matcher(progs[i].Category.toLowerCase()).replaceAll(""); //$NON-NLS-1$ try { tv.setBackgroundColor(Category.valueOf(cat).color()); } catch (IllegalArgumentException e) { tv.setBackgroundColor(Category.unknown.color()); } tv.setTextColor(0xfff0f0f0); tv.setPadding(4, 4, 4, 4); tv.setMaxLines(2); tv.setText(progs[i].Title); setStatusDrawable(tv, progs[i]); int width = setLayoutParams(layout, progs[i]) * colWidth; if (width < 1) continue; tv.setWidth(width); tv.setLayoutParams(layout); tv.setTag(progs[i]); tv.setOnClickListener(progClickListener); row.addView(tv); } return row; }
From source file:com.timothy.android.api.fragment.PageFragmentNew.java
public void setAllComponent(List<HtmlCleanAPI.HtmlContent> hcList) { Log.i(LOG_TAG, "setAllComponent()..."); for (HtmlCleanAPI.HtmlContent hc : hcList) { String tag = hc.getTag(); String content = hc.getContent(); if (StringUtil.isEmpty(content)) continue; String contentMBlank = StringUtil.mergeBlank(content); if (StringUtil.isEmpty(contentMBlank)) continue; String contentRBlank = StringUtil.rmvEnter(StringUtil.trim(contentMBlank)); if (StringUtil.isEmpty(contentRBlank)) continue; String contentRSpecial = StringUtil.rmvSpecial(contentRBlank); if (StringUtil.isEmpty(contentRSpecial)) continue; Log.i(LOG_TAG, "tag:" + tag); Log.i(LOG_TAG, "content:" + contentRSpecial); if (tag.equalsIgnoreCase("P")) { final TextView tagPTV = new TextView(mContext); tagPTV.setBackgroundResource(R.drawable.tag_p_drawable); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.setMargins(2, 3, 2, 3);// w w w . j a v a2s . co m tagPTV.setLayoutParams(lp); tagPTV.setPadding(3, 3, 3, 3); tagPTV.setPaddingRelative(3, 3, 3, 3); tagPTV.setMovementMethod(ScrollingMovementMethod.getInstance()); tagPTV.setTextColor(Color.BLACK); tagPTV.setText(contentRSpecial); tagPTV.setTextSize(TEXT_SIZE); tagPTV.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { openDialog(tagPTV.getText().toString()); return false; } }); lineLayout.addView(tagPTV); } else if (tag.equalsIgnoreCase("pre")) { final TextView tagPre = new TextView(mContext); tagPre.setBackgroundColor(Color.parseColor("#D2EADE")); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.setMargins(2, 2, 2, 2); tagPre.setLayoutParams(lp); tagPre.setPadding(2, 2, 2, 2); tagPre.setPaddingRelative(2, 2, 2, 2); tagPre.setMovementMethod(ScrollingMovementMethod.getInstance()); tagPre.setTextColor(Color.BLACK); // String contentRSpecial = StringUtil.rmvSpecial(content); tagPre.setText(StringUtil.rmvSpecial(content)); tagPre.setTextSize(TEXT_SIZE); tagPre.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { openDialog(tagPre.getText().toString()); return false; } }); lineLayout.addView(tagPre); } else if (tag.equalsIgnoreCase("dt") || tag.equalsIgnoreCase("H1") || tag.equalsIgnoreCase("H2") || tag.equalsIgnoreCase("H3")) {//title TextView tagDtHTV = new TextView(mContext); tagDtHTV.setBackgroundColor(Color.DKGRAY); tagDtHTV.setTypeface(null, Typeface.BOLD); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.setMargins(2, 0, 2, 0); tagDtHTV.setLayoutParams(lp); tagDtHTV.setPadding(2, 2, 2, 2); tagDtHTV.setPaddingRelative(2, 2, 2, 2); tagDtHTV.setMovementMethod(ScrollingMovementMethod.getInstance()); tagDtHTV.setTextColor(Color.WHITE); tagDtHTV.setText(contentRSpecial); tagDtHTV.setTextSize(TEXT_SIZE); lineLayout.addView(tagDtHTV); } else if (tag.equalsIgnoreCase("dd")) { final TextView tagDD = new TextView(mContext); tagDD.setBackgroundResource(R.drawable.tag_p_drawable); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.setMargins(2, 2, 2, 2); tagDD.setLayoutParams(lp); tagDD.setPadding(3, 3, 3, 3); tagDD.setPaddingRelative(3, 3, 3, 3); tagDD.setMovementMethod(ScrollingMovementMethod.getInstance()); tagDD.setTextColor(Color.BLACK); tagDD.setText(contentRSpecial); tagDD.setTextSize(TEXT_SIZE); tagDD.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { openDialog(tagDD.getText().toString()); return false; } }); lineLayout.addView(tagDD); } else if (tag.equalsIgnoreCase("li")) { final TextView tagLigTV = new TextView(mContext); tagLigTV.setBackgroundResource(R.drawable.tag_p_drawable); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.setMargins(2, 2, 2, 2); tagLigTV.setLayoutParams(lp); tagLigTV.setPaddingRelative(2, 2, 2, 2); tagLigTV.setMovementMethod(ScrollingMovementMethod.getInstance()); tagLigTV.setTextColor(Color.BLACK); tagLigTV.setText(contentRSpecial); tagLigTV.setTextSize(TEXT_SIZE); tagLigTV.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { openDialog(tagLigTV.getText().toString()); return false; } }); lineLayout.addView(tagLigTV); } else if (tag.equalsIgnoreCase("img")) { final TextView imgTV = new TextView(mContext); imgTV.setBackgroundResource(R.drawable.tag_p_drawable); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.setMargins(2, 2, 2, 2); imgTV.setLayoutParams(lp); imgTV.setPaddingRelative(2, 2, 2, 2); imgTV.setMovementMethod(ScrollingMovementMethod.getInstance()); imgTV.setTextColor(Color.BLACK); imgTV.setText(content); imgTV.setTextSize(TEXT_SIZE); lineLayout.addView(imgTV); ImageView imageView = new ImageView(mContext); LinearLayout.LayoutParams imgLP = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); imageView.setLayoutParams(imgLP); Bitmap localBt = getLoacalBitmap(baseFolder + File.separator + content); imageView.setImageBitmap(localBt); lineLayout.addView(imageView); } } }
From source file:com.android.launcher3.Hotseat.java
void resetLayout() { mContent.removeAllViewsInLayout();//from ww w. j av a 2 s . c o m if (!FeatureFlags.NO_ALL_APPS_ICON) { // Add the Apps button Context context = getContext(); int allAppsButtonRank = mLauncher.getDeviceProfile().inv.getAllAppsButtonRank(); LayoutInflater inflater = LayoutInflater.from(context); TextView allAppsButton = (TextView) inflater.inflate(R.layout.all_apps_button, mContent, false); Drawable d = context.getResources().getDrawable(R.drawable.all_apps_button_icon); mLauncher.resizeIconDrawable(d); int scaleDownPx = getResources().getDimensionPixelSize(R.dimen.all_apps_button_scale_down); Rect bounds = d.getBounds(); d.setBounds(bounds.left, bounds.top + scaleDownPx / 2, bounds.right - scaleDownPx, bounds.bottom - scaleDownPx / 2); allAppsButton.setCompoundDrawables(null, d, null, null); allAppsButton.setContentDescription(context.getString(R.string.all_apps_button_label)); allAppsButton.setOnKeyListener(new HotseatIconKeyEventListener()); if (mLauncher != null) { mLauncher.setAllAppsButton(allAppsButton); allAppsButton.setOnTouchListener(mLauncher.getHapticFeedbackTouchListener()); allAppsButton.setOnClickListener(mLauncher); allAppsButton.setOnLongClickListener(mLauncher); allAppsButton.setOnFocusChangeListener(mLauncher.mFocusHandler); } // Note: We do this to ensure that the hotseat is always laid out in the orientation of // the hotseat in order regardless of which orientation they were added int x = getCellXFromOrder(allAppsButtonRank); int y = getCellYFromOrder(allAppsButtonRank); CellLayout.LayoutParams lp = new CellLayout.LayoutParams(x, y, 1, 1); lp.canReorder = false; mContent.addViewToCellLayout(allAppsButton, -1, allAppsButton.getId(), lp, true); } }
From source file:net.momodalo.app.vimtouch.VimTouch.java
private void addQuickbarButton(String text) { TextView button = (TextView) getLayoutInflater().inflate(R.layout.quickbutton, (ViewGroup) mButtonBarLayout, false);/*www . j a v a2s . co m*/ button.setText(text); button.setOnClickListener(mClickListener); button.setOnLongClickListener(mLongClickListener); mButtonBarLayout.addView((View) button); }
From source file:org.svij.taskwarriorapp.TaskAddActivity.java
public void onCreate(Bundle savedInstanceState) { setTheme(R.style.Theme_Sherlock_Light_DarkActionBar); super.onCreate(savedInstanceState); setContentView(R.layout.activity_task_add); getSupportActionBar().setDisplayHomeAsUpEnabled(true); final TextView tvDueDate = (TextView) findViewById(R.id.tvDueDate); tvDueDate.setOnClickListener(new View.OnClickListener() { @Override//from w w w . j a v a2 s . co m public void onClick(View v) { DatePickerFragment date = new DatePickerFragment(); date.setCallBack(onDate); date.setTimestamp(timestamp); date.show(getSupportFragmentManager().beginTransaction(), "date_dialog"); } }); final TextView tvDueTime = (TextView) findViewById(R.id.tvDueTime); tvDueTime.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { TimePickerFragment date = new TimePickerFragment(); date.setCallBack(onTime); date.setTimestamp(timestamp); date.show(getSupportFragmentManager().beginTransaction(), "time_dialog"); } }); tvDueDate.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { if (TextUtils.isEmpty(tvDueTime.getText().toString())) { timestamp = 0; } else { cal.set(Calendar.YEAR, Calendar.getInstance().get(Calendar.YEAR)); cal.set(Calendar.MONTH, Calendar.getInstance().get(Calendar.MONTH)); cal.set(Calendar.DAY_OF_MONTH, Calendar.getInstance().get(Calendar.DAY_OF_MONTH)); timestamp = cal.getTimeInMillis(); } tvDueDate.setText(""); return true; } }); tvDueTime.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { if (TextUtils.isEmpty(tvDueDate.getText().toString())) { timestamp = 0; } else { cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); timestamp = cal.getTimeInMillis(); } tvDueTime.setText(""); return true; } }); TaskDataSource dataSource = new TaskDataSource(this); ArrayList<String> projectsAR = dataSource.getProjects(); projectsAR.removeAll(Collections.singleton(null)); String[] projects = projectsAR.toArray(new String[projectsAR.size()]); final AutoCompleteTextView actvProject = (AutoCompleteTextView) findViewById(R.id.actvProject); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, projects); actvProject.setAdapter(adapter); actvProject.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View arg0, MotionEvent arg1) { actvProject.showDropDown(); return false; } }); Intent intent = getIntent(); Bundle extras = intent.getExtras(); if (extras != null) { taskID = extras.getString("taskID"); if (taskID != null) { datasource = new TaskDataSource(this); Task task = datasource.getTask(UUID.fromString(taskID)); TextView etTaskAdd = (TextView) findViewById(R.id.etTaskAdd); Spinner spPriority = (Spinner) findViewById(R.id.spPriority); TextView etTags = (TextView) findViewById(R.id.etTags); etTaskAdd.setText(task.getDescription()); if (task.getDue() != null && task.getDue().getTime() != 0) { tvDueDate.setText(DateFormat.getDateInstance(DateFormat.SHORT).format(task.getDue())); if (!DateFormat.getTimeInstance().format(task.getDue()).equals("00:00:00")) { tvDueTime.setText(DateFormat.getTimeInstance(DateFormat.SHORT).format(task.getDue())); } cal.setTime(task.getDue()); timestamp = cal.getTimeInMillis(); } actvProject.setText(task.getProject()); Log.i("PriorityID", ":" + task.getPriorityID()); spPriority.setSelection(task.getPriorityID()); etTags.setText(task.getTags()); } else { String action = intent.getAction(); if ((action.equalsIgnoreCase(Intent.ACTION_SEND) || action.equalsIgnoreCase("com.google.android.gm.action.AUTO_SEND")) && intent.hasExtra(Intent.EXTRA_TEXT)) { String s = intent.getStringExtra(Intent.EXTRA_TEXT); TextView etTaskAdd = (TextView) findViewById(R.id.etTaskAdd); etTaskAdd.setText(s); addingTaskFromOtherApp = true; } } } }
From source file:com.coinblesk.client.KeyboardFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.fragment_keyboard, container, false); final int screenLayout = getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK; switch (screenLayout) { case Configuration.SCREENLAYOUT_SIZE_LARGE: case Configuration.SCREENLAYOUT_SIZE_XLARGE: initLarge(view);/*from ww w .j a v a2s .c om*/ break; default: initStandard(view); break; } TextView t1 = (TextView) view.findViewById(R.id.amount_large_text_view); TextView t2 = (TextView) view.findViewById(R.id.amount_large_text_currency); TextView t3 = (TextView) view.findViewById(R.id.amount_small_text_view); TextView t4 = (TextView) view.findViewById(R.id.amount_small_text_currency); View.OnLongClickListener listener = new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { DialogFragment fragment = CurrencyDialogFragment.newInstance(); if (fragment != null) { fragment.show(KeyboardFragment.this.getFragmentManager(), TAG); } return true; } }; t1.setOnLongClickListener(listener); t2.setOnLongClickListener(listener); t3.setOnLongClickListener(listener); t4.setOnLongClickListener(listener); UIUtils.refreshConnectionIconStatus(getActivity(), view); return view; }
From source file:com.cssweb.android.base.QuoteGridActivity.java
private void AddViewItem(String paramString, int paramInt1, LinearLayout paramLinearLayout, int paramInt2, int paramInt3, int paramInt4, boolean paramBoolean) { TextView localTextView = new TextView(this); float f = this.mFontSize; localTextView.setTextSize(f);//from w w w . ja va 2 s . c om //??4? if (paramInt2 == paramInt4 && paramInt3 == 0 && nameOrcode) { if (this.mPaint.measureText(paramString) > textWeight) localTextView.setTextSize(13); } if (n2 == paramInt2) { String str = (n1 == 0) ? paramString + low : (n1 == 1) ? paramString + top : paramString; localTextView.setText(str); } else { localTextView.setText(paramString); } localTextView.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL); localTextView.setFocusable(paramBoolean); localTextView.setOnClickListener(mClickListener); localTextView.setOnLongClickListener(mLongClickListener); localTextView.setOnTouchListener(this); //touch localTextView.setTag(paramInt2); localTextView.setEnabled(paramBoolean); localTextView.setSingleLine(false); if (paramInt4 == 0 && paramInt3 >= 0) {// localTextView.setGravity(Gravity.CENTER); int i1 = this.residTitleCol; int i8 = 0; localTextView.setTextColor(paramInt1); if (paramInt3 == 0) { localDrawable = getResources().getDrawable(i1); i8 = localDrawable.getIntrinsicWidth(); } else if (paramInt3 == 100) { localDrawable = getResources().getDrawable(this.residTitleScrollCol[2]); i8 = localDrawable.getIntrinsicWidth(); } else if (paramInt3 == 13) { localDrawable = getResources().getDrawable(this.residTitleScrollCol[0]); i8 = localDrawable.getIntrinsicWidth(); i8 += 20; } else if (paramInt3 == 8) { localDrawable = getResources().getDrawable(this.residTitleScrollCol[0]); i8 = localDrawable.getIntrinsicWidth(); i8 += 10; } else if (paramInt3 % 2 == 0) { localDrawable = getResources().getDrawable(this.residTitleScrollCol[1]); i8 = localDrawable.getIntrinsicWidth(); } else { localDrawable = getResources().getDrawable(this.residTitleScrollCol[0]); i8 = localDrawable.getIntrinsicWidth(); } localTextView.setBackgroundDrawable(localDrawable); int i6 = localDrawable.getIntrinsicHeight(); localTextView.setHeight(i6 + CssSystem.getTableTitleHeight(this)); //int i9 = (int) Math.max(i8, mPaint.measureText(paramString)); localTextView.setWidth(i8); paramLinearLayout.addView(localTextView); return; } if (paramInt4 != 0 && paramInt3 >= 0) { int i8 = 0; localTextView.setTextColor(paramInt1); if (paramInt3 == 0) { localDrawable = getResources().getDrawable(this.residCol); i8 = localDrawable.getIntrinsicWidth(); } else if (paramInt3 == 100) { localDrawable = getResources().getDrawable(this.residScrollCol[2]); localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL); i8 = localDrawable.getIntrinsicWidth(); } else if (paramInt3 == 13) { localDrawable = getResources().getDrawable(this.residScrollCol[0]); localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL); i8 = localDrawable.getIntrinsicWidth(); i8 += 20; //localTextView.setWidth(i8+20); } else if (paramInt3 == 8) { localDrawable = getResources().getDrawable(this.residScrollCol[0]); localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL); i8 = localDrawable.getIntrinsicWidth(); i8 += 10; //localTextView.setWidth(i8+20); } else if (paramInt3 % 2 == 0) { localDrawable = getResources().getDrawable(this.residScrollCol[1]); localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL); i8 = localDrawable.getIntrinsicWidth(); } else { localDrawable = getResources().getDrawable(this.residScrollCol[0]); localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL); i8 = localDrawable.getIntrinsicWidth(); } localTextView.setBackgroundDrawable(localDrawable); int i6 = localDrawable.getIntrinsicHeight(); localTextView.setHeight(i6 + rowHeight); //int i9 = (int) Math.max(i8, mPaint.measureText(paramString)); localTextView.setWidth(i8); paramLinearLayout.addView(localTextView); return; } // if ((paramInt3 == j) && (paramInt4 == l)) { // int i13 = this.residTitleScrollCol[l]; // localDrawable = localResources.getDrawable(i13); // localTextView.setTextColor(paramInt1); // localTextView.setBackgroundDrawable(localDrawable); // paramLinearLayout.addView(localTextView); // return; // } }
From source file:com.xiaoyu.DoctorHelp.chat.chatuidemo.adapter.MessageAdapter.java
/** * ???/*ww w . java 2 s .c om*/ * * @param message * @param holder * @param position * @param convertView */ private void handleLocationMessage(final EMMessage message, final ViewHolder holder, final int position, View convertView) { TextView locationView = ((TextView) convertView.findViewById(R.id.tv_location)); LocationMessageBody locBody = (LocationMessageBody) message.getBody(); locationView.setText(locBody.getAddress()); LatLng loc = new LatLng(locBody.getLatitude(), locBody.getLongitude()); locationView.setOnClickListener(new MapClickListener(loc, locBody.getAddress())); locationView.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { activity.startActivityForResult((new Intent(activity, ContextMenu.class)) .putExtra("position", position).putExtra("type", EMMessage.Type.LOCATION.ordinal()), ChatActivity.REQUEST_CODE_CONTEXT_MENU); return false; } }); if (message.direct == EMMessage.Direct.RECEIVE) { return; } // deal with send message switch (message.status) { case SUCCESS: holder.pb.setVisibility(View.GONE); holder.staus_iv.setVisibility(View.GONE); break; case FAIL: holder.pb.setVisibility(View.GONE); holder.staus_iv.setVisibility(View.VISIBLE); break; case INPROGRESS: holder.pb.setVisibility(View.VISIBLE); break; default: sendMsgInBackground(message, holder); } }