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:org.geometerplus.fbreader.plugin.local_opds_scanner.ScanLocalNetworkActivity.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    setContentView(R.layout.scan_local_network);

    setListAdapter(new ItemAdapter());

    setTitle(R.string.scan_local_network_window_title);

    final View buttonView = findViewById(R.id.scan_local_network_buttons);

    final Button cancelButton = (Button) buttonView.findViewById(R.id.cancel_button);
    cancelButton.setText(R.string.button_cancel);
    cancelButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            finish();/*from w ww. j  a va 2 s .  co m*/
        }
    });

    final WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
    final int state = wifiManager.getWifiState();
    if (state != WifiManager.WIFI_STATE_ENABLED && state != WifiManager.WIFI_STATE_ENABLING) {
        setTitle(R.string.wifi_is_turned_off);
        final View listView = findViewById(android.R.id.list);
        final TextView errorView = (TextView) findViewById(R.id.scan_local_network_error);
        listView.setVisibility(View.GONE);
        errorView.setVisibility(View.VISIBLE);
        errorView.setText(R.string.turn_wifi_on);

        final Button turnOnButton = (Button) buttonView.findViewById(R.id.ok_button);
        turnOnButton.setText(R.string.button_turn_on);
        turnOnButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                wifiManager.setWifiEnabled(true);
                finish();
            }
        });

        myLock = null;
    } else {
        final Button rescanButton = (Button) buttonView.findViewById(R.id.ok_button);
        rescanButton.setText(R.string.button_rescan);
        rescanButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                runOnUiThread(new Runnable() {
                    public void run() {
                        clear();
                        scan();
                    }
                });
            }
        });

        myLock = wifiManager.createMulticastLock("FBReader_lock");
        myLock.setReferenceCounted(true);
        myLock.acquire();

        scan();
    }
}

From source file:com.example.wmgps.MainActivity.java

private void processUIDisplay(Map<String, String> typeAndValueOfTag) {
    int currentOutputTag = R.id.Hidden1;
    int currentInputTag = R.id.edit_message;

    for (Iterator<String> iterator = (Iterator<String>) typeAndValueOfTag.keySet(); iterator.hasNext();) {
        String inputType = iterator.next();
        String inputValue = typeAndValueOfTag.get(inputType);

        if (inputType.equals("output")) {
            TextView output = (TextView) findViewById(currentOutputTag++);
            output.setText(inputValue);//  w w w.j av  a2 s .  c  om
            output.setVisibility(View.VISIBLE);
        } else if (inputType.equals("input")) {
            EditText input = ((EditText) findViewById(currentInputTag++));
            input.setVisibility(View.VISIBLE);
            input.setFocusable(true);
            if (Misc.isNullTrimmedString(inputValue))
                input.setHint("Please enter value");
            else
                input.setText(inputValue);
        }
    }
}

From source file:com.zt.hackman.model.HackmanModel.java

/**
 * ??/*from   w  ww .j a v a 2s  . com*/
 */
private void initImage(RelativeLayout btn, String text) {
    View view = LayoutInflater.from(ac).inflate(R.layout.layout_front_one, btn, false);
    ImageView imageView = (ImageView) view.findViewById(R.id.layout_one_img);
    TextView textView = (TextView) view.findViewById(R.id.layout_one_text);
    if (textView == null) {
        textView.setVisibility(View.GONE);
    } else {
        textView.setText(text);
    }
    btn.addView(view);
}

From source file:com.google.android.apps.paco.FindExperimentsActivity.java

private TextView createRefreshHeader() {
    TextView listHeader = (TextView) findViewById(R.id.ExperimentRefreshTitle);
    DateTime lastRefresh = userPrefs.getAvailableExperimentListRefreshTime();
    if (lastRefresh == null) {
        listHeader.setVisibility(View.GONE);
    } else {//  ww  w  .  ja  va 2 s  .co  m
        String lastRefreshTime = TimeUtil.dateTimeNoZoneFormatter.print(lastRefresh);
        String header = getString(R.string.last_refreshed) + ": " + lastRefreshTime;
        listHeader.setText(header);
        listHeader.setTextSize(15);
    }
    return listHeader;
}

