Example usage for android.graphics PixelFormat RGBA_8888

List of usage examples for android.graphics PixelFormat RGBA_8888

Introduction

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

Prototype

int RGBA_8888

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

Click Source Link

Usage

From source file:com.todoroo.astrid.actfm.ActFmLoginActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ContextManager.setContext(this);

    setContentView(getContentViewResource());
    if (getTitleResource() != 0)
        setTitle(getTitleResource());//from  www .j av  a 2s.com

    if (getSupportActionBar() != null)
        getSupportActionBar().hide();

    rand = new Random(DateUtilities.now());

    initializeUI();

    getWindow().setFormat(PixelFormat.RGBA_8888);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_DITHER);

    recordPageView();

    setResult(RESULT_CANCELED);
}

From source file:com.example.gangzhang.myapplication.VideoPlayerActivity.java

/**
 *
 * Called when the activity is first created.
 *//*from   w ww .  jav  a2  s. c  o  m*/
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    Log.d(TAG, "onCreate");

    requestWindowFeature(Window.FEATURE_NO_TITLE);//??

    Vitamio.isInitialized(this.getApplicationContext());
    setContentView(R.layout.videoview);
    mPreview = (SurfaceView) findViewById(R.id.surface);
    mPreview.setClickable(false);
    holder = mPreview.getHolder();
    holder.addCallback(this);
    holder.setFormat(PixelFormat.RGBA_8888);

    mProgressBar = (ImageView) findViewById(R.id.loading);
    mPlayImageView = (ImageView) findViewById(R.id.play);
    mPlayImageView.setOnClickListener(this);

    mImageCapture = (Button) findViewById(R.id.capture);
    mImageCapture.setOnClickListener(this);
    mImageCapture.setEnabled(false);

    mImageRecord = (Button) findViewById(R.id.record);
    mImageRecord.setOnClickListener(this);

    extras = getIntent().getExtras();

    operatingAnim = AnimationUtils.loadAnimation(this, R.anim.loading_anim);
    LinearInterpolator lin = new LinearInterpolator();
    operatingAnim.setInterpolator(lin);

    sp = getSharedPreferences(SettingFragment.KEY_SETTING, PreferenceActivity.MODE_PRIVATE);
    hardEnabled = sp.getBoolean(SettingFragment.KEY_HARD_DECODER, false);

    //        byte[] bt= new byte[]{};
    //        load();
    //        initH264(bt);

}

From source file:cn.edu.sdu.online.activity.FragmentTabsPager.java

private void createView() {
    floatView = new FloatView(getApplicationContext());
    floatView.setOnClickListener(new imageviewListener());
    floatView.setImageResource(R.drawable.releasetask);
    windowManager = (WindowManager) getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
    windowManagerParams = ((FloatApplication) getApplication()).getWindowParams();
    windowManagerParams.type = LayoutParams.TYPE_PHONE;
    windowManagerParams.format = PixelFormat.RGBA_8888;
    windowManagerParams.flags = LayoutParams.FLAG_NOT_TOUCH_MODAL | LayoutParams.FLAG_NOT_FOCUSABLE;
    windowManagerParams.gravity = Gravity.LEFT | Gravity.TOP;

    windowManagerParams.x = 8;//from  ww  w. ja v a2s .  c o m
    windowManagerParams.y = height - 260;
    windowManagerParams.width = LayoutParams.WRAP_CONTENT;
    windowManagerParams.height = LayoutParams.WRAP_CONTENT;
    windowManager.addView(floatView, windowManagerParams);
}

From source file:com.waz.zclient.MainActivity.java

/**
 * Sets to RGBA_8888 to ensure fluent gradients.
 *//*from w  w w.ja va  2s  .c  o m*/
@Override
public void onAttachedToWindow() {
    super.onAttachedToWindow();
    Window window = getWindow();
    window.setFormat(PixelFormat.RGBA_8888);
}

From source file:name.gudong.translate.listener.view.TipViewController.java

private WindowManager.LayoutParams getPopViewParams() {
    int w = WindowManager.LayoutParams.MATCH_PARENT;
    int h = WindowManager.LayoutParams.WRAP_CONTENT;

    int flags = 0;
    int type;/*  ww w .j av  a  2s . com*/
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        type = WindowManager.LayoutParams.TYPE_TOAST;
    } else {
        type = WindowManager.LayoutParams.TYPE_PHONE;
    }

    WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(w, h, type, flags,
            PixelFormat.TRANSLUCENT);
    layoutParams.gravity = Gravity.TOP;
    layoutParams.format = PixelFormat.RGBA_8888;
    layoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
            | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;

    layoutParams.gravity = Gravity.CENTER | Gravity.TOP;
    layoutParams.x = 0;
    layoutParams.y = 0;
    return layoutParams;
}

