Example usage for android.widget LinearLayout getVisibility

List of usage examples for android.widget LinearLayout getVisibility

Introduction

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

Prototype

@ViewDebug.ExportedProperty(mapping = { @ViewDebug.IntToString(from = VISIBLE, to = "VISIBLE"),
        @ViewDebug.IntToString(from = INVISIBLE, to = "INVISIBLE"),
        @ViewDebug.IntToString(from = GONE, to = "GONE") })
@Visibility
public int getVisibility() 

Source Link

Document

Returns the visibility status for this view.

Usage

From source file:com.money.manager.ex.SearchActivity.java

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

    setContentView(R.layout.main_fragments_activity);
    SearchFragment fragment = (SearchFragment) getSupportFragmentManager()
            .findFragmentByTag(SearchFragment.class.getSimpleName());
    if (fragment == null) {
        // fragment create
        fragment = new SearchFragment();
        // set dual panle
        LinearLayout fragmentDetail = (LinearLayout) findViewById(R.id.fragmentDetail);
        mIsDualPanel = fragmentDetail != null && fragmentDetail.getVisibility() == View.VISIBLE;
        fragment.setDualPanel(mIsDualPanel);
        // add to stack
        getSupportFragmentManager().beginTransaction()
                .add(R.id.fragmentContent, fragment, SearchFragment.class.getSimpleName()).commit();
    }/*from ww  w.ja v  a  2s . c o m*/
    // home
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}

From source file:com.money.manager.ex.budget.BudgetsActivity.java

private void createFragments() {
    LinearLayout fragmentDetail = (LinearLayout) findViewById(R.id.fragmentDetail);
    setDualPanel(fragmentDetail != null && fragmentDetail.getVisibility() == View.VISIBLE);

    Core core = new Core(getApplicationContext());

    // show navigation fragment
    BudgetListFragment fragment = (BudgetListFragment) getSupportFragmentManager()
            .findFragmentByTag(BudgetListFragment.class.getSimpleName());
    if (fragment == null) {
        // fragment create
        fragment = BudgetListFragment.newInstance();

        // add to stack
        getSupportFragmentManager().beginTransaction()
                .replace(R.id.fragmentMain, fragment, BudgetListFragment.class.getSimpleName()).commit();
    } else {//w  w  w.j a  v a2 s  .  com
        if (core.isTablet()) {
            getSupportFragmentManager().beginTransaction()
                    .replace(R.id.fragmentMain, fragment, BudgetListFragment.class.getSimpleName()).commit();
        }
    }
}

From source file:com.money.manager.ex.search.SearchActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.search_activity);

    SearchParametersFragment searchParametersFragment = getSearchFragment();
    if (!searchParametersFragment.isAdded()) {
        // set dual panel
        LinearLayout fragmentDetail = (LinearLayout) findViewById(R.id.fragmentDetail);
        mIsDualPanel = fragmentDetail != null && fragmentDetail.getVisibility() == View.VISIBLE;
    }// w w  w  . ja  va2 s  .  co m
    // reconfigure the toolbar event
    //        showStandardToolbarActions(getToolbar(), R.id.action_cancel, R.id.action_search);
    setDisplayHomeAsUpEnabled(true);

    handleSearchRequest();
}

From source file:eisene.riskspeedtools.BattleFrag.java

/**
 * Checks if we are displaying blitz mode or dice mode.
 * @return True if we are in blitz mode, false if in dice mode.
 *//*from   ww w  .j  ava2s  . com*/
public boolean isBlitzMode() {
    LinearLayout blitzFrame = (LinearLayout) findViewById(R.id.blitz_frame);
    return (blitzFrame.getVisibility() == View.VISIBLE);
}

From source file:eisene.riskspeedtools.BattleFrag.java

/**
 * Changes the mode (dice or blitz) on click.
 *//*from   w ww .j  a v a2  s .c  om*/
public void modeOnClick() {
    LinearLayout blitzFrame = (LinearLayout) findViewById(R.id.blitz_frame);

    setMode(blitzFrame.getVisibility() == View.GONE);
}

From source file:com.he5ed.lib.cloudprovider.picker.CloudPickerActivity.java

/**
 * @hide/*w w  w .  j  a  va2 s  . c om*/
 */
