Java Code Examples for android.view.View#findViewWithTag()
The following examples show how to use
android.view.View#findViewWithTag() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RobotoCalendarView.java From roboto-calendar-view with Apache License 2.0 | 6 votes |
@Override public boolean onLongClick(View view) { // Extract day selected ViewGroup dayOfTheMonthContainer = (ViewGroup) view; String tagId = (String) dayOfTheMonthContainer.getTag(); tagId = tagId.substring(DAY_OF_THE_MONTH_LAYOUT.length(), tagId.length()); TextView dayOfTheMonthText = view.findViewWithTag(DAY_OF_THE_MONTH_TEXT + tagId); // Extract the day from the text Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, currentCalendar.get(Calendar.YEAR)); calendar.set(Calendar.MONTH, currentCalendar.get(Calendar.MONTH)); calendar.set(Calendar.DAY_OF_MONTH, Integer.valueOf(dayOfTheMonthText.getText().toString())); markDayAsSelectedDay(calendar.getTime()); // Fire event if (robotoCalendarListener == null) { throw new IllegalStateException("You must assign a valid RobotoCalendarListener first!"); } else { robotoCalendarListener.onDayLongClick(calendar.getTime()); } return true; }
Example 2
Source File: FavoriteCursorAdapter.java From MCPDict with MIT License | 6 votes |
public void expandItem(final char unicode, final View view, final ListView list) { expandedItems.add(unicode); if (view == null) return; final View container = view.findViewWithTag("container"); final SearchResultFragment fragment = (SearchResultFragment) view.getTag(); new AsyncTask<Void, Void, Cursor>() { @Override protected Cursor doInBackground(Void... params) { return MCPDatabase.directSearch(unicode); } @Override protected void onPostExecute(Cursor data) { fragment.setData(data); container.setVisibility(View.VISIBLE); if (list == null) return; scrollListToShowItem(list, view); } }.execute(); }
Example 3
Source File: RobotoCalendarView.java From roboto-calendar-view with Apache License 2.0 | 6 votes |
@Override public void onClick(View view) { // Extract day selected ViewGroup dayOfTheMonthContainer = (ViewGroup) view; String tagId = (String) dayOfTheMonthContainer.getTag(); tagId = tagId.substring(DAY_OF_THE_MONTH_LAYOUT.length(), tagId.length()); TextView dayOfTheMonthText = view.findViewWithTag(DAY_OF_THE_MONTH_TEXT + tagId); // Extract the day from the text Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, currentCalendar.get(Calendar.YEAR)); calendar.set(Calendar.MONTH, currentCalendar.get(Calendar.MONTH)); calendar.set(Calendar.DAY_OF_MONTH, Integer.valueOf(dayOfTheMonthText.getText().toString())); markDayAsSelectedDay(calendar.getTime()); // Fire event if (robotoCalendarListener == null) { throw new IllegalStateException("You must assign a valid RobotoCalendarListener first!"); } else { robotoCalendarListener.onDayClick(calendar.getTime()); } }
Example 4
Source File: CalendarView.java From holo-calendar with Apache License 2.0 | 6 votes |
@Override public TextView getTextViewForDate(final long dayInMillis) { // Loop through all children final int childCount = getChildCount(); for(int i = 0; i < childCount; i++) { final View weekLayout = getChildAt(i); if(weekLayout != null) { // Let the weekLayout find a view with a correct tag final View dayLayout = weekLayout.findViewWithTag(dayInMillis); if(dayLayout != null) { // Find the TextView, and return it return (TextView) dayLayout.findViewById(R.id.lib_calendar_day_text); } } } // No suitable TextView found, return null return null; }
Example 5
Source File: BlurBehindView.java From BlurView with Apache License 2.0 | 6 votes |
private void printViewsBehind(ViewGroup rootView) { if (!this.isInEditMode() && !(rootView instanceof BlurBehindView) && rootView.getVisibility() == View.VISIBLE && rootView.getAlpha() != 0.0F) { if (rootView.getBackground() != null) { this.blurCanvas.save(); this.blurCanvas.translate((float) (this.childPositionInWindow[0] - this.thisPositionInWindow[0] + this.halfPaddingOnSides), (float) (this.halfPaddingOnSides + this.childPositionInWindow[1] - this.thisPositionInWindow[1])); rootView.getBackground().draw(this.blurCanvas); this.blurCanvas.restore(); } for (int i = 0; i < rootView.getChildCount(); ++i) { View childView = rootView.getChildAt(i); if (childView.findViewWithTag(TAG_VIEW) != null & rootView.getVisibility() == View.VISIBLE) { this.printViewsBehind((ViewGroup) childView); } else if (childView.getVisibility() == View.VISIBLE) { this.blurCanvas.save(); childView.getLocationOnScreen(this.childPositionInWindow); this.blurCanvas.translate((float) (this.halfPaddingOnSides + this.childPositionInWindow[0] - this.thisPositionInWindow[0]), (float) (this.halfPaddingOnSides + this.childPositionInWindow[1] - this.thisPositionInWindow[1])); this.blurCanvas.scale(childView.getScaleX(), childView.getScaleY()); childView.draw(this.blurCanvas); this.blurCanvas.restore(); } } } }
Example 6
Source File: ListView.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
View findViewWithTagInHeadersOrFooters(ArrayList<FixedViewInfo> where, Object tag) { // Look in the passed in list of headers or footers for the view with // the tag. if (where != null) { int len = where.size(); View v; for (int i = 0; i < len; i++) { v = where.get(i).view; if (!v.isRootNamespace()) { v = v.findViewWithTag(tag); if (v != null) { return v; } } } } return null; }
Example 7
Source File: ViewUtil.java From NCalendar with Apache License 2.0 | 5 votes |
public static View getTargetView(Context context, View view) { View targetView = view.findViewWithTag(context.getString(R.string.N_factual_scroll_view)); if (targetView != null && isViewVisible(targetView)) { return targetView; } else { try { traverseView(view); } catch (ViewUtil.ViewException e) { e.printStackTrace(); return e.getExceptionView(); } } return null; }
Example 8
Source File: CustomSwipeBaseAdapter.java From android-common-utils with Apache License 2.0 | 5 votes |
@Override public void run() { View v; if( (v = mWeakView.get())==null){ return; } View itemView = v.findViewWithTag(CustomSwipeListView.ITEMMAIN_LAYOUT_TAG); View swipeView = v.findViewWithTag(CustomSwipeListView.ITEMSWIPE_LAYOUT_TAG); if(swipeView.getHeight() != itemView.getHeight()) { swipeView.getLayoutParams().height = itemView.getHeight(); swipeView.getLayoutParams().width = ViewGroup.LayoutParams.WRAP_CONTENT; v.requestLayout(); } }
Example 9
Source File: CoordinatorLayoutManager.java From react-native-bottom-sheet-behavior with MIT License | 5 votes |
/** * Find and sets the BottomSheetHeader to manage colors * @param child */ private void setBottomSheetHeader(View child) { if (child instanceof BottomSheetBehaviorView) { View view = child.findViewWithTag(BottomSheetHeaderView.TAG); if (view != null && view instanceof BottomSheetHeaderView) { BottomSheetBehaviorView b = (BottomSheetBehaviorView) child; RNBottomSheetBehavior behavior = b.behavior; headerView = (BottomSheetHeaderView) view; headerView.registerFields(); headerView.toggle(behavior.getState() == RNBottomSheetBehavior.STATE_COLLAPSED); behavior.setHeader(headerView); } } }
Example 10
Source File: FavoriteCursorAdapter.java From MCPDict with MIT License | 5 votes |
public void collapseItem(char unicode, View view, ListView list) { expandedItems.remove(unicode); if (view == null) return; View container = view.findViewWithTag("container"); container.setVisibility(View.GONE); if (list == null) return; scrollListToShowItem(list, view); }
Example 11
Source File: RobotoCalendarView.java From roboto-calendar-view with Apache License 2.0 | 5 votes |
private void findViewsById(View view) { robotoCalendarMonthLayout = view.findViewById(R.id.robotoCalendarDateTitleContainer); leftButton = view.findViewById(R.id.leftButton); rightButton = view.findViewById(R.id.rightButton); dateTitle = view.findViewById(R.id.monthText); LayoutInflater inflate = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); for (int i = 0; i < 42; i++) { int weekIndex = (i % 7) + 1; ViewGroup dayOfTheWeekLayout = view.findViewWithTag(DAY_OF_THE_WEEK_LAYOUT + weekIndex); // Create day of the month View dayOfTheMonthLayout = inflate.inflate(R.layout.roboto_calendar_day_of_the_month_layout, null); View dayOfTheMonthText = dayOfTheMonthLayout.findViewWithTag(DAY_OF_THE_MONTH_TEXT); View dayOfTheMonthBackground = dayOfTheMonthLayout.findViewWithTag(DAY_OF_THE_MONTH_BACKGROUND); View dayOfTheMonthCircleImage1 = dayOfTheMonthLayout.findViewWithTag(DAY_OF_THE_MONTH_CIRCLE_IMAGE_1); View dayOfTheMonthCircleImage2 = dayOfTheMonthLayout.findViewWithTag(DAY_OF_THE_MONTH_CIRCLE_IMAGE_2); // Set tags to identify them int viewIndex = i + 1; dayOfTheMonthLayout.setTag(DAY_OF_THE_MONTH_LAYOUT + viewIndex); dayOfTheMonthText.setTag(DAY_OF_THE_MONTH_TEXT + viewIndex); dayOfTheMonthBackground.setTag(DAY_OF_THE_MONTH_BACKGROUND + viewIndex); dayOfTheMonthCircleImage1.setTag(DAY_OF_THE_MONTH_CIRCLE_IMAGE_1 + viewIndex); dayOfTheMonthCircleImage2.setTag(DAY_OF_THE_MONTH_CIRCLE_IMAGE_2 + viewIndex); dayOfTheWeekLayout.addView(dayOfTheMonthLayout); } }
Example 12
Source File: Getter.java From AndroidRipper with GNU Affero General Public License v3.0 | 5 votes |
/** * Returns a {@code View} with a given tag. * * @param tag the <code>tag</code> of the {@code View} to be returned * @param index the index of the {@link View}. {@code 0} if only one is available * @param timeout the timeout in milliseconds * @return a {@code View} with a given tag if available, <code>null</code> otherwise */ public View getView(Object tag, int index, int timeout){ //Because https://github.com/android/platform_frameworks_base/blob/master/core/java/android/view/View.java#L17005-L17007 if(tag == null) { return null; } final Activity activity = activityUtils.getCurrentActivity(false); View viewToReturn = null; if(index < 1){ index = 0; if(activity != null){ //Using https://github.com/android/platform_frameworks_base/blob/master/core/java/android/app/Activity.java#L2070-L2072 Window window = activity.getWindow(); if(window != null) { View decorView = window.getDecorView(); if(decorView != null) { viewToReturn = decorView.findViewWithTag(tag); } } } } if (viewToReturn != null) { return viewToReturn; } return waiter.waitForView(tag, index, timeout); }
Example 13
Source File: GoogleMapsFragment.java From ground-android with Apache License 2.0 | 5 votes |
private void setWatermarkPadding(View view, int left, int top, int right, int bottom) { ImageView watermark = view.findViewWithTag("GoogleWatermark"); // Watermark may be null if Maps failed to load. if (watermark == null) { return; } RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) watermark.getLayoutParams(); params.setMargins(left, top, right, bottom); watermark.setLayoutParams(params); }
Example 14
Source File: LiteIconActivity.java From NanoIconPackLite with Apache License 2.0 | 4 votes |
IconHolder(View itemView) { super(itemView); ivIcon = (ImageView) itemView.findViewWithTag("iv"); }
Example 15
Source File: LiteIconActivity.java From NanoIconPackLite with Apache License 2.0 | 4 votes |
CateHolder(View itemView) { super(itemView); tvCate = (TextView) itemView.findViewWithTag("cate"); tvCount = (TextView) itemView.findViewWithTag("count"); }
Example 16
Source File: LiteIconActivityV2.java From NanoIconPackLite with Apache License 2.0 | 4 votes |
IconHolder(View itemView) { super(itemView); ivIcon = (ImageView) itemView.findViewWithTag("iv"); }
Example 17
Source File: AAH_CustomViewHolder.java From AutoplayVideos with Apache License 2.0 | 4 votes |
public AAH_CustomViewHolder(View x) { super(x); aah_vi = (AAH_VideoImage) x.findViewWithTag("aah_vi"); }
Example 18
Source File: SectionedAdapter.java From android-sectioned-adapter with MIT License | 4 votes |
SectionViewHolder(View itemView) { super(itemView); this.titleView = (TextView) itemView.findViewWithTag("TITLE"); }
Example 19
Source File: LayoutSpecVisibilityEventTesterSpec.java From litho with Apache License 2.0 | 4 votes |
@OnEvent(VisibleEvent.class) static void onVisible(ComponentContext c, @Prop View rootView, @Prop Output<View> foundView) { final View view = rootView.findViewWithTag("test_vt"); foundView.set(view); }
Example 20
Source File: GalleryActivity.java From Android-Application with GNU General Public License v3.0 | 4 votes |
public ViewHolder(View linearLayoutView) { super(linearLayoutView); image = (ImageView) linearLayoutView.findViewWithTag("image"); }