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:org.ciasaboark.tacere.activity.fragment.SelectCalendarsFragment.java

private void hideDialogBody() {
    LinearLayout layout = (LinearLayout) rootView.findViewById(R.id.calendars_box);
    layout.setVisibility(View.GONE);
}

From source file:dynamite.zafroshops.app.fragment.ZopItemFragment.java

private void setLayout(LayoutInflater inflater, LinearLayout layout, final FullMobileZop zop,
        RelativeLayout loader) {/*ww w  .ja  v  a  2 s .c o m*/
    LinearLayout item = (LinearLayout) layout.findViewById(R.id.itemZop);

    loader.setVisibility(View.VISIBLE);
    item.setVisibility(View.INVISIBLE);
    if (zop != null && zop.id != null && !zop.id.trim().equals("")) {
        MainActivity activity = (MainActivity) getActivity();
        (activity).setCurrentItem(zop.id, zop);

        LinearLayout list = (LinearLayout) layout.findViewById(R.id.zopOpeningHours);
        ArrayList<MobileOpeningHourData> ohs = zop.getGroupedOpeningHours();

        // set other fields
        ((ImageView) item.findViewById(R.id.zopImg)).setImageResource(R.drawable.nopictureyet);
        ((TextView) item.findViewById(R.id.zopName)).setText(zop.Name);
        ((TextView) item.findViewById(R.id.zopStreet)).setText(zop.Street + " " + zop.StreetNumber);
        ((TextView) item.findViewById(R.id.zopCity)).setText(zop.City);
        ((TextView) item.findViewById(R.id.zopCountry)).setText(zop.CountryName);

        LinearLayout linearLayout = ((LinearLayout) item.findViewById(R.id.zopServiceIcons));

        linearLayout.removeAllViews();
        setView(zop.Type.toString(), zop.Type.getText(), linearLayout, inflater);
        for (Object s : zop.Services) {
            ZopServiceType zopServiceType = ((MobileZopService) s).Service;

            if (!zopServiceType.toString().equals(zop.Type.toString())) {
                setView(zopServiceType.toString(), zopServiceType.getText(), linearLayout, inflater);
            }
        }

        if (zop.Distance > 0) {
            ((TextView) item.findViewById(R.id.locatoin_km)).setText(
                    " (" + String.format("%.0f", zop.Distance) + " " + getString(R.string.far_away) + ")");
        }
        if (zop.PhoneNumber == null || zop.PhoneNumber.trim().equals("")) {
            item.findViewById(R.id.zopPhoneNumberLabel).setVisibility(View.INVISIBLE);
        } else {
            item.findViewById(R.id.zopPhoneNumberLabel).setVisibility(View.VISIBLE);
            ((TextView) item.findViewById(R.id.zopPhoneNumber))
                    .setText(zop.CountryPhoneCode + " " + zop.PhoneNumber);
        }

        if (zop.Details == null || zop.Details.trim().equals("")) {
            item.findViewById(R.id.zopDetailsLabel).setVisibility(View.INVISIBLE);
        } else {
            item.findViewById(R.id.zopDetailsLabel).setVisibility(View.VISIBLE);
            ((TextView) item.findViewById(R.id.zopDetails)).setText(zop.Details);
        }
        // set opening hours
        setOpeningsList(ohs, list, inflater, (TextView) item.findViewById(R.id.zopOpeningHoursLabel));
        loader.setVisibility(View.INVISIBLE);
        item.setVisibility(View.VISIBLE);
    }
}

From source file:com.mobicage.rogerthat.FriendDetailOrInviteActivity.java

