Example usage for android.view View setVisibility

List of usage examples for android.view View setVisibility

Introduction

In this page you can find the example usage for android.view View setVisibility.

Prototype

@RemotableViewMethod
public void setVisibility(@Visibility int visibility) 

Source Link

Document

Set the visibility state of this view.

Usage

From source file:br.com.viniciuscr.notification2android.mediaPlayer.MusicUtils.java

static void updateNowPlaying(Activity a) {
    View nowPlayingView = a.findViewById(R.id.nowplaying);
    if (nowPlayingView == null) {
        return;/*from   w ww.j a v a  2s  . c  om*/
    }
    boolean withtabs = false;
    Intent intent = a.getIntent();
    if (intent != null) {
        withtabs = intent.getBooleanExtra("withtabs", false);
    }
    //tinha um true == Music...
    if (MusicUtils.sService != null && MusicUtils.sService.getAudioId() != -1) {
        TextView title = (TextView) nowPlayingView.findViewById(R.id.title);
        TextView artist = (TextView) nowPlayingView.findViewById(R.id.artist);
        title.setText(MusicUtils.sService.getTrackName());
        String artistName = MusicUtils.sService.getArtistName();
        if (MediaStore.UNKNOWN_STRING.equals(artistName)) {
            artistName = a.getString(R.string.unknown_artist_name);
        }
        artist.setText(artistName);
        //mNowPlayingView.setOnFocusChangeListener(mFocuser);
        //mNowPlayingView.setOnClickListener(this);
        nowPlayingView.setVisibility(View.VISIBLE);
        nowPlayingView.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {
                // Context c = v.getContext();
                // c.startActivity(new Intent(c, MediaPlaybackActivity.class));
            }
        });
        return;
    }
    nowPlayingView.setVisibility(View.GONE);
}

From source file:com.pitchedapps.primenumbercalculator.Calculator.java

License:asdf

void enterReveal(View view) {
    // previously invisible view
    final View myView = view;

    // get the final radius for the clipping circle
    int finalRadius = Math.max(myView.getWidth(), myView.getHeight());

    // create the animator for this view (the start radius is zero)
    Animator anim = ViewAnimationUtils.createCircularReveal(myView, x, y, 0, finalRadius).setDuration(600);

    // make the view visible and start the animation
    myView.setVisibility(View.VISIBLE);
    anim.start();/*w ww  .  j  a v  a  2  s.  co  m*/
}

From source file:co.ceryle.radiorealbutton.library.RadioRealButtonGroup.java

private void animateSelectorSliding(int toPosition, String property, boolean hasAnimation,
        boolean enableDeselection) {
    boolean isViewDrawn = buttons.size() > 0 && buttons.get(0).getWidth() > 0;
    if (!isViewDrawn) {
        if (initialPosition != -1)
            v_selectors.get(initialPosition).setVisibility(INVISIBLE);
        v_selectors.get(toPosition).setVisibility(VISIBLE);
        initialPosition = toPosition;/* w w w  . j ava  2 s .c  om*/
        return;
    }

    if (initialPosition < 0) {
        initialPosition = 0;

        View view = v_selectors.get(initialPosition);
        view.setTranslationX(-buttons.get(initialPosition).getWidth());
        view.setVisibility(VISIBLE);
    }

    if (enableDeselection && toPosition == lastPosition && buttons.get(toPosition).isChecked()) {
        toPosition = lastPosition > numberOfButtons / 2 ? numberOfButtons : -1;
    }

    float position = toPosition - initialPosition;

    float value = buttons.get(initialPosition).getWidth() * position + dividerSize * position;
    ObjectAnimator animator = createAnimator(v_selectors.get(initialPosition), property, value, false,
            hasAnimation);
    animator.start();
}

From source file:android.support.v17.leanback.app.PlaybackSupportFragment.java

/**
 * Show or hide other rows other than PlaybackRow.
 * @param inSeek True to make other rows visible, false to make other rows invisible.
 *//*from w  ww. j  a v  a  2s .  c  o  m*/
void setSeekMode(boolean inSeek) {
    if (mInSeek == inSeek) {
        return;
    }
    mInSeek = inSeek;
    getVerticalGridView().setSelectedPosition(0);
    if (mInSeek) {
        stopFadeTimer();
    }
    // immediately fade in control row.
    showControlsOverlay(true);
    final int count = getVerticalGridView().getChildCount();
    for (int i = 0; i < count; i++) {
        View view = getVerticalGridView().getChildAt(i);
        if (getVerticalGridView().getChildAdapterPosition(view) > 0) {
            view.setVisibility(mInSeek ? View.INVISIBLE : View.VISIBLE);
        }
    }
}

