Example usage for android.widget LinearLayout setVisibility

List of usage examples for android.widget LinearLayout setVisibility

Introduction

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

Prototype

@RemotableViewMethod
public void setVisibility(@Visibility int visibility) 

Source Link

Document

Set the visibility state of this view.

Usage

From source file:org.safegees.safegees.gui.fragment.ProfileContactFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.fragment_profile_contact, container, false);

    ArrayList<Friend> friends = SafegeesDAO.getInstance(view.getContext()).getMutualFriends();

    Friend friend = friends.get(position);

    //this.getActivity().onBackPressed();

    //ImageButton closeContact = (ImageButton) view.findViewById(R.id.close_contact);
    //closeContact.setOnClickListener(this);

    imageView = (ImageView) view.findViewById(R.id.result);
    editName = (EditText) view.findViewById(R.id.editName);
    editSurname = (EditText) view.findViewById(R.id.editSurname);
    editEmail = (EditText) view.findViewById(R.id.editEmail);
    editPhone = (EditText) view.findViewById(R.id.editPhone);
    editTopic = (TextView) view.findViewById(R.id.editTopic);

    LinearLayout llName = (LinearLayout) view.findViewById(R.id.lay_name);
    LinearLayout llSurname = (LinearLayout) view.findViewById(R.id.lay_surname);
    LinearLayout llMail = (LinearLayout) view.findViewById(R.id.lay_mail);
    LinearLayout llPhone = (LinearLayout) view.findViewById(R.id.lay_phone);
    //LinearLayout llBio = (LinearLayout) view.findViewById(R.id.lay_topic);

    //Show arrows to reveal user if there are more contacts
    ImageView arrowLeft = (ImageView) view.findViewById(R.id.contact_left);
    ImageView arrowRight = (ImageView) view.findViewById(R.id.contact_right);

    //Change arrows if Language is LTR (Ar or FA)
    //And reveal the accurate arrow
    if (TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL) {
        arrowLeft.setBackgroundResource(R.drawable.ic_chevron_right_black_24dp);
        arrowRight.setBackgroundResource(R.drawable.ic_chevron_left_black_24dp);
        if (position == 0)
            arrowRight.setVisibility(View.INVISIBLE);
        if (position == friends.size() - 1)
            arrowLeft.setVisibility(View.INVISIBLE);
    } else {//ww  w  . j  a  va 2 s . c o m
        if (position == 0)
            arrowLeft.setVisibility(View.INVISIBLE);
        if (position == friends.size() - 1)
            arrowRight.setVisibility(View.INVISIBLE);
    }

    if (friend != null) {
        this.editName.setText(friend.getName() != null ? friend.getName() : "");
        this.editSurname.setText(friend.getSurname() != null ? friend.getSurname() : "");
        this.editEmail.setText(friend.getPublicEmail() != null ? friend.getPublicEmail() : "");
        this.editPhone.setText(friend.getPhoneNumber() != null ? friend.getPhoneNumber() : "");
        this.editTopic.setText(friend.getBio() != null ? "\"" + friend.getBio() + "\"" : "");
        ViewGroup.LayoutParams params = editTopic.getLayoutParams();
        params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
        editTopic.setLayoutParams(params);
    }

    if (friend.getName() == null || friend.getName().equals(""))
        llName.setVisibility(View.GONE);
    if (friend.getSurname() == null || friend.getSurname().equals(""))
        llSurname.setVisibility(View.GONE);
    if (friend.getPublicEmail() == null || friend.getPublicEmail().equals(""))
        llMail.setVisibility(View.GONE);
    if (friend.getPhoneNumber() == null || friend.getPhoneNumber().equals(""))
        llPhone.setVisibility(View.GONE);
    if (friend.getBio() == null || friend.getBio().equals(""))
        editTopic.setVisibility(View.GONE);

    //Add image from friend
    if (friend.getPublicEmail() != null) {
        Bitmap bitmap = ImageController.getContactImageBitmap(getContext(), friend.getPublicEmail());
        if (bitmap != null)
            this.imageView.setImageBitmap(bitmap);
    }

    // Inflate the layout for this fragment
    return view;
}

From source file:com.hybris.mobile.app.commerce.helper.OrderHelper.java

/**
 * Populate the order summary//  w  w  w .  ja v  a 2 s .c  om
 *
 * @param order
 */
public static void createOrderSummary(Activity activity, Order order) {

    LinearLayout mOrderSummaryItemsLayout;
    TextView mOrderSummaryItems;
    TextView mOrderSummarySubtotal;
    TextView mOrderSummarySavings;
    TextView mOrderSummaryTax;
    TextView mOrderSummaryShipping;
    TextView mOrderSummaryTotal;
    TextView mOrderSummaryPromotion;
    TableRow mOrderSummarySavingsRow;

    // order summary
    mOrderSummaryItemsLayout = (LinearLayout) activity.findViewById(R.id.order_summary_items_layout);
    mOrderSummaryItems = (TextView) activity.findViewById(R.id.order_summary_items);
    mOrderSummarySubtotal = (TextView) activity.findViewById(R.id.order_summary_subtotal);
    mOrderSummarySavings = (TextView) activity.findViewById(R.id.order_summary_savings);
    mOrderSummaryTax = (TextView) activity.findViewById(R.id.order_summary_tax);
    mOrderSummaryShipping = (TextView) activity.findViewById(R.id.order_summary_shipping);
    mOrderSummaryTotal = (TextView) activity.findViewById(R.id.order_summary_total);
    mOrderSummaryPromotion = (TextView) activity.findViewById(R.id.order_summary_promotion);
    mOrderSummarySavingsRow = (TableRow) activity.findViewById(R.id.order_summary_savings_row);

    if (order != null) {

        populatePromotions(order);

        // Display total price
        if (order.getTotalPrice() != null) {
            mOrderSummaryTotal.setText(order.getTotalPrice().getFormattedValue());
        }

        // Display subtotal price
        if (order.getSubTotal() != null) {
            mOrderSummarySubtotal.setText(order.getSubTotal().getFormattedValue());
        }

        // Display tax price
        if (order.getTotalTax() != null) {
            mOrderSummaryTax.setText(order.getTotalTax().getFormattedValue());
        }

        // Display delivery method cost
        if (order.getDeliveryCost() != null) {
            mOrderSummaryShipping.setText(order.getDeliveryCost().getFormattedValue());
        }

        if (order.getAppliedOrderPromotions() != null && !order.getAppliedOrderPromotions().isEmpty()) {
            if (StringUtils.isNotBlank(order.getOrderDiscounts().getFormattedValue())) {
                mOrderSummarySavingsRow.setVisibility(View.VISIBLE);
                mOrderSummarySavings.setText(order.getOrderDiscounts().getFormattedValue());
            }
        }

        if (order.getAppliedOrderPromotions() != null || order.getAppliedProductPromotions() != null) {
            if (order.getAppliedProductPromotions() != null && !order.getAppliedProductPromotions().isEmpty()) {
                mOrderSummaryPromotion.setVisibility(View.VISIBLE);
                // Nb order Promotion
                StringBuffer promotion = new StringBuffer();

                if (order.getAppliedOrderPromotions() != null && !order.getAppliedOrderPromotions().isEmpty()) {
                    for (PromotionResult orderPromotion : order.getAppliedOrderPromotions()) {
                        promotion.append(orderPromotion.getDescription()).append("\n");
                    }
                }

                mOrderSummaryPromotion.setText(promotion);
            } else {
                mOrderSummaryPromotion.setVisibility(View.GONE);
            }
        } else {
            mOrderSummaryPromotion.setVisibility(View.GONE);
            mOrderSummarySavingsRow.setVisibility(View.GONE);
        }

        // Nb items
        mOrderSummaryItemsLayout.setVisibility(View.VISIBLE);
        mOrderSummaryItems
                .setText(activity.getString(R.string.order_summary_items, order.getDeliveryItemsQuantity()));
    }
}

