Example usage for android.view View INVISIBLE

List of usage examples for android.view View INVISIBLE

Introduction

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

Prototype

int INVISIBLE

To view the source code for android.view View INVISIBLE.

Click Source Link

Document

This view is invisible, but it still takes up space for layout purposes.

Usage

From source file:hr.foicore.varazdinlandmarksdemo.POIMapActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {

    int id = item.getItemId();
    if (id == R.id.action_view_as_grid) {
        Intent i = new Intent(POIMapActivity.this, POIGridActivity.class);

        i.putExtra("playOn", mActionPlay);

        i.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        // finish();
        overridePendingTransition(0, 0);

        startActivityForResult(i, 1);/*  ww  w . j  a v a  2  s . c  o m*/
        overridePendingTransition(0, 0);

    } else if (id == R.id.action_directions) {

        if (mActionDirections == 1) { // cancel directions action
            item.setIcon(R.drawable.ic_action_directions);
            mActionDirections = 0;
            tvMapDirectionsInfo.setVisibility(View.INVISIBLE);
            if (mRoute != null) {
                mRoute.remove();
            }
        } else if (mActionDirections == 0) { // set directions action on

            item.setIcon(R.drawable.ic_action_directions_pressed);
            mActionDirections = 1;

            gmm.handleMapWarningMessages(POIMapActivity.this, tvMapMessage);
            if (gmm.myLocationEnabled && gmm.internetEnabled) {
                Toast.makeText(POIMapActivity.this,
                        POIMapActivity.this.getResources().getString(R.string.tap_route_destination),
                        Toast.LENGTH_SHORT).show();

            } else {
                tvMapMessage.setBackgroundColor(
                        POIMapActivity.this.getResources().getColor(R.color.red_transparent));

                item.setIcon(R.drawable.ic_action_directions);
                mActionDirections = 0;
                tvMapDirectionsInfo.setVisibility(View.INVISIBLE);

            }
        } else { // mActionDirections == 3
            item.setIcon(R.drawable.ic_action_directions);
            mActionDirections = 0;
            tvMapDirectionsInfo.setVisibility(View.INVISIBLE);
            if (mRoute != null) {
                mRoute.remove();
            }
        }

    } else if (id == R.id.action_play) {

        if (mActionPlay) { // cancel play mode
            gmm.addAllMarkers(POIMapActivity.this);
            item.setIcon(R.drawable.ic_action_play);
            mActionPlay = false;

            miDirections.setIcon(R.drawable.ic_action_directions);
            mActionDirections = 0;
            tvMapDirectionsInfo.setVisibility(View.INVISIBLE);
            if (mRoute != null) {
                mRoute.remove();
            }
        } else {
            gmm.addPlayMarkers(POIMapActivity.this);
            item.setIcon(R.drawable.ic_action_pause_red);
            if (gmm.activePOIMarker != null) {
                drawUserDestRoute(gmm.activePOIMarker.getPosition());
            }
            mActionPlay = true;

        }

    } else if (id == R.id.action_google_map_type) {
        // get google map type names
        String[] googleMapTypeNames = getResources().getStringArray(R.array.google_map_type_names);

        // creating and Building the Dialog
        AlertDialog.Builder builderMapType = new AlertDialog.Builder(this);
        builderMapType.setTitle(getResources().getString(R.string.action_google_map_type));
        builderMapType.setSingleChoiceItems(googleMapTypeNames, selectedMapType,
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int item) {

                        if (item != selectedMapType) {
                            switchGoogleMapType(item);
                            // save selected type in settings
                            SharedPreferences preferences = PreferenceManager
                                    .getDefaultSharedPreferences(POIMapActivity.this);
                            SharedPreferences.Editor editor = preferences.edit();
                            editor.putString("googleMapType", String.valueOf(item));
                            editor.commit();
                        }
                        mapTypeDialog.dismiss();
                    }
                });
        mapTypeDialog = builderMapType.create();
        mapTypeDialog.show();

    } else if (id == R.id.action_legal_notices) {

        String licenseInfo = GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getApplicationContext());
        AlertDialog.Builder licenseDialog = new AlertDialog.Builder(POIMapActivity.this);
        licenseDialog.setTitle(getString(R.string.action_legal_notices));
        licenseDialog.setMessage(licenseInfo);
        licenseDialog.show();

    } else if (id == R.id.action_scan_qr_code) {

        handleQRcodeScanRequest();

    } else if (id == R.id.action_about) {
        String about = getString(R.string.about_application);
        AlertDialog alertDialog;
        alertDialog = new AlertDialog.Builder(POIMapActivity.this).create();

        alertDialog.setTitle(getString(R.string.action_about));
        alertDialog.setMessage(Html.fromHtml(about));

        alertDialog.setButton(Dialog.BUTTON_NEGATIVE, getString(R.string.ok),
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                    }
                });
        alertDialog.show();
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.facebook.android.GraphExplorer.java

