Example usage for android.widget LinearLayout setVisibility

List of usage examples for android.widget LinearLayout setVisibility

Introduction

In this page you can find the example usage for android.widget LinearLayout setVisibility.

Prototype

@RemotableViewMethod
public void setVisibility(@Visibility int visibility) 

Source Link

Document

Set the visibility state of this view.

Usage

From source file:com.github.colorchief.colorchief.MainActivity.java

public void acceptButtonClick(View view) {
    LinearLayout overlayColorControl = (LinearLayout) findViewById(R.id.overlayColorControl);
    overlayColorControl.setVisibility(LinearLayout.INVISIBLE);
    ImageView colourBlock22 = (ImageView) findViewById(R.id.colour22);
    ColorDrawable colourDrawable = (ColorDrawable) colourBlock22.getBackground();
    int setColour = colourDrawable.getColor();
    colorLUT.setLUTElement(verticeCoords[0], verticeCoords[1], verticeCoords[2], setColour);
    colorControlVerticesX.add(verticeCoords[0]);
    colorControlVerticesY.add(verticeCoords[1]);
    colorControlVerticesZ.add(verticeCoords[2]);
    colorControlOutputColors.add(setColour);

    transformImage();/*  ww w  .j  a  v  a 2  s  .  co  m*/
    updateImageViewer();
}

From source file:com.github.colorchief.colorchief.MainActivity.java

public void setImageViewBitmap(View view) {
    if (bitmapLoaded) {
        if (view == (View) findViewById(R.id.radioButtonImageOriginal)) {
            showTransformedBitmap = false;
        } else if (view == (View) findViewById(R.id.radioButtonImageTransformed)) {
            showTransformedBitmap = true;
        }/*from  w w w . j av  a 2 s.  c om*/
        LinearLayout overlayColorControl = (LinearLayout) findViewById(R.id.overlayColorControl);
        overlayColorControl.setVisibility(LinearLayout.INVISIBLE);
        updateImageViewer();
    }
}

From source file:com.jamsuni.jamsunicodescan.MainActivity.java

/**
 * Called when a view has been clicked.//from   ww w.java2  s . c o m
 *
 * @param v The view that was clicked.
 */
@Override
public void onClick(View v) {
    if (v.getId() == R.id.btnScan) {
        //testTTS("13   ? ?    ??  ?  ? ? ??  ?  ? ?\n");

        Button btContent = (Button) findViewById(R.id.btnContentView);
        btContent.setText("");
        btContent.setVisibility(View.GONE);
        contentString = "";

        barcodeValue.setText("");
        barcodeValue.setVisibility(View.VISIBLE);

        LinearLayout llBookInfo = (LinearLayout) findViewById(R.id.llBookInfo);
        llBookInfo.setVisibility(View.GONE);
        LinearLayout llProductInfo = (LinearLayout) findViewById(R.id.llProductInfo);
        llProductInfo.setVisibility(View.GONE);

        startScan();
        /*
        // launch barcode activity.
        Intent intent = new Intent(this, BarcodeCaptureActivity.class);
        intent.putExtra(BarcodeCaptureActivity.AutoFocus, autoFocus.isChecked());
        intent.putExtra(BarcodeCaptureActivity.UseFlash, useFlash.isChecked());
                
        startActivityForResult(intent, RC_BARCODE_CAPTURE);
        */

    }
    if (v.getId() == R.id.btnHistory) {
        Intent intent = new Intent(this, HistoryActivity.class);
        startActivityForResult(intent, HISTORY_CONTENT_VIEW);
    }
    if (v.getId() == R.id.btnContentView) {
        goURL();
    }

}

From source file:com.github.colorchief.colorchief.MainActivity.java

