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.example.ramesh.p2pfileshare.ClientActivity.java

public void setTargetFileStatus(String message) {
    TextView targetFileStatus = (TextView) findViewById(R.id.selected_filename);
    targetFileStatus.setText(message);//from   w  w  w . j a  v a  2  s . c o  m
    targetFileStatus.setVisibility(View.VISIBLE);
}

From source file:com.example.ramesh.p2pfileshare.ClientActivity.java

public void setClientStatus(String message) {
    TextView clientStatusText = (TextView) findViewById(R.id.client_status_text);
    clientStatusText.setText(message);//from   w  w  w.  jav  a 2s  .c  om
    clientStatusText.setVisibility(View.VISIBLE);
}

From source file:com.groksolutions.grok.mobile.chart.AbstractAnomalyChartFragment.java

protected void updateUnit(final View parent, final AnomalyChartData data) {
    final TextView text = (TextView) parent.findViewById(R.id.metric_unit);
    if (text != null) {
        if (data == null) {
            text.setVisibility(View.GONE);
        } else {// w  w w. jav  a  2s  .  co m
            text.setVisibility(View.VISIBLE);
            text.setText(data.getUnit());
        }
        parent.forceLayout();
    }
}

From source file:com.example.com.benasque2014.mercurio.FamiliaMapaFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    buses = new Vector<Marker>();
    recorrido = (Recorrido) getArguments().getSerializable(Recorrido.KEY);

    View rootView = inflater.inflate(R.layout.fragment_family_map, container, false);
    TextView incidencia = (TextView) rootView.findViewById(R.id.textIncidencia);
    if (recorrido.getIncidencia().equalsIgnoreCase(""))
        incidencia.setVisibility(View.GONE);
    else/*from ww w.j  av  a 2  s  .c  o  m*/
        incidencia.setText(recorrido.getIncidencia());
    // Passing harcoded values for latitude & longitude. Please change as
    // per your need. This is just used to drop a Marker on the Map
    latitude = 42.6042858;
    longitude = 0.5228286000000253;

    setUpMapIfNeeded();

    return rootView;
}

From source file:com.groksolutions.grok.mobile.chart.AbstractAnomalyChartFragment.java

protected void updateDate(final View parent, final AnomalyChartData data) {
    final TextView dateView = (TextView) parent.findViewById(R.id.date);
    if (dateView != null) {
        if (data == null) {
            dateView.setVisibility(View.GONE);
        } else {//  w  w w.j a va  2s. c  o  m
            Date endDate = data.getEndDate();
            if (endDate != null) {
                dateView.setVisibility(View.VISIBLE);
                dateView.setText(_sdf.format(data.getEndDate()));
            } else {
                dateView.setVisibility(View.GONE);
            }
        }
        parent.forceLayout();
    }
}

From source file:net.exclaimindustries.geohashdroid.wiki.WikiMessageEditor.java

@Override
protected void onResume() {
    super.onResume();

    // Check for username/password here.  That way, when we get back from
    // the settings screen, it'll update the message accordingly.
    SharedPreferences prefs = getSharedPreferences(GHDConstants.PREFS_BASE, 0);
    TextView warning = (TextView) findViewById(R.id.warningmessage);
    String wpName = prefs.getString(GHDConstants.PREF_WIKI_USER, "");
    if ((wpName == null) || (wpName.trim().length() == 0)) {
        warning.setVisibility(View.VISIBLE);
    } else {/*w w w . j  a  va2s  .c  om*/
        warning.setVisibility(View.GONE);
    }

    resetSubmitButton();
}

From source file:com.app.blockydemo.content.bricks.ChangeVariableBrick.java

