Example usage for android.view View GONE

List of usage examples for android.view View GONE

Introduction

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

Prototype

int GONE

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

Click Source Link

Document

This view is invisible, and it doesn't take any space for layout purposes.

Usage

From source file:com.velia_systems.menuphoto.connection.ImageDownloader.java

/**
 * Download the specified image from the Internet and binds it to the provided ImageView. The
 * binding is immediate if the image is found in the cache and will be done asynchronously
 * otherwise. A null bitmap will be associated to the ImageView if an error occurs.
 *
 * @param url The URL of the image to download.
 * @param imageView The ImageView to bind the downloaded image to.
 *///from  w w  w. j a  va 2  s  .co m
public void download(String url, ImageView imageView, ProgressBar progress) {
    resetPurgeTimer();
    Bitmap bitmap = getBitmapFromCache(url);
    if (bitmap == null) {
        forceDownload(url, imageView, bitmap, progress);
    } else {
        cancelPotentialDownload(url, imageView);
        imageView.setImageBitmap(bitmap);
        progress.setVisibility(View.GONE);
    }
}

From source file:com.developer.album.ActivityPhotoView.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_photoview);

    index_of_album = getIntent().getIntExtra("index_of_album", 0);
    index_of_photo = getIntent().getIntExtra("index_of_photo", 0);

    // Locate the viewpager in activity_main.xml
    mViewPager = (ViewPager) findViewById(R.id.pager);

    // Set the ViewPagerAdapter into ViewPager
    mViewPager.setAdapter(new PhotoPagerAdapter(this));
    mViewPager.setCurrentItem(index_of_photo);
    mControlable = getIntent().getExtras().getBoolean("controlable");

    if (mControlable) {
        ((FrameLayout) findViewById(R.id.framelayout_control_panel)).setVisibility(View.VISIBLE);

        ((ImageButton) findViewById(R.id.imagebutton_remove)).setOnClickListener(new OnClickListener() {
            @Override/*from   w  ww  .java 2  s  . co  m*/
            public void onClick(View v) {
                // TODO Auto-generated method stub
                showAlertDialog();
            }
        });
    } else {
        ((FrameLayout) findViewById(R.id.framelayout_control_panel)).setVisibility(View.GONE);
    }

}

From source file:com.plnyyanks.frcnotebook.datafeed.EventListFetcher.java

@Override
protected void onPostExecute(String result) {
    super.onPostExecute(result);
    //Log.d(Constants.LOG_TAG,"Event Data: "+result.toString());

    //LinearLayout eventList = (LinearLayout) listActivity.findViewById(R.id.event_list_to_download);
    ListView eventList = (ListView) listActivity.findViewById(R.id.event_list_to_download);

    adapter = new ListViewArrayAdapter(listActivity, events, keys);
    eventList.setAdapter(adapter);//  w w w.j  av a  2s . co m
    eventList.setOnItemClickListener(new EventClickListener(keys));

    //hide the progress bar
    ProgressBar prog = (ProgressBar) listActivity.findViewById(R.id.event_loading_progress);
    prog.setVisibility(View.GONE);
}

From source file:com.vrem.wifianalyzer.wifi.AccessPointsDetailTest.java

@Test
public void testSetViewWithWiFiDetailAsConnection() throws Exception {
    // setup//from w  ww  . java2s. c om
    WiFiDetail wiFiDetail = new WiFiDetail("SSID", "BSSID", "capabilities",
            new WiFiSignal(1, WiFiWidth.MHZ_20, 2), new WiFiAdditional("VendorName", "IPAddress", 22));
    // execute
    fixture.setView(mainActivity.getResources(), view, wiFiDetail, false, false);
    // validate
    validateTextViewValues(wiFiDetail, "SSID");

    validateTextViewValue(wiFiDetail.getWiFiAdditional().getIPAddress(), R.id.ipAddress);
    assertEquals(View.VISIBLE, view.findViewById(R.id.ipAddress).getVisibility());

    assertEquals(View.VISIBLE, view.findViewById(R.id.configuredImage).getVisibility());

    validateTextViewValue(
            String.format("%d%s", wiFiDetail.getWiFiAdditional().getLinkSpeed(), WifiInfo.LINK_SPEED_UNITS),
            R.id.linkSpeed);
    assertEquals(View.VISIBLE, view.findViewById(R.id.linkSpeed).getVisibility());

    validateTextViewValue(wiFiDetail.getWiFiAdditional().getVendorName(), R.id.vendor);
    assertEquals(View.VISIBLE, view.findViewById(R.id.vendor).getVisibility());

    assertEquals(View.GONE, view.findViewById(R.id.tab).getVisibility());
    assertEquals(View.GONE, view.findViewById(R.id.groupIndicator).getVisibility());

    assertEquals(View.GONE, view.findViewById(R.id.channel_frequency_range_row).getVisibility());
}

