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.fbbackup.TagMeImageGridFragment.java

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

    final View v = inflater.inflate(R.layout.album_photo_grid, container, false);
    final GridView mGridView = (GridView) v.findViewById(R.id.gridView);

    TextView tx_user_name = (TextView) v.findViewById(R.id.tx_album_name);

    tx_user_name.setText(albumName);// w  ww  .ja v  a2s .c om

    btn_tag_me = (ImageButton) v.findViewById(R.id.btn_tag_me);
    btn_photo = (ImageButton) v.findViewById(R.id.btn_photo);

    btn_tag_me.setVisibility(View.VISIBLE);
    btn_photo.setVisibility(View.VISIBLE);
    tx_user_name.setVisibility(View.GONE);

    btn_tag_me.setBackgroundResource(R.drawable.tagme);

    btn_photo.setOnClickListener(new ImageButton.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub

            getFragmentManager().popBackStack();

            MyFriendFragmentActivity.controlPanelHandler
                    .sendEmptyMessage(MyFriendFragmentActivity.SHOW_CONTROL_PANEL);
        }

    });

    cb_all = (CheckBox) v.findViewById(R.id.cb_all_photo);

    cb_all.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton v, boolean choose) {
            // TODO Auto-generated method stub

            if (choose) {

                // Toast.makeText(getActivity(), "choose:" + choose,
                // Toast.LENGTH_SHORT).show();

            } else {
                // Toast.makeText(getActivity(), "choose:" + choose,
                // Toast.LENGTH_SHORT).show();
            }
            setSelectedData(choose);

            mAdapter.notifyDataSetChanged();

        }

    });

    btn_download_photo = (ImageButton) v.findViewById(R.id.btn_download_photo);

    btn_download_photo.setOnClickListener(new ImageButton.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub

            String dir = Utils.getDirName(albumName);
            int select = 0;

            // QarrayU
            for (int i = 0; i < isSelected.size(); i++) {

                if (isSelected.get(i)) {
                    DownloadList.downloadPhotoAlbumQueue.add(dir);
                    DownloadList.downloadPhotoQueue.add(tagMePicture[i]);
                    DownloadList.downloadUserNameQueue.add(name);
                    select++;
                }

            }

            DownloadList.setAddNumber(select);

            DownloadList.setUserName(name);

            MyFriendFragmentActivity.downloadHandler.sendMessage(MyFriendFragmentActivity.downloadHandler
                    .obtainMessage(MyFriendFragmentActivity.DOWNLOAD_PRB, 0, 0));
        }

    });
    isSelected = new HashMap<Integer, Boolean>();

    initSelectedData();

    mGridView.setAdapter(mAdapter);
    mGridView.setOnItemClickListener(this);
    mGridView.setOnScrollListener(new AbsListView.OnScrollListener() {
        @Override
        public void onScrollStateChanged(AbsListView absListView, int scrollState) {
            // Pause fetcher to ensure smoother scrolling when flinging
            if (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_FLING) {
                mImageFetcher.setPauseWork(true);
            } else {
                mImageFetcher.setPauseWork(false);
            }
        }

        @Override
        public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount,
                int totalItemCount) {
        }
    });

    // This listener is used to get the final width of the GridView and then
    // calculate the
    // number of columns and the width of each column. The width of each
    // column is variable
    // as the GridView has stretchMode=columnWidth. The column width is used
    // to set the height
    // of each view so we get nice square thumbnails.
    mGridView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            if (mAdapter.getNumColumns() == 0) {
                final int numColumns = (int) Math
                        .floor(mGridView.getWidth() / (mImageThumbSize + mImageThumbSpacing));
                if (numColumns > 0) {
                    final int columnWidth = (mGridView.getWidth() / numColumns) - mImageThumbSpacing;
                    mAdapter.setNumColumns(numColumns);
                    mAdapter.setItemHeight(columnWidth);
                    if (BuildConfig.DEBUG) {
                        Log.d(TAG, "onCreateView - numColumns set to " + numColumns);
                    }
                }
            }
        }
    });

    return v;
}

From source file:com.android.mail.ui.NestedFolderTeaserView.java

