Java Code Examples for android.graphics.PixelFormat

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project android-flip, under directory /FlipView/FlipLibrary/src/com/aphidmobile/flip/.

Source file: FlipViewController.java

  19 
vote

private void setupSurfaceView(){
  surfaceView=new GLSurfaceView(getContext());
  cards=new FlipCards(this);
  renderer=new FlipRenderer(this,cards);
  surfaceView.setEGLConfigChooser(8,8,8,8,16,0);
  surfaceView.setZOrderOnTop(true);
  surfaceView.setRenderer(renderer);
  surfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
  surfaceView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
  addViewInLayout(surfaceView,-1,new AbsListView.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT),false);
}
 

Example 2

From project android-voip-service, under directory /src/main/java/org/linphone/.

Source file: GL2JNIView.java

  19 
vote

private void init(boolean translucent,int depth,int stencil){
  if (translucent) {
    this.getHolder().setFormat(PixelFormat.TRANSLUCENT);
  }
  setEGLContextFactory(new ContextFactory());
  setEGLConfigChooser(translucent ? new ConfigChooser(8,8,8,8,depth,stencil) : new ConfigChooser(5,6,5,0,depth,stencil));
}
 

Example 3

From project AndroidSensorLogger, under directory /src/com/sstp/androidsensorlogger/.

Source file: CameraActivity.java

  19 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  Log.d(TAG,"onCreate");
  super.onCreate(savedInstanceState);
  getWindow().setFormat(PixelFormat.TRANSLUCENT);
  setContentView(R.layout.main2);
  surfaceView=(SurfaceView)findViewById(R.id.camera_surface);
  Log.d(TAG,"got surface view");
  surfaceHolder=surfaceView.getHolder();
  Log.d(TAG,"got surface holder");
  surfaceHolder.addCallback(this);
  surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
  Log.d(TAG,"surface holder type was set");
}
 

Example 4

From project android_8, under directory /src/com/defuzeme/playqueue/.

Source file: DnDList.java

  19 
vote