From source file:com.android.argb.edhlc.Utils.java

public static void createRecordListElement(Activity parent, Record currentRecord,
        String highlightedPlayerName) {
    TextView textDateRecordCard = (TextView) parent.findViewById(R.id.textDateRecordCard);
    LinearLayout linearFirstLineRecordCard = (LinearLayout) parent.findViewById(R.id.linearFirstLineRecordCard);
    TextView textFirstIndicatorRecordCard = (TextView) parent.findViewById(R.id.textFirstIndicatorRecordCard);
    TextView textFirstPlayerRecordCard = (TextView) parent.findViewById(R.id.textFirstPlayerRecordCard);
    TextView textFirstDeckRecordCard = (TextView) parent.findViewById(R.id.textFirstDeckRecordCard);

    View divider1RecordCard = parent.findViewById(R.id.divider1RecordCard);

    LinearLayout linearSecondLineRecordCard = (LinearLayout) parent
            .findViewById(R.id.linearSecondLineRecordCard);
    TextView textSecondIndicatorRecordCard = (TextView) parent.findViewById(R.id.textSecondIndicatorRecordCard);
    TextView textSecondPlayerRecordCard = (TextView) parent.findViewById(R.id.textSecondPlayerRecordCard);
    TextView textSecondDeckRecordCard = (TextView) parent.findViewById(R.id.textSecondDeckRecordCard);

    View divider2RecordCard = parent.findViewById(R.id.divider2RecordCard);

    LinearLayout linearThirdLineRecordCard = (LinearLayout) parent.findViewById(R.id.linearThirdLineRecordCard);
    TextView textThirdIndicatorRecordCard = (TextView) parent.findViewById(R.id.textThirdIndicatorRecordCard);
    TextView textThirdPlayerRecordCard = (TextView) parent.findViewById(R.id.textThirdPlayerRecordCard);
    TextView textThirdDeckRecordCard = (TextView) parent.findViewById(R.id.textThirdDeckRecordCard);

    View divider3RecordCard = parent.findViewById(R.id.divider3RecordCard);

    LinearLayout linearFourthLineRecordCard = (LinearLayout) parent
            .findViewById(R.id.linearFourthLineRecordCard);
    TextView textFourthIndicatorRecordCard = (TextView) parent.findViewById(R.id.textFourthIndicatorRecordCard);
    TextView textFourthPlayerRecordCard = (TextView) parent.findViewById(R.id.textFourthPlayerRecordCard);
    TextView textFourthDeckRecordCard = (TextView) parent.findViewById(R.id.textFourthDeckRecordCard);

    Typeface typefaceMedium = Typeface.create("sans-serif-medium", Typeface.NORMAL);
    Typeface typefaceNormal = Typeface.create("sans-serif", Typeface.NORMAL);
    int colorAccent = ContextCompat.getColor(parent, R.color.accent_color);
    int colorSecondary = ContextCompat.getColor(parent, R.color.secondary_text);

    textDateRecordCard.setText(String.format("Played on %s", currentRecord.getDate()));

    switch (currentRecord.getTotalPlayers()) {
    case 2:/*from w  w  w  .ja  v  a 2 s  . c  o  m*/
        linearFirstLineRecordCard.setVisibility(View.VISIBLE);
        linearSecondLineRecordCard.setVisibility(View.VISIBLE);
        linearThirdLineRecordCard.setVisibility(View.GONE);
        linearFourthLineRecordCard.setVisibility(View.GONE);

        divider1RecordCard.setVisibility(View.VISIBLE);
        divider2RecordCard.setVisibility(View.GONE);
        divider3RecordCard.setVisibility(View.GONE);

        textFirstDeckRecordCard.setText(currentRecord.getFirstPlace().getDeckName());
        textFirstPlayerRecordCard.setText(currentRecord.getFirstPlace().getDeckOwnerName());

        textSecondDeckRecordCard.setText(currentRecord.getSecondPlace().getDeckName());
        textSecondPlayerRecordCard.setText(currentRecord.getSecondPlace().getDeckOwnerName());

        if (highlightedPlayerName != null) {
            textFirstDeckRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textFirstPlayerRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textFirstIndicatorRecordCard.setTextColor(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? colorAccent
                            : colorSecondary);
            textFirstIndicatorRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);

            textSecondDeckRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textSecondPlayerRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textSecondIndicatorRecordCard.setTextColor(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? colorAccent
                            : colorSecondary);
            textSecondIndicatorRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
        }
        break;

    case 3:
        linearFirstLineRecordCard.setVisibility(View.VISIBLE);
        linearSecondLineRecordCard.setVisibility(View.VISIBLE);
        linearThirdLineRecordCard.setVisibility(View.VISIBLE);
        linearFourthLineRecordCard.setVisibility(View.GONE);

        divider1RecordCard.setVisibility(View.VISIBLE);
        divider2RecordCard.setVisibility(View.VISIBLE);
        divider3RecordCard.setVisibility(View.GONE);

        textFirstDeckRecordCard.setText(currentRecord.getFirstPlace().getDeckName());
        textFirstPlayerRecordCard.setText(currentRecord.getFirstPlace().getDeckOwnerName());

        textSecondDeckRecordCard.setText(currentRecord.getSecondPlace().getDeckName());
        textSecondPlayerRecordCard.setText(currentRecord.getSecondPlace().getDeckOwnerName());

        textThirdDeckRecordCard.setText(currentRecord.getThirdPlace().getDeckName());
        textThirdPlayerRecordCard.setText(currentRecord.getThirdPlace().getDeckOwnerName());

        if (highlightedPlayerName != null) {
            textFirstDeckRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textFirstPlayerRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textFirstIndicatorRecordCard.setTextColor(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? colorAccent
                            : colorSecondary);
            textFirstIndicatorRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);

            textSecondDeckRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textSecondPlayerRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textSecondIndicatorRecordCard.setTextColor(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? colorAccent
                            : colorSecondary);
            textSecondIndicatorRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);

            textThirdDeckRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getThirdPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textThirdPlayerRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getThirdPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textThirdIndicatorRecordCard.setTextColor(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getThirdPlace().getDeckOwnerName())
                            ? colorAccent
                            : colorSecondary);
            textThirdIndicatorRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getThirdPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
        }
        break;

    case 4:
        linearFirstLineRecordCard.setVisibility(View.VISIBLE);
        linearSecondLineRecordCard.setVisibility(View.VISIBLE);
        linearThirdLineRecordCard.setVisibility(View.VISIBLE);
        linearFourthLineRecordCard.setVisibility(View.VISIBLE);

        divider1RecordCard.setVisibility(View.VISIBLE);
        divider2RecordCard.setVisibility(View.VISIBLE);
        divider3RecordCard.setVisibility(View.VISIBLE);

        textFirstDeckRecordCard.setText(currentRecord.getFirstPlace().getDeckName());
        textFirstPlayerRecordCard.setText(currentRecord.getFirstPlace().getDeckOwnerName());

        textSecondDeckRecordCard.setText(currentRecord.getSecondPlace().getDeckName());
        textSecondPlayerRecordCard.setText(currentRecord.getSecondPlace().getDeckOwnerName());

        textThirdDeckRecordCard.setText(currentRecord.getThirdPlace().getDeckName());
        textThirdPlayerRecordCard.setText(currentRecord.getThirdPlace().getDeckOwnerName());

        textFourthDeckRecordCard.setText(currentRecord.getFourthPlace().getDeckName());
        textFourthPlayerRecordCard.setText(currentRecord.getFourthPlace().getDeckOwnerName());

        if (highlightedPlayerName != null) {
            textFirstDeckRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textFirstPlayerRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textFirstIndicatorRecordCard.setTextColor(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? colorAccent
                            : colorSecondary);
            textFirstIndicatorRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);

            textSecondDeckRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textSecondPlayerRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textSecondIndicatorRecordCard.setTextColor(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? colorAccent
                            : colorSecondary);
            textSecondIndicatorRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);

            textThirdDeckRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getThirdPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textThirdPlayerRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getThirdPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textThirdIndicatorRecordCard.setTextColor(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getThirdPlace().getDeckOwnerName())
                            ? colorAccent
                            : colorSecondary);
            textThirdIndicatorRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getThirdPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);

            textFourthDeckRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFourthPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textFourthPlayerRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFourthPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textFourthIndicatorRecordCard.setTextColor(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFourthPlace().getDeckOwnerName())
                            ? colorAccent
                            : colorSecondary);
            textFourthIndicatorRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFourthPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
        }
        break;
    }
}

