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.arconus.dicecommander.ui.dialogs.PowerRollResultDialog.java

private void showCritStatus(View view) {
    if (roll != null) {
        CriticalStatus status = roll.getCritStatus();

        if (status == CriticalStatus.SUCCESS || status == CriticalStatus.FAILURE) {
            TextView critStatus = (TextView) view.findViewById(R.id.critical_status);
            if (critStatus != null) {
                critStatus.setVisibility(View.VISIBLE);

                int stringID = (status == CriticalStatus.SUCCESS) ? R.string.critical_hit
                        : R.string.critical_failure;
                int colorID = (status == CriticalStatus.SUCCESS) ? R.color.critical_hit
                        : R.color.critical_failure;

                critStatus.setText(stringID);
                critStatus.setTextColor(getResources().getColor(colorID));
            }// w ww .  j a  v  a2 s .co m
        }
    }
}

From source file:com.manning.androidhacks.hack026.SectionAdapter.java

@Override
public View getView(int position, View view, ViewGroup parent) {
    if (view == null) {
        view = activity.getLayoutInflater().inflate(R.layout.list_item, parent, false);
    }//from  w  ww.j a  va 2  s  . c  om
    TextView header = (TextView) view.findViewById(R.id.header);
    String label = getItem(position);
    if (position == 0 || getItem(position - 1).charAt(0) != label.charAt(0)) {
        header.setVisibility(View.VISIBLE);
        header.setText(label.substring(0, 1));
    } else {
        header.setVisibility(View.GONE);
    }
    return super.getView(position, view, parent);
}

From source file:org.flakor.androidtool.net.net.HistoryTask.java

@Override
protected void onPostExecute(Integer i) {
    if (i < 0) {
        if (dialog != null)
            dialog.dismiss();//from ww w.jav a2 s .  c om
        Toast.makeText(context, "?", Toast.LENGTH_SHORT).show();
    } else if (i >= 0) {
        View view = LayoutInflater.from(context).inflate(R.layout.dialog_history, null);
        ListView list = (ListView) view.findViewById(R.id.history_list);
        if (i == 0) {
            TextView noHistory = (TextView) view.findViewById(R.id.no_history);
            noHistory.setVisibility(View.VISIBLE);
            list.setVisibility(View.GONE);
        } else {
            RemoteHistoryAdapter adapter = new RemoteHistoryAdapter(context);
            list.setAdapter(adapter);
        }
        TextView title = (TextView) view.findViewById(R.id.dialog_title);
        title.setText("??");
        Button okBtn = (Button) view.findViewById(R.id.ok_btn);
        okBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
            }
        });

        dialog.setContentView(view);

        Toast.makeText(context, "??", Toast.LENGTH_SHORT).show();
    } else {
        if (dialog != null)
            dialog.dismiss();
        Toast.makeText(context, "???", Toast.LENGTH_SHORT).show();
    }
}

From source file:at.bitfire.davdroid.syncadapter.AccountDetailsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.account_details, container, false);

    serverInfo = (ServerInfo) getArguments().getSerializable(KEY_SERVER_INFO);

    editAccountName = (EditText) v.findViewById(R.id.account_name);
    editAccountName.addTextChangedListener(this);

    TextView textAccountNameInfo = (TextView) v.findViewById(R.id.account_name_info);
    if (!serverInfo.hasEnabledCalendars())
        textAccountNameInfo.setVisibility(View.GONE);

    setHasOptionsMenu(true);// w  w  w .  j  a  v  a  2s  .co m
    return v;
}

From source file:barqsoft.footballscores.ScoresFragment.java

private void updateEmptyView() {
    if (mAdapter.getCount() != 0)
        return;/*  w  w  w  .j av  a 2  s  .  c o  m*/
    @Status.NetworkStatus
    int networkStatus = Status.getNetworkStatus(getContext());
    TextView emptyTextView = (TextView) getView().findViewById(R.id.emptyListView);
    emptyTextView.setVisibility(View.VISIBLE);
    mScoreList.setEmptyView(emptyTextView);
    if (networkStatus == Status.INTERNET_OFF) {
        emptyTextView.setText(R.string.no_scores_internet_off);
        return;
    }
    @Status.FootballApiStatus
    int footballApiStatus = Status.getFootballApiStatus(getContext());
    if ((networkStatus == Status.INTERNET_ON) && (footballApiStatus == Status.SERVEUR_DOWN)) {
        emptyTextView.setText(R.string.no_scores_serveur_down);
        return;
    }
    if ((networkStatus == Status.INTERNET_ON) && (footballApiStatus == Status.SERVEUR_WRONG_URL_APP_INPUT)) {
        emptyTextView.setText(R.string.no_scores_wrong_url_app_input);
        return;
    }
    @Status.ScoreTableStatus
    int scoreTableStatus = Status.getScoreTableStatus(getContext());
    if ((networkStatus == Status.INTERNET_ON) && (footballApiStatus == Status.SERVEUR_OK)
            && (scoreTableStatus == Status.TABLE_STATUS_UNKNOWN)) {
        emptyTextView.setText(R.string.no_scores_table_status_unknown);
        return;
    }
    emptyTextView.setText(R.string.no_scores);
}

