List of usage examples for android.view ViewGroup getMeasuredHeight
public final int getMeasuredHeight()
From source file:Main.java
public static void collapse(final ViewGroup v) { final int initialHeight = v.getMeasuredHeight(); Animation a = new Animation() { @Override//from w w w . j a v a 2 s . c om protected void applyTransformation(float interpolatedTime, Transformation t) { if (interpolatedTime == 1) { v.setVisibility(View.GONE); } else { v.getLayoutParams().height = initialHeight - (int) (initialHeight * interpolatedTime); v.setAlpha(1 - interpolatedTime); v.requestLayout(); } } @Override public boolean willChangeBounds() { return true; } }; a.setDuration((int) (initialHeight / v.getContext().getResources().getDisplayMetrics().density)); v.startAnimation(a); }
From source file:Main.java
public static void expand(final ViewGroup v) { v.measure(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); final int targetHeight = v.getMeasuredHeight(); // Older versions of android (pre API 21) cancel animations for views with a height of 0. v.getLayoutParams().height = 1;/*from w w w. ja v a2 s. c o m*/ v.setVisibility(View.VISIBLE); Animation a = new Animation() { @Override protected void applyTransformation(float interpolatedTime, Transformation t) { v.getLayoutParams().height = interpolatedTime == 1 ? ViewGroup.LayoutParams.WRAP_CONTENT : (int) (targetHeight * interpolatedTime); v.setAlpha(interpolatedTime); v.requestLayout(); } @Override public boolean willChangeBounds() { return true; } }; // 1dp/ms a.setDuration((int) (targetHeight / v.getContext().getResources().getDisplayMetrics().density)); v.startAnimation(a); }
From source file:com.taobao.luaview.view.adapter.LVPagerAdapter.java
/** * layout params??view?/*from www. ja v a 2 s .c o m*/ * * @param container * @return */ private RelativeLayout.LayoutParams createLayoutParams(ViewGroup container) { final RelativeLayout.LayoutParams layoutParams = LuaViewUtil.createRelativeLayoutParamsWM(); if (container != null) { layoutParams.width = container.getMeasuredWidth(); layoutParams.height = container.getMeasuredHeight(); } return layoutParams; }
From source file:arefin.dialogs.core.BaseDialogFragment.java
private boolean isScrollable(ViewGroup listView) { int totalHeight = 0; for (int i = 0; i < listView.getChildCount(); i++) { totalHeight += listView.getChildAt(i).getMeasuredHeight(); }/*from ww w .jav a 2 s . c o m*/ return listView.getMeasuredHeight() < totalHeight; }
From source file:org.onebusaway.android.ui.TripPlanActivity.java
@Override protected void onResume() { super.onResume(); Bundle bundle = mBuilder.getBundle(); boolean newItineraries = false; // see if there is data from intent Intent intent = getIntent();/* w w w . j a va 2 s .com*/ if (intent != null && intent.getExtras() != null) { OTPConstants.Source source = (OTPConstants.Source) intent .getSerializableExtra(OTPConstants.INTENT_SOURCE); if (source != null) { // Copy planning params - necessary if this intent came from a notification. if (source == OTPConstants.Source.NOTIFICATION) { new TripRequestBuilder(intent.getExtras()).copyIntoBundle(bundle); } ArrayList<Itinerary> itineraries = (ArrayList<Itinerary>) intent.getExtras() .getSerializable(OTPConstants.ITINERARIES); if (itineraries != null) { bundle.putSerializable(OTPConstants.ITINERARIES, itineraries); newItineraries = true; } if (intent.getIntExtra(PLAN_ERROR_CODE, -1) != -1) { bundle.putSerializable(SHOW_ERROR_DIALOG, true); bundle.putInt(PLAN_ERROR_CODE, intent.getIntExtra(PLAN_ERROR_CODE, 0)); bundle.putString(PLAN_ERROR_URL, intent.getStringExtra(PLAN_ERROR_URL)); } setIntent(null); bundle.putBoolean(REQUEST_LOADING, false); mRequestLoading = false; } } if (mRequestLoading || bundle.getBoolean(REQUEST_LOADING)) { showProgressDialog(); } // Check which fragment to create boolean haveTripPlan = bundle.getSerializable(OTPConstants.ITINERARIES) != null; TripPlanFragment fragment = (TripPlanFragment) getSupportFragmentManager() .findFragmentById(R.id.trip_plan_fragment_container); if (fragment == null) { fragment = new TripPlanFragment(); fragment.setArguments(bundle); fragment.setListener(this); getSupportFragmentManager().beginTransaction().add(R.id.trip_plan_fragment_container, fragment) .commit(); } mPanel = (SlidingUpPanelLayout) findViewById(R.id.trip_plan_sliding_layout); mPanel.setEnabled(haveTripPlan); if (haveTripPlan) { initResultsFragment(); if (bundle.getBoolean(PANEL_STATE_EXPANDED) || newItineraries) { mPanel.setPanelState(SlidingUpPanelLayout.PanelState.EXPANDED); } } // show error dialog if necessary if (bundle.getBoolean(SHOW_ERROR_DIALOG)) { int planErrorCode = intent.getIntExtra(PLAN_ERROR_CODE, 0); String planErrorUrl = intent.getStringExtra(PLAN_ERROR_URL); showFeedbackDialog(planErrorCode, planErrorUrl); } if (fragment != null && intent != null) { fragment.setPlanErrorUrl(intent.getStringExtra(PLAN_ERROR_URL)); fragment.setPlanRequestUrl(intent.getStringExtra(PLAN_REQUEST_URL)); } // Set the height of the panel after drawing occurs. final ViewGroup layout = (ViewGroup) findViewById(R.id.trip_plan_fragment_container); ViewTreeObserver vto = layout.getViewTreeObserver(); vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { layout.getViewTreeObserver().removeGlobalOnLayoutListener(this); int viewHeight = mPanel.getHeight(); int height = layout.getMeasuredHeight(); mPanel.setPanelHeight(viewHeight - height); } }); }
From source file:com.achep.header2actionbar.HeaderFragmentSupportV4.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Activity activity = getActivity(); assert activity != null; mFrameLayout = new FrameLayout(activity); mHeader = onCreateHeaderView(inflater, mFrameLayout); mHeaderHeader = mHeader.findViewById(android.R.id.title); mHeaderBackground = mHeader.findViewById(android.R.id.background); assert mHeader.getLayoutParams() != null; mHeader.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)); mHeaderHeight = mHeader.getMeasuredHeight(); mFakeHeader = new Space(activity); View content = onCreateContentView(inflater, mFrameLayout); mContentView = content;// w ww . ja va 2s. co m Log.i(TAG, "container:" + container.getMeasuredHeight() + ",mHeaderHeight=" + mHeaderHeight); final View topContentView = container; if (content instanceof ListView) { isListViewEmpty = true; final ListView listView = (ListView) content; mFakeHeader.setLayoutParams(new ListView.LayoutParams(0, mHeaderHeight)); listView.addHeaderView(mFakeHeader); listView.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView absListView, int scrollState) { if (mOnScrollListener != null) { mOnScrollListener.onScrollStateChanged(absListView, scrollState); } } @Override public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (isListViewEmpty) { scrollHeaderTo(0); } else { final View child = absListView.getChildAt(0); assert child != null; scrollHeaderTo(child == mFakeHeader ? child.getTop() : -mHeaderHeight); } } }); } else { topContentView.getViewTreeObserver() .addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @SuppressWarnings("deprecation") @Override public void onGlobalLayout() { //Remove it here unless you want to get this callback for EVERY //layout pass, which can get you into infinite loops if you ever //modify the layout from within this method. topContentView.getViewTreeObserver().removeGlobalOnLayoutListener(this); //Now you can get the width and height from content int actionBarHeight = 0; TypedValue tv = new TypedValue(); if (getActivity().getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) { actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, getResources().getDisplayMetrics()); } Log.i(TAG, "topContentView:" + topContentView.getHeight() + ", actionBarHeight:" + actionBarHeight + ", getStatusBarHeight:" + getStatusBarHeight()); ViewGroup.LayoutParams lp = mContentView.getLayoutParams(); lp.height = topContentView.getHeight() - actionBarHeight - getStatusBarHeight(); mContentView.setLayoutParams(lp); } }); // Merge fake header view and content view. final LinearLayout view = new LinearLayout(activity); view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); view.setOrientation(LinearLayout.VERTICAL); mFakeHeader.setLayoutParams(new LinearLayout.LayoutParams(0, mHeaderHeight)); view.addView(mFakeHeader); view.addView(content); // Put merged content to ScrollView final NotifyingScrollView scrollView = new NotifyingScrollView(activity); scrollView.addView(view); scrollView.setVerticalScrollBarEnabled(false); scrollView.setOverScrollMode(ScrollView.OVER_SCROLL_NEVER); scrollView.setOnScrollChangedListener(new NotifyingScrollView.OnScrollChangedListener() { @Override public void onScrollChanged(ScrollView who, int l, int t, int oldl, int oldt) { Log.i(TAG, "onScrollChanged scroll ot -t :" + (-t)); scrollHeaderTo(-t); } }); mContentWrapper = scrollView; content = scrollView; } mFrameLayout.addView(content); mFrameLayout.addView(mHeader); // Content overlay view always shows at the top of content. if ((mContentOverlay = onCreateContentOverlayView(inflater, mFrameLayout)) != null) { mFrameLayout.addView(mContentOverlay, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); } // Post initial scroll mFrameLayout.post(new Runnable() { @Override public void run() { Log.i(TAG, "post initial scroll to 0"); // SEAN: walk around for scroll position bug if (mContentWrapper != null) { mContentWrapper.scrollTo(0, 0); } scrollHeaderTo(0, true); } }); return mFrameLayout; }
From source file:com.waz.zclient.pages.main.participants.dialog.ParticipantsDialogFragment.java
private void adjustAccordingToAnchor() { Bundle bundle = getArguments();//from w w w . j a va 2 s . co m if (bundle == null || getView() == null) { return; } View view = getView(); ViewGroup viewGroup = (ViewGroup) view.getParent(); Rect rect = bundle.getParcelable(ARG_ANCHOR_RECT); int posX = bundle.getInt(ARG_POS_X); int posY = bundle.getInt(ARG_POS_Y); final int widthSpec = View.MeasureSpec.makeMeasureSpec( viewGroup.getMeasuredWidth() - viewGroup.getPaddingLeft() - viewGroup.getPaddingRight(), View.MeasureSpec.AT_MOST); final int heightSpec = View.MeasureSpec.makeMeasureSpec( viewGroup.getMeasuredHeight() - viewGroup.getPaddingTop() - viewGroup.getPaddingBottom(), View.MeasureSpec.AT_MOST); view.measure(widthSpec, heightSpec); ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) dialogFrameLayout .getLayoutParams(); int rootHeight = dialogFrameLayout.getMeasuredHeight(); int rootWidth = dialogFrameLayout.getMeasuredWidth(); int dialogHeight = rootHeight + layoutParams.bottomMargin + layoutParams.topMargin; int dialogWidth = rootWidth + layoutParams.leftMargin + layoutParams.rightMargin; setDialogPosition(rect, posX, posY, dialogWidth, dialogHeight); }
From source file:com.android.mail.browse.ConversationItemViewCoordinates.java
private ConversationItemViewCoordinates(final Context context, final Config config, final CoordinatesCache cache) { Utils.traceBeginSection("CIV coordinates constructor"); final Resources res = context.getResources(); final int layoutId = R.layout.conversation_item_view; ViewGroup view = (ViewGroup) cache.getView(layoutId); if (view == null) { view = (ViewGroup) LayoutInflater.from(context).inflate(layoutId, null); cache.put(layoutId, view);//www . j av a2 s. c om } // Show/hide optional views before measure/layout call final TextView folders = (TextView) view.findViewById(R.id.folders); folders.setVisibility(config.areFoldersVisible() ? View.VISIBLE : View.GONE); View contactImagesView = view.findViewById(R.id.contact_image); switch (config.getGadgetMode()) { case GADGET_CONTACT_PHOTO: contactImagesView.setVisibility(View.VISIBLE); break; case GADGET_CHECKBOX: contactImagesView.setVisibility(View.GONE); contactImagesView = null; break; default: contactImagesView.setVisibility(View.GONE); contactImagesView = null; break; } final View replyState = view.findViewById(R.id.reply_state); replyState.setVisibility(config.isReplyStateVisible() ? View.VISIBLE : View.GONE); final View personalIndicator = view.findViewById(R.id.personal_indicator); personalIndicator.setVisibility(config.isPersonalIndicatorVisible() ? View.VISIBLE : View.GONE); setFramePadding(context, view, config.useFullPadding()); // Layout the appropriate view. ViewCompat.setLayoutDirection(view, config.getLayoutDirection()); final int widthSpec = MeasureSpec.makeMeasureSpec(config.getWidth(), MeasureSpec.EXACTLY); final int heightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED); view.measure(widthSpec, heightSpec); view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight()); // Once the view is measured, let's calculate the dynamic width variables. folderLayoutWidth = (int) (view.getWidth() * res.getInteger(R.integer.folder_max_width_proportion) / 100.0); folderCellWidth = (int) (view.getWidth() * res.getInteger(R.integer.folder_cell_max_width_proportion) / 100.0); // Utils.dumpViewTree((ViewGroup) view); // Records coordinates. // Contact images view if (contactImagesView != null) { contactImagesWidth = contactImagesView.getWidth(); contactImagesHeight = contactImagesView.getHeight(); contactImagesX = getX(contactImagesView); contactImagesY = getY(contactImagesView); } else { contactImagesX = contactImagesY = contactImagesWidth = contactImagesHeight = 0; } final boolean isRtl = ViewUtils.isViewRtl(view); final View star = view.findViewById(R.id.star); final int starPadding = res.getDimensionPixelSize(R.dimen.conv_list_star_padding_start); starX = getX(star) + (isRtl ? 0 : starPadding); starY = getY(star); starWidth = star.getWidth(); final TextView senders = (TextView) view.findViewById(R.id.senders); final int sendersTopAdjust = getLatinTopAdjustment(senders); sendersX = getX(senders); sendersY = getY(senders) + sendersTopAdjust; sendersWidth = senders.getWidth(); sendersHeight = senders.getHeight(); sendersLineCount = SINGLE_LINE; sendersFontSize = senders.getTextSize(); final TextView subject = (TextView) view.findViewById(R.id.subject); final int subjectTopAdjust = getLatinTopAdjustment(subject); subjectX = getX(subject); subjectY = getY(subject) + subjectTopAdjust; subjectWidth = subject.getWidth(); subjectHeight = subject.getHeight(); subjectFontSize = subject.getTextSize(); final TextView snippet = (TextView) view.findViewById(R.id.snippet); final int snippetTopAdjust = getLatinTopAdjustment(snippet); snippetX = getX(snippet); snippetY = getY(snippet) + snippetTopAdjust; maxSnippetWidth = snippet.getWidth(); snippetHeight = snippet.getHeight(); snippetFontSize = snippet.getTextSize(); if (config.areFoldersVisible()) { foldersLeft = getX(folders); foldersRight = foldersLeft + folders.getWidth(); foldersY = getY(folders); foldersTypeface = folders.getTypeface(); foldersFontSize = folders.getTextSize(); } else { foldersLeft = 0; foldersRight = 0; foldersY = 0; foldersTypeface = null; foldersFontSize = 0; } final View colorBlock = view.findViewById(R.id.color_block); if (config.isColorBlockVisible() && colorBlock != null) { colorBlockX = getX(colorBlock); colorBlockY = getY(colorBlock); colorBlockWidth = colorBlock.getWidth(); colorBlockHeight = colorBlock.getHeight(); } else { colorBlockX = colorBlockY = colorBlockWidth = colorBlockHeight = 0; } if (config.isReplyStateVisible()) { replyStateX = getX(replyState); replyStateY = getY(replyState); } else { replyStateX = replyStateY = 0; } if (config.isPersonalIndicatorVisible()) { personalIndicatorX = getX(personalIndicator); personalIndicatorY = getY(personalIndicator); } else { personalIndicatorX = personalIndicatorY = 0; } final View infoIcon = view.findViewById(R.id.info_icon); infoIconX = getX(infoIcon); infoIconXRight = infoIconX + infoIcon.getWidth(); infoIconY = getY(infoIcon); final TextView date = (TextView) view.findViewById(R.id.date); dateX = getX(date); dateXRight = dateX + date.getWidth(); dateY = getY(date); datePaddingStart = ViewUtils.getPaddingStart(date); dateFontSize = date.getTextSize(); dateYBaseline = dateY + getLatinTopAdjustment(date) + date.getBaseline(); final View paperclip = view.findViewById(R.id.paperclip); paperclipY = getY(paperclip); paperclipPaddingStart = ViewUtils.getPaddingStart(paperclip); height = view.getHeight() + sendersTopAdjust; Utils.traceEndSection(); }
From source file:com.tct.mail.browse.ConversationItemViewCoordinates.java
private ConversationItemViewCoordinates(final Context context, final Config config, final CoordinatesCache cache) { Utils.traceBeginSection("CIV coordinates constructor"); final Resources res = context.getResources(); mMinListWidthForWide = res.getDimensionPixelSize(R.dimen.list_min_width_is_wide); mMode = calculateMode(res, config);//from ww w . j a va2 s .c om final int layoutId = R.layout.conversation_item_view; ViewGroup view = (ViewGroup) cache.getView(layoutId); if (view == null) { view = (ViewGroup) LayoutInflater.from(context).inflate(layoutId, null); cache.put(layoutId, view); } // Show/hide optional views before measure/layout call final TextView folders = (TextView) view.findViewById(R.id.folders); folders.setVisibility(config.areFoldersVisible() ? View.VISIBLE : View.GONE); View contactImagesView = view.findViewById(R.id.contact_image); switch (config.getGadgetMode()) { case GADGET_CONTACT_PHOTO: contactImagesView.setVisibility(View.VISIBLE); break; case GADGET_CHECKBOX: contactImagesView.setVisibility(View.GONE); contactImagesView = null; break; default: contactImagesView.setVisibility(View.GONE); contactImagesView = null; break; } final View replyState = view.findViewById(R.id.reply_state); replyState.setVisibility(config.isReplyStateVisible() ? View.VISIBLE : View.GONE); final View personalIndicator = view.findViewById(R.id.personal_indicator); personalIndicator.setVisibility(config.isPersonalIndicatorVisible() ? View.VISIBLE : View.GONE); setFramePadding(context, view, config.useFullPadding()); // Layout the appropriate view. ViewCompat.setLayoutDirection(view, config.getLayoutDirection()); final int widthSpec = MeasureSpec.makeMeasureSpec(config.getWidth(), MeasureSpec.EXACTLY); final int heightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED); view.measure(widthSpec, heightSpec); view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight()); // Once the view is measured, let's calculate the dynamic width variables. folderLayoutWidth = (int) (view.getWidth() * res.getInteger(R.integer.folder_max_width_proportion) / 100.0); folderCellWidth = (int) (view.getWidth() * res.getInteger(R.integer.folder_cell_max_width_proportion) / 100.0); // Utils.dumpViewTree((ViewGroup) view); // Records coordinates. // Contact images view if (contactImagesView != null) { contactImagesWidth = contactImagesView.getWidth(); contactImagesHeight = contactImagesView.getHeight(); contactImagesX = getX(contactImagesView); contactImagesY = getY(contactImagesView); } else { contactImagesX = contactImagesY = contactImagesWidth = contactImagesHeight = 0; } final boolean isRtl = ViewUtils.isViewRtl(view); final View star = view.findViewById(R.id.star); final int starPadding = res.getDimensionPixelSize(R.dimen.conv_list_star_padding_start); starX = getX(star) + (isRtl ? 0 : starPadding); starY = getY(star); starWidth = star.getWidth(); final TextView senders = (TextView) view.findViewById(R.id.senders); final int sendersTopAdjust = getLatinTopAdjustment(senders); sendersX = getX(senders); sendersY = getY(senders) + sendersTopAdjust; sendersWidth = senders.getWidth(); sendersHeight = senders.getHeight(); sendersLineCount = SINGLE_LINE; sendersFontSize = senders.getTextSize(); final TextView subject = (TextView) view.findViewById(R.id.subject); final int subjectTopAdjust = getLatinTopAdjustment(subject); subjectX = getX(subject); subjectY = getY(subject) + subjectTopAdjust; subjectWidth = subject.getWidth(); subjectHeight = subject.getHeight(); subjectFontSize = subject.getTextSize(); // TS: chao.zhang 2015-09-14 EMAIL FEATURE-585337 ADD_S final TextView status = (TextView) view.findViewById(R.id.status); final int statusTopAdjust = getLatinTopAdjustment(status); statusX = getX(status); statusY = getY(status) + statusTopAdjust; statusWidth = status.getWidth(); statusHeight = status.getHeight(); statusFontSize = status.getTextSize(); statusPaddingStart = ViewUtils.getPaddingStart(status); statusPanddingEnd = ViewUtils.getPaddingEnd(status); // TS: chao.zhang 2015-09-14 EMAIL FEATURE-585337 ADD_E final TextView snippet = (TextView) view.findViewById(R.id.snippet); final int snippetTopAdjust = getLatinTopAdjustment(snippet); snippetX = getX(snippet); snippetY = getY(snippet) + snippetTopAdjust; maxSnippetWidth = snippet.getWidth(); snippetHeight = snippet.getHeight(); snippetFontSize = snippet.getTextSize(); if (config.areFoldersVisible()) { // vertically align folders min left edge with subject foldersLeft = getX(folders); foldersRight = foldersLeft + folders.getWidth(); foldersY = getY(folders) + sendersTopAdjust; foldersHeight = folders.getHeight(); foldersTypeface = folders.getTypeface(); foldersTextBottomPadding = res.getDimensionPixelSize(R.dimen.folders_text_bottom_padding); foldersFontSize = folders.getTextSize(); } else { foldersLeft = 0; foldersRight = 0; foldersY = 0; foldersHeight = 0; foldersTypeface = null; foldersTextBottomPadding = 0; foldersFontSize = 0; } final View colorBlock = view.findViewById(R.id.color_block); if (config.isColorBlockVisible() && colorBlock != null) { colorBlockX = getX(colorBlock); colorBlockY = getY(colorBlock); colorBlockWidth = colorBlock.getWidth(); colorBlockHeight = colorBlock.getHeight(); } else { colorBlockX = colorBlockY = colorBlockWidth = colorBlockHeight = 0; } if (config.isReplyStateVisible()) { replyStateX = getX(replyState); replyStateY = getY(replyState); } else { replyStateX = replyStateY = 0; } if (config.isPersonalIndicatorVisible()) { personalIndicatorX = getX(personalIndicator); personalIndicatorY = getY(personalIndicator); } else { personalIndicatorX = personalIndicatorY = 0; } final View infoIcon = view.findViewById(R.id.info_icon); infoIconX = getX(infoIcon); infoIconXRight = infoIconX + infoIcon.getWidth(); infoIconY = getY(infoIcon); final TextView date = (TextView) view.findViewById(R.id.date); dateX = getX(date); dateXRight = dateX + date.getWidth(); dateY = getY(date); datePaddingStart = ViewUtils.getPaddingStart(date); dateFontSize = date.getTextSize(); dateYBaseline = dateY + getLatinTopAdjustment(date) + date.getBaseline(); final View paperclip = view.findViewById(R.id.paperclip); paperclipY = getY(paperclip); paperclipPaddingStart = ViewUtils.getPaddingStart(paperclip); height = view.getHeight() + sendersTopAdjust; Utils.traceEndSection(); }
From source file:com.juick.android.JuickMessagesAdapter.java
public void recycleView(View view) { if (view instanceof ViewGroup) { ListRowRuntime lrr = (ListRowRuntime) view.getTag(); if (lrr != null) { if (lrr.userpicListener != null) { lrr.removeListenerIfExists(); }//ww w .j a va2s.c o m } ViewGroup vg = (ViewGroup) view; if (vg.getChildCount() > 1 && vg.getChildAt(1) instanceof ImageGallery && vg instanceof PressableLinearLayout) { PressableLinearLayout pll = (PressableLinearLayout) vg; // our view ImageGallery gallery = (ImageGallery) vg.getChildAt(1); Object tag = gallery.getTag(); if (tag instanceof HashMap) { HashMap<Integer, ImageLoaderConfiguration> loaders = (HashMap<Integer, ImageLoaderConfiguration>) tag; for (ImageLoaderConfiguration imageLoader : loaders.values()) { imageLoader.loader.terminate(); } } pll.blockLayoutRequests = true; gallery.cleanup(); gallery.setTag(null); vg.removeViewAt(1); vg.measure(View.MeasureSpec.makeMeasureSpec(vg.getRight() - vg.getLeft(), View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)); vg.layout(vg.getLeft(), vg.getTop(), vg.getRight(), vg.getTop() + vg.getMeasuredHeight()); pll.blockLayoutRequests = false; } } }