From source file:de.awisus.refugeeaidleipzig.views.signup.FragmentSignup.java

@Override
protected void initElements(View view) {
    super.initElements(view);

    warnungID = R.string.warnung_signup;

    TextView tvUnterkunft;//from   w  ww.  j  a  v  a  2  s  .  com
    tvUnterkunft = (TextView) view.findViewById(R.id.tvUnterkunft);
    spUnterkunft = (Spinner) view.findViewById(R.id.spUnterkunft);

    if (isRefugee) {
        initSpinnerAdapter();
    } else {
        tvUnterkunft.setVisibility(View.GONE);
        spUnterkunft.setVisibility(View.GONE);
    }
}

From source file:com.qiscus.sdk.ui.adapter.viewholder.QiscusBaseButtonMessageViewHolder.java

@Override
protected void showMessage(QiscusComment qiscusComment) {
    super.showMessage(qiscusComment);
    buttonsContainer.removeAllViews();// w  w  w .  ja v a2s .co  m
    try {
        JSONObject payload = QiscusRawDataExtractor.getPayload(qiscusComment);
        setUpButtons(payload.getJSONArray("buttons"));
    } catch (JSONException | NullPointerException e) {
        buttonsContainer.setVisibility(View.GONE);
    }
}

From source file:com.everyplay.android.everyplayrecord.EveryplayRecordActivity.java

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

    // Create a GLSurfaceView instance and set it
    // as the ContentView for this Activity
    mGLView = new EveryplayRecordSurfaceView(this);
    setContentView(mGLView);// ww  w  .j  ava  2s .c om

    buttons = new LinearLayout(this);
    buttons.setOrientation(LinearLayout.VERTICAL);
    if (!USE_EVERYPLAY_AUDIO_BOARD) {
        addButton("Everyplay", "everyplay");
        addButton("Start recording", "rec");
        Button playLastRecording = addButton("Play last recording", "play_last_recording");
        playLastRecording.setVisibility(View.GONE);

        addButton("Test video playback", "test_video_playback");
        addButton("Show sharing modal", "sharing_modal");

        Button hudRecord = addButton("HUD record off", "hud_record");
        hudRecord.setVisibility(View.GONE);

        stream1 = new EveryplayRecordAudioGenerator(5);
        stream1.play();
        streamActive = stream1;
    } else {
        addButton("Play song #1", "play1_a");
        addButton("Unload song #1", "unload1_a");
        addButton("Pause song", "pause_a");
        addButton("Resume song", "resume_a");
        addButton("Rewind song", "rewind_a");
        addButton("Stop song", "stop_a");

        this.addContentView(buttons, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
                LinearLayout.LayoutParams.WRAP_CONTENT));
        buttons = new LinearLayout(this);
        buttons.setOrientation(LinearLayout.VERTICAL);
        buttons.setX(400);

        addButton("Play song #2", "play2_a");
        addButton("Unload song #2", "unload2_a");
        addButton("Effect #1", "effect1_a");
        addButton("Effect #2", "effect2_a");
        addButton("Start recording", "rec");
        addButton("Play last recording", "play_last_recording");

        soundPool = new SoundPool(10, AudioManager.STREAM_MUSIC, 0);
        sound_pew = soundPool.load(this, R.raw.pew, 1);
        sound_pow = soundPool.load(this, R.raw.pow, 1);
    }

    this.addContentView(buttons, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.WRAP_CONTENT));

    init();
}

From source file:com.chintans.venturebox.cards.SystemCard.java

/**
 * Refreshes the SystemCard texts to reflect any new changes from updates checks
 */// w ww. ja v  a 2 s .c o m
