how to control exoplayer pip via switch button - android-studio

i want to control pip mode via switch if user press the switch button to disable pip mode the code i wrote in userleaveagent for pip wont work and if they enable it will work. similar to google android youtube feature
i can provide what i have. currenly i have added pip mode via userleaveagent trigger
private void pipcode() {
Display d = getWindowManager()
.getDefaultDisplay();
Point p = new Point();
d.getSize(p);
int width = p.x;
int height = p.y;
Rational ratio
= new Rational(2, 3);
PictureInPictureParams.Builder
pip_Builder
= new PictureInPictureParams
.Builder();
pip_Builder.setAspectRatio(ratio).build();
enterPictureInPictureMode(pip_Builder.build());
setPictureInPictureParams(new PictureInPictureParams.Builder()
.setSeamlessResizeEnabled(false)
.build());
}

Related

Can this code be changed to support a preview in the print dialog?

I am not sure if this is an issue that can be resolved with coding or is by design. I am running the latest version of Windows 11 with all updates. And my application is a MFC dialog application built with Visual Studio 2022.
My application uses a CHtmlView control and the user can trigger a Print Preview. This event will trigger the following code:
void CChristianLifeMinistryHtmlView::DoPrintPreview()
{
ExecWB(OLECMDID_PRINTPREVIEW, OLECMDEXECOPT_PROMPTUSER, nullptr, nullptr);
HWND HWND_PP = nullptr ;
const auto t1 = ::GetTickCount64();
auto t2 = ::GetTickCount64(); // Extra line required for 'while' rearrangement.
while (HWND_PP == nullptr && t2 - t1 <= 6000) // if found or Timeout reached...
{
HWND HWND_FG = ::GetForegroundWindow(); // Get the ForeGroundWindow
if (HWND_FG != nullptr)
{
TCHAR szClassName[256]{} ;
::GetClassName(HWND_FG, &szClassName[0], 256);
if (lstrcmp(&szClassName[0], IE_PPREVIEWCLASS) == 0) // Check for Print Preview Dialog
HWND_PP = HWND_FG ;
}
theApp.PumpMessage();
t2 = ::GetTickCount64();
}
if (HWND_PP != nullptr)
{
RECT workArea{};
::SystemParametersInfo( SPI_GETWORKAREA, 0, &workArea, 0 );
::MoveWindow(HWND_PP, workArea.left, workArea.top,
workArea.right - workArea.left, workArea.bottom - workArea.top, TRUE);
}
}
This code works fine, and I get a good print preview, resized to the display. For example:
Now, if I hit Print from here it displays:
Opting to print to PDF looks the same:
Prior to the recent Windows 11 Updates these latter "print dialogs" looked different with no preview anyway. But since this updated version of the system "print dialog" can cope with a preview, is there no way to get our existing CHtmlView preview displayed there?
This is only a cosmetic thing because I have a standard preview for the user to see anyway (snap 1). But it would be the icing on the cake if that preview could someone be fed into this popup print window.
Is this something we can do by code or is it a "system / by design issue"?

CodenameOne - Layered Layout import not working

According to the docu of LayeredLayout here (JavaDoc), there is an inset method that can be used for relative positioning. I created a bare pones CN1 project and added this piece, also from the docu:
Container cnt = new Container(new LayeredLayout());
LayeredLayout ll = (LayeredLayout)cnt.getLayout();
TextField searchField = new TextField();
Button btn = new Button("Search");
cnt.add(searchField).add(btn);
ll
.setInsets(searchField, "1mm auto auto auto")
.setInsets(btn, "0 auto auto 0")
.setReferenceComponentLeft(btn, searchField, 1f)
.setReferenceComponentTop(btn, searchField, 0);
However, I am getting an error that the setInset Method is not found. Looking at the source of LayeredLayout class reveals that it indeed does not have this method.
The method setInsets(TextField, String) is undefined for the type LayeredLayout
I just updated CN1 lib to the latest version as of today.
Any idea?
I suggest updating your plugin.
In Codename One Settings select Basic and click Update Client Libs.

How to access gradient editor in Unity3D?