private void updateView() {
    final ImageView image = (ImageView) findViewById(R.id.friend_avatar);

    if (mFriend == null) {
        image.setVisibility(View.INVISIBLE);
        return;/*from   ww  w. jav  a 2s.  co  m*/
    }
    image.setVisibility(View.VISIBLE);
    final TextView nameView = (TextView) findViewById(R.id.friend_name);

    if (mFriend.avatar == null) {
        image.setImageBitmap(mFriendsPlugin.getMissingFriendAvatarBitmap());
    } else {
        final Bitmap avatarBitmap = BitmapFactory.decodeByteArray(mFriend.avatar, 0, mFriend.avatar.length);
        image.setImageBitmap(ImageHelper.getRoundedCornerAvatar(avatarBitmap));
    }

    setTitle(mFriend.getDisplayName());
    nameView.setText(mFriend.getDisplayName());
    nameView.setTextColor(ContextCompat.getColor(this, android.R.color.primary_text_light));

    final LinearLayout profileDataContainer = (LinearLayout) findViewById(R.id.profile_data);
    if (AppConstants.PROFILE_DATA_FIELDS.length > 0) {
        profileDataContainer.removeAllViews();
        profileDataContainer.setVisibility(View.VISIBLE);
        Map<String, String> profileData = mFriend.getProfileDataDict();
        for (String k : AppConstants.PROFILE_DATA_FIELDS) {
            final LinearLayout ll = (LinearLayout) View.inflate(this, R.layout.profile_data_detail, null);
            final TextView tvKey = (TextView) ll.findViewById(R.id.profile_data_detail_key);
            final TextView tvVal = (TextView) ll.findViewById(R.id.profile_data_detail_value);

            String v = profileData == null ? null : profileData.get(k);
            if (v == null) {
                v = getString(R.string.unknown);
            }
            tvKey.setText(k);
            tvKey.setTextColor(LookAndFeelConstants.getPrimaryColor(this));
            tvVal.setText(v);

            profileDataContainer.addView(ll);
        }
    } else {
        profileDataContainer.setVisibility(View.GONE);
    }
}

From source file:org.mariotaku.twidere.fragment.support.BasePullToRefreshMultiColumnListFragment.java