public void resetColorControlAll(View view) {
    new AlertDialog.Builder(this).setTitle("Warning: Reset All? ")
            .setMessage("Choosing OK will reset any changes made with the colour controls.  "
                    + "Do you want to proceed?")
            .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    Log.d(TAG, "ok");
                    LinearLayout overlayColorControl = (LinearLayout) findViewById(R.id.overlayColorControl);
                    overlayColorControl.setVisibility(LinearLayout.INVISIBLE);
                    colorControlVerticesX.clear();
                    colorControlVerticesY.clear();
                    colorControlVerticesZ.clear();
                    colorControlOutputColors.clear();

                    recalculateTransform();
                    transformImage();//from  w w w .j  a v  a2 s  .  c o m
                    updateImageViewer();
                }
            }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    Log.d(TAG, "cancel");
                    // do nothing - leave the LUT as is
                }
            }).setIcon(android.R.drawable.ic_dialog_alert).show();

}

From source file:fm.krui.kruifm.StreamFragment.java

/**
 * Moves the stream status bar into view to show messages regarding stream status. Use indefinite time constraints
 * @param message String to display in the status bar.
 * @param isIndefinite true if the message should be displayed until explicitly cancelled by a broadcast message.
 *//*from w w  w .  j a  va 2s .c om*/
public void showStreamStatusBar(String message, boolean isIndefinite) {
    final LinearLayout statusContainer = (LinearLayout) getActivity()
            .findViewById(R.id.stream_status_container_linearlayout);
    // Apply label text, then bring the status bar into view
    TextView statusLabel = (TextView) getActivity().findViewById(R.id.stream_status_label_textview);
    statusLabel.setText(message);
    statusContainer.setVisibility(View.VISIBLE);

    // Construct translation animations from xml.
    final Animation animIn = AnimationUtils.loadAnimation(getActivity(), R.anim.translate_up);
    final Animation animOut = AnimationUtils.loadAnimation(getActivity(), R.anim.translate_down);
    statusContainer.startAnimation(animIn);

    if (!isIndefinite) {

        // When fade in is completed, trigger a fade out animation.
        animIn.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                animOut.setStartOffset(1200);
                statusContainer.startAnimation(animOut);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }
        });

        // When the animation has completely faded out, hide its parent container
        animOut.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                statusContainer.setVisibility(View.INVISIBLE);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }
        });
    }
}

From source file:com.github.colorchief.colorchief.MainActivity.java

private void clickColourChange(int x, int y, ImageView imageView) {
    //ImageView imageViewer = (ImageView) findViewById(R.id.imageView);

    //Bitmap bitmap = null;

    int colourAtPixel = 0;

    try {// w  w  w  .  j  a v a  2  s .c o m
        //bitmap = ((BitmapDrawable) imageView.getDrawable()).getBitmap();
        //colourAtPixel = bitmap.getPixel(x, y);
        //grab the value of the original, not converted image
        colourAtPixel = bitmapScaledOriginal.getPixel(x, y);
    } catch (NullPointerException npe) {
        Log.e(TAG, "Failed to grab Bitmap from ImageView or invalid pixel request" + " (i.e. out of bounds): "
                + npe);
        return;
    }

    verticeCoords = colorLUT.getNearestVerticeCoords(colourAtPixel);
    int inColor = colorLUT.getInputColor(verticeCoords[0], verticeCoords[1], verticeCoords[2]);

    int outColor = colorLUT.getLUTElement(verticeCoords[0], verticeCoords[1], verticeCoords[2]);

    /*
    Log.d(TAG, "Pixel x,y = " + Integer.toString(x) + ", " + Integer.toString(y)
        + " Colour = " + Integer.toHexString(colourAtPixel) + ", nearest input colour = " +
        Integer.toHexString(inColor) + ", output colour = " + Integer.toHexString(outColor));
    */

    LinearLayout overlayColorControl = (LinearLayout) findViewById(R.id.overlayColorControl);
    overlayColorControl.setVisibility(LinearLayout.VISIBLE);

    if (showTransformedBitmap && transformedBitmapIsValid) {
        ((RadioButton) findViewById(R.id.radioButtonImageOriginal)).setChecked(false);
        ((RadioButton) findViewById(R.id.radioButtonImageTransformed)).setChecked(true);
    } else {
        ((RadioButton) findViewById(R.id.radioButtonImageOriginal)).setChecked(true);
        ((RadioButton) findViewById(R.id.radioButtonImageTransformed)).setChecked(false);
    }

    ImageView colourBlock11 = (ImageView) findViewById(R.id.colour11);
    ImageView colourBlock12 = (ImageView) findViewById(R.id.colour12);
    ImageView colourBlock13 = (ImageView) findViewById(R.id.colour13);
    ImageView colourBlock21 = (ImageView) findViewById(R.id.colour21);
    ImageView colourBlock22 = (ImageView) findViewById(R.id.colour22);
    ImageView colourBlock23 = (ImageView) findViewById(R.id.colour23);
    ImageView colourBlock31 = (ImageView) findViewById(R.id.colour31);
    ImageView colourBlock32 = (ImageView) findViewById(R.id.colour32);
    ImageView colourBlock33 = (ImageView) findViewById(R.id.colour33);

    colourBlock11.setBackgroundColor(inColor);
    colourBlock12.setBackgroundColor(inColor);
    colourBlock13.setBackgroundColor(inColor);
    colourBlock21.setBackgroundColor(inColor);
    colourBlock23.setBackgroundColor(inColor);
    colourBlock31.setBackgroundColor(inColor);
    colourBlock32.setBackgroundColor(inColor);
    colourBlock33.setBackgroundColor(inColor);

    colourBlock22.setBackgroundColor(outColor);

    /*
    Log.d(TAG,"nearest vertice = " + Integer.toString(verticeCoords[0]) + ", "
        + Integer.toString(verticeCoords[1]) + ", " + Integer.toString(verticeCoords[2])
        + " and output Colour = " + Integer.toHexString(outColor));
    */
}

