Example usage for android.widget TextView invalidate

List of usage examples for android.widget TextView invalidate

Introduction

In this page you can find the example usage for android.widget TextView invalidate.

Prototype

public void invalidate() 

Source Link

Document

Invalidate the whole view.

Usage

From source file:com.google.corp.productivity.specialprojects.android.samples.fft.AnalyzeActivity.java

private void refreshPeakLabel() {
    textPeak.setLength(0);/* ww  w .j a  va2 s  .co m*/
    textPeak.append("Peak:");
    SBNumFormat.fillInNumFixedWidthPositive(textPeak, maxAmpFreq, 5, 1);
    textPeak.append("Hz(");
    freq2Cent(textPeak, maxAmpFreq, " ");
    textPeak.append(") ");
    SBNumFormat.fillInNumFixedWidth(textPeak, maxAmpDB, 3, 1);
    textPeak.append("dB");
    textPeak.getChars(0, Math.min(textPeak.length(), textPeakChar.length), textPeakChar, 0);

    TextView tv = (TextView) findViewById(R.id.textview_peak);
    tv.setText(textPeakChar, 0, textPeakChar.length);
    tv.invalidate();
}

From source file:com.inmobi.ultrapush.AnalyzeActivity.java

private void refreshRMSLabel() {
    textRMS.setLength(0);/*from w w  w  .jav a 2  s .  c o m*/
    textRMS.append("RMS:dB \n");
    SBNumFormat.fillInNumFixedWidth(textRMS, 20 * Math.log10(dtRMSFromFT), 3, 1);
    textRMS.getChars(0, Math.min(textRMS.length(), textRMSChar.length), textRMSChar, 0);

    TextView tv = (TextView) findViewById(R.id.textview_RMS);
    tv.setText(textRMSChar, 0, textRMSChar.length);
    tv.invalidate();
}

From source file:com.inmobi.ultrapush.AnalyzeActivity.java

private void refreshPeakLabel() {
    fifoQueue.add(maxAmpFreq);//from w  w w  .  j  a v a 2 s . co  m

    if (maxAmpFreq < 16000) {
        handler.removeCallbacks(frequencyDetectorRunnable);
        return;
    }

    getMaxValueFromFifo(maxAmpFreq);

    handler.post(frequencyDetectorRunnable);
    textPeak.setLength(0);
    textPeak.append("Peak:");
    SBNumFormat.fillInNumFixedWidthPositive(textPeak, maxAmpFreq, 5, 1);
    textPeak.append("Hz(");
    freq2Cent(textPeak, maxAmpFreq, " ");
    textPeak.append(") ");
    SBNumFormat.fillInNumFixedWidth(textPeak, maxAmpDB, 3, 1);
    textPeak.append("dB");
    textPeak.getChars(0, Math.min(textPeak.length(), textPeakChar.length), textPeakChar, 0);

    TextView tv = (TextView) findViewById(R.id.textview_peak);
    tv.setText(textPeakChar, 0, textPeakChar.length);
    tv.invalidate();
}

From source file:ru.adios.budgeter.widgets.DataTableLayout.java

public void enableUserOrdering(OrderResolver orderResolver) {
    checkArgument(orderResolver != null, "orderResolver is null");
    this.orderResolver = Optional.of(orderResolver);
    if (getChildCount() > 0) {
        final TableRow columnsRow = (TableRow) getChildAt(2);
        for (int i = 0; i < columnsRow.getChildCount(); i++) {
            final TextView col = (TextView) columnsRow.getChildAt(i);
            final String text = col.getText().toString();

            if (!orderBy.isPresent()) {
                final Optional<OrderBy> possibleOrder = orderResolver.byColumnName(text, Order.DESC);
                if (!possibleOrder.isPresent()) {
                    continue;
                }//  w  w  w . j a  v a  2s. co m
                orderBy = Optional.of(possibleOrder.get());
                selectOrderByColumn(col);
                if (tablePopulated) {
                    clearContents();
                    loadTableProcedures();
                }
                return;
            }

            if (text.equals(orderResolver.byField(orderBy.get().field).orElse(null))) {
                if (!col.isSelected()) {
                    selectOrderByColumn(col);
                    col.invalidate();
                }
                break;
            }
        }
    }
}

