Example usage for android.widget TextView append

List of usage examples for android.widget TextView append

Introduction

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

Prototype

public final void append(CharSequence text) 

Source Link

Document

Convenience method to append the specified text to the TextView's display buffer, upgrading it to android.widget.TextView.BufferType#EDITABLE if it was not already editable.

Usage

From source file:eu.trentorise.smartcampus.trentinofamiglia.fragments.poi.PoisListingFragment.java

@Override
public void onStart() {
    // hide keyboard if it is still open
    Utils.hideKeyboard(getActivity());/* ww  w  .j a v  a  2s .  c  om*/

    if (reload) {
        poiAdapter = new PoiAdapter(context, R.layout.pois_row);
        setAdapter(poiAdapter);
        reload = false;
    }
    Bundle bundle = this.getArguments();
    String category = (bundle != null) ? bundle.getString(SearchFragment.ARG_CATEGORY) : null;
    CategoryDescriptor catDescriptor = CategoryHelper
            .getCategoryDescriptorByCategoryFiltered(CategoryHelper.CATEGORY_TYPE_POIS, category);
    String categoryString = (catDescriptor != null)
            ? context.getResources().getString(catDescriptor.description)
            : null;

    //      //warning toast if baby little home or hotels
    //      warningToast(catDescriptor);
    // set title
    TextView title = (TextView) getView().findViewById(R.id.list_title);
    if (categoryString != null) {
        title.setText(categoryString);
    }
    if (bundle != null && bundle.containsKey(SearchFragment.ARG_QUERY)
            && bundle.getString(SearchFragment.ARG_QUERY) != null) {
        String query = bundle.getString(SearchFragment.ARG_QUERY);
        title.setText(context.getResources().getString(R.string.search_for) + " ' " + query + " '");
        if (bundle.containsKey(SearchFragment.ARG_CATEGORY)) {
            category = bundle.getString(SearchFragment.ARG_CATEGORY);
            if (category != null)
                title.append(" " + context.getResources().getString(R.string.search_in_category) + " "
                        + getString(catDescriptor.description));
        }

    }
    if (bundle.containsKey(SearchFragment.ARG_WHERE_SEARCH)) {
        WhereForSearch where = bundle.getParcelable(SearchFragment.ARG_WHERE_SEARCH);
        if (where != null)
            title.append(" " + where.getDescription() + " ");
    }

    // close items menus if open
    ((View) list.getParent()).setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            hideListItemsMenu(v, false);
        }
    });
    list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            hideListItemsMenu(view, false);
            setStorePoiId(view, position);

        }
    });

    // open items menu for that entry
    // list.setOnItemLongClickListener(new
    // AdapterView.OnItemLongClickListener() {
    // public boolean onItemLongClick(AdapterView<?> parent, View view, int
    // position, long id) {
    // if ((position != postitionSelected) && (previousViewSwitcher !=
    // null)) {
    // // //close the old viewSwitcher
    // previousViewSwitcher.showPrevious();
    // poiAdapter.setElementSelected(-1);
    // previousViewSwitcher = null;
    // hideListItemsMenu(view, true);
    //
    // }
    // ViewSwitcher vs = (ViewSwitcher)
    // view.findViewById(R.id.poi_viewswitecher);
    // setupOptionsListeners(vs, position);
    // vs.showNext();
    // postitionSelected = position;
    // poiAdapter.setElementSelected(position);
    // previousViewSwitcher = vs;
    //
    // return true;
    // }
    // });

    //      FeedbackFragmentInflater.inflateHandleButton(getActivity(), getView());
    super.onStart();
}

From source file:org.akvo.caddisfly.sensor.colorimetry.strip.camera.InstructionFragment.java

private void showInstruction(@NonNull LinearLayout linearLayout, @NonNull String instruction, int style) {
    TextView textView = new TextView(getActivity());
    textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.mediumTextSize));

    textView.setPadding((int) getResources().getDimension(R.dimen.activity_vertical_margin), 0,
            (int) getResources().getDimension(R.dimen.activity_vertical_margin),
            (int) getResources().getDimension(R.dimen.activity_vertical_margin));

    String text = instruction;/* w w  w  .j  ava 2  s.  c om*/
    if (instruction.contains("<!>")) {
        text = instruction.replaceAll("<!>", "");
        textView.setTextColor(Color.RED);
    } else {
        textView.setTextColor(Color.DKGRAY);
    }

    if (instruction.contains("<b>") || style == BOLD) {
        text = text.replaceAll("<b>", "").replaceAll("</b>", "");
        textView.setTypeface(null, Typeface.BOLD);
        textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.titleTextSize));
    } else {
        textView.setTextColor(Color.DKGRAY);
    }

    textView.setLineSpacing(
            TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5.0f, getResources().getDisplayMetrics()),
            1.0f);

    Spanned spanned = StringUtil.getStringResourceByName(getContext(), text);
    if (!text.isEmpty()) {
        textView.append(spanned);
        linearLayout.addView(textView);
    }
}

From source file:eu.trentorise.smartcampus.trentinofamiglia.fragments.event.EventsListingFragment.java

