Java Code Examples for android.view.WindowManager

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 agit, under directory /agit/src/main/java/com/madgag/android/notifications/.

Source file: StatusBarNotificationStyles.java

  36 
vote

private DisplayMetrics getDisplayMetrics(){
  DisplayMetrics metrics=new DisplayMetrics();
  WindowManager wm=(WindowManager)context.getSystemService(WINDOW_SERVICE);
  wm.getDefaultDisplay().getMetrics(metrics);
  return metrics;
}
 

Example 2

From project android-gltron, under directory /GlTron/src/com/glTron/.

Source file: glTron.java

  34 
vote

@Override public void onCreate(Bundle savedInstanceState){
  WindowManager w=getWindowManager();
  Display d=w.getDefaultDisplay();
  int width=d.getWidth();
  int height=d.getHeight();
  super.onCreate(savedInstanceState);
  this.requestWindowFeature(Window.FEATURE_NO_TITLE);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  _View=new OpenGLView(this,width,height);
  setContentView(_View);
}
 

Example 3

From project android-joedayz, under directory /Proyectos/GreenDroid/src/greendroid/widget/.

Source file: QuickActionWidget.java

  33 
vote

/** 
 * Creates a new QuickActionWidget for the given context.
 * @param context The context in which the QuickActionWidget is running in
 */
public QuickActionWidget(Context context){
  super(context);
  mContext=context;
  initializeDefault();
  setFocusable(true);
  setTouchable(true);
  setOutsideTouchable(true);
  setWidth(WindowManager.LayoutParams.WRAP_CONTENT);
  setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
  final WindowManager windowManager=(WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE);
  mScreenWidth=windowManager.getDefaultDisplay().getWidth();
  mScreenHeight=windowManager.getDefaultDisplay().getHeight();
}
 

Example 4

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

Source file: DnDList.java

  33 
vote

private void drag(int x,int y){
  if (mDragView != null) {
    final WindowManager.LayoutParams layoutParams=(WindowManager.LayoutParams)mDragView.getLayoutParams();
    layoutParams.x=x;
    layoutParams.y=y - mDragPointOffset;
    final WindowManager mWindowManager=(WindowManager)getContext().getSystemService(Context.WINDOW_SERVICE);
    mWindowManager.updateViewLayout(mDragView,layoutParams);
    if (mDragListener != null)     mDragListener.onDrag(x,y,this);
  }
}
 

Example 5

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

Source file: TouchInterceptor.java

  33 
vote

private void stopDragging(){
  if (mDragView != null) {
    WindowManager wm=(WindowManager)getContext().getSystemService("window");
    wm.removeView(mDragView);
    mDragView.setImageDrawable(null);
    mDragView=null;
  }
  if (mDragBitmap != null) {
    mDragBitmap.recycle();
    mDragBitmap=null;
  }
}
 

Example 6

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

Source file: TouchInterceptor.java

  32 
vote

private void stopDragging(){
  if (mDragView != null) {
    WindowManager wm=(WindowManager)getContext().getSystemService("window");
    wm.removeView(mDragView);
    mDragView.setImageDrawable(null);
    mDragView=null;
  }
  if (mDragBitmap != null) {
    mDragBitmap.recycle();
    mDragBitmap=null;
  }
}
 

Example 7

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

Source file: TouchInterceptor.java

  32 
vote

private void stopDragging(){
  if (mDragView != null) {
    WindowManager wm=(WindowManager)getContext().getSystemService("window");
    wm.removeView(mDragView);
    mDragView.setImageDrawable(null);
    mDragView=null;
  }
  if (mDragBitmap != null) {
    mDragBitmap.recycle();
    mDragBitmap=null;
  }
}
 

Example 8

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

Source file: EyePosition.java

  32 
vote

public EyePosition(Context context,EyePositionListener listener){
  mContext=context;
  mListener=listener;
  mUserDistance=GalleryUtils.meterToPixel(USER_DISTANCE_METER);
  mLimit=mUserDistance * MAX_VIEW_RANGE;
  WindowManager wManager=(WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE);
  mDisplay=wManager.getDefaultDisplay();
}
 

Example 9

From project apps-for-android, under directory /BTClickLinkCompete/src/net/clc/bt/.

Source file: AirHockey.java

  32 
vote

public void OnIncomingConnection(String device){
  rivalDevice=device;
  WindowManager w=getWindowManager();
  Display d=w.getDefaultDisplay();
  int width=d.getWidth();
  int height=d.getHeight();
  mBall=new Demo_Ball(true,width,height - 60);
  mBall.putOnScreen(width / 2,(height / 2 + (int)(height * .05)),0,0,0,0,0);
}
 

Example 10

From project BazaarUtils, under directory /src/com/congenialmobile/widget/.

Source file: LazyImageView.java

  32 
vote