/**
 * Creates a {@link FolderHolder}./*from www . j a  v  a 2  s .c o  m*/
 */
private FolderHolder createFolderHolder(final CharSequence folderName) {
    final View itemView = mInflater.inflate(R.layout.folder_teaser_item, mNestedFolderContainer,
            false /* attachToRoot */);

    ((TextView) itemView.findViewById(R.id.folder_textView)).setText(folderName);
    final TextView sendersTextView = (TextView) itemView.findViewById(R.id.senders_textView);
    final TextView countTextView = (TextView) itemView.findViewById(R.id.unread_count_textView);
    final ImageView folderIconImageView = (ImageView) itemView.findViewById(R.id.nested_folder_icon);
    final FolderHolder holder = new FolderHolder(itemView, sendersTextView, countTextView, folderIconImageView);
    countTextView.setVisibility(View.VISIBLE);
    attachOnClickListener(itemView, holder);

    return holder;
}

From source file:com.google.android.apps.authenticator.backup.BackupActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.backup);/*  www  .  j a v  a  2 s . com*/

    TextView backupText = (TextView) findViewById(R.id.backup_text);
    backupText.setText(getString(R.string.backup_text, BACKUP_FILE_STRING));

    TextView restoreText = (TextView) findViewById(R.id.restore_text);
    restoreText.setText(getString(R.string.restore_text, BACKUP_FILE_STRING));

    Button backupButton = (Button) findViewById(R.id.backup);
    backupButton.setOnClickListener(this);

    Button restoreButton = (Button) findViewById(R.id.restore);
    restoreButton.setOnClickListener(this);

    // hide backup instructions if the account database is empty
    ArrayList<String> accountNames = new ArrayList<String>();
    DependencyInjector.getAccountDb().getNames(accountNames);
    if (accountNames.size() < 1) {
        backupText.setVisibility(View.GONE);
        backupButton.setVisibility(View.GONE);
    }
}

From source file:com.dvn.vindecoder.ui.seller.GetAllVehicalSellerDetails.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //  setContentView(R.layout.activity_get_all_vehical_details);
    // Watch for button clicks.
    /* Button button = (Button)findViewById(R.id.new_fragment);
            //from  w w  w .ja v a 2  s. c  o m
     button.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {
        addFragmentToStack();
    }
     });*/
    setTitle("Vehical details");
    Bundle bundle = getIntent().getExtras();
    if (bundle != null) {
        v_id = bundle.getString("v_id");
        CommonURL.V_ID = v_id;
        CommonURL.PK_ID = v_id;
        if (bundle.containsKey("user_type")) {
            CommonURL.USER_TYPE = bundle.getInt("user_type");
            ;
        }
    }
    drawChildLayout();
    if (savedInstanceState == null) {
        // Do first time initialization -- add initial fragment.
        newFragment = GetNewVehicalFragment.newInstance(GetAllVehicalSellerDetails.this);
        FragmentTransaction ft = getFragmentManager().beginTransaction();
        ft.add(R.id.fragment1, newFragment).commit();
    } else {
        mStackLevel = savedInstanceState.getInt("level");
    }

    fab = (FloatingActionButton) findViewById(R.id.fab);
    TextView fab_txt = (TextView) findViewById(R.id.textView12);
    if (CommonURL.USER_TYPE == 1) {

        fab.setVisibility(View.GONE);
        fab_txt.setVisibility(View.GONE);
    }
    fab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            //handleCameraForPickingPhoto();
            openDialog();
        }
    });

}

From source file:com.manning.androidhacks.hack017.CreateAccountAdapter.java

private TextView createErrorView(String key) {
    TextView ret = new TextView(mContext);
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,
            LayoutParams.WRAP_CONTENT);/*from w  w w. j  ava  2s. c  o m*/
    params.topMargin = 10;
    params.bottomMargin = 10;
    ret.setLayoutParams(params);
    ret.setTextColor(Color.RED);
    ret.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10);

    HashMap<String, String> errors = mAccount.getErrors();
    if (errors != null && errors.containsKey(key)) {
        ret.setText(errors.get(key));
        ret.setVisibility(View.VISIBLE);
    } else {
        ret.setVisibility(View.INVISIBLE);
    }

    return ret;
}