@Override
public void onStart() {
    // hide keyboard if it is still open
    Utils.hideKeyboard(getActivity());//  ww w .  ja  va 2s  .c  o  m

    Bundle bundle = this.getArguments();

    if (reload) {
        eventsAdapter = new EventAdapter(context, R.layout.events_row, postProcAndHeader);
        setAdapter(eventsAdapter);
        reload = false;
    }

    // set title
    TextView title = (TextView) getView().findViewById(R.id.list_title);
    String category = bundle.getString(SearchFragment.ARG_CATEGORY);
    CategoryDescriptor catDescriptor = CategoryHelper
            .getCategoryDescriptorByCategoryFiltered(CategoryHelper.CATEGORY_TYPE_EVENTS, category);
    String categoryString = (catDescriptor != null)
            ? context.getResources().getString(catDescriptor.description)
            : null;
    //      //load warning toast if summer events
    //      warningToast(catDescriptor);

    if (bundle != null && bundle.containsKey(SearchFragment.ARG_QUERY)
            && bundle.getString(SearchFragment.ARG_QUERY) != null) {
        String query = bundle.getString(SearchFragment.ARG_QUERY);
        title.setText(context.getResources().getString(R.string.search_for) + " ' " + query + " '");
        if (bundle.containsKey(SearchFragment.ARG_CATEGORY)) {
            category = bundle.getString(SearchFragment.ARG_CATEGORY);
            if (category != null)
                title.append(" " + context.getResources().getString(R.string.search_in_category) + " "
                        + getString(catDescriptor.description));
        }

    } else if (bundle != null && bundle.containsKey(SearchFragment.ARG_CATEGORY)
            && (bundle.getString(SearchFragment.ARG_CATEGORY) != null)) {
        title.setText(categoryString);
    }
    // else if (bundle != null && bundle.containsKey(SearchFragment.ARG_MY)
    // && bundle.getBoolean(SearchFragment.ARG_MY)) {
    // title.setText(R.string.myevents);
    // }
    else if (bundle != null && bundle.containsKey(ARG_POI_NAME)) {
        String poiName = bundle.getString(ARG_POI_NAME);
        title.setText(getResources().getString(R.string.eventlist_at_place) + " " + poiName);
    } else if (bundle != null && bundle.containsKey(ARG_QUERY)) {
        String query = bundle.getString(ARG_QUERY);
        title.setText(context.getResources().getString(R.string.search_for) + " '" + query + "'");
        if (bundle.containsKey(ARG_CATEGORY_SEARCH)) {
            category = bundle.getString(ARG_CATEGORY_SEARCH);
            if (category != null)
                title.append(context.getResources().getString(R.string.search_in_category) + " " + category);
        }
    } else if (bundle != null && bundle.containsKey(ARG_QUERY_TODAY)) {
        title.setText(context.getResources().getString(R.string.search_today_events));
    }
    if (bundle.containsKey(SearchFragment.ARG_WHERE_SEARCH)) {
        WhereForSearch where = bundle.getParcelable(SearchFragment.ARG_WHERE_SEARCH);
        if (where != null)
            title.append(" " + where.getDescription() + " ");
    }

    if (bundle.containsKey(SearchFragment.ARG_WHEN_SEARCH)) {
        WhenForSearch when = bundle.getParcelable(SearchFragment.ARG_WHEN_SEARCH);
        if (when != null)
            title.append(" " + when.getDescription() + " ");
    }
    // close items menus if open
    ((View) list.getParent()).setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            hideListItemsMenu(v, false);
        }
    });
    list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            hideListItemsMenu(view, false);
            setStoreEventId(view, position);
        }

    });

    super.onStart();

}

From source file:nl.privacybarometer.privacyvandaag.adapter.FeedsCursorAdapter.java

@Override
protected void bindChildView(View view, Context context, Cursor cursor) {
    view.findViewById(R.id.indicator).setVisibility(View.INVISIBLE);

    TextView textView = ((TextView) view.findViewById(android.R.id.text1));
    // if FetchMode is 99 then DO-NOT-REFRESH feed channel. activeFeedChannel = false;
    boolean activeFeedChannel = !(cursor.getInt(mFetchModePos) == FETCHMODE_DO_NOT_FETCH);

    // Use icons in package instead of fetching favicons from internet. See comment below.
    Drawable mDrawable;//from  w w w  .j av a  2  s. c om
    int mIconResourceId = cursor.getInt(mIconId);
    if (mIconResourceId > 0) {
        mDrawable = ContextCompat.getDrawable(context, mIconResourceId);
    } else {
        mDrawable = ContextCompat.getDrawable(context, R.drawable.logo_icon_pv);
    }
    mDrawable.setBounds(0, 0, 50, 50); // define the size of the drawable
    textView.setCompoundDrawables(mDrawable, null, null, null);

    //  Code not needed since we no longer use favicons retrieved from the internet,
    //but use the logo's included in the resource directory of the app using the code above.
    /*
        final long feedId = cursor.getLong(mIdPos);
        Bitmap bitmap = UiUtils.getFaviconBitmap(feedId, cursor, mIconPos);
        if ((bitmap != null) && (activeFeedChannel)) {   // if a favicon is available, show it next to the feed name.
            textView.setCompoundDrawablesWithIntrinsicBounds(new BitmapDrawable(context.getResources(), bitmap), null, null, null);
        } else {
            textView.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
        }
    */
    textView.setText((cursor.isNull(mNamePos) ? cursor.getString(mLinkPos) : cursor.getString(mNamePos)));
    // if FetchMode is 99 then DO-NOT-REFRESH is active. Add remark and change style
    if (activeFeedChannel) {
        textView.setTextColor(ACTIVE_TEXT_COLOR);
    } else { // inactive feed channel. Is not refreshed.
        textView.append(" - niet volgen");
        textView.setTextColor(DO_NOT_FETCH_COLOR_TEXT_COLOR);
    }
}

From source file:me.trashout.fragment.CollectionPointDetailFragment.java

/**
 * setup collection point data//from   w w w .j a v  a 2s.co m
 *
 * @param collectionPoint
 */
