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:hu.balazsbakai.sq.ui.fragments.PagerFragment.java

protected void showEmptyListView() {
    RelativeLayout r = (RelativeLayout) getActivity().findViewById(loadingId);
    if (r != null)
        r.setVisibility(View.GONE);

    LinearLayout ll = (LinearLayout) getActivity().findViewById(emptyListViewId);
    if (ll != null)
        ll.setVisibility(View.VISIBLE);
}

From source file:org.starfishrespect.myconsumption.android.ui.SlidingStatFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_sliding_stat, container, false);

    mStat = (StatDTO) getArguments().getSerializable(STATDTO_KEY);

    ViewCompat.setElevation(rootView, 50);

    // If no values found for this period, just display info for the user
    if (mStat == null || mStat.getConsumption() == 0) {
        LinearLayout layout = (LinearLayout) rootView.findViewById(R.id.stat_container);
        layout.setVisibility(View.GONE);

        TextView textView = (TextView) rootView.findViewById(R.id.txtViewNoValues);
        textView.setVisibility(View.VISIBLE);
        return rootView;
    }/*w  w w .j  a v a2s  .c  o m*/

    DecimalFormat df = new DecimalFormat("0.00");

    TextView textView = (TextView) rootView.findViewById(R.id.txtVwConsumption);
    textView.setText(String.valueOf(StatUtils.wh2kWh(mStat.getConsumption())));

    textView = (TextView) rootView.findViewById(R.id.txtVwAverageWatts);
    textView.setText(String.valueOf(mStat.getAverage()));

    textView = (TextView) rootView.findViewById(R.id.txtVwMaximum);
    textView.setText(String.valueOf(mStat.getMaxValue()));

    textView = (TextView) rootView.findViewById(R.id.txtVwMaximumTimestamp);
    textView.setText(StatUtils.timestamp2DateString(mStat.getMaxTimestamp()));

    textView = (TextView) rootView.findViewById(R.id.txtVwMinimum);
    textView.setText(String.valueOf(mStat.getMinValue()));

    textView = (TextView) rootView.findViewById(R.id.txtVwMinimumTimestamp);
    textView.setText(StatUtils.timestamp2DateString(mStat.getMinTimestamp()));

    textView = (TextView) rootView.findViewById(R.id.txtVwCO2);
    double co2 = (StatUtils.wh2kWh(mStat.getConsumption()) * SingleInstance.getkWhToCO2());
    textView.setText(df.format(co2));

    textView = (TextView) rootView.findViewById(R.id.txtVwEuroHigh);
    double dayEuro = (StatUtils.wh2kWh(mStat.getConsumptionDay()) * SingleInstance.getkWhDayPrice());
    textView.setText(df.format(dayEuro));

    textView = (TextView) rootView.findViewById(R.id.txtVwEuroOff);
    double nightEuro = (StatUtils.wh2kWh(mStat.getConsumptionNight()) * SingleInstance.getkWhNightPrice());
    textView.setText(df.format(nightEuro));

    textView = (TextView) rootView.findViewById(R.id.txtVwEuro);
    double totEuro = dayEuro + nightEuro;
    textView.setText(df.format(totEuro));

    // Adding arrow
    ImageView imgView = (ImageView) rootView.findViewById(R.id.imageView);
    int diff = mStat.getDiffLastTwo();
    String text = "";

    if (diff > 0) {
        imgView.setImageResource(R.drawable.ic_arrow_up);
        text = "+";
    } else if (diff < 0)
        imgView.setImageResource(R.drawable.ic_arrow_down);
    else
        imgView.setImageResource(R.drawable.ic_arrow_stable);

    textView = (TextView) rootView.findViewById(R.id.txtVwComparison);
    textView.setText(text + " " + StatUtils.wh2kWh(diff));

    // Piechart
    mChart = (PieChart) rootView.findViewById(R.id.pieChart1);
    mChart.setDescription("");

    // radius of the center hole in percent of maximum radius
    mChart.setHoleRadius(45f);
    mChart.setTransparentCircleRadius(50f);

    Legend l = mChart.getLegend();
    l.setPosition(Legend.LegendPosition.BELOW_CHART_CENTER);

    mChart.setData(generatePieData());

    return rootView;
}

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

@Nullable
@Override//from  w  w  w.  ja v a2 s.  c o m
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    mView = inflater.inflate(R.layout.fragment_pd_instagram_share, container, false);
    mView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mCallback.onCancel();
        }
    });
    mView.findViewById(R.id.pd_facebook_share_okay_button).setOnClickListener(this);

    if (type.equalsIgnoreCase("facebook")) {
        setupFacebookViews();
    } else {
        PDAbraLogEvent.log(PDAbraConfig.ABRA_EVENT_PAGE_VIEWED,
                new PDAbraProperties.Builder().add(PDAbraConfig.ABRA_PROPERTYNAME_SOURCE_PAGE,
                        PDAbraConfig.ABRA_PROPERTYVALUE_PAGE_TUTORIAL_MODULE_ONE).create());
        mView.findViewById(R.id.pd_instagram_share_next_button).setOnClickListener(this);
        mView.findViewById(R.id.pd_instagram_share_okay_button).setOnClickListener(this);
        LinearLayout facebookView = (LinearLayout) mView.findViewById(R.id.pd_instagram_share_facebook_view);
        facebookView.setVisibility(View.INVISIBLE);
    }
    return mView;
}