From source file:android.support.designox.widget.Snackbar.java

/**
 * Set the action to be displayed in this {@link Snackbar}.
 *
 * @param text     Text to display//  w  ww  .ja  v  a  2 s  .  c om
 * @param listener callback to be invoked when the action is clicked
 */
@NonNull
public Snackbar setAction(CharSequence text, final View.OnClickListener listener) {
    final TextView tv = mView.getActionView();

    if (TextUtils.isEmpty(text) || listener == null) {
        tv.setVisibility(View.GONE);
        tv.setOnClickListener(null);
    } else {
        tv.setVisibility(View.VISIBLE);
        tv.setText(text);
        tv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                listener.onClick(view);
                // Now dismiss the Snackbar
                dispatchDismiss(Callback.DISMISS_EVENT_ACTION);
            }
        });
    }
    return this;
}

From source file:com.glanznig.beepme.view.ExportActivity.java

public void startExport(View v) {
    Button start = (Button) findViewById(R.id.export_start_button);
    ProgressBar progress = (ProgressBar) findViewById(R.id.export_progress_bar);
    TextView runningText = (TextView) findViewById(R.id.export_running_text);

    BeeperApp app = (BeeperApp) getApplication();

    if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
        enableDisableView(findViewById(R.id.export_settings), false);

        start.setVisibility(View.GONE);
        progress.setVisibility(View.VISIBLE);
        runningText.setVisibility(View.VISIBLE);

        if (app.getPreferences().exportRunningSince() == 0L || (Calendar.getInstance().getTimeInMillis()
                - app.getPreferences().exportRunningSince()) >= 120000) { //2 min
            app.getPreferences().setExportRunningSince(Calendar.getInstance().getTimeInMillis());
            createExportRunningNotification();
            exportHandler = new ExportHandler(ExportActivity.this);

            Bundle opts = new Bundle();
            opts.putBoolean("photoExport", photoExport);
            opts.putBoolean("rawExport", rawExport);
            new Thread(new ExportRunnable(ExportActivity.this, opts)).start();
        }//from w  w w  .ja va 2  s. c o m
    } else {
        Toast.makeText(ExportActivity.this, R.string.export_storage_error, Toast.LENGTH_SHORT).show();
    }
}

From source file:com.coact.kochzap.CaptureActivity.java