private void initProgressBarLoadingView(Context context){
  WindowManager wm=(WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
  DisplayMetrics metrics=new DisplayMetrics();
  wm.getDefaultDisplay().getMetrics(metrics);
  int width=(int)((float)metrics.density * 36);
  ProgressBar pBar=new ProgressBar(context);
  pBar.setLayoutParams(new LayoutParams(width,width,Gravity.CENTER));
  addView(pBar);
}
 

Example 11

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

Source file: TouchListView.java

  32 
vote

private void stopDragging(){
  if (mDragView != null) {
    WindowManager wm=(WindowManager)getContext().getSystemService("window");
    wm.removeView(mDragView);
    mDragView.setImageDrawable(null);
    mDragView=null;
  }
  if (mDragBitmap != null) {
    mDragBitmap.recycle();
    mDragBitmap=null;
  }
}
 

Example 12

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

Source file: DragAndDropListView.java

  32 
vote

private void startDragging(Bitmap bitmap,int y){
  stopDragging();
  if (bitmap.getHeight() > maximumDragViewHeight) {
    bitmap=Bitmap.createBitmap(bitmap,0,0,bitmap.getWidth(),maximumDragViewHeight);
  }
  ImageView imageView=new ImageView(getContext());
  imageView.setBackgroundColor(DRAG_BACKGROUND_COLOR);
  imageView.setImageBitmap(bitmap);
  WindowManager.LayoutParams dragViewParameters=createLayoutParameters();
  dragViewParameters.y=y - bitmap.getHeight() / 2;
  WindowManager windowManager=getWindowManager();
  windowManager.addView(imageView,dragViewParameters);
  dragView=imageView;
}
 

Example 13

From project CineShowTime-Android, under directory /Libraries/GreenDroid/src/greendroid/widget/.

Source file: QuickActionWidget.java

  32 
vote

/** 
 * Creates a new QuickActionWidget for the given context.
 * @param context The context in which the QuickActionWidget is running in
 */
public QuickActionWidget(Context context){
  super(context);
  mContext=context;
  initializeDefault();
  setFocusable(true);
  setTouchable(true);
  setOutsideTouchable(true);
  setWidth(WindowManager.LayoutParams.WRAP_CONTENT);
  setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
  final WindowManager windowManager=(WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE);
  mScreenWidth=windowManager.getDefaultDisplay().getWidth();
  mScreenHeight=windowManager.getDefaultDisplay().getHeight();
}
 

Example 14

From project cornerstone, under directory /frameworks/base/policy/src/com/android/internal/policy/impl/.

Source file: PhoneWindowManager.java

  32 
vote

/** 
 * {@inheritDoc} 
 */
public void removeStartingWindow(IBinder appToken,View window){
  if (localLOGV)   Log.v(TAG,"Removing starting window for " + appToken + ": "+ window);
  if (window != null) {
    WindowManager wm=(WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE);
    wm.removeView(window);
  }
}
 

Example 15

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

Source file: TouchInterceptor.java

  32 
vote

private void stopDragging(){
  if (mDragView != null) {
    WindowManager wm=(WindowManager)getContext().getSystemService("window");
    wm.removeView(mDragView);
    mDragView.setImageDrawable(null);
    mDragView=null;
  }
  if (mDragBitmap != null) {
    mDragBitmap.recycle();
    mDragBitmap=null;
  }
}
 

Example 16

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

Source file: TouchInterceptor.java

  32 
vote

private void stopDragging(){
  if (mDragView != null) {
    WindowManager wm=(WindowManager)getContext().getSystemService("window");
    wm.removeView(mDragView);
    mDragView.setImageDrawable(null);
    mDragView=null;
  }
  if (mDragBitmap != null) {
    mDragBitmap.recycle();
    mDragBitmap=null;
  }
}
 

Example 17

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

Source file: TouchInterceptor.java

  32 
vote

private void stopDragging(){
  if (mDragView != null) {
    mDragView.setVisibility(GONE);
    WindowManager wm=(WindowManager)getContext().getSystemService(Context.WINDOW_SERVICE);
    wm.removeView(mDragView);
    mDragView.setImageDrawable(null);
    mDragView=null;
  }
  if (mDragBitmap != null) {
    mDragBitmap.recycle();
    mDragBitmap=null;
  }
}
 

Example 18

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

Source file: CameraConfigurationManager.java

  32 
vote

/** 
 * Reads, one time, values from the camera that are needed by the app.
 */
public void initFromCameraParameters(Camera camera){
  Camera.Parameters parameters=camera.getParameters();
  previewFormat=parameters.getPreviewFormat();
  previewFormatString=parameters.get("preview-format");
  Log.d(TAG,"Default preview format: " + previewFormat + '/'+ previewFormatString);
  WindowManager manager=(WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
  Display display=manager.getDefaultDisplay();
  screenResolution=new Point(display.getWidth(),display.getHeight());
  Log.d(TAG,"Screen resolution: " + screenResolution);
  cameraResolution=getCameraResolution(parameters,screenResolution);
  Log.d(TAG,"Camera resolution: " + screenResolution);
}
 

Example 19

From project and-bible, under directory /AndBible/src/net/bible/android/view/activity/page/.

Source file: BibleGestureListener.java

  31 
vote

@Override public boolean onSingleTapConfirmed(MotionEvent e){
  boolean handled=false;
  if (sensePageDownTap) {
    Log.d(TAG,"onSingleTapConfirmed ");
    WindowManager window=(WindowManager)BibleApplication.getApplication().getSystemService(Context.WINDOW_SERVICE);
    Display display=window.getDefaultDisplay();
    int height=display.getHeight();
    if (e.getY() > height * 0.93) {
      Log.d(TAG,"scrolling down");
      mainBibleActivity.scrollScreenDown();
      handled=true;
    }
    Log.d(TAG,"finished onSingleTapConfirmed ");
  }
  if (!handled) {
    handled=super.onSingleTapConfirmed(e);
  }
  return handled;
}
 

Example 20

From project android-ocr, under directory /android/src/edu/sfsu/cs/orange/ocr/camera/.

Source file: CameraConfigurationManager.java

  31 
vote

/** 
 * Reads, one time, values from the camera that are needed by the app.
 */
void initFromCameraParameters(Camera camera){
  Camera.Parameters parameters=camera.getParameters();
  WindowManager manager=(WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
  Display display=manager.getDefaultDisplay();
  int width=display.getWidth();
  int height=display.getHeight();
  if (width < height) {
    Log.i(TAG,"Display reports portrait orientation; assuming this is incorrect");
    int temp=width;
    width=height;
    height=temp;
  }
  screenResolution=new Point(width,height);
  Log.i(TAG,"Screen resolution: " + screenResolution);
  cameraResolution=findBestPreviewSizeValue(parameters,screenResolution);
  Log.i(TAG,"Camera resolution: " + cameraResolution);
}
 

Example 21

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

Source file: Camera.java

  31 
vote

private Size getOptimalPreviewSize(List<Size> sizes,double targetRatio){
  final double ASPECT_TOLERANCE=0.05;
  if (sizes == null)   return null;
  Size optimalSize=null;
  double minDiff=Double.MAX_VALUE;
  Display display=getWindowManager().getDefaultDisplay();
  int targetHeight=Math.min(display.getHeight(),display.getWidth());
  if (targetHeight <= 0) {
    WindowManager windowManager=(WindowManager)getSystemService(Context.WINDOW_SERVICE);
    targetHeight=windowManager.getDefaultDisplay().getHeight();
  }
  for (  Size size : sizes) {
    double ratio=(double)size.width / size.height;
    if (Math.abs(ratio - targetRatio) > ASPECT_TOLERANCE)     continue;
    if (Math.abs(size.height - targetHeight) < minDiff) {
      optimalSize=size;
      minDiff=Math.abs(size.height - targetHeight);
    }
  }
  if (optimalSize == null) {
    Log.v(TAG,"No preview size match the aspect ratio");
    minDiff=Double.MAX_VALUE;
    for (    Size size : sizes) {
      if (Math.abs(size.height - targetHeight) < minDiff) {
        optimalSize=size;
        minDiff=Math.abs(size.height - targetHeight);
      }
    }
  }
  Log.v(TAG,String.format("Optimal preview size is %sx%s",optimalSize.width,optimalSize.height));
  return optimalSize;
}
 

Example 22

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

Source file: GridInputProcessor.java

  31 
vote

public GridInputProcessor(Context context,GridCamera camera,GridLayer layer,RenderView view,Pool<Vector3f> pool,DisplayItem[] displayItems){
  mPool=pool;
  mCamera=camera;
  mLayer=layer;
  mCurrentFocusSlot=Shared.INVALID;
  mCurrentSelectedSlot=Shared.INVALID;
  mCurrentScaleSlot=Shared.INVALID;
  mContext=context;
  mDisplayItems=displayItems;
  mGestureDetector=new GestureDetector(context,this);
  mScaleGestureDetector=new ScaleGestureDetector(context,this);
  mGestureDetector.setIsLongpressEnabled(true);
  mZoomGesture=false;
  mScale=1.0f;
  mSupportPanAndZoom=context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH);
{
    WindowManager windowManager=(WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
    mDisplay=windowManager.getDefaultDisplay();
  }
}
 

Example 23

From project cocos2d, under directory /cocos2d-android/src/org/cocos2d/nodes/.

Source file: CCDirector.java

  31 
vote

private CGRect getAppFrameRect(float targetRatio){
  WindowManager w=theApp.getWindowManager();
  CGSize size=CGSize.make(w.getDefaultDisplay().getWidth(),w.getDefaultDisplay().getHeight());
  float currentRation=size.width / size.height;
  CGSize newSize=CGSize.make(size.width,size.height);
  CGPoint offset=CGPoint.make(0,0);
  if (currentRation > targetRatio) {
    newSize.width=targetRatio * size.height;
    offset.x=(size.width - newSize.width) / 2;
  }
 else   if (currentRation < targetRatio) {
    newSize.height=size.width / targetRatio;
    offset.y=(size.height - newSize.height) / 2;
  }
  CGRect rect=CGRect.make(offset,newSize);
  return rect;
}
 

Example 24

From project dungbeetle, under directory /src/com/google/zxing/client/android/encode/.

Source file: EncodeActivity.java

  31 
vote

@Override protected void onResume(){
  super.onResume();
  WindowManager manager=(WindowManager)getSystemService(WINDOW_SERVICE);
  Display display=manager.getDefaultDisplay();
  int width=display.getWidth();
  int height=display.getHeight();
  int smallerDimension=width < height ? width : height;
  smallerDimension=smallerDimension * 7 / 8;
  Intent intent=getIntent();
  try {
    qrCodeEncoder=new QRCodeEncoder(this,intent,smallerDimension);
    setTitle(R.string.scan_here);
    Bitmap bitmap=qrCodeEncoder.encodeAsBitmap();
    ImageView view=(ImageView)findViewById(R.id.image_view);
    view.setImageBitmap(bitmap);
    TextView contents=(TextView)findViewById(R.id.contents_text_view);
    contents.setText(qrCodeEncoder.getDisplayContents());
  }
 catch (  WriterException e) {
    Log.e(TAG,"Could not encode barcode",e);
    showErrorMessage(R.string.msg_encode_contents_failed);
    qrCodeEncoder=null;
  }
catch (  IllegalArgumentException e) {
    Log.e(TAG,"Could not encode barcode",e);
    showErrorMessage(R.string.msg_encode_contents_failed);
    qrCodeEncoder=null;
  }
}
 

Example 25

From project abalone-android, under directory /src/com/bytopia/abalone/.

Source file: SplashAcitvity.java

  29 
vote

public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.splash);
  Thread splashTimer=new Thread(){
    public void run(){
      try {
        long ms=0;
        while (m_bSplashActive && ms < m_dwSplashTime) {
          sleep(100);
          if (!m_bPaused)           ms+=100;
        }
        startActivity(new Intent("com.bytopia.abalone.MAINMENU"));
      }
 catch (      Exception e) {
        Log.e("Splash",e.toString());
      }
 finally {
        finish();
      }
    }
  }
;
  splashTimer.start();
}
 

Example 26

From project Alerte-voirie-android, under directory /src/net/londatiga/android/.

Source file: CustomPopupWindow.java

  29 
vote

/** 
 * Create a QuickAction
 * @param anchor the view that the QuickAction will be displaying 'from'
 */
public CustomPopupWindow(View anchor){
  this.anchor=anchor;
  this.window=new PopupWindow(anchor.getContext());
  window.setTouchInterceptor(new OnTouchListener(){
    @Override public boolean onTouch(    View v,    MotionEvent event){
      if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
        CustomPopupWindow.this.window.dismiss();
        return true;
      }
      return false;
    }
  }
);
  windowManager=(WindowManager)anchor.getContext().getSystemService(Context.WINDOW_SERVICE);
  onCreate();
}
 