private void startDrag(int itemIndex,int y){
  stopDrag(itemIndex);
  final View item=getChildAt(itemIndex);
  if (item == null)   return;
  item.setDrawingCacheEnabled(true);
  if (mDragListener != null)   mDragListener.onStartDrag(item);
  final Bitmap bitmap=Bitmap.createBitmap(item.getDrawingCache());
  final WindowManager.LayoutParams mWindowParams=new WindowManager.LayoutParams();
  mWindowParams.gravity=Gravity.TOP;
  mWindowParams.x=0;
  mWindowParams.y=y - mDragPointOffset;
  mWindowParams.height=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.width=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
  mWindowParams.format=PixelFormat.TRANSLUCENT;
  mWindowParams.windowAnimations=0;
  final Context context=getContext();
  final ImageView v=new ImageView(context);
  v.setImageBitmap(bitmap);
  final WindowManager mWindowManager=(WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
  mWindowManager.addView(v,mWindowParams);
  mDragView=v;
}
 

Example 5

From project android_packages_apps_cmparts, under directory /src/com/cyanogenmod/cmparts/widgets/.

Source file: TouchInterceptor.java

  19 
vote

private void startDragging(Bitmap bm,int y){
  stopDragging();
  mWindowParams=new WindowManager.LayoutParams();
  mWindowParams.gravity=Gravity.TOP;
  mWindowParams.x=0;
  mWindowParams.y=y - mDragPoint + mCoordOffset;
  mWindowParams.height=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.width=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
  mWindowParams.format=PixelFormat.TRANSLUCENT;
  mWindowParams.windowAnimations=0;
  Context context=getContext();
  ImageView v=new ImageView(context);
  int backGroundColor=context.getResources().getColor(R.color.dragndrop_background);
  v.setBackgroundColor(backGroundColor);
  v.setImageBitmap(bm);
  mDragBitmap=bm;
  mWindowManager=(WindowManager)context.getSystemService("window");
  mWindowManager.addView(v,mWindowParams);
  mDragView=v;
}
 

Example 6

From project android_packages_apps_CMSettings, under directory /src/com/cyanogenmod/settings/widgets/.

Source file: TouchInterceptor.java

  19 
vote

private void startDragging(Bitmap bm,int y){
  stopDragging();
  mWindowParams=new WindowManager.LayoutParams();
  mWindowParams.gravity=Gravity.TOP;
  mWindowParams.x=0;
  mWindowParams.y=y - mDragPoint + mCoordOffset;
  mWindowParams.height=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.width=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
  mWindowParams.format=PixelFormat.TRANSLUCENT;
  mWindowParams.windowAnimations=0;
  Context context=getContext();
  ImageView v=new ImageView(context);
  int backGroundColor=context.getResources().getColor(R.color.dragndrop_background);
  v.setBackgroundColor(backGroundColor);
  v.setImageBitmap(bm);
  mDragBitmap=bm;
  mWindowManager=(WindowManager)context.getSystemService("window");
  mWindowManager.addView(v,mWindowParams);
  mDragView=v;
}
 

Example 7

From project android_packages_apps_Gallery, under directory /src/com/android/camera/.

Source file: OnScreenHint.java

  19 
vote

/** 
 * Construct an empty OnScreenHint object.  You must call  {@link #setView}before you can call  {@link #show}.
 * @param context  The context to use.  Usually your{@link android.app.Application} or{@link android.app.Activity} object.
 */
public OnScreenHint(Context context){
  mContext=context;
  mWM=(WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
  mY=context.getResources().getDimensionPixelSize(R.dimen.hint_y_offset);
  mParams.height=WindowManager.LayoutParams.WRAP_CONTENT;
  mParams.width=WindowManager.LayoutParams.WRAP_CONTENT;
  mParams.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
  mParams.format=PixelFormat.TRANSLUCENT;
  mParams.windowAnimations=R.style.Animation_OnScreenHint;
  mParams.type=WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;
  mParams.setTitle("OnScreenHint");
}
 

Example 8

From project android_packages_apps_Gallery2, under directory /src/com/android/gallery3d/ui/.

Source file: GLRootView.java

  19 
vote

public GLRootView(Context context,AttributeSet attrs){
  super(context,attrs);
  mFlags|=FLAG_INITIALIZED;
  setBackgroundDrawable(null);
  setEGLConfigChooser(mEglConfigChooser);
  setRenderer(this);
  getHolder().setFormat(PixelFormat.RGB_565);
}
 

Example 9

From project android_packages_apps_Gallery3D, under directory /src/com/cooliris/media/.

Source file: RenderView.java

  19 
vote

public RenderView(final Context context){
  super(context);
  setBackgroundDrawable(null);
  setFocusable(true);
  if (getResources().getBoolean(R.bool.use_32bpp_display)) {
    setEGLConfigChooser(8,8,8,8,16,0);
    getHolder().setFormat(PixelFormat.RGBA_8888);
  }
  setRenderer(this);
  mSensorManager=(SensorManager)context.getSystemService(Context.SENSOR_SERVICE);
  if (sCachedTextureLoadThread == null) {
    for (int i=0; i != NUM_TEXTURE_LOAD_THREADS; ++i) {
      TextureLoadThread thread=new TextureLoadThread();
      if (i == 0) {
        sCachedTextureLoadThread=thread;
      }
      if (i == 1) {
        sVideoTextureLoadThread=thread;
      }
      sTextureLoadThreads[i]=thread;
      thread.start();
    }
  }
}
 

Example 10

From project android_packages_apps_phone, under directory /src/com/android/phone/.

Source file: InCallScreen.java

  19 
vote

private void initInCallScreen(){
  if (VDBG)   log("initInCallScreen()...");
  getWindow().addFlags(WindowManager.LayoutParams.FLAG_IGNORE_CHEEK_PRESSES);
  getWindow().setFormat(PixelFormat.RGBX_8888);
  mMainFrame=(ViewGroup)findViewById(R.id.mainFrame);
  mInCallPanel=(ViewGroup)findViewById(R.id.inCallPanel);
  mCallCard=(CallCard)findViewById(R.id.callCard);
  if (VDBG)   log("  - mCallCard = " + mCallCard);
  mCallCard.setInCallScreenInstance(this);
  initInCallTouchUi();
  mInCallControlState=new InCallControlState(this,mCM);
  mManageConferenceUtils=new ManageConferenceUtils(this,mCM);
}
 

Example 11

From project android_packages_apps_SalvageParts, under directory /src/com/salvagemod/salvageparts/widgets/.

Source file: TouchInterceptor.java

  19 
vote

private void startDragging(Bitmap bm,int y){
  stopDragging();
  mWindowParams=new WindowManager.LayoutParams();
  mWindowParams.gravity=Gravity.TOP;
  mWindowParams.x=0;
  mWindowParams.y=y - mDragPoint + mCoordOffset;
  mWindowParams.height=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.width=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
  mWindowParams.format=PixelFormat.TRANSLUCENT;
  mWindowParams.windowAnimations=0;
  Context context=getContext();
  ImageView v=new ImageView(context);
  int backGroundColor=context.getResources().getColor(R.color.dragndrop_background);
  v.setBackgroundColor(backGroundColor);
  v.setImageBitmap(bm);
  mDragBitmap=bm;
  mWindowManager=(WindowManager)context.getSystemService("window");
  mWindowManager.addView(v,mWindowParams);
  mDragView=v;
}
 

Example 12

From project beintoo-android-sdk, under directory /BeintooSDK/src/com/beintoo/activities/mission/.

Source file: MissionAchievementMessage.java

  19 
vote

public void show(){
  WindowManager.LayoutParams mParams=new WindowManager.LayoutParams();
  mParams.gravity=Gravity.BOTTOM;
  mParams.height=WindowManager.LayoutParams.WRAP_CONTENT;
  mParams.width=WindowManager.LayoutParams.FILL_PARENT;
  mParams.flags=WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
  mParams.format=PixelFormat.TRANSLUCENT;
  mParams.type=WindowManager.LayoutParams.TYPE_TOAST;
  mParams.windowAnimations=android.R.style.Animation_Toast;
  wM.addView(container,mParams);
  mHandler=new Handler();
  mHandler.postDelayed(mRunnable,5000);
}
 

Example 13

From project Book-Catalogue, under directory /src/com/eleybourn/bookcatalogue/.

Source file: TouchListView.java

  19 
vote

private void startDragging(Bitmap bm,int x,int y){
  stopDragging();
  mWindowParams=new WindowManager.LayoutParams();
  mWindowParams.gravity=Gravity.TOP | Gravity.LEFT;
  mWindowParams.x=x;
  mWindowParams.y=y - mDragPoint + mCoordOffset;
  mWindowParams.height=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.width=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
  mWindowParams.format=PixelFormat.TRANSLUCENT;
  mWindowParams.windowAnimations=0;
  ImageView v=new ImageView(getContext());
  v.setBackgroundColor(dragndropBackgroundColor);
  v.setImageBitmap(bm);
  mDragBitmap=bm;
  mWindowManager=(WindowManager)getContext().getSystemService("window");
  mWindowManager.addView(v,mWindowParams);
  mDragView=v;
}
 

Example 14

From project Catroid-maven-playground, under directory /src/main/java/at/tugraz/ist/catroid/ui/dragndrop/.

Source file: DragAndDropListView.java

  19 
vote

private WindowManager.LayoutParams createLayoutParameters(){
  WindowManager.LayoutParams windowParameters=new WindowManager.LayoutParams();
  windowParameters.gravity=Gravity.TOP | Gravity.LEFT;
  windowParameters.height=WindowManager.LayoutParams.WRAP_CONTENT;
  windowParameters.width=getWidth() - originalTrashWidth + 2;
  windowParameters.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
  windowParameters.format=PixelFormat.TRANSLUCENT;
  return windowParameters;
}
 

Example 15

From project cornerstone, under directory /frameworks/base/core/java/android/view/.

Source file: ViewRootImpl.java

  19 
vote

private void enableHardwareAcceleration(WindowManager.LayoutParams attrs){
  mAttachInfo.mHardwareAccelerated=false;
  mAttachInfo.mHardwareAccelerationRequested=false;
  if (mTranslator != null)   return;
  final boolean hardwareAccelerated=(attrs.flags & WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED) != 0;
  if (hardwareAccelerated) {
    if (!HardwareRenderer.isAvailable()) {
      return;
    }
    final boolean fakeHwAccelerated=(attrs.privateFlags & WindowManager.LayoutParams.PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED) != 0;
    final boolean forceHwAccelerated=(attrs.privateFlags & WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED) != 0;
    if (!HardwareRenderer.sRendererDisabled || (HardwareRenderer.sSystemRendererDisabled && forceHwAccelerated)) {
      if (!HardwareRenderer.sSystemRendererDisabled && Looper.getMainLooper() != Looper.myLooper()) {
        Log.w(HardwareRenderer.LOG_TAG,"Attempting to initialize hardware " + "acceleration outside of the main thread, aborting");
        return;
      }
      final boolean translucent=attrs.format != PixelFormat.OPAQUE;
      if (mAttachInfo.mHardwareRenderer != null) {
        mAttachInfo.mHardwareRenderer.destroy(true);
      }
      mAttachInfo.mHardwareRenderer=HardwareRenderer.createGlRenderer(2,translucent);
      mAttachInfo.mHardwareAccelerated=mAttachInfo.mHardwareAccelerationRequested=mAttachInfo.mHardwareRenderer != null;
    }
 else     if (fakeHwAccelerated) {
      mAttachInfo.mHardwareAccelerationRequested=true;
    }
  }
}
 

Example 16

From project COSsettings, under directory /src/com/cyanogenmod/cmparts/widgets/.

Source file: TouchInterceptor.java

  19 
vote

private void startDragging(Bitmap bm,int y){
  stopDragging();
  mWindowParams=new WindowManager.LayoutParams();
  mWindowParams.gravity=Gravity.TOP;
  mWindowParams.x=0;
  mWindowParams.y=y - mDragPoint + mCoordOffset;
  mWindowParams.height=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.width=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
  mWindowParams.format=PixelFormat.TRANSLUCENT;
  mWindowParams.windowAnimations=0;
  Context context=getContext();
  ImageView v=new ImageView(context);
  int backGroundColor=context.getResources().getColor(R.color.dragndrop_background);
  v.setBackgroundColor(backGroundColor);
  v.setImageBitmap(bm);
  mDragBitmap=bm;
  mWindowManager=(WindowManager)context.getSystemService("window");
  mWindowManager.addView(v,mWindowParams);
  mDragView=v;
}
 

Example 17

From project creamed_glacier_app_settings, under directory /src/com/android/settings/cyanogenmod/.

Source file: TouchInterceptor.java

  19 
vote

private void startDragging(Bitmap bm,int y){
  stopDragging();
  mWindowParams=new WindowManager.LayoutParams();
  mWindowParams.gravity=Gravity.TOP;
  mWindowParams.x=0;
  mWindowParams.y=y - mDragPoint + mCoordOffset;
  mWindowParams.height=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.width=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
  mWindowParams.format=PixelFormat.TRANSLUCENT;
  mWindowParams.windowAnimations=0;
  Context context=getContext();
  ImageView v=new ImageView(context);
  int backGroundColor=context.getResources().getColor(R.color.dragndrop_background);
  v.setBackgroundColor(backGroundColor);
  v.setImageBitmap(bm);
  mDragBitmap=bm;
  mWindowManager=(WindowManager)context.getSystemService("window");
  mWindowManager.addView(v,mWindowParams);
  mDragView=v;
}
 

Example 18

From project cw-advandroid, under directory /Media/Video/src/com/commonsware/android/video/.

Source file: VideoDemo.java

  19 
vote

@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  getWindow().setFormat(PixelFormat.TRANSLUCENT);
  setContentView(R.layout.main);
  File clip=new File(Environment.getExternalStorageDirectory(),"test.mp4");
  if (clip.exists()) {
    video=(VideoView)findViewById(R.id.video);
    video.setVideoPath(clip.getAbsolutePath());
    ctlr=new MediaController(this);
    ctlr.setMediaPlayer(video);
    video.setMediaController(ctlr);
    video.requestFocus();
    video.start();
  }
}
 

Example 19

From project cw-omnibus, under directory /Media/Video/src/com/commonsware/android/video/.

Source file: VideoDemo.java

  19 
vote

@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  getWindow().setFormat(PixelFormat.TRANSLUCENT);
  setContentView(R.layout.main);
  File clip=new File(Environment.getExternalStorageDirectory(),"test.mp4");
  if (clip.exists()) {
    video=(VideoView)findViewById(R.id.video);
    video.setVideoPath(clip.getAbsolutePath());
    ctlr=new MediaController(this);
    ctlr.setMediaPlayer(video);
    video.setMediaController(ctlr);
    video.requestFocus();
    video.start();
  }
}
 

