Example usage for android.graphics PixelFormat TRANSLUCENT

List of usage examples for android.graphics PixelFormat TRANSLUCENT

Introduction

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

Prototype

int TRANSLUCENT

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

Click Source Link

Document

System chooses a format that supports translucency (many alpha bits)

Usage

From source file:android.support.design.widget.CircularBorderDrawable.java

@Override
public int getOpacity() {
    return mBorderWidth > 0 ? PixelFormat.TRANSLUCENT : PixelFormat.TRANSPARENT;
}

From source file:eu.sathra.SathraActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mCurrentSathra = this;
    mWasInitiated = false;/*from w ww  .j ava  2 s.  co m*/

    ResourceManager.getInstance().unloadAll();

    mParams = getParameters();

    if (mParams.fullscreen) {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }

    if (mParams.layout == 0) {
        mSurfaceView = new GLSurfaceView(this);
        setContentView(mSurfaceView);
    } else {
        setContentView(mParams.layout);
        mSurfaceView = (GLSurfaceView) findViewById(R.id.surface);
    }

    mSurfaceView.setRenderer(this);
    mSurfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
    mSurfaceView.setPreserveEGLContextOnPause(true);

    // resize view to forced resolution
    if (mParams.width != 0 && mParams.height != 0)
        mSurfaceView.getHolder().setFixedSize(mParams.width, mParams.height);

    SathraAdapter adapter = new SathraAdapter();

    IO.getInstance().registerAdapter(SathraActivity.class, adapter);
    IO.getInstance().registerAdapter(Context.class, adapter);

    mIsRunning = true;

    // setup FPS view

    showFPS(mParams.showFPS);

    setTimeScale(1);

    setAmbientColor(mParams.ambientColor);

    setRequestedOrientation(
            mParams.orientation == Orientation.VERTICAL ? ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
                    : ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    // new CameraNode(this, null, null, true, null, null, null, null);
    // mRootNode.addChild(CameraNode.getActiveCamera());
}

From source file:com.andremion.floatingnavigationview.FloatingNavigationView.java

@NonNull
private static WindowManager.LayoutParams createLayoutParams(int gravity) {
    WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(
            WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.MATCH_PARENT,
            WindowManager.LayoutParams.TYPE_APPLICATION_PANEL,
            WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
                    | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
            PixelFormat.TRANSLUCENT);
    layoutParams.gravity = gravity;/*from w  w  w  .  j a  va  2  s .c o  m*/
    return layoutParams;
}

From source file:com.example.accessibility.OverlayManager.java

void createFeedbackClickView(Context context) {
    //The overlay with visual feedback and scroll buttons is created here. It's a FeedbackClickView.

    mContext = context;//from   ww w  .j  av  a  2s .  c  o m
    // ////////////////////////////////////////////////////////////////////////////////
    // FeedbackClickView
    LayoutParams feedbackParams = new LayoutParams();
    feedbackParams.setTitle("OverlayManager");

    // Set a transparent background
    feedbackParams.format = PixelFormat.TRANSLUCENT;

    // Create an always on top type of window:
    //  TYPE_SYSTEM_ALERT   = touch events are intercepted
    feedbackParams.type = LayoutParams.TYPE_PHONE | LayoutParams.TYPE_SYSTEM_OVERLAY;

    // The whole screen is covered (including status bar)
    feedbackParams.flags = LayoutParams.FLAG_NOT_FOCUSABLE | LayoutParams.FLAG_LAYOUT_IN_SCREEN;
    // ////////////////////////////////////////////////////////////////////////////////

    WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);

    if (mFCV == null) {

        mFCV = new FeedbackClickView(this.getApplicationContext());

        showScrollButtons();
        wm.addView(mFCV, feedbackParams);
    }
    Log.i("prints", "acaba createFeedbackClickView del Overlay");
}

From source file:com.woodblockwithoutco.quickcontroldock.model.impl.actions.flashlight.FlashlightService.java