From source file:org.smilec.smile.ui.fragment.StudentsFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {

    super.onActivityCreated(savedInstanceState);

    TextView tvTopTitle = (TextView) getActivity().findViewById(R.id.tv_top_scorers);
    tvTopTitle.setTextColor(Color.WHITE);

    LinearLayout llTopScorersConatainer = (LinearLayout) getActivity().findViewById(R.id.ll_top_scorers);
    llTopScorersConatainer.setVisibility(View.INVISIBLE);
}

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

/**
 * Shows a loading spinner instead of the item details.
 *//*from   w w w  .  j av  a 2  s. c  om*/
public void showLoadingSpinner() {
    mLoadingSpinnerVisible = true;
    if (getView() != null) {
        LinearLayout progressLayout = (LinearLayout) getView().findViewById(R.id.progress_layout);
        if (progressLayout != null)
            progressLayout.setVisibility(View.VISIBLE);
    }
}

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

/**
 * Dismisses the loading spinner view.//  ww  w.  jav  a2s.  com
 * 
 * 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 dismissLoadingSpinner() {
    mLoadingSpinnerVisible = false;
    if (getView() != null) {
        LinearLayout progressLayout = (LinearLayout) getView().findViewById(R.id.progress_layout);
        if (progressLayout != null) {
            progressLayout.setVisibility(View.GONE);
        }
    }

}

From source file:de.androvdr.fragments.RecordingsFragment.java

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

    if (!Preferences.showDiskStatus) {
        LinearLayout lay = (LinearLayout) mActivity.findViewById(R.id.recdiskstatus);
        lay.setVisibility(View.GONE);
    }//from   w  ww. j  a v  a  2 s .  co m

    mListView = (ListView) mActivity.findViewById(android.R.id.list);

    /*
     * setTheme doesn't change background color :(
     */
    if (Preferences.blackOnWhite)
        mListView.setBackgroundColor(Color.WHITE);

    mController = new RecordingController(mActivity, mHandler, mListView, savedInstanceState);
    mController.setOnRecordingSelectedListener(this);

    getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);

    if (mActivity.isDualPane()) {
        mUpdateSelectedItemThread = new UpdateSelectedItemThread() {
            @Override
            public int getPosition() {
                int position = mCurrentItemIndex;
                if (position == -1) {
                    for (int i = 0; i < getListView().getCount(); i++) {
                        RecordingViewItem item = (RecordingViewItem) getListView().getItemAtPosition(i);
                        if (!item.isFolder) {
                            position = i;
                            break;
                        }
                    }
                }
                logger.trace("position = {}", position);
                return position;
            }
        };
    }
}

From source file:net.peterkuterna.android.apps.devoxxfrsched.ui.ProgressFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final Context context = getActivity();

    FrameLayout root = new FrameLayout(context);

    LinearLayout pframe = new LinearLayout(context);
    pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID);
    pframe.setOrientation(LinearLayout.VERTICAL);
    pframe.setVisibility(View.GONE);
    pframe.setGravity(Gravity.CENTER);//  w  ww.ja v a  2 s.  c  o  m

    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.FILL_PARENT,
            ViewGroup.LayoutParams.FILL_PARENT));

    FrameLayout cframe = new FrameLayout(context);
    cframe.setId(INTERNAL_CONTENT_CONTAINER_ID);

    TextView tv = new TextView(context);
    tv.setId(INTERNAL_EMPTY_ID);
    tv.setGravity(Gravity.CENTER);
    cframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
            ViewGroup.LayoutParams.FILL_PARENT));

    View contentView = onCreateContentView(inflater, cframe, savedInstanceState);
    cframe.addView(contentView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
            ViewGroup.LayoutParams.FILL_PARENT));

    root.addView(cframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
            ViewGroup.LayoutParams.FILL_PARENT));

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

    return root;
}

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

/**
 * Shows the progress bar indicating that the content is currently being
 * loaded./*w  w w.ja va2s .  c  o  m*/
 */
public void showProgressBar() {
    mProgressBarVisible = true;
    if (getView() != null) {
        LinearLayout progressLayout = (LinearLayout) getView().findViewById(R.id.severity_list_progress_layout);
        if (progressLayout != null)
            progressLayout.setVisibility(View.VISIBLE);
    }
}

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

/**
 * Dismisses the progress bar./*w ww  .  java 2s  .c o m*/
 */
public void dismissProgressBar() {
    mProgressBarVisible = false;
    if (getView() != null) {
        LinearLayout progressLayout = (LinearLayout) getView().findViewById(R.id.severity_list_progress_layout);
        if (progressLayout != null) {
            progressLayout.setVisibility(View.GONE);
        }
        ProgressBar listProgress = (ProgressBar) getView().findViewById(R.id.severity_list_progress);
        listProgress.setProgress(0);
    }
}