Example usage for android.widget TextView setVisibility

List of usage examples for android.widget TextView setVisibility

Introduction

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

Prototype

@RemotableViewMethod
public void setVisibility(@Visibility int visibility) 

Source Link

Document

Set the visibility state of this view.

Usage

From source file:com.dsi.ant.antplus.pluginsampler.watchdownloader.Dialog_WatchData.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

    builder.setTitle("Data for: " + deviceData.getDisplayName());
    // Get the layout inflater
    final LayoutInflater inflater = getActivity().getLayoutInflater();
    final View detailsView = inflater.inflate(R.layout.dialog_watchdata, null);

    // Inflate and set the layout for the dialog
    // Pass null as the parent view because its going in the dialog layout
    builder.setView(detailsView);//from w ww . j a va  2  s. co m

    // Add action buttons
    builder.setPositiveButton("Close", null);

    linearLayout_FitDataView = (LinearLayout) detailsView.findViewById(R.id.linearLayout_DataCards);

    FileIdMesgListener fileIdMesgListener = new FileIdMesgListener() {
        @Override
        public void onMesg(final FileIdMesg mesg) {
            getActivity().runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    layoutControllerList
                            .add(new LayoutController_FileId(inflater, linearLayout_FitDataView, mesg));
                }
            });
        }
    };

    ActivityMesgListener activityMesgListener = new ActivityMesgListener() {
        @Override
        public void onMesg(final ActivityMesg mesg) {
            getActivity().runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    layoutControllerList
                            .add(new LayoutController_Activity(inflater, linearLayout_FitDataView, mesg));
                }
            });
        }
    };

    SessionMesgListener sessionMesgListener = new SessionMesgListener() {
        @Override
        public void onMesg(final SessionMesg mesg) {
            getActivity().runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    layoutControllerList
                            .add(new LayoutController_Session(inflater, linearLayout_FitDataView, mesg));
                }
            });
        }
    };

    MesgBroadcaster mesgBroadcaster;

    // If we have downloaded fit file to display, hides the no activities available text view
    if (!fitFileList.isEmpty()) {
        TextView textview = (TextView) detailsView.findViewById(R.id.textView_no_data_page);
        textview.setVisibility(TextView.INVISIBLE);
    }

    for (final FitFile downloadedFitFile : fitFileList)
        try {
            mesgBroadcaster = new MesgBroadcaster();
            mesgBroadcaster.addListener(activityMesgListener);
            mesgBroadcaster.addListener(fileIdMesgListener);
            mesgBroadcaster.addListener(sessionMesgListener);
            Log.e("WatchDownloaderSampler", "Begin decoding file");
            mesgBroadcaster.run(downloadedFitFile.getInputStream());
            Log.e("WatchDownloaderSampler", "End decoding file");
        } catch (FitRuntimeException e) {
            Log.e("WatchDownloaderSampler", "Error decoding FIT file: " + e.getMessage());
            getActivity().runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    Toast.makeText(getActivity(), "Error decoding FIT file", Toast.LENGTH_LONG).show();
                }
            });
        }

    return builder.create();
}

From source file:net.eledge.android.europeana.gui.dialog.NameInputDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    LayoutInflater inflater = getActivity().getLayoutInflater();

    View view = inflater.inflate(R.layout.dialog_nameinput, null);
    TextView text = (TextView) view.findViewById(R.id.dialog_nameinput_textview);
    if (resText != -1) {
        text.setText(resText);/*  w  w  w  .ja v a 2s.  c  o m*/
    } else {
        text.setVisibility(View.GONE);
    }
    mInput = (EditText) view.findViewById(R.id.dialog_nameinput_edittext);
    mInput.setHint(resInput);
    mInput.addTextChangedListener(new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            //ignore
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            //ignore
        }

        @Override
        public void afterTextChanged(Editable s) {
            mDialog.getButton(Dialog.BUTTON_POSITIVE).setEnabled(StringUtils.isNotBlank(s.toString()));
        }
    });

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setView(view);
    if (resTitle != -1) {
        builder.setTitle(resTitle);
    }
    builder.setPositiveButton(resPositiveButton, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int id) {
            String input = mInput.getText().toString();
            if (StringUtils.isNotBlank(input)) {
                mListener.positiveResponse(input);
                NameInputDialog.this.dismiss();
            }
        }
    });
    builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int id) {
            mListener.negativeResponse();
            mDialog.dismiss();
        }
    });
    mDialog = builder.create();
    mDialog.setCanceledOnTouchOutside(false);
    mDialog.setCancelable(false);
    return mDialog;
}

From source file:kr.co.generic.wifianalyzer.wifi.AccessPointDetail.java