From source file:org.xingjitong.InCallActivity.java

private void displayCall(Resources resources, LinphoneCall call, int index) {
    String sipUri = call.getRemoteAddress().asStringUriOnly();
    LinphoneAddress lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
    // Control Row
    LinearLayout callView = (LinearLayout) inflater.inflate(R.layout.active_call_control_row, container, false);
    setContactPhone(callView, lAddress, sipUri, resources);
    //yyppcallingfun del
    //displayCallStatusIconAndReturnCallPaused(callView, call);
    setRowBackground(callView, index);//from   w w w. ja  v  a  2s  . c  o  m
    registerCallDurationTimer(callView, call);
    callsList.addView(callView);

    // Image Row
    LinearLayout imageView = (LinearLayout) inflater.inflate(R.layout.active_call_image_row, container, false);
    Uri pictureUri = LinphoneUtils.findUriPictureOfContactAndSetDisplayName(lAddress,
            imageView.getContext().getContentResolver());

    final TextView name = (TextView) imageView.findViewById(R.id.call_name);
    //yyppcalling //yyppcallingui add
    //callhint = (TextView) imageView.findViewById(R.id.incall_callhint);

    phone = sipUri.substring(sipUri.indexOf(":") + 1, sipUri.indexOf("@"));
    if (phone.startsWith("01") && !phone.startsWith("010")) {
        phone = phone.substring(1);
    } else if (phone.startsWith("51201")) {
        phone = phone.substring(4);
    } else if (phone.startsWith("512")) {
        phone = phone.substring(3);
    }
    if (!phone.startsWith("1") && !phone.startsWith("0")) {
        phone = "0" + phone;
    }
    handler.post(new Runnable() {

        @Override
        public void run() {
            String n = ContactDB.Instance().getName(phone);
            if (!n.equals(phone) && n != null) {
                name.invalidate();
                name.setText(n);
            }
        }
    });
    displayOrHideContactPicture(imageView, pictureUri, false);
    callsList.addView(imageView);

    callView.setTag(imageView);
    callView.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (v.getTag() != null) {
                View imageView = (View) v.getTag();
                if (imageView.getVisibility() == View.VISIBLE)
                    imageView.setVisibility(View.GONE);
                else
                    imageView.setVisibility(View.VISIBLE);
                callsList.invalidate();
            }
        }
    });
}

From source file:at.alladin.rmbt.android.adapter.result.RMBTResultPagerAdapter.java

/**
 * //from ww w . jav a  2s  . co m
 * @param view
 */