@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    // save empty view state skip if not visible
    LinearLayout emptyView = (LinearLayout) findViewById(R.id.error_view);
    outState.putInt("empty_view_visibility", emptyView.getVisibility());
    if (emptyView.getVisibility() != View.VISIBLE)
        return;

    ImageView icon = (ImageView) findViewById(R.id.empty_icon_image_view);
    TextView title = (TextView) findViewById(R.id.empty_title_text_view);
    TextView detail = (TextView) findViewById(R.id.empty_detail_text_view);

    Bitmap bitmap = ((BitmapDrawable) icon.getDrawable()).getBitmap();
    outState.putParcelable("icon_drawable", bitmap);
    outState.putCharSequence("title_text", title.getText());
    outState.putCharSequence("detail_text", detail.getText());
}

From source file:net.palacesoft.cngstation.client.StationActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.refresh:
        try {/*ww  w  .j  a  v  a2  s.  c  o m*/
            Address locationAddress = lookupAddressFromLocation(currentLocation);
            new StationLoader(this, locationAddress, getZoomLevel(), STATIONS_URL).execute();
        } catch (AddressEmptyException e) {
            showInfoMessage("Could not determine your current location");
        } catch (IOException e) {
            showInfoMessage("Network error. Try refreshing.");
        }

        break;

    case R.id.search:
        LinearLayout linearLayout = (LinearLayout) findViewById(R.id.searchLayout);
        if (linearLayout.getVisibility() == View.VISIBLE) {
            linearLayout.setVisibility(View.INVISIBLE);
        } else {
            linearLayout.setVisibility(View.VISIBLE);
            if (countries == null) {
                initSearchForm();
                loadAvailableCountriesList();
            }
        }
        break;

    case R.id.settings:
        startActivity(new Intent(this, Preferences.class));
        break;

    case R.id.cheapest:
        try {
            stationOverlay.popupCheapest();
        } catch (Exception e) {
            logError(e, "Could not show the cheapest station");
        }
        break;

    case R.id.closest:
        try {
            stationOverlay.popupClosest();
        } catch (Exception e) {
            logError(e, "Could not show the closest station");
        }
        break;
    }

    return false;
}

From source file:com.he5ed.lib.cloudprovider.picker.PickerFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    if (getView() == null)
        return;/*from  w w w  . ja va  2  s. com*/
    // save empty view state skip if not visible
    LinearLayout emptyView = (LinearLayout) getView().findViewById(android.R.id.empty);
    outState.putInt("empty_view_visibility", emptyView.getVisibility());
    if (emptyView.getVisibility() != View.VISIBLE)
        return;

    ImageView icon = (ImageView) getView().findViewById(R.id.empty_icon_image_view);
    TextView title = (TextView) getView().findViewById(R.id.empty_title_text_view);
    TextView detail = (TextView) getView().findViewById(R.id.empty_detail_text_view);

    Bitmap bitmap = ((BitmapDrawable) icon.getDrawable()).getBitmap();
    outState.putParcelable("icon_drawable", bitmap);
    outState.putCharSequence("title_text", title.getText());
    outState.putCharSequence("detail_text", detail.getText());
}