private void handleDecodeInternally(Result rawResult, ResultHandler resultHandler, Bitmap barcode) {

    maybeSetClipboard(resultHandler);//  w  w w  .ja  v a2  s.c  om

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);

    if (resultHandler.getDefaultButtonID() != null
            && prefs.getBoolean(PreferencesActivity.KEY_AUTO_OPEN_WEB, false)) {
        resultHandler.handleButtonPress(resultHandler.getDefaultButtonID());
        return;
    }

    statusView.setVisibility(View.GONE);
    viewfinderView.setVisibility(View.GONE);
    resultView.setVisibility(View.VISIBLE);

    ImageView barcodeImageView = (ImageView) findViewById(R.id.barcode_image_view);
    if (barcode == null) {
        barcodeImageView.setImageBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.launcher_icon));
    } else {
        barcodeImageView.setImageBitmap(barcode);
    }

    TextView formatTextView = (TextView) findViewById(R.id.format_text_view);
    formatTextView.setText(rawResult.getBarcodeFormat().toString());

    TextView typeTextView = (TextView) findViewById(R.id.type_text_view);
    typeTextView.setText(resultHandler.getType().toString());

    DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
    TextView timeTextView = (TextView) findViewById(R.id.time_text_view);
    timeTextView.setText(formatter.format(rawResult.getTimestamp()));

    TextView metaTextView = (TextView) findViewById(R.id.meta_text_view);
    View metaTextViewLabel = findViewById(R.id.meta_text_view_label);
    metaTextView.setVisibility(View.GONE);
    metaTextViewLabel.setVisibility(View.GONE);
    Map<ResultMetadataType, Object> metadata = rawResult.getResultMetadata();
    if (metadata != null) {
        StringBuilder metadataText = new StringBuilder(20);
        for (Map.Entry<ResultMetadataType, Object> entry : metadata.entrySet()) {
            if (DISPLAYABLE_METADATA_TYPES.contains(entry.getKey())) {
                metadataText.append(entry.getValue()).append('\n');
            }
        }
        if (metadataText.length() > 0) {
            metadataText.setLength(metadataText.length() - 1);
            metaTextView.setText(metadataText);
            metaTextView.setVisibility(View.VISIBLE);
            metaTextViewLabel.setVisibility(View.VISIBLE);
        }
    }

    CharSequence displayContents = resultHandler.getDisplayContents();
    TextView contentsTextView = (TextView) findViewById(R.id.contents_text_view);
    contentsTextView.setText(displayContents);
    int scaledSize = Math.max(22, 32 - displayContents.length() / 4);
    contentsTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, scaledSize);

    TextView supplementTextView = (TextView) findViewById(R.id.contents_supplement_text_view);
    supplementTextView.setText("");
    supplementTextView.setOnClickListener(null);
    if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(PreferencesActivity.KEY_SUPPLEMENTAL,
            true)) {
        SupplementalInfoRetriever.maybeInvokeRetrieval(supplementTextView, resultHandler.getResult(),
                historyManager, this);
    }

    int buttonCount = resultHandler.getButtonCount();
    ViewGroup buttonView = (ViewGroup) findViewById(R.id.result_button_view);
    buttonView.requestFocus();
    for (int x = 0; x < ResultHandler.MAX_BUTTON_COUNT; x++) {
        TextView button = (TextView) buttonView.getChildAt(x);
        if (x < buttonCount) {
            button.setVisibility(View.VISIBLE);
            button.setText(resultHandler.getButtonText(x));
            button.setOnClickListener(new ResultButtonListener(resultHandler, x));
        } else {
            button.setVisibility(View.GONE);
        }
    }

}

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

public void setHideTitle(boolean value) {
    hideTitle = value;/*  w w  w.  j a  v  a2 s .co m*/
    TextView groupTitle = (TextView) findViewById(R.id.appwidget_location_grouptitle);
    groupTitle.setVisibility((hideTitle ? View.GONE : View.VISIBLE));
}

From source file:com.concentricsky.android.khanacademy.app.VideoListActivity.java

private void setParentTopic(Topic topic) {
    this.topic = topic;

    if (topic != null) {
        topicId = topic.getId();// www.  j  ava 2 s.c  o m

        // header
        ((TextView) headerView.findViewById(R.id.header_video_list_title)).setText(topic.getTitle());

        String desc = topic.getDescription();
        TextView descView = (TextView) headerView.findViewById(R.id.header_video_list_description);
        if (desc != null && desc.length() > 0) {
            descView.setText(Html.fromHtml(desc).toString());
            descView.setVisibility(View.VISIBLE);
            descView.setMovementMethod(new ScrollingMovementMethod());
        } else {
            descView.setVisibility(View.GONE);
        }

        final ImageView thumb = (ImageView) headerView.findViewById(R.id.header_video_list_thumbnail);
        if (thumb != null) {
            new AsyncTask<Void, Void, Bitmap>() {
                @Override
                public Bitmap doInBackground(Void... arg) {
                    Bitmap bmp = thumbnailManager.getThumbnail(VideoListActivity.this.topic.getThumb_id(),
                            Thumbnail.QUALITY_SD);
                    return bmp;
                }

                @Override
                public void onPostExecute(Bitmap bmp) {
                    thumb.setImageBitmap(bmp);
                }
            }.execute();
        }

        String countFormat;
        int param;
        if (isShowingDownloadedVideosOnly()) {
            countFormat = getString(R.string.format_downloaded_count);
            param = dataService.getOfflineVideoManager().getDownloadCountForTopic(dataService.getHelper(),
                    topicId, 1);
        } else {
            countFormat = getString(R.string.format_video_count);
            param = topic.getVideo_count();
        }
        ((TextView) headerView.findViewById(R.id.header_video_list_count))
                .setText(String.format(countFormat, param));

        listView.setAdapter(new VideoAdapter(this));
        resetListContents(topic.getId());
    }
}