private void setupCollectionPointData(CollectionPoint collectionPoint) {
    if (isAdded()) {
        collectionPointDetailName
                .setText(collectionPoint.getSize().equals(Constants.CollectionPointSize.DUSTBIN)
                        ? getString(Constants.CollectionPointSize.DUSTBIN.getStringResId())
                        : collectionPoint.getName());

        collectionPointDetailType.setText(Html.fromHtml(
                getString(R.string.recyclable_gray, getString(R.string.collectionPoint_detail_mobile_recycable))
                        + TextUtils.join(", ", Constants.CollectionPointType
                                .getCollectionPointTypeNameList(getContext(), collectionPoint.getTypes()))));
        collectionPointDetailDistance
                .setText(String.format(getString(R.string.distance_away_formatter),
                        lastPosition != null ? PositionUtils.getFormattedComputeDistance(getContext(),
                                lastPosition, collectionPoint.getPosition()) : "?",
                        getString(R.string.global_distanceAttribute_away)));
        collectionPointDetailPosition
                .setText(collectionPoint.getPosition() != null
                        ? PositionUtils.getFormattedLocation(getContext(),
                                collectionPoint.getPosition().latitude, collectionPoint.getPosition().longitude)
                        : "?");

        if (collectionPoint.getOpeningHours() == null || collectionPoint.getOpeningHours().isEmpty()) {
            collectionPointDetailOpeningHoursContainer.setVisibility(View.GONE);
            collectionPointDetailOpeningHours.setVisibility(View.GONE);
        } else {
            collectionPointDetailOpeningHoursContainer.setVisibility(View.VISIBLE);
            collectionPointDetailOpeningHoursContainer.removeAllViews();
            collectionPointDetailOpeningHours.setVisibility(View.VISIBLE);
            for (Map<String, List<OpeningHour>> openingHoursMap : collectionPoint.getOpeningHours()) {
                for (Map.Entry<String, List<OpeningHour>> openingHourEntry : openingHoursMap.entrySet()) {
                    LinearLayout openingHoursLayout = (LinearLayout) getLayoutInflater()
                            .inflate(R.layout.item_opening_hours, null);
                    TextView dayNameTextView = openingHoursLayout.findViewById(R.id.txt_day_name);
                    TextView openingHoursTextView = openingHoursLayout.findViewById(R.id.txt_opening_hours);

                    int dayNameResId;
                    switch (openingHourEntry.getKey()) {
                    case "Monday":
                        dayNameResId = R.string.global_days_Monday;
                        break;
                    case "Tuesday":
                        dayNameResId = R.string.global_days_Tuesday;
                        break;
                    case "Wednesday":
                        dayNameResId = R.string.global_days_Wednesday;
                        break;
                    case "Thursday":
                        dayNameResId = R.string.global_days_Thursday;
                        break;
                    case "Friday":
                        dayNameResId = R.string.global_days_Friday;
                        break;
                    case "Saturday":
                        dayNameResId = R.string.global_days_Saturday;
                        break;
                    case "Sunday":
                        dayNameResId = R.string.global_days_Sunday;
                        break;
                    default:
                        dayNameResId = R.string.global_days_Monday;
                    }

                    dayNameTextView.setText(getString(dayNameResId));
                    for (OpeningHour openingHour : openingHourEntry.getValue()) {
                        String startString = String.valueOf(openingHour.getStart());
                        String finishString = String.valueOf(openingHour.getFinish());
                        if (startString.length() == 3) {
                            startString = "0" + startString;
                        }
                        if (finishString.length() == 3) {
                            finishString = "0" + finishString;
                        }
                        openingHoursTextView.append(startString.substring(0, 2) + ":"
                                + startString.substring(2, startString.length()) + " - "
                                + finishString.substring(0, 2) + ":"
                                + finishString.substring(2, finishString.length()) + ", ");
                    }
                    if (openingHourEntry.getValue().size() > 0) {
                        openingHoursTextView.setText(openingHoursTextView.getText().toString().substring(0,
                                openingHoursTextView.getText().length() - 2));
                    }
                    collectionPointDetailOpeningHoursContainer.addView(openingHoursLayout);
                }
            }
        }
        collectionPointDetailNote.setText(collectionPoint.getNote());

        if (collectionPoint.getPhone() == null || collectionPoint.getPhone().isEmpty()) {
            collectionPointDetailPhoneLayout.setVisibility(View.GONE);
        } else {
            collectionPointDetailPhoneLayout.setVisibility(View.VISIBLE);
            collectionPointDetailPhone.setText(collectionPoint.getPhone());
        }
        if (collectionPoint.getEmail() == null || collectionPoint.getEmail().isEmpty()) {
            collectionPointDetailEmailLayout.setVisibility(View.GONE);
        } else {
            collectionPointDetailEmailLayout.setVisibility(View.VISIBLE);
            collectionPointDetailEmail.setText(collectionPoint.getEmail());
        }

        if (collectionPoint.getGps() != null && collectionPoint.getGps().getArea() != null
                && !TextUtils.isEmpty(collectionPoint.getGps().getArea().getFormatedLocation())) {
            collectionPointDetailPlace.setText(collectionPoint.getGps().getArea().getFormatedLocation());
        } else {
            Geocoder geocoder = new Geocoder(getActivity(), Locale.getDefault());
            new GeocoderTask(geocoder, collectionPoint.getGps().getLat(), collectionPoint.getGps().getLng(),
                    new GeocoderTask.Callback() {
                        @Override
                        public void onAddressComplete(GeocoderTask.GeocoderResult geocoderResult) {
                            if (!TextUtils.isEmpty(geocoderResult.getFormattedAddress())) {
                                collectionPointDetailPlace.setText(geocoderResult.getFormattedAddress());
                            } else {
                                collectionPointDetailPlace.setVisibility(View.GONE);
                            }
                        }
                    }).execute();
        }
    }
}

From source file:org.rm3l.ddwrt.tiles.syslog.StatusSyslogTile.java