Example 20

From project DigitbooksExamples, under directory /DigitbooksExamples/src/fr/digitbooks/android/examples/chapitre10/.

Source file: GLSurfaceViewTranslucent.java

  19 
vote

public GLSurfaceViewTranslucent(Context context,AttributeSet attrs){
  super(context,attrs);
  setEGLConfigChooser(8,8,8,8,16,0);
  getHolder().setFormat(PixelFormat.TRANSLUCENT);
  setRenderer(this);
}
 

Example 21

From project dmix, under directory /MPDroid/src/com/namelessdev/mpdroid/views/.

Source file: TouchInterceptor.java

  19 
vote

private void startDragging(Bitmap bm,int y){
  stopDragging();
  mWindowParams=new WindowManager.LayoutParams();
  mWindowParams.gravity=Gravity.TOP;
  mWindowParams.x=0;
  mWindowParams.y=y - mDragPoint + mCoordOffset;
  mWindowParams.height=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.width=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
  mWindowParams.format=PixelFormat.TRANSLUCENT;
  mWindowParams.windowAnimations=0;
  Context context=getContext();
  ImageView v=new ImageView(context);
  int backGroundColor=Color.BLACK;
  v.setBackgroundColor(backGroundColor);
  v.setImageBitmap(bm);
  mDragBitmap=bm;
  mWindowManager=(WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
  mWindowManager.addView(v,mWindowParams);
  mDragView=v;
}
 

Example 22

From project droidgiro-android, under directory /src/se/droidgiro/scanner/camera/.

Source file: CameraManager.java

  19 
vote

/** 
 * A factory method to build the appropriate LuminanceSource object based on the format of the preview buffers, as described by Camera.Parameters.
 * @param data A preview frame.
 * @param width The width of the image.
 * @param height The height of the image.
 * @return A PlanarYUVLuminanceSource instance.
 */
public PlanarYUVLuminanceSource buildLuminanceSource(byte[] data,int width,int height){
  Rect rect=getFramingRectInPreview();
  int previewFormat=configManager.getPreviewFormat();
  String previewFormatString=configManager.getPreviewFormatString();
switch (previewFormat) {
case PixelFormat.YCbCr_420_SP:
case PixelFormat.YCbCr_422_SP:
    return new PlanarYUVLuminanceSource(data,width,height,rect.left,rect.top,rect.width(),rect.height());
default :
  if ("yuv420p".equals(previewFormatString)) {
    return new PlanarYUVLuminanceSource(data,width,height,rect.left,rect.top,rect.width(),rect.height());
  }
}
throw new IllegalArgumentException("Unsupported picture format: " + previewFormat + '/'+ previewFormatString);
}
 

Example 23

From project evodroid, under directory /src/com/sonorth/evodroid/.

Source file: Dashboard.java

  19 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.dashboard);
  getWindow().setFormat(PixelFormat.RGBA_8888);
  getWindow().addFlags(WindowManager.LayoutParams.FLAG_DITHER);
}
 

Example 24

From project fanfoudroid, under directory /src/com/ch_linghu/fanfoudroid/app/.

Source file: ImageManager.java

  19 
vote

public static Bitmap drawableToBitmap(Drawable drawable){
  Bitmap bitmap=Bitmap.createBitmap(drawable.getIntrinsicWidth(),drawable.getIntrinsicHeight(),drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565);
  Canvas canvas=new Canvas(bitmap);
  drawable.setBounds(0,0,drawable.getIntrinsicWidth(),drawable.getIntrinsicHeight());
  drawable.draw(canvas);
  return bitmap;
}
 

Example 25

From project galaxyCar, under directory /AndroidColladaLoader/src/ckt/projects/acl/.

Source file: AndroidColladaLoader.java

  19 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  glView=new GLSurfaceView(this);
  glView.setEGLConfigChooser(8,8,8,8,16,0);
  glView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
  glView.setRenderer(this);
  setContentView(glView);
  assetMgr=getResources().getAssets();
  handler=new ColladaHandler();
}
 

Example 26

From project Game_3, under directory /android/src/playn/android/.

Source file: AndroidGraphics.java

  19 
vote

/** 
 * Determines the most performant pixel format for the active display.
 */
private Bitmap.Config mapDisplayPixelFormat(){
  int format=platform.activity.getWindowManager().getDefaultDisplay().getPixelFormat();
  ActivityManager activityManager=(ActivityManager)platform.activity.getApplication().getSystemService(Context.ACTIVITY_SERVICE);
  int memoryClass=activityManager.getMemoryClass();
  return (format == PixelFormat.RGBA_4444 || memoryClass <= 16) ? Bitmap.Config.ARGB_4444 : Bitmap.Config.ARGB_8888;
}
 

Example 27

From project huiswerk, under directory /print/zxing-1.6/android/src/com/google/zxing/client/android/camera/.

Source file: CameraManager.java

  19 
vote

/** 
 * A factory method to build the appropriate LuminanceSource object based on the format of the preview buffers, as described by Camera.Parameters.
 * @param data A preview frame.
 * @param width The width of the image.
 * @param height The height of the image.
 * @return A PlanarYUVLuminanceSource instance.
 */
public PlanarYUVLuminanceSource buildLuminanceSource(byte[] data,int width,int height){
  Rect rect=getFramingRectInPreview();
  int previewFormat=configManager.getPreviewFormat();
  String previewFormatString=configManager.getPreviewFormatString();
switch (previewFormat) {
case PixelFormat.YCbCr_420_SP:
case PixelFormat.YCbCr_422_SP:
    return new PlanarYUVLuminanceSource(data,width,height,rect.left,rect.top,rect.width(),rect.height());
default :
  if ("yuv420p".equals(previewFormatString)) {
    return new PlanarYUVLuminanceSource(data,width,height,rect.left,rect.top,rect.width(),rect.height());
  }
}
throw new IllegalArgumentException("Unsupported picture format: " + previewFormat + '/'+ previewFormatString);
}
 

Example 28

From project Juggernaut_SystemUI, under directory /src/com/android/systemui/statusbar/.

Source file: StatusBarService.java

  19 
vote

protected void addStatusBarView(){
  Resources res=getResources();
  final int height=res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height);
  final StatusBarView view=mStatusBarView;
  WindowManager.LayoutParams lp=new WindowManager.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,height,WindowManager.LayoutParams.TYPE_STATUS_BAR,WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING,PixelFormat.TRANSLUCENT);
  lp.gravity=Gravity.TOP | Gravity.FILL_HORIZONTAL;
  lp.setTitle("StatusBar");
  lp.windowAnimations=com.android.internal.R.style.Animation_StatusBar;
  mStatusBarView.setVisibility(View.GONE);
  WindowManagerImpl.getDefault().addView(view,lp);
  mMusicControls.setupControls();
}
 

Example 29

From project lullaby, under directory /src/net/sileht/lullaby/.

Source file: TouchInterceptor.java

  19 
vote

private void startDragging(Bitmap bm,int y){
  stopDragging();
  mWindowParams=new WindowManager.LayoutParams();
  mWindowParams.gravity=Gravity.TOP;
  mWindowParams.x=0;
  mWindowParams.y=y - mDragPoint + mCoordOffset;
  mWindowParams.height=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.width=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
  mWindowParams.format=PixelFormat.TRANSLUCENT;
  mWindowParams.windowAnimations=0;
  Context mContext=getContext();
  ImageView v=new ImageView(mContext);
  int backGroundColor=mContext.getResources().getColor(android.R.color.background_light);
  v.setBackgroundColor(backGroundColor);
  v.setImageBitmap(bm);
  mDragBitmap=bm;
  mWindowManager=(WindowManager)mContext.getSystemService("window");
  mWindowManager.addView(v,mWindowParams);
  mDragView=v;
}
 

Example 30

