UIautomator with two scroll views - android-uiautomator

I am just trying to automate settings app-> storage
I need to scroll through the storage part in right pane(TABLET) but couldnt do so. i could only scroll the left pane with Storage, Display etc
Any ideas?

I couldn't find a way either. I found a workaround though.
In the settings app, under Storage use something like:
int width = getUiDevice().getDisplayWidth();
int height = getUiDevice().getDisplayHeight();
getUiDevice.swipe(width*3/4, height*9/10, width*3/4, height*1/10, 10);

I don't have any tablet to test this on but my guess is that you just try to find a scrollable. This will find the first one in view hierarchy. You need to be more specific.
I suggest searching for a scrollable with text that is unique within that. For instance if "Storage" is selected in settings, then there will be a "Total space" item in the list you want to find. First find the top node of the hierarchy (search for a LinearLayout or whatever type the top node is) and then find a scrollable that has a child with the text "Total space"
UiCollection topNode = new UiCollection(
new UiSelector().className(LinearLayout.class.getName()));
UiScrollable storageList = topNode.getChildByText(
new UiSelector().scrollable(true), "Total space");

Try instances of the view as below, below example works for right pane scrolling.
UiScrollable scroll = new UiScrollable(new UiSelector().scrollable(true).instance(1));
scroll.setAsVerticalList();

Related

Removing the image placeholder (picture) in Word using OpenXML

I have a Word file that I'm manipulating with OpenXML. I have nothing but a picture content control there and I have successfully added a picture ("content") into that picture content control.
Now everything is otherwise fine, but I don't have a slightest clue of how to remove the placeholder picture. That is, I have that "little icon with monitor, sun and mountain" there right in the middle of my inserted picture. You know, the icon that you see when you insert a picture content control. I can take the count of content controls thru VBA and it says there's exactly one, so there's not two controls on top of each other.
If I delete the target content control (with remove-method), the entire content control (including the correctly set picture) gets deleted.
Is there something like "placeholderimage.Hide"-method or something that I should use?
I set the content to the picture like this:
DocumentFormat.OpenXml.Drawing.Blip blip = targetpicturecontrol.Descendants<DocumentFormat.OpenXml.Drawing.Blip>().FirstOrDefault();
blip.Embed = mainPart.GetIdOfPart(imagePart);
This code hides (or removes, whatever) the place holder
private static void RemovePlaceHolder(SdtProperties targetproperties)
{
Appearance appearance = new Appearance();
appearance.Val = new EnumValue<SdtAppearance>();
SdtAppearance sdtAppearance = new SdtAppearance();
sdtAppearance = SdtAppearance.Hidden;
appearance.Val.Value = sdtAppearance;
targetproperties.AppendChild(appearance);
}

Libgdx - Making a drop-down menu/settings screen

I'm looking to make a drop-down menu and drop-down settings screen but I couldn't find any resources for making these in Libgdx. Would like some pointers to good resources for this specific type of interface or a quick example.
Thanks!
SelectBox is in LibGDX can be used for drop-down list, it allows one of a number of values to be chosen from a list. And for pop-up window you can use Dialog.
stage=new Stage();
Skin skin=new Skin(Gdx.files.internal("skin/glassy-ui.json"));
dialog=new Dialog("Setting",skin);
dialog.setSize(200,200);
dialog.setPosition(Gdx.graphics.getWidth()/2-100,Gdx.graphics.getHeight()/2-100);
final SelectBox<String> selectBox=new SelectBox<String>(skin);
selectBox.setItems("XYZ","ABC","PQR","LMN");
dialog.getContentTable().defaults().pad(10);
dialog.getContentTable().add(selectBox);
stage.addActor(dialog);
Gdx.input.setInputProcessor(stage);
Output

How to Possible to select last item of listbox by tap on when last item stay under the application bar?

