List of usage examples for android.graphics PixelFormat TRANSPARENT
int TRANSPARENT
To view the source code for android.graphics PixelFormat TRANSPARENT.
Click Source Link
From source file:com.linkbubble.ui.BubbleFlowDraggable.java
public void configure(EventHandler eventHandler, boolean addRootWindow) { mUrlsToOpen = new HashSet<OpenUrlSettings>(); mUrlsToOpenLock = new ReentrantReadWriteLock(); mBubbleFlowWidth = Config.mScreenWidth; mBubbleFlowHeight = getResources().getDimensionPixelSize(R.dimen.bubble_pager_height); configure(mBubbleFlowWidth, getResources().getDimensionPixelSize(R.dimen.bubble_pager_item_width), getResources().getDimensionPixelSize(R.dimen.bubble_pager_item_height)); setBubbleFlowViewListener(new BubbleFlowView.Listener() { @Override// w w w.j av a2 s . co m public void onCenterItemClicked(BubbleFlowView sender, View view) { try { MainController.get().switchToBubbleView(); } catch (NullPointerException exc) { CrashTracking.logHandledException(exc); } } @Override public void onCenterItemLongClicked(BubbleFlowView sender, View view) { if (view instanceof TabView) { MainController mainController = MainController.get(); if (mainController.getActiveTabCount() != 0) { mainController.startDraggingFromContentView(); } } } @Override public void onCenterItemSwiped(VerticalGestureListener.GestureDirection gestureDirection) { // TODO: Implement me } @Override public void onCenterItemChanged(BubbleFlowView sender, View view) { setCurrentTab((TabView) view, true); } }); WindowManager.LayoutParams windowManagerParams = new WindowManager.LayoutParams(); windowManagerParams.gravity = Gravity.TOP | Gravity.LEFT; windowManagerParams.x = 0; windowManagerParams.y = 0; windowManagerParams.height = mBubbleFlowHeight; windowManagerParams.width = mBubbleFlowWidth; windowManagerParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT; windowManagerParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED; windowManagerParams.format = PixelFormat.TRANSPARENT; windowManagerParams.setTitle("LinkBubble: BubbleFlowView"); mDraggableHelper = new DraggableHelper(this, windowManagerParams, false, new DraggableHelper.OnTouchActionEventListener() { @Override public void onActionDown(DraggableHelper.TouchEvent event) { if (mEventHandler != null) { mEventHandler.onMotionEvent_Touch(BubbleFlowDraggable.this, event); } } @Override public void onActionMove(DraggableHelper.MoveEvent event) { if (mEventHandler != null) { mEventHandler.onMotionEvent_Move(BubbleFlowDraggable.this, event); } } @Override public void onActionUp(DraggableHelper.ReleaseEvent event, boolean startDelay) { if (mEventHandler != null) { mEventHandler.onMotionEvent_Release(BubbleFlowDraggable.this, event); } } }); mEventHandler = eventHandler; if (mDraggableHelper.isAlive() && addRootWindow) { MainController.addRootWindow(this, windowManagerParams); setExactPos(0, 0); } mDestroyed = false; StartActivity(); }
From source file:com.example.admin.news.mvp.ui.activities.base.BaseActivity.java
private void initNightView() { if (mIsAddedView) { return;//from ww w . ja v a 2 s. c om } // ?? WindowManager.LayoutParams nightViewParam = new WindowManager.LayoutParams( WindowManager.LayoutParams.TYPE_APPLICATION, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, PixelFormat.TRANSPARENT); mWindowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE); mNightView = new View(this); mWindowManager.addView(mNightView, nightViewParam); mIsAddedView = true; }
From source file:org.telegram.ui.Components.AvatarDrawable.java
@Override public int getOpacity() { return PixelFormat.TRANSPARENT; }
From source file:com.linkbubble.ui.BubbleDraggable.java
public void configure(int x0, int y0, int targetX, int targetY, int targetTime, CanvasView cv) { try {//from w w w .j ava 2 s. c om super.configure("http://blerg.com"); // the URL is not actually used... } catch (MalformedURLException e) { e.printStackTrace(); } //setBackgroundColor(0xff00ff00); mMode = Mode.BubbleView; mAnimActive = false; mHasMoved = false; mCanvasView = cv; mBadgeView = (BadgeView) findViewById(R.id.badge_view); mBadgeView.hide(); mBadgeView.setVisibility(View.GONE); mCircle = new Circle(0, 0, 1); int bubbleSize = getResources().getDimensionPixelSize(R.dimen.bubble_size); WindowManager.LayoutParams windowManagerParams = new WindowManager.LayoutParams(); windowManagerParams.gravity = Gravity.TOP | Gravity.LEFT; windowManagerParams.x = x0; windowManagerParams.y = y0; windowManagerParams.height = bubbleSize; windowManagerParams.width = bubbleSize; windowManagerParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT; windowManagerParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED; windowManagerParams.format = PixelFormat.TRANSPARENT; windowManagerParams.setTitle("LinkBubble: BubbleDraggable"); final MainController controller = MainController.get(); mDraggableHelper = new DraggableHelper(this, windowManagerParams, true, new DraggableHelper.OnTouchActionEventListener() { @Override public void onActionDown(DraggableHelper.TouchEvent e) { if (!mAnimActive) { mCurrentSnapTarget = null; mHasMoved = false; mTouchDown = true; mTouchInitialX = e.posX; mTouchInitialY = e.posY; animate().alpha(1.0f).setDuration(Constant.BUBBLE_ANIM_TIME); mBadgeView.animate().alpha(1.0f).setDuration(Constant.BUBBLE_ANIM_TIME); MainController mainController = MainController.get(); if (mainController != null) { mainController.scheduleUpdate(); } MainApplication.postEvent(getContext(), mBeginBubbleDragEvent); CrashTracking.log("BubbleDraggable.configure(): onActionDown() - start drag"); } } @Override public void onActionMove(DraggableHelper.MoveEvent e) { Log.d(TAG, "!!!!!Moving"); if (mTouchDown) { setVisibility(View.VISIBLE); int targetX = targetX = (int) (e.rawX - Config.mBubbleWidth * 0.5); int targetY = (int) (e.rawY - Config.mBubbleHeight); targetX = Util.clamp(Config.mBubbleSnapLeftX, targetX, Config.mBubbleSnapRightX); targetY = Util.clamp(Config.mBubbleMinY, targetY, Config.mBubbleMaxY); float d = (float) Math.sqrt((e.dx * e.dx) + (e.dy * e.dy)); if (d >= Config.dpToPx(10.0f)) { mHasMoved = true; } if (!mAnimActive) { // c = null, t = null wasn't snapping, no snap -> move // c = 1, t = null was snapping, no snap -> anim out // c = null, t = 1 wasn't snapping, is snap -> anim in // c = 1, t = 1 was snapping, is snapping -> NO move mCircle.Update(targetX + Config.mBubbleWidth * 0.5f, targetY + Config.mBubbleHeight * 0.5f, Config.mBubbleWidth * 0.5f); BubbleTargetView tv = mCanvasView.getSnapTarget(mCircle, 1.0f); if (mCurrentSnapTarget == null) { if (tv == null) { setTargetPos(targetX, targetY, 0.0f, DraggableHelper.AnimationType.DistanceProportion, false, null); } else { tv.beginSnapping(); mCurrentSnapTarget = tv; mTimeOnSnapTarget = 0.0f; Circle dc = tv.GetDefaultCircle(); int xt = (int) (0.5f + dc.mX - Config.mBubbleWidth * 0.5f); int yt = (int) (0.5f + dc.mY - Config.mBubbleHeight * 0.5f); setTargetPos(xt, yt, Config.ANIMATE_TO_SNAP_TIME, DraggableHelper.AnimationType.Linear, false, new DraggableHelper.AnimationEventListener() { @Override public void onAnimationComplete() { onAnimComplete(); } @Override public void onCancel() { onAnimComplete(); } }); } } else { if (tv == null) { setTargetPos(targetX, targetY, 0.05f, DraggableHelper.AnimationType.Linear, false, new DraggableHelper.AnimationEventListener() { @Override public void onAnimationComplete() { mCurrentSnapTarget.endSnapping(); mCurrentSnapTarget.endLongHovering(); mCurrentSnapTarget = null; mTimeOnSnapTarget = 0.f; onAnimComplete(); } @Override public void onCancel() { onAnimComplete(); } }); } } } } } @Override public void onActionUp(DraggableHelper.ReleaseEvent e, boolean startDelay) { if (mTouchDown) { CrashTracking.log("BubbleDraggable.configure(): onActionUp() - end drag"); mDraggableHelper.cancelAnimation(); if (mHasMoved) { if (mCurrentSnapTarget == null) { float v = (float) Math.sqrt(e.vx * e.vx + e.vy * e.vy); float threshold = Config.dpToPx(900.0f); if (v > threshold) { doFlick(e.vx, e.vy); CrashTracking.log("BubbleDraggable.configure(): onActionUp() - doFlick()"); } else { boolean doBubbleView = mMode == Mode.BubbleView || e.posX < Config.mScreenWidth * 0.2f || e.posX > Config.mScreenWidth * 0.8f || e.posY > Config.mScreenHeight * 0.5f; if (doBubbleView) { mMode = Mode.BubbleView; } MainApplication.postEvent(getContext(), mEndBubbleDragEvent); if (doBubbleView) { CrashTracking .log("BubbleDraggable.configure(): onActionUp() - doSnap()"); doSnap(); } else { CrashTracking.log( "BubbleDraggable.configure(): onActionUp() - doAnimateToContentView() [mHasMoved==true]"); doAnimateToContentView(controller, startDelay); } } } else { MainApplication.postEvent(getContext(), mEndBubbleDragEvent); CrashTracking.log("BubbleDraggable.configure(): onActionUp() - doSnapAction()"); doSnapAction(mCurrentSnapTarget.getAction()); } } else { MainApplication.postEvent(getContext(), mEndBubbleDragEvent); if (mMode == Mode.BubbleView) { CrashTracking.log( "BubbleDraggable.configure(): onActionUp() - doAnimateToContentView() [mMode == Mode.BubbleView]"); doAnimateToContentView(controller, startDelay); } else { if (mMode == Mode.ContentView && mBubbleFlowDraggable.isExpanded() == false) { CrashTracking.log( "BubbleDraggable.configure(): onActionUp() - doAnimateToContentView() [mMode == Mode.ContentView]"); doAnimateToContentView(controller, startDelay); } else { CrashTracking.log( "BubbleDraggable.configure(): onActionUp() - doAnimateToBubbleView()"); doAnimateToBubbleView(0); } } } mTouchDown = false; } } }); if (mDraggableHelper.isAlive()) { MainController.addRootWindow(this, windowManagerParams); slideOnScreen(x0, y0, targetX, targetY, targetTime); } }
From source file:com.mikepenz.iconics.IconicsDrawable.java
@Override public int getOpacity() { if (mTintFilter != null || mIconPaint.getColorFilter() != null) { return PixelFormat.TRANSLUCENT; }//from w ww . jav a 2s . c o m switch (getAlpha()) { case 255: return PixelFormat.OPAQUE; case 0: return PixelFormat.TRANSPARENT; } return PixelFormat.TRANSLUCENT; }
From source file:com.sonymobile.android.media.testmediaplayer.MainActivity.java
public void reset() { mSeekBarUpdater.deactivate();/* w ww .ja va 2s .com*/ mTimeTracker.stopUpdating(); mMediaPlayer.reset(); mHolder.setFormat(PixelFormat.TRANSPARENT); mHolder.setFormat(PixelFormat.OPAQUE); mMediaPlayer.setScreenOnWhilePlaying(true); mMediaPlayer.setDisplay(mHolder); mBottomControls.setVisibility(View.INVISIBLE); mSeekbar.setVisibility(View.GONE); mTimeLayout.setVisibility(View.GONE); mDecorView.setOnSystemUiVisibilityChangeListener(this); mMediaPlayer.setOnCompletionListener(this); mMediaPlayer.setOnPreparedListener(this); mMediaPlayer.setOnInfoListener(this); mMediaPlayer.setOnSeekCompleteListener(this); mMediaPlayer.setOnSubtitleDataListener(this); mSeekbar.setOnSeekBarChangeListener(new OwnOnSeekBarChangeListener(mMediaPlayer)); mSeekBarUpdater = new SeekbarUpdater(mSeekbar, mMediaPlayer); mTimeTracker.setMediaPlayer(mMediaPlayer); mSubtitleRenderer.stopRendering(); RelativeLayout browsingL = (RelativeLayout) findViewById(R.id.activity_main_browsing_layout); RelativeLayout debugLayout = (RelativeLayout) findViewById(R.id.activity_main_debug_view); LinearLayout debugLinearLayout = (LinearLayout) debugLayout.findViewById(R.id.activity_main_debug_linear); mFileBrowser = new MediaBrowser(this, (ExpandableListView) browsingL.findViewById(R.id.file_browsing_exp_list_view), (ListView) browsingL.findViewById(R.id.file_browsing_listview), mMediaPlayer, (MainActivity) this, mDrawerLayout, debugLinearLayout); mAudioPos = 0; mSubPos = 0; mMediaPlayer.setOnOutputControlListener(this); }
From source file:com.mobiroller.tools.inappbrowser.MobirollerInAppBrowser.java
/** * Display a new browser with the specified URL. * * @param url The url to load. * @param jsonObject//from w w w. j a v a 2 s .c o m */ public String showWebPage(final String url, final HashMap<String, Boolean> features) { // Determine if we should hide the location bar. showLocationBar = true; showZoomControls = false; openWindowHidden = false; if (features != null) { Boolean show = features.get(LOCATION); if (show != null) { showLocationBar = show.booleanValue(); } Boolean zoom = features.get(ZOOM); if (zoom != null) { showZoomControls = zoom.booleanValue(); } Boolean hidden = features.get(HIDDEN); if (hidden != null) { openWindowHidden = hidden.booleanValue(); } Boolean hardwareBack = features.get(HARDWARE_BACK_BUTTON); if (hardwareBack != null) { hadwareBackButton = hardwareBack.booleanValue(); } Boolean cache = features.get(CLEAR_ALL_CACHE); if (cache != null) { clearAllCache = cache.booleanValue(); } else { cache = features.get(CLEAR_SESSION_CACHE); if (cache != null) { clearSessionCache = cache.booleanValue(); } } } final CordovaWebView thatWebView = this.webView; // Create dialog in new thread Runnable runnable = new Runnable() { /** * Convert our DIP units to Pixels * * @return int */ private int dpToPixels(int dipValue) { int value = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, (float) dipValue, cordova.getActivity().getResources().getDisplayMetrics()); return value; } @SuppressLint("NewApi") public void run() { // Let's create the main dialog dialog = new MobirollerInAppBrowserDialog(cordova.getActivity(), android.R.style.Theme_Translucent_NoTitleBar); dialog.getWindow().getAttributes().windowAnimations = android.R.style.Animation_Dialog; dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCancelable(true); dialog.setInAppBroswer(getInAppBrowser()); // Main container layout LinearLayout main = new LinearLayout(cordova.getActivity()); main.setBackgroundColor(Color.TRANSPARENT); main.setOrientation(LinearLayout.VERTICAL); // Toolbar layout RelativeLayout toolbar = new RelativeLayout(cordova.getActivity()); //Please, no more black! toolbar.setBackgroundColor(Color.TRANSPARENT); toolbar.setLayoutParams(new RelativeLayout.LayoutParams(WindowManager.LayoutParams.MATCH_PARENT, this.dpToPixels(44))); toolbar.setPadding(this.dpToPixels(2), this.dpToPixels(2), this.dpToPixels(2), this.dpToPixels(2)); toolbar.setHorizontalGravity(Gravity.LEFT); toolbar.setVerticalGravity(Gravity.TOP); // Action Button Container layout RelativeLayout actionButtonContainer = new RelativeLayout(cordova.getActivity()); actionButtonContainer.setLayoutParams(new RelativeLayout.LayoutParams( WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT)); actionButtonContainer.setHorizontalGravity(Gravity.LEFT); actionButtonContainer.setVerticalGravity(Gravity.CENTER_VERTICAL); actionButtonContainer.setId(1); // Back button Button back = new Button(cordova.getActivity()); RelativeLayout.LayoutParams backLayoutParams = new RelativeLayout.LayoutParams( WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.MATCH_PARENT); backLayoutParams.addRule(RelativeLayout.ALIGN_LEFT); back.setLayoutParams(backLayoutParams); back.setContentDescription("Back Button"); back.setId(2); Resources activityRes = cordova.getActivity().getResources(); int backResId = activityRes.getIdentifier("ic_action_previous_item", "drawable", cordova.getActivity().getPackageName()); Drawable backIcon = activityRes.getDrawable(backResId); if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) { back.setBackgroundDrawable(backIcon); } else { back.setBackground(backIcon); } back.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { goBack(); } }); // Forward button Button forward = new Button(cordova.getActivity()); RelativeLayout.LayoutParams forwardLayoutParams = new RelativeLayout.LayoutParams( WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.MATCH_PARENT); forwardLayoutParams.addRule(RelativeLayout.RIGHT_OF, 2); forward.setLayoutParams(forwardLayoutParams); forward.setContentDescription("Forward Button"); forward.setId(3); int fwdResId = activityRes.getIdentifier("ic_action_next_item", "drawable", cordova.getActivity().getPackageName()); Drawable fwdIcon = activityRes.getDrawable(fwdResId); if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) { forward.setBackgroundDrawable(fwdIcon); } else { forward.setBackground(fwdIcon); } forward.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { goForward(); } }); // Edit Text Box edittext = new EditText(cordova.getActivity()); RelativeLayout.LayoutParams textLayoutParams = new RelativeLayout.LayoutParams( WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT); textLayoutParams.addRule(RelativeLayout.RIGHT_OF, 1); textLayoutParams.addRule(RelativeLayout.LEFT_OF, 5); edittext.setLayoutParams(textLayoutParams); edittext.setId(4); edittext.setSingleLine(true); edittext.setText(url); edittext.setInputType(InputType.TYPE_TEXT_VARIATION_URI); edittext.setImeOptions(EditorInfo.IME_ACTION_GO); edittext.setInputType(InputType.TYPE_NULL); // Will not except input... Makes the text NON-EDITABLE edittext.setOnKeyListener(new View.OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { // If the event is a key-down event on the "enter" button if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { navigate(edittext.getText().toString()); return true; } return false; } }); // Close/Done button Button close = new Button(cordova.getActivity()); RelativeLayout.LayoutParams closeLayoutParams = new RelativeLayout.LayoutParams( WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.MATCH_PARENT); closeLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); close.setLayoutParams(closeLayoutParams); forward.setContentDescription("Close Button"); close.setId(5); int closeResId = activityRes.getIdentifier("ic_action_remove", "drawable", cordova.getActivity().getPackageName()); Drawable closeIcon = activityRes.getDrawable(closeResId); if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) { close.setBackgroundDrawable(closeIcon); } else { close.setBackground(closeIcon); } close.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { closeDialog(); } }); // WebView inAppWebView = new WebView(cordova.getActivity()); inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT)); inAppWebView.setWebChromeClient(new MobirollerInAppChromeClient(thatWebView)); WebViewClient client = new InAppBrowserClient(thatWebView, edittext); inAppWebView.setWebViewClient(client); WebSettings settings = inAppWebView.getSettings(); settings.setJavaScriptEnabled(true); settings.setJavaScriptCanOpenWindowsAutomatically(true); settings.setBuiltInZoomControls(showZoomControls); settings.setPluginState(android.webkit.WebSettings.PluginState.ON); //Toggle whether this is enabled or not! Bundle appSettings = cordova.getActivity().getIntent().getExtras(); boolean enableDatabase = appSettings == null ? true : appSettings.getBoolean("InAppBrowserStorageEnabled", true); if (enableDatabase) { String databasePath = cordova.getActivity().getApplicationContext() .getDir("inAppBrowserDB", Context.MODE_PRIVATE).getPath(); settings.setDatabasePath(databasePath); settings.setDatabaseEnabled(true); } settings.setDomStorageEnabled(true); if (clearAllCache) { CookieManager.getInstance().removeAllCookie(); } else if (clearSessionCache) { CookieManager.getInstance().removeSessionCookie(); } inAppWebView.loadUrl(url); inAppWebView.setId(6); inAppWebView.getSettings().setLoadWithOverviewMode(true); inAppWebView.getSettings().setUseWideViewPort(true); inAppWebView.requestFocus(); inAppWebView.requestFocusFromTouch(); // Add the back and forward buttons to our action button container layout actionButtonContainer.addView(back); actionButtonContainer.addView(forward); // Add the views to our toolbar // toolbar.addView(actionButtonContainer); // toolbar.addView(edittext); toolbar.addView(close); // Don't add the toolbar if its been disabled if (getShowLocationBar()) { // Add our toolbar to our main view/layout main.addView(toolbar); } // Add our webview to our main view/layout main.addView(inAppWebView); WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); lp.copyFrom(dialog.getWindow().getAttributes()); lp.width = WindowManager.LayoutParams.MATCH_PARENT; lp.height = WindowManager.LayoutParams.MATCH_PARENT; //Mobiroller Needs DisplayMetrics metrics = cordova.getActivity().getResources().getDisplayMetrics(); Rect windowRect = new Rect(); webView.getView().getWindowVisibleDisplayFrame(windowRect); int bottomGap = 0; if (features.containsKey("hasTabs")) { if (features.get("hasTabs")) { bottomGap += Math.ceil(44 * metrics.density); } } lp.height = (windowRect.bottom - windowRect.top) - (bottomGap); lp.gravity = Gravity.TOP; lp.format = PixelFormat.TRANSPARENT; close.setAlpha(0); //Mobiroller Needs dialog.setContentView(main); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); dialog.show(); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); dialog.getWindow().setAttributes(lp); // the goal of openhidden is to load the url and not display it // Show() needs to be called to cause the URL to be loaded if (openWindowHidden) { dialog.hide(); } } }; this.cordova.getActivity().runOnUiThread(runnable); return ""; }
From source file:com.android.tv.MainActivity.java
@Override public void onAttachedToWindow() { super.onAttachedToWindow(); WindowManager.LayoutParams windowParams = new WindowManager.LayoutParams( WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL, 0, PixelFormat.TRANSPARENT); windowParams.token = getWindow().getDecorView().getWindowToken(); ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).addView(mOverlayRootView, windowParams); }
From source file:org.linphone.LinphoneService.java
void addFloatingWindows() { view = LayoutInflater.from(this).inflate(R.layout.callingactivity, null); windowManager = (WindowManager) this.getSystemService(WINDOW_SERVICE); /*/* w w w .j a v a2 s . c o m*/ * LayoutParams.TYPE_SYSTEM_ERRORView * LayoutParams.FLAG_NOT_FOCUSABLE: * PixelFormat.TRANSPARENT */ LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, LayoutParams.TYPE_SYSTEM_ERROR, LayoutParams.FLAG_NOT_FOCUSABLE, PixelFormat.TRANSPARENT); // layoutParams.gravity = Gravity.RIGHT|Gravity.BOTTOM; // layoutParams.gravity = Gravity.LEFT | Gravity.TOP; layoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT; final Button Answer = (Button) view.findViewById(R.id.buttonAnswer); Answer.setVisibility(View.VISIBLE); Answer.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { LinphoneCore lLinphoneCore = LinphoneService.instance().getLinphoneCore(); if (lLinphoneCore.isInComingInvitePending()) { try { lLinphoneCore.acceptCall(lLinphoneCore.getCurrentCall()); Answer.setVisibility(View.GONE); } catch (LinphoneCoreException e) { lLinphoneCore.terminateCall(lLinphoneCore.getCurrentCall()); // Toast toast = Toast.makeText(DialerActivity.this // ,String.format(getString(R.string.warning_wrong_destination_address),mAddress.getText().toString()) // ,Toast.LENGTH_LONG); // toast.show(); // finish(); } return; } } }); Button guaDuanDianhua = (Button) view.findViewById(R.id.buttonGuaDuanDianhua); guaDuanDianhua.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // LinphoneCore lLinphoneCore = LinphoneService.instance() // .getLinphoneCore(); // lLinphoneCore.terminateCall(lLinphoneCore.getCurrentCall()); // Intent intent = new Intent(); // intent.setClass(CallingActivity.this, CallEndActivity.class); // startActivity(intent); // finish(); try { Log.i("mayingcai", "classType: "); Class classType = Class.forName("com.android.internal.telephony.ITelephony"); Log.i("mayingcai", "classType: 1"); Object invokeTester = classType.newInstance(); Log.i("mayingcai", "classType: 2"); Method addMethod = classType.getMethod("endCall", null); Log.i("mayingcai", "classType: 3"); addMethod.invoke(invokeTester); Log.i("mayingcai", "classType: 4"); } catch (Exception e) { // TODO Auto-generated catch block Log.i("mayingcai", "classType: 5"); e.printStackTrace(); } } }); windowManager.addView(view, layoutParams); }
From source file:com.cognizant.trumobi.PersonaLauncher.java
public void setWindowBackground(boolean lwp) { wallpaperHack = lwp;//from w w w . j a v a 2s . c om if (!lwp) { getWindow().setBackgroundDrawable(null); getWindow().setFormat(PixelFormat.OPAQUE); // getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER); } else { getWindow().setBackgroundDrawable(new ColorDrawable(0)); getWindow().setFormat(PixelFormat.TRANSPARENT); // getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER); } }