From project maven-android-plugin-samples, under directory /apidemos-android-10/application/src/main/java/com/example/android/apis/graphics/.

Source file: TranslucentGLSurfaceViewActivity.java

  19 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mGLSurfaceView=new GLSurfaceView(this);
  mGLSurfaceView.setEGLConfigChooser(8,8,8,8,16,0);
  mGLSurfaceView.setRenderer(new CubeRenderer(true));
  mGLSurfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
  setContentView(mGLSurfaceView);
}
 

Example 31

From project mediautilities, under directory /src/ac/robinson/util/.

Source file: UIUtilities.java

  19 
vote

public static void setPixelDithering(Window window){
  if (window != null) {
    window.setFormat(PixelFormat.RGBA_8888);
    window.addFlags(WindowManager.LayoutParams.FLAG_DITHER);
  }
}
 

Example 32

From project MIT-Mobile-for-Android, under directory /src/com/google/zxing/client/android/camera/.

Source file: CameraManager.java

  19 
vote

/** 
 * A factory method to build the appropriate LuminanceSource object based on the format of the preview buffers, as described by Camera.Parameters.
 * @param data A preview frame.
 * @param width The width of the image.
 * @param height The height of the image.
 * @return A PlanarYUVLuminanceSource instance.
 */
public PlanarYUVLuminanceSource buildLuminanceSource(byte[] data,int width,int height){
  Rect rect=getFramingRectInPreview();
  int previewFormat=configManager.getPreviewFormat();
  String previewFormatString=configManager.getPreviewFormatString();
switch (previewFormat) {
case PixelFormat.YCbCr_420_SP:
case PixelFormat.YCbCr_422_SP:
    return new PlanarYUVLuminanceSource(data,width,height,rect.left,rect.top,rect.width(),rect.height());
default :
  if ("yuv420p".equals(previewFormatString)) {
    return new PlanarYUVLuminanceSource(data,width,height,rect.left,rect.top,rect.width(),rect.height());
  }
}
throw new IllegalArgumentException("Unsupported picture format: " + previewFormat + '/'+ previewFormatString);
}
 

Example 33

From project mobilis, under directory /MobilisXHunt/MobilisXHunt_Android_Emulation/MobilisXHunt_Android_Emulation/src/com/jayway/android/robotium/solo/.

Source file: MapViewUtils.java

  19 
vote

private void appendTransparency(StringBuilder str,OverlayItem item,String stateName,int state){
switch (item.getMarker(OverlayItem.ITEM_STATE_FOCUSED_MASK).getOpacity()) {
case PixelFormat.UNKNOWN:
    break;
case PixelFormat.TRANSPARENT:
  str.append("\"").append(stateName).append("\":\"transparent\",");
return;
case PixelFormat.TRANSLUCENT:
str.append("\"").append(stateName).append("\":\"translucent\",");
return;
case PixelFormat.OPAQUE:
str.append("\"").append(stateName).append("\":\"opaque\",");
return;
}
Region region=item.getMarker(state).getTransparentRegion();
if (region != null) {
str.append("\"").append(stateName).append("\":true,");
}
}
 

Example 34

From project mp3tunes-android, under directory /src/com/mp3tunes/android/.

Source file: TouchInterceptor.java

  19 
vote

private void startDragging(Bitmap bm,int y){
  mWindowParams=new WindowManager.LayoutParams();
  mWindowParams.gravity=Gravity.TOP;
  mWindowParams.x=0;
  mWindowParams.y=y - mDragPoint + mCoordOffset;
  mWindowParams.height=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.width=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
  mWindowParams.format=PixelFormat.TRANSLUCENT;
  mWindowParams.windowAnimations=0;
  ImageView v=new ImageView(mContext);
  int backGroundColor=mContext.getResources().getColor(R.color.dragndrop_background);
  v.setBackgroundColor(backGroundColor);
  v.setImageBitmap(bm);
  if (mDragBitmap != null) {
    mDragBitmap.recycle();
  }
  mDragBitmap=bm;
  mWindowManager=(WindowManager)mContext.getSystemService("window");
  mWindowManager.addView(v,mWindowParams);
  mDragView=v;
}
 

Example 35

From project NFCShopping, under directory /nfc updater client/NFCUpdater/src/scut/bgooo/updater/camera/.

Source file: CameraManager.java

  19 
vote

/** 
 * A factory method to build the appropriate LuminanceSource object based on the format of the preview buffers, as described by Camera.Parameters.
 * @param data A preview frame.
 * @param width The width of the image.
 * @param height The height of the image.
 * @return A PlanarYUVLuminanceSource instance.
 */
public PlanarYUVLuminanceSource buildLuminanceSource(byte[] data,int width,int height){
  Rect rect=getFramingRectInPreview();
  int previewFormat=configManager.getPreviewFormat();
  String previewFormatString=configManager.getPreviewFormatString();
switch (previewFormat) {
case PixelFormat.YCbCr_420_SP:
case PixelFormat.YCbCr_422_SP:
    return new PlanarYUVLuminanceSource(data,width,height,rect.left,rect.top,rect.width(),rect.height());
default :
  if ("yuv420p".equals(previewFormatString)) {
    return new PlanarYUVLuminanceSource(data,width,height,rect.left,rect.top,rect.width(),rect.height());
  }
}
throw new IllegalArgumentException("Unsupported picture format: " + previewFormat + '/'+ previewFormatString);
}
 

Example 36

From project NotePad, under directory /src/com/ericharlow/DragNDrop/.

Source file: DragNDropListView.java

  19 
vote

private void startDrag(int itemIndex,int y){
  stopDrag(itemIndex);
  View item=getChildAt(itemIndex);
  Log.d("dragdrop","getting bitmap from " + itemIndex);
  Log.d("dragdrop","my calc: " + pointToPosition(0,y) + " = "+ (pointToPosition(0,y) - getFirstVisiblePosition()));
  if (item == null)   return;
  item.setDrawingCacheEnabled(true);
  if (mDragListener != null)   mDragListener.onStartDrag(item);
  Bitmap bitmap=Bitmap.createBitmap(item.getDrawingCache());
  item.setDrawingCacheEnabled(false);
  WindowManager.LayoutParams mWindowParams=new WindowManager.LayoutParams();
  mWindowParams.gravity=Gravity.TOP;
  mWindowParams.x=0;
  mWindowParams.y=y - mDragPointOffset;
  mWindowParams.height=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.width=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
  mWindowParams.format=PixelFormat.TRANSLUCENT;
  mWindowParams.windowAnimations=0;
  Context context=getContext();
  ImageView v=new ImageView(context);
  v.setImageBitmap(bitmap);
  WindowManager mWindowManager=(WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
  mWindowManager.addView(v,mWindowParams);
  mDragView=v;
}
 

Example 37

From project open_robot, under directory /Android/WebbedSocketFeet/src/com/phinominal/webbedsocketmain/.

Source file: SocketFeet.java

  19 
vote

/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Window lWin=getWindow();
  lWin.setFormat(PixelFormat.TRANSLUCENT);
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  lWin.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.main);
  mSurfaceView=(SurfaceView)findViewById(R.id.surfaceCamera);
  mSurfaceView.setOnClickListener(new OnClickListener(){
    public void onClick(    View aView){
      System.out.println("Surface view was clicked");
    }
  }
);
  Log.d("OUT","IP Address:  " + NetworkHelper.getLocalIpAddress());
  int videoPort=8886;
  videoWebSocketServer=new VideoWebSocketServer(videoPort,mSurfaceView);
  videoWebSocketServer.start();
  Log.d("OUT","VideoWebSocketServer started on port: " + videoWebSocketServer.getPort());
  int controlPort=8887;
  controlWebSocketServer=new ControlWebSocketServer(controlPort,this);
  controlWebSocketServer.start();
  Log.d("OUT","ControlWebSocketServer started on port: " + controlWebSocketServer.getPort());
}
 

Example 38

From project packages_apps_BlackICEControl, under directory /src/com/blackice/control/widgets/.

Source file: TouchInterceptor.java

  19 
vote