@Override
public void onLoadFinished(@NotNull Loader<NVRAMInfo> loader, @Nullable NVRAMInfo data) {
    //Set tiles// w w  w  . jav  a 2 s .  co m
    Log.d(LOG_TAG, "onLoadFinished: loader=" + loader + " / data=" + data);

    layout.findViewById(R.id.tile_status_router_syslog_header_loading_view).setVisibility(View.GONE);
    layout.findViewById(R.id.tile_status_router_syslog_content_loading_view).setVisibility(View.GONE);
    layout.findViewById(R.id.tile_status_router_syslog_state).setVisibility(View.VISIBLE);
    layout.findViewById(R.id.tile_status_router_syslog_content).setVisibility(View.VISIBLE);

    if (data == null) {
        data = new NVRAMInfo().setException(new DDWRTNoDataException("No Data!"));
    }

    @NotNull
    final TextView errorPlaceHolderView = (TextView) this.layout
            .findViewById(R.id.tile_status_router_syslog_error);

    @Nullable
    final Exception exception = data.getException();

    if (!(exception instanceof DDWRTTileAutoRefreshNotAllowedException)) {

        if (exception == null) {
            errorPlaceHolderView.setVisibility(View.GONE);
        }

        final String syslogdEnabledPropertyValue = data.getProperty(SYSLOGD_ENABLE);
        final boolean isSyslogEnabled = "1".equals(syslogdEnabledPropertyValue);

        final TextView syslogState = (TextView) this.layout.findViewById(R.id.tile_status_router_syslog_state);

        final View syslogContentView = this.layout.findViewById(R.id.tile_status_router_syslog_content);
        final EditText filterEditText = (EditText) this.layout
                .findViewById(R.id.tile_status_router_syslog_filter);

        syslogState.setText(
                syslogdEnabledPropertyValue == null ? "-" : (isSyslogEnabled ? "Enabled" : "Disabled"));

        syslogState.setVisibility(mDisplayStatus ? View.VISIBLE : View.GONE);

        final TextView logTextView = (TextView) syslogContentView;
        if (isSyslogEnabled) {

            //Highlight textToFind for new log lines
            final String newSyslog = data.getProperty(SYSLOG, EMPTY_STRING);

            //Hide container if no data at all (no existing data, and incoming data is empty too)
            final View scrollView = layout.findViewById(R.id.tile_status_router_syslog_content_scrollview);

            //noinspection ConstantConditions
            Spanned newSyslogSpan = new SpannableString(newSyslog);

            final SharedPreferences sharedPreferences = this.mParentFragmentPreferences;
            final String existingSearch = sharedPreferences != null
                    ? sharedPreferences.getString(getFormattedPrefKey(LAST_SEARCH), null)
                    : null;

            if (!isNullOrEmpty(existingSearch)) {
                if (isNullOrEmpty(filterEditText.getText().toString())) {
                    filterEditText.setText(existingSearch);
                }
                if (!isNullOrEmpty(newSyslog)) {
                    //noinspection ConstantConditions
                    newSyslogSpan = findAndHighlightOutput(newSyslog, existingSearch);
                }
            }

            //                if (!(isNullOrEmpty(existingSearch) || isNullOrEmpty(newSyslog))) {
            //                    filterEditText.setText(existingSearch);
            //                    //noinspection ConstantConditions
            //                    newSyslogSpan = findAndHighlightOutput(newSyslog, existingSearch);
            //                }

            if (isNullOrEmpty(logTextView.getText().toString()) && isNullOrEmpty(newSyslog)) {
                scrollView.setVisibility(View.INVISIBLE);
            } else {
                scrollView.setVisibility(View.VISIBLE);

                logTextView.setMovementMethod(new ScrollingMovementMethod());

                logTextView.append(
                        new SpannableStringBuilder().append(Html.fromHtml("<br/>")).append(newSyslogSpan));
            }

            filterEditText.setOnTouchListener(new View.OnTouchListener() {
                @Override
                public boolean onTouch(View v, MotionEvent event) {
                    final int DRAWABLE_LEFT = 0;
                    final int DRAWABLE_TOP = 1;
                    final int DRAWABLE_RIGHT = 2;
                    final int DRAWABLE_BOTTOM = 3;

                    if (event.getAction() == MotionEvent.ACTION_UP) {
                        if (event.getRawX() >= (filterEditText.getRight()
                                - filterEditText.getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width())) {
                            //Reset everything
                            filterEditText.setText(EMPTY_STRING); //this will trigger the TextWatcher, thus disabling the "Find" button
                            //Highlight text in textview
                            final String currentText = logTextView.getText().toString();

                            logTextView.setText(currentText.replaceAll(SLASH_FONT_HTML, EMPTY_STRING)
                                    .replaceAll(FONT_COLOR_YELLOW_HTML, EMPTY_STRING));

                            if (sharedPreferences != null) {
                                final SharedPreferences.Editor editor = sharedPreferences.edit();
                                editor.putString(getFormattedPrefKey(LAST_SEARCH), EMPTY_STRING);
                                editor.apply();
                            }
                            return true;
                        }
                    }
                    return false;
                }
            });

            filterEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
                @Override
                public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                    if (actionId == EditorInfo.IME_ACTION_SEARCH) {
                        final String textToFind = filterEditText.getText().toString();
                        if (isNullOrEmpty(textToFind)) {
                            //extra-check, even though we can be pretty sure the button is enabled only if textToFind is present
                            return true;
                        }
                        if (sharedPreferences != null) {
                            if (textToFind.equalsIgnoreCase(existingSearch)) {
                                //No need to go further as this is already the string we are looking for
                                return true;
                            }
                            final SharedPreferences.Editor editor = sharedPreferences.edit();
                            editor.putString(getFormattedPrefKey(LAST_SEARCH), textToFind);
                            editor.apply();
                        }
                        //Highlight text in textview
                        final String currentText = logTextView.getText().toString();

                        logTextView.setText(
                                findAndHighlightOutput(currentText.replaceAll(SLASH_FONT_HTML, EMPTY_STRING)
                                        .replaceAll(FONT_COLOR_YELLOW_HTML, EMPTY_STRING), textToFind));

                        return true;
                    }
                    return false;
                }
            });

        }
    }

    if (exception != null && !(exception instanceof DDWRTTileAutoRefreshNotAllowedException)) {
        //noinspection ThrowableResultOfMethodCallIgnored
        final Throwable rootCause = Throwables.getRootCause(exception);
        errorPlaceHolderView.setText("Error: " + (rootCause != null ? rootCause.getMessage() : "null"));
        final Context parentContext = this.mParentFragmentActivity;
        errorPlaceHolderView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(final View v) {
                //noinspection ThrowableResultOfMethodCallIgnored
                if (rootCause != null) {
                    Toast.makeText(parentContext, rootCause.getMessage(), Toast.LENGTH_LONG).show();
                }
            }
        });
        errorPlaceHolderView.setVisibility(View.VISIBLE);
    }

    doneWithLoaderInstance(this, loader, R.id.tile_status_router_syslog_togglebutton_title,
            R.id.tile_status_router_syslog_togglebutton);

    Log.d(LOG_TAG, "onLoadFinished(): done loading!");
}

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

@Override
protected void onResume() {
    super.onResume();
    TextView tv = (TextView) findViewById(R.id.textview_info_rec);
    tv.setMovementMethod(new ScrollingMovementMethod());

    tv.setText("Testing..."); // TODO: No use...
    tv.invalidate();/*from w  w w  .j  a  v  a2s.  c  o m*/

    // Show supported sample rate and corresponding minimum buffer size.
    String[] requested = new String[] { "8000", "11025", "16000", "22050", "32000", "44100", "48000", "96000" };
    String st = "sampleRate minBufSize\n";
    ArrayList<String> validated = new ArrayList<String>();
    for (String s : requested) {
        int rate = Integer.parseInt(s);
        int minBufSize = AudioRecord.getMinBufferSize(rate, AudioFormat.CHANNEL_IN_MONO,
                AudioFormat.ENCODING_PCM_16BIT);
        if (minBufSize != AudioRecord.ERROR_BAD_VALUE) {
            validated.add(s);
            st += s + "  \t" + Integer.toString(minBufSize) + "\n";
        }
    }
    requested = validated.toArray(new String[0]);

    tv.setText(st);
    tv.invalidate();

    // Test audio source
    String[] audioSourceString = new String[] { "DEFAULT", "MIC", "VOICE_UPLINK", "VOICE_DOWNLINK",
            "VOICE_CALL", "CAMCORDER", "VOICE_RECOGNITION" };
    int[] audioSourceId = new int[] { MediaRecorder.AudioSource.DEFAULT, // Default audio source
            MediaRecorder.AudioSource.MIC, // Microphone audio source
            MediaRecorder.AudioSource.VOICE_UPLINK, // Voice call uplink (Tx) audio source
            MediaRecorder.AudioSource.VOICE_DOWNLINK, // Voice call downlink (Rx) audio source
            MediaRecorder.AudioSource.VOICE_CALL, // Voice call uplink + downlink audio source
            MediaRecorder.AudioSource.CAMCORDER, // Microphone audio source with same orientation as camera if available, the main device microphone otherwise (apilv7)
            MediaRecorder.AudioSource.VOICE_RECOGNITION, // Microphone audio source tuned for voice recognition if available, behaves like DEFAULT otherwise. (apilv7)
            //            MediaRecorder.AudioSource.VOICE_COMMUNICATION, // Microphone audio source tuned for voice communications such as VoIP. It will for instance take advantage of echo cancellation or automatic gain control if available. It otherwise behaves like DEFAULT if no voice processing is applied. (apilv11)
            //            MediaRecorder.AudioSource.REMOTE_SUBMIX,       // Audio source for a submix of audio streams to be presented remotely. (apilv19)
    };
    tv.append("\n-- Audio Source Test --");
    for (String s : requested) {
        int sampleRate = Integer.parseInt(s);
        int recBufferSize = AudioRecord.getMinBufferSize(sampleRate, AudioFormat.CHANNEL_IN_MONO,
                AudioFormat.ENCODING_PCM_16BIT);
        tv.append("\n(" + Integer.toString(sampleRate) + "Hz, MONO, 16BIT)\n");
        for (int iass = 0; iass < audioSourceId.length; iass++) {
            st = "";
            // wait for AudioRecord fully released...
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            AudioRecord record;
            record = new AudioRecord(audioSourceId[iass], sampleRate, AudioFormat.CHANNEL_IN_MONO,
                    AudioFormat.ENCODING_PCM_16BIT, recBufferSize);
            if (record.getState() == AudioRecord.STATE_INITIALIZED) {
                st += audioSourceString[iass] + " successed";
                int as = record.getAudioSource();
                if (as != audioSourceId[iass]) {
                    int i = 0;
                    while (i < audioSourceId.length) {
                        if (as == audioSourceId[iass]) {
                            break;
                        }
                        i++;
                    }
                    if (i >= audioSourceId.length) {
                        st += "(auto set to \"unknown source\")";
                    } else {
                        st += "(auto set to " + audioSourceString[i] + ")";
                    }
                }
                st += "\n";
            } else {
                st += audioSourceString[iass] + " failed\n";
            }
            record.release();
            record = null;
            tv.append(st);
            tv.invalidate();
        }
    }

}