@Override
public void onCreate() {

    sIsRunning = true;/*w  w  w .  j  a va 2s .co  m*/

    NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
    builder.setContentTitle(getResources().getString(R.string.persistent_flash_active));
    builder.setContentText(getResources().getString(R.string.persistent_flash_active_tap));
    builder.setSmallIcon(R.drawable.ic_persistent_flash);

    builder.setContentIntent(
            PendingIntent.getBroadcast(this, -1, new Intent(getPackageName() + ".STOP_FLASH"), 0));
    startForeground(NOTIFICATION_ID, builder.build());

    mContainer = new LinearLayout(getApplicationContext());
    LinearLayout.LayoutParams lparams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.WRAP_CONTENT);
    mContainer.setLayoutParams(lparams);
    mContainer.setOrientation(LinearLayout.VERTICAL);

    mTurnOffButton = new ImageButton(getApplicationContext());
    mTurnOffButton.setImageResource(R.drawable.ic_persistent_flash);
    mTurnOffButton.setBackgroundColor(0x80000000);
    mTurnOffButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            stopSelf();
        }
    });

    mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
    WindowManager.LayoutParams params = new WindowManager.LayoutParams();
    params.type = ConstantHolder.getLockscreenType();
    params.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
    params.x = 0;
    params.y = 0;
    params.width = WindowManager.LayoutParams.WRAP_CONTENT;
    params.height = params.width;
    params.gravity = Gravity.CENTER;
    params.format = PixelFormat.TRANSLUCENT;

    mContainer.addView(mTurnOffButton);

    String method = TogglesResolver.getFlashlightType(getApplicationContext());

    if (method.equals("default")) {
        mDummySurfaceView = new SurfaceView(getApplicationContext());
        mDummySurfaceView.setAlpha(0.01f);
        ViewGroup.LayoutParams sparams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, 1);
        mDummySurfaceView.setLayoutParams(sparams);
        mFlashManipulator = new DefaultFlashlightManipulator(mDummySurfaceView);
        mContainer.addView(mDummySurfaceView);
    } else if (method.equals("htc")) {
        mFlashManipulator = new HTCFlashlightManipulator();
    } else if (method.equals("nosurfaceview")) {
        mFlashManipulator = new NoSurfaceViewFlashlightManipulator();
    } else {
        mDummySurfaceView = new SurfaceView(getApplicationContext());
        mDummySurfaceView.setAlpha(0.01f);
        ViewGroup.LayoutParams sparams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, 1);
        mDummySurfaceView.setLayoutParams(sparams);
        mFlashManipulator = new DefaultFlashlightManipulator(mDummySurfaceView);
        mContainer.addView(mDummySurfaceView);
    }

    mWindowManager.addView(mContainer, params);

    mHandler = new Handler();
    mActor = new Runnable() {
        @Override
        public void run() {
            mFlashManipulator.turnFlashlightOn();
        }
    };

    mScreenOffReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            mFlashManipulator.turnFlashlightOff();
            mHandler.postDelayed(mActor, 200);
        }
    };

    mStopServiceReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            mFlashManipulator.turnFlashlightOff();
            stopSelf();
        }
    };
    registerReceiver(mScreenOffReceiver, new IntentFilter(Intent.ACTION_SCREEN_OFF));
    registerReceiver(mStopServiceReceiver, new IntentFilter(getPackageName() + ".STOP_FLASH"));
}

From source file:com.acious.android.paginationseekbar.internal.PopupIndicator.java

private WindowManager.LayoutParams createPopupLayout(IBinder token) {
    WindowManager.LayoutParams p = new WindowManager.LayoutParams();
    p.gravity = Gravity.START | Gravity.TOP;
    p.width = ViewGroup.LayoutParams.MATCH_PARENT;
    p.height = ViewGroup.LayoutParams.MATCH_PARENT;
    p.format = PixelFormat.TRANSLUCENT;
    p.flags = computeFlags(p.flags);/*  www.  j  av  a  2s  .com*/
    p.type = WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;
    p.token = token;
    p.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN;
    p.setTitle("PaginationSeekBar Indicator:" + Integer.toHexString(hashCode()));

    return p;
}

