Example usage for android.widget TableRow setVisibility

List of usage examples for android.widget TableRow setVisibility

Introduction

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

Prototype

@RemotableViewMethod
public void setVisibility(@Visibility int visibility) 

Source Link

Document

Set the visibility state of this view.

Usage

From source file:com.SecUpwN.AIMSICD.activities.MapViewer.java

/**
 * Initialises the Map and sets initial options
 *///from  w ww.ja  va 2s .  c  o m
private void setUpMapIfNeeded() {
    // Do a null check to confirm that we have not already instantiated the
    // map.
    if (mMap == null) {
        mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();

        // Check if we were successful in obtaining the map.
        if (mMap != null) {
            // The Map is verified. It is now safe to manipulate the map.
            UiSettings uiSettings = mMap.getUiSettings();
            uiSettings.setZoomControlsEnabled(true);
            uiSettings.setCompassEnabled(true);
            uiSettings.setMyLocationButtonEnabled(true);
            uiSettings.setScrollGesturesEnabled(true);
            uiSettings.setZoomGesturesEnabled(true);
            uiSettings.setTiltGesturesEnabled(true);
            uiSettings.setRotateGesturesEnabled(true);
            mMap.setMyLocationEnabled(true);
            // Setting a custom info window adapter for the google map
            mMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {

                // Use default InfoWindow frame
                @Override
                public View getInfoWindow(Marker arg0) {
                    return null;
                }

                // Defines the contents of the InfoWindow
                @Override
                public View getInfoContents(Marker arg0) {

                    TextView tv;

                    // Getting view from the layout file info_window_layout
                    View v = getLayoutInflater().inflate(R.layout.marker_info_window, null);

                    if (v != null) {
                        final MarkerData data = mMarkerMap.get(arg0);
                        if (data != null) {
                            if (data.openCellID) {
                                TableRow tr = (TableRow) v.findViewById(R.id.open_cell_label);
                                tr.setVisibility(View.VISIBLE);
                            }

                            tv = (TextView) v.findViewById(R.id.cell_id);
                            tv.setText(data.cellID);
                            tv = (TextView) v.findViewById(R.id.lat);
                            tv.setText(String.valueOf(data.lat));
                            tv = (TextView) v.findViewById(R.id.lng);
                            tv.setText(String.valueOf(data.lng));
                            tv = (TextView) v.findViewById(R.id.mcc);
                            tv.setText(data.mcc);
                            tv = (TextView) v.findViewById(R.id.mnc);
                            tv.setText(data.mnc);
                            tv = (TextView) v.findViewById(R.id.samples);
                            tv.setText(data.samples);
                        }
                    }

                    // Returning the view containing InfoWindow contents
                    return v;
                }
            });
        } else {
            Helpers.msgShort(this, "Unable to create map!");
        }
    }
}

From source file:com.mobicage.rogerthat.plugins.friends.ServiceActionMenuActivity.java

private void clearScreen() {
    for (int x = 0; x < 4; x++) {
        for (int y = 0; y < 3; y++) {
            Cell cell = cells[x][y];/*from  w w w. ja va 2s.co m*/
            ((View) cell.icon.getParent()).setOnClickListener(null);
            cell.icon.setVisibility(View.INVISIBLE);
            cell.faIcon.setVisibility(View.GONE);
            cell.label.setVisibility(View.INVISIBLE);
            cell.label.setTextColor(lightSchemeTextColor);
            cell.label.setShadowLayer(2, 1, 1, Color.WHITE);
            cells[x][y] = cell;
        }
    }
    pages.removeAllViews();
    pages.setVisibility(View.GONE);
    setNavigationBarVisible(false);
    title.setVisibility(View.GONE);
    branding.setVisibility(View.GONE);
    activity.setBackgroundResource(R.drawable.activity_background);
    for (TableRow row : tableRows) {
        row.setVisibility(View.VISIBLE);
    }
    badge.setVisibility(View.GONE);
}

From source file:com.secupwn.aimsicd.ui.fragments.DeviceFragment.java