Example 27

From project AmDroid, under directory /AmDroid/src/main/java/com/jaeckel/amenoid/.

Source file: SignupDialog.java

  29 
vote

@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.fragment_sign_up,container);
  nameEditText=(EditText)view.findViewById(R.id.name_edit_text);
  if (!TextUtils.isEmpty(name)) {
    nameEditText.setText(name);
  }
  emailEditText=(EditText)view.findViewById(R.id.email_edit_text);
  if (!TextUtils.isEmpty(email)) {
    emailEditText.setText(email);
  }
  passwordEditText=(EditText)view.findViewById(R.id.passowrd_edit_text);
  if (!TextUtils.isEmpty(password)) {
    passwordEditText.setText(password);
  }
  cancelButton=(Button)view.findViewById(R.id.button_cancel);
  cancelButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      SignupDialog.this.dismiss();
    }
  }
);
  submitButton=(Button)view.findViewById(R.id.button_submit);
  submitButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      name=nameEditText.getText().toString();
      email=emailEditText.getText().toString();
      password=passwordEditText.getText().toString();
      new SignupAsyncTask(getActivity(),name,email,password).executeOnThreadPool();
    }
  }
);
  getDialog().setTitle("Sign up for getamen.com");
  nameEditText.setNextFocusDownId(R.id.email_edit_text);
  emailEditText.setNextFocusDownId(R.id.passowrd_edit_text);
  nameEditText.requestFocus();
  getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
  passwordEditText.setOnEditorActionListener(this);
  return view;
}
 

Example 28

From project android-api-demos, under directory /src/com/mobeelizer/demos/adapters/.

Source file: FileSyncAdapter.java

  29 
vote

/** 
 * Constructor
 * @param context
 * @param objects
 */
public FileSyncAdapter(final Context context,final List<FileSyncEntity> objects){
  super(context,R.layout.itemized_list_item,R.id.listItemLowerText,objects);
  mInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  mRes=context.getResources();
  mDisplayMetrics=new DisplayMetrics();
  ((WindowManager)context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getMetrics(mDisplayMetrics);
}
 

Example 29

From project android-bankdroid, under directory /src/com/liato/bankdroid/.

Source file: BetterPopupWindow.java

  29 
vote

/** 
 * Create a BetterPopupWindow
 * @param anchor the view that the BetterPopupWindow will be displaying 'from'
 */
public BetterPopupWindow(View anchor){
  this.anchor=anchor;
  this.window=new PopupWindow(anchor.getContext());
  this.window.setTouchInterceptor(new OnTouchListener(){
    @Override public boolean onTouch(    View v,    MotionEvent event){
      if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
        BetterPopupWindow.this.window.dismiss();
        return true;
      }
      return false;
    }
  }
);
  this.windowManager=(WindowManager)this.anchor.getContext().getSystemService(Context.WINDOW_SERVICE);
  onCreate();
}
 

Example 30

From project android-client, under directory /xwiki-android-client/src/org/xwiki/android/client/blog/.

Source file: Blogger.java

  29 
vote

private void showRetreiveDialog(){
  ret_dialog=new Dialog(this);
  ret_dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
  ret_dialog.setTitle("Page to retreive");
  LayoutInflater li=(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View dialogView=li.inflate(R.layout.blog_retreive_dialog,null);
  ret_dialog.setContentView(dialogView);
  ret_dialog.show();
  Button okBtn=(Button)dialogView.findViewById(R.id.blg_ret_btn_ok);
  etPageName=(EditText)dialogView.findViewById(R.id.blg_ret_et_pageName);
  okBtn.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      DocumentReference dref=new DocumentReference("xwiki","Blog",etPageName.getText().toString());
      DocumentRemoteSvcCallbacks clbk=new DocumentRemoteSvcCallbacks(){
        @Override public void onFullyRetreived(        Document res,        boolean success,        RaoException ex){
          if (success) {
            ret_dialog.dismiss();
            progDialog.dismiss();
            Intent i=new Intent(Blogger.this,EditPostActivity.class);
            i.putExtra(EditPostActivity.ARG_UPDATE_DOC,res);
            startActivity(i);
          }
 else {
            progDialog.dismiss();
          }
        }
      }
;
      progDialog=ProgressDialog.show(Blogger.this,"Processing","Fetching document from server");
      dsvc.retreive(dref,clbk);
    }
  }
);
}
 