I was searching through the Unity manual to see what they had for gradient effects and I found this:
Here is the link:
http://docs.unity3d.com/Manual/EditingValueProperties.html
However, I can't find this editor anywhere inside of Unity. I want to use this to apply a gradient to my background for a game. Does it exist!?
You do not have access to arbitrarily use color picker or gradient editor. For your purpose of making the background you have several options,
Change the Camera background color from the editor.
Use a Skybox, you can make your own skybox too.
If your game has a limited view, use a plane with a custom material.
Maybe this script shows how you can use Gradients. You need to add this script to one of your GameObject in your scene. And your Camera's tag is MainCamera .
This code based on this.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class GradientHandler : MonoBehaviour {
public Camera camera;
public Gradient gradient;
// Use this for initialization
void Start () {
camera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Camera>() as Camera; //Gets Camera script from MainCamera object(Object's tag is MainCamera).
GradientColorKey[] colorKey = new GradientColorKey[2];
GradientAlphaKey[] alphaKey = new GradientAlphaKey[2];
// Populate the color keys at the relative time 0 and 1 (0 and 100%)
colorKey[0].color = Color.red;
colorKey[0].time = 0.0f;
colorKey[1].color = Color.blue;
colorKey[1].time = 1.0f;
// Populate the alpha keys at relative time 0 and 1 (0 and 100%)
alphaKey[0].alpha = 1.0f;
alphaKey[0].time = 0.0f;
alphaKey[1].alpha = 0.0f;
alphaKey[1].time = 1.0f;
gradient.SetKeys(colorKey, alphaKey);
}
// Update is called once per frame
void Update () {
Debug.Log ("Time: "+Time.deltaTime);
camera.backgroundColor = gradient.Evaluate(Time.time%1);
}
}

Custom controls not visible in the View

Below is my code I used to create a custom UITextField in code behind.
UITextField usernameField;
usernameField = new UITextField
{
Placeholder = "Enter your username",
BorderStyle = UITextBorderStyle.RoundedRect,
Frame = new RectangleF(10, 32, 50, 30)
};
View.AddSubview(usernameField);
But when I run my app, I dont see this anywhere. Not only this control but all the controls that I create in code behind.
If I drag the controls from toolbox onto my View it's working very fine.
What might be the cause?
Make sure that Container View is not transparent so Alpha = 1 and set background colors for appropriate controlls. Because by default its set to ClearYou can use this method to easly set background and rounded corners like in older versions of iOS
public static void MakeViewRounded(UIView view,float cornerRadius, MonoTouch.CoreGraphics.CGColor backgroundColor)
{
view.Layer.CornerRadius = cornerRadius;
view.Layer.BackgroundColor = backgroundColor;
}
Also make sure that you adding your custom controll to ViewController/View

How can I create a WebBrowser control (ActiveX / IWebBrowser2) without a UI?

I cannot figure out how to use the WebBrowser control without having it create a window in the taskbar.
I am using the IWebBrowser2 ActiveX control directly because I need to use some of the advanced features like blocking downloading JAVA/ActiveX/images etc. That apparently is not available in the WPF or winforms WebBrowser wrappers (but these wrappers do have the ability to create the control with no UI)
Here is my code for creating the control:
Type webbrowsertype = Type.GetTypeFromCLSID(Iid_Clsids.CLSID_WebBrowser, true);
m_WBWebBrowser2 = (IWebBrowser2)System.Activator.CreateInstance(webbrowsertype);
m_WBWebBrowser2.Visible = false;
m_WBOleObject = (IOleObject)m_WBWebBrowser2;
int iret = m_WBOleObject.SetClientSite(this);
iret = m_WBOleObject.SetHostNames("me", string.Empty);
tagRECT rect = new tagRECT(0, 0, 0, 0);
tagMSG nullMsg = new tagMSG();
m_WBOleInPlaceObject = (IOleInPlaceObject)m_WBWebBrowser2;
//INPLACEACTIVATE the WB
iret = m_WBOleObject.DoVerb((int)OLEDOVERB.OLEIVERB_INPLACEACTIVATE,
ref nullMsg, this, 0, IntPtr.Zero, ref rect);
IConnectionPointContainer cpCont = (IConnectionPointContainer)m_WBWebBrowser2;
Guid guid = typeof(DWebBrowserEvents2).GUID;
IConnectionPoint m_WBConnectionPoint = null;
cpCont.FindConnectionPoint(ref guid, out m_WBConnectionPoint);
m_WBConnectionPoint.Advise(this, out m_dwCookie);
This code works perfectly but it shows a window in the taskbar. If i omit the DoVerb(OLEDOVERB.OLEIVERB_INPLACEACTIVATE) call, then Navigating to a webpage is not working properly. Navigate() will not download everything on the page and it never fires the DocumentComplete event. If I add a DoVerb(OLEIVERB_HIDE) then I get the same behavior as if I omitted the DoVerb(OLEDOVERB.OLEIVERB_INPLACEACTIVATE) call.
This seems like a pretty basic question but I couldn't find any examples anywhere.
Check the wraparounds in BUG: DocumentComplete Does Not Fire When WebBrowser Is Not Visible

Resources