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.bt.download.android.gui.adapters.SearchResultListAdapter.java

protected void populateFilePart(View view, FileSearchResult sr) {
    ImageView fileTypeIcon = findView(view, R.id.view_bittorrent_search_result_list_item_filetype_icon);
    fileTypeIcon.setImageResource(getFileTypeIconId());

    TextView adIndicator = findView(view, R.id.view_bittorrent_search_result_list_item_ad_indicator);
    adIndicator.setVisibility(View.GONE);

    TextView title = findView(view, R.id.view_bittorrent_search_result_list_item_title);
    title.setText(sr.getDisplayName());/* w ww  . j  ava  2  s  . c om*/
    // if marked as downloading
    // title.setTextColor(GlobalConstants.COLOR_DARK_BLUE);

    TextView fileSize = findView(view, R.id.view_bittorrent_search_result_list_item_file_size);
    if (sr.getSize() > 0) {
        fileSize.setText(UIUtils.getBytesInHuman(sr.getSize()));
    } else {
        fileSize.setText("");
    }

    TextView extra = findView(view, R.id.view_bittorrent_search_result_list_item_text_extra);
    extra.setText(FilenameUtils.getExtension(sr.getFilename()));

    TextView seeds = findView(view, R.id.view_bittorrent_search_result_list_item_text_seeds);
    seeds.setText("");

    String license = sr.getLicense().equals(License.UNKNOWN) ? "" : " - " + sr.getLicense();

    TextView sourceLink = findView(view, R.id.view_bittorrent_search_result_list_item_text_source);
    sourceLink.setText(sr.getSource() + license); // TODO: ask for design
    sourceLink.setTag(sr.getDetailsUrl());
    sourceLink.setPaintFlags(sourceLink.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
    sourceLink.setOnClickListener(linkListener);
}

From source file:com.forrestguice.suntimeswidget.LocationDialog.java

protected void initViews(Context context) {
    WidgetSettings.initDisplayStrings(context);

    TextView groupTitle = (TextView) findViewById(R.id.appwidget_location_grouptitle);
    groupTitle.setVisibility(View.GONE);

    ArrayAdapter<WidgetSettings.LocationMode> spinner_locationModeAdapter;
    spinner_locationModeAdapter = new ArrayAdapter<WidgetSettings.LocationMode>(myParent,
            R.layout.layout_listitem_oneline, WidgetSettings.LocationMode.values());
    spinner_locationModeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    spinner_locationMode = (Spinner) findViewById(R.id.appwidget_location_mode);
    spinner_locationMode.setAdapter(spinner_locationModeAdapter);
    spinner_locationMode.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() {
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            final WidgetSettings.LocationMode[] locationModes = WidgetSettings.LocationMode.values();
            WidgetSettings.LocationMode locationMode = locationModes[parent.getSelectedItemPosition()];

            LocationDialogMode dialogMode = (locationMode == WidgetSettings.LocationMode.CUSTOM_LOCATION)
                    ? LocationDialogMode.MODE_CUSTOM
                    : LocationDialogMode.MODE_AUTO;
            setMode(dialogMode);/* w  w  w . jav a  2  s.  c  om*/
        }

        public void onNothingSelected(AdapterView<?> parent) {
        }
    });

    labl_locationName = (TextView) findViewById(R.id.appwidget_location_name_label);
    text_locationName = (EditText) findViewById(R.id.appwidget_location_name);

    labl_locationLat = (TextView) findViewById(R.id.appwidget_location_lat_label);
    text_locationLat = (EditText) findViewById(R.id.appwidget_location_lat);

    labl_locationLon = (TextView) findViewById(R.id.appwidget_location_lon_label);
    text_locationLon = (EditText) findViewById(R.id.appwidget_location_lon);

    progress_getfix = (ProgressBar) findViewById(R.id.appwidget_location_getfixprogress);
    progress_getfix.setVisibility(View.GONE);

    button_getfix = (ImageButton) findViewById(R.id.appwidget_location_getfix);
    button_getfix.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            getFixHelper.getFix();
        }
    });

    getFixUI = new GetFixUI1(text_locationName, text_locationLat, text_locationLon, progress_getfix,
            button_getfix);
    getFixHelper = new GetFixHelper(myParent, getFixUI);

    if (!getFixHelper.isLocationEnabled()) {
        button_getfix.setImageResource(GetFixUI.ICON_GPS_DISABLED);
    }
}