public void setText(final String txt) {
    mHandler.post(new Runnable() {

        /*/*from   w  w w  .  jav  a 2 s .  c om*/
         * A transform filter that simply returns just the text captured by
         * the first regular expression group.
         */
        TransformFilter idFilter = new TransformFilter() {
            @Override
            public final String transformUrl(final Matcher match, String url) {
                return match.group(1);
            }
        };

        @Override
        public void run() {
            mViewURLButton.setVisibility(TextUtils.isEmpty(txt) ? View.INVISIBLE : View.VISIBLE);
            mFieldsConnectionsButton.setVisibility(TextUtils.isEmpty(txt) ? View.INVISIBLE : View.VISIBLE);
            mOutput.setVisibility(TextUtils.isEmpty(txt) ? View.INVISIBLE : View.VISIBLE);
            mBackParentButton.setVisibility(TextUtils.isEmpty(mParentObjectId) ? View.INVISIBLE : View.VISIBLE);

            String convertedTxt = txt.replace("\\/", "/");
            mOutput.setText(convertedTxt);
            mScrollView.scrollTo(0, 0);

            Linkify.addLinks(mOutput, Linkify.WEB_URLS);
            /*
             * Linkify the object ids so they can be clicked. match pattern:
             * "id" : "objectid" (objectid can be int or int_int)
             */
            Pattern pattern = Pattern.compile("\"id\": \"(\\d*_?\\d*)\"");
            String scheme = "fbGraphEx://";
            Linkify.addLinks(mOutput, pattern, scheme, null, idFilter);
        }
    });
}

From source file:mp.paschalis.EditBookActivity.java

/**
 * Fix buttons according to Book Status/*from   ww w.  ja va2 s.  c om*/
 */
private void updateButtons() {
    if (app.selectedBook.status == App.BOOK_STATE_USER_RENTED) {
        buttonLentReturnBook.setText(R.string.isItReturned_);
        buttonLentReturnBook.setEnabled(true);
        buttonDeleteBook.setEnabled(false);
        spinnerEditBookStatus.setVisibility(View.INVISIBLE);
        textViewCheckYourBooks.setVisibility(View.INVISIBLE);
    } else if (app.selectedBook.status == App.BOOK_STATE_USER_AVAILABLE) {
        buttonLentReturnBook.setText(R.string.lent);
        buttonLentReturnBook.setEnabled(true);
        buttonDeleteBook.setEnabled(true);
        spinnerEditBookStatus.setEnabled(true);
        spinnerEditBookStatus.setVisibility(View.VISIBLE);
        textViewCheckYourBooks.setVisibility(View.VISIBLE);
    } else if (app.selectedBook.status == App.BOOK_STATE_USER_NO_RENTAL
            || app.selectedBook.status == App.BOOK_STATE_USER_OTHER) {
        buttonLentReturnBook.setText(R.string.lent);
        buttonLentReturnBook.setEnabled(false);
        buttonDeleteBook.setEnabled(true);
        spinnerEditBookStatus.setEnabled(true);
        spinnerEditBookStatus.setVisibility(View.VISIBLE);
        textViewCheckYourBooks.setVisibility(View.VISIBLE);
    } else {

        buttonLentReturnBook.setText(R.string.lent);
        buttonLentReturnBook.setEnabled(false);
        buttonDeleteBook.setEnabled(false);
        buttonDeleteBook.setText(R.string.deleted);
        spinnerEditBookStatus.setEnabled(false);
        spinnerEditBookStatus.setVisibility(View.INVISIBLE);
        textViewCheckYourBooks.setVisibility(View.INVISIBLE);

        Handler handler = new Handler();
        handler.postDelayed(new Runnable() {

            @Override
            public void run() {

                if (!fromBookSearch) {
                    NavUtils.navigateUpFromSameTask(EditBookActivity.this);
                }
            }
        }, App.DELAY_TWO_SEC);

    }

}

From source file:com.nononsenseapps.filepicker.sample.ftp.FtpPickerFragment.java

/**
 * If we are loading, then hide the list and show the progress bar instead.
 *
 * @param nextPath path to list files for
 *//*from www.  j av  a2  s .c  om*/