From source file:com.android.argb.edhlc.Utils.java

public static void createRecordListElement(View parent, Record currentRecord, String highlightedPlayerName) {
    RelativeLayout selectedRecord = (RelativeLayout) parent.findViewById(R.id.selectedRecord);
    selectedRecord.setVisibility(currentRecord.isSelected() ? View.VISIBLE : View.GONE);

    TextView textDateRecordCard = (TextView) parent.findViewById(R.id.textDateRecordCard);
    LinearLayout linearFirstLineRecordCard = (LinearLayout) parent.findViewById(R.id.linearFirstLineRecordCard);
    TextView textFirstIndicatorRecordCard = (TextView) parent.findViewById(R.id.textFirstIndicatorRecordCard);
    TextView textFirstPlayerRecordCard = (TextView) parent.findViewById(R.id.textFirstPlayerRecordCard);
    TextView textFirstDeckRecordCard = (TextView) parent.findViewById(R.id.textFirstDeckRecordCard);

    View divider1RecordCard = parent.findViewById(R.id.divider1RecordCard);

    LinearLayout linearSecondLineRecordCard = (LinearLayout) parent
            .findViewById(R.id.linearSecondLineRecordCard);
    TextView textSecondIndicatorRecordCard = (TextView) parent.findViewById(R.id.textSecondIndicatorRecordCard);
    TextView textSecondPlayerRecordCard = (TextView) parent.findViewById(R.id.textSecondPlayerRecordCard);
    TextView textSecondDeckRecordCard = (TextView) parent.findViewById(R.id.textSecondDeckRecordCard);

    View divider2RecordCard = parent.findViewById(R.id.divider2RecordCard);

    LinearLayout linearThirdLineRecordCard = (LinearLayout) parent.findViewById(R.id.linearThirdLineRecordCard);
    TextView textThirdIndicatorRecordCard = (TextView) parent.findViewById(R.id.textThirdIndicatorRecordCard);
    TextView textThirdPlayerRecordCard = (TextView) parent.findViewById(R.id.textThirdPlayerRecordCard);
    TextView textThirdDeckRecordCard = (TextView) parent.findViewById(R.id.textThirdDeckRecordCard);

    View divider3RecordCard = parent.findViewById(R.id.divider3RecordCard);

    LinearLayout linearFourthLineRecordCard = (LinearLayout) parent
            .findViewById(R.id.linearFourthLineRecordCard);
    TextView textFourthIndicatorRecordCard = (TextView) parent.findViewById(R.id.textFourthIndicatorRecordCard);
    TextView textFourthPlayerRecordCard = (TextView) parent.findViewById(R.id.textFourthPlayerRecordCard);
    TextView textFourthDeckRecordCard = (TextView) parent.findViewById(R.id.textFourthDeckRecordCard);

    Typeface typefaceMedium = Typeface.create("sans-serif-medium", Typeface.NORMAL);
    Typeface typefaceNormal = Typeface.create("sans-serif", Typeface.NORMAL);
    int colorAccent = ContextCompat.getColor(parent.getContext(), R.color.accent_color);
    int colorSecondary = ContextCompat.getColor(parent.getContext(), R.color.secondary_text);

    textDateRecordCard.setText(String.format("Played on %s", currentRecord.getDate()));

    switch (currentRecord.getTotalPlayers()) {
    case 2://from  w ww .j  ava2 s.c om
        linearFirstLineRecordCard.setVisibility(View.VISIBLE);
        linearSecondLineRecordCard.setVisibility(View.VISIBLE);
        linearThirdLineRecordCard.setVisibility(View.GONE);
        linearFourthLineRecordCard.setVisibility(View.GONE);

        divider1RecordCard.setVisibility(View.VISIBLE);
        divider2RecordCard.setVisibility(View.GONE);
        divider3RecordCard.setVisibility(View.GONE);

        textFirstDeckRecordCard.setText(currentRecord.getFirstPlace().getDeckName());
        textFirstPlayerRecordCard.setText(currentRecord.getFirstPlace().getDeckOwnerName());

        textSecondDeckRecordCard.setText(currentRecord.getSecondPlace().getDeckName());
        textSecondPlayerRecordCard.setText(currentRecord.getSecondPlace().getDeckOwnerName());

        if (highlightedPlayerName != null) {
            textFirstDeckRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textFirstPlayerRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textFirstIndicatorRecordCard.setTextColor(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? colorAccent
                            : colorSecondary);
            textFirstIndicatorRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);

            textSecondDeckRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textSecondPlayerRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textSecondIndicatorRecordCard.setTextColor(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? colorAccent
                            : colorSecondary);
            textSecondIndicatorRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
        }
        break;

    case 3:
        linearFirstLineRecordCard.setVisibility(View.VISIBLE);
        linearSecondLineRecordCard.setVisibility(View.VISIBLE);
        linearThirdLineRecordCard.setVisibility(View.VISIBLE);
        linearFourthLineRecordCard.setVisibility(View.GONE);

        divider1RecordCard.setVisibility(View.VISIBLE);
        divider2RecordCard.setVisibility(View.VISIBLE);
        divider3RecordCard.setVisibility(View.GONE);

        textFirstDeckRecordCard.setText(currentRecord.getFirstPlace().getDeckName());
        textFirstPlayerRecordCard.setText(currentRecord.getFirstPlace().getDeckOwnerName());

        textSecondDeckRecordCard.setText(currentRecord.getSecondPlace().getDeckName());
        textSecondPlayerRecordCard.setText(currentRecord.getSecondPlace().getDeckOwnerName());

        textThirdDeckRecordCard.setText(currentRecord.getThirdPlace().getDeckName());
        textThirdPlayerRecordCard.setText(currentRecord.getThirdPlace().getDeckOwnerName());

        if (highlightedPlayerName != null) {
            textFirstDeckRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textFirstPlayerRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textFirstIndicatorRecordCard.setTextColor(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? colorAccent
                            : colorSecondary);
            textFirstIndicatorRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);

            textSecondDeckRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textSecondPlayerRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textSecondIndicatorRecordCard.setTextColor(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? colorAccent
                            : colorSecondary);
            textSecondIndicatorRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);

            textThirdDeckRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getThirdPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textThirdPlayerRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getThirdPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textThirdIndicatorRecordCard.setTextColor(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getThirdPlace().getDeckOwnerName())
                            ? colorAccent
                            : colorSecondary);
            textThirdIndicatorRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getThirdPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
        }
        break;

    case 4:
        linearFirstLineRecordCard.setVisibility(View.VISIBLE);
        linearSecondLineRecordCard.setVisibility(View.VISIBLE);
        linearThirdLineRecordCard.setVisibility(View.VISIBLE);
        linearFourthLineRecordCard.setVisibility(View.VISIBLE);

        divider1RecordCard.setVisibility(View.VISIBLE);
        divider2RecordCard.setVisibility(View.VISIBLE);
        divider3RecordCard.setVisibility(View.VISIBLE);

        textFirstDeckRecordCard.setText(currentRecord.getFirstPlace().getDeckName());
        textFirstPlayerRecordCard.setText(currentRecord.getFirstPlace().getDeckOwnerName());

        textSecondDeckRecordCard.setText(currentRecord.getSecondPlace().getDeckName());
        textSecondPlayerRecordCard.setText(currentRecord.getSecondPlace().getDeckOwnerName());

        textThirdDeckRecordCard.setText(currentRecord.getThirdPlace().getDeckName());
        textThirdPlayerRecordCard.setText(currentRecord.getThirdPlace().getDeckOwnerName());

        textFourthDeckRecordCard.setText(currentRecord.getFourthPlace().getDeckName());
        textFourthPlayerRecordCard.setText(currentRecord.getFourthPlace().getDeckOwnerName());

        if (highlightedPlayerName != null) {
            textFirstDeckRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textFirstPlayerRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textFirstIndicatorRecordCard.setTextColor(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? colorAccent
                            : colorSecondary);
            textFirstIndicatorRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFirstPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);

            textSecondDeckRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textSecondPlayerRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textSecondIndicatorRecordCard.setTextColor(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? colorAccent
                            : colorSecondary);
            textSecondIndicatorRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getSecondPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);

            textThirdDeckRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getThirdPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textThirdPlayerRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getThirdPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textThirdIndicatorRecordCard.setTextColor(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getThirdPlace().getDeckOwnerName())
                            ? colorAccent
                            : colorSecondary);
            textThirdIndicatorRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getThirdPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);

            textFourthDeckRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFourthPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textFourthPlayerRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFourthPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
            textFourthIndicatorRecordCard.setTextColor(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFourthPlace().getDeckOwnerName())
                            ? colorAccent
                            : colorSecondary);
            textFourthIndicatorRecordCard.setTypeface(
                    highlightedPlayerName.equalsIgnoreCase(currentRecord.getFourthPlace().getDeckOwnerName())
                            ? typefaceMedium
                            : typefaceNormal);
        }
        break;
    }
}