From source file:ca.mymenuapp.ui.widgets.SlidingUpPanelLayout.java

void setAllChildrenVisible() {
    for (int i = 0, childCount = getChildCount(); i < childCount; i++) {
        final View child = getChildAt(i);
        if (child.getVisibility() == INVISIBLE) {
            child.setVisibility(VISIBLE);
        }//from   ww  w . ja  va  2 s . co m
    }
}

From source file:com.orbar.pxdemo.ImageView.FivePXImageFragment.java

private void loadImageDetails(View rootView) {

    TextView ratingContent = (TextView) rootView.findViewById(R.id.rating);
    ratingContent.setText("" + (mFiveZeroZeroImageBean.getRating()));

    TextView highestRatingContent = (TextView) rootView.findViewById(R.id.highest_rating);
    highestRatingContent.setText("" + mFiveZeroZeroImageBean.getHighestRating());

    TextView viewsContent = (TextView) rootView.findViewById(R.id.views);
    viewsContent.setText(Integer.toString(mFiveZeroZeroImageBean.getTimesViewed()));

    TextView descriptionContent = (TextView) rootView.findViewById(R.id.description);
    descriptionContent.setText(mFiveZeroZeroImageBean.getDescription());

    TextView cameraContent = (TextView) rootView.findViewById(R.id.camera_content);
    cameraContent.setText(mFiveZeroZeroImageBean.getCamera());

    TextView focalLengthContent = (TextView) rootView.findViewById(R.id.focal_length_content);
    focalLengthContent.setText(mFiveZeroZeroImageBean.getFocalLength());

    TextView shutterSpeedContent = (TextView) rootView.findViewById(R.id.shutter_speed_content);
    shutterSpeedContent.setText(mFiveZeroZeroImageBean.getShutterSpeed());

    TextView isoContent = (TextView) rootView.findViewById(R.id.iso_content);
    isoContent.setText(mFiveZeroZeroImageBean.getIso());

    TextView categotyContent = (TextView) rootView.findViewById(R.id.category_content);
    categotyContent.setText(Category.forValue(mFiveZeroZeroImageBean.getCategory()).toString());

    TextView apertureContent = (TextView) rootView.findViewById(R.id.aperture_content);
    apertureContent.setText(mFiveZeroZeroImageBean.getAperture());

    TextView uploadedAtContent = (TextView) rootView.findViewById(R.id.uploaded_content);
    uploadedAtContent.setText(mFiveZeroZeroImageBean.getCreatedAt());

    TextView takenAtoContent = (TextView) rootView.findViewById(R.id.taken_content);
    takenAtoContent.setText(mFiveZeroZeroImageBean.getTakenAt());

    TextView licenseContent = (TextView) rootView.findViewById(R.id.license_content);
    licenseContent.setText(License.forValue(mFiveZeroZeroImageBean.getLicenseType()).toString());

    TextView locationContent = (TextView) rootView.findViewById(R.id.location_content);
    if (mFiveZeroZeroImageBean.getLocation() != null) {
        locationContent.setText(mFiveZeroZeroImageBean.getLocation());
    } else {/*w w  w. j  ava2  s.c  o  m*/
        locationContent.setText(null);
        locationContent.setVisibility(View.GONE);
    }

    if (mFiveZeroZeroImageBean.getLatitude() != null && mFiveZeroZeroImageBean.getLatitude() != null) {

        setupMap(mFiveZeroZeroImageBean.getLatitude(), mFiveZeroZeroImageBean.getLongitude(),
                mFiveZeroZeroImageBean.getName(), mFiveZeroZeroImageBean.getDescription());
    } else {
        View mapView = rootView.findViewById(R.id.map);
        mapView.setVisibility(View.GONE);
    }

    // when logged in - highlight images that are "Liked" (voted)
    if (mFiveZeroZeroImageBean.isVoted()) {
        imageLikes.setBackgroundResource(R.drawable.ic_background_like);
    } else {
        imageLikes.setBackgroundResource(R.drawable.ic_background);
    }

    // when logged in - highlight images that are "favorited"
    if (mFiveZeroZeroImageBean.isFavorited()) {
        imageFavorites.setBackgroundResource(R.drawable.ic_background_fav);
    } else {
        imageFavorites.setBackgroundResource(R.drawable.ic_background);
    }

}

From source file:com.hivewallet.androidclient.wallet.ui.WalletActivity.java