private void startDragging(Bitmap bm,int y){
  stopDragging();
  mWindowParams=new WindowManager.LayoutParams();
  mWindowParams.gravity=Gravity.TOP;
  mWindowParams.x=0;
  mWindowParams.y=y - mDragPoint + mCoordOffset;
  mWindowParams.height=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.width=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
  mWindowParams.format=PixelFormat.TRANSLUCENT;
  mWindowParams.windowAnimations=0;
  Context context=getContext();
  ImageView v=new ImageView(context);
  int backGroundColor=context.getResources().getColor(R.color.dragndrop_background);
  v.setBackgroundColor(backGroundColor);
  v.setImageBitmap(bm);
  mDragBitmap=bm;
  mWindowManager=(WindowManager)context.getSystemService("window");
  mWindowManager.addView(v,mWindowParams);
  mDragView=v;
}
 

Example 39

From project packages_apps_Camera_1, under directory /src/com/android/camera/.

Source file: OnScreenHint.java

  19 
vote

/** 
 * Construct an empty OnScreenHint object.  You must call  {@link #setView}before you can call  {@link #show}.
 * @param context  The context to use.  Usually your{@link android.app.Application} or{@link android.app.Activity} object.
 */
public OnScreenHint(Context context){
  mWM=(WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
  mY=context.getResources().getDimensionPixelSize(R.dimen.hint_y_offset);
  mParams.height=WindowManager.LayoutParams.WRAP_CONTENT;
  mParams.width=WindowManager.LayoutParams.WRAP_CONTENT;
  mParams.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
  mParams.format=PixelFormat.TRANSLUCENT;
  mParams.windowAnimations=R.style.Animation_OnScreenHint;
  mParams.type=WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;
  mParams.setTitle("OnScreenHint");
}
 

Example 40

From project packages_apps_Camera_2, under directory /src/com/android/camera/.

Source file: OnScreenHint.java

  19 
vote

/** 
 * Construct an empty OnScreenHint object.  You must call  {@link #setView}before you can call  {@link #show}.
 * @param context  The context to use.  Usually your{@link android.app.Application} or{@link android.app.Activity} object.
 */
public OnScreenHint(Context context){
  mWM=(WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
  mY=context.getResources().getDimensionPixelSize(R.dimen.hint_y_offset);
  mParams.height=WindowManager.LayoutParams.WRAP_CONTENT;
  mParams.width=WindowManager.LayoutParams.WRAP_CONTENT;
  mParams.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
  mParams.format=PixelFormat.TRANSLUCENT;
  mParams.windowAnimations=R.style.Animation_OnScreenHint;
  mParams.type=WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;
  mParams.setTitle("OnScreenHint");
}
 

Example 41

From project packages_apps_God_Mode, under directory /src/com/t3hh4xx0r/god_mode/widgets/.

Source file: TouchInterceptor.java

  19 
vote

private void startDragging(Bitmap bm,int y){
  stopDragging();
  mWindowParams=new WindowManager.LayoutParams();
  mWindowParams.gravity=Gravity.TOP;
  mWindowParams.x=0;
  mWindowParams.y=y - mDragPoint + mCoordOffset;
  mWindowParams.height=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.width=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
  mWindowParams.format=PixelFormat.TRANSLUCENT;
  mWindowParams.windowAnimations=0;
  Context context=getContext();
  ImageView v=new ImageView(context);
  int backGroundColor=context.getResources().getColor(R.color.dragndrop_background);
  v.setBackgroundColor(backGroundColor);
  v.setImageBitmap(bm);
  mDragBitmap=bm;
  mWindowManager=(WindowManager)context.getSystemService("window");
  mWindowManager.addView(v,mWindowParams);
  mDragView=v;
}
 

Example 42

From project packages_apps_ROMControl, under directory /src/com/aokp/romcontrol/widgets/.

Source file: TouchInterceptor.java

  19 
vote

private void startDragging(Bitmap bm,int y){
  stopDragging();
  mWindowParams=new WindowManager.LayoutParams();
  mWindowParams.gravity=Gravity.TOP;
  mWindowParams.x=0;
  mWindowParams.y=y - mDragPoint + mCoordOffset;
  mWindowParams.height=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.width=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
  mWindowParams.format=PixelFormat.TRANSLUCENT;
  mWindowParams.windowAnimations=0;
  Context context=getContext();
  ImageView v=new ImageView(context);
  int backGroundColor=0xE0103010;
  v.setBackgroundColor(backGroundColor);
  v.setImageBitmap(bm);
  mDragBitmap=bm;
  mWindowManager=(WindowManager)context.getSystemService("window");
  mWindowManager.addView(v,mWindowParams);
  mDragView=v;
}
 

Example 43

From project PartyWare, under directory /android/src/com/google/zxing/client/android/camera/.

Source file: CameraManager.java

  19 
vote

/** 
 * A factory method to build the appropriate LuminanceSource object based on the format of the preview buffers, as described by Camera.Parameters.
 * @param data A preview frame.
 * @param width The width of the image.
 * @param height The height of the image.
 * @return A PlanarYUVLuminanceSource instance.
 */
public PlanarYUVLuminanceSource buildLuminanceSource(byte[] data,int width,int height){
  Rect rect=getFramingRectInPreview();
  int previewFormat=configManager.getPreviewFormat();
  String previewFormatString=configManager.getPreviewFormatString();
switch (previewFormat) {
case PixelFormat.YCbCr_420_SP:
case PixelFormat.YCbCr_422_SP:
    return new PlanarYUVLuminanceSource(data,width,height,rect.left,rect.top,rect.width(),rect.height());
default :
  if ("yuv420p".equals(previewFormatString)) {
    return new PlanarYUVLuminanceSource(data,width,height,rect.left,rect.top,rect.width(),rect.height());
  }
}
throw new IllegalArgumentException("Unsupported picture format: " + previewFormat + '/'+ previewFormatString);
}
 

Example 44

From project platform_frameworks_ex, under directory /carousel/test/src/com/android/carouseltest/.

Source file: CarouselTestActivity.java

  19 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.carousel_test);
  mView=(CarouselView)findViewById(R.id.carousel);
  mView.getHolder().setFormat(PixelFormat.RGBA_8888);
  mPaint.setColor(0xffffffff);
  final Resources res=getResources();
  mHelper=new LocalCarouselViewHelper(this);
  mHelper.setCarouselView(mView);
  mView.setSlotCount(CARD_SLOTS);
  mView.createCards(INCREMENTAL_ADD ? 1 : TOTAL_CARDS);
  mView.setVisibleSlots(SLOTS_VISIBLE);
  mView.setStartAngle((float)-(2.0f * Math.PI * 5 / CARD_SLOTS));
  mBorder=BitmapFactory.decodeResource(res,R.drawable.border);
  mView.setDefaultBitmap(mBorder);
  mView.setLoadingBitmap(mBorder);
  mView.setBackgroundColor(0.25f,0.25f,0.5f,0.5f);
  mView.setRezInCardCount(3.0f);
  mView.setFadeInDuration(250);
  mView.setVisibleDetails(VISIBLE_DETAIL_COUNT);
  mView.setDragModel(CarouselView.DRAG_MODEL_PLANE);
  if (INCREMENTAL_ADD) {
    mView.postDelayed(mAddCardRunnable,2000);
  }
  mGlossyOverlay=BitmapFactory.decodeResource(res,R.drawable.glossy_overlay);
}
 

Example 45

From project platform_frameworks_policies_base, under directory /phone/com/android/internal/policy/impl/.

Source file: KeyguardViewManager.java

  19 
vote

/** 
 * Show the keyguard.  Will handle creating and attaching to the view manager lazily.
 */
