Search in sources :

Example 41 with ViewStub

use of android.view.ViewStub in project facebook-api-android-maven by avianey.

the class GraphObjectAdapter method createGraphObjectView.

protected View createGraphObjectView(T graphObject) {
    View result = inflater.inflate(getGraphObjectRowLayoutId(graphObject), null);
    ViewStub checkboxStub = (ViewStub) result.findViewById(R.id.com_facebook_picker_checkbox_stub);
    if (checkboxStub != null) {
        if (!getShowCheckbox()) {
            checkboxStub.setVisibility(View.GONE);
        } else {
            CheckBox checkBox = (CheckBox) checkboxStub.inflate();
            updateCheckboxState(checkBox, false);
        }
    }
    ViewStub profilePicStub = (ViewStub) result.findViewById(R.id.com_facebook_picker_profile_pic_stub);
    if (!getShowPicture()) {
        profilePicStub.setVisibility(View.GONE);
    } else {
        ImageView imageView = (ImageView) profilePicStub.inflate();
        imageView.setVisibility(View.VISIBLE);
    }
    return result;
}
Also used : ViewStub(android.view.ViewStub) View(android.view.View)

Example 42 with ViewStub

use of android.view.ViewStub in project facebook-api-android-maven by avianey.

the class PickerFragment method inflateTitleBar.

private void inflateTitleBar(ViewGroup view) {
    ViewStub stub = (ViewStub) view.findViewById(R.id.com_facebook_picker_title_bar_stub);
    if (stub != null) {
        View titleBar = stub.inflate();
        final RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
        layoutParams.addRule(RelativeLayout.BELOW, R.id.com_facebook_picker_title_bar);
        listView.setLayoutParams(layoutParams);
        if (titleBarBackground != null) {
            titleBar.setBackgroundDrawable(titleBarBackground);
        }
        doneButton = (Button) view.findViewById(R.id.com_facebook_picker_done_button);
        if (doneButton != null) {
            doneButton.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    logAppEvents(true);
                    appEventsLogged = true;
                    if (onDoneButtonClickedListener != null) {
                        onDoneButtonClickedListener.onDoneButtonClicked(PickerFragment.this);
                    }
                }
            });
            if (getDoneButtonText() != null) {
                doneButton.setText(getDoneButtonText());
            }
            if (doneButtonBackground != null) {
                doneButton.setBackgroundDrawable(doneButtonBackground);
            }
        }
        titleTextView = (TextView) view.findViewById(R.id.com_facebook_picker_title);
        if (titleTextView != null) {
            if (getTitleText() != null) {
                titleTextView.setText(getTitleText());
            }
        }
    }
}
Also used : ViewStub(android.view.ViewStub) View(android.view.View)

Example 43 with ViewStub

use of android.view.ViewStub in project cardslib by gabrielemariotti.

the class TopColoredCard method setupInnerViewElements.

@Override
public void setupInnerViewElements(ViewGroup parent, View view) {
    //Use the title in super method
    super.setupInnerViewElements(parent, view);
    //Add a simple subtitle
    if (view != null) {
        ViewHolder holder = (ViewHolder) view.getTag();
        if (holder == null) {
            holder = new ViewHolder();
            holder.mLinearLayoutContainer = (LinearLayout) view.findViewById(R.id.card_main_inner_topcolored_layout);
            holder.mTitleView = (TextView) view.findViewById(R.id.card_main_inner_topcolored_title);
            holder.mSubTitleView = (TextView) view.findViewById(R.id.card_main_inner_topcolored_subtitle);
            View viewStub = ((View) getCardView()).findViewById(R.id.card_halfcolored_secondhalf);
            if (viewStub != null) {
                ((ViewStub) viewStub).setLayoutResource(mSecondHalfViewStubLayoutId);
                ((ViewStub) viewStub).inflate();
                holder.mSecondHalfView = ((View) getCardView()).findViewById(R.id.card_halfcolored_secondhalf_layout);
            }
            view.setTag(holder);
        }
        //Color the LinearLayout
        if (holder.mLinearLayoutContainer != null && mColorResourceId != 0) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
                holder.mLinearLayoutContainer.setBackgroundColor(mContext.getResources().getColor(mColorResourceId));
            else {
                ((CardViewNative) (getCardView())).setPreventCornerOverlap(false);
                GradientDrawable shapeDrawable = (GradientDrawable) (holder.mLinearLayoutContainer.getBackground());
                shapeDrawable.setColor(mContext.getResources().getColor(mColorResourceId));
            }
        }
        //Set the text elements
        buildTitleOverColor(holder);
        buildSubTitleOverColor(holder);
        //Set the second half area
        if (holder.mSecondHalfView != null && mSecondHalfViewStubLayoutId != 0) {
            setupInnerViewElementsSecondHalf(holder.mSecondHalfView);
        }
    }
}
Also used : ViewStub(android.view.ViewStub) TextView(android.widget.TextView) View(android.view.View) GradientDrawable(android.graphics.drawable.GradientDrawable) CardViewNative(it.gmariotti.cardslib.library.view.CardViewNative)