From source file:com.tweetlanes.android.core.view.ProfileFragment.java

void configureView() {

    TextView fullNameTextView = (TextView) mProfileView.findViewById(R.id.fullNameTextView);
    TextView followingTextView = (TextView) mProfileView.findViewById(R.id.followState);
    TextView descriptionTextView = (TextView) mProfileView.findViewById(R.id.bioTextView);
    TextView tweetCount = (TextView) mProfileView.findViewById(R.id.tweetCountLabel);
    TextView followingCount = (TextView) mProfileView.findViewById(R.id.followingCountLabel);
    TextView followersCount = (TextView) mProfileView.findViewById(R.id.followersCountLabel);
    TextView favoritesCount = (TextView) mProfileView.findViewById(R.id.favorites_count);
    LinearLayout linkLayout = (LinearLayout) mProfileView.findViewById(R.id.linkLayout);
    TextView link = (TextView) mProfileView.findViewById(R.id.link);
    LinearLayout locationLayout = (LinearLayout) mProfileView.findViewById(R.id.locationLayout);
    TextView location = (TextView) mProfileView.findViewById(R.id.location);
    LinearLayout detailsLayout = (LinearLayout) mProfileView.findViewById(R.id.detailsLayout);
    ImageView privateAccountImage = (ImageView) mProfileView.findViewById(R.id.private_account_image);
    mFriendshipButton = (Button) mProfileView.findViewById(R.id.friendship_button);
    mFriendshipDivider = mProfileView.findViewById(R.id.friendship_divider);

    if (mUser != null) {
        ImageView avatar = (ImageView) mProfileView.findViewById(R.id.profileImage);
        // String imageUrl =
        // TwitterManager.getProfileImageUrl(mUser.getScreenName(),
        // TwitterManager.ProfileImageSize.ORIGINAL);
        String imageUrl = mUser.getProfileImageUrl(TwitterManager.ProfileImageSize.ORIGINAL);
        UrlImageViewHelper.setUrlDrawable(avatar, imageUrl, R.drawable.ic_contact_picture);
        // avatar.setImageURL(imageUrl);

        ImageView coverImage = (ImageView) mProfileView.findViewById(R.id.coverImage);
        if (coverImage != null) {
            String url = mUser.getCoverImageUrl();
            if (url != null) {
                UrlImageViewHelper.setUrlDrawable(coverImage, url, R.drawable.ic_contact_picture);
            }//from w  w  w  .ja  v  a  2 s  .  c o  m
        }

        fullNameTextView.setText(mUser.getName());
        if (mFollowsLoggedInUser != null && mFollowsLoggedInUser.booleanValue()) {
            followingTextView.setText(R.string.follows_you);
        } else {
            followingTextView.setText(null);
        }

        String description = mUser.getDescription();
        URLEntity[] urlEntities = mUser.getUrlEntities();
        if (description != null) {
            String descriptionMarkup = TwitterUtil.getTextMarkup(description, urlEntities);
            descriptionTextView.setText(Html.fromHtml(descriptionMarkup + " "));
            descriptionTextView.setMovementMethod(LinkMovementMethod.getInstance());
            URLSpanNoUnderline.stripUnderlines(descriptionTextView);
        }

        if (mUser.getUrl() != null) {
            linkLayout.setVisibility(View.VISIBLE);
            String urlMarkup = TwitterUtil.getTextMarkup(mUser.getUrl(), urlEntities);
            link.setText(Html.fromHtml(urlMarkup + ""));
            link.setMovementMethod(LinkMovementMethod.getInstance());
            URLSpanNoUnderline.stripUnderlines(link);
        } else {
            linkLayout.setVisibility(View.GONE);
        }

        detailsLayout.setVisibility(View.VISIBLE);
        privateAccountImage.setVisibility(mUser.getProtected() ? View.VISIBLE : View.GONE);

        tweetCount.setText(Util.getPrettyCount(mUser.getStatusesCount()));
        followingCount.setText(Util.getPrettyCount(mUser.getFriendsCount()));
        followersCount.setText(Util.getPrettyCount(mUser.getFollowersCount()));
        if (favoritesCount != null) {
            favoritesCount.setText(Util.getPrettyCount(mUser.getFavoritesCount()));
        }

        if (mUser.getLocation() != null) {
            locationLayout.setVisibility(View.VISIBLE);
            location.setText(mUser.getLocation());
        } else {
            locationLayout.setVisibility(View.GONE);
        }

        configureFriendshipButtonVisibility(mLoggedInUserFollows);

    } else {
        fullNameTextView.setText(null);
        followingTextView.setText(null);
        descriptionTextView.setText(null);

        detailsLayout.setVisibility(View.GONE);
        linkLayout.setVisibility(View.GONE);
        locationLayout.setVisibility(View.GONE);
        mFriendshipButton.setVisibility(View.GONE);
        mFriendshipDivider.setVisibility(View.GONE);
        privateAccountImage.setVisibility(View.GONE);
    }
}