From source file:de.hackerspacebremen.fragments.StatusFragment.java

public void onEvent(final RefreshEvent event) {
    if (statusAnimation != null) {
        statusAnimation.start();//from   ww  w.  j  a v  a 2s. c  o m
    }
    if (messageAnimation != null) {
        messageAnimation.start();
    }
    StatusViewHolder.get().messageBlock.setVisibility(RelativeLayout.GONE);
    StatusViewHolder.get().imgStatus.setVisibility(ImageView.VISIBLE);
    StatusViewHolder.get().imgConnErr.setVisibility(ImageView.GONE);
    final TextView text = StatusViewHolder.get().statusMessage;
    text.setTypeface(null, Typeface.NORMAL);
    text.setText(getString(R.string.fetch_status));
    final TextView messageText = StatusViewHolder.get().messageText;
    messageText.setText(getString(R.string.fetch_message));
    final TextView messageLabel = StatusViewHolder.get().messageLabel;
    messageLabel.setVisibility(TextView.GONE);
    startStatusCommunication();
}

From source file:com.example.h.medapp.QuestionActivity.java

private void addItem() {
    answered_flag = false;//from  w ww. ja  v a  2s.c o m
    textView.setText("Question " + (count + 1) + " / 10");

    // Instantiate a new "row" view.
    final ViewGroup newView = (ViewGroup) LayoutInflater.from(this).inflate(R.layout.row, mContainerView,
            false);

    mContainerView.addView(newView);

    SeekBar seekBar = (SeekBar) newView.findViewById(R.id.progress_bar);
    TextView question_text_view = (TextView) newView.findViewById(R.id.question_text);
    Button next_button = (Button) newView.findViewById(R.id.next_button);
    final TextView slider_textView = (TextView) newView.findViewById(R.id.slider_text);

    scrollView.scrollBy(0, +1000);

    slider_textView.setVisibility(View.INVISIBLE);
    question_text_view.setText(questions_array[count]);

    seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        int progress = 0;

        @Override
        public void onProgressChanged(SeekBar seekBar, int progresValue, boolean fromUser) {
            progress = progresValue;
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
            answered_flag = true;
            Toast.makeText(getApplicationContext(), "Stopped tracking seekbar", Toast.LENGTH_SHORT).show();
            //TODO: save the result to an array
            result_array[count] = progress;
            slider_textView.setVisibility(View.VISIBLE);
            slider_textView.setText("you have chosen: " + seekBar.getProgress() + "/" + seekBar.getMax()
                    + " as your degree of symptom.");

        }
    });

    next_button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View arg0) {
            if (answered_flag) {
                //MAKE SURE THIS QUESTION IS NOT THE LAST QUESTION.
                //IF IT IS THE LAST QUESTION GO TO THANK YOU ACTIVITY
                if (count == total_number_of_question - 1) {
                    //TODO: save to parse

                    //TODO: go to thank you activity
                    Intent intent = new Intent(QuestionActivity.this, activity_T.class);
                    startActivity(intent);

                } else {
                    //IF NOT GO TO NEXT QUESTION
                    count++;
                    addItem();
                }

            }
        }
    });

}

From source file:android.support.v17.preference.LeanbackListPreferenceDialogFragment.java

@Override
public @Nullable View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.leanback_list_preference_fragment, container, false);
    final VerticalGridView verticalGridView = (VerticalGridView) view.findViewById(android.R.id.list);

    verticalGridView.setWindowAlignment(VerticalGridView.WINDOW_ALIGN_BOTH_EDGE);
    verticalGridView.setFocusScrollStrategy(VerticalGridView.FOCUS_SCROLL_ALIGNED);
    verticalGridView.setAdapter(onCreateAdapter());
    verticalGridView.requestFocus();//  ww w . j  a  v  a 2s  .com

    final CharSequence title = mDialogTitle;
    if (!TextUtils.isEmpty(title)) {
        final TextView titleView = (TextView) view.findViewById(R.id.decor_title);
        titleView.setText(title);
    }

    final CharSequence message = mDialogMessage;
    if (!TextUtils.isEmpty(message)) {
        final TextView messageView = (TextView) view.findViewById(android.R.id.message);
        messageView.setVisibility(View.VISIBLE);
        messageView.setText(message);
    }

    return view;
}

From source file:de.awisus.refugeeaidleipzig.views.signup.FragmentSignup.java