Example 31

From project Android-File-Manager, under directory /src/com/nexes/manager/.

Source file: AudioPlayblack.java

  29 
vote

public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
  setContentView(R.layout.audio_layout);
  mp=new MediaPlayer();
  label=(TextView)findViewById(R.id.music_label);
  play_button=(Button)findViewById(R.id.media_play_button);
  play_button.setText("Preview");
  play_button.setOnClickListener(new ButtonHandler());
  close_button=(Button)findViewById(R.id.media_close_button);
  close_button.setText("Close");
  close_button.setOnClickListener(new ButtonHandler());
  music_path=getIntent().getExtras().getString("MUSIC PATH");
  music_name=music_path.substring(music_path.lastIndexOf("/") + 1,music_path.length());
  label.setText("Audio file: " + music_name);
}
 

Example 32

From project Android-GifStitch, under directory /src/com/phunkosis/gifstitch/views/.

Source file: CameraSurface.java

  29 
vote

private void initializeScreenBrightness(){
  Window win=this.mActivity.getWindow();
  int mode=Settings.System.getInt(this.getContext().getContentResolver(),Settings.System.SCREEN_BRIGHTNESS_MODE,Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
  if (mode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) {
    WindowManager.LayoutParams winParams=win.getAttributes();
    winParams.screenBrightness=DEFAULT_CAMERA_BRIGHTNESS;
    win.setAttributes(winParams);
  }
}
 

Example 33

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

Source file: CloudActivity.java

  29 
vote

protected final void showDialog(){
  if (pDialog == null || !pDialog.isShowing()) {
    isLoading=true;
    pDialog=new ProgressDialog(this);
    pDialog.setProgressStyle(R.style.NewDialog);
    pDialog.setOnCancelListener(new OnCancelListener(){
      @Override public void onCancel(      DialogInterface dialog){
        finish();
      }
    }
);
    pDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
    pDialog.show();
    pDialog.setContentView(new ProgressBar(this),new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
  }
}
 

Example 34

From project Android-Terminal-Emulator, under directory /src/jackpal/androidterm/.

Source file: Term.java

  29 
vote

private void updatePrefs(){
  DisplayMetrics metrics=new DisplayMetrics();
  getWindowManager().getDefaultDisplay().getMetrics(metrics);
  ColorScheme colorScheme=new ColorScheme(mSettings.getColorScheme());
  mViewFlipper.updatePrefs(mSettings);
  for (  View v : mViewFlipper) {
    ((EmulatorView)v).setDensity(metrics);
    ((TermView)v).updatePrefs(mSettings);
  }
  if (mTermSessions != null) {
    for (    TermSession session : mTermSessions) {
      ((ShellTermSession)session).updatePrefs(mSettings);
    }
  }
{
    Window win=getWindow();
    WindowManager.LayoutParams params=win.getAttributes();
    final int FULLSCREEN=WindowManager.LayoutParams.FLAG_FULLSCREEN;
    int desiredFlag=mSettings.showStatusBar() ? 0 : FULLSCREEN;
    if (desiredFlag != (params.flags & FULLSCREEN) || (AndroidCompat.SDK >= 11 && mActionBarMode != mSettings.actionBarMode())) {
      if (mAlreadyStarted) {
        restart();
      }
 else {
        win.setFlags(desiredFlag,FULLSCREEN);
        if (mActionBarMode == TermSettings.ACTION_BAR_MODE_HIDES) {
          mActionBar.hide();
        }
      }
    }
  }
}
 

Example 35

From project android-thaiime, under directory /latinime/src/com/android/inputmethod/compat/.

Source file: InputMethodServiceCompatWrapper.java

  29 
vote

public void showOptionDialogInternal(AlertDialog dialog){
  final IBinder windowToken=KeyboardSwitcher.getInstance().getKeyboardView().getWindowToken();
  if (windowToken == null)   return;
  dialog.setCancelable(true);
  dialog.setCanceledOnTouchOutside(true);
  final Window window=dialog.getWindow();
  final WindowManager.LayoutParams lp=window.getAttributes();
  lp.token=windowToken;
  lp.type=WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
  window.setAttributes(lp);
  window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
  mOptionsDialog=dialog;
  dialog.show();
}
 

Example 36

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

Source file: LinphoneActivity.java

  29 
vote

void hideScreen(boolean isHidden){
  WindowManager.LayoutParams lAttrs=getWindow().getAttributes();
  if (isHidden) {
    lAttrs.flags|=WindowManager.LayoutParams.FLAG_FULLSCREEN;
    mMainFrame.setVisibility(View.INVISIBLE);
  }
 else {
    lAttrs.flags&=(~WindowManager.LayoutParams.FLAG_FULLSCREEN);
    mMainFrame.setVisibility(View.VISIBLE);
  }
  getWindow().setAttributes(lAttrs);
}
 

Example 37

From project android-xbmcremote, under directory /src/org/xbmc/android/remote/presentation/activity/.

Source file: HomeActivity.java

  29 
vote

@Override public Dialog onCreateDialog(int id){
  mProgressDialog=new ProgressDialog(this);
  mProgressDialog.setMessage("");
  mProgressDialog.setProgress(0);
  mProgressDialog.setOnCancelListener(new OnCancelListener(){
    public void onCancel(    DialogInterface dialog){
      mProgressThread.cancel();
    }
  }
);
  mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
  mProgressDialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
  return mProgressDialog;
}
 

Example 38

From project androidtracks, under directory /src/org/sfcta/cycletracks/.

Source file: SaveTrip.java

  29 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.save);
  finishRecording();
  purpose="";
  preparePurposeButtons();
  final Button prefsButton=(Button)findViewById(R.id.ButtonPrefs);
  final Intent pi=new Intent(this,UserInfoActivity.class);
  prefsButton.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      startActivity(pi);
    }
  }
);
  SharedPreferences settings=getSharedPreferences("PREFS",0);
  if (settings.getAll().size() >= 1) {
    prefsButton.setVisibility(View.GONE);
  }
  final Button btnDiscard=(Button)findViewById(R.id.ButtonDiscard);
  btnDiscard.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      Toast.makeText(getBaseContext(),"Trip discarded.",Toast.LENGTH_SHORT).show();
      cancelRecording();
      Intent i=new Intent(SaveTrip.this,MainInput.class);
      i.putExtra("keepme",true);
      startActivity(i);
      SaveTrip.this.finish();
    }
  }
);
  final Button btnSubmit=(Button)findViewById(R.id.ButtonSubmit);
  btnSubmit.setEnabled(false);
  this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
}
 

Example 39

From project android_aosp_packages_apps_Settings, under directory /src/com/android/settings/.

Source file: BandMode.java

  29 
vote