public synchronized void show(){
  if (DEBUG)   Log.d(TAG,"show(); mKeyguardView==" + mKeyguardView);
  if (mKeyguardHost == null) {
    if (DEBUG)     Log.d(TAG,"keyguard host is null, creating it...");
    mKeyguardHost=new KeyguardViewHost(mContext,mCallback);
    final int stretch=ViewGroup.LayoutParams.MATCH_PARENT;
    int flags=WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN | WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER | WindowManager.LayoutParams.FLAG_KEEP_SURFACE_WHILE_ANIMATING;
    if (!mNeedsInput) {
      flags|=WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
    }
    WindowManager.LayoutParams lp=new WindowManager.LayoutParams(stretch,stretch,WindowManager.LayoutParams.TYPE_KEYGUARD,flags,PixelFormat.TRANSLUCENT);
    lp.softInputMode=WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN;
    lp.windowAnimations=com.android.internal.R.style.Animation_LockScreen;
    lp.screenOrientation=ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;
    lp.setTitle("Keyguard");
    mWindowLayoutParams=lp;
    mViewManager.addView(mKeyguardHost,lp);
  }
  if (mKeyguardView == null) {
    if (DEBUG)     Log.d(TAG,"keyguard view is null, creating it...");
    mKeyguardView=mKeyguardViewProperties.createKeyguardView(mContext,mUpdateMonitor,this);
    mKeyguardView.setId(R.id.lock_screen);
    mKeyguardView.setCallback(mCallback);
    final ViewGroup.LayoutParams lp=new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
    mKeyguardHost.addView(mKeyguardView,lp);
    if (mScreenOn) {
      mKeyguardView.onScreenTurnedOn();
    }
  }
  mKeyguardHost.setVisibility(View.VISIBLE);
  mKeyguardView.requestFocus();
}
 

Example 46

From project platform_packages_apps_camera, under directory /src/com/android/camera/.

Source file: OnScreenHint.java

  19 
vote

/** 
 * Construct an empty OnScreenHint object.
 * @param context  The context to use.  Usually your{@link android.app.Application} or{@link android.app.Activity} object.
 */
private OnScreenHint(Context context){
  mWM=(WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
  mY=context.getResources().getDimensionPixelSize(R.dimen.hint_y_offset);
  mParams.height=WindowManager.LayoutParams.WRAP_CONTENT;
  mParams.width=WindowManager.LayoutParams.WRAP_CONTENT;
  mParams.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
  mParams.format=PixelFormat.TRANSLUCENT;
  mParams.windowAnimations=R.style.Animation_OnScreenHint;
  mParams.type=WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;
  mParams.setTitle("OnScreenHint");
}
 

Example 47

From project platform_packages_apps_CytownPhone, under directory /src/com/android/phone/.

Source file: InCallScreen.java

  19 
vote

private void initInCallScreen(){
  if (VDBG)   log("initInCallScreen()...");
  getWindow().addFlags(WindowManager.LayoutParams.FLAG_IGNORE_CHEEK_PRESSES);
  getWindow().setFormat(PixelFormat.RGBX_8888);
  mMainFrame=(ViewGroup)findViewById(R.id.mainFrame);
  mInCallPanel=(ViewGroup)findViewById(R.id.inCallPanel);
  mCallCard=(CallCard)findViewById(R.id.callCard);
  if (VDBG)   log("  - mCallCard = " + mCallCard);
  mCallCard.setInCallScreenInstance(this);
  initInCallTouchUi();
  mInCallControlState=new InCallControlState(this,mCM);
  mManageConferenceUtils=new ManageConferenceUtils(this,mCM);
}
 

Example 48

From project platform_packages_apps_Gallery2_1, under directory /src/com/android/gallery3d/ui/.

Source file: GLRootView.java

  19 
vote

public GLRootView(Context context,AttributeSet attrs){
  super(context,attrs);
  mFlags|=FLAG_INITIALIZED;
  setBackgroundDrawable(null);
  setEGLConfigChooser(mEglConfigChooser);
  setRenderer(this);
  getHolder().setFormat(PixelFormat.RGB_565);
}
 

Example 49

From project platform_packages_apps_music, under directory /src/com/android/music/.

Source file: TouchInterceptor.java

  19 
vote

private void startDragging(Bitmap bm,int x,int y){
  stopDragging();
  mWindowParams=new WindowManager.LayoutParams();
  mWindowParams.gravity=Gravity.TOP | Gravity.LEFT;
  mWindowParams.x=x - mDragPointX + mXOffset;
  mWindowParams.y=y - mDragPointY + mYOffset;
  mWindowParams.height=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.width=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
  mWindowParams.format=PixelFormat.TRANSLUCENT;
  mWindowParams.windowAnimations=0;
  Context context=getContext();
  ImageView v=new ImageView(context);
  v.setBackgroundResource(R.drawable.playlist_tile_drag);
  v.setPadding(0,0,0,0);
  v.setImageBitmap(bm);
  mDragBitmap=bm;
  mWindowManager=(WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
  mWindowManager.addView(v,mWindowParams);
  mDragView=v;
}
 

Example 50

From project Playlist, under directory /src/com/google/zxing/client/android/camera/.

Source file: CameraManager.java

  19 
vote

/** 
 * A factory method to build the appropriate LuminanceSource object based on the format of the preview buffers, as described by Camera.Parameters.
 * @param data A preview frame.
 * @param width The width of the image.
 * @param height The height of the image.
 * @return A PlanarYUVLuminanceSource instance.
 */
public PlanarYUVLuminanceSource buildLuminanceSource(byte[] data,int width,int height){
  Rect rect=getFramingRectInPreview();
  int previewFormat=configManager.getPreviewFormat();
  String previewFormatString=configManager.getPreviewFormatString();
switch (previewFormat) {
case PixelFormat.YCbCr_420_SP:
case PixelFormat.YCbCr_422_SP:
    return new PlanarYUVLuminanceSource(data,width,height,rect.left,rect.top,rect.width(),rect.height());
default :
  if ("yuv420p".equals(previewFormatString)) {
    return new PlanarYUVLuminanceSource(data,width,height,rect.left,rect.top,rect.width(),rect.height());
  }
}
throw new IllegalArgumentException("Unsupported picture format: " + previewFormat + '/'+ previewFormatString);
}
 

Example 51

From project playn, under directory /android/src/playn/android/.

Source file: AndroidGraphics.java

  19 
vote

/** 
 * Determines the most performant pixel format for the active display.
 */
private Bitmap.Config mapDisplayPixelFormat(){
  int format=platform.activity.getWindowManager().getDefaultDisplay().getPixelFormat();
  ActivityManager activityManager=(ActivityManager)platform.activity.getApplication().getSystemService(Context.ACTIVITY_SERVICE);
  int memoryClass=activityManager.getMemoryClass();
  return (format == PixelFormat.RGBA_4444 || memoryClass <= 16) ? Bitmap.Config.ARGB_4444 : Bitmap.Config.ARGB_8888;
}
 

Example 52

From project proxydroid, under directory /src/org/proxydroid/.

Source file: AppManager.java

  19 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  this.setContentView(R.layout.layout_apps);
  dm=ImageLoaderFactory.getImageLoader(this);
  this.overlay=(TextView)View.inflate(this,R.layout.overlay,null);
  getWindowManager().addView(overlay,new WindowManager.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT,WindowManager.LayoutParams.TYPE_APPLICATION,WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE,PixelFormat.TRANSLUCENT));
  mAppManager=this;
}
 

Example 53

From project QuickSnap, under directory /Camera/src/com/lightbox/android/camera/.

Source file: OnScreenHint.java

  19 
vote

/** 
 * Construct an empty OnScreenHint object.  You must call  {@link #setView}before you can call  {@link #show}.
 * @param context  The context to use.  Usually your{@link android.app.Application} or{@link android.app.Activity} object.
 */
public OnScreenHint(Context context){
  mWM=(WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
  mY=context.getResources().getDimensionPixelSize(R.dimen.hint_y_offset);
  mParams.height=WindowManager.LayoutParams.WRAP_CONTENT;
  mParams.width=WindowManager.LayoutParams.WRAP_CONTENT;
  mParams.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
  mParams.format=PixelFormat.TRANSLUCENT;
  mParams.windowAnimations=R.style.Animation_OnScreenHint;
  mParams.type=WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;
  mParams.setTitle("OnScreenHint");
}
 

Example 54

From project RA_Launcher, under directory /src/com/android/ra/launcher/.

Source file: DragView.java

  19 
vote

/** 
 * Create a window containing this view and show it.
 * @param windowToken obtained from v.getWindowToken() from one of your views
 * @param touchX the x coordinate the user touched in screen coordinates
 * @param touchY the y coordinate the user touched in screen coordinates
 */
public void show(IBinder windowToken,int touchX,int touchY){
  WindowManager.LayoutParams lp;
  int pixelFormat;
  pixelFormat=PixelFormat.TRANSLUCENT;
  lp=new WindowManager.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT,touchX - mRegistrationX,touchY - mRegistrationY,WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL,WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,pixelFormat);
  lp.gravity=Gravity.LEFT | Gravity.TOP;
  lp.token=windowToken;
  lp.setTitle("DragView");
  mLayoutParams=lp;
  mWindowManager.addView(this,lp);
  mAnimationScale=1.0f / mScale;
  mTween.start(true);
}
 