From source file:com.foursquare.android.sample.MainActivity.java

/**
 * Update the UI. If we already fetched a token, we'll just show a success
 * message./*w w  w . j a  v a 2 s.  c  o  m*/
 */
private void ensureUi() {
    boolean isAuthorized = !TextUtils.isEmpty(ExampleTokenStore.get().getToken());

    TextView tvMessage = (TextView) findViewById(R.id.tvMessage);
    tvMessage.setVisibility(isAuthorized ? View.VISIBLE : View.GONE);

    Button btnLogin = (Button) findViewById(R.id.btnLogin);
    btnLogin.setVisibility(isAuthorized ? View.GONE : View.VISIBLE);
    btnLogin.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            // Start the native auth flow.
            Intent intent = FoursquareOAuth.getConnectIntent(MainActivity.this, CLIENT_ID);

            // If the device does not have the Foursquare app installed, we'd
            // get an intent back that would open the Play Store for download.
            // Otherwise we start the auth flow.
            if (FoursquareOAuth.isPlayStoreIntent(intent)) {
                toastMessage(MainActivity.this, getString(R.string.app_not_installed_message));
                startActivity(intent);
            } else {
                startActivityForResult(intent, REQUEST_CODE_FSQ_CONNECT);
            }
        }
    });
}

From source file:com.granita.tasks.groupings.BaseTaskViewDescriptor.java

protected void setDescription(View view, Cursor cursor) {
    String description = TaskFieldAdapters.DESCRIPTION.get(cursor);
    TextView descriptionView = (TextView) getView(view, android.R.id.text1);
    if (TextUtils.isEmpty(description)) {
        descriptionView.setVisibility(View.GONE);
    } else {//from  www. j a  v a  2s  .c  om
        descriptionView.setVisibility(View.VISIBLE);
        if (description.length() > 150) {
            description = description.substring(0, 150);
        }
        descriptionView.setText(description);
    }
}

From source file:com.elkriefy.android.apps.authenticationexample.credentialsgrace.CredGraceActivity.java

private void showAlreadyAuthenticated() {
    TextView textView = (TextView) findViewById(R.id.already_has_valid_device_credential_message);
    textView.setVisibility(View.VISIBLE);
    textView.setText(getString(R.string.already_confirmed_device_credentials_within_last_x_seconds,
            AUTHENTICATION_DURATION_SECONDS));
    findViewById(R.id.purchase_button).setEnabled(false);
}

From source file:com.cw.litenote.note.NoteUi.java

public static void primaryVideoSeekBarProgressUpdater(ViewPager pager, int curNotePos, int curVideoPos,
        String pictureUri) {//w  ww . j av  a2 s  .co m
    //        System.out.println("NoteUi / _primaryVideoSeekBarProgressUpdater / curNotePos = " + curNotePos);
    if ((UtilVideo.mVideoView == null))
        return;

    ViewGroup pictureGroup = getPictureGroup(curNotePos, pager);

    TextView videoView_currPosition = null;
    SeekBar videoView_seekBar = null;
    TextView videoView_fileLength = null;

    if (pictureGroup != null) {
        videoView_currPosition = (TextView) (pictureGroup.findViewById(R.id.video_current_pos));
        videoView_seekBar = (SeekBar) (pictureGroup.findViewById(R.id.video_seek_bar));
        videoView_fileLength = (TextView) (pictureGroup.findViewById(R.id.video_file_length));
    }

    // show current play position
    if (videoView_currPosition != null) {
        videoView_currPosition.setText(Util.getTimeFormatString(curVideoPos));
        videoView_currPosition.setVisibility(View.VISIBLE);
    }

    // show file length
    if (!Util.isEmptyString(pictureUri)) {
        // set file length
        if (videoView_fileLength != null) {
            videoView_fileLength.setText(Util.getTimeFormatString(videoFileLength_inMilliSeconds));
            videoView_fileLength.setVisibility(View.VISIBLE);
        }
    }

    // show seek bar progress
    if (videoView_seekBar != null) {
        videoView_seekBar.setVisibility(View.VISIBLE);
        videoView_seekBar.setMax(99);
        videoView_progress = (int) (((float) curVideoPos / videoFileLength_inMilliSeconds) * 100);
        videoView_seekBar.setProgress(videoView_progress);
    }
}

From source file:android.support.test.testapp.PickersActivity.java

private void updateTextInUi(String text, TextView textView) {
    if (null == textView) {
        return;// www  . j  a v  a  2  s.co  m
    }

    if (View.INVISIBLE == textView.getVisibility()) {
        textView.setVisibility(View.VISIBLE);
    }

    textView.setText(text);
}