Example usage for android.widget LinearLayout setPressed

List of usage examples for android.widget LinearLayout setPressed

Introduction

In this page you can find the example usage for android.widget LinearLayout setPressed.

Prototype

public void setPressed(boolean pressed) 

Source Link

Document

Sets the pressed state for this view.

Usage

From source file:com.juick.android.ThreadFragment.java

public void showThread(JuickMessage jmsg, boolean keepShow) {
    if (jmsg.getReplyTo() != 0) {
        JuickMessage reply = jmsg;//from w w w  .ja  v a2s.  co  m
        LinearLayout ll = new LinearLayout(getActivity());
        ll.setOrientation(LinearLayout.VERTICAL);
        ll.setBackgroundDrawable(new ColorDrawable(Color.WHITE));
        int totalCount = 0;
        while (reply != null) {
            totalCount += reply.Text.length();
            if (totalCount > 500 || ll.getChildCount() > 10)
                break;
            JuickMessagesAdapter.ParsedMessage parsedMessage = JuickMessagesAdapter
                    .formatMessageText(getActivity(), reply, true);
            TextView child = new TextView(getActivity());
            ll.addView(child, 0);
            child.setText(parsedMessage.textContent);
            if (reply.getReplyTo() < 1)
                break;
            reply = findReply(getListView(), reply.getReplyTo());
        }
        if (ll.getChildCount() != 0) {
            int xy[] = new int[2];
            getListView().getLocationOnScreen(xy);
            int windowHeight = getActivity().getWindow().getWindowManager().getDefaultDisplay().getHeight();
            int listBottom = getListView().getHeight() + xy[1];
            int bottomSize = windowHeight - listBottom;
            ll.setPressed(true);
            MainActivity.restyleChildrenOrWidget(ll);
            if (!keepShow || shownThreadToast.getView().getParent() == null) { // new or already hidden
                shownThreadToast = new Toast(getActivity());
                shownThreadToast.setView(ll);
                shownThreadToast.setGravity(Gravity.BOTTOM | Gravity.LEFT, 0, bottomSize);
                shownThreadToast.setDuration(Toast.LENGTH_LONG);
            }
            shownThreadToast.show();
        }
    }
}