@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
  setContentView(R.layout.band_mode);
  setTitle(getString(R.string.band_mode_title));
  getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT,WindowManager.LayoutParams.WRAP_CONTENT);
  mPhone=PhoneFactory.getDefaultPhone();
  mBandList=(ListView)findViewById(R.id.band);
  mBandListAdapter=new ArrayAdapter<BandListItem>(this,android.R.layout.simple_list_item_1);
  mBandList.setAdapter(mBandListAdapter);
  mBandList.setOnItemClickListener(mBandSelectionHandler);
  loadBandList();
}
 

Example 40

From project android_packages_apps_CellBroadcastReceiver, under directory /src/com/android/cellbroadcastreceiver/.

Source file: CellBroadcastAlertFullScreen.java

  29 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  final Window win=getWindow();
  win.requestFeature(Window.FEATURE_NO_TITLE);
  win.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
  if (!getIntent().getBooleanExtra(SCREEN_OFF,false)) {
    win.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  }
  mMessage=getIntent().getParcelableExtra(CellBroadcastMessage.SMS_CB_MESSAGE_EXTRA);
  updateLayout(mMessage);
}
 

Example 41

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

Source file: CdmaDisplayInfo.java

  29 
vote

/** 
 * Handle the DisplayInfo record and display the alert dialog with the network message.
 * @param context context to get strings.
 * @param infoMsg Text message from Network.
 */
public static void displayInfoRecord(Context context,String infoMsg){
  if (DBG)   log("displayInfoRecord: infoMsg=" + infoMsg);
  if (sDisplayInfoDialog != null) {
    sDisplayInfoDialog.dismiss();
  }
  sDisplayInfoDialog=new AlertDialog.Builder(context).setIcon(android.R.drawable.ic_dialog_info).setTitle(context.getText(R.string.network_message)).setMessage(infoMsg).setCancelable(true).create();
  sDisplayInfoDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG);
  sDisplayInfoDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
  sDisplayInfoDialog.show();
  PhoneApp.getInstance().wakeUpScreen();
}
 

Example 42

From project android_packages_apps_QuickSearchBox, under directory /src/com/android/quicksearchbox/.

Source file: CorpusSelectionDialog.java

  29 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  setContentView(R.layout.corpus_selection_dialog);
  mCorpusGrid=(GridView)findViewById(R.id.corpus_grid);
  mCorpusGrid.setOnItemClickListener(new CorpusClickListener());
  mCorpusGrid.setFocusable(true);
  mEditItems=(ImageView)findViewById(R.id.corpus_edit_items);
  mEditItems.setOnClickListener(new CorpusEditListener());
  Window window=getWindow();
  WindowManager.LayoutParams lp=window.getAttributes();
  lp.width=WindowManager.LayoutParams.MATCH_PARENT;
  lp.height=WindowManager.LayoutParams.MATCH_PARENT;
  lp.flags|=WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
  window.setAttributes(lp);
  if (DBG)   Log.d(TAG,"Window params: " + lp);
}
 

Example 43

From project android_packages_apps_Superuser, under directory /src/com/noshufou/android/su/widget/.

Source file: BetterPopupWindow.java

  29 
vote

/** 
 * Create a BetterPopupWindow
 * @param anchor the view that the BetterPopupWindow will be displaying 'from'
 */
public BetterPopupWindow(View anchor){
  this.anchor=anchor;
  this.window=new PopupWindow(anchor.getContext());
  this.window.setTouchInterceptor(new OnTouchListener(){
    @Override public boolean onTouch(    View v,    MotionEvent event){
      if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
        BetterPopupWindow.this.window.dismiss();
        return true;
      }
      return false;
    }
  }
);
  this.windowManager=(WindowManager)this.anchor.getContext().getSystemService(Context.WINDOW_SERVICE);
  onCreate();
}
 

Example 44

From project android_packages_apps_Tag, under directory /src/com/android/apps/tag/.

Source file: TagViewer.java

  29 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (SHOW_OVER_LOCK_SCREEN) {
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
  }
  setContentView(R.layout.tag_viewer);
  mTagContent=(LinearLayout)findViewById(R.id.list);
  mTitle=(TextView)findViewById(R.id.title);
  mDate=(TextView)findViewById(R.id.date);
  mIcon=(ImageView)findViewById(R.id.icon);
  mStar=(CheckBox)findViewById(R.id.star);
  mDeleteButton=(Button)findViewById(R.id.button_delete);
  mDoneButton=(Button)findViewById(R.id.button_done);
  mDeleteButton.setOnClickListener(this);
  mDoneButton.setOnClickListener(this);
  mStar.setOnClickListener(this);
  mIcon.setImageResource(R.drawable.ic_launcher_nfc);
  resolveIntent(getIntent());
}
 

Example 45

From project android_packages_inputmethods_LatinIME, under directory /java/src/com/android/inputmethod/compat/.

Source file: InputMethodServiceCompatWrapper.java

  29 
vote

public void showOptionDialogInternal(AlertDialog dialog){
  final IBinder windowToken=KeyboardSwitcher.getInstance().getKeyboardView().getWindowToken();
  if (windowToken == null)   return;
  dialog.setCancelable(true);
  dialog.setCanceledOnTouchOutside(true);
  final Window window=dialog.getWindow();
  final WindowManager.LayoutParams lp=window.getAttributes();
  lp.token=windowToken;
  lp.type=WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
  window.setAttributes(lp);
  window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
  mOptionsDialog=dialog;
  dialog.show();
}
 

Example 46

From project androlog, under directory /androlog/src/main/java/de/akquinet/android/androlog/reporter/.

Source file: Report.java

  29 
vote

/** 
 * Adds the device data to the report.
 * @param report the report
 * @throws JSONException if the device data cannot be added
 */
private void addDeviceData(JSONObject report) throws JSONException {
  JSONObject device=new JSONObject();
  device.put("device",Build.DEVICE);
  device.put("brand",Build.BRAND);
  Object windowService=context.getSystemService(Context.WINDOW_SERVICE);
  if (windowService instanceof WindowManager) {
    Display display=((WindowManager)windowService).getDefaultDisplay();
    device.put("resolution",display.getWidth() + "x" + display.getHeight());
    device.put("orientation",display.getOrientation());
  }
  device.put("display",Build.DISPLAY);
  device.put("manufacturer",Build.MANUFACTURER);
  device.put("model",Build.MODEL);
  device.put("product",Build.PRODUCT);
  device.put("build.type",Build.TYPE);
  device.put("android.version",Build.VERSION.SDK_INT);
  report.put("device",device);
}
 

Example 47

From project Anki-Android, under directory /src/com/ichi2/anki/.