@Override
protected void initElements(View view) {
    super.initElements(view);

    warnungID = R.string.warnung_signup;

    TextView tvUnterkunft;
    tvUnterkunft = (TextView) view.findViewById(R.id.tvUnterkunft);
    spUnterkunft = (Spinner) view.findViewById(R.id.spUnterkunft);

    if (isRefugee) {
        initSpinnerAdapter();/*from   w  w  w  .  j  a  v a 2s.  c  o m*/
    } else {
        tvUnterkunft.setVisibility(View.GONE);
        spUnterkunft.setVisibility(View.GONE);
    }
}

From source file:org.geometerplus.android.fbreader.network.AuthenticationActivity.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    Thread.setDefaultUncaughtExceptionHandler(
            new org.geometerplus.zlibrary.ui.android.library.UncaughtExceptionHandler(this));
    setResult(RESULT_CANCELED);/* ww w  . ja va  2s  .  c o m*/
    setContentView(R.layout.authentication);

    final Intent intent = getIntent();
    final String host = intent.getStringExtra(HOST_KEY);
    final String area = intent.getStringExtra(AREA_KEY);
    final String username = intent.getStringExtra(USERNAME_KEY);
    final String error = intent.getStringExtra(ERROR_KEY);
    final boolean showSignupLink = intent.getBooleanExtra(SHOW_SIGNUP_LINK_KEY, false);

    myResource = ZLResource.resource("dialog").getResource("AuthenticationDialog");

    setTitle(host != null ? host : myResource.getResource("title").getValue());

    if (area != null && !"".equals(area)) {
        findTextView(R.id.authentication_subtitle).setText(area);
    } else {
        findTextView(R.id.authentication_subtitle).setVisibility(View.GONE);
    }
    final TextView warningView = findTextView(R.id.authentication_unencrypted_warning);
    if ("https".equalsIgnoreCase(intent.getStringExtra(SCHEME_KEY))) {
        warningView.setVisibility(View.GONE);
    } else {
        warningView.setText(myResource.getResource("unencryptedWarning").getValue());
    }
    findTextView(R.id.authentication_username_label).setText(myResource.getResource("login").getValue());
    findTextView(R.id.authentication_password_label).setText(myResource.getResource("password").getValue());

    final TextView usernameView = findTextView(R.id.authentication_username);
    usernameView.setText(username);

    final TextView errorView = findTextView(R.id.authentication_error);
    if (error != null && !"".equals(error)) {
        errorView.setVisibility(View.VISIBLE);
        errorView.setText(error);
    } else {
        errorView.setVisibility(View.GONE);
    }

    if (showSignupLink) {
        findViewById(R.id.authentication_signup_box).setVisibility(View.VISIBLE);
        final TextView signupView = (TextView) findViewById(R.id.authentication_signup);
        signupView.setText(myResource.getResource("register").getValue());
        signupView.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                setResult(RESULT_SIGNUP);
                finish();
            }
        });
    } else {
        findViewById(R.id.authentication_signup_box).setVisibility(View.GONE);
    }

    final ZLResource buttonResource = ZLResource.resource("dialog").getResource("button");

    final Button okButton = findButton(R.id.authentication_ok_button);
    okButton.setText(buttonResource.getResource("ok").getValue());
    okButton.setOnClickListener(new Button.OnClickListener() {
        public void onClick(View v) {
            final Intent data = new Intent();
            data.putExtra(USERNAME_KEY, usernameView.getText().toString());
            data.putExtra(PASSWORD_KEY, findTextView(R.id.authentication_password).getText().toString());
            setResult(RESULT_OK, data);
            finish();
        }
    });

    final Button cancelButton = findButton(R.id.authentication_cancel_button);
    cancelButton.setText(buttonResource.getResource("cancel").getValue());
    cancelButton.setOnClickListener(new Button.OnClickListener() {
        public void onClick(View v) {
            finish();
        }
    });
}

From source file:eu.operando.proxy.wifi.AccessPointsDetail.java