private void displayResult(View view, LayoutInflater inflater, ViewGroup vg) {
    /*
     final Button shareButton = (Button) view.findViewById(R.id.resultButtonShare);
     if (shareButton != null)
    shareButton.setEnabled(false);
    */

    //final LinearLayout measurementLayout = (LinearLayout) view.findViewById(R.id.resultMeasurementList);
    measurementLayout = (LinearLayout) view.findViewById(R.id.resultMeasurementList);
    measurementLayout.setVisibility(View.GONE);

    final LinearLayout resultLayout = (LinearLayout) view.findViewById(R.id.result_layout);
    resultLayout.setVisibility(View.INVISIBLE);

    final LinearLayout netLayout = (LinearLayout) view.findViewById(R.id.resultNetList);
    netLayout.setVisibility(View.GONE);

    final TextView measurementHeader = (TextView) view.findViewById(R.id.resultMeasurement);
    measurementHeader.setVisibility(View.GONE);

    final TextView netHeader = (TextView) view.findViewById(R.id.resultNet);
    netHeader.setVisibility(View.GONE);

    final TextView emptyView = (TextView) view.findViewById(R.id.infoText);
    emptyView.setVisibility(View.GONE);
    final float scale = activity.getResources().getDisplayMetrics().density;

    final ProgressBar progessBar = (ProgressBar) view.findViewById(R.id.progressBar);

    if (testResult != null && testResult.length() > 0) {

        JSONObject resultListItem;

        try {
            resultListItem = testResult.getJSONObject(0);

            openTestUuid = resultListItem.optString("open_test_uuid");
            if (graphView != null) {
                graphView.setOpenTestUuid(openTestUuid);
                graphView.initialize(graphViewEndTaskListener);
            }

            JSONObject testResultItem;
            try {
                testResultItem = testResult.getJSONObject(0);
                if (testResultItem.has("geo_lat") && testResultItem.has("geo_long") && !hasMap) {
                    hasMap = true;
                    if (dataChangedListener != null) {
                        dataChangedListener.onChange(false, true, "HAS_MAP");
                    }
                    notifyDataSetChanged();
                } else if (!testResultItem.has("geo_lat") && !testResultItem.has("geo_long") && hasMap) {
                    System.out.println("hasMap = " + hasMap);
                    hasMap = false;
                    if (dataChangedListener != null) {
                        dataChangedListener.onChange(true, false, "HAS_MAP");
                    }
                    notifyDataSetChanged();
                }
            } catch (JSONException e) {
                hasMap = false;
                e.printStackTrace();
            }

            if (completeListener != null) {
                completeListener.onComplete(OnCompleteListener.DATA_LOADED, this);
            }

            final JSONArray measurementArray = resultListItem.getJSONArray("measurement");

            final JSONArray netArray = resultListItem.getJSONArray("net");

            final int leftRightDiv = Helperfunctions.dpToPx(0, scale);
            final int topBottomDiv = Helperfunctions.dpToPx(0, scale);
            final int heightDiv = Helperfunctions.dpToPx(1, scale);

            for (int i = 0; i < measurementArray.length(); i++) {

                final View measurementItemView = inflater.inflate(R.layout.classification_list_item, vg, false);

                final JSONObject singleItem = measurementArray.getJSONObject(i);

                final TextView itemTitle = (TextView) measurementItemView
                        .findViewById(R.id.classification_item_title);
                itemTitle.setText(singleItem.getString("title"));

                final ImageView itemClassification = (ImageView) measurementItemView
                        .findViewById(R.id.classification_item_color);
                itemClassification.setImageResource(
                        Helperfunctions.getClassificationColor(singleItem.getInt("classification")));

                itemClassification.setOnClickListener(new OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        activity.showHelp(R.string.url_help_result, false);
                    }
                });

                final TextView itemValue = (TextView) measurementItemView
                        .findViewById(R.id.classification_item_value);
                itemValue.setText(singleItem.getString("value"));

                measurementLayout.addView(measurementItemView);

                final View divider = new View(activity);
                divider.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, heightDiv, 1));
                divider.setPadding(leftRightDiv, topBottomDiv, leftRightDiv, topBottomDiv);

                divider.setBackgroundResource(R.drawable.bg_trans_light_10);

                measurementLayout.addView(divider);

                measurementLayout.invalidate();
            }

            for (int i = 0; i < netArray.length(); i++) {

                final JSONObject singleItem = netArray.getJSONObject(i);

                addResultListItem(singleItem.getString("title"), singleItem.optString("value", null),
                        netLayout);
            }

            addQoSResultItem();

        } catch (final JSONException e) {
            e.printStackTrace();
        }

        progessBar.setVisibility(View.GONE);
        emptyView.setVisibility(View.GONE);

        resultLayout.setVisibility(View.VISIBLE);
        measurementHeader.setVisibility(View.VISIBLE);
        netHeader.setVisibility(View.VISIBLE);

        measurementLayout.setVisibility(View.VISIBLE);
        netLayout.setVisibility(View.VISIBLE);

    } else {
        Log.i(DEBUG_TAG, "LEERE LISTE");
        progessBar.setVisibility(View.GONE);
        emptyView.setVisibility(View.VISIBLE);
        emptyView.setText(activity.getString(R.string.error_no_data));
        emptyView.invalidate();
    }
}