From source file:ua.mkh.settings.full.MainActivity.java

@Override
public boolean onKeyDown(int keycode, KeyEvent e) {
    switch (keycode) {
    case KeyEvent.KEYCODE_MENU:
        if (menui == 1) {
            openDialog();/*  w  w w.  j a  v  a 2s  . c  o m*/
        }
        return true;
    case KeyEvent.KEYCODE_BACK:
        if (sear == true) {
            b11.setVisibility(View.GONE);
            b21.setVisibility(View.GONE);
            ed11.clearFocus();
            ed1.clearFocus();
            InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(ed1.getWindowToken(), 0);
            ed11.setText("");
            ed1.setText("");
            LinearLayout list_res_top = (LinearLayout) findViewById(R.id.list_res_top);
            list_res_top.setVisibility(View.GONE);
            LinearLayout list_res = (LinearLayout) findViewById(R.id.list_res);
            list_res.setVisibility(View.GONE);
            ll1.setVisibility(View.VISIBLE);
            sear = false;
        } else {
            Intent intent = new Intent(Intent.ACTION_MAIN);
            intent.addCategory(Intent.CATEGORY_HOME);
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(intent);
        }
        return true;
    }

    return super.onKeyDown(keycode, e);
}

From source file:ua.mkh.settings.full.MainActivity.java