From source file:nl.hnogames.domoticz.Welcome.WelcomePage3.java

private void getLayoutReferences() {

    remote_server_input = (FloatingLabelEditText) v.findViewById(R.id.remote_server_input);
    remote_port_input = (FloatingLabelEditText) v.findViewById(R.id.remote_port_input);
    remote_username_input = (FloatingLabelEditText) v.findViewById(R.id.remote_username_input);
    remote_password_input = (FloatingLabelEditText) v.findViewById(R.id.remote_password_input);
    remote_directory_input = (FloatingLabelEditText) v.findViewById(R.id.remote_directory_input);
    remote_protocol_spinner = (Spinner) v.findViewById(R.id.remote_protocol_spinner);
    local_server_input = (FloatingLabelEditText) v.findViewById(R.id.local_server_input);
    local_port_input = (FloatingLabelEditText) v.findViewById(R.id.local_port_input);
    local_username_input = (FloatingLabelEditText) v.findViewById(R.id.local_username_input);
    local_password_input = (FloatingLabelEditText) v.findViewById(R.id.local_password_input);
    local_directory_input = (FloatingLabelEditText) v.findViewById(R.id.local_directory_input);
    local_protocol_spinner = (Spinner) v.findViewById(R.id.local_protocol_spinner);
    local_wifi_spinner = (MultiSelectionSpinner) v.findViewById(R.id.local_wifi);
    cbShowPassword = (CheckBox) v.findViewById(R.id.showpassword);
    cbShowPasswordLocal = (CheckBox) v.findViewById(R.id.showpasswordlocal);

    startScreen_spinner = (Spinner) v.findViewById(R.id.startScreen_spinner);
    btnManualSSID = (Button) v.findViewById(R.id.set_ssid);
    btnManualSSID.setOnClickListener(new View.OnClickListener() {
        @Override//from  w w  w .j a va2 s.  co m
        public void onClick(View v) {
            new MaterialDialog.Builder(getContext()).title(R.string.welcome_ssid_button_prompt)
                    .content(R.string.welcome_msg_no_ssid_found)
                    .inputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD)
                    .input(null, null, new MaterialDialog.InputCallback() {
                        @Override
                        public void onInput(MaterialDialog dialog, CharSequence input) {
                            Set<String> ssidFromPrefs = mServerUtil.getActiveServer().getLocalServerSsid();
                            final ArrayList<String> ssidListFromPrefs = new ArrayList<>();
                            if (ssidFromPrefs != null) {
                                if (ssidFromPrefs.size() > 0) {
                                    for (String wifi : ssidFromPrefs) {
                                        ssidListFromPrefs.add(wifi);
                                    }
                                }
                            }
                            ssidListFromPrefs.add(String.valueOf(input));
                            mServerUtil.getActiveServer().setLocalServerSsid(ssidListFromPrefs);

                            setSsid_spinner();
                        }
                    }).show();
        }
    });

    if (callingInstance == SETTINGS) {
        // Hide these settings if being called by settings (instead of welcome wizard)
        startScreen_spinner.setVisibility(View.GONE);
        v.findViewById(R.id.startScreen_title).setVisibility(View.GONE);
        v.findViewById(R.id.server_settings_title).setVisibility(View.GONE);
    }

    final LinearLayout localServerSettingsLayout = (LinearLayout) v.findViewById(R.id.local_server_settings);
    localServer_switch = (Switch) v.findViewById(R.id.localServer_switch);
    localServer_switch.setChecked(mSharedPrefs.isAdvancedSettingsEnabled());

    localServer_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
            if (checked)
                localServerSettingsLayout.setVisibility(View.VISIBLE);
            else
                localServerSettingsLayout.setVisibility(View.GONE);
        }
    });

    final LinearLayout advancedSettings_layout = (LinearLayout) v.findViewById(R.id.advancedSettings_layout);

    advancedSettings_switch = (Switch) v.findViewById(R.id.advancedSettings_switch);
    advancedSettings_switch.setChecked(mSharedPrefs.isAdvancedSettingsEnabled());

    if (mSharedPrefs.isAdvancedSettingsEnabled())
        advancedSettings_layout.setVisibility(View.VISIBLE);

    advancedSettings_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            mSharedPrefs.setAdvancedSettingsEnabled(isChecked);

            if (isChecked)
                advancedSettings_layout.setVisibility(View.VISIBLE);
            else
                advancedSettings_layout.setVisibility(View.GONE);
        }
    });

    cbShowPassword.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (!isChecked) {
                remote_password_input.getInputWidget()
                        .setTransformationMethod(PasswordTransformationMethod.getInstance());
            } else {
                remote_password_input.getInputWidget()
                        .setTransformationMethod(HideReturnsTransformationMethod.getInstance());
            }
        }
    });

    cbShowPasswordLocal.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (!isChecked) {
                local_password_input.getInputWidget()
                        .setTransformationMethod(PasswordTransformationMethod.getInstance());
            } else {
                local_password_input.getInputWidget()
                        .setTransformationMethod(HideReturnsTransformationMethod.getInstance());
            }
        }
    });
}