From source file:com.hp.mss.printsdksample.fragment.TabFragmentPrintLayout.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View inflatedView = inflater.inflate(R.layout.tab_fragment_print_layout, container, false);
    filePickerLayout = (RelativeLayout) inflatedView.findViewById(R.id.filePickerLayout);

    RadioGroup layoutRadioGroup = (RadioGroup) inflatedView.findViewById(R.id.layoutRadioGroup);
    layoutRadioGroup.setOnCheckedChangeListener(this);
    onCheckedChanged(layoutRadioGroup, layoutRadioGroup.getCheckedRadioButtonId());

    RadioGroup layoutMarginRadioGroup = (RadioGroup) inflatedView.findViewById(R.id.layoutMarginRadioGroup);
    layoutMarginRadioGroup.setOnCheckedChangeListener(this);
    onCheckedChanged(layoutMarginRadioGroup, layoutMarginRadioGroup.getCheckedRadioButtonId());

    SwitchCompat metricsSwitch = (SwitchCompat) inflatedView.findViewById(R.id.metricsRadioGroup);
    metricsSwitch.setOnCheckedChangeListener(this);
    onCheckedChanged(metricsSwitch, metricsSwitch.isChecked());

    RadioGroup contentRadioGroup = (RadioGroup) inflatedView.findViewById(R.id.contentRadioGroup);
    contentRadioGroup.setOnCheckedChangeListener(this);
    onCheckedChanged(contentRadioGroup, contentRadioGroup.getCheckedRadioButtonId());

    RadioGroup deviceIdRadioGroup = (RadioGroup) inflatedView.findViewById(R.id.deviceIdRadioGroup);
    deviceIdRadioGroup.setOnCheckedChangeListener(this);
    onCheckedChanged(deviceIdRadioGroup, deviceIdRadioGroup.getCheckedRadioButtonId());

    tagText = (EditText) inflatedView.findViewById(R.id.tagEditText);
    valueText = (EditText) inflatedView.findViewById(R.id.valueEditText);
    LinearLayout customData = (LinearLayout) inflatedView.findViewById(R.id.customData);
    showCustomData = customData.getVisibility() == View.VISIBLE;

    FloatingActionButton printButton = (FloatingActionButton) inflatedView.findViewById(R.id.printBtn);
    printButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            continueButtonClicked(v);// ww  w.ja  v  a  2 s .  co  m
        }
    });

    Button buttonPick = (Button) inflatedView.findViewById(R.id.buttonPick);
    buttonPick.setOnClickListener(new Button.OnClickListener() {

        @Override
        public void onClick(View arg0) {
            Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
            intent.setType(getContentMimeType());
            startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICKFILE_RESULT_CODE);
        }
    });

    mediaSize5x7 = new PrintAttributes.MediaSize("na_5x7_5x7in", "5 x 7", 5000, 7000);

    return inflatedView;
}

From source file:eu.power_switch.gui.adapter.RoomRecyclerViewAdapter.java

@Override
public void onBindViewHolder(final RoomRecyclerViewAdapter.ViewHolder holder, int position) {
    // Get the data model based on position
    final Room room = rooms.get(holder.getAdapterPosition());

    // Set item views based on the data model
    holder.roomName.setText(room.getName());

    final LinearLayout linearLayout = holder.linearLayoutOfReceivers;
    holder.roomName.setOnClickListener(new View.OnClickListener() {
        @Override//from w  ww .  j a v a  2s . co m
        public void onClick(View v) {
            if (linearLayout.getVisibility() == View.VISIBLE) {
                room.setCollapsed(true);
                linearLayout.setVisibility(View.GONE);
            } else {
                room.setCollapsed(false);
                linearLayout.setVisibility(View.VISIBLE);
            }
        }
    });
    holder.roomName.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            EditRoomDialog editRoomDialog = EditRoomDialog.newInstance(room.getId());
            editRoomDialog.setTargetFragment(recyclerViewFragment, 0);
            editRoomDialog.show(fragmentActivity.getSupportFragmentManager(), null);
            return true;
        }
    });

    View.OnClickListener onClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (SmartphonePreferencesHandler.getVibrateOnButtonPress()) {
                VibrationHandler.vibrate(fragmentActivity, SmartphonePreferencesHandler.getVibrationDuration());
            }

            android.widget.Button buttonView = (android.widget.Button) v;
            String buttonName = buttonView.getText().toString();
            new AsyncTask<String, Void, Void>() {
                @Override
                protected Void doInBackground(String... buttonNames) {
                    try {
                        String buttonName = buttonNames[0];

                        // send signal
                        ActionHandler.execute(fragmentActivity, room, buttonName);

                    } catch (Exception e) {

                    }

                    return null;
                }

                @Override
                protected void onPostExecute(Void aVoid) {
                    updateReceiverViews(holder, room);
                }
            }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, buttonName);
        }
    };

    holder.buttonAllOn.setOnClickListener(onClickListener);
    holder.buttonAllOff.setOnClickListener(onClickListener);

    if (!SmartphonePreferencesHandler.getShowRoomAllOnOff()) {
        holder.buttonAllOn.setVisibility(View.GONE);
        holder.buttonAllOff.setVisibility(View.GONE);
    } else {
        holder.buttonAllOn.setVisibility(View.VISIBLE);
        holder.buttonAllOff.setVisibility(View.VISIBLE);
    }

    updateReceiverViews(holder, room);

    // collapse room
    if (room.isCollapsed()) {
        linearLayout.setVisibility(View.GONE);
    } else {
        linearLayout.setVisibility(View.VISIBLE);
    }

    if (holder.getAdapterPosition() == getItemCount() - 1) {
        holder.footer.setVisibility(View.VISIBLE);
    } else {
        holder.footer.setVisibility(View.GONE);
    }
}