From source file:mtmo.test.mediadrm.MainActivity.java

private void setupDrmProcessButton(final int appMode) {
    final Button btnRegistration = (Button) findViewById(R.id.btn_registration);
    final Button btnSaveLicense = (Button) findViewById(R.id.btn_license);
    final Button btnDeregistration = (Button) findViewById(R.id.btn_deregistration);
    final Button btnCheckRights = (Button) findViewById(R.id.btn_check_rights);
    final Button btnRemoveRights = (Button) findViewById(R.id.btn_remove_rights);
    final Button btnStatus = (Button) findViewById(R.id.btn_check_regist);

    if (btnRegistration != null) {
        btnRegistration.setOnClickListener(new OnClickListener() {
            @Override/*from  w  w w.  ja va  2 s  .c  o  m*/
            public void onClick(View v) {
                mLogger.enter("requeseted registration...");

                final TaskInfo taskInfo = new TaskInfo(TaskType.REGISTRATION, mAccountId, mServiceId,
                        mCurrentATKNFilePath);
                mHandler.post(new TaskStarter(taskInfo));
            }
        });
    }
    if (btnSaveLicense != null) {
        btnSaveLicense.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                mLogger.d("requeseted getting License...");
                final TaskInfo taskInfo = new TaskInfo(TaskType.LICENSE, mAccountId, mServiceId,
                        mCurrentATKNFilePath);
                mHandler.post(new TaskStarter(taskInfo));
            }
        });
    }
    if (btnDeregistration != null) {
        btnDeregistration.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                mLogger.d("requeseted deregistration...");
                final TaskInfo taskInfo = new TaskInfo(TaskType.DEREGISTRATION, mAccountId, mServiceId,
                        mCurrentATKNFilePath);
                mHandler.post(new TaskStarter(taskInfo));
            }
        });
    }
    if (btnCheckRights != null) {
        btnCheckRights.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                mLogger.d("requeseted check License...");
                TextView log = (TextView) findViewById(R.id.log);
                byte[] sessionId = null;
                MediaDrm mediaDrm = null;
                byte[] contentData = null;
                log.setText("");

                try {
                    mediaDrm = new MediaDrm(Constants.MBB_UUID);
                    sessionId = mediaDrm.openSession();

                    switch (appMode) {
                    case Constants.APP_MODE_ABS:
                        ABSContentInfo absContentInfo = getABSContentInfo();
                        contentData = Utils.readPsshDataFromFile(true);
                        mediaDrm.restoreKeys(sessionId,
                                InitData.getPSSHTableForAndroid(contentData, absContentInfo.getVideoKid()));
                        break;
                    case Constants.APP_MODE_OFFLINE:
                        contentData = Utils.readIPMPDataFromFile(true);
                        mediaDrm.restoreKeys(sessionId, InitData.getIPMPTableForAndroid(contentData));
                        break;
                    default:
                        Toast.makeText(mContext, "Unknown App Mode", Toast.LENGTH_SHORT).show();
                        return;
                    }
                    HashMap<String, String> infoMap = mediaDrm.queryKeyStatus(sessionId);

                    if (infoMap != null && infoMap.size() > 0) {
                        StringBuilder sb = new StringBuilder();
                        Iterator<String> iterator = infoMap.keySet().iterator();
                        log.setText("");
                        Time time = new Time();
                        while (iterator.hasNext()) {
                            String name = iterator.next();
                            time.set(Long.valueOf(infoMap.get(name)));
                            mLogger.d("\t" + name + " = " + infoMap.get(name) + " [" + time.format2445() + "]");
                            sb.append(
                                    "\n\t" + name + " = " + infoMap.get(name) + " [" + time.format2445() + "]");
                        }
                        log.append(sb);
                    }
                    mediaDrm.closeSession(sessionId);
                    sessionId = null;
                    Toast.makeText(MainActivity.this, "queryKeyStatus finished", Toast.LENGTH_LONG).show();
                    return;
                } catch (IllegalArgumentException e) {
                    e.printStackTrace();
                } catch (IllegalStateException e) {
                    e.printStackTrace();
                } catch (UnsupportedSchemeException e) {
                    e.printStackTrace();
                } catch (NotProvisionedException e) {
                    e.printStackTrace();
                } catch (JSONException e) {
                    e.printStackTrace();
                }
                mediaDrm.closeSession(sessionId);
                sessionId = null;
                Toast.makeText(MainActivity.this, "Failure", Toast.LENGTH_LONG).show();
            }
        });
    }
    if (btnRemoveRights != null) {
        btnRemoveRights.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                mLogger.d("requeseted removing License...");
                Toast.makeText(MainActivity.this, "Not implementation", Toast.LENGTH_LONG).show();
            }
        });
    }
    if (btnStatus != null) {
        btnStatus.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                mLogger.enter("Check registration Status...");

                RequestParser parser = null;
                MediaDrm mediaDrm = null;
                byte[] sessionid = null;
                HashMap<String, String> optionalParameters = null;
                try {
                    mediaDrm = new MediaDrm(Constants.MBB_UUID);
                    sessionid = mediaDrm.openSession();
                    KeyRequest keyRequest = mediaDrm.getKeyRequest(sessionid,
                            InitData.getPropertyTableForAndroid(Constants.QUERY_NAME_REGISTERED_STATE,
                                    Utils.accountIdToMarlinFormat(mAccountId), mServiceId),
                            Constants.REQUEST_MIMETYPE_QUERY_PROPERTY, MediaDrm.KEY_TYPE_OFFLINE,
                            optionalParameters);
                    parser = new RequestParser(keyRequest.getData());

                    if (parser.parse()) {
                        Toast.makeText(MainActivity.this, parser.getProperty(), Toast.LENGTH_LONG).show();
                    } else {
                        Toast.makeText(MainActivity.this, "Failure", Toast.LENGTH_LONG).show();
                    }
                    return;
                } catch (IllegalArgumentException e) {
                    e.printStackTrace();
                } catch (IllegalStateException e) {
                    e.printStackTrace();
                } catch (UnsupportedSchemeException e) {
                    e.printStackTrace();
                } catch (JSONException e) {
                    e.printStackTrace();
                } catch (NotProvisionedException e) {
                    e.printStackTrace();
                }
                Toast.makeText(MainActivity.this, "Failure", Toast.LENGTH_LONG).show();
            }
        });
    }
}

