use of android.widget.LinearLayout in project NotificationPeekPort by lzanita09.
the class NotificationLayout method hideNotificationContent.
private void hideNotificationContent() {
if (!mContentShowing) {
// Content is already hidden.
return;
}
mContentShowing = false;
final ViewGroup peekView = (ViewGroup) getParent();
final View contentView = peekView.findViewById(R.id.notification_content);
LinearLayout contentTextLayout = (LinearLayout) contentView.findViewById(R.id.content_layout);
// Animations.
contentTextLayout.animate().translationY(50).setInterpolator(new AccelerateInterpolator()).start();
contentView.animate().alpha(0f).setInterpolator(new AccelerateInterpolator()).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
peekView.removeView(contentView);
}
}).start();
// Send broadcast to NotificationPeekActivity to let it show the components again.
Intent intent = new Intent(NotificationPeekActivity.NotificationPeekReceiver.ACTION_HIDE_CONTENT);
getContext().sendBroadcast(intent);
}
use of android.widget.LinearLayout in project AdvancedMaterialDrawer by madcyph3r.
the class FragmentActionBarButtons method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.example_action_bar_buttons, container, false);
setHasOptionsMenu(true);
LinearLayout ll = (LinearLayout) v.findViewById(R.id.linearLayout);
Button button = new Button(this.getActivity());
button.setText("show menu icon and unlock the drawer");
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
button.setLayoutParams(params);
button.setGravity(Gravity.CENTER);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
MaterialNavigationDrawer drawer = (MaterialNavigationDrawer) getActivity();
// show the menu button and unlock the drawer
drawer.showActionBarMenuIcon(MaterialNavigationDrawer.ActionBarMenuItem.MENU);
drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
}
});
Button button2 = new Button(this.getActivity());
button2.setText("hide menu icon and lock the drawer");
LinearLayout.LayoutParams params2 = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
button2.setLayoutParams(params2);
button2.setGravity(Gravity.CENTER);
button2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// hide the drawer button and lock the drawer to close
MaterialNavigationDrawer drawer = (MaterialNavigationDrawer) getActivity();
drawer.showActionBarMenuIcon(MaterialNavigationDrawer.ActionBarMenuItem.NONE);
drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
}
});
Button button3 = new Button(this.getActivity());
button3.setText("convert menu icon to back icon and lock the drawer");
LinearLayout.LayoutParams params3 = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
button3.setLayoutParams(params3);
button3.setGravity(Gravity.CENTER);
button3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// hide the drawer button and show the back button and lock the drawer to close
MaterialNavigationDrawer drawer = (MaterialNavigationDrawer) getActivity();
drawer.showActionBarMenuIcon(MaterialNavigationDrawer.ActionBarMenuItem.BACK);
drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
}
});
ll.addView(button);
ll.addView(button2);
ll.addView(button3);
return v;
}
use of android.widget.LinearLayout in project robolectric by robolectric.
the class ViewInnerTextTest method testInnerText.
@Test
public void testInnerText() throws Exception {
LinearLayout top = new LinearLayout(context);
top.addView(textView("blah"));
top.addView(new View(context));
top.addView(textView("a b c"));
LinearLayout innerLayout = new LinearLayout(context);
top.addView(innerLayout);
innerLayout.addView(textView("d e f"));
innerLayout.addView(textView("g h i"));
innerLayout.addView(textView(""));
innerLayout.addView(textView(null));
innerLayout.addView(textView("jkl!"));
top.addView(textView("mnop"));
assertEquals("blah a b c d e f g h i jkl! mnop", shadowOf(top).innerText());
}
use of android.widget.LinearLayout in project robolectric by robolectric.
the class ViewInnerTextTest method shouldOnlyIncludeViewTextViewsText.
@Test
public void shouldOnlyIncludeViewTextViewsText() throws Exception {
LinearLayout top = new LinearLayout(context);
top.addView(textView("blah", View.VISIBLE));
top.addView(textView("blarg", View.GONE));
top.addView(textView("arrg", View.INVISIBLE));
assertEquals("blah", shadowOf(top).innerText());
}
use of android.widget.LinearLayout in project robolectric by robolectric.
the class ViewStubTest method inflate_shouldReplaceOriginalWithLayout.
@Test
public void inflate_shouldReplaceOriginalWithLayout() throws Exception {
ViewStub viewStub = new ViewStub(ctxt);
int stubId = 12345;
int inflatedId = 12346;
viewStub.setId(stubId);
viewStub.setInflatedId(inflatedId);
viewStub.setLayoutResource(R.layout.media);
LinearLayout root = new LinearLayout(ctxt);
root.addView(new View(ctxt));
root.addView(viewStub);
root.addView(new View(ctxt));
View inflatedView = viewStub.inflate();
assertNotNull(inflatedView);
assertSame(inflatedView, root.findViewById(inflatedId));
assertNull(root.findViewById(stubId));
assertEquals(1, root.indexOfChild(inflatedView));
assertEquals(3, root.getChildCount());
}
Aggregations