Search in sources :

Example 61 with ViewStub

use of android.view.ViewStub in project platform_frameworks_base by android.

the class ViewStubTest method testInflatedLayoutParams.

@UiThreadTest
@MediumTest
public void testInflatedLayoutParams() throws Exception {
    final StubbedView activity = getActivity();
    final ViewStub stub = (ViewStub) activity.findViewById(R.id.viewStubWithId);
    final View swapped = stub.inflate();
    assertNotNull("The inflated view is null", swapped);
    assertEquals("Both stub and inflated should same width", stub.getLayoutParams().width, swapped.getLayoutParams().width);
    assertEquals("Both stub and inflated should same height", stub.getLayoutParams().height, swapped.getLayoutParams().height);
}
Also used : ViewStub(android.view.ViewStub) StubbedView(android.view.StubbedView) StubbedView(android.view.StubbedView) View(android.view.View) UiThreadTest(android.test.UiThreadTest) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 62 with ViewStub

use of android.view.ViewStub in project platform_frameworks_base by android.

the class ViewStubTest method testInflatedId.

@UiThreadTest
@MediumTest
public void testInflatedId() throws Exception {
    final StubbedView activity = getActivity();
    final ViewStub stub = (ViewStub) activity.findViewById(R.id.viewStubWithId);
    final View swapped = stub.inflate();
    assertNotNull("The inflated view is null", swapped);
    assertTrue("The inflated view has no id", swapped.getId() != View.NO_ID);
    assertTrue("The inflated view has the wrong id", swapped.getId() == R.id.stub_inflated);
}
Also used : ViewStub(android.view.ViewStub) StubbedView(android.view.StubbedView) StubbedView(android.view.StubbedView) View(android.view.View) UiThreadTest(android.test.UiThreadTest) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 63 with ViewStub

use of android.view.ViewStub in project openkit-android by OpenKit.

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 64 with ViewStub

use of android.view.ViewStub in project openkit-android by OpenKit.

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 65 with ViewStub

use of android.view.ViewStub in project android_frameworks_base by DirtyUnicorns.

the class PhoneStatusBar method initTickerView.

private void initTickerView() {
    if (mTickerEnabled != 0 && (mTicker == null || mTickerView == null)) {
        final ViewStub tickerStub = (ViewStub) mStatusBarView.findViewById(R.id.ticker_stub);
        if (tickerStub != null) {
            mTickerView = tickerStub.inflate();
            mTicker = new MyTicker(mContext, mStatusBarView);
            TickerView tickerView = (TickerView) mStatusBarView.findViewById(R.id.tickerText);
            tickerView.mTicker = mTicker;
        } else {
            mTickerEnabled = 0;
        }
    }
}
Also used : ViewStub(android.view.ViewStub) TickerView(com.android.systemui.statusbar.phone.TickerView)

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