private void setText() {
    if (mUpdateAvailable == true || mUpdateDownloading == true || mUpdateDownloaded == true) {
        mSeparator.setVisibility(View.VISIBLE);
        mUpdateItem.setVisibility(View.VISIBLE);
    } else {
        mSeparator.setVisibility(View.GONE);
        mUpdateItem.setVisibility(View.GONE);
    }

    // TODO: Change to real strings
    if (mUpdateAvailable == true) {
        mUpdateItem.setTitle("Update is available! Download?");
    } else if (mUpdateDownloading == true) {
        mUpdateItem.setTitle("Update is downloading!");
    } else if (mUpdateDownloaded == true) {
        mUpdateItem.setTitle("Update is downloaded! Install?");
    }
}

From source file:com.hybris.mobile.app.commerce.adapter.ProductGridAdapter.java

@Override
public void bindView(View rowView, final Context context, final Cursor cursor) {

    // When clicking outside a EditText, hide keyboard, remove focus and reset to the default value
    // Clicking on the main view
    rowView.setOnTouchListener(new OnTouchListener() {

        @Override/*  ww  w .j  ava 2s.c o  m*/
        public boolean onTouch(View v, MotionEvent event) {
            UIUtils.hideKeyboard(getContext());
            v.performClick();
            return false;
        }
    });

    final ProductBase product = getData();
    final ViewHolder productGridViewHolder = (ViewHolder) rowView.getTag();

    // Loading the product image
    if (CommerceApplication.isOnline()) {
        if (StringUtils.isNotBlank(product.getImageThumbnailUrl())) {
            CommerceApplication.getContentServiceHelper().loadImage(product.getImageThumbnailUrl(),
                    "product_grid_image_" + product.getCode(), productGridViewHolder.productMainImage, 0, 0,
                    true, new OnRequestListener() {

                        @Override
                        public void beforeRequest() {
                            productGridViewHolder.productMainImage
                                    .setImageResource(android.R.color.transparent);
                            productGridViewHolder.productMainImage.setVisibility(View.GONE);
                            productGridViewHolder.productImageLoading.setVisibility(View.VISIBLE);
                        }

                        @Override
                        public void afterRequestBeforeResponse() {

                        }

                        @Override
                        public void afterRequest(boolean isDataSynced) {
                            productGridViewHolder.productMainImage.setVisibility(View.VISIBLE);
                        }
                    }, true);
        }

    } else {
        Log.i(TAG, "Application offline, displaying no image for product " + product.getCode());
        productGridViewHolder.productMainImage
                .setImageDrawable(getContext().getResources().getDrawable(R.drawable.no_image_product));
        productGridViewHolder.productMainImage.setVisibility(View.VISIBLE);
    }

    // Populate name and code for a product when row collapsed
    productGridViewHolder.productName.setText(product.getName());
    productGridViewHolder.productNo.setText(product.getCode());
    productGridViewHolder.productPrice.setText(product.getPriceRangeFormattedValue());

    //Rating
    if (product.getAverageRating() != null) {
        productGridViewHolder.productItemRating.setVisibility(View.VISIBLE);
        productGridViewHolder.productItemRating.setRating(product.getAverageRating().floatValue());
    } else {
        productGridViewHolder.productItemRating.setVisibility(View.GONE);
    }

    if (product.getMultidimensional() != null && product.getMultidimensional()) {
        //Show arrow down with variants
        productGridViewHolder.productImageViewCartIcon.setVisibility(View.GONE);
        productGridViewHolder.productImageViewExpandIcon.setVisibility(View.VISIBLE);
        productGridViewHolder.productImageViewExpandIcon.setEnabled(true);
        productGridViewHolder.productImageViewExpandIcon.setClickable(true);
    } else {
        productGridViewHolder.productImageViewCartIcon.setVisibility(View.VISIBLE);
        productGridViewHolder.productImageViewExpandIcon.setVisibility(View.GONE);
        productGridViewHolder.productImageViewCartIcon.setEnabled(false);
        productGridViewHolder.productImageViewCartIcon.setClickable(false);
    }

    /**
     * Product item row is expanded and user click on the main part of the cell to navigate to the product detail page
     */
    productGridViewHolder.productMainImage.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            ProductHelper.redirectToProductDetail(getContext(),
                    StringUtils.isNotBlank(getFirstVariantCode(product)) ? getFirstVariantCode(product)
                            : product.getCode());
        }
    });

    /**
     * Product item row is expanded and user click on the product name of the cell to navigate to the product detail
     * page
     */
    productGridViewHolder.productName.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            ProductHelper.redirectToProductDetail(getContext(),
                    StringUtils.isNotBlank(getFirstVariantCode(product)) ? getFirstVariantCode(product)
                            : product.getCode());
        }
    });

}