@Override
public View getView(final Context context, int brickId, BaseAdapter baseAdapter) {
    if (animationState) {
        return view;
    }/*from  w w w.  ja  v a 2s  . co m*/

    view = View.inflate(context, R.layout.brick_change_variable_by, null);
    view = getViewWithAlpha(alphaValue);
    setCheckboxView(R.id.brick_change_variable_checkbox);
    final Brick brickInstance = this;

    checkbox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            checked = isChecked;
            adapter.handleCheck(brickInstance, isChecked);
        }
    });

    TextView prototypeText = (TextView) view.findViewById(R.id.brick_change_variable_prototype_view);
    TextView textField = (TextView) view.findViewById(R.id.brick_change_variable_edit_text);
    prototypeText.setVisibility(View.GONE);
    variableFormula.setTextFieldId(R.id.brick_change_variable_edit_text);
    variableFormula.refreshTextField(view);
    textField.setVisibility(View.VISIBLE);
    textField.setOnClickListener(this);

    Spinner variableSpinner = (Spinner) view.findViewById(R.id.change_variable_spinner);
    UserVariableAdapter userVariableAdapter = ProjectManager.getInstance().getCurrentProject()
            .getUserVariables().createUserVariableAdapter(context, sprite);
    UserVariableAdapterWrapper userVariableAdapterWrapper = new UserVariableAdapterWrapper(context,
            userVariableAdapter);
    userVariableAdapterWrapper.setItemLayout(android.R.layout.simple_spinner_item, android.R.id.text1);

    variableSpinner.setAdapter(userVariableAdapterWrapper);

    if (!(checkbox.getVisibility() == View.VISIBLE)) {
        variableSpinner.setClickable(true);
        variableSpinner.setEnabled(true);
    } else {
        variableSpinner.setClickable(false);
        variableSpinner.setFocusable(false);
    }

    setSpinnerSelection(variableSpinner, null);

    variableSpinner.setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View view, MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_UP) {
                if (((Spinner) view).getSelectedItemPosition() == 0
                        && ((Spinner) view).getAdapter().getCount() == 1) {
                    NewVariableDialog dialog = new NewVariableDialog((Spinner) view);
                    dialog.addVariableDialogListener(ChangeVariableBrick.this);
                    dialog.show(((FragmentActivity) view.getContext()).getSupportFragmentManager(),
                            NewVariableDialog.DIALOG_FRAGMENT_TAG);
                    return true;
                }
            }
            return false;
        }
    });

    variableSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            if (position == 0 && ((UserVariableAdapterWrapper) parent.getAdapter()).isTouchInDropDownView()) {
                NewVariableDialog dialog = new NewVariableDialog((Spinner) parent);
                dialog.addVariableDialogListener(ChangeVariableBrick.this);
                dialog.show(((FragmentActivity) view.getContext()).getSupportFragmentManager(),
                        NewVariableDialog.DIALOG_FRAGMENT_TAG);
            }
            ((UserVariableAdapterWrapper) parent.getAdapter()).resetIsTouchInDropDownView();
            userVariable = (UserVariable) parent.getItemAtPosition(position);
            adapterView = parent;
        }

        @Override
        public void onNothingSelected(AdapterView<?> arg0) {
            userVariable = null;
        }
    });

    return view;
}

From source file:com.android.browser.GearsBaseDialog.java

/**
 * Utility method to set elements' text indicated in
 * the dialogs' arguments.//from  w w  w .j av a 2  s.c  o m
 */
void setLabel(JSONObject json, String name, int rsc) {
    try {
        if (json.has(name)) {
            String text = json.getString(name);
            View view = findViewById(rsc);
            if (view != null && text != null) {
                TextView textView = (TextView) view;
                textView.setText(text);
                textView.setVisibility(View.VISIBLE);
            }
        }
    } catch (JSONException e) {
        Log.e(TAG, "json exception", e);
    }
}

From source file:com.example.research.whatis.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    Log.e("CLicked Menu", String.valueOf(id));
    Log.e("CLicked action", String.valueOf(R.id.action_settings));
    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
        TextView view = (TextView) findViewById(R.id.textView);
        view.setVisibility(View.GONE);
        ListView lView = (ListView) findViewById(R.id.listView);
        lView.setVisibility(View.VISIBLE);

        ArrayList<String> storedWords = dbHelper.getAllWords();
        Log.e("SQLite", storedWords.toString());
        ArrayAdapter arrayAdapter = new ArrayAdapter(this, R.layout.activity_listview, R.id.wordsLabel,
                storedWords);/*from  ww w.  j a v a  2s .co m*/

        lView.setAdapter(arrayAdapter);
    }

    return super.onOptionsItemSelected(item);
}

From source file:com.android.mail.browse.MessageHeaderView.java

public static void renderExpandedDetails(Resources res, View detailsView, String viaDomain,
        Map<String, Address> addressCache, Account account, VeiledAddressMatcher veiledMatcher, String[] from,
        String[] replyTo, String[] to, String[] cc, String[] bcc, CharSequence receivedTimestamp,
        BidiFormatter bidiFormatter) {/*www .j a v a  2  s  .c  o m*/
    renderEmailList(res, R.id.from_heading, R.id.from_details, from, viaDomain, detailsView, addressCache,
            account, veiledMatcher, bidiFormatter);
    renderEmailList(res, R.id.replyto_heading, R.id.replyto_details, replyTo, viaDomain, detailsView,
            addressCache, account, veiledMatcher, bidiFormatter);
    renderEmailList(res, R.id.to_heading, R.id.to_details, to, viaDomain, detailsView, addressCache, account,
            veiledMatcher, bidiFormatter);
    renderEmailList(res, R.id.cc_heading, R.id.cc_details, cc, viaDomain, detailsView, addressCache, account,
            veiledMatcher, bidiFormatter);
    renderEmailList(res, R.id.bcc_heading, R.id.bcc_details, bcc, viaDomain, detailsView, addressCache, account,
            veiledMatcher, bidiFormatter);

    // Render date
    detailsView.findViewById(R.id.date_heading).setVisibility(VISIBLE);
    final TextView date = (TextView) detailsView.findViewById(R.id.date_details);
    date.setText(receivedTimestamp);
    date.setVisibility(VISIBLE);
}