Example usage for android.graphics PixelFormat UNKNOWN

List of usage examples for android.graphics PixelFormat UNKNOWN

Introduction

In this page you can find the example usage for android.graphics PixelFormat UNKNOWN.

Prototype

int UNKNOWN

To view the source code for android.graphics PixelFormat UNKNOWN.

Click Source Link

Usage

From source file:com.luyaozhou.recognizethisforglass.ViewFinder.java

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

    setContentView(R.layout.camera_preview);

    // Set up the camera preview user interface
    getWindow().setFormat(PixelFormat.UNKNOWN);
    SurfaceView surfaceView = (SurfaceView) findViewById(R.id.camerapreview);
    surfaceHolder = surfaceView.getHolder();
    surfaceHolder.addCallback(new SurfaceHolderCallback());
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); // keep screen on
}

From source file:com.github.shareme.gwsmaterialuikit.library.material.drawable.PaddingDrawable.java

@Override
public int getOpacity() {
    return mDrawable != null ? mDrawable.getOpacity() : PixelFormat.UNKNOWN;
}

From source file:android.support.v17.leanback.graphics.CompositeDrawable.java

@Override
public int getOpacity() {
    return PixelFormat.UNKNOWN;
}

From source file:com.imagine.BaseActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    Window win = getWindow();//from   w w w. jav a  2  s  .  c om
    win.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
            | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR);
    super.onCreate(savedInstanceState);
    win.setBackgroundDrawable(null);
    win.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED
            | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
    if (android.os.Build.VERSION.SDK_INT >= 11) {
        // NativeActivity explicitly sets the window format to RGB_565, this is fine in Android 2.3 since we default to that
        // and call setFormat ourselves, but in >= 3.0 we only use ANativeWindow_setBuffersGeometry so set the format back to
        // the default value to avoid a spurious surface destroy & create the next time the window flags are set since it may
        // cause the screen to flash
        win.setFormat(PixelFormat.UNKNOWN);
    }
    // get rid of NativeActivity's view and layout listener, then add our custom view
    View nativeActivityView = findViewById(android.R.id.content);
    nativeActivityView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
    View contentView;
    if (android.os.Build.VERSION.SDK_INT >= 24)
        contentView = new ContentViewV24(this);
    else if (android.os.Build.VERSION.SDK_INT >= 16)
        contentView = new ContentViewV16(this);
    else
        contentView = new ContentViewV9(this);
    setContentView(contentView);
    contentView.requestFocus();
}

From source file:org.appcelerator.titanium.TiBaseActivity.java

@Override
/**//ww w  .  j  av a  2 s .c om
 * When the activity is created, this method adds it to the activity stack and
 * fires a javascript 'create' event.
 * @param savedInstanceState Bundle of saved data.
 */