From source file:fm.krui.kruifm.StreamActivity.java

/**
 * Moves the stream status bar into view to show messages regarding stream status. Use indefinite time constraints
 * @param message String to display in the status bar.
 * @param isIndefinite true if the message should be displayed until explicitly cancelled by a broadcast message.
 */// ww  w . j  a  v a 2s.c om
public void showStreamStatusBar(String message, boolean isIndefinite) {
    final LinearLayout statusContainer = (LinearLayout) this
            .findViewById(R.id.stream_status_container_linearlayout);
    // Apply label text, then bring the status bar into view
    TextView statusLabel = (TextView) this.findViewById(R.id.stream_status_label_textview);
    statusLabel.setText(message);
    statusContainer.setVisibility(View.VISIBLE);

    // Construct translation animations from xml.
    final Animation animIn = AnimationUtils.loadAnimation(this, R.anim.translate_up);
    final Animation animOut = AnimationUtils.loadAnimation(this, R.anim.translate_down);
    statusContainer.startAnimation(animIn);

    if (!isIndefinite) {

        // When fade in is completed, trigger a fade out animation.
        animIn.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                animOut.setStartOffset(1200);
                statusContainer.startAnimation(animOut);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }
        });

        // When the animation has completely faded out, hide its parent container
        animOut.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                statusContainer.setVisibility(View.INVISIBLE);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }
        });
    }
}

From source file:com.example.mego.adas.directions.ui.DirectionsFragment.java