private void updateUI() {
    HighlightTextView content;//from   w  w  w  . j av a 2  s. c  om
    TableRow tr;
    if (mBound) {
        final AnimationManager ani = new AnimationManager();

        mAimsicdService.getCellTracker().refreshDevice();
        Device mDevice = mAimsicdService.getCellTracker().getDevice();
        switch (mDevice.getPhoneId()) {

        case TelephonyManager.PHONE_TYPE_NONE: // Maybe bad!
        case TelephonyManager.PHONE_TYPE_SIP: // Maybe bad!
        case TelephonyManager.PHONE_TYPE_GSM: {
            content = (HighlightTextView) getView().findViewById(R.id.network_lac);
            content.updateText(String.valueOf(mAimsicdService.getCell().getLocationAreaCode()), ani);
            tr = (TableRow) getView().findViewById(R.id.gsm_cellid);
            tr.setVisibility(View.VISIBLE);
            content = (HighlightTextView) getView().findViewById(R.id.network_cellid);
            content.updateText(String.valueOf(mAimsicdService.getCell().getCellId()), ani);
            break;
        }

        case TelephonyManager.PHONE_TYPE_CDMA: {
            tr = (TableRow) getView().findViewById(R.id.cdma_netid);
            tr.setVisibility(View.VISIBLE);
            content = (HighlightTextView) getView().findViewById(R.id.network_netid);
            content.updateText(String.valueOf(mAimsicdService.getCell().getLocationAreaCode()), ani);
            tr = (TableRow) getView().findViewById(R.id.cdma_sysid);
            tr.setVisibility(View.VISIBLE);
            content = (HighlightTextView) getView().findViewById(R.id.network_sysid);
            content.updateText(String.valueOf(mAimsicdService.getCell().getSid()), ani);
            tr = (TableRow) getView().findViewById(R.id.cdma_baseid);
            tr.setVisibility(View.VISIBLE);
            content = (HighlightTextView) getView().findViewById(R.id.network_baseid);
            content.updateText(String.valueOf(mAimsicdService.getCell().getCellId()), ani);
            break;
        }
        }

        if (mAimsicdService.getCell().getTimingAdvance() != Integer.MAX_VALUE) {
            tr = (TableRow) getView().findViewById(R.id.lte_timing_advance);
            tr.setVisibility(View.VISIBLE);
            content = (HighlightTextView) getView().findViewById(R.id.network_lte_timing_advance);
            content.updateText(String.valueOf(mAimsicdService.getCell().getTimingAdvance()), ani);
        } else {
            tr = (TableRow) getView().findViewById(R.id.lte_timing_advance);
            tr.setVisibility(View.GONE);
        }

        if (mAimsicdService.getCell().getPrimaryScramblingCode() != Integer.MAX_VALUE) {
            content = (HighlightTextView) getView().findViewById(R.id.network_psc);
            content.updateText(String.valueOf(mAimsicdService.getCell().getPrimaryScramblingCode()), ani);
            tr = (TableRow) getView().findViewById(R.id.primary_scrambling_code);
            tr.setVisibility(View.VISIBLE);
        }

        String notAvailable = getString(R.string.n_a);

        content = (HighlightTextView) getView().findViewById(R.id.sim_country);
        content.updateText(mDevice.getSimCountry().orElse(notAvailable), ani);
        content = (HighlightTextView) getView().findViewById(R.id.sim_operator_id);
        content.updateText(mDevice.getSimOperator().orElse(notAvailable), ani);
        content = (HighlightTextView) getView().findViewById(R.id.sim_operator_name);
        content.updateText(mDevice.getSimOperatorName().orElse(notAvailable), ani);
        content = (HighlightTextView) getView().findViewById(R.id.sim_imsi);
        content.updateText(mDevice.getSimSubs().orElse(notAvailable), ani);
        content = (HighlightTextView) getView().findViewById(R.id.sim_serial);
        content.updateText(mDevice.getSimSerial().orElse(notAvailable), ani);

        content = (HighlightTextView) getView().findViewById(R.id.device_type);
        content.updateText(mDevice.getPhoneType(), ani);
        content = (HighlightTextView) getView().findViewById(R.id.device_imei);
        content.updateText(mDevice.getIMEI(), ani);
        content = (HighlightTextView) getView().findViewById(R.id.device_version);
        content.updateText(mDevice.getIMEIv(), ani);
        content = (HighlightTextView) getView().findViewById(R.id.network_name);
        content.updateText(mDevice.getNetworkName(), ani);
        content = (HighlightTextView) getView().findViewById(R.id.network_code);
        content.updateText(mDevice.getMncMcc(), ani);
        content = (HighlightTextView) getView().findViewById(R.id.network_type);
        content.updateText(mDevice.getNetworkTypeName(), ani);

        content = (HighlightTextView) getView().findViewById(R.id.data_activity);
        content.updateText(mDevice.getDataActivityType(), ani);
        content = (HighlightTextView) getView().findViewById(R.id.data_status);
        content.updateText(mDevice.getDataState(), ani);
        content = (HighlightTextView) getView().findViewById(R.id.network_roaming);
        content.updateText(String.valueOf(mDevice.isRoaming()), ani);

        ani.startAnimation(5000);
    }
}