From source file:com.eveningoutpost.dexdrip.Home.java

private void updateCurrentBgInfo(String source) {
    Log.d(TAG, "updateCurrentBgInfo from: " + source);

    if (!activityVisible) {
        Log.d(TAG, "Display not visible - not updating chart");
        return;/* ww w.j  a  va 2 s.  com*/
    }
    if (reset_viewport) {
        reset_viewport = false;
        holdViewport.set(0, 0, 0, 0);
        if (chart != null)
            chart.setZoomType(ZoomType.HORIZONTAL);
    }
    setupCharts();
    final TextView notificationText = (TextView) findViewById(R.id.notices);
    final TextView lowPredictText = (TextView) findViewById(R.id.lowpredict);
    if (BgGraphBuilder.isXLargeTablet(getApplicationContext())) {
        notificationText.setTextSize(40);
    }
    notificationText.setText("");
    notificationText.setTextColor(Color.RED);

    UndoRedo.purgeQueues();

    if (UndoRedo.undoListHasItems()) {
        btnUndo.setVisibility(View.VISIBLE);
        showcasemenu(SHOWCASE_UNDO);
    } else {
        btnUndo.setVisibility(View.INVISIBLE);
    }

    if (UndoRedo.redoListHasItems()) {
        btnRedo.setVisibility(View.VISIBLE);
        showcasemenu(SHOWCASE_REDO);
    } else {
        btnRedo.setVisibility(View.INVISIBLE);
    }
    boolean isBTWixel = CollectionServiceStarter.isBTWixel(getApplicationContext());
    // port this lot to DexCollectionType to avoid multiple lookups of the same preference
    boolean isDexbridgeWixel = CollectionServiceStarter.isDexBridgeOrWifiandDexBridge();
    boolean isWifiBluetoothWixel = CollectionServiceStarter.isWifiandBTWixel(getApplicationContext());
    isBTShare = CollectionServiceStarter.isBTShare(getApplicationContext());
    isG5Share = CollectionServiceStarter.isBTG5(getApplicationContext());
    boolean isWifiWixel = CollectionServiceStarter.isWifiWixel(getApplicationContext());
    alreadyDisplayedBgInfoCommon = false; // reset flag
    if (isBTShare) {
        updateCurrentBgInfoForBtShare(notificationText);
    }
    if (isG5Share) {
        updateCurrentBgInfoCommon(notificationText);
    }
    if (isBTWixel || isDexbridgeWixel || isWifiBluetoothWixel) {
        updateCurrentBgInfoForBtBasedWixel(notificationText);
    }
    if (isWifiWixel || isWifiBluetoothWixel) {
        updateCurrentBgInfoForWifiWixel(notificationText);
    } else if (is_follower) {
        displayCurrentInfo();
        getApplicationContext().startService(new Intent(getApplicationContext(), Notifications.class));
    } else if (!alreadyDisplayedBgInfoCommon
            && DexCollectionType.getDexCollectionType() == DexCollectionType.LibreAlarm) {
        updateCurrentBgInfoCommon(notificationText);
    }
    if (prefs.getLong("alerts_disabled_until", 0) > new Date().getTime()) {
        notificationText.append("\n ALL ALERTS CURRENTLY DISABLED");
    } else if (prefs.getLong("low_alerts_disabled_until", 0) > new Date().getTime()
            && prefs.getLong("high_alerts_disabled_until", 0) > new Date().getTime()) {
        notificationText.append("\n LOW AND HIGH ALERTS CURRENTLY DISABLED");
    } else if (prefs.getLong("low_alerts_disabled_until", 0) > new Date().getTime()) {
        notificationText.append("\n LOW ALERTS CURRENTLY DISABLED");
    } else if (prefs.getLong("high_alerts_disabled_until", 0) > new Date().getTime()) {
        notificationText.append("\n HIGH ALERTS CURRENTLY DISABLED");
    }
    NavigationDrawerFragment navigationDrawerFragment = (NavigationDrawerFragment) getFragmentManager()
            .findFragmentById(R.id.navigation_drawer);

    // DEBUG ONLY
    if ((BgGraphBuilder.last_noise > 0) && (prefs.getBoolean("show_noise_workings", false))) {
        notificationText.append("\nSensor Noise: " + JoH.qs(BgGraphBuilder.last_noise, 1));
        if ((BgGraphBuilder.best_bg_estimate > 0) && (BgGraphBuilder.last_bg_estimate > 0)) {
            final double estimated_delta = BgGraphBuilder.best_bg_estimate - BgGraphBuilder.last_bg_estimate;

            notificationText.append("\nBG Original: "
                    + bgGraphBuilder.unitized_string(BgReading.lastNoSenssor().calculated_value) + " \u0394 "
                    + bgGraphBuilder.unitizedDeltaString(false, true, true) + " "
                    + BgReading.lastNoSenssor().slopeArrow());

            notificationText.append("\nBG Estimate: "
                    + bgGraphBuilder.unitized_string(BgGraphBuilder.best_bg_estimate) + " \u0394 "
                    + bgGraphBuilder.unitizedDeltaStringRaw(false, true, estimated_delta) + " "
                    + BgReading.slopeToArrowSymbol(estimated_delta / (BgGraphBuilder.DEXCOM_PERIOD / 60000)));

        }
    }

    // TODO we need to consider noise level?
    // when to raise the alarm
    lowPredictText.setText("");
    lowPredictText.setVisibility(View.INVISIBLE);
    if (BgGraphBuilder.low_occurs_at > 0) {
        final double low_predicted_alarm_minutes = Double
                .parseDouble(prefs.getString("low_predict_alarm_level", "50"));
        final double now = JoH.ts();
        final double predicted_low_in_mins = (BgGraphBuilder.low_occurs_at - now) / 60000;

        if (predicted_low_in_mins > 1) {
            lowPredictText.append(getString(R.string.low_predicted) + "\n" + getString(R.string.in) + ": "
                    + (int) predicted_low_in_mins + getString(R.string.space_mins));
            if (predicted_low_in_mins < low_predicted_alarm_minutes) {
                lowPredictText.setTextColor(Color.RED); // low front getting too close!
            } else {
                final double previous_predicted_low_in_mins = (BgGraphBuilder.previous_low_occurs_at - now)
                        / 60000;
                if ((BgGraphBuilder.previous_low_occurs_at > 0)
                        && ((previous_predicted_low_in_mins + 5) < predicted_low_in_mins)) {
                    lowPredictText.setTextColor(Color.GREEN); // low front is getting further away
                } else {
                    lowPredictText.setTextColor(Color.YELLOW); // low front is getting nearer!
                }
            }
            lowPredictText.setVisibility(View.VISIBLE);
        }
        BgGraphBuilder.previous_low_occurs_at = BgGraphBuilder.low_occurs_at;
    }

    if (navigationDrawerFragment == null)
        Log.e("Runtime", "navigationdrawerfragment is null");

    try {
        navigationDrawerFragment.setUp(R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout),
                menu_name, this);
    } catch (Exception e) {
        Log.e("Runtime", "Exception with navigrationdrawerfragment: " + e.toString());
    }
    if (nexttoast != null) {
        toast(nexttoast);
        nexttoast = null;
    }

    // hide the treatment recognition text after some seconds
    if ((last_speech_time > 0) && ((JoH.ts() - last_speech_time) > 20000)) {
        voiceRecognitionText.setVisibility(View.INVISIBLE);
        last_speech_time = 0;
    }

    if (ActivityRecognizedService.is_in_vehicle_mode()) {
        btnVehicleMode.setVisibility(View.VISIBLE);
    } else {
        btnVehicleMode.setVisibility(View.INVISIBLE);
    }

    //showcasemenu(1); // 3 dot menu

}