/**
 * method used to show the reveal effect to the edit text
 *///  w ww  .  j  a  va 2s. c  o  m
private void revealEditText(LinearLayout view) {
    int centerX = view.getRight() - 30;
    int centerY = view.getBottom() - 60;
    int finalRadius = Math.max(view.getWidth(), view.getHeight());

    //work with api 21 or above
    Animator animator = null;
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        animator = ViewAnimationUtils.createCircularReveal(view, centerX, centerY, 0, finalRadius);
    }
    view.setVisibility(View.VISIBLE);

    isEditTextVisible = true;
    if (animator != null) {
        animator.start();
    }
}

From source file:com.nogago.android.tracks.UploadResultActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    if (id != DIALOG_RESULT_ID) {
        return null;
    }/*ww  w  .  j a va  2s. c  o  m*/
    view = getLayoutInflater().inflate(R.layout.upload_result, null);

    LinearLayout mapsResult = (LinearLayout) view.findViewById(R.id.upload_result_maps_result);
    LinearLayout fusionTablesResult = (LinearLayout) view.findViewById(R.id.upload_result_fusion_tables_result);
    LinearLayout docsResult = (LinearLayout) view.findViewById(R.id.upload_result_docs_result);

    ImageView mapsResultIcon = (ImageView) view.findViewById(R.id.upload_result_maps_result_icon);
    ImageView fusionTablesResultIcon = (ImageView) view
            .findViewById(R.id.upload_result_fusion_tables_result_icon);
    ImageView docsResultIcon = (ImageView) view.findViewById(R.id.upload_result_docs_result_icon);

    TextView successFooter = (TextView) view.findViewById(R.id.upload_result_success_footer);
    TextView errorFooter = (TextView) view.findViewById(R.id.upload_result_error_footer);

    boolean hasError = false;
    if (!sendRequest.isSendMaps()) {
        mapsResult.setVisibility(View.GONE);
    } else {
        if (!sendRequest.isMapsSuccess()) {
            mapsResultIcon.setImageResource(R.drawable.failure);
            mapsResultIcon.setContentDescription(getString(R.string.generic_error_title));
            hasError = true;
        }
    }

    if (!sendRequest.isSendFusionTables()) {
        fusionTablesResult.setVisibility(View.GONE);
    } else {
        if (!sendRequest.isFusionTablesSuccess()) {
            fusionTablesResultIcon.setImageResource(R.drawable.failure);
            fusionTablesResultIcon.setContentDescription(getString(R.string.generic_error_title));
            hasError = true;
        }
    }

    if (!sendRequest.isSendDocs()) {
        docsResult.setVisibility(View.GONE);
    } else {
        if (!sendRequest.isDocsSuccess()) {
            docsResultIcon.setImageResource(R.drawable.failure);
            docsResultIcon.setContentDescription(getString(R.string.generic_error_title));
            hasError = true;
        }
    }

    if (hasError) {
        successFooter.setVisibility(View.GONE);
    } else {
        errorFooter.setVisibility(View.GONE);
    }

    AlertDialog.Builder builder = new AlertDialog.Builder(this).setCancelable(true)
            .setIcon(hasError ? android.R.drawable.ic_dialog_alert : android.R.drawable.ic_dialog_info)
            .setOnCancelListener(new DialogInterface.OnCancelListener() {
                @Override
                public void onCancel(DialogInterface dialog) {
                    finish();
                }
            }).setPositiveButton(R.string.generic_ok, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    finish();
                }
            }).setTitle(hasError ? R.string.generic_error_title : R.string.generic_success_title).setView(view);

    // Add a Share URL button if shareUrl exists
    if (shareUrl != null) {
        builder.setNegativeButton(R.string.share_track_share_url, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                ChooseActivityDialogFragment.newInstance(sendRequest.getTrackId(), shareUrl).show(
                        getSupportFragmentManager(), ChooseActivityDialogFragment.CHOOSE_ACTIVITY_DIALOG_TAG);
            }
        });
    }
    resultDialog = builder.create();
    return resultDialog;
}