Example usage for android.widget RelativeLayout setVisibility

List of usage examples for android.widget RelativeLayout setVisibility

Introduction

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

Prototype

@RemotableViewMethod
public void setVisibility(@Visibility int visibility) 

Source Link

Document

Set the visibility state of this view.

Usage

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:nl.hnogames.domoticz.app.DomoticzDashboardFragment.java

private void setErrorLayoutMessage(String message) {
    hideListView();/*from  w w w.ja v  a  2s  . co m*/

    RelativeLayout errorLayout = (RelativeLayout) root.findViewById(R.id.errorLayout);
    if (errorLayout != null) {
        errorLayout.setVisibility(View.VISIBLE);
        TextView errorTextMessage = (TextView) root.findViewById(R.id.errorTextMessage);
        errorTextMessage.setText(message);
    } else
        throw new RuntimeException("Layout should have a RelativeLayout defined with the ID of errorLayout");
}

From source file:org.ciasaboark.tacere.activity.SettingsActivity.java

private void drawDoNotDisturbWidgets() {
    Switch doNotDisturbSwitch = (Switch) findViewById(id.doNotDisturbSwitch);
    boolean isDoNotDisturbEnabled = prefs.getDoNotDisturb();
    doNotDisturbSwitch.setChecked(isDoNotDisturbEnabled);
    doNotDisturbSwitch.setEnabled(prefs.getIsServiceActivated());
    findViewById(id.do_not_disturb_box).setEnabled(prefs.getIsServiceActivated());

    TextView doNotDisturbHeader = (TextView) findViewById(id.do_not_disturb_header);
    if (prefs.getIsServiceActivated()) {
        doNotDisturbHeader.setTextColor(getResources().getColor(R.color.textcolor));
    } else {//from   w w w. j  a  va2s .  co m
        doNotDisturbHeader.setTextColor(getResources().getColor(R.color.textColorDisabled));
    }

    int apiLevelAvailable = Build.VERSION.SDK_INT;
    RelativeLayout layout = (RelativeLayout) findViewById(id.do_not_disturb_box);
    if (apiLevelAvailable >= 20) { //TODO this should be 21
        layout.setVisibility(View.VISIBLE);
    } else {
        layout.setVisibility(View.GONE);
    }

}

From source file:com.cssweb.android.quote.KLine2Activity.java

private void setToolbarByScreen(int orientation) {
    if (orientation == 2) {
        RelativeLayout l = (RelativeLayout) findViewById(R.id.zrtoolbar);
        l.setVisibility(View.GONE);
    } else {/*  w w  w .  j ava2  s . co m*/
        RelativeLayout l = (RelativeLayout) findViewById(R.id.zrtoolbar);
        l.setVisibility(View.VISIBLE);
        initToolBar(toolbarname, Global.BAR_TAG);
    }
}

From source file:nl.hnogames.domoticz.app.DomoticzDashboardFragment.java

public void setMessage(String message) {
    RelativeLayout errorLayout = (RelativeLayout) root.findViewById(R.id.errorLayout);
    if (errorLayout != null) {
        errorLayout.setVisibility(View.VISIBLE);

        ImageView errorImage = (ImageView) root.findViewById(R.id.errorImage);
        errorImage.setImageResource(R.drawable.empty);
        errorImage.setAlpha(0.5f);// w w  w.  j ava 2 s  . c o m
        errorImage.setVisibility(View.VISIBLE);

        TextView errorTextWrong = (TextView) root.findViewById(R.id.errorTextWrong);
        errorTextWrong.setVisibility(View.GONE);

        TextView errorTextMessage = (TextView) root.findViewById(R.id.errorTextMessage);
        errorTextMessage.setText(message);
    } else
        throw new RuntimeException("Layout should have a RelativeLayout defined with the ID of errorLayout");
}

From source file:layout.FragmentImage.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_fragment_image, container, false);
    imageView = (SubsamplingScaleImageView) view.findViewById(R.id.imageView);
    gifView = (GifImageView) view.findViewById(R.id.gifView);
    imageView.setVisibility(View.GONE);
    gifView.setVisibility(View.GONE);
    RelativeLayout layoutOpenBrowser = (RelativeLayout) view.findViewById(R.id.layoutOpenBrowser);
    if (boardItemFile.file != null) {
        if (!boardItemFile.file.endsWith(".webm") && !boardItemFile.file.endsWith(".swf")
                && !boardItemFile.file.endsWith(".ogg") && !boardItemFile.file.endsWith(".opus")) {
            layoutOpenBrowser.setVisibility(View.GONE);
            downloadFile();/* www .java2  s.c om*/
        } else {
            layoutOpenBrowser.setVisibility(View.VISIBLE);
        }
    }
    Button btnOpenBrowser = (Button) view.findViewById(R.id.btnLaunchBrowser);
    btnOpenBrowser.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent in = new Intent(Intent.ACTION_VIEW, Uri.parse(boardItemFile.fileURL));
            in.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            v.getContext().startActivity(in);
        }
    });
    return view;
}

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

public void setNavigationBarVisible(boolean isVisible) {
    if (!AppConstants.SHOW_NAV_HEADER)
        return;/*from   w ww  . ja  va 2  s.  c  o  m*/
    final RelativeLayout navBar = (RelativeLayout) findViewById(R.id.nav_bar);
    if (navBar == null) {
        L.d("navBar not found in current activity");
        return;
    }
    navBar.setVisibility(isVisible ? View.VISIBLE : View.GONE);
}

From source file:com.snowdream.wallpaper.adapter.ImagePagerAdapter.java