@Override
protected void refresh(@NonNull FtpFile nextPath) {
    super.refresh(nextPath);
    if (isLoading) {
        progressBar.setVisibility(View.VISIBLE);
        recyclerView.setVisibility(View.INVISIBLE);
    }
}

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 a  v a  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:com.moonpi.swiftnotes.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Get lobster_two asset and create typeface
    // Set action bar title to lobster_two typeface
    lobsterTwo = Typeface.createFromAsset(getAssets(), "lobster_two.otf");

    actionBarTitle = Resources.getSystem().getIdentifier("action_bar_title", "id", "android");

    TextView actionBarTitleView = null;/*from  w ww.  ja v  a  2s . com*/
    if (actionBarTitle != 0)
        actionBarTitleView = (TextView) getWindow().findViewById(actionBarTitle);

    if (actionBarTitleView != null) {
        if (lobsterTwo != null)
            actionBarTitleView.setTypeface(lobsterTwo);
    }

    readFromJSON();
    writeToJSON();
    readFromJSON();

    File folder = new File(Environment.getExternalStorageDirectory() + "/Swiftnotes");
    File backupFile = new File(folder, "swiftnotes_backup.json");

    if (backupFile.exists())
        backupFilePath = backupFile.getAbsolutePath();

    setContentView(R.layout.activity_main);

    listView = (ListView) findViewById(R.id.listView);
    ImageButton newNote = (ImageButton) findViewById(R.id.newNote);
    noNotes = (TextView) findViewById(R.id.noNotes);

    // Initialize NoteAdapter with notes array
    adapter = new NoteAdapter(this, notes);

    registerForContextMenu(listView);

    listView.setAdapter(adapter);
    listView.setOnItemClickListener(this);
    newNote.setOnClickListener(this);

    // If no notes, show 'Press + to add new note' text, invisible otherwise
    if (notes.length() == 0)
        noNotes.setVisibility(View.VISIBLE);
    else
        noNotes.setVisibility(View.INVISIBLE);
}

From source file:de.sourcestream.movieDB.controller.TVDetails.java

/**
 * @param savedInstanceState if the fragment is being re-created from a previous saved state, this is the state.
 *///from w ww .  ja  va  2  s . co m
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    if (save != null) {
        setTitle(save.getString("title"));
        currentId = save.getInt("currentId");
        timeOut = save.getInt("timeOut");
        if (timeOut == 0) {
            spinner.setVisibility(View.GONE);
            onOrientationChange(save);
        }
    }

    if (currentId != this.getArguments().getInt("id") || this.timeOut == 1) {
        currentId = this.getArguments().getInt("id");
        moreIcon.setVisibility(View.INVISIBLE);
        mSlidingTabLayout.setVisibility(View.INVISIBLE);
        mViewPager.setVisibility(View.INVISIBLE);
        spinner.setVisibility(View.VISIBLE);

        request = new JSONAsyncTask();
        new Thread(new Runnable() {
            public void run() {
                try {
                    request.execute(MovieDB.url + "tv/" + currentId
                            + "?append_to_response=images,credits,similar&api_key=" + MovieDB.key)
                            .get(10000, TimeUnit.MILLISECONDS);
                } catch (TimeoutException | ExecutionException | InterruptedException
                        | CancellationException e) {
                    request.cancel(true);
                    // we abort the http request, else it will cause problems and slow connection later
                    if (conn != null)
                        conn.disconnect();
                    if (spinner != null)
                        activity.hideView(spinner);
                    if (mViewPager != null)
                        activity.hideLayout(mViewPager);
                    if (getActivity() != null && !(e instanceof CancellationException)) {
                        getActivity().runOnUiThread(new Runnable() {
                            public void run() {
                                Toast.makeText(getActivity(), getResources().getString(R.string.timeout),
                                        Toast.LENGTH_SHORT).show();
                            }
                        });
                    }
                    setTimeOut(1);
                }
            }
        }).start();
    }
    activity.setTitle(getTitle());
    activity.setTvDetailsFragment(this);
    if (activity.getSaveInTVDetailsSimFragment()) {
        activity.setSaveInTVDetailsSimFragment(false);
        activity.setTvDetailsSimFragment(this);
    }

    new Handler().post(new Runnable() {
        @Override
        public void run() {
            tvDetailsInfo = (TVDetailsInfo) tvDetailsSlideAdapter.getRegisteredFragment(0);
            tvDetailsCast = (TVDetailsCast) tvDetailsSlideAdapter.getRegisteredFragment(1);
            tvDetailsOverview = (TVDetailsOverview) tvDetailsSlideAdapter.getRegisteredFragment(2);
        }
    });

    showInstantToolbar();

    iconMarginConstant = activity.getIconMarginConstant();
    iconMarginLandscape = activity.getIconMarginLandscape();
    iconConstantSpecialCase = activity.getIconConstantSpecialCase();
    twoIcons = activity.getTwoIcons();
    twoIconsToolbar = activity.getTwoIconsToolbar();
    oneIcon = activity.getOneIcon();
    oneIconToolbar = activity.getOneIconToolbar();

    Tracker t = ((MovieDB) activity.getApplication()).getTracker();
    t.setScreenName("TVDetails - " + getTitle());
    t.send(new HitBuilders.ScreenViewBuilder().build());
}

