List of usage examples for android.view View getTag
@ViewDebug.ExportedProperty
public Object getTag()
From source file:codepath.watsiapp.adapters.PatientAdapter.java
private View buildViewHolder() { View convertView;// w w w .j a v a2s . c o m convertView = View.inflate(getContext(), R.layout.item_patient, null); //viewHolder.name = (TextView) convertView.findViewById(R.id.name); viewHolder.donationTogo = (TextView) convertView.findViewById(R.id.donation_togo); viewHolder.medicalNeed = (TextView) convertView.findViewById(R.id.medicalNeeds); viewHolder.patientPhoto = (ImageView) convertView.findViewById(R.id.progressBarImageView); viewHolder.donationProgress = (ProgressBar) convertView.findViewById(R.id.progressBarToday); viewHolder.shareAction = (ImageView) convertView.findViewById(R.id.shareIv); viewHolder.shareOnFacebook = (ImageView) convertView.findViewById(R.id.share_fb); viewHolder.donateView = (ImageView) convertView.findViewById(R.id.fund_treatment); viewHolder.shareOnTwitter = (ImageView) convertView.findViewById(R.id.share_tw); //Util.applyPrimaryFont(getContext(), viewHolder.name); applyPrimaryFont(getContext(), viewHolder.donationTogo); applyPrimaryFont(getContext(), viewHolder.medicalNeed); convertView.setTag(viewHolder); convertView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ViewHolder _viewHolder = (ViewHolder) v.getTag(); String patientId = _viewHolder.patientId; PatientDetailActivity.getPatientDetailsIntent(activity, patientId); } }); return convertView; }
From source file:com.bt.download.android.gui.adapters.SearchResultListAdapter.java
@Override protected void onItemClicked(View v) { SearchResult sr = (SearchResult) v.getTag(); if (sr instanceof AppiaSearchResult) { onAppiaSearchResultClicked((AppiaSearchResult) sr); } else {/*from www .j a va 2 s . c o m*/ searchResultClicked(sr); } }
From source file:com.antonioleiva.materialeverywhere.HomeActivity1.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setActionBarIcon(R.drawable.ic_ab_drawer); GridView gridView = (GridView) findViewById(R.id.gridView); gridView.setAdapter(new GridViewAdapter()); gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override//from w w w . java 2 s . c o m public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { String url = (String) view.getTag(); DetailActivity.launch(HomeActivity1.this, view.findViewById(R.id.image), url); } }); drawer = (DrawerLayout) findViewById(R.id.drawer); drawer.setDrawerShadow(R.drawable.drawer_shadow, Gravity.START); NotificationManager notifier = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); notifier.cancel(ACTION_NOTIFICATION_ID); //? ?? Intent intent1 = new Intent(this, HomeActivity1.class); PendingIntent viewPendingIntent = PendingIntent.getActivity(this, ACTION_NOTIFICATION_ID, intent1, 0); NotificationCompat.WearableExtender secondWearableExtender = new NotificationCompat.WearableExtender() .setContentIcon(R.drawable.ic_launcher).setContentIconGravity(Gravity.CENTER); //step4 Notification secondPage = new NotificationCompat.Builder(this).setContentTitle("Step 4") .setContentText(" ? ? ? ?.") .extend(secondWearableExtender).build(); //5 NotificationCompat.Action step5 = new NotificationCompat.Action(R.drawable.ic_launcher, "step5", viewPendingIntent); //step5 Notification thirdPage = new NotificationCompat.Builder(this).setContentTitle("Step 5") .setContentText(" .") .extend(new NotificationCompat.WearableExtender().setContentIcon(R.drawable.ic_launcher) .setContentIconGravity(Gravity.CENTER).setContentAction(0)) .build(); //step6 Notification fourthPage = new NotificationCompat.Builder(this).setContentTitle("Step 6") .setContentText(" ? .") .extend(new NotificationCompat.WearableExtender().setContentIcon(R.drawable.ic_launcher) .setContentIconGravity(Gravity.CENTER)) .build(); // ?? ? ?. //?, ? NotificationCompat.WearableExtender wearableOptions = new NotificationCompat.WearableExtender() .setContentIcon(R.drawable.ic_launcher).setContentIconGravity(Gravity.CENTER).addAction(step5) .addPage(secondPage).addPage(thirdPage).addPage(fourthPage); // ? ? ? Notification notification = new NotificationCompat.Builder(this).setContentTitle("?") .setContentText("2").setUsesChronometer(true).setSmallIcon(R.drawable.ic_launcher) .extend(wearableOptions).setAutoCancel(true).build(); //? // ? ? . NotificationManagerCompat.from(this).notify(RECIPE_NOTIFICATION_ID, notification); }
From source file:me.kartikarora.transfersh.adapters.FileGridAdapter.java
@Override public void bindView(View view, final Context context, Cursor cursor) { FileItemViewHolder holder = (FileItemViewHolder) view.getTag(); int nameCol = cursor.getColumnIndex(FilesContract.FilesEntry.COLUMN_NAME); int typeCol = cursor.getColumnIndex(FilesContract.FilesEntry.COLUMN_TYPE); int sizeCol = cursor.getColumnIndex(FilesContract.FilesEntry.COLUMN_SIZE); int urlCol = cursor.getColumnIndex(FilesContract.FilesEntry.COLUMN_URL); final String name = cursor.getString(nameCol); final String type = cursor.getString(typeCol); final String size = cursor.getString(sizeCol); final String url = cursor.getString(urlCol); holder.fileNameTextView.setText(name); String ext = FilenameUtils.getExtension(name); int identifier = context.getResources().getIdentifier("t" + ext, "drawable", context.getPackageName()); try {//from w ww .j ava 2 s . co m holder.fileTypeImageView .setImageDrawable(ResourcesCompat.getDrawable(context.getResources(), identifier, null)); } catch (Resources.NotFoundException e) { e.printStackTrace(); holder.fileTypeImageView .setImageDrawable(ResourcesCompat.getDrawable(context.getResources(), R.drawable.tblank, null)); } holder.fileInfoImageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String message = "Name: " + name + "\n" + "File type: " + type + "\n" + "URL: " + url; new AlertDialog.Builder(activity).setMessage(message).setPositiveButton(android.R.string.ok, null) .create().show(); } }); holder.fileShareImageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { tracker.send( new HitBuilders.EventBuilder().setCategory("Action").setAction("Share : " + url).build()); context.startActivity(new Intent().setAction(Intent.ACTION_SEND).putExtra(Intent.EXTRA_TEXT, url) .setType("text/plain").addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); } }); holder.fileDownloadImageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { checkForDownload(name, type, url, view); } }); }
From source file:com.alex.view.tab.TabLayout.java
private void addOnTabSelectedListener() { View tabView;//from w w w. j av a2s.c o m for (int i = 0; i < mTabCount; i++) { tabView = getChildAt(i); tabView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { int position = (int) v.getTag(); if (mCurrentTab != position) { mTabClickTrigger = true; setCurrentTab(position); if (mListener != null) { mListener.onTabSelect(v, position); } } else { if (mListener != null) { mListener.onTabReselect(v, position); } } } }); } }
From source file:android.widget.PinnedHeaderListAdapter.java
/** * The default implementation creates the same type of view as a normal * partition header.//from w ww .j a v a2 s . co m */ @Override public View getPinnedHeaderView(int partition, View convertView, ViewGroup parent) { if (hasHeader(partition)) { View view = null; if (convertView != null) { Integer headerType = (Integer) convertView.getTag(); if (headerType != null && headerType == PARTITION_HEADER_TYPE) { view = convertView; } } if (view == null) { view = newHeaderView(getContext(), partition, null, parent); view.setTag(PARTITION_HEADER_TYPE); view.setFocusable(false); view.setEnabled(false); } bindHeaderView(view, partition, getCursor(partition)); ViewCompat.setLayoutDirection(view, ViewCompat.getLayoutDirection(parent)); return view; } else { return null; } }
From source file:com.newtifry.android.ChooseAccount.java
public void onClick(View textview) { Long id = (Long) textview.getTag(); NewtifryAccount account = NewtifryAccount.FACTORY.get(this, id); this.clickAccountName(account); }
From source file:com.abcvoipsip.ui.messages.ConverstationsAdapter.java
@Override public void bindView(View view, Context context, Cursor cursor) { super.bindView(view, context, cursor); final ConversationListItemViews tagView = (ConversationListItemViews) view.getTag(); String nbr = cursor.getString(cursor.getColumnIndex(SipMessage.FIELD_FROM)); String fromFull = cursor.getString(cursor.getColumnIndex(SipMessage.FIELD_FROM_FULL)); String to_number = cursor.getString(cursor.getColumnIndex(SipMessage.FIELD_TO)); //int read = cursor.getInt(cursor.getColumnIndex(SipMessage.FIELD_READ)); long date = cursor.getLong(cursor.getColumnIndex(SipMessage.FIELD_DATE)); tagView.fromFull = fromFull;/*from ww w .j a va 2 s . co m*/ tagView.to = to_number; tagView.from = nbr; tagView.position = cursor.getPosition(); /* Drawable background = (read == 0)? context.getResources().getDrawable(R.drawable.conversation_item_background_unread) : context.getResources().getDrawable(R.drawable.conversation_item_background_read); view.setBackgroundDrawable(background); */ String number = cursor.getString(cursor.getColumnIndex(SipMessage.FIELD_FROM_FULL)); CallerInfo info = CallerInfo.getCallerInfoFromSipUri(mContext, number); /* final Uri lookupUri = info.contactContentUri; final String name = info.name; final int ntype = info.numberType; final String label = info.phoneLabel; CharSequence formattedNumber = SipUri.getCanonicalSipContact(number, false); */ // Photo tagView.quickContactView.assignContactUri(info.contactContentUri); ContactsAsyncHelper.updateImageViewWithContactPhotoAsync(mContext, tagView.quickContactView.getImageView(), info, SipHome.USE_LIGHT_THEME ? R.drawable.ic_contact_picture_holo_light : R.drawable.ic_contact_picture_holo_dark); // From tagView.fromView.setText(formatMessage(cursor)); //Date // Set the date/time field by mixing relative and absolute times. int flags = DateUtils.FORMAT_ABBREV_RELATIVE; tagView.dateView.setText(DateUtils.getRelativeTimeSpanString(date, System.currentTimeMillis(), DateUtils.MINUTE_IN_MILLIS, flags)); }
From source file:com.skalski.raspberrycontrol.Activity_RemoteControl.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_remotecontrol); OnClickListener listener = new OnClickListener() { @Override/*from ww w .j av a2 s . com*/ public void onClick(View v) { String button; button = (String) v.getTag(); if (device == null) toast_connection_error(getResources().getString(R.string.error_msg_10)); else sendCommand(device, button); } }; OnLongClickListener listener1 = new OnLongClickListener() { @Override public boolean onLongClick(View v) { AlertDialog diaBox = makeAndShowDialogBox(v); diaBox.show(); return true; } }; for (int i = 0; i < 44; ++i) { String buttonID = String.format("button%02d", i); int resID = getResources().getIdentifier(buttonID, "id", getPackageName()); button[i] = ((Button) findViewById(resID)); button[i].setOnClickListener(listener); button[i].setOnLongClickListener(listener1); } }
From source file:com.abcvoipsip.ui.account.AccountsEditListAdapter.java
@Override public void bindView(View view, Context context, Cursor cursor) { super.bindView(view, context, cursor); AccountListItemViews tagView = (AccountListItemViews) view.getTag(); if (tagView == null) { tagView = tagRowView(view);//w w w . j a va 2s . c o m } // Get the view object and account object for the row final SipProfile account = new SipProfile(cursor); AccountRowTag tagIndicator = new AccountRowTag(); tagIndicator.accountId = account.id; tagIndicator.activated = account.active; tagView.indicator.setTag(tagIndicator); tagView.indicator.setVisibility(draggable ? View.GONE : View.VISIBLE); tagView.grabber.setVisibility(draggable ? View.VISIBLE : View.GONE); // Get the status of this profile tagView.labelView.setText(account.display_name); // Update status label and color if (account.active) { AccountStatusDisplay accountStatusDisplay = AccountListUtils.getAccountDisplay(context, account.id); tagView.statusView.setText(accountStatusDisplay.statusLabel); tagView.labelView.setTextColor(accountStatusDisplay.statusColor); // Update checkbox selection tagView.activeCheckbox.setChecked(true); tagView.barOnOff.setImageResource(accountStatusDisplay.checkBoxIndicator); } else { tagView.statusView.setText(R.string.acct_inactive); tagView.labelView.setTextColor(mContext.getResources().getColor(R.color.account_inactive)); // Update checkbox selection tagView.activeCheckbox.setChecked(false); tagView.barOnOff.setImageResource(R.drawable.ic_indicator_off); } // Update account image final WizardInfo wizardInfos = WizardUtils.getWizardClass(account.wizard); if (wizardInfos != null) { tagView.activeCheckbox.setBackgroundResource(wizardInfos.icon); } }