From source file:com.coinblesk.client.CurrentBalanceFragment.java

private void refreshTestnetWarning() {
    final View view = getView();
    if (walletService == null || view == null) {
        return;/*  w  w w.ja  va2  s.  c  om*/
    }

    final TextView testnetWarning = (TextView) view.findViewById(R.id.testnet_textview);
    final NetworkParameters params = walletService.getNetworkParameters();
    if (testnetWarning != null) {
        if (ClientUtils.isMainNet(params)) {
            testnetWarning.setVisibility(View.GONE);
        } else {
            testnetWarning.setText(getString(R.string.testnet_warning, params.getClass().getSimpleName()));
            testnetWarning.setVisibility(View.VISIBLE);
        }
    }
}

From source file:com.gh4a.fragment.RepositoryFragment.java

private void fillData() {
    TextView tvRepoName = (TextView) mContentView.findViewById(R.id.tv_repo_name);
    SpannableStringBuilder repoName = new SpannableStringBuilder();
    repoName.append(mRepository.getOwner().getLogin());
    repoName.append("/");
    repoName.append(mRepository.getName());
    repoName.setSpan(new IntentSpan(tvRepoName.getContext()) {
        @Override/*from w  ww.j a  va 2s  . co  m*/
        protected Intent getIntent() {
            return IntentUtils.getUserActivityIntent(getActivity(), mRepository.getOwner());
        }
    }, 0, mRepository.getOwner().getLogin().length(), 0);
    tvRepoName.setText(repoName);
    tvRepoName.setMovementMethod(UiUtils.CHECKING_LINK_METHOD);

    TextView tvParentRepo = (TextView) mContentView.findViewById(R.id.tv_parent);
    if (mRepository.isFork() && mRepository.getParent() != null) {
        Repository parent = mRepository.getParent();
        tvParentRepo.setVisibility(View.VISIBLE);
        tvParentRepo.setText(
                getString(R.string.forked_from, parent.getOwner().getLogin() + "/" + parent.getName()));
        tvParentRepo.setOnClickListener(this);
        tvParentRepo.setTag(parent);
    } else {
        tvParentRepo.setVisibility(View.GONE);
    }

    fillTextView(R.id.tv_desc, 0, mRepository.getDescription());
    fillTextView(R.id.tv_language, R.string.repo_language, mRepository.getLanguage());
    fillTextView(R.id.tv_url, 0, !StringUtils.isBlank(mRepository.getHomepage()) ? mRepository.getHomepage()
            : mRepository.getHtmlUrl());

    mContentView.findViewById(R.id.cell_stargazers).setOnClickListener(this);
    mContentView.findViewById(R.id.cell_forks).setOnClickListener(this);
    mContentView.findViewById(R.id.cell_pull_requests).setOnClickListener(this);
    mContentView.findViewById(R.id.tv_contributors_label).setOnClickListener(this);
    mContentView.findViewById(R.id.other_info).setOnClickListener(this);
    mContentView.findViewById(R.id.tv_releases_label).setOnClickListener(this);

    Permissions permissions = mRepository.getPermissions();
    updateClickableLabel(R.id.tv_collaborators_label, permissions != null && permissions.hasPushAccess());
    updateClickableLabel(R.id.tv_downloads_label, mRepository.isHasDownloads());
    updateClickableLabel(R.id.tv_wiki_label, mRepository.isHasWiki());

    TextView tvStargazersCount = (TextView) mContentView.findViewById(R.id.tv_stargazers_count);
    tvStargazersCount.setText(String.valueOf(mRepository.getWatchers()));

    TextView tvForksCount = (TextView) mContentView.findViewById(R.id.tv_forks_count);
    tvForksCount.setText(String.valueOf(mRepository.getForks()));

    LinearLayout llIssues = (LinearLayout) mContentView.findViewById(R.id.cell_issues);

    if (mRepository.isHasIssues()) {
        llIssues.setVisibility(View.VISIBLE);
        llIssues.setOnClickListener(this);
        // value will be filled when PR count arrives
    } else {
        llIssues.setVisibility(View.GONE);
    }

    mContentView.findViewById(R.id.tv_private)
            .setVisibility(mRepository.isPrivate() ? View.VISIBLE : View.GONE);

}