From source file:de.sourcestream.movieDB.controller.CastDetails.java

/**
 * @param savedInstanceState if the fragment is being re-created from a previous saved state, this is the state.
 */// w  w  w .j  av  a  2 s.  c om
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    if (save != null) {
        setTitle(save.getString("title"));
        currentId = save.getInt("currentId");
        timeOut = save.getInt("timeOut");
        if (timeOut == 0) {
            spinner.setVisibility(View.GONE);
            onOrientationChange(save);
        }
    }

    if (currentId != this.getArguments().getInt("id") || this.timeOut == 1) {
        currentId = this.getArguments().getInt("id");
        moreIcon.setVisibility(View.INVISIBLE);
        mSlidingTabLayout.setVisibility(View.INVISIBLE);
        mViewPager.setVisibility(View.INVISIBLE);
        spinner.setVisibility(View.VISIBLE);

        request = new JSONAsyncTask();
        new Thread(new Runnable() {
            public void run() {
                try {
                    request.execute(MovieDB.url + "person/" + currentId
                            + "?append_to_response=combined_credits%2Cimages&api_key=" + MovieDB.key)
                            .get(10000, TimeUnit.MILLISECONDS);
                } catch (TimeoutException | ExecutionException | InterruptedException
                        | CancellationException e) {
                    request.cancel(true);
                    // we abort the http request, else it will cause problems and slow connection later
                    if (conn != null)
                        conn.disconnect();
                    if (spinner != null)
                        activity.hideView(spinner);
                    if (getActivity() != null && !(e instanceof CancellationException)) {
                        getActivity().runOnUiThread(new Runnable() {
                            public void run() {
                                Toast.makeText(getActivity(), getResources().getString(R.string.timeout),
                                        Toast.LENGTH_SHORT).show();
                            }
                        });
                    }
                    setTimeOut(1);
                }
            }
        }).start();
    }

    activity.setTitle(getTitle());
    activity.setCastDetailsFragment(this);

    new Handler().post(new Runnable() {
        @Override
        public void run() {
            castDetailsInfo = (CastDetailsInfo) castDetailsSlideAdapter.getRegisteredFragment(0);
            castDetailsCredits = (CastDetailsCredits) castDetailsSlideAdapter.getRegisteredFragment(1);
            castDetailsBiography = (CastDetailsBiography) castDetailsSlideAdapter.getRegisteredFragment(2);
        }
    });

    showInstantToolbar();

    iconMarginConstant = activity.getIconMarginConstant();
    iconMarginLandscape = activity.getIconMarginLandscape();
    iconConstantSpecialCase = activity.getIconConstantSpecialCase();
    twoIcons = activity.getTwoIcons();
    twoIconsToolbar = activity.getTwoIconsToolbar();
    oneIcon = activity.getOneIcon();
    oneIconToolbar = activity.getOneIconToolbar();

    Tracker t = ((MovieDB) activity.getApplication()).getTracker();
    t.setScreenName("CastDetails - " + getTitle());
    t.send(new HitBuilders.ScreenViewBuilder().build());
}

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

/**
 * Utility method to download an icon from a url and set
 * it to the GUI element R.id.origin_icon.
 * It is used both in the shortcut dialog and the
 * permission dialog.//from w w  w .jav  a  2s .c o m
 * The actual download is done in the background via
 * IconDownload; once the icon is downlowded the UI is updated
 * via updateIcon().
 * The icon size is included in the layout with the choosen
 * size, although not displayed, to limit text reflow once
 * the icon is received.
 */
void downloadIcon(String url) {
    if (url == null) {
        return;
    }
    View view = findViewById(R.id.origin_icon);
    if (view != null) {
        view.setMinimumWidth(mChoosenIconSize);
        view.setMinimumHeight(mChoosenIconSize);
        view.setVisibility(View.INVISIBLE);
    }
    Thread thread = new Thread(new IconDownload(url));
    thread.start();
}

From source file:com.nononsenseapps.filepicker.sample.ftp.FtpPickerFragment.java

@Override
public void onLoadFinished(Loader<SortedList<FtpFile>> loader, SortedList<FtpFile> data) {
    progressBar.setVisibility(View.INVISIBLE);
    recyclerView.setVisibility(View.VISIBLE);
    super.onLoadFinished(loader, data);
}