private void prepareImportKeysDialog(final Dialog dialog) {
    final AlertDialog alertDialog = (AlertDialog) dialog;

    final List<File> files = new LinkedList<File>();

    // result of ACTION_PICk
    File selectedExternalWalletBackup = new File(getFilesDir(), Constants.Files.EXTERNAL_WALLET_TMP_FILE);
    if (selectedExternalWalletBackup.exists())
        files.add(selectedExternalWalletBackup);

    // local copies of external backups
    File externalWalletBackupDir = new File(getFilesDir(), Constants.Files.EXTERNAL_WALLET_BACKUP_DIR);
    if (externalWalletBackupDir.exists() && externalWalletBackupDir.isDirectory())
        for (final File file : externalWalletBackupDir.listFiles())
            if (WalletUtils.BACKUP_FILE_FILTER.accept(file) || WalletUtils.KEYS_FILE_FILTER.accept(file)
                    || Crypto.OPENSSL_FILE_FILTER.accept(file))
                files.add(file);//from   w  w  w  .j a v a  2 s . c o  m

    // internal storage
    for (final String filename : fileList())
        if (filename.startsWith(Constants.Files.WALLET_KEY_BACKUP_PROTOBUF + '.'))
            files.add(new File(getFilesDir(), filename));

    // sort
    Collections.sort(files, new Comparator<File>() {
        @Override
        public int compare(final File lhs, final File rhs) {
            return lhs.getName().compareToIgnoreCase(rhs.getName());
        }
    });

    final View replaceWarningView = alertDialog
            .findViewById(R.id.restore_wallet_from_storage_dialog_replace_warning);
    final boolean hasCoins = wallet.getBalance(BalanceType.ESTIMATED).signum() > 0;
    replaceWarningView.setVisibility(hasCoins ? View.VISIBLE : View.GONE);

    final Spinner fileView = (Spinner) alertDialog.findViewById(R.id.import_keys_from_storage_file);
    final FileAdapter adapter = (FileAdapter) fileView.getAdapter();
    adapter.setFiles(files);
    fileView.setEnabled(!adapter.isEmpty());

    final EditText passwordView = (EditText) alertDialog.findViewById(R.id.import_keys_from_storage_password);
    passwordView.setText(null);

    final ImportDialogButtonEnablerListener dialogButtonEnabler = new ImportDialogButtonEnablerListener(
            passwordView, alertDialog) {
        @Override
        protected boolean hasFile() {
            return fileView.getSelectedItem() != null;
        }

        @Override
        protected boolean needsPassword() {
            final File selectedFile = (File) fileView.getSelectedItem();
            return selectedFile != null ? Crypto.OPENSSL_FILE_FILTER.accept(selectedFile) : false;
        }
    };
    passwordView.addTextChangedListener(dialogButtonEnabler);
    fileView.setOnItemSelectedListener(dialogButtonEnabler);

    final CheckBox showView = (CheckBox) alertDialog.findViewById(R.id.import_keys_from_storage_show);
    showView.setOnCheckedChangeListener(new ShowPasswordCheckListener(passwordView));
}

From source file:org.mifos.androidclient.main.CustomerChargesDetailsActivity.java