public void setView(@NonNull Resources resources, @NonNull View view, @NonNull final WiFiDetail wiFiDetail) {

    TextView ssidLabel = (TextView) view.findViewById(R.id.ssid);
    ssidLabel.setText(wiFiDetail.getTitle());
    TextView textLinkSpeed = (TextView) view.findViewById(R.id.linkSpeed);
    String ipAddress = wiFiDetail.getWiFiAdditional().getIPAddress();
    boolean isConnected = StringUtils.isNotBlank(ipAddress);
    if (!isConnected) {
        textLinkSpeed.setVisibility(View.GONE);
        ssidLabel.setTextColor(resources.getColor(android.R.color.white));
    } else {/*from   w w w .j  a  va2s .c  o m*/
        ssidLabel.setTextColor(resources.getColor(R.color.connected));

        int linkSpeed = wiFiDetail.getWiFiAdditional().getLinkSpeed();
        if (linkSpeed == WiFiConnection.LINK_SPEED_INVALID) {
            textLinkSpeed.setVisibility(View.GONE);
        } else {
            textLinkSpeed.setVisibility(View.VISIBLE);
            textLinkSpeed.setText(String.format("%d%s", linkSpeed, WifiInfo.LINK_SPEED_UNITS));
        }
    }

    WiFiSignal wiFiSignal = wiFiDetail.getWiFiSignal();
    Strength strength = wiFiSignal.getStrength();
    ImageView imageView = (ImageView) view.findViewById(R.id.levelImage);
    imageView.setImageResource(strength.imageResource());
    imageView.setColorFilter(resources.getColor(strength.colorResource()));

    Security security = wiFiDetail.getSecurity();
    ImageView securityImage = (ImageView) view.findViewById(R.id.securityImage);
    securityImage.setImageResource(security.imageResource());
    securityImage.setColorFilter(resources.getColor(R.color.icons_color));

    TextView textLevel = (TextView) view.findViewById(R.id.level);
    textLevel.setText(String.format("%ddBm", wiFiSignal.getLevel()));
    textLevel.setTextColor(resources.getColor(strength.colorResource()));

    ((TextView) view.findViewById(R.id.channel))
            .setText(String.format("%d", wiFiSignal.getWiFiChannel().getChannel()));
    ((TextView) view.findViewById(R.id.frequency))
            .setText(String.format("%d%s", wiFiSignal.getFrequency(), WifiInfo.FREQUENCY_UNITS));
    ((TextView) view.findViewById(R.id.distance)).setText(String.format("%.1fm", wiFiSignal.getDistance()));
    ((TextView) view.findViewById(R.id.capabilities)).setText(wiFiDetail.getCapabilities());

    LayoutInflater layoutInflater = mainContext.getLayoutInflater();

    final WiFiApConfig wiFiApConfig = wiFiDetail.getWiFiAdditional().getWiFiApConfig();
    ImageView configuredImage = (ImageView) view.findViewById(R.id.configuredImage);
    if (wiFiApConfig != null) {

        configuredImage.setVisibility(View.VISIBLE);

        if (isOperandoCompatible(wiFiApConfig)) {
            configuredImage.setColorFilter(resources.getColor(android.R.color.holo_green_light));
            view.setOnClickListener(
                    new ConfiguredClickListener(context, wiFiDetail, wiFiApConfig, isConnected));
        } else {
            configuredImage.setColorFilter(resources.getColor(android.R.color.holo_red_light));
            view.setOnClickListener(new ForgetClickListener(context, wiFiDetail));
        }

    } else {
        configuredImage.setVisibility(View.GONE);
        view.setOnClickListener(new ConnectClickListener(context, wiFiDetail, layoutInflater));
    }

}

From source file:es.uniovi.imovil.fcrtrainer.BinaryExerciseFragment.java

private void updateToTrainMode() {
    gameMode = false;/*from w  w  w . j  ava 2  s.co  m*/

    Button solution = (Button) rootView.findViewById(R.id.seesolution);
    solution.setVisibility(View.VISIBLE);
    Button change = (Button) rootView.findViewById(R.id.change);
    change.setVisibility(View.VISIBLE);

    TextView points = (TextView) rootView.findViewById(R.id.points);
    points.setVisibility(View.INVISIBLE);
}

From source file:es.uniovi.imovil.fcrtrainer.BinaryExerciseFragment.java

private void updateToGameMode() {
    gameMode = true;/*from w  w  w  .ja  v  a 2s .c  o  m*/

    newQuestion();

    Button solution = (Button) rootView.findViewById(R.id.seesolution);
    solution.setVisibility(View.INVISIBLE);
    Button change = (Button) rootView.findViewById(R.id.change);
    change.setVisibility(View.INVISIBLE);

    TextView points = (TextView) rootView.findViewById(R.id.points);
    points.setVisibility(View.VISIBLE);

}