Source file: Reviewer.java

  29 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Log.i(AnkiDroidApp.TAG,"Reviewer - onCreate");
  if (AnkiDroidApp.deck() == null) {
    setResult(StudyOptions.CONTENT_NO_EXTERNAL_STORAGE);
    finish();
  }
 else {
    restorePreferences();
    if (mPrefFullscreenReview) {
      getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
      requestWindowFeature(Window.FEATURE_NO_TITLE);
    }
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    registerExternalStorageListener();
    initLayout(R.layout.flashcard_portrait);
    try {
      mCardTemplate=Utils.convertStreamToString(getAssets().open("card_template.html"));
      mCardTemplate=mCardTemplate.replaceFirst("var availableWidth = \\d*;","var availableWidth = " + getAvailableWidthInCard() + ";");
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
    long timelimit=AnkiDroidApp.deck().getSessionTimeLimit() * 1000;
    Log.i(AnkiDroidApp.TAG,"SessionTimeLimit: " + timelimit + " ms.");
    mSessionTimeLimit=System.currentTimeMillis() + timelimit;
    mSessionCurrReps=0;
    DeckTask.launchDeckTask(DeckTask.TASK_TYPE_ANSWER_CARD,mAnswerCardHandler,new DeckTask.TaskData(0,AnkiDroidApp.deck(),null));
  }
}
 

Example 48

From project AnySoftKeyboard, under directory /src/com/anysoftkeyboard/.

Source file: AnySoftKeyboard.java

  29 
vote

private void showOptionsMenu(){
  AlertDialog.Builder builder=new AlertDialog.Builder(this);
  builder.setCancelable(true);
  builder.setIcon(R.drawable.ic_launcher);
  builder.setNegativeButton(android.R.string.cancel,null);
  CharSequence itemSettings=getString(R.string.ime_settings);
  CharSequence itemOverrideDictionary=getString(R.string.override_dictionary);
  CharSequence itemInputMethod=getString(R.string.change_ime);
  builder.setItems(new CharSequence[]{itemSettings,itemOverrideDictionary,itemInputMethod},new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface di,    int position){
      di.dismiss();
switch (position) {
case 0:
        launchSettings();
      break;
case 1:
    launchDictionaryOverriding();
  break;
case 2:
((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE)).showInputMethodPicker();
break;
}
}
}
);
builder.setTitle(getResources().getString(R.string.ime_name));
mOptionsDialog=builder.create();
Window window=mOptionsDialog.getWindow();
WindowManager.LayoutParams lp=window.getAttributes();
lp.token=mInputView.getWindowToken();
lp.type=WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
window.setAttributes(lp);
window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
mOptionsDialog.show();
}
 

Example 49

From project BBC-News-Reader, under directory /src/com/digitallizard/bbcnewsreader/fragments/.

Source file: CategoryFragment.java

  29 
vote

public void displayCategory(String categoryTitle){
  int rowPixelWidth=((WindowManager)getActivity().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getWidth();
  int rowLength=(int)Math.floor(rowPixelWidth / THUMBNAIL_WIDTH_PX);
  int thumbWidth=(int)Math.floor(rowPixelWidth / rowLength);
  int thumbHeight=(int)Math.floor((thumbWidth / THUMBNAIL_WIDTH_PX) * THUMBNAIL_HEIGHT_PX);
  grid.setNumColumns(rowLength);
  items=new ArrayList<NewsItem>(Arrays.asList(database.getItems(categoryTitle,28)));
  grid.setAdapter(new ItemAdapter(getActivity(),R.layout.list_news_item,items,thumbWidth,thumbHeight));
}
 

Example 50

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

Source file: UserAlliance.java

  29 
vote

public UserAlliance(Context context,int section,String allianceID){
  super(context,R.style.ThemeBeintoo);
  setContentView(R.layout.useralliance);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  current=this;
  currentContext=context;
  ratio=(context.getApplicationContext().getResources().getDisplayMetrics().densityDpi / 160d);
  double pixels=ratio * 40;
  RelativeLayout beintooBar=(RelativeLayout)findViewById(R.id.beintoobarsmall);
  beintooBar.setBackgroundDrawable(new BDrawableGradient(0,(int)pixels,BDrawableGradient.BAR_GRADIENT));
  listView=(ListView)findViewById(R.id.listView);
  listView.setVisibility(LinearLayout.GONE);
  listView.setCacheColorHint(0);
  content=(LinearLayout)findViewById(R.id.goodcontent);
  content.addView(progressLoading());
  TextView title=(TextView)findViewById(R.id.dialogTitle);
  title.setTextColor(Color.WHITE);
  if (section == ENTRY_VIEW) {
    title.setText(current.getContext().getString(R.string.alliance));
    loadEntryView();
  }
 else   if (section == CREATE_ALLIANCE) {
    title.setText(current.getContext().getString(R.string.alliancemaincreate));
    createAllianceForm();
  }
 else   if (section == SHOW_ALLIANCE) {
    showAlliance(allianceID);
  }
 else   if (section == PENDING_REQUESTS) {
    title.setText(current.getContext().getString(R.string.allianceviewpending));
    pendingRequests();
  }
 else   if (section == ALLIANCES_LIST) {
    title.setText(current.getContext().getString(R.string.alliancemainlist));
    loadAlliancesList();
  }
}
 

Example 51

From project BibleQuote-for-Android, under directory /src/com/BibleQuote/activity/.

Source file: SplashActivity.java

  29 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.main);
  Log.Init(getApplicationContext());
  Log.i(TAG,"Get link on application...");
  BibleQuoteApp app=(BibleQuoteApp)getApplication();
  Log.i(TAG,"Get progress message...");
  String progressMessage=getResources().getString(R.string.messageLoad);
  Log.i(TAG,"Get AsyncTask manager...");
  AsyncManager myAsyncManager=app.getAsyncManager();
  Log.i(TAG,"Restore old task...");
  myAsyncManager.handleRetainedTask(getLastNonConfigurationInstance(),this);
  Log.i(TAG,"Start task InitApplication...");
  myAsyncManager.setupTask(new AsyncCommand(new InitApplication(),progressMessage,true),this);
}
 

Example 52

From project Biljetter, under directory /src/se/rebootit/android/tagbiljetter/.

Source file: TicketView.java

  29 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.ticketview);
  getSupportActionBar().setTitle(getString(R.string.TicketView_header));
  Intent intent=getIntent();
  this.ticket=intent.getParcelableExtra("ticket");
  this.fromNotification=intent.getBooleanExtra("fromNotification",false);
  if (sharedPreferences.getBoolean("keepscreenon",false)) {
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  }
  LinearLayout layoutHeader=(LinearLayout)findViewById(R.id.header);
  TextView txtCompanyname=(TextView)findViewById(R.id.companyname);
  ImageView imgCompanyLogo=(ImageView)findViewById(R.id.companylogo);
  TransportCompany transportCompany=dataParser.getCompany(ticket.getProvider());
  if (transportCompany.getLogo() == null) {
    imgCompanyLogo.setVisibility(ImageView.GONE);
  }
 else {
    int logo=Biljetter.getContext().getResources().getIdentifier(transportCompany.getLogo(),"drawable","se.rebootit.android.tagbiljetter");
    int logobg=Biljetter.getContext().getResources().getIdentifier(transportCompany.getLogo() + "_bg","drawable","se.rebootit.android.tagbiljetter");
    imgCompanyLogo.setImageResource(logo);
    layoutHeader.setBackgroundResource(logobg == 0 ? R.drawable.header_background : logobg);
  }
  txtCompanyname.setTextColor(Color.parseColor(transportCompany.getTextColor()));
  txtCompanyname.setText(transportCompany.getName());
  ((TextView)findViewById(R.id.sender)).setText(ticket.getAddress());
  if (!"".equals(ticket.getTicketTimestampFormatted())) {
    ((TextView)findViewById(R.id.validtoHeader)).setVisibility(TextView.VISIBLE);
    ((TextView)findViewById(R.id.validto)).setVisibility(TextView.VISIBLE);
    ((TextView)findViewById(R.id.validto)).setText(ticket.getTicketTimestampFormatted());
  }
  ((TextView)findViewById(R.id.received)).setText(ticket.getTimestampFormatted());
  ((TextView)findViewById(R.id.message)).setText(ticket.getMessage());
  mNotificationManager=(NotificationManager)this.getSystemService(Context.NOTIFICATION_SERVICE);
}
 