Listbox contain several items. when i scroll to last item and take initiate to select the item by taping on is not possible cause of that item presence under application bar. Now anybody can say what should i do??? Sample code bellow:
Okay, so no sample code huh? :). But judging by the scenario, I think you've not limited the height of your listbox. Set the height so that the listbox's area is limited above the applicationbar.
As PhoBi mentioned, adding code to your post would be more helpful. however, try this code to limit the size of the listbox:
MyListBox.Height = Application.Current.Host.Content.ActualHeight;
you may need to account for other controls' space. for e.g.:
MyListBox.Height = Application.Current.Host.Content.ActualHeight - (HeaderStackPanel.ActualHeight);

Change the colour of WinJS.UI.BackButton (Win 8.1 back button)

I'm getting started with Windows 8 App development using WinJS. I'm using the Light UI theme but I have set up a darker area on the left of the page (where the black back button is) and the issue is: you can't see the button.
I've trawled through the MSDN pages and the most I could find is how to style a button which doesn't actually explain how to change the colour of an actual asset.
http://msdn.microsoft.com/en-us/library/windows/apps/jj835822.aspx
I've also tried adding: win-ui-light and win-ui-dark classes to the button with no success.
I wondered if someone could point me in the right direction?
Many thanks for your time
Chris
First of all you have to delete the link tag that contain UI css by default and add it to document head , Dynamically.see below code :
var uistyle;
// call when your app load or resume.
function onappopen(){
uistyle = document.createElement('link');
uistyle.href = "//Microsoft.WinJS.2.0/css/ui-dark.css";
uistyle.rel = "stylesheet";
uistyle.id = "UIstyle";
document.head.appendChild(uistyle);}
// call when you want to change UI Style.
function UIstyle(UIbool){
if(UIbool=='light'){ uistyle.href = "//Microsoft.WinJS.2.0/css/ui-light.css";}
else {uistyle.href = "//Microsoft.WinJS.2.0/css/ui-dark.css";}}
Like: UIstyle('light'); for light UI in Windows 8 or "UIstyle()" for dark;
I used the DOM Explorer to find the buttons default values and overwrite them. It was the child element that needed to be overwritten: .win-back

How to fix overlapping objects on the stage in AS3

I have a flash game where I have a picture designed to be the textbox for a prompt and textbox inside with the relevant text but the textbox is being hidden by the image. Anyone know how to make is so that the textbox is guaranteed to be on top or whatever I need to do to keep this from happening?
The other answer using setChildIndex will definitely work, however, I think a different design approach is really what you should be doing to remove the headache altogether.
For example in a game I might have different layers such as :
backgroundLayer
gameLayer
interfaceLayer
Those 3 Sprite layers would get added to the stage in that order. I would then add display objects to the appropriate layers. So anything I added to the backgroundLayer or gameLayer would ALWAYS be 'behind' my user interface on the interfaceLayer.
That allows you to not have to worry about the layering constantly. The answer with setChildIndex will fix the problem for that moment, but should something else be added to the container it will overlap your textbox, which is something I don't assume you want.
here's an example :
var backgroundLayer:Sprite = new Sprite;
var gameLayer:Sprite = new Sprite;
var interfaceLayer:Sprite = new Sprite;
addChild(backgroundLayer);
addChild(gameLayer);
addChild(interfaceLayer);
now, whatever you add to interfaceLayer, will ALWAYS be on top of objects you add to gameLayer or backgroundLayer.
So in the case of your text box, just add it to your interfaceLayer and any other objects you want behind it, you add to the gameLayer or backgroundLayer.
The order of adding display objects to display object containers effect their z-order, in other words the front to back order. The last added display object becomes the frontmost. So the child index of the children of a display object container is important for drawing of overlapped children.
If you put picture and text on the same DisplayObjectContainer such as a MovieClip:
Lets say your DisplayObjectContainer is mc.
And your textbox is txt
Please try this:
mc.setChildIndex(txt, mc.numChildren-1);

Resources