From source file:com.apptentive.android.sdk.ViewActivity.java

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

    try {/*from  www . ja v a 2 s  .  c o m*/
        requestWindowFeature(Window.FEATURE_NO_TITLE);

        String activityContentTypeString = getIntent().getStringExtra(ActivityContent.KEY);
        String parseStringExtra = getIntent().getStringExtra("com.parse.Data");

        if (activityContentTypeString != null) {
            Log.v("Started ViewActivity normally for %s.", activityContent);
            activeContentType = ActivityContent.Type.parse(activityContentTypeString);

            try {
                switch (activeContentType) {
                case ABOUT:
                    break;
                case MESSAGE_CENTER:
                    break;
                case INTERACTION:
                    String interactionString = getIntent().getExtras().getCharSequence(Interaction.KEY_NAME)
                            .toString();
                    Interaction interaction = Interaction.Factory.parseInteraction(interactionString);
                    switch (interaction.getType()) {
                    case UpgradeMessage:
                        activityContent = new UpgradeMessageInteractionView(
                                (UpgradeMessageInteraction) interaction);
                        break;
                    case EnjoymentDialog:
                        activityContent = new EnjoymentDialogInteractionView(
                                (EnjoymentDialogInteraction) interaction);
                        break;
                    case RatingDialog:
                        activityContent = new RatingDialogInteractionView(
                                (RatingDialogInteraction) interaction);
                        break;
                    case AppStoreRating:
                        activityContent = new AppStoreRatingInteractionView(
                                (AppStoreRatingInteraction) interaction);
                        break;
                    case FeedbackDialog:
                        activityContent = new FeedbackDialogInteractionView(
                                (FeedbackDialogInteraction) interaction);
                        break;
                    case Survey:
                        activityContent = new SurveyInteractionView((SurveyInteraction) interaction);
                        break;
                    case MessageCenter:
                        // For now, we use the old method.
                        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
                        finish();
                        Apptentive.showMessageCenter(this);
                        return;
                    case TextModal:
                        activityContent = new TextModalInteractionView((TextModalInteraction) interaction);
                        break;
                    case NavigateToLink:
                        activityContent = new NavigateToLinkInteractionView(
                                (NavigateToLinkInteraction) interaction);
                        break;
                    default:
                        break;
                    }
                    if (activityContent == null) {
                        finish();
                    } else {
                        activityContent.onCreate(this, savedInstanceState);
                    }
                    break;
                default:
                    Log.w("No Activity specified. Finishing...");
                    finish();
                    break;
                }
            } catch (Exception e) {
                Log.e("Error starting ViewActivity.", e);
                MetricModule.sendError(this, e, null, null);
            }
        } else
        // If no content was sent to this Activity, then it may have been started from a Parse push notification.
        if (parseStringExtra != null) {
            Log.i("Started ViewActivity from Parse push.");

            // Save off the callback Activity if one was passed in.
            pushCallbackActivityName = ApptentiveInternal.getPushCallbackActivityName();

            // If the callback is null and we got here, then the developer forgot to set it.
            if (pushCallbackActivityName != null) {
                returnToPushCallbackActivity = true;
                JSONObject parseJson = new JSONObject(parseStringExtra);
                String apptentiveStringData = parseJson.optString(Apptentive.APPTENTIVE_PUSH_EXTRA_KEY);
                JSONObject apptentiveJson = new JSONObject(apptentiveStringData);
                ApptentiveInternal.PushAction action = ApptentiveInternal.PushAction
                        .parse(apptentiveJson.getString(ApptentiveInternal.PUSH_ACTION));
                switch (action) {
                case pmc:
                    activeContentType = ActivityContent.Type.MESSAGE_CENTER;
                    break;
                default:
                    break;
                }
            } else {
                Log.a("Push callback Activity was not set. Make sure to call Apptentive.setPushCallback()");
                if (GlobalInfo.isAppDebuggable) {
                    Toast.makeText(this,
                            "Push callback Activity was not set. Make sure to call Apptentive.setPushCallback()",
                            Toast.LENGTH_LONG).show();
                }
                finish();
            }
        } else {
            Log.e("Started ViewActivity in a bad way.");
        }
    } catch (Exception e) {
        Log.e("Error creating ViewActivity.", e);
        MetricModule.sendError(this, e, null, null);
    }
    if (activeContentType == null) {
        finish();
    }
    Window window = getWindow();
    window.setFormat(PixelFormat.RGBA_8888);
    window.addFlags(WindowManager.LayoutParams.FLAG_DITHER);
}