private void ifest() {

    if (vk_app == null) {
        ImageView im9 = (ImageView) findViewById(R.id.ImageView99);
        im9.setVisibility(View.GONE);
        if (viber_app == null) {
            ImageView im91 = (ImageView) findViewById(R.id.ImageView96);
            im91.setVisibility(View.GONE);
            if (ok_app == null) {
                ImageView im92 = (ImageView) findViewById(R.id.ImageView93);
                im92.setVisibility(View.GONE);
                if (skype_app == null) {
                    ImageView im93 = (ImageView) findViewById(R.id.ImageView90);
                    im93.setVisibility(View.GONE);
                    if (whatsapp_app == null) {
                        ImageView im94 = (ImageView) findViewById(R.id.ImageView87);
                        im94.setVisibility(View.GONE);
                        if (twitter_app == null) {
                            ImageView im95 = (ImageView) findViewById(R.id.ImageView84);
                            im95.setVisibility(View.GONE);
                            if (facebook_app == null) {
                                ImageView im96 = (ImageView) findViewById(R.id.ImageView31);
                                im96.setVisibility(View.GONE);
                                if (instagram_app == null) {
                                    ImageView im1 = (ImageView) findViewById(R.id.ImageView34);
                                    ImageView im2 = (ImageView) findViewById(R.id.ImageView82);
                                    im1.setVisibility(View.GONE);
                                    im2.setVisibility(View.GONE);
                                    LinearLayout LinearLayoutSoc = (LinearLayout) findViewById(
                                            R.id.LinearLayoutSoc);
                                    LinearLayoutSoc.setVisibility(View.GONE);
                                }/*from  w  ww . j a  v  a  2 s  .com*/
                            }
                        }
                    }
                }
            }
        }
    }

    if (music_app == null) {
        ImageView im1 = (ImageView) findViewById(R.id.ImageView454);
        im1.setVisibility(View.GONE);
        if (gamecenter_app == null) {
            ImageView im2 = (ImageView) findViewById(R.id.ImageView393);
            im2.setVisibility(View.GONE);
            if (weather_app == null) {
                ImageView im5 = (ImageView) findViewById(R.id.ImageView105);
                im5.setVisibility(View.GONE);
                if (maps_app == null) {
                    ImageView im7 = (ImageView) findViewById(R.id.ImageView154);
                    im7.setVisibility(View.GONE);
                    if (new1_app == null) {
                        ImageView im8 = (ImageView) findViewById(R.id.ImageView64);
                        im8.setVisibility(View.GONE);
                        if (new2_app == null) {
                            ImageView im9 = (ImageView) findViewById(R.id.ImageView67);
                            im9.setVisibility(View.GONE);
                            if (new3_app == null) {
                                ImageView im10 = (ImageView) findViewById(R.id.ImageView70);
                                im10.setVisibility(View.GONE);
                                if (new4_app == null) {
                                    ImageView im3 = (ImageView) findViewById(R.id.ImageView80);
                                    ImageView im4 = (ImageView) findViewById(R.id.ImageView102);
                                    im3.setVisibility(View.GONE);
                                    im4.setVisibility(View.GONE);
                                    LinearLayout LinearLayoutAnother = (LinearLayout) findViewById(
                                            R.id.LinearLayoutAnother);
                                    LinearLayoutAnother.setVisibility(View.GONE);
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    if (mail_app == null) {
        ImageView im7 = (ImageView) findViewById(R.id.ImageView107);
        im7.setVisibility(View.GONE);
        if (notes_app == null) {
            ImageView im8 = (ImageView) findViewById(R.id.ImageView41);
            im8.setVisibility(View.GONE);
            if (phone_app == null) {
                ImageView im9 = (ImageView) findViewById(R.id.ImageView50);
                im9.setVisibility(View.GONE);
                if (messages_app == null) {
                    ImageView im10 = (ImageView) findViewById(R.id.ImageView55);
                    im10.setVisibility(View.GONE);
                    if (compass_app == null) {
                        ImageView im11 = (ImageView) findViewById(R.id.ImageView32);
                        im11.setVisibility(View.GONE);
                        if (safari_app == null) {
                            LinearLayout LinearLayout1 = (LinearLayout) findViewById(R.id.LinearLayout1);
                            LinearLayout1.setVisibility(View.GONE);
                            ImageView im5 = (ImageView) findViewById(R.id.ImageView37);
                            ImageView im6 = (ImageView) findViewById(R.id.ImageView106);
                            im5.setVisibility(View.GONE);
                            im6.setVisibility(View.GONE);
                        }
                    }
                }
            }
        }
    }
}

From source file:es.ugr.swad.swadroid.modules.tests.TestsMake.java

/**
 * Shows a test question on screen//from   w  ww  .  j av  a  2  s.  c  o  m
 *
 * @param pos Question's position in questions's list of the test
 */
private void showQuestion(int pos) {
    TestQuestion question = test.getQuestions().get(pos);
    List<TestAnswer> answers = question.getAnswers();
    TestAnswer a;
    ScrollView scrollContent = (ScrollView) findViewById(R.id.testMakeScroll);
    LinearLayout testMakeList = (LinearLayout) findViewById(R.id.testMakeList);
    TextView stem = (TextView) findViewById(R.id.testMakeQuestionStem);
    TextView questionFeedback = (TextView) findViewById(R.id.testMakeQuestionFeedback);
    TextView answerFeedback = (TextView) findViewById(R.id.testMakeAnswerFeedback);
    TextView score = (TextView) findViewById(R.id.testMakeQuestionScore);
    TextView textCorrectAnswer = (TextView) findViewById(R.id.testMakeCorrectAnswer);
    EditText textAnswer = (EditText) findViewById(R.id.testMakeEditText);
    ImageView img = (ImageView) findViewById(R.id.testMakeCorrectAnswerImage);
    MenuItem actionScoreItem = menu.findItem(R.id.action_score);
    CheckedAnswersArrayAdapter checkedAnswersAdapter;
    String answerType = question.getAnswerType();
    String feedback = test.getFeedback();
    String questionFeedbackText = question.getFeedback();
    String correctAnswer = "";
    int numAnswers = answers.size();
    Float questionScore;
    DecimalFormat df = new DecimalFormat("0.00");
    int feedbackLevel;
    int mediumFeedbackLevel = Test.FEEDBACK_VALUES.indexOf(Test.FEEDBACK_MEDIUM);
    int maxFeedbackLevel = Test.FEEDBACK_VALUES.indexOf(Test.FEEDBACK_MAX);

    scrollContent.setOnTouchListener(new View.OnTouchListener() {
        public boolean onTouch(View v, MotionEvent event) {
            findViewById(R.id.testMakeList).getParent().requestDisallowInterceptTouchEvent(false);
            return false;
        }
    });
    testMakeList.setOnTouchListener(new View.OnTouchListener() {
        public boolean onTouch(View v, MotionEvent event) {
            // Disallow the touch request for parent scroll on touch of child view
            v.getParent().requestDisallowInterceptTouchEvent(true);
            return false;
        }
    });

    questionFeedback.setVisibility(View.GONE);
    answerFeedback.setVisibility(View.GONE);
    textAnswer.setVisibility(View.GONE);
    textCorrectAnswer.setVisibility(View.GONE);
    testMakeList.setVisibility(View.GONE);
    img.setVisibility(View.GONE);

    testMakeList.removeAllViews();
    stem.setText(Html.fromHtml(question.getStem()));

    if ((questionFeedbackText != null) && (!questionFeedbackText.equals(Constants.NULL_VALUE))) {
        questionFeedback.setText(Html.fromHtml(questionFeedbackText));
    }

    feedbackLevel = Test.FEEDBACK_VALUES.indexOf(feedback);

    if (test.isEvaluated() && (feedbackLevel == maxFeedbackLevel)
            && !question.getFeedback().equals(Constants.NULL_VALUE)) {
        questionFeedback.setVisibility(View.VISIBLE);
    } else {
        questionFeedback.setVisibility(View.GONE);
    }

    if (answerType.equals(TestAnswer.TYPE_TEXT) || answerType.equals(TestAnswer.TYPE_INT)
            || answerType.equals(TestAnswer.TYPE_FLOAT)) {

        if (answerType.equals(TestAnswer.TYPE_INT)) {
            textAnswer.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED);
        } else if (answerType.equals(TestAnswer.TYPE_FLOAT)) {
            textAnswer.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL
                    | InputType.TYPE_NUMBER_FLAG_SIGNED);
        } else {
            textAnswer.setInputType(InputType.TYPE_CLASS_TEXT);
        }

        a = answers.get(0);
        textAnswer.setText(a.getUserAnswer());
        textAnswer.setVisibility(View.VISIBLE);

        answerFeedback.setText(Html.fromHtml(a.getFeedback()));

        if (test.isEvaluated() && (feedbackLevel > mediumFeedbackLevel)) {
            if (answerType.equals(TestAnswer.TYPE_FLOAT)) {
                correctAnswer = "[" + a.getAnswer() + ";" + answers.get(1).getAnswer() + "]";

                if ((feedbackLevel == maxFeedbackLevel) && !a.getFeedback().equals(Constants.NULL_VALUE)) {
                    answerFeedback.setVisibility(View.VISIBLE);
                } else {
                    answerFeedback.setVisibility(View.GONE);
                }
            } else {
                for (int i = 0; i < numAnswers; i++) {
                    a = answers.get(i);

                    if ((feedbackLevel == maxFeedbackLevel) && !a.getFeedback().equals(Constants.NULL_VALUE)) {
                        correctAnswer += "<strong>" + a.getAnswer() + "</strong><br/>";
                        correctAnswer += "<i>" + a.getFeedback() + "</i><br/><br/>";
                    } else {
                        correctAnswer += a.getAnswer() + "<br/>";
                    }
                }
            }

            textCorrectAnswer.setText(Html.fromHtml(correctAnswer));
            textCorrectAnswer.setVisibility(View.VISIBLE);
        }
    } else if (answerType.equals(TestAnswer.TYPE_MULTIPLE_CHOICE)) {
        checkedAnswersAdapter = new CheckedAnswersArrayAdapter(this, R.layout.list_item_multiple_choice,
                answers, test.isEvaluated(), test.getFeedback(), answerType);

        for (int i = 0; i < numAnswers; i++) {
            a = answers.get(i);
            CheckableLinearLayout item = (CheckableLinearLayout) checkedAnswersAdapter.getView(i, null, null);
            item.setChecked(Utils.parseStringBool(a.getUserAnswer()));
            testMakeList.addView(item);
        }

        testMakeList.setVisibility(View.VISIBLE);
    } else {
        if (answerType.equals(TestAnswer.TYPE_TRUE_FALSE) && (numAnswers < 2)) {
            if (answers.get(0).getAnswer().equals(TestAnswer.VALUE_TRUE)) {
                answers.add(1,
                        new TestAnswer(0, 1, 0, false, TestAnswer.VALUE_FALSE, answers.get(0).getFeedback()));
            } else {
                answers.add(0,
                        new TestAnswer(0, 0, 0, false, TestAnswer.VALUE_TRUE, answers.get(0).getFeedback()));
            }

            numAnswers = 2;
        }

        checkedAnswersAdapter = new CheckedAnswersArrayAdapter(this, R.layout.list_item_single_choice, answers,
                test.isEvaluated(), test.getFeedback(), answerType);

        for (int i = 0; i < numAnswers; i++) {
            a = answers.get(i);
            CheckableLinearLayout item = (CheckableLinearLayout) checkedAnswersAdapter.getView(i, null, null);
            item.setChecked(a.getAnswer().equals(answers.get(0).getUserAnswer()));
            testMakeList.addView(item);
        }

        testMakeList.setVisibility(View.VISIBLE);
    }

    if (test.isEvaluated() && (feedbackLevel > mediumFeedbackLevel)) {
        textAnswer.setEnabled(false);
        textAnswer.setOnClickListener(null);

        if (feedback.equals(Test.FEEDBACK_HIGH)) {
            img.setImageResource(R.drawable.btn_check_buttonless_on);
            if (!answerType.equals(TestAnswer.TYPE_TRUE_FALSE)
                    && !answerType.equals(TestAnswer.TYPE_MULTIPLE_CHOICE)
                    && !answerType.equals(TestAnswer.TYPE_UNIQUE_CHOICE)) {

                if (!answers.get(0).isCorrectAnswered()) {
                    img.setImageResource(android.R.drawable.ic_delete);
                }

                img.setVisibility(View.VISIBLE);
            }
        }

        questionScore = test.getQuestionScore(pos);
        if (questionScore > 0) {
            score.setTextColor(getResources().getColor(R.color.green));
        } else if (questionScore < 0) {
            score.setTextColor(getResources().getColor(R.color.red));
        } else {
            score.setTextColor(Color.BLACK);
        }

        score.setText(df.format(questionScore));

        MenuItemCompat.setActionView(actionScoreItem, score);
        actionScoreItem.setVisible(true);
    }
}

From source file:org.appspot.apprtc.CallActivity.java

private void callConnected() {
    connectedUserIds.add(mPeerId);//from w  w w .  ja  va  2  s . co m
    connectedUserIds.add(mOwnId);

    LinearLayout connecting_layout = (LinearLayout) findViewById(R.id.connecting_progress_layout);
    if (connecting_layout != null) {
        connecting_layout.setVisibility(View.GONE);
    }

    final long delta = System.currentTimeMillis() - callStartedTimeMs;
    Log.i(TAG, "Call connected: delay=" + delta + "ms");
    if (peerConnectionClient == null || isError) {
        Log.w(TAG, "Call is connected in closed or error state");
        return;
    }
    // Update video view.
    updateVideoView();

    // incoming calls pending
    for (RemoteConnection remoteConnection : mQueuedRemoteConnections) {
        addToCall(remoteConnection.sdp, remoteConnection.user);
    }
    mQueuedRemoteConnections.clear();

    for (User user : mQueuedPeers) {
        addToCall(user, "", true, null);
    }
    mQueuedPeers.clear();

    // Enable statistics callback.
    //peerConnectionClient.enableStatsEvents(true, STAT_CALLBACK_PERIOD);
}

From source file:com.sentaroh.android.TaskAutomation.Config.ProfileMaintenanceActionProfile.java

final static private void setViewVisibilityByActionType(final GlobalParameters mGlblParms, Dialog dialog,
        String action_type, String data_type) {
    Spinner sp_exec_android_activity = (Spinner) dialog
            .findViewById(R.id.edit_profile_action_exec_activity_name);
    LinearLayout ll_exec_sound = (LinearLayout) dialog.findViewById(R.id.edit_profile_action_ll_exec_sound);
    LinearLayout ll_exec_ringtone = (LinearLayout) dialog
            .findViewById(R.id.edit_profile_action_ll_exec_ringtone);
    LinearLayout ll_exec_compare = (LinearLayout) dialog.findViewById(R.id.edit_profile_action_ll_compare);
    LinearLayout ll_exec_message = (LinearLayout) dialog.findViewById(R.id.edit_profile_action_ll_message);
    LinearLayout ll_exec_time = (LinearLayout) dialog.findViewById(R.id.edit_profile_action_ll_time);
    LinearLayout ll_exec_task = (LinearLayout) dialog.findViewById(R.id.edit_profile_action_ll_task);
    LinearLayout ll_exec_wait = (LinearLayout) dialog.findViewById(R.id.edit_profile_action_ll_wait);
    LinearLayout ll_exec_bsh = (LinearLayout) dialog.findViewById(R.id.edit_profile_action_ll_bsh);
    LinearLayout ll_exec_test = (LinearLayout) dialog.findViewById(R.id.edit_profile_action_ll_test_exec);
    //        TextView tv_layout_normal=(TextView)dialog.findViewById(R.id.edit_profile_action_dlg_bsh_layout_normal);
    final CheckBox cb_volume = (CheckBox) dialog
            .findViewById(R.id.edit_profile_action_profile_sound_use_volume);
    final SeekBar sb_volume = (SeekBar) dialog.findViewById(R.id.edit_profile_action_profile_sound_volume);

    final Spinner sp_type = (Spinner) dialog.findViewById(R.id.edit_profile_action_exec_activity_data_type);
    final Button uri_fl = (Button) dialog
            .findViewById(R.id.edit_profile_action_exec_activity_uri_data_filelist);
    final EditText uri_data = (EditText) dialog.findViewById(R.id.edit_profile_action_exec_activity_uri_data);
    //        final Button test_exec_btn=(Button)dialog.findViewById(R.id.edit_profile_action_test_exec);
    final ListView lv_extra_data = (ListView) dialog
            .findViewById(R.id.edit_profile_action_exec_activity_extra_data_listview);
    uri_fl.setVisibility(Button.GONE);
    uri_data.setVisibility(EditText.GONE);
    ll_exec_test.setVisibility(Button.GONE);
    lv_extra_data.setVisibility(ListView.GONE);

    final EditText et_msg_text = (EditText) dialog.findViewById(R.id.edit_profile_action_message_message);
    et_msg_text.setVisibility(EditText.GONE);

    sp_exec_android_activity.setVisibility(Spinner.VISIBLE);
    sp_type.setVisibility(Spinner.VISIBLE);
    ll_exec_sound.setVisibility(LinearLayout.VISIBLE);
    ll_exec_ringtone.setVisibility(LinearLayout.VISIBLE);
    ll_exec_compare.setVisibility(LinearLayout.VISIBLE);
    ll_exec_message.setVisibility(LinearLayout.VISIBLE);
    ll_exec_time.setVisibility(LinearLayout.VISIBLE);
    ll_exec_task.setVisibility(LinearLayout.VISIBLE);
    ll_exec_wait.setVisibility(LinearLayout.VISIBLE);

    if (action_type.equals(PROFILE_ACTION_TYPE_ACTIVITY)) {
        ll_exec_sound.setVisibility(LinearLayout.GONE);
        ll_exec_ringtone.setVisibility(LinearLayout.GONE);
        ll_exec_compare.setVisibility(LinearLayout.GONE);
        ll_exec_message.setVisibility(LinearLayout.GONE);
        ll_exec_test.setVisibility(Button.VISIBLE);
        ll_exec_time.setVisibility(LinearLayout.GONE);
        ll_exec_task.setVisibility(LinearLayout.GONE);
        ll_exec_wait.setVisibility(LinearLayout.GONE);
        ll_exec_bsh.setVisibility(LinearLayout.GONE);
        if (data_type.equals(PROFILE_ACTION_TYPE_ACTIVITY_DATA_TYPE_EXTRA)) {
            uri_fl.setVisibility(Button.GONE);
            uri_data.setVisibility(EditText.GONE);
            lv_extra_data.setVisibility(ListView.VISIBLE);
        } else if (data_type.equals(PROFILE_ACTION_TYPE_ACTIVITY_DATA_TYPE_URI)) {
            uri_fl.setVisibility(Button.VISIBLE);
            uri_data.setVisibility(EditText.VISIBLE);
            lv_extra_data.setVisibility(ListView.GONE);
        }/* w w  w . j  a  v  a  2s.  c  o  m*/
    } else if (action_type.equals(PROFILE_ACTION_TYPE_MUSIC)) {
        sp_type.setVisibility(Spinner.GONE);
        sp_exec_android_activity.setVisibility(Spinner.GONE);
        ll_exec_ringtone.setVisibility(LinearLayout.GONE);
        if (cb_volume.isChecked())
            sb_volume.setEnabled(true);
        else
            sb_volume.setEnabled(false);
        ll_exec_compare.setVisibility(LinearLayout.GONE);
        ll_exec_message.setVisibility(LinearLayout.GONE);
        ll_exec_time.setVisibility(LinearLayout.GONE);
        ll_exec_task.setVisibility(LinearLayout.GONE);
        ll_exec_wait.setVisibility(LinearLayout.GONE);
        ll_exec_bsh.setVisibility(LinearLayout.GONE);
    } else if (action_type.equals(PROFILE_ACTION_TYPE_RINGTONE)) {
        sp_type.setVisibility(Spinner.GONE);
        sp_exec_android_activity.setVisibility(Spinner.GONE);
        ll_exec_sound.setVisibility(LinearLayout.GONE);
        if (cb_volume.isChecked())
            sb_volume.setEnabled(true);
        else
            sb_volume.setEnabled(false);
        ll_exec_compare.setVisibility(LinearLayout.GONE);
        ll_exec_message.setVisibility(LinearLayout.GONE);
        ll_exec_time.setVisibility(LinearLayout.GONE);
        ll_exec_task.setVisibility(LinearLayout.GONE);
        ll_exec_wait.setVisibility(LinearLayout.GONE);
        ll_exec_bsh.setVisibility(LinearLayout.GONE);
    } else if (action_type.equals(PROFILE_ACTION_TYPE_COMPARE)) {
        sp_type.setVisibility(Spinner.GONE);
        sp_exec_android_activity.setVisibility(Spinner.GONE);
        ll_exec_sound.setVisibility(LinearLayout.GONE);
        ll_exec_ringtone.setVisibility(LinearLayout.GONE);
        ll_exec_compare.setVisibility(LinearLayout.VISIBLE);
        ll_exec_message.setVisibility(LinearLayout.GONE);
        ll_exec_time.setVisibility(LinearLayout.GONE);
        ll_exec_task.setVisibility(LinearLayout.GONE);
        ll_exec_wait.setVisibility(LinearLayout.GONE);
        ll_exec_bsh.setVisibility(LinearLayout.GONE);
    } else if (action_type.equals(PROFILE_ACTION_TYPE_MESSAGE)) {
        sp_type.setVisibility(Spinner.GONE);
        sp_exec_android_activity.setVisibility(Spinner.GONE);
        ll_exec_sound.setVisibility(LinearLayout.GONE);
        ll_exec_ringtone.setVisibility(LinearLayout.GONE);
        ll_exec_compare.setVisibility(LinearLayout.GONE);
        ll_exec_message.setVisibility(LinearLayout.VISIBLE);
        et_msg_text.setVisibility(EditText.VISIBLE);
        ll_exec_time.setVisibility(LinearLayout.GONE);
        ll_exec_task.setVisibility(LinearLayout.GONE);
        ll_exec_wait.setVisibility(LinearLayout.GONE);
        ll_exec_bsh.setVisibility(LinearLayout.GONE);
    } else if (action_type.equals(PROFILE_ACTION_TYPE_TIME)) {
        sp_type.setVisibility(Spinner.GONE);
        sp_exec_android_activity.setVisibility(Spinner.GONE);
        ll_exec_sound.setVisibility(LinearLayout.GONE);
        ll_exec_ringtone.setVisibility(LinearLayout.GONE);
        ll_exec_compare.setVisibility(LinearLayout.GONE);
        ll_exec_message.setVisibility(LinearLayout.GONE);
        et_msg_text.setVisibility(EditText.GONE);
        ll_exec_time.setVisibility(LinearLayout.VISIBLE);
        ll_exec_task.setVisibility(LinearLayout.GONE);
        ll_exec_wait.setVisibility(LinearLayout.GONE);
        ll_exec_bsh.setVisibility(LinearLayout.GONE);
    } else if (action_type.equals(PROFILE_ACTION_TYPE_TASK)) {
        sp_type.setVisibility(Spinner.GONE);
        sp_exec_android_activity.setVisibility(Spinner.GONE);
        ll_exec_sound.setVisibility(LinearLayout.GONE);
        ll_exec_ringtone.setVisibility(LinearLayout.GONE);
        ll_exec_compare.setVisibility(LinearLayout.GONE);
        ll_exec_message.setVisibility(LinearLayout.GONE);
        et_msg_text.setVisibility(EditText.GONE);
        ll_exec_time.setVisibility(LinearLayout.GONE);
        ll_exec_task.setVisibility(LinearLayout.VISIBLE);
        ll_exec_wait.setVisibility(LinearLayout.GONE);
        ll_exec_bsh.setVisibility(LinearLayout.GONE);
    } else if (action_type.equals(PROFILE_ACTION_TYPE_WAIT)) {
        sp_type.setVisibility(Spinner.GONE);
        sp_exec_android_activity.setVisibility(Spinner.GONE);
        ll_exec_sound.setVisibility(LinearLayout.GONE);
        ll_exec_ringtone.setVisibility(LinearLayout.GONE);
        ll_exec_compare.setVisibility(LinearLayout.GONE);
        ll_exec_message.setVisibility(LinearLayout.GONE);
        et_msg_text.setVisibility(EditText.GONE);
        ll_exec_time.setVisibility(LinearLayout.GONE);
        ll_exec_task.setVisibility(LinearLayout.GONE);
        ll_exec_wait.setVisibility(LinearLayout.VISIBLE);
        ll_exec_bsh.setVisibility(LinearLayout.GONE);
    } else if (action_type.equals(PROFILE_ACTION_TYPE_BSH_SCRIPT)) {
        //         test_exec_btn.setVisibility(Button.VISIBLE);
        sp_type.setVisibility(Spinner.GONE);
        sp_exec_android_activity.setVisibility(Spinner.GONE);
        ll_exec_sound.setVisibility(LinearLayout.GONE);
        ll_exec_ringtone.setVisibility(LinearLayout.GONE);
        ll_exec_compare.setVisibility(LinearLayout.GONE);
        ll_exec_message.setVisibility(LinearLayout.GONE);
        ll_exec_test.setVisibility(Button.VISIBLE);
        et_msg_text.setVisibility(EditText.GONE);
        ll_exec_time.setVisibility(LinearLayout.GONE);
        ll_exec_task.setVisibility(LinearLayout.GONE);
        ll_exec_wait.setVisibility(LinearLayout.GONE);
        ll_exec_bsh.setVisibility(LinearLayout.VISIBLE);
    }
}