From source file:com.android.vending.billing.InAppBillingService.LACK.listAppsFragment.java

public static void patch_dialog_text_builder(TextView paramTextView, boolean paramBoolean) {
      float f2 = 0.0F;
      float f4 = 0.0F;
      float f3;//  ww  w.  j  a  va2 s  . c  o  m
      if (str != null) {
          if (str.contains("com.android.vending dependencies removed\n")) {
              paramTextView
                      .append(Utils.getColoredText("\n" + Utils.getText(2131165620) + "\n", "#ff00ff73", "bold"));
              f2 = 0.0F + 1.0F;
          }
          if (str == null) {
              str = " ";
          }
          f1 = f2;
          if (str.contains("amazon patch N1!\n")) {
              f1 = f2;
              if (!str.contains("runpatchads")) {
                  paramTextView.append(
                          Utils.getColoredText("\n" + Utils.getText(2131165618) + "\n", "#ff00ff73", "bold"));
                  f1 = f2 + 1.0F;
              }
          }
          f2 = f1;
          if (str.contains("samsung patch N")) {
              f2 = f1;
              if (!str.contains("runpatchads")) {
                  paramTextView.append(
                          Utils.getColoredText("\n" + Utils.getText(2131165621) + "\n", "#ff00ff73", "bold"));
                  f2 = f1 + 1.0F;
              }
          }
          f1 = f2;
          if (str.contains("Site from AdsBlockList blocked!")) {
              i = 0;
              localObject = Pattern.compile("Site from AdsBlockList blocked!").matcher(str);
              while (((Matcher) localObject).find()) {
                  i += 1;
              }
              paramTextView.append(Utils.getColoredText("\n" + Utils.getText(2131165673) + " (" + i + ") " + "\n",
                      "#ff00ff73", "bold"));
              f1 = f2 + 1.0F;
          }
          if (!str.contains("ads1 Fixed!\n")) {
              f2 = f1;
              if (!str.contains("support1 Fixed!\n")) {
              }
          } else {
              paramTextView
                      .append(Utils.getColoredText("\n" + Utils.getText(2131165604) + "\n", "#ff00ff73", "bold"));
              f2 = f1 + 1.0F;
          }
          if (!str.contains("ads2 Fixed!\n")) {
              f1 = f2;
              if (!str.contains("support2 Fixed!\n")) {
              }
          } else {
              paramTextView
                      .append(Utils.getColoredText("\n" + Utils.getText(2131165606) + "\n", "#ff00ff73", "bold"));
              f1 = f2 + 1.0F;
          }
          if (!str.contains("ads3 Fixed!\n")) {
              f2 = f1;
              if (!str.contains("support3 Fixed!\n")) {
              }
          } else {
              paramTextView
                      .append(Utils.getColoredText("\n" + Utils.getText(2131165608) + "\n", "#ff00ff73", "bold"));
              f2 = f1 + 1.0F;
          }
          if (!str.contains("ads4 Fixed!\n")) {
              f1 = f2;
              if (!str.contains("support4 Fixed!\n")) {
              }
          } else {
              paramTextView
                      .append(Utils.getColoredText("\n" + Utils.getText(2131165610) + "\n", "#ff00ff73", "bold"));
              f1 = f2 + 1.0F;
          }
          f2 = f1;
          if (str.contains("ads5 Fixed!\n")) {
              paramTextView
                      .append(Utils.getColoredText("\n" + Utils.getText(2131165612) + "\n", "#ff00ff73", "bold"));
              f2 = f1 + 1.0F;
          }
          f1 = f2;
          if (str.contains("ads6 Fixed!\n")) {
              paramTextView
                      .append(Utils.getColoredText("\n" + Utils.getText(2131165614) + "\n", "#ff00ff73", "bold"));
              f1 = f2 + 1.0F;
          }
          f2 = f1;
          if (str.contains("lvl patch N1!\n")) {
              i = 0;
              localObject = Pattern.compile("lvl patch N1!\n").matcher(str);
              while (((Matcher) localObject).find()) {
                  i += 1;
              }
              paramTextView.append(Utils.getColoredText("\n" + Utils.getText(2131165604) + " (" + i + ")" + "\n",
                      "#ff00ff73", "bold"));
              f2 = f1 + 1.0F;
          }
          f1 = f2;
          if (str.contains("lvl patch N2!\n")) {
              i = 0;
              localObject = Pattern.compile("lvl patch N2!\n").matcher(str);
              while (((Matcher) localObject).find()) {
                  i += 1;
              }
              paramTextView.append(Utils.getColoredText("\n" + Utils.getText(2131165606) + " (" + i + ")" + "\n",
                      "#ff00ff73", "bold"));
              f1 = f2 + 1.0F;
          }
          f2 = f1;
          if (str.contains("lvl patch N3!\n")) {
              i = 0;
              localObject = Pattern.compile("lvl patch N3!\n").matcher(str);
              while (((Matcher) localObject).find()) {
                  i += 1;
              }
              paramTextView.append(Utils.getColoredText("\n" + Utils.getText(2131165608) + " (" + i + ")" + "\n",
                      "#ff00ff73", "bold"));
              f2 = f1 + 1.0F;
          }
          f1 = f2;
          if (str.contains("lvl patch N4!\n")) {
              i = 0;
              localObject = Pattern.compile("lvl patch N4!\n").matcher(str);
              while (((Matcher) localObject).find()) {
                  i += 1;
              }
              paramTextView.append(Utils.getColoredText("\n" + Utils.getText(2131165610) + " (" + i + ")" + "\n",
                      "#ff00ff73", "bold"));
              f1 = f2 + 1.0F;
          }
          int i = 0;
          f2 = f1;
          if (str.contains("lvl patch N5!\n")) {
              localObject = Pattern.compile("lvl patch N5!\n").matcher(str);
              while (((Matcher) localObject).find()) {
                  i += 1;
              }
              paramTextView.append(Utils.getColoredText("\n" + Utils.getText(2131165612) + " (" + i + ")" + "\n",
                      "#ff00ff73", "bold"));
              f2 = f1 + 1.0F;
          }
          f1 = f2;
          if (str.contains("lvl patch N6!\n")) {
              i = 0;
              localObject = Pattern.compile("lvl patch N6!\n").matcher(str);
              while (((Matcher) localObject).find()) {
                  i += 1;
              }
              paramTextView.append(Utils.getColoredText("\n" + Utils.getText(2131165614) + " (" + i + ")" + "\n",
                      "#ff00ff73", "bold"));
              f1 = f2 + 1.0F;
          }
          f3 = f1;
          if (str.contains("lvl patch N7!\n")) {
              i = 0;
              localObject = Pattern.compile("lvl patch N7!\n").matcher(str);
              while (((Matcher) localObject).find()) {
                  i += 1;
              }
              paramTextView.append(Utils.getColoredText("\n" + Utils.getText(2131165616) + " (" + i + ")" + "\n",
                      "#ff00ff73", "bold"));
              f3 = f1 + 1.0F;
          }
          f1 = f4;
          if (!str.contains("amazon patch N1!\n")) {
              f1 = f4;
              if (!str.contains("runpatchads")) {
                  f1 = f4;
                  if (!str.contains("runpatchsupport")) {
                      paramTextView.append(
                              Utils.getColoredText("\n" + Utils.getText(2131165619) + "\n", "#ffff0055", "bold"));
                      f1 = 0.0F + 1.0F;
                  }
              }
          }
          f2 = f1;
          if (!str.contains("samsung patch N")) {
              f2 = f1;
              if (!str.contains("runpatchads")) {
                  f2 = f1;
                  if (!str.contains("runpatchsupport")) {
                      paramTextView.append(
                              Utils.getColoredText("\n" + Utils.getText(2131165622) + "\n", "#ffff0055", "bold"));
                      f2 = f1 + 1.0F;
                  }
              }
          }
          f1 = f2;
          if (!str.contains("lvl patch N1!\n")) {
              f1 = f2;
              if (!str.contains("ads1 Fixed!\n")) {
                  f1 = f2;
                  if (!str.contains("support1 Fixed!\n")) {
                      paramTextView.append(
                              Utils.getColoredText("\n" + Utils.getText(2131165605) + "\n", "#ffff0055", "bold"));
                      f1 = f2 + 1.0F;
                  }
              }
          }
          f2 = f1;
          if (!str.contains("lvl patch N2!\n")) {
              f2 = f1;
              if (!str.contains("ads2 Fixed!\n")) {
                  f2 = f1;
                  if (!str.contains("support2 Fixed!\n")) {
                      paramTextView.append(
                              Utils.getColoredText("\n" + Utils.getText(2131165607) + "\n", "#ffff0055", "bold"));
                      f2 = f1 + 1.0F;
                  }
              }
          }
          f1 = f2;
          if (!str.contains("lvl patch N3!\n")) {
              f1 = f2;
              if (!str.contains("ads3 Fixed!\n")) {
                  f1 = f2;
                  if (!str.contains("support3 Fixed!\n")) {
                      paramTextView.append(
                              Utils.getColoredText("\n" + Utils.getText(2131165609) + "\n", "#ffff0055", "bold"));
                      f1 = f2 + 1.0F;
                  }
              }
          }
          f2 = f1;
          if (!str.contains("lvl patch N4!\n")) {
              f2 = f1;
              if (!str.contains("ads4 Fixed!\n")) {
                  f2 = f1;
                  if (!str.contains("support4 Fixed!\n")) {
                      paramTextView.append(
                              Utils.getColoredText("\n" + Utils.getText(2131165611) + "\n", "#ffff0055", "bold"));
                      f2 = f1 + 1.0F;
                  }
              }
          }
          f1 = f2;
          if (!str.contains("lvl patch N5!\n")) {
              f1 = f2;
              if (!str.contains("runpatchads")) {
                  f1 = f2;
                  if (!str.contains("runpatchsupport")) {
                      paramTextView.append(
                              Utils.getColoredText("\n" + Utils.getText(2131165613) + "\n", "#ffff0055", "bold"));
                      f1 = f2 + 1.0F;
                  }
              }
          }
          f2 = f1;
          if (!str.contains("lvl patch N6!\n")) {
              f2 = f1;
              if (!str.contains("runpatchads")) {
                  f2 = f1;
                  if (!str.contains("runpatchsupport")) {
                      paramTextView.append(
                              Utils.getColoredText("\n" + Utils.getText(2131165615) + "\n", "#ffff0055", "bold"));
                      f2 = f1 + 1.0F;
                  }
              }
          }
          f1 = f2;
          if (!str.contains("lvl patch N7!\n")) {
              f1 = f2;
              if (!str.contains("runpatchads")) {
                  f1 = f2;
                  if (!str.contains("runpatchsupport")) {
                      paramTextView.append(
                              Utils.getColoredText("\n" + Utils.getText(2131165617) + "\n", "#ffff0055", "bold"));
                      f1 = f2 + 1.0F;
                  }
              }
          }
          if (str.contains("Error: Program files are not found!")) {
              paramTextView
                      .append(Utils.getColoredText("\n" + Utils.getText(2131165185) + "\n", "#ffff0055", "bold"));
          }
          if (paramBoolean) {
              break label2688;
          }
          if ((!str.contains("Error:")) && (!str.contains("Fixed")) && (!str.contains("Failed"))
                  && (!str.contains("ads")) && (!str.contains("lvl patch"))
                  && (!str.contains("SU Java-Code Running!"))) {
              paramTextView.setText(
                      Utils.getColoredText("\n" + Utils.getText(2131165567) + "\n", "#ff00ffff", "bold"));
          }
      } else {
          return;
      }
      float f1 = Math.round(f3 / 7.0F * 100.0F) - 1;
      Object localObject = "\n" + Utils.getText(2131165478) + " " + f1 + Utils.getText(2131165477) + "\n";
      if (f1 < 0.0F) {
          localObject = "\n" + Utils.getText(2131165478) + " " + 0.0F + Utils.getText(2131165628);
      }
      paramTextView.append(Utils.getColoredText((String) localObject, "#fff0e442", "bold"));
      return;
      label2688: paramTextView
              .append(Utils.getColoredText("\n" + Utils.getText(2131165807) + "\n", "#fff0e442", "bold"));
  }