From source file:net.yanzm.actionbarprogress.MaterialIndeterminateProgressDrawable.java

@Override
public int getOpacity() {
    int trackColorAlpha = trackColor >>> 24;
    int accentColorAlpha = accentColor >>> 24;
    if (trackColorAlpha == 255 && accentColorAlpha == 255) {
        return PixelFormat.OPAQUE;
    }//w w  w. java 2 s.  c om
    if (trackColorAlpha == 0 && accentColorAlpha == 0) {
        return PixelFormat.TRANSPARENT;
    }
    return PixelFormat.TRANSLUCENT;
}

From source file:at.andreasrohner.spartantimelapserec.BackgroundService.java

@SuppressWarnings("deprecation")
@Override/*from   ww w. j  ava  2  s .  co  m*/
public void onCreate() {
    created = true;

    settings = new RecSettings();
    settings.load(getApplicationContext(),
            PreferenceManager.getDefaultSharedPreferences(getApplicationContext()));

    createNotification(NOTIFICATION_ID);

    if (settings.isSchedRecEnabled() && settings.getSchedRecTime() > System.currentTimeMillis() + 10000) {
        AlarmManager alarmMgr = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
        Intent intent = new Intent(getApplicationContext(), ScheduleReceiver.class);
        PendingIntent alarmIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, intent, 0);

        alarmMgr.set(AlarmManager.RTC_WAKEUP, settings.getSchedRecTime(), alarmIntent);

        stopSelf();
        return;
    }

    // Create new SurfaceView, set its size to 1x1, move
    // it to the top left corner and set this service as a callback
    WindowManager winMgr = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
    surfaceView = new SurfaceView(this);
    // deprecated setting, but required on Android versions prior to 3.0
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB)
        surfaceView.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
    surfaceView.getHolder().addCallback(this);

    LayoutParams layoutParams = new WindowManager.LayoutParams(1, 1,
            WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY, WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
            PixelFormat.TRANSLUCENT);
    layoutParams.gravity = Gravity.LEFT | Gravity.TOP;
    winMgr.addView(surfaceView, layoutParams);

    PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE);
    wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
    wakeLock.setReferenceCounted(false);
    wakeLock.acquire();
}

From source file:com.readystatesoftware.ghostlog.ServerlessLogScreen.java

private void createSystemWindow(Activity activity) {
    final WindowManager.LayoutParams lp = new WindowManager.LayoutParams(viewWidth, viewHeight, 0,
            WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE,
            PixelFormat.TRANSLUCENT);
    lp.gravity = viewGravity;//w  w w.  j a v  a 2  s. com

    setSystemViewBackground(mPrefs.getInt(getString(R.string.pref_bg_opacity), 0));
    mLogBuffer = new LinkedList<LogLine>();
    mLogBufferFiltered = new LinkedList<LogLine>();
    mAdapter = new LogAdapter(mContext, mLogBufferFiltered, TAG);
    mLogListView.setAdapter(mAdapter);
    activity.getWindowManager().addView(mLogListView, lp);
}

From source file:in.sc9.discreteslider.internal.PopupIndicator.java

private WindowManager.LayoutParams createPopupLayout(IBinder token) {
    WindowManager.LayoutParams p = new WindowManager.LayoutParams();
    p.gravity = Gravity.START | Gravity.TOP;
    p.width = ViewGroup.LayoutParams.MATCH_PARENT;
    p.height = ViewGroup.LayoutParams.MATCH_PARENT;
    p.format = PixelFormat.TRANSLUCENT;
    p.flags = computeFlags(p.flags);/*from   w ww  .j a v a 2s .co m*/
    p.type = WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;
    p.token = token;
    p.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN;
    p.setTitle("DiscreteSlider Indicator:" + Integer.toHexString(hashCode()));

    return p;
}