Example 55

From project RebeLauncher, under directory /src/com/dirtypepper/rebelauncher/.

Source file: Launcher.java

  19 
vote

public void setWindowBackground(boolean lwp){
  wallpaperHack=lwp;
  if (!lwp) {
    getWindow().setBackgroundDrawable(null);
    getWindow().setFormat(PixelFormat.OPAQUE);
  }
 else {
    getWindow().setBackgroundDrawable(new ColorDrawable(0));
    getWindow().setFormat(PixelFormat.TRANSPARENT);
  }
}
 

Example 56

From project Rhybudd, under directory /src/net/networksaremadeofstring/rhybudd/.

Source file: RhybuddHome.java

  19 
vote

@Override public void onAttachedToWindow(){
  super.onAttachedToWindow();
  try {
    Window window=getWindow();
    window.setFormat(PixelFormat.RGBA_8888);
  }
 catch (  Exception e) {
  }
}
 

Example 57

From project roman10-android-tutorial, under directory /colorConversion/src/roman10/tutorial/media/colorconversion/.

Source file: Main.java

  19 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mContext=this.getApplicationContext();
  WindowManager.LayoutParams lp=new WindowManager.LayoutParams();
  lp.copyFrom(getWindow().getAttributes());
  lp.format=PixelFormat.RGBA_8888;
  getWindow().setBackgroundDrawable(new ColorDrawable(0xff000000));
  getWindow().setAttributes(lp);
  CopyAssets();
  String lTestFilePath="/sdcard/test.yuv";
  int lTestFileWidth=672;
  int lTestFileHeight=336;
  prRenderView=new RenderView(this,lTestFilePath,lTestFileWidth,lTestFileHeight);
  setContentView(prRenderView);
}
 

Example 58

From project shoppinglist, under directory /ShoppingList/src/org/openintents/shopping/ui/widget/.

Source file: ShoppingItemsView.java

  19 
vote

private void startDragging(Bitmap bm,int y){
  stopDragging();
  mWindowParams=new WindowManager.LayoutParams();
  mWindowParams.gravity=Gravity.TOP;
  mWindowParams.x=0;
  mWindowParams.y=y - mDragPoint + mCoordOffset;
  mWindowParams.height=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.width=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
  mWindowParams.format=PixelFormat.TRANSLUCENT;
  mWindowParams.windowAnimations=0;
  Context context=getContext();
  ImageView v=new ImageView(context);
  int backGroundColor=context.getResources().getColor(R.color.darkgreen);
  v.setBackgroundColor(backGroundColor);
  v.setImageBitmap(bm);
  mDragBitmap=bm;
  mWindowManager=(WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
  mWindowManager.addView(v,mWindowParams);
  mDragView=v;
}
 

Example 59

From project SWE12-Drone, under directory /catroid/src/at/tugraz/ist/catroid/ui/dragndrop/.

Source file: DragAndDropListView.java

  19 
vote

private WindowManager.LayoutParams createLayoutParameters(){
  WindowManager.LayoutParams windowParameters=new WindowManager.LayoutParams();
  windowParameters.gravity=Gravity.TOP | Gravity.LEFT;
  windowParameters.height=WindowManager.LayoutParams.WRAP_CONTENT;
  windowParameters.width=getWidth() - originalTrashWidth + 2;
  windowParameters.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
  windowParameters.format=PixelFormat.TRANSLUCENT;
  return windowParameters;
}
 

Example 60

From project titanium-barcode, under directory /src/com/mwaysolutions/barcode/camera/.

Source file: CameraManager.java

  19 
vote

/** 
 * A factory method to build the appropriate LuminanceSource object based on the format of the preview buffers, as described by Camera.Parameters.
 * @param data A preview frame.
 * @param width The width of the image.
 * @param height The height of the image.
 * @return A PlanarYUVLuminanceSource instance.
 */
public PlanarYUVLuminanceSource buildLuminanceSource(byte[] data,int width,int height){
  Rect rect=getFramingRectInPreview();
  int previewFormat=configManager.getPreviewFormat();
  String previewFormatString=configManager.getPreviewFormatString();
switch (previewFormat) {
case PixelFormat.YCbCr_420_SP:
case PixelFormat.YCbCr_422_SP:
    return new PlanarYUVLuminanceSource(data,width,height,rect.left,rect.top,rect.width(),rect.height());
default :
  if ("yuv420p".equals(previewFormatString)) {
    return new PlanarYUVLuminanceSource(data,width,height,rect.left,rect.top,rect.width(),rect.height());
  }
}
throw new IllegalArgumentException("Unsupported picture format: " + previewFormat + '/'+ previewFormatString);
}
 

Example 61

From project titanium_modules, under directory /beintoosdk/mobile/android/src/com/beintoo/beintoosdkutility/.

Source file: MessageDisplayer.java

  19 
vote

public static void showMessage(Context ctx,String message,int g){
  try {
    wM=(WindowManager)ctx.getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
    if (v != null) {
      if (v.isShown()) {
        wM.removeView(v);
        mHandler.removeCallbacks(mRunnable);
      }
    }
    WindowManager.LayoutParams mParams=new WindowManager.LayoutParams();
    LayoutInflater inflate=(LayoutInflater)ctx.getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    v=inflate.inflate(ctx.getResources().getIdentifier("notification","layout",ctx.getPackageName()),null);
    TextView tw=(TextView)v.findViewById(ctx.getResources().getIdentifier("message","id",ctx.getPackageName()));
    tw.setText(message);
    LinearLayout ll=(LinearLayout)v.findViewById(ctx.getResources().getIdentifier("main","id",ctx.getPackageName()));
    ll.setBackgroundColor(Color.argb(200,65,65,65));
    mParams.gravity=g;
    mParams.height=WindowManager.LayoutParams.WRAP_CONTENT;
    mParams.width=WindowManager.LayoutParams.FILL_PARENT;
    mParams.flags=WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
    mParams.format=PixelFormat.TRANSLUCENT;
    mParams.type=WindowManager.LayoutParams.TYPE_TOAST;
    mParams.windowAnimations=android.R.style.Animation_Toast;
    wM.addView(v,mParams);
    mHandler=new Handler();
    int delay=getDelay(tw.length());
    mHandler.postDelayed(mRunnable,delay);
  }
 catch (  Exception e) {
  }
}
 

Example 62

From project TodoBento, under directory /src/leoliang/tasks365/.

Source file: DraggableListView.java

  19 
vote

/** 
 * @param y
 * @param offset - the difference in y axis between screen coordinates and coordinates in this view
 * @param view - which view is dragged
 */
public void start(int y,int offset,View view){
  this.y=y;
  lastY=y;
  this.coordOffset=offset;
  mDragPoint=y - view.getTop();
  draggingItemHeight=view.getHeight();
  mDragView=new ImageView(context);
  mDragView.setBackgroundResource(android.R.drawable.alert_light_frame);
  view.setDrawingCacheEnabled(true);
  mDragBitmap=Bitmap.createBitmap(view.getDrawingCache());
  mDragView.setImageBitmap(mDragBitmap);
  mWindowParams=new WindowManager.LayoutParams();
  mWindowParams.gravity=Gravity.TOP;
  mWindowParams.x=0;
  mWindowParams.y=y - mDragPoint + coordOffset;
  mWindowParams.height=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.width=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
  mWindowParams.format=PixelFormat.TRANSLUCENT;
  mWindowParams.windowAnimations=0;
  windowManager.addView(mDragView,mWindowParams);
}
 

Example 63

From project tramhunter, under directory /android/TramHunter/src/com/andybotting/tramhunter/ui/.

Source file: TouchListView.java

  19 
vote

private void startDragging(Bitmap bm,int y){
  stopDragging();
  mWindowParams=new WindowManager.LayoutParams();
  mWindowParams.gravity=Gravity.TOP;
  mWindowParams.x=0;
  mWindowParams.y=y - mDragPoint + mCoordOffset;
  mWindowParams.height=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.width=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
  mWindowParams.format=PixelFormat.TRANSLUCENT;
  mWindowParams.windowAnimations=0;
  ImageView v=new ImageView(getContext());
  v.setBackgroundColor(dragndropBackgroundColor);
  v.setImageBitmap(bm);
  mDragBitmap=bm;
  mWindowManager=(WindowManager)getContext().getSystemService("window");
  mWindowManager.addView(v,mWindowParams);
  mDragView=v;
}
 

Example 64

From project twidere, under directory /src/org/mariotaku/twidere/fragment/.

Source file: ColorPickerDialogFragment.java

  19 
vote

private void init(final Context context,final int color){
  getWindow().setFormat(PixelFormat.RGBA_8888);
  final LinearLayout mContentView=new LinearLayout(context);
  mContentView.setGravity(Gravity.CENTER);
  mColorPicker=new ColorPickerView(context);
  mContentView.addView(mColorPicker,LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
  mContentView.setPadding(Math.round(mColorPicker.getDrawingOffset()),0,Math.round(mColorPicker.getDrawingOffset()),0);
  mColorPicker.setOnColorChangedListener(this);
  mColorPicker.setColor(color,true);
  mColorPicker.setAlphaSliderVisible(true);
  setTitle(R.string.pick_color);
  setView(mContentView);
  setButton(BUTTON_POSITIVE,context.getString(android.R.string.ok),this);
  setButton(BUTTON_NEGATIVE,context.getString(android.R.string.cancel),this);
}
 

Example 65

From project vlc-android, under directory /vlc-android/src/org/videolan/vlc/android/.

Source file: VideoPlayerActivity.java

  19 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.player);
  PowerManager pm=(PowerManager)getSystemService(Context.POWER_SERVICE);
  mWakeLock=pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK,TAG);
  mDecor=(LinearLayout)findViewById(R.id.player_overlay_decor);
  mSpacer=(View)findViewById(R.id.player_overlay_spacer);
  mSpacer.setOnTouchListener(mTouchListener);
  LayoutInflater inflater=(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  mOverlay=(LinearLayout)inflater.inflate(R.layout.player_overlay,null);
  mTime=(TextView)mOverlay.findViewById(R.id.player_overlay_time);
  mLength=(TextView)mOverlay.findViewById(R.id.player_overlay_length);
  mInfo=(TextView)findViewById(R.id.player_overlay_info);
  mPause=(ImageButton)mOverlay.findViewById(R.id.player_overlay_play);
  mPause.setOnClickListener(mPauseListener);
  mLock=(ImageButton)mOverlay.findViewById(R.id.player_overlay_lock);
  mLock.setOnClickListener(mLockListener);
  mSize=(ImageButton)mOverlay.findViewById(R.id.player_overlay_size);
  mSize.setOnClickListener(mSizeListener);
  mSurface=(SurfaceView)findViewById(R.id.player_surface);
  mSurfaceHolder=mSurface.getHolder();
  mSurfaceHolder.setKeepScreenOn(true);
  mSurfaceHolder.setFormat(PixelFormat.RGBX_8888);
  mSurfaceHolder.addCallback(mSurfaceCallback);
  mSeekbar=(SeekBar)mOverlay.findViewById(R.id.player_overlay_seekbar);
  mSeekbar.setOnSeekBarChangeListener(mSeekListener);
  try {
    mLibVLC=LibVLC.getInstance();
  }
 catch (  LibVlcException e) {
    e.printStackTrace();
  }
  EventManager em=EventManager.getIntance();
  em.addHandler(eventHandler);
  this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
  setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
  load();
}
 