From source file:com.mitre.holdshort.MainActivity.java

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

    startTime = System.currentTimeMillis();
    getWindow().setFormat(PixelFormat.RGBA_8888);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_DITHER);
    // No need to have the title bar. Just takes up space
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    // Let's first check the date/time and see if we're
    // within the time frame of the app

    // Set up expiration date
    Calendar cal = new GregorianCalendar(2012, 1, 1);

    // Check and make sure the consent has been agreed to
    settings = getSharedPreferences(PREFS_NAME, 0);
    if (settings.getBoolean("consent", false)) {
        waiverAccept = true;//w  ww  . jav a 2  s  . co m
        startUp();
    } else {
        showDisclaimer();
    }

}

From source file:com.vuze.android.remote.activity.LoginActivity.java

@Override
public void onAttachedToWindow() {
    super.onAttachedToWindow();
    getWindow().setFormat(PixelFormat.RGBA_8888);
}

From source file:org.osm.keypadmapper2.KeypadMapper2Activity.java

@Override
public void onAttachedToWindow() {
    super.onAttachedToWindow();
    Window window = getWindow();//from  ww w  .  jav a2s  . c  om
    window.setFormat(PixelFormat.RGBA_8888);
    window.setFlags(WindowManager.LayoutParams.FLAG_DITHER, WindowManager.LayoutParams.FLAG_DITHER);
    Log.d(TAG, "attached to window");
}

From source file:com.flyingcrop.ScreenCaptureFragment.java

public void saveImage() {
    if (mMediaProjection != null) {

        final Notification.Builder builder = new Notification.Builder(getActivity())
                .setContentTitle(getResources().getString(R.string.fragment_saving_crop))
                .setContentText(getResources().getString(R.string.fragment_wait))
                .setSmallIcon(com.flyingcrop.R.drawable.ab_ico);

        final NotificationManager notificationManager = (NotificationManager) getActivity()
                .getSystemService(Context.NOTIFICATION_SERVICE);

        notificationManager.notify(1, builder.build());

        STORE_DIRECTORY = storage;/*from  w  ww  .  j  a va 2s  . c  om*/

        int flags = DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY
                | DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC;

        mImageReader = ImageReader.newInstance(mWidth, mHeight, PixelFormat.RGBA_8888, 2);
        mMediaProjection.createVirtualDisplay("screencap", mWidth, mHeight, mScreenDensity, flags,
                mImageReader.getSurface(), new VirtualDisplayCallback(), mHandler);
        if (ServiceIsRunning()) {
            Intent mIntent = new Intent(getActivity(), Brush.class);
            getActivity().bindService(mIntent, mConnection, Context.BIND_AUTO_CREATE);
        }

        mImageReader.setOnImageAvailableListener(new ImageReader.OnImageAvailableListener() {

            @Override
            public void onImageAvailable(ImageReader reader) {

                image_available = true;

                Log.d("teste", "image_available : " + image_available.toString());

                try {

                    final long time_now = System.currentTimeMillis();
                    image = mImageReader.acquireLatestImage();

                    Log.i(TAG, "Time 1 " + (System.currentTimeMillis() - time_now));

                    if (image != null) {

                        if (ServiceIsRunning()) {
                            if (loop == 0) {
                                View v = mServer.getView();
                                WindowManager wm = mServer.getWindowM();
                                if (v != null)
                                    wm.removeViewImmediate(v);
                                else
                                    mServer.removeAllView();

                            }
                            loop++;
                        }

                        if (!isFolder()) {
                            Notification.Builder builder = new Notification.Builder(getActivity())
                                    .setContentTitle(getResources().getString(R.string.fragment_error))
                                    .setContentText(getResources().getString(R.string.fragment_error_access))
                                    .setSmallIcon(com.flyingcrop.R.drawable.ab_ico);
                            Toast.makeText(getActivity(),
                                    getResources().getString(R.string.fragment_error_toast), Toast.LENGTH_SHORT)
                                    .show();

                            NotificationManager notificationManager = (NotificationManager) getActivity()
                                    .getSystemService(Context.NOTIFICATION_SERVICE);

                            notificationManager.notify(1, builder.build());

                            getActivity().finish();
                        }

                        savePlanes();

                    }

                } catch (Exception e) {
                    e.printStackTrace();
                } finally {
                    if (fos != null) {
                        try {
                            fos.close();
                        } catch (IOException ioe) {
                            ioe.printStackTrace();
                        }
                    }

                    if (bitmap != null) {
                        bitmap.recycle();
                    }

                    if (image != null) {
                        image.close();
                    }
                }
            }

        }, null);
    }
}