From source file:de.domjos.schooltools.activities.MainActivity.java

private void hideButton(String content, int id, TableRow row) {
    if (content.equals(this.getString(id))) {
        row.setVisibility(View.VISIBLE);
    }/*  w  w  w.jav  a2s .c o  m*/
}

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

/**
 * Populate the order summary/*from   ww  w.  ja  va  2  s . com*/
 *
 * @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:org.nypl.simplified.app.MainSettingsAccountActivity.java

@Override
protected void onCreate(final @Nullable Bundle state) {
    super.onCreate(state);

    final Bundle extras = getIntent().getExtras();
    if (extras != null) {
        this.account = new AccountsRegistry(this).getAccount(extras.getInt("selected_account"));
    } else {/*from ww w  . ja va  2s.  co  m*/
        this.account = Simplified.getCurrentAccount();
    }

    final ActionBar bar = this.getActionBar();
    if (android.os.Build.VERSION.SDK_INT < 21) {
        bar.setDisplayHomeAsUpEnabled(false);
        bar.setHomeButtonEnabled(true);
        bar.setIcon(R.drawable.ic_arrow_back);
    } else {
        bar.setHomeAsUpIndicator(R.drawable.ic_arrow_back);
        bar.setDisplayHomeAsUpEnabled(true);
        bar.setHomeButtonEnabled(false);
    }

    final DocumentStoreType docs = Simplified.getDocumentStore(this.account, getResources());

    final LayoutInflater inflater = NullCheck.notNull(this.getLayoutInflater());

    final FrameLayout content_area = this.getContentFrame();
    final ViewGroup layout = NullCheck
            .notNull((ViewGroup) inflater.inflate(R.layout.settings_account, content_area, false));
    content_area.addView(layout);
    content_area.requestLayout();

    final TextView in_barcode_label = NullCheck.notNull(this.findViewById(R.id.settings_barcode_label));
    final TextView in_barcode_text = NullCheck.notNull(this.findViewById(R.id.settings_barcode_text));
    final TextView in_pin_label = NullCheck.notNull(this.findViewById(R.id.settings_pin_label));
    final ImageView in_barcode_image = NullCheck.notNull(this.findViewById(R.id.settings_barcode_image));
    final TextView in_barcode_image_toggle = NullCheck
            .notNull(this.findViewById(R.id.settings_barcode_toggle_barcode));
    final TextView in_pin_text = NullCheck.notNull(this.findViewById(R.id.settings_pin_text));
    final CheckBox in_pin_reveal = NullCheck.notNull(this.findViewById(R.id.settings_reveal_password));

    if (!this.account.pinRequired()) {
        in_pin_label.setVisibility(View.INVISIBLE);
        in_pin_text.setVisibility(View.INVISIBLE);
        in_pin_reveal.setVisibility(View.INVISIBLE);
    }

    final Button in_login = NullCheck.notNull(this.findViewById(R.id.settings_login));
    final Button in_signup = NullCheck.notNull(this.findViewById(R.id.settings_signup));

    this.sync_switch = findViewById(R.id.sync_switch);
    this.sync_table_row = findViewById(R.id.sync_table_row);
    this.sync_table_row.setVisibility(View.GONE);
    this.advanced_table_row = findViewById(R.id.link_advanced);
    this.advanced_table_row.setVisibility(View.GONE);

    this.advanced_table_row.setOnClickListener(view -> {
        final FragmentManager mgr = getFragmentManager();
        final FragmentTransaction transaction = mgr.beginTransaction();
        final SettingsAccountAdvancedFragment fragment = new SettingsAccountAdvancedFragment();
        transaction.add(R.id.settings_account_container, fragment).addToBackStack("advanced").commit();
    });

    final TableRow in_privacy = findViewById(R.id.link_privacy);
    final TableRow in_license = findViewById(R.id.link_license);

    final TextView account_name = NullCheck.notNull(this.findViewById(android.R.id.text1));
    final TextView account_subtitle = NullCheck.notNull(this.findViewById(android.R.id.text2));

    final ImageView in_account_icon = NullCheck.notNull(this.findViewById(R.id.account_icon));

    in_pin_text.setTransformationMethod(PasswordTransformationMethod.getInstance());
    if (android.os.Build.VERSION.SDK_INT >= 21) {
        this.handle_pin_reveal(in_pin_text, in_pin_reveal);
    } else {
        in_pin_reveal.setVisibility(View.GONE);
    }

    final TableRow in_report_issue = findViewById(R.id.report_issue);

    if (this.account.getSupportEmail() == null) {
        in_report_issue.setVisibility(View.GONE);
    } else {
        in_report_issue.setVisibility(View.VISIBLE);
        in_report_issue.setOnClickListener(view -> {
            final Intent intent = new Intent(this, ReportIssueActivity.class);
            final Bundle b = new Bundle();
            b.putInt("selected_account", this.account.getId());
            intent.putExtras(b);
            startActivity(intent);
        });
    }

    final TableRow in_support_center = findViewById(R.id.support_center);
    if (this.account.supportsHelpCenter()) {
        in_support_center.setVisibility(View.VISIBLE);
        in_support_center.setOnClickListener(view -> {
            final HSHelpStack stack = HSHelpStack.getInstance(this);
            final HSDeskGear gear = new HSDeskGear("https://nypl.desk.com/", "4GBRmMv8ZKG8fGehhA", null);
            stack.setGear(gear);
            stack.showHelp(this);
        });
    } else {
        in_support_center.setVisibility(View.GONE);
    }

    //Get labels from the current authentication document.
    final AuthenticationDocumentType auth_doc = docs.getAuthenticationDocument();
    in_barcode_label.setText(auth_doc.getLabelLoginUserID());
    in_pin_label.setText(auth_doc.getLabelLoginPassword());

    final TableLayout in_table_with_code = NullCheck
            .notNull(this.findViewById(R.id.settings_login_table_with_code));
    in_table_with_code.setVisibility(View.GONE);
    final TableLayout in_table_signup = NullCheck.notNull(this.findViewById(R.id.settings_signup_table));

    //    boolean locationpermission = false;
    //    if (ContextCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
    //      locationpermission = true;
    //    }
    //    else
    //    {
    //      ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 1);
    //    }

    if (this.account.supportsCardCreator() || this.account.getCardCreatorUrl() != null) {
        in_table_signup.setVisibility(View.VISIBLE);
    } else {
        in_table_signup.setVisibility(View.GONE);
    }

    in_login.setOnClickListener(v -> this.onLoginWithBarcode());

    final CheckBox in_age13_checkbox = NullCheck.notNull(this.findViewById(R.id.age13_checkbox));

    if (Simplified.getSharedPrefs().contains("age13")) {
        in_age13_checkbox.setChecked(Simplified.getSharedPrefs().getBoolean("age13"));
    } else if (account.getId() == 2) {
        showAgeGateOptionsDialog(in_age13_checkbox);
    }

    in_age13_checkbox.setOnCheckedChangeListener(this::showAgeChangeConfirmation);

    if (this.account.needsAuth()) {
        in_login.setVisibility(View.VISIBLE);
        in_age13_checkbox.setVisibility(View.GONE);
    } else {
        in_login.setVisibility(View.GONE);
        in_age13_checkbox.setVisibility(View.VISIBLE);
    }

    if (this.account.supportsCardCreator()) {
        in_signup.setOnClickListener(v -> {
            final Intent cardcreator = new Intent(this, CardCreatorActivity.class);
            startActivity(cardcreator);
        });
        in_signup.setText(R.string.need_card_button);

    } else if (this.account.getCardCreatorUrl() != null) {
        in_signup.setOnClickListener(v -> {
            final Intent e_card = new Intent(Intent.ACTION_VIEW);
            e_card.setData(Uri.parse(this.account.getCardCreatorUrl()));
            startActivity(e_card);
        });
        in_signup.setText(R.string.need_card_button);
    }

    final boolean permission = Simplified.getSharedPrefs().getBoolean("syncPermissionGranted",
            this.account.getId());
    this.sync_switch.setChecked(permission);

    /*
    If switching on, disable user interaction until server has responded.
    If switching off, disable applicable network requests by updating shared prefs flags.
     */
    this.sync_switch.setOnCheckedChangeListener((buttonView, isChecked) -> {
        if (isChecked) {
            buttonView.setEnabled(false);
            annotationsManager.updateServerSyncPermissionStatus(true, (success) -> {
                if (success) {
                    Simplified.getSharedPrefs().putBoolean("syncPermissionGranted", this.account.getId(), true);
                    this.sync_switch.setChecked(true);
                } else {
                    Simplified.getSharedPrefs().putBoolean("syncPermissionGranted", this.account.getId(),
                            false);
                    this.sync_switch.setChecked(false);
                }
                this.sync_switch.setEnabled(true);
                return kotlin.Unit.INSTANCE;
            });
        } else {
            Simplified.getSharedPrefs().putBoolean("syncPermissionGranted", this.account.getId(), false);
            this.sync_switch.setChecked(false);
        }
    });

    if (this.account.getPrivacyPolicy() != null) {
        in_privacy.setVisibility(View.VISIBLE);
    } else {
        in_privacy.setVisibility(View.GONE);
    }
    if (this.account.getContentLicense() != null) {
        in_license.setVisibility(View.VISIBLE);
    } else {
        in_license.setVisibility(View.GONE);
    }

    in_license.setOnClickListener(view -> {
        final Intent intent = new Intent(this, WebViewActivity.class);
        final Bundle b = new Bundle();
        WebViewActivity.setActivityArguments(b, this.account.getContentLicense(), "Content Licenses",
                SimplifiedPart.PART_SETTINGS);
        intent.putExtras(b);
        intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        startActivity(intent);
    });

    in_privacy.setOnClickListener(view -> {
        final Intent intent = new Intent(this, WebViewActivity.class);
        final Bundle b = new Bundle();
        WebViewActivity.setActivityArguments(b, this.account.getPrivacyPolicy(), "Privacy Policy",
                SimplifiedPart.PART_SETTINGS);
        intent.putExtras(b);
        intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        startActivity(intent);
    });

    this.navigationDrawerSetActionBarTitle();

    this.account_name_text = account_name;
    this.account_subtitle_text = account_subtitle;
    this.account_icon = in_account_icon;
    this.barcode_text = in_barcode_text;
    this.pin_text = in_pin_text;
    this.barcode_image_toggle = in_barcode_image_toggle;
    this.barcode_image = in_barcode_image;
    this.login = in_login;
    this.table_with_code = in_table_with_code;
    this.table_signup = in_table_signup;

    final CheckBox in_eula_checkbox = NullCheck.notNull(this.findViewById(R.id.eula_checkbox));

    final OptionType<EULAType> eula_opt = docs.getEULA();

    if (eula_opt.isSome()) {
        final Some<EULAType> some_eula = (Some<EULAType>) eula_opt;
        final EULAType eula = some_eula.get();

        in_eula_checkbox.setChecked(eula.eulaHasAgreed());
        in_eula_checkbox.setEnabled(true);
        in_eula_checkbox.setOnCheckedChangeListener((button, checked) -> eula.eulaSetHasAgreed(checked));

        if (eula.eulaHasAgreed()) {
            LOG.debug("EULA: agreed");
        } else {
            LOG.debug("EULA: not agreed");
        }
    } else {
        LOG.debug("EULA: unavailable");
    }

    this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
}