protected void onCreate(Bundle savedInstanceState) {
    Log.d(TAG, "Activity " + this + " onCreate", Log.DEBUG_MODE);

    TiApplication tiApp = getTiApp();

    if (tiApp.isRestartPending()) {
        super.onCreate(savedInstanceState);
        if (!isFinishing()) {
            finish();
        }
        return;
    }

    // If all the activities has been killed and the runtime has been disposed, we cannot recover one
    // specific activity because the info of the top-most view proxy has been lost (TiActivityWindows.dispose()).
    // In this case, we have to restart the app.
    if (TiBaseActivity.isUnsupportedReLaunch(this, savedInstanceState)) {
        Log.w(TAG, "Runtime has been disposed. Finishing.");
        super.onCreate(savedInstanceState);
        tiApp.scheduleRestart(250);
        finish();
        return;
    }

    TiApplication.addToActivityStack(this);

    // create the activity proxy here so that it is accessible from the activity in all cases
    activityProxy = new ActivityProxy(this);

    // Increment the reference count so we correctly clean up when all of our activities have been destroyed
    KrollRuntime.incrementActivityRefCount();

    Intent intent = getIntent();
    if (intent != null) {
        if (intent.hasExtra(TiC.INTENT_PROPERTY_MESSENGER)) {
            messenger = (Messenger) intent.getParcelableExtra(TiC.INTENT_PROPERTY_MESSENGER);
            msgActivityCreatedId = intent.getIntExtra(TiC.INTENT_PROPERTY_MSG_ACTIVITY_CREATED_ID, -1);
            msgId = intent.getIntExtra(TiC.INTENT_PROPERTY_MSG_ID, -1);
        }

        if (intent.hasExtra(TiC.PROPERTY_WINDOW_PIXEL_FORMAT)) {
            getWindow().setFormat(intent.getIntExtra(TiC.PROPERTY_WINDOW_PIXEL_FORMAT, PixelFormat.UNKNOWN));
        }
    }

    // Doing this on every create in case the activity is externally created.
    TiPlatformHelper.intializeDisplayMetrics(this);

    if (layout == null) {
        layout = createLayout();
    }
    if (intent != null && intent.hasExtra(TiC.PROPERTY_KEEP_SCREEN_ON)) {
        layout.setKeepScreenOn(intent.getBooleanExtra(TiC.PROPERTY_KEEP_SCREEN_ON, layout.getKeepScreenOn()));
    }

    super.onCreate(savedInstanceState);

    // we only want to set the current activity for good in the resume state but we need it right now.
    // save off the existing current activity, set ourselves to be the new current activity temporarily 
    // so we don't run into problems when we give the proxy the event
    Activity tempCurrentActivity = tiApp.getCurrentActivity();
    tiApp.setCurrentActivity(this, this);

    windowCreated();

    if (activityProxy != null) {
        activityProxy.fireSyncEvent(TiC.EVENT_CREATE, null);
    }

    // set the current activity back to what it was originally
    tiApp.setCurrentActivity(this, tempCurrentActivity);

    setContentView(layout);

    sendMessage(msgActivityCreatedId);
    // for backwards compatibility
    sendMessage(msgId);

    // store off the original orientation for the activity set in the AndroidManifest.xml
    // for later use
    originalOrientationMode = getRequestedOrientation();

    if (window != null) {
        window.onWindowActivityCreated();
    }
}

From source file:codetail.graphics.drawables.LayerDrawable.java

@Override
public int getOpacity() {
    if (mOpacityOverride != PixelFormat.UNKNOWN) {
        return mOpacityOverride;
    }/*from w w  w .  j  a v a  2 s.  c o m*/
    return mLayerState.getOpacity();
}

From source file:org.telegram.ui.ActionBar.Theme.java

public static Drawable createBarSelectorDrawable(int color, boolean masked) {
    Drawable drawable;//  w  w w .  java2s.  c om
    if (Build.VERSION.SDK_INT >= 21) {
        Drawable maskDrawable = null;
        if (masked) {
            maskPaint.setColor(0xffffffff);
            maskDrawable = new Drawable() {
                @Override
                public void draw(Canvas canvas) {
                    android.graphics.Rect bounds = getBounds();
                    canvas.drawCircle(bounds.centerX(), bounds.centerY(), AndroidUtilities.dp(18), maskPaint);
                }

                @Override
                public void setAlpha(int alpha) {

                }

                @Override
                public void setColorFilter(ColorFilter colorFilter) {

                }

                @Override
                public int getOpacity() {
                    return PixelFormat.UNKNOWN;
                }
            };
        }
        ColorStateList colorStateList = new ColorStateList(new int[][] { new int[] {} }, new int[] { color });
        return new RippleDrawable(colorStateList, null, maskDrawable);
    } else {
        StateListDrawable stateListDrawable = new StateListDrawable();
        stateListDrawable.addState(new int[] { android.R.attr.state_pressed }, new ColorDrawable(color));
        stateListDrawable.addState(new int[] { android.R.attr.state_focused }, new ColorDrawable(color));
        stateListDrawable.addState(new int[] { android.R.attr.state_selected }, new ColorDrawable(color));
        stateListDrawable.addState(new int[] { android.R.attr.state_activated }, new ColorDrawable(color));
        stateListDrawable.addState(new int[] {}, new ColorDrawable(0x00000000));
        return stateListDrawable;
    }
}