@Override
public Object instantiateItem(ViewGroup view, int position) {
    LayoutInflater inflater = LayoutInflater.from(mContext);
    View imageLayout = inflater.inflate(R.layout.item_pager_image, view, false);

    // The "loadAdOnCreate" and "testDevices" XML attributes no longer available.
    AdView adView = (AdView) imageLayout.findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
            .addTestDevice(TEST_DEVICE_ID).build();
    adView.loadAd(adRequest);//from   w  ww . j a va 2  s.c om

    PhotoView photoView = (PhotoView) imageLayout.findViewById(R.id.image);
    photoView.setScaleType(ScaleType.FIT_CENTER);

    photoView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (mContext == null) {
                return;
            }

            Activity activity = (Activity) mContext;

            if (!(activity instanceof ImagePagerActivity)) {
                return;
            }

            ((ImagePagerActivity) activity).onImageClick(v);

        }
    });

    final RelativeLayout spinner = (RelativeLayout) imageLayout.findViewById(R.id.rl_loading);
    final String imgUrl = images.get(position).getUrl();

    ImageLoader.getInstance().displayImage(imgUrl, photoView, options, new SimpleImageLoadingListener() {
        @Override
        public void onLoadingStarted(String imageUri, View view) {
            spinner.setVisibility(View.VISIBLE);
        }

        @Override
        public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
            String message = null;
            switch (failReason.getType()) {
            case IO_ERROR:
                message = "Input/Output error";
                break;
            case DECODING_ERROR:
                message = "Image can't be decoded";
                break;
            case NETWORK_DENIED:
                message = "Downloads are denied";
                break;
            case OUT_OF_MEMORY:
                message = "Out Of Memory error";
                break;
            case UNKNOWN:
                message = "Unknown error";
                break;
            }
            // Toast.makeText(ImagePagerActivity.this, message,
            // Toast.LENGTH_SHORT).show();
            Log.e("onLoadingFailed" + message);

            spinner.setVisibility(View.GONE);
        }

        @Override
        public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
            spinner.setVisibility(View.GONE);
        }
    });

    ((ViewPager) view).addView(imageLayout, 0);
    return imageLayout;
}

From source file:com.ultrafunk.network_info.config.ConfigActivity.java

private void initShowWidgetView() {
    RadioGroup showWidgetRadioGroup = (RadioGroup) findViewById(R.id.showWidgetRadioGroup);

    if (widgetConfig.showBothWidgets())
        showWidgetRadioGroup.check(R.id.showBothRadioButton);
    else if (widgetConfig.showMobileDataWidget())
        showWidgetRadioGroup.check(R.id.showMobileRadioButton);
    else/*from   w  w w  .  j  av  a  2 s.  c  o m*/
        showWidgetRadioGroup.check(R.id.showWifiRadioButton);

    showWidgetRadioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
        public void onCheckedChanged(RadioGroup radioGroup, int checkedId) {
            RelativeLayout mobileSettingsScreenRelativeLayout = (RelativeLayout) findViewById(
                    R.id.mobileSettingsScreenRelativeLayout);

            widgetConfig.setBothWidgets(false);

            if (checkedId == R.id.showBothRadioButton) {
                widgetConfig.setBothWidgets(true);
                mobileSettingsScreenRelativeLayout.setVisibility(View.VISIBLE);
            }

            if (checkedId == R.id.showMobileRadioButton) {
                widgetConfig.setMobileDataWidget(true);
                mobileSettingsScreenRelativeLayout.setVisibility(View.VISIBLE);
            }

            if (checkedId == R.id.showWifiRadioButton) {
                widgetConfig.setWifiWidget(true);
                mobileSettingsScreenRelativeLayout.setVisibility(View.GONE);
            }
        }
    });
}

From source file:com.inter.trade.imageframe.ImageWorker.java

/**
 * Load an image specified by the data parameter into an ImageView (override
 * {@link ImageWorker#processBitmap(Object)} to define the processing logic). A memory and
 * disk cache will be used if an {@link ImageCache} has been added using
 * {@link ImageWorker#addImageCache(FragmentManager, ImageCache.ImageCacheParams)}. If the
 * image is found in the memory cache, it is set immediately, otherwise an {@link AsyncTask}
 * will be created to asynchronously load the bitmap.
 *
 * @param data The URL of the image to download.
 * @param imageView The ImageView to bind the downloaded image to.
 *///from   ww  w  .  ja v a  2s.  c o  m
public void loadImage(Object data, ImageView imageView) {

    if (mLoadPause) {
        return;
    }

    if (data == null) {
        return;
    }

    BitmapDrawable value = null;

    if (mImageCache != null) {
        value = mImageCache.getBitmapFromMemCache(String.valueOf(data));
    }

    if (value != null) {
        // Bitmap found in memory cache
        imageView.setImageDrawable(value);
        RelativeLayout mLayout = (RelativeLayout) imageView.getTag();
        if (mLayout != null) {
            mLayout.setVisibility(View.GONE);
        }
    } else if (cancelPotentialWork(data, imageView)) {
        final BitmapWorkerTask task = new BitmapWorkerTask(imageView);
        final AsyncDrawable asyncDrawable = new AsyncDrawable(mResources, mLoadingBitmap, task);
        imageView.setImageDrawable(asyncDrawable);

        // NOTE: This uses a custom version of AsyncTask that has been pulled from the
        // framework and slightly modified. Refer to the docs at the top of the class
        // for more info on what was changed.

        task.executeOnExecutor(AsyncTask.DUAL_THREAD_EXECUTOR, data);
        //            task.execute(data);
    }
}