Search in sources :

Example 86 with LinearLayout

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);
}
Also used : Animator(android.animation.Animator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) ViewGroup(android.view.ViewGroup) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) Intent(android.content.Intent) View(android.view.View) LinearLayout(android.widget.LinearLayout)

Example 87 with LinearLayout

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;
}
Also used : MaterialNavigationDrawer(de.madcyph3r.materialnavigationdrawer.MaterialNavigationDrawer) Button(android.widget.Button) View(android.view.View) LinearLayout(android.widget.LinearLayout)

Example 88 with LinearLayout

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());
}
Also used : TextView(android.widget.TextView) View(android.view.View) LinearLayout(android.widget.LinearLayout) Test(org.junit.Test)

Example 89 with LinearLayout

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());
}
Also used : LinearLayout(android.widget.LinearLayout) Test(org.junit.Test)

Example 90 with LinearLayout

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());
}
Also used : ViewStub(android.view.ViewStub) View(android.view.View) LinearLayout(android.widget.LinearLayout) Test(org.junit.Test)

Aggregations

LinearLayout (android.widget.LinearLayout)1205 View (android.view.View)473 TextView (android.widget.TextView)455 ViewGroup (android.view.ViewGroup)203 ImageView (android.widget.ImageView)196 Button (android.widget.Button)167 ScrollView (android.widget.ScrollView)125 ListView (android.widget.ListView)100 LayoutInflater (android.view.LayoutInflater)90 FrameLayout (android.widget.FrameLayout)85 Context (android.content.Context)80 AdapterView (android.widget.AdapterView)74 EditText (android.widget.EditText)74 Intent (android.content.Intent)66 AbsListView (android.widget.AbsListView)58 LayoutParams (android.widget.LinearLayout.LayoutParams)48 RelativeLayout (android.widget.RelativeLayout)48 Bitmap (android.graphics.Bitmap)46 OnClickListener (android.view.View.OnClickListener)44 Drawable (android.graphics.drawable.Drawable)42