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);
}
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);
}
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());
}
}
}
}
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;
}
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;
}
}
}
Aggregations