Example usage for android.view ViewGroup getAlpha

List of usage examples for android.view ViewGroup getAlpha

Introduction

In this page you can find the example usage for android.view ViewGroup getAlpha.

Prototype

@ViewDebug.ExportedProperty(category = "drawing")
public float getAlpha() 

Source Link

Document

The opacity of the view.

Usage

From source file:com.google.android.apps.muzei.settings.SettingsActivity.java

private void updateRenderLocally(boolean renderLocally) {
    if (mRenderLocally == renderLocally) {
        return;//from   w w w.  ja va  2  s  . c  om
    }

    mRenderLocally = renderLocally;

    final View uiContainer = findViewById(R.id.container);
    final ViewGroup localRenderContainer = (ViewGroup) findViewById(R.id.local_render_container);

    FragmentManager fm = getSupportFragmentManager();
    Fragment localRenderFragment = fm.findFragmentById(R.id.local_render_container);
    if (mRenderLocally) {
        if (localRenderFragment == null) {
            fm.beginTransaction()
                    .add(R.id.local_render_container, MuzeiRendererFragment.createInstance(false, false))
                    .commit();
        }
        if (localRenderContainer.getAlpha() == 1) {
            localRenderContainer.setAlpha(0);
        }
        localRenderContainer.setVisibility(View.VISIBLE);
        localRenderContainer.animate().alpha(1).setDuration(2000).withEndAction(null);
        uiContainer.setBackgroundColor(0x00000000); // for ripple touch feedback
    } else {
        if (localRenderFragment != null) {
            fm.beginTransaction().remove(localRenderFragment).commit();
        }
        localRenderContainer.animate().alpha(0).setDuration(1000).withEndAction(new Runnable() {
            @Override
            public void run() {
                localRenderContainer.setVisibility(View.GONE);
            }
        });
        uiContainer.setBackground(null);
    }
}