Example 66

From project Wordpress-Android-App, under directory /src/org/wordpress/android/.

Source file: Dashboard.java

  19 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.dashboard);
  getWindow().setFormat(PixelFormat.RGBA_8888);
  getWindow().addFlags(WindowManager.LayoutParams.FLAG_DITHER);
}
 

Example 67

From project yammp, under directory /src/org/yammp/widget/.

Source file: TouchInterceptor.java

  19 
vote

private void startDragging(Bitmap bm,int x,int y){
  stopDragging();
  mWindowParams=new WindowManager.LayoutParams();
  mWindowParams.gravity=Gravity.TOP | Gravity.LEFT;
  mWindowParams.x=x - mDragPointX + mXOffset;
  mWindowParams.y=y - mDragPointY + mYOffset;
  mWindowParams.height=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.width=WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
  mWindowParams.format=PixelFormat.TRANSLUCENT;
  mWindowParams.windowAnimations=0;
  Context context=getContext();
  ImageView v=new ImageView(context);
  v.setBackgroundResource(R.drawable.playlist_tile_drag);
  v.setPadding(0,0,0,0);
  v.setImageBitmap(bm);
  mDragBitmap=bm;
  mWindowManager=(WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
  mWindowManager.addView(v,mWindowParams);
  mDragView=v;
}
 

Example 68

From project Yeno-Checklist, under directory /src/com/yeno/checklist/view/.

Source file: TouchListView.java

  19 
vote

private void startDragging(Bitmap bm,int y){
  stopDragging();
  mWindowParams=new WindowManager.LayoutParams();
  mWindowParams.gravity=Gravity.TOP;
  mWindowParams.x=0;
  mWindowParams.y=y - mDragPoint + mCoordOffset;
  mWindowParams.height=android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
  mWindowParams.width=android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
  mWindowParams.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
  mWindowParams.format=PixelFormat.TRANSLUCENT;
  mWindowParams.windowAnimations=0;
  ImageView v=new ImageView(getContext());
  v.setBackgroundColor(dragndropBackgroundColor);
  v.setImageBitmap(bm);
  mDragBitmap=bm;
  mWindowManager=(WindowManager)getContext().getSystemService("window");
  mWindowManager.addView(v,mWindowParams);
  mDragView=v;
}
 

Example 69

From project zxing-android, under directory /src/com/laundrylocker/barcodescanner/camera/.

Source file: CameraManager.java

  19 
vote

/** 
 * A factory method to build the appropriate LuminanceSource object based on the format of the preview buffers, as described by Camera.Parameters.
 * @param data   A preview frame.
 * @param width  The width of the image.
 * @param height The height of the image.
 * @return A PlanarYUVLuminanceSource instance.
 */
public PlanarYUVLuminanceSource buildLuminanceSource(byte[] data,int width,int height){
  Rect rect=getFramingRectInPreview();
  int previewFormat=configManager.getPreviewFormat();
  String previewFormatString=configManager.getPreviewFormatString();
switch (previewFormat) {
case PixelFormat.YCbCr_420_SP:
case PixelFormat.YCbCr_422_SP:
    return new PlanarYUVLuminanceSource(data,width,height,rect.left,rect.top,rect.width(),rect.height(),reverseImage);
default :
  if ("yuv420p".equals(previewFormatString)) {
    return new PlanarYUVLuminanceSource(data,width,height,rect.left,rect.top,rect.width(),rect.height(),reverseImage);
  }
}
throw new IllegalArgumentException("Unsupported picture format: " + previewFormat + '/'+ previewFormatString);
}
 

Example 70

From project zxing-iphone, under directory /android/src/com/google/zxing/client/android/camera/.

Source file: CameraManager.java

  19 
vote

/** 
 * A factory method to build the appropriate LuminanceSource object based on the format of the preview buffers, as described by Camera.Parameters.
 * @param data A preview frame.
 * @param width The width of the image.
 * @param height The height of the image.
 * @return A PlanarYUVLuminanceSource instance.
 */
public PlanarYUVLuminanceSource buildLuminanceSource(byte[] data,int width,int height){
  Rect rect=getFramingRectInPreview();
  int previewFormat=configManager.getPreviewFormat();
  String previewFormatString=configManager.getPreviewFormatString();
switch (previewFormat) {
case PixelFormat.YCbCr_420_SP:
case PixelFormat.YCbCr_422_SP:
    return new PlanarYUVLuminanceSource(data,width,height,rect.left,rect.top,rect.width(),rect.height());
default :
  if ("yuv420p".equals(previewFormatString)) {
    return new PlanarYUVLuminanceSource(data,width,height,rect.left,rect.top,rect.width(),rect.height());
  }
}
throw new IllegalArgumentException("Unsupported picture format: " + previewFormat + '/'+ previewFormatString);
}