From source file:app.abhijit.iter.MainActivity.java

public void displaySubjectsEmptyHint(boolean visible) {
    TextView subjectsEmptyHint = (TextView) findViewById(R.id.hint_subjects_empty);
    subjectsEmptyHint.setVisibility(visible ? View.VISIBLE : View.GONE);
}

From source file:app.abhijit.iter.MainActivity.java

public void displayStudentsEmptyHint(boolean visible) {
    TextView studentsEmptyHint = (TextView) findViewById(R.id.hint_students_empty);
    studentsEmptyHint.setVisibility(visible ? View.VISIBLE : View.GONE);
}

From source file:fm.smart.r1.CreateExampleActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ExceptionHandler.register(this);
    setContentView(R.layout.create_example);
    final Intent queryIntent = getIntent();
    Bundle extras = queryIntent.getExtras();
    item_id = (String) extras.get("item_id");
    goal_id = (String) extras.get("goal_id");
    if (goal_id == null || goal_id.equals("")) {
        goal_id = Main.default_study_goal_id;
    }//from  ww  w .ja v a 2  s  . c o m

    cue = (String) extras.get("cue");
    example = (String) extras.get("example");
    translation = (String) extras.get("translation");
    example_language = (String) extras.get("example_language");
    translation_language = (String) extras.get("translation_language");
    example_transliteration = (String) extras.get("example_transliteration");
    translation_transliteration = (String) extras.get("translation_transliteration");

    TextView example_text = (TextView) findViewById(R.id.create_example_sentence);
    if (!TextUtils.isEmpty(example)) {
        example_text.setText(example);
    }
    example_text.setHint(example_language + " sentence with " + cue);
    TextView translation_text = (TextView) findViewById(R.id.create_example_translation);
    if (!TextUtils.isEmpty(translation)) {
        translation_text.setText(translation);
    }
    translation_text.setHint(translation_language + " translation of example sentence");

    Button button = (Button) findViewById(R.id.create_example_submit);
    button.setOnClickListener(this);

    TextView translation_text_legend = (TextView) findViewById(R.id.create_example_translation_legend);

    TextView sentence_transliteration_textView = (TextView) findViewById(
            R.id.create_example_sentence_transliteration);
    EditText sentence_transliteration_input_textView = (EditText) findViewById(R.id.sentence_transliteration);
    if (!Utils.isIdeographicLanguage(Main.search_lang)) {
        sentence_transliteration_textView.setVisibility(View.GONE);
        sentence_transliteration_input_textView.setVisibility(View.GONE);
    } else if (!TextUtils.isEmpty(example_transliteration)) {
        sentence_transliteration_input_textView.setText(example_transliteration);
    }

    TextView translation_transliteration_textView = (TextView) findViewById(
            R.id.create_example_translation_transliteration);
    EditText translation_transliteration_input_textView = (EditText) findViewById(
            R.id.translation_transliteration);
    if (!Utils.isIdeographicLanguage(Main.result_lang)) {
        translation_transliteration_textView.setVisibility(View.GONE);
        translation_transliteration_input_textView.setVisibility(View.GONE);
    } else if (!TextUtils.isEmpty(translation_transliteration)) {
        translation_transliteration_input_textView.setText(translation_transliteration);
    }

}

From source file:app.abhijit.iter.MainActivity.java

public void displayGettingStartedHint(boolean visible) {
    TextView gettingStartedHint = (TextView) findViewById(R.id.hint_getting_started);
    gettingStartedHint.setVisibility(visible ? View.VISIBLE : View.GONE);
}