Example 53

From project Birthdays, under directory /src/com/rexmenpara/birthdays/.

Source file: EditBirthdayDialog.java

  29 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  try {
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
    setContentView(R.layout.view_edit_dialog);
    String birthday=getIntent().getStringExtra("birthday");
    boolean reminder=getIntent().getBooleanExtra("reminder",true);
    long rowId=getIntent().getLongExtra("rowId",-1);
    DatePicker picker=(DatePicker)this.findViewById(R.id.birthdayPicker);
    Date date=DateUtility.parseDate(birthday);
    int year=date.getYear();
    if (year <= 0) {
      CheckBox chkIgnoreYear=(CheckBox)this.findViewById(R.id.chkIgnoreYear);
      chkIgnoreYear.setVisibility(View.VISIBLE);
      chkIgnoreYear.setChecked(true);
      year=new Date().getYear();
    }
    year=1900 + year;
    picker.updateDate(year,date.getMonth(),date.getDate());
    CheckBox chkReminder=(CheckBox)this.findViewById(R.id.chkReminder);
    chkReminder.setChecked(reminder);
    Button btnSet=(Button)findViewById(R.id.btnOk);
    btnSet.setOnClickListener(new BtnListener(true,rowId));
    Button btnCancel=(Button)findViewById(R.id.btnCancel);
    btnCancel.setOnClickListener(new BtnListener(false,rowId));
  }
 catch (  ParseException e) {
    ErrorReportHandler.collectData(e.getMessage());
  }
}
 

Example 54

From project blokish, under directory /src/org/scoutant/blokish/.

Source file: ButtonsView.java

  29 
vote

public ButtonsView(Context context){
  super(context);
  this.context=context;
  setVisibility(INVISIBLE);
  Display display=((WindowManager)context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
  int h=display.getHeight() - display.getWidth();
  setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT,h,Gravity.BOTTOM));
  cancel=button(R.drawable.cancel,doCancel,0);
  addView(cancel);
  ok=button(R.drawable.checkmark,doOk,1);
  addView(ok);
  setOkState(false);
}
 

Example 55

From project Cafe, under directory /testrunner/src/com/baidu/cafe/remote/.

Source file: Armser.java

  29 
vote

public Armser(Context context){
  mContext=context;
  db=new Database(mContext.getContentResolver());
  Display display=((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
  mScreenHeight=display.getHeight();
  mScreenWidth=display.getWidth();
  serviceConnection=new MyServiceConnection();
}
 

Example 56

From project CHMI, under directory /src/org/kaldax/app/chmi/.

Source file: CHMI.java

  29 
vote

private void setScreenMode(){
  if (chmiConfigBundle._fullscreen_mode) {
    this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
    getWindow().requestFeature(Window.FEATURE_PROGRESS);
  }
 else {
    this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
    getWindow().requestFeature(Window.FEATURE_PROGRESS);
  }
}
 

Example 57

From project Common-Sense-Net-2, under directory /RealFarm/src/com/commonsensenet/realfarm/.

Source file: HelpEnabledActivity.java

  29 
vote

/** 
 * Initializes all the shared components.
 */
protected void initActivity(){
  mDataProvider=RealFarmProvider.getInstance(this);
  mSoundQueue=SoundQueue.getInstance();
  ApplicationTracker.getInstance().logEvent(EventType.ACTIVITY_VIEW,Global.userId,getLogTag());
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  BitmapDrawable bg=(BitmapDrawable)getResources().getDrawable(R.drawable.bg_curved_extended);
  getSupportActionBar().setBackgroundDrawable(bg);
}
 

Example 58

From project connectbot, under directory /src/sk/vx/connectbot/.

Source file: ConsoleActivity.java

  29 
vote

@Override public void onResume(){
  super.onResume();
  Log.d(TAG,"onResume called");
  if (prefs.getBoolean(PreferenceConstants.KEEP_ALIVE,true)) {
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  }
 else {
    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  }
  configureOrientation();
  if (forcedOrientation && bound != null)   bound.setResizeAllowed(true);
}
 

Example 59

From project cow, under directory /src/com/ad/cow/.

Source file: AbstractActivity.java

  29 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  adView=new AdView(this,AdSize.BANNER,"a14fbaa462a5c66");
}
 

Example 60

From project cw-advandroid, under directory /Tapjacking/Jackalope/src/com/commonsware/android/tj/jackalope/.

Source file: Tapjacker.java

  29 
vote

@Override public void onCreate(){
  super.onCreate();
  v=new View(this);
  v.setOnTouchListener(this);
  mgr=(WindowManager)getSystemService(WINDOW_SERVICE);
  WindowManager.LayoutParams params=new WindowManager.LayoutParams(WindowManager.LayoutParams.FILL_PARENT,WindowManager.LayoutParams.FILL_PARENT,WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,PixelFormat.TRANSPARENT);
  params.gravity=Gravity.FILL_HORIZONTAL | Gravity.FILL_VERTICAL;
  mgr.addView(v,params);
}
 

Example 61

From project cw-omnibus, under directory /Tapjacking/Jackalope/src/com/commonsware/android/tj/jackalope/.

Source file: Tapjacker.java

  29 
vote

@Override public void onCreate(){
  super.onCreate();
  v=new View(this);
  v.setOnTouchListener(this);
  mgr=(WindowManager)getSystemService(WINDOW_SERVICE);
  WindowManager.LayoutParams params=new WindowManager.LayoutParams(WindowManager.LayoutParams.FILL_PARENT,WindowManager.LayoutParams.FILL_PARENT,WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,PixelFormat.TRANSPARENT);
  params.gravity=Gravity.FILL_HORIZONTAL | Gravity.FILL_VERTICAL;
  mgr.addView(v,params);
}
 

Example 62

From project DateSlider, under directory /src/com/googlecode/android/widgets/DateSlider/.

Source file: ScrollLayout.java

  29 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  final Display display=((WindowManager)getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
  final int displayWidth=display.getWidth();
  int childCount=displayWidth / objWidth;
  if (displayWidth % objWidth != 0) {
    childCount++;
  }
  if (childCount % 2 == 0) {
    childCount++;
  }
  final int centerIndex=(childCount / 2);
  removeAllViews();
  for (int i=0; i < childCount; i++) {
    LayoutParams lp=new LayoutParams(objWidth,objHeight);
    TimeView ttv=mLabeler.createView(getContext(),i == centerIndex);
    addView((View)ttv,lp);
  }
  mCenterView=(TimeView)getChildAt(centerIndex);
  mCenterView.setVals(mLabeler.getElem(currentTime));
  Log.v(TAG,"mCenter: " + mCenterView.getTimeText() + " minInterval "+ minuteInterval);
  for (int i=centerIndex + 1; i < childCount; i++) {
    TimeView lastView=(TimeView)getChildAt(i - 1);
    TimeView thisView=(TimeView)getChildAt(i);
    thisView.setVals(mLabeler.add(lastView.getEndTime(),1));
  }
  for (int i=centerIndex - 1; i >= 0; i--) {
    TimeView lastView=(TimeView)getChildAt(i + 1);
    TimeView thisView=(TimeView)getChildAt(i);
    thisView.setVals(mLabeler.add(lastView.getEndTime(),-1));
  }
  childrenWidth=childCount * objWidth;
}
 

Example 63

From project Diktofon, under directory /app/src/kaljurand_at_gmail_dot_com/diktofon/activity/.

Source file: RecorderActivity.java

  29 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.recorder);
  getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  mVolumeBar=getString(R.string.volumeBar);
  mButtonPauseResumeRecorder=(Button)findViewById(R.id.buttonPauseResumeRecording);
  mVolume=(TextView)findViewById(R.id.volume);
  mStatusbar=(TextView)findViewById(R.id.statusbar);
  mChronometer=(Chronometer)findViewById(R.id.chronometer);
  mVolume.setText("");
  mStatusbar.setText("");
  String baseDir=null;
  Bundle extras=getIntent().getExtras();
  if (extras != null) {
    baseDir=extras.getString(EXTRA_BASE_DIR);
    mHighResolution=extras.getBoolean(EXTRA_HIGH_RESOLUTION);
    mSampleRate=extras.getInt(EXTRA_SAMPLE_RATE);
  }
  if (baseDir == null) {
    Dirs.setBaseDir(getPackageName());
    mRecordingsDir=Dirs.getRecorderDir();
  }
 else {
    mRecordingsDir=new File(baseDir);
  }
  if (!mHighResolution) {
    mResolution=AudioFormat.ENCODING_PCM_8BIT;
  }
}
 