From source file:org.sirimangalo.meditationplus.AdapterCommit.java

@Override
public View getView(final int position, View convertView, ViewGroup parent) {

    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    View rowView = inflater.inflate(R.layout.list_item_commit, parent, false);

    final View shell = rowView.findViewById(R.id.detail_shell);

    rowView.setOnClickListener(new View.OnClickListener() {
        @Override//w  w w  .  j ava2 s . c om
        public void onClick(View view) {
            boolean visible = shell.getVisibility() == View.VISIBLE;

            shell.setVisibility(visible ? View.GONE : View.VISIBLE);

            context.setCommitVisible(position, !visible);

        }
    });

    final JSONObject p = values.get(position);

    TextView title = (TextView) rowView.findViewById(R.id.title);
    TextView descV = (TextView) rowView.findViewById(R.id.desc);
    TextView defV = (TextView) rowView.findViewById(R.id.def);
    TextView usersV = (TextView) rowView.findViewById(R.id.users);
    TextView youV = (TextView) rowView.findViewById(R.id.you);

    try {

        if (p.getBoolean("open"))
            shell.setVisibility(View.VISIBLE);

        title.setText(p.getString("title"));
        descV.setText(p.getString("description"));

        String length = p.getString("length");
        String time = p.getString("time");
        final String cid = p.getString("cid");

        String def = "";

        boolean repeat = false;

        if (length.indexOf(":") > 0) {
            repeat = true;
            String[] lengtha = length.split(":");
            def += lengtha[0] + " minutes walking and " + lengtha[1] + " minutes sitting";
        } else
            def += length + " minutes total meditation";

        String period = p.getString("period");

        String day = p.getString("day");

        if (period.equals("daily")) {
            if (repeat)
                def += " every day";
            else
                def += " per day";
        } else if (period.equals("weekly")) {
            if (repeat)
                def += " every " + dow[Integer.parseInt(day)];
            else
                def += " per week";
        } else if (period.equals("monthly")) {
            if (repeat)
                def += " on the " + day
                        + (day.substring(day.length() - 1).equals("1") ? "st"
                                : (day.substring(day.length() - 1).equals("2") ? "nd"
                                        : (day.substring(day.length() - 1).equals("3") ? "rd" : "th")))
                        + " day of the month";
            else
                def += " per month";
        } else if (period.equals("yearly")) {
            if (repeat)
                def += " on the " + day
                        + (day.substring(day.length() - 1).equals("1") ? "st"
                                : (day.substring(day.length() - 1).equals("2") ? "nd"
                                        : (day.substring(day.length() - 1).equals("3") ? "rd" : "th")))
                        + " day of the year";
            else
                def += " per year";
        }

        if (!time.equals("any")) {
            Calendar utc = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
            utc.set(Calendar.HOUR_OF_DAY, Integer.parseInt(time.split(":")[0]));
            utc.set(Calendar.MINUTE, Integer.parseInt(time.split(":")[1]));

            Calendar here = Calendar.getInstance();
            here.setTimeInMillis(utc.getTimeInMillis());

            int hours = here.get(Calendar.HOUR_OF_DAY);
            int minutes = here.get(Calendar.MINUTE);

            def += " at " + (time.length() == 4 ? "0" : "") + time.replace(":", "") + "h UTC <i>("
                    + (hours > 12 ? hours - 12 : hours) + ":" + ((minutes < 10 ? "0" : "") + minutes) + " "
                    + (hours > 11 && hours < 24 ? "PM" : "AM") + " your time)</i>";
        }

        defV.setText(Html.fromHtml(def));

        JSONObject usersJ = p.getJSONObject("users");

        ArrayList<String> committedArray = new ArrayList<String>();

        // collect into array

        for (int i = 0; i < usersJ.names().length(); i++) {
            try {
                String j = usersJ.names().getString(i);
                String k = j;
                //                    if(j.equals(p.getString("creator")))
                //                        k = "["+j+"]";
                committedArray.add(k);
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }

        String text = context.getString(R.string.committed) + " ";

        // add spans

        int committed = -1;

        int pos = text.length(); // start after "Committed: "

        text += TextUtils.join(", ", committedArray);
        Spannable span = new SpannableString(text);

        span.setSpan(new StyleSpan(Typeface.BOLD), 0, pos, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); // bold the "Online: "

        for (int i = 0; i < committedArray.size(); i++) {
            try {

                final String oneCom = committedArray.get(i);
                String userCom = usersJ.getString(oneCom);
                //String userCom = usersJ.getString(oneCom.replace("[", "").replace("]", ""));

                //if(oneCom.replace("[","").replace("]","").equals(loggedUser))
                if (oneCom.equals(loggedUser))
                    committed = Integer.parseInt(userCom);

                int end = pos + oneCom.length();

                ClickableSpan clickable = new ClickableSpan() {

                    @Override
                    public void onClick(View widget) {
                        context.showProfile(oneCom);
                    }

                };
                span.setSpan(clickable, pos, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

                span.setSpan(new UnderlineSpan() {
                    public void updateDrawState(TextPaint tp) {
                        tp.setUnderlineText(false);
                    }
                }, pos, end, 0);

                String color = Utils.makeRedGreen(Integer.parseInt(userCom), true);

                span.setSpan(new ForegroundColorSpan(Color.parseColor("#FF" + color)), pos, end,
                        Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

                pos += oneCom.length() + 2;

            } catch (JSONException e) {
                e.printStackTrace();
            }
        }

        usersV.setText(span);
        usersV.setMovementMethod(new LinkMovementMethod());

        if (loggedUser != null && loggedUser.length() > 0) {
            LinearLayout bl = (LinearLayout) rowView.findViewById(R.id.commit_buttons);
            if (!usersJ.has(loggedUser)) {
                Button commitB = new Button(context);
                commitB.setId(R.id.commit_button);
                commitB.setText(R.string.commit);
                commitB.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        ArrayList<NameValuePair> nvp = new ArrayList<NameValuePair>();
                        nvp.add(new BasicNameValuePair("full_update", "true"));

                        context.doSubmit("commitform_" + cid, nvp, true);
                    }
                });
                bl.addView(commitB);
            } else {
                Button commitB = new Button(context);
                commitB.setId(R.id.uncommit_button);
                commitB.setText(R.string.uncommit);
                commitB.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        ArrayList<NameValuePair> nvp = new ArrayList<NameValuePair>();
                        nvp.add(new BasicNameValuePair("full_update", "true"));

                        context.doSubmit("uncommitform_" + cid, nvp, true);
                    }
                });
                bl.addView(commitB);
            }

            if (loggedUser.equals(p.getString("creator")) || context.isAdmin) {
                Button commitB2 = new Button(context);
                commitB2.setId(R.id.edit_commit_button);
                commitB2.setText(R.string.edit);
                commitB2.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        Intent i = new Intent(context, ActivityCommit.class);
                        i.putExtra("commitment", p.toString());
                        context.startActivity(i);
                    }
                });
                bl.addView(commitB2);

                Button commitB3 = new Button(context);
                commitB3.setId(R.id.uncommit_button);
                commitB3.setText(R.string.delete);
                commitB3.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        ArrayList<NameValuePair> nvp = new ArrayList<NameValuePair>();
                        nvp.add(new BasicNameValuePair("full_update", "true"));

                        context.doSubmit("delcommitform_" + cid, nvp, true);
                    }
                });
                bl.addView(commitB3);
            }

        }

        if (committed > -1) {
            int color = Color.parseColor("#FF" + Utils.makeRedGreen(committed, false));
            rowView.setBackgroundColor(color);
        }

        if (committed != -1) {
            youV.setText(String.format(context.getString(R.string.you_commit_x), committed));
            youV.setVisibility(View.VISIBLE);
        }

    } catch (Exception e) {
        e.printStackTrace();
    }
    return rowView;
}