/**
 * Provide default implementation to return a simple list view. Subclasses
 * can override to replace with their own layout. If doing so, the returned
 * view hierarchy <em>must</em> have a ListView whose id is
 * {@link android.R.id#list android.R.id.list} and can optionally have a
 * sibling view id {@link android.R.id#empty android.R.id.empty} that is to
 * be shown when the list is empty.//from   w w  w.  jav a 2 s .c  om
 * <p>
 * If you are overriding this method with your own custom content, consider
 * including the standard layout {@link android.R.layout#list_content} in
 * your layout file, so that you continue to retain all of the standard
 * behavior of ListFragment. In particular, this is currently the only way
 * to have the built-in indeterminant progress state be shown.
 */
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
        final Bundle savedInstanceState) {
    final Context context = getActivity();
    final FrameLayout root = new FrameLayout(context);

    // ------------------------------------------------------------------

    final LinearLayout pframe = new LinearLayout(context);
    pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID);
    pframe.setOrientation(LinearLayout.VERTICAL);
    pframe.setVisibility(View.GONE);
    pframe.setGravity(Gravity.CENTER);

    final ProgressBar progress = new ProgressBar(context, null, android.R.attr.progressBarStyleLarge);
    pframe.addView(progress, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));

    root.addView(pframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    // ------------------------------------------------------------------

    final FrameLayout lframe = new FrameLayout(context);
    lframe.setId(INTERNAL_LIST_CONTAINER_ID);

    final TextView tv = new TextView(getActivity());
    tv.setId(INTERNAL_EMPTY_ID);
    tv.setGravity(Gravity.CENTER);
    lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    final PullToRefreshLayout plv = new PullToRefreshLayout(context);
    mPullToRefreshLayout = plv;

    final MultiColumnListView lv = createMultiColumnListView(context, inflater);
    lv.setId(android.R.id.list);
    lv.setDrawSelectorOnTop(false);
    plv.addView(lv, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    final Options.Builder builder = new Options.Builder();
    builder.scrollDistance(DEFAULT_PULL_TO_REFRESH_SCROLL_DISTANCE);
    builder.headerTransformer(new TwidereHeaderTransformer());
    if (!isDetached() && getActivity() != null) {
        final SetupWizard wizard = ActionBarPullToRefresh.from(getActivity());
        wizard.allChildrenArePullable();
        wizard.useViewDelegate(MultiColumnListView.class, new PLAAbsListViewDelegate());
        wizard.listener(this);
        wizard.options(builder.build());
        wizard.setup(mPullToRefreshLayout);
    }
    // ViewCompat.setOverScrollMode(lv, ViewCompat.OVER_SCROLL_NEVER);
    lframe.addView(plv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    root.addView(lframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    // ------------------------------------------------------------------

    root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    return root;
}

From source file:com.inovex.zabbixmobile.activities.fragments.ChecksApplicationsFragment.java

/**
 * Shows a loading spinner instead of this page's list view.
 *///from   w  ww.j  a va2 s  . c  o  m
public void showItemsLoadingSpinner() {
    mItemsLoadingSpinnerVisible = true;
    if (getView() != null) {
        LinearLayout progressLayout = (LinearLayout) getView().findViewById(R.id.items_progress_layout);
        if (progressLayout != null)
            progressLayout.setVisibility(View.VISIBLE);
    }
}

From source file:dynamite.zafroshops.app.fragment.AddZopFragment.java

public void resetVisibility() {
    View view = getView();/*from   w ww  .  j a v  a  2s  .co m*/
    RelativeLayout loader = (RelativeLayout) view.findViewById(R.id.relativeLayoutLoader);
    LinearLayout zop = (LinearLayout) view.findViewById(R.id.itemZopAdd);

    loader.setVisibility(View.INVISIBLE);
    zop.setVisibility(View.VISIBLE);
}

From source file:com.popdeem.sdk.uikit.fragment.PDUIShareMessageFragment.java

@Override
public void onClick(View v) {
    final int ID = v.getId();
    if (ID == R.id.pd_instagram_share_next_button) {
        PDAbraLogEvent.log(PDAbraConfig.ABRA_EVENT_PAGE_VIEWED,
                new PDAbraProperties.Builder().add(PDAbraConfig.ABRA_PROPERTYNAME_SOURCE_PAGE,
                        PDAbraConfig.ABRA_PROPERTYVALUE_PAGE_TUTORIAL_MODULE_TWO).create());

        final LinearLayout firstView = (LinearLayout) mView.findViewById(R.id.pd_instagram_share_first_view);
        final LinearLayout secondView = (LinearLayout) mView.findViewById(R.id.pd_instagram_share_second_view);

        firstView.setVisibility(View.INVISIBLE);
        secondView.setVisibility(View.VISIBLE);

        //            ObjectAnimator fAnim = ObjectAnimator.ofFloat(firstView, "translationX", -1.0f);
        //            ObjectAnimator sAnim = ObjectAnimator.ofFloat(secondView, "translationX", 2.0f, 1.0f);
        //            AnimatorSet set = new AnimatorSet();
        //            set.setDuration(1000);
        //            set.setInterpolator(new LinearInterpolator());
        //            set.playTogether(fAnim, sAnim);
        //            set.addListener(new Animator.AnimatorListener() {
        //                @Override
        //                public void onAnimationStart(Animator animation) {
        //                    secondView.setVisibility(View.VISIBLE);
        //                }
        ///*from  w ww.  j  av  a 2 s.co m*/
        //                @Override
        //                public void onAnimationEnd(Animator animation) {
        //                    firstView.setVisibility(View.INVISIBLE);
        //                }
        //
        //                @Override
        //                public void onAnimationCancel(Animator animation) {
        //                }
        //
        //                @Override
        //                public void onAnimationRepeat(Animator animation) {
        //                }
        //            });
        //            set.start();
    } else if (ID == R.id.pd_instagram_share_okay_button || ID == R.id.pd_facebook_share_okay_button) {
        PDAbraLogEvent.log(PDAbraConfig.ABRA_EVENT_CLICKED_NEXT_INSTAGRAM_TUTORIAL, null);
        mCallback.onShareClick();
    }
}

From source file:dynamite.zafroshops.app.fragment.AddZopFragment.java

public void setVisibility() {
    MainActivity activity = (MainActivity) getActivity();
    RelativeLayout loader = (RelativeLayout) activity.findViewById(R.id.relativeLayoutLoader);
    LinearLayout zop = (LinearLayout) activity.findViewById(R.id.itemZopAdd);

    loader.setVisibility(View.VISIBLE);
    zop.setVisibility(View.INVISIBLE);
}

From source file:com.inovex.zabbixmobile.activities.fragments.ChecksApplicationsFragment.java

/**
 * Dismisses the loading spinner view.//from w  w w . j  a  va2  s  .  c o m
 * 
 * If the view has not yet been created, the status is saved and when the
 * view is created, the spinner will not be shown at all.
 */
public void dismissItemsLoadingSpinner() {
    mItemsLoadingSpinnerVisible = false;
    if (getView() != null) {
        LinearLayout progressLayout = (LinearLayout) getView().findViewById(R.id.items_progress_layout);
        if (progressLayout != null) {
            progressLayout.setVisibility(View.GONE);
        }
        ProgressBar listProgress = (ProgressBar) getView().findViewById(R.id.applications_progress);
        listProgress.setProgress(0);
    }

}

From source file:com.inovex.zabbixmobile.activities.fragments.ChecksApplicationsFragment.java

/**
 * Shows a loading spinner instead of this page's list view.
 *//*  w ww. j  a  va 2s. c  o  m*/
public void showApplicationsProgressBar() {
    mApplicationsProgressBarVisible = true;
    if (getView() != null) {
        LinearLayout progressLayout = (LinearLayout) getView().findViewById(R.id.applications_progress_layout);
        if (progressLayout != null)
            progressLayout.setVisibility(View.VISIBLE);
    }
}