private void setViewVendorLong(@NonNull View view, @NonNull WiFiAdditional wiFiAdditional) {
    TextView textVendor = ((TextView) view.findViewById(kr.co.generic.wifianalyzer.R.id.vendorLong));
    String vendor = wiFiAdditional.getVendorName();
    if (StringUtils.isBlank(vendor)) {
        textVendor.setVisibility(View.GONE);
    } else {//from  w  w  w. j a va  2 s  .  c  o m
        textVendor.setVisibility(View.VISIBLE);
        textVendor.setText(vendor.substring(0, Math.min(VENDOR_LONG_MAX, vendor.length())));
    }
}

From source file:kr.co.generic.wifianalyzer.wifi.AccessPointDetail.java

private void setViewVendorShort(@NonNull View view, @NonNull WiFiAdditional wiFiAdditional) {
    TextView textVendorShort = ((TextView) view.findViewById(kr.co.generic.wifianalyzer.R.id.vendorShort));
    String vendor = wiFiAdditional.getVendorName();
    if (StringUtils.isBlank(vendor)) {
        textVendorShort.setVisibility(View.GONE);
    } else {/*  w ww  . ja v a 2  s  .  co m*/
        textVendorShort.setVisibility(View.VISIBLE);
        textVendorShort.setText(vendor.substring(0, Math.min(VENDOR_SHORT_MAX, vendor.length())));
    }
}

From source file:com.github.jobs.ui.fragment.JobDetailsFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    Bundle arguments = getArguments();/*from  w  w  w  .j a  v  a 2 s.  com*/
    String jobId = arguments.getString(KEY_JOB_ID);
    mJob = new Job();
    mJob.setId(jobId);
    mJob = adapter.findFirst(mJob);
    if (mJob == null) {
        mJob = new Job();
        Toast.makeText(getActivity(), R.string.error_getting_job_info, Toast.LENGTH_LONG).show();
    }
    setHasOptionsMenu(true);

    TextView title = (TextView) getView().findViewById(R.id.title);
    title.setText(StringUtils.trim(mJob.getTitle()));

    TextView description = (TextView) getView().findViewById(R.id.description);
    String jobDescription = mJob.getDescription();
    if (jobDescription != null) {
        description.setText(Html.fromHtml(jobDescription));
        description.setMovementMethod(LinkMovementMethod.getInstance());
    }

    TextView company = (TextView) getView().findViewById(R.id.company);
    company.setText(mJob.getCompany());

    TextView companyUrl = (TextView) getView().findViewById(R.id.company_url);
    if (mJob.getCompanyUrl() == null) {
        companyUrl.setVisibility(View.GONE);
    } else {
        SpannableString content = new SpannableString(mJob.getCompanyUrl());
        content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
        companyUrl.setText(content);
        companyUrl.setOnClickListener(this);
        companyUrl.setVisibility(View.VISIBLE);
    }

    TextView companyLocation = (TextView) getView().findViewById(R.id.company_location);
    if (mJob.getLocation() == null) {
        companyLocation.setVisibility(View.GONE);
    } else {
        companyLocation.setText(mJob.getLocation());
        companyLocation.setVisibility(View.VISIBLE);
    }

    if (!JobDetailsActivity.FULL_TIME.equalsIgnoreCase(mJob.getType())) {
        getView().findViewById(R.id.full_time).setVisibility(View.INVISIBLE);
    }

    mBackground = (ImageView) getView().findViewById(R.id.job_details_background);
    setLogoBackground();
}

From source file:ch.timjahn.learningapp.ls.java

public void hideSolution() {
    TextView tv2 = (TextView) findViewById(R.id.solution);
    tv2.setVisibility(View.GONE);
}

From source file:com.example.levelup.core.app.LoginFragment.java

/**
 * Shows an error message in the fragment. This is for general errors relating to logging in.
 * /*from ww w  .  j av a2s . c  o  m*/
 * @param message the error message to display or null to hide the message.
 */
private void showErrorMessage(CharSequence message) {
    TextView errorView = (TextView) getView().findViewById(R.id.error_message);
    errorView.setText(message);

    if (TextUtils.isEmpty(message)) {
        errorView.setVisibility(View.GONE);
    } else {
        errorView.setVisibility(View.VISIBLE);
    }
}

From source file:com.enadein.carlogbook.core.BaseActivity.java

protected void showErrorLayout(int errorViewId, boolean show) {
    TextView errorView = (TextView) findViewById(errorViewId);
    errorView.setVisibility((show) ? View.VISIBLE : View.GONE);
}

From source file:com.enadein.carlogbook.core.BaseActivity.java

public void showError(int errorViewId, boolean show) {
    TextView errorView = (TextView) findViewById(errorViewId);
    errorView.setVisibility((show) ? View.VISIBLE : View.GONE);
}

From source file:com.coincollection.ReorderCollections.java

private void showUnsavedTextView() {

    TextView unsavedMessageView = (TextView) getView().findViewById(R.id.unsaved_message_textview_reorder);

    unsavedMessageView.setVisibility(View.VISIBLE);
}