From source file:com.hybris.mobile.app.commerce.view.CartViewUtils.java

/**
 * Populate the cart summary/*from   w  w w. j a va  2s  . co m*/
 *
 * @param cart
 */
public static void createCartSummary(View view, Cart cart, boolean enableItems) {

    // Cart summary
    LinearLayout mCartSummaryItemsLayout;
    TextView mCartSummaryItems;
    TextView mCartSummarySubtotal;
    TextView mCartSummarySavings;
    TextView mCartSummaryTax;
    TextView mCartSummaryShipping;
    TextView mCartSummaryTotal;
    TextView mCartSummaryPromotion;
    TableRow mCartSummarySavingsRow;
    TableRow mCartSummaryTaxRow;
    TextView mCartSummaryNoTax;
    TableRow mCartSummaryShippingRow;
    TextView mCartSummaryEmpty;
    LinearLayout mCartSummaryDetailsLayout;

    // cart summary
    mCartSummaryItemsLayout = (LinearLayout) view.findViewById(R.id.cart_summary_items_layout);
    mCartSummaryItems = (TextView) view.findViewById(R.id.cart_summary_items);
    mCartSummarySubtotal = (TextView) view.findViewById(R.id.cart_summary_subtotal);
    mCartSummarySavings = (TextView) view.findViewById(R.id.cart_summary_savings);
    mCartSummaryTax = (TextView) view.findViewById(R.id.cart_summary_tax);
    mCartSummaryShipping = (TextView) view.findViewById(R.id.cart_summary_shipping);
    mCartSummaryTotal = (TextView) view.findViewById(R.id.cart_summary_total);
    mCartSummaryPromotion = (TextView) view.findViewById(R.id.cart_summary_promotion);
    mCartSummarySavingsRow = (TableRow) view.findViewById(R.id.cart_summary_savings_row);
    mCartSummaryTaxRow = (TableRow) view.findViewById(R.id.cart_summary_tax_row);
    mCartSummaryNoTax = (TextView) view.findViewById(R.id.cart_summary_no_taxes);
    mCartSummaryShippingRow = (TableRow) view.findViewById(R.id.cart_summary_shipping_row);
    mCartSummaryEmpty = (TextView) view.findViewById(R.id.cart_summary_empty);
    mCartSummaryDetailsLayout = (LinearLayout) view.findViewById(R.id.cart_summary_details_layout);

    if (cart != null) {
        if (cart.getEntries() != null && !cart.getEntries().isEmpty()) {
            // Display total price
            if (cart.getTotalPrice() != null) {
                mCartSummaryTotal.setText(cart.getTotalPrice().getFormattedValue());
            }

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

            // Display tax price
            if (cart.getTotalTax() != null && cart.getTotalTax().getValue().intValue() > 0) {
                mCartSummaryTax.setText(cart.getTotalTax().getFormattedValue());
                mCartSummaryTaxRow.setVisibility(View.VISIBLE);
                mCartSummaryNoTax.setVisibility(View.GONE);
            } else {
                mCartSummaryTaxRow.setVisibility(View.GONE);
                mCartSummaryNoTax.setVisibility(View.VISIBLE);
            }

            // Display delivery method cost
            if (cart.getDeliveryCost() != null) {
                mCartSummaryShipping.setText(cart.getDeliveryCost().getFormattedValue());
                mCartSummaryShippingRow.setVisibility(View.VISIBLE);
            } else {
                mCartSummaryShippingRow.setVisibility(View.GONE);
            }

            if (cart.getAppliedOrderPromotions() != null && !cart.getAppliedOrderPromotions().isEmpty()) {
                if (StringUtils.isNotBlank(cart.getOrderDiscounts().getFormattedValue())) {
                    mCartSummarySavingsRow.setVisibility(View.VISIBLE);
                    mCartSummarySavings.setText(cart.getOrderDiscounts().getFormattedValue());
                }
            }

            if (cart.getTotalDiscounts() != null && cart.getTotalDiscounts().getValue().doubleValue() > 0) {
                if (cart.getAppliedOrderPromotions() != null && !cart.getAppliedOrderPromotions().isEmpty()) {
                    mCartSummaryPromotion.setVisibility(View.VISIBLE);
                    // Nb order Promotion
                    StringBuffer promotion = new StringBuffer();
                    for (PromotionResult orderPromotion : cart.getAppliedOrderPromotions()) {
                        promotion.append(orderPromotion.getDescription()).append("\n");
                    }
                    mCartSummaryPromotion.setText(promotion);
                } else {
                    mCartSummaryPromotion.setVisibility(View.GONE);
                }
            } else {
                mCartSummaryPromotion.setVisibility(View.GONE);
                mCartSummarySavingsRow.setVisibility(View.GONE);
            }

            // Nb items
            mCartSummaryItemsLayout.setVisibility(enableItems ? View.VISIBLE : View.GONE);
            mCartSummaryItems.setText(CommerceApplication.getContext().getString(R.string.cart_summary_items,
                    cart.getTotalUnitCount()));

            //Cart is used
            mCartSummaryEmpty.setVisibility(View.GONE);
            mCartSummaryDetailsLayout.setVisibility(View.VISIBLE);
        } else {
            //Cart Empty show messages & Cart Empty remove all summary views
            mCartSummaryEmpty.setVisibility(View.VISIBLE);
            mCartSummaryDetailsLayout.setVisibility(View.GONE);
            mCartSummaryPromotion.setVisibility(View.GONE);

        }
    }
}