private void updateContent(CustomerChargesDetails details) {
    mDetails = details;//www . ja va2 s. c o  m
    TextView textView;
    TableLayout table;
    TableRow row;
    View disabledView;
    TableLayoutHelper helper = new TableLayoutHelper(this);

    textView = (TextView) findViewById(R.id.customerChargesDetails_amountDue);
    textView.setText(details.getNextDueAmount().toString());
    textView = (TextView) findViewById(R.id.customerChargesDetails_amountOverdue);
    textView.setText(details.getTotalAmountInArrears().toString());
    textView = (TextView) findViewById(R.id.customerChargesDetails_total);
    textView.setText(details.getTotalAmountDue().toString());

    if (details.getUpcomingInstallment() != null
            && (ValueUtils.hasValue(details.getUpcomingInstallment().getMiscFee())
                    || ValueUtils.hasValue(details.getUpcomingInstallment().getMiscPenalty())
                    || ValueUtils.hasElements(details.getUpcomingInstallment().getFeesActionDetails()))) {

        disabledView = findViewById(R.id.customerChargesDetails_upcomingCharges_label);
        disabledView.setVisibility(View.VISIBLE);
        disabledView = findViewById(R.id.customerChargesDetails_upcomingCharges_scrollView);
        disabledView.setVisibility(View.VISIBLE);

        table = (TableLayout) findViewById(R.id.customerChargesDetails_upcomingCharges_table);

        if (ValueUtils.hasValue(details.getUpcomingInstallment().getMiscFee())) {
            row = helper.createTableRow();
            textView = helper.createTableCell(getString(R.string.customerChargesDetails_miscFee_label), 1);
            row.addView(textView);
            textView = helper.createTableCell(details.getUpcomingInstallment().getMiscFee().toString(), 2);
            row.addView(textView);
            table.addView(row);
            table.addView(helper.createRowSeparator());
        }

        if (ValueUtils.hasValue(details.getUpcomingInstallment().getMiscPenalty())) {
            row = helper.createTableRow();
            textView = helper.createTableCell(getString(R.string.customerChargesDetails_miscPenalty_label), 1);
            row.addView(textView);
            textView = helper.createTableCell(details.getUpcomingInstallment().getMiscPenalty().toString(), 2);
            row.addView(textView);
            table.addView(row);
            table.addView(helper.createRowSeparator());
        }

        if (ValueUtils.hasElements(details.getUpcomingInstallment().getFeesActionDetails())) {
            for (AccountFeeSchedule fee : details.getUpcomingInstallment().getFeesActionDetails()) {
                row = helper.createTableRow();
                textView = helper.createTableCell(fee.getFeeName(), 1);
                row.addView(textView);
                textView = helper.createTableCell(fee.getFeeAmount().toString(), 2);
                row.addView(textView);
                table.addView(row);
                table.addView(helper.createRowSeparator());
            }
        }
    }

    if (ValueUtils.hasElements(details.getRecentActivities())) {
        disabledView = findViewById(R.id.customerChargesDetails_recentAccountActivity_label);
        disabledView.setVisibility(View.VISIBLE);
        disabledView = findViewById(R.id.customerChargesDetails_recentAccountActivity_scrollView);
        disabledView.setVisibility(View.VISIBLE);

        table = (TableLayout) findViewById(R.id.customerChargesDetails_recentAccountActivity_table);

        for (CustomerRecentActivity activity : details.getRecentActivities()) {
            row = helper.createTableRow();
            textView = helper.createTableCell(DateUtils.format(activity.getActivityDate()), 1);
            row.addView(textView);
            textView = helper.createTableCell(activity.getDescription(), 2);
            row.addView(textView);
            textView = helper.createTableCell(activity.getAmount(), 3);
            row.addView(textView);
            textView = helper.createTableCell(activity.getPostedBy(), 4);
            row.addView(textView);
            table.addView(row);
            table.addView(helper.createRowSeparator());
        }
    }

    if (ValueUtils.hasElements(details.getAccountFees())) {
        boolean hasRecurring = false;
        List<AccountFee> recurringFees = new ArrayList<AccountFee>();
        for (AccountFee fee : details.getAccountFees()) {
            if (fee.getMeetingRecurrence() != null) {
                hasRecurring = true;
                recurringFees.add(fee);
            }
        }
        if (hasRecurring) {
            disabledView = findViewById(R.id.customerChargesDetails_recurringAccountFees_label);
            disabledView.setVisibility(View.VISIBLE);
            disabledView = findViewById(R.id.customerChargesDetails_recurringAccountFees_scrollView);
            disabledView.setVisibility(View.VISIBLE);

            table = (TableLayout) findViewById(R.id.customerChargesDetails_recurringAccountFees_table);

            for (AccountFee fee : recurringFees) {
                row = helper.createTableRow();
                textView = helper.createTableCell(fee.getFeeName(), 1);
                row.addView(textView);
                textView = helper.createTableCell(fee.getAccountFeeAmount().toString(), 2);
                row.addView(textView);
                textView = helper.createTableCell(fee.getMeetingRecurrence(), 2);
                row.addView(textView);
                table.addView(row);
                table.addView(helper.createRowSeparator());
            }
        }
    }

}

From source file:com.xgf.inspection.qrcode.google.zxing.client.CaptureActivity.java

private void handleDecodeInternally(Result rawResult, ResultHandler resultHandler, Bitmap barcode) {
    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.qr_scan));
    } else {/*from w ww .ja  v a  2 s . c o m*/
        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);
    String formattedTime = formatter.format(new Date(rawResult.getTimestamp()));
    TextView timeTextView = (TextView) findViewById(R.id.time_text_view);
    timeTextView.setText(formattedTime);

    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);
        }
    }

    TextView contentsTextView = (TextView) findViewById(R.id.contents_text_view);
    CharSequence displayContents = resultHandler.getDisplayContents();
    contentsTextView.setText(displayContents);
    // Crudely scale betweeen 22 and 32 -- bigger font for shorter text
    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);
        }
    }

    if (copyToClipboard && !resultHandler.areContentsSecure()) {
        ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
        if (displayContents != null) {
            clipboard.setText(displayContents);
        }
    }
}

From source file:at.alladin.rmbt.android.main.RMBTMainMenuFragment.java

public void setViewVisibility(View view, int visibility) {
    if (view != null && view.getVisibility() != visibility) {
        view.setVisibility(visibility);
    }/*from  ww w. jav a2 s .co  m*/
}