Example 64

From project droidkit, under directory /src/org/droidkit/image/app/crop/.

Source file: CropImage.java

  29 
vote

@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.activity_cropimage);
  mImageView=(CropImageView)findViewById(R.id.image);
  mImageView.mContext=this;
}
 

Example 65

From project Ebento, under directory /src/mobisocial/bento/ebento/ui/quickaction/.

Source file: PopupWindows.java

  29 
vote

/** 
 * Constructor.
 * @param context Context
 */
public PopupWindows(Context context){
  mContext=context;
  mWindow=new PopupWindow(context);
  mWindow.setTouchInterceptor(new OnTouchListener(){
    @Override public boolean onTouch(    View v,    MotionEvent event){
      if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
        mWindow.dismiss();
        return true;
      }
      return false;
    }
  }
);
  mWindowManager=(WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
}
 

Example 66

From project ElectricSleep, under directory /src/com/androsz/electricsleepbeta/alarmclock/.

Source file: AlarmAlertFullScreen.java

  29 
vote

@Override protected void onCreate(final Bundle icicle){
  super.onCreate(icicle);
  setTheme(R.style.Theme_Sherlock);
  mAlarm=getIntent().getParcelableExtra(Alarms.ALARM_INTENT_EXTRA);
  final String vol=getSharedPreferences(SettingsActivity.PREFERENCES,0).getString(SettingsActivity.KEY_VOLUME_BEHAVIOR,DEFAULT_VOLUME_BEHAVIOR);
  mVolumeBehavior=Integer.parseInt(vol);
  requestWindowFeature(android.view.Window.FEATURE_NO_TITLE);
  final Window win=getWindow();
  win.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
  final boolean screenOff=getIntent().getBooleanExtra(SCREEN_OFF,false);
  if (!screenOff) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) {
      win.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON);
    }
 else {
      win.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
    }
  }
  updateLayout();
  final IntentFilter filter=new IntentFilter(Alarms.ALARM_KILLED);
  filter.addAction(Alarms.ALARM_SNOOZE_ACTION);
  filter.addAction(Alarms.ALARM_DISMISS_ACTION);
  registerReceiver(mReceiver,filter);
}
 

Example 67

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

Source file: Dashboard.java

  29 
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 68

From project farebot, under directory /src/com/codebutler/farebot/.

Source file: Utils.java

  29 
vote

public static void showErrorAndFinish(final Activity activity,Exception ex){
  try {
    Log.e(activity.getClass().getName(),Utils.getErrorMessage(ex));
    ex.printStackTrace();
    new AlertDialog.Builder(activity).setMessage(Utils.getErrorMessage(ex)).setCancelable(false).setPositiveButton(android.R.string.ok,new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface arg0,      int arg1){
        activity.finish();
      }
    }
).show();
  }
 catch (  WindowManager.BadTokenException unused) {
  }
}
 

Example 69

From project FlickrCity, under directory /src/com/FlickrCity/FlickrCityAndroid/Activities/.

Source file: PhotoActivity.java

  29 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.photo);
  Bundle extras=getIntent().getExtras();
  if (extras != null) {
    newUrl=extras.getString(Constants.URL_KEY);
    owner=extras.getString(Constants.USERNAME_KEY);
    title=extras.getString(Constants.TITLE_KEY);
    flickrPhotoID=extras.getString(Constants.PHOTO_ID_KEY);
    urls_list=extras.getStringArrayList(Constants.URLS_LIST_KEY);
    current_position=extras.getInt(Constants.CURRENT_POSITION);
    mCity=extras.getString(Constants.CITY_NAME_KEY);
    geoTextInfo=extras.getString(Constants.CITY_GEO_INFO_KEY);
  }
  TextView citytext=(TextView)findViewById(R.id.textviewcityname_photo);
  citytext.setText(mCity);
  TextView text_view_lat_lon=(TextView)findViewById(R.id.text_view_lat_lon_photo);
  text_view_lat_lon.setText(geoTextInfo);
  iv=(ImageView)findViewById(R.id.picture_full_size);
  text_username=(TextView)findViewById(R.id.photo_username);
  text_title=(TextView)findViewById(R.id.photo_title);
  gestureDetector=new GestureDetector(new MyGestureDetector());
  ImageButton addToFavButton=(ImageButton)findViewById(R.id.addToFavoriteBtn);
  addToFavButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      addToFavorites();
    }
  }
);
  new BitmapDownloaderTask(PhotoActivity.this).execute(newUrl);
  text_username.setText("By: " + owner);
  if (!"".equals(title))   text_title.setText(title);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  mSettings=PreferenceManager.getDefaultSharedPreferences(this);
}
 

Example 70

From project framework_base_policy, under directory /src/com/android/internal/policy/impl/.

Source file: AccountUnlockScreen.java

  29 
vote

private Dialog getProgressDialog(){
  if (mCheckingDialog == null) {
    mCheckingDialog=new ProgressDialog(mContext);
    mCheckingDialog.setMessage(mContext.getString(R.string.lockscreen_glogin_checking_password));
    mCheckingDialog.setIndeterminate(true);
    mCheckingDialog.setCancelable(false);
    mCheckingDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
  }
  return mCheckingDialog;
}