Example 44 with ViewStub

use of android.view.ViewStub in project facebook-android-sdk by facebook.

the class PickerFragment method inflateTitleBar.

private void inflateTitleBar(ViewGroup view) {
    ViewStub stub = (ViewStub) view.findViewById(R.id.com_facebook_picker_title_bar_stub);
    if (stub != null) {
        View titleBar = stub.inflate();
        final RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
        layoutParams.addRule(RelativeLayout.BELOW, R.id.com_facebook_picker_title_bar);
        listView.setLayoutParams(layoutParams);
        if (titleBarBackground != null) {
            titleBar.setBackgroundDrawable(titleBarBackground);
        }
        doneButton = (Button) view.findViewById(R.id.com_facebook_picker_done_button);
        if (doneButton != null) {
            doneButton.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    logAppEvents(true);
                    appEventsLogged = true;
                    if (onDoneButtonClickedListener != null) {
                        onDoneButtonClickedListener.onDoneButtonClicked(PickerFragment.this);
                    }
                }
            });
            if (getDoneButtonText() != null) {
                doneButton.setText(getDoneButtonText());
            }
            if (doneButtonBackground != null) {
                doneButton.setBackgroundDrawable(doneButtonBackground);
            }
        }
        titleTextView = (TextView) view.findViewById(R.id.com_facebook_picker_title);
        if (titleTextView != null) {
            if (getTitleText() != null) {
                titleTextView.setText(getTitleText());
            }
        }
    }
}
Also used : ViewStub(android.view.ViewStub) View(android.view.View)

Example 45 with ViewStub

use of android.view.ViewStub in project facebook-android-sdk by facebook.

the class GraphObjectAdapter method createGraphObjectView.

protected View createGraphObjectView(JSONObject graphObject) {
    View result = inflater.inflate(getGraphObjectRowLayoutId(graphObject), null);
    ViewStub checkboxStub = (ViewStub) result.findViewById(R.id.com_facebook_picker_checkbox_stub);
    if (checkboxStub != null) {
        if (!getShowCheckbox()) {
            checkboxStub.setVisibility(View.GONE);
        } else {
            CheckBox checkBox = (CheckBox) checkboxStub.inflate();
            updateCheckboxState(checkBox, false);
        }
    }
    ViewStub profilePicStub = (ViewStub) result.findViewById(R.id.com_facebook_picker_profile_pic_stub);
    if (!getShowPicture()) {
        profilePicStub.setVisibility(View.GONE);
    } else {
        ImageView imageView = (ImageView) profilePicStub.inflate();
        imageView.setVisibility(View.VISIBLE);
    }
    return result;
}
Also used : ViewStub(android.view.ViewStub) View(android.view.View)

Aggregations

ViewStub (android.view.ViewStub)79 View (android.view.View)46 UiThreadTest (android.test.UiThreadTest)18 MediumTest (android.test.suitebuilder.annotation.MediumTest)18 StubbedView (android.view.StubbedView)18 TextView (android.widget.TextView)8 StandaloneActionMode (com.actionbarsherlock.internal.view.StandaloneActionMode)7 ActionMode (com.actionbarsherlock.view.ActionMode)7 Context (android.content.Context)6 Resources (android.content.res.Resources)6 ContextThemeWrapper (android.view.ContextThemeWrapper)6 Animator (android.animation.Animator)5 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)5 ObjectAnimator (android.animation.ObjectAnimator)5 Paint (android.graphics.Paint)5 TypedValue (android.util.TypedValue)5 ActionMode (android.view.ActionMode)5 PopupWindow (android.widget.PopupWindow)5 FloatingActionMode (com.android.internal.view.FloatingActionMode)5 StandaloneActionMode (com.android.internal.view.StandaloneActionMode)5