From source file:com.landenlabs.all_devtool.IconBaseFragment.java

/**
 * Display icon (drawable) information//from w  w  w  . j  av a 2  s  .  c om
 *
 * @param iconInfo
 */
private void showIconDialog(IconInfo iconInfo) {
    Drawable iconD = iconInfo.getDrawable();
    String iconType = iconD.getClass().getSimpleName();

    LayoutInflater inflater = m_context.getLayoutInflater();
    final View dialogLayout = inflater.inflate(R.layout.icon_dlg, null);

    View shareBtn = dialogLayout.findViewById(R.id.icon_dlg_share);
    shareBtn.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            Utils.shareScreen(dialogLayout, "iconDetail", null);
        }
    });

    final TextView imageName = Ui.viewById(dialogLayout, R.id.icon_dlg_name);
    final TextView imageSize = Ui.viewById(dialogLayout, R.id.icon_dlg_size);
    final TextView imageType = Ui.viewById(dialogLayout, R.id.icon_dlg_type);
    final TextView imageExtra = Ui.viewById(dialogLayout, R.id.icon_dlg_extra);

    imageName.setText(iconInfo.fieldStr());
    imageSize.setText(String.format("Size: %d x %d", iconD.getIntrinsicWidth(), iconD.getIntrinsicHeight()));
    imageType.setText(iconType);

    final ImageView imageView = Ui.viewById(dialogLayout, R.id.icon_dlg_image);
    // imageView.setImageDrawable(iconD);
    boolean hasStates = iconD.isStateful();

    final View stateTitle = dialogLayout.findViewById(R.id.icon_dlg_state_title);
    stateTitle.setVisibility(hasStates ? View.VISIBLE : View.GONE);

    final TableRow row1 = Ui.viewById(dialogLayout, R.id.icon_dlg_state_row1);
    row1.removeAllViews();

    final TableRow row2 = Ui.viewById(dialogLayout, R.id.icon_dlg_state_row2);
    row2.removeAllViews();

    boolean showRows = false;
    String extraInfo = "";

    if (hasStates) {
        extraInfo = "StateFul";
        showRows = true;

        StateListDrawable stateListDrawable = (StateListDrawable) iconD;
        Set<Drawable> stateIcons = new HashSet<Drawable>();
        showStateIcon(imageView, row1, row2, stateListDrawable, android.R.attr.state_enabled, "Enabled",
                stateIcons);
        showStateIcon(imageView, row1, row2, stateListDrawable, android.R.attr.state_pressed, "Pressed",
                stateIcons);
        showStateIcon(imageView, row1, row2, stateListDrawable, android.R.attr.state_checked, "Checked",
                stateIcons);
        showStateIcon(imageView, row1, row2, stateListDrawable, android.R.attr.state_selected, "Selected",
                stateIcons);
    }

    if (iconType.equals(LayerDrawable.class.getSimpleName())) {
        showRows = true;
        LayerDrawable layerDrawable = (LayerDrawable) iconD;
        int layerCnt = layerDrawable.getNumberOfLayers();
        extraInfo = String.format(Locale.getDefault(), "Layers:%d", layerCnt);
        for (int layerIdx = 0; layerIdx < Math.min(layerCnt, 3); layerIdx++) {
            showLayerIcon(imageView, row1, row2, layerDrawable.getDrawable(layerIdx), layerIdx);
        }
    } else if (iconType.equals(AnimationDrawable.class.getSimpleName())) {
        final AnimationDrawable animationDrawable = (AnimationDrawable) iconD;
        extraInfo = String.format(Locale.getDefault(), "Frames:%d", animationDrawable.getNumberOfFrames());
        showRows = true;
        showAnimationBtns(imageView, animationDrawable, row1, row2);

        // Can't control animation at this time, drawable not rendered yet.
        // animationDrawable.stop();
    }

    row1.setVisibility(showRows ? View.VISIBLE : View.GONE);
    row2.setVisibility(showRows ? View.VISIBLE : View.GONE);

    imageExtra.setText(extraInfo);
    imageView.setImageDrawable(iconD);

    dialogLayout.findViewById(R.id.icon_dlg_whiteBtn).setOnClickListener(new View.OnClickListener() {
        @SuppressWarnings("deprecation")
        @Override
        public void onClick(View v) {
            imageView.setBackgroundDrawable(v.getBackground());
        }
    });

    dialogLayout.findViewById(R.id.icon_dlg_grayBtn).setOnClickListener(new View.OnClickListener() {
        @SuppressWarnings("deprecation")
        @Override
        public void onClick(View v) {
            imageView.setBackgroundDrawable(v.getBackground());
        }
    });

    dialogLayout.findViewById(R.id.icon_dlg_blackBtn).setOnClickListener(new View.OnClickListener() {
        @SuppressWarnings("deprecation")
        @Override
        public void onClick(View v) {
            imageView.setBackgroundDrawable(v.getBackground());
        }
    });

    dialogLayout.findViewById(R.id.icon_dlg_squaresBtn).setOnClickListener(new View.OnClickListener() {
        @SuppressWarnings("deprecation")
        @Override
        public void onClick(View v) {
            imageView.setBackgroundDrawable(v.getBackground());
        }
    });

    AlertDialog.Builder builder = new AlertDialog.Builder(m_context);
    builder.setView(dialogLayout);

    builder.setMessage("Icon").setCancelable(false).setPositiveButton("Close",
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    // if this button is clicked, close
                    dialog.cancel();
                }
            });

    builder.show();
}