Proof-of-concept: get and display the current image from any item
Proof-of-concept: get and display the current image from any item
This displays the current image of the first loaded item in a dialog.
Problem now is: how to identify which view belongs to which item?
]]>
< ![CDATA[
LL.bindClass(“android.R”);
LL.bindClass(“android.widget.ImageView”);
LL.bindClass(“android.app.AlertDialog”);
LL.bindClass(“android.content.DialogInterface”);
var view=LL.getContext().getWindow().getDecorView().findViewById(R.id.content).getChildAt(0).getChildAt(1).getChildAt(0).getChildAt(0).getChildAt(1);
var img=LL.createImage(view.getWidth(),view.getHeight());
var c=img.draw();
view.draw(c);
var imgView=new ImageView(LL.getContext());
imgView.setImageBitmap(img.getBitmap());
var builder=new AlertDialog.Builder(LL.getContext());
builder.setView(imgView);
builder.setCancelable(true);
builder.setTitle(“Image”);
builder.setNeutralButton(“Close”,new DialogInterface.OnClickListener(){onClick:function(dialog,id){dialog.dismiss();}});
builder.create().show();
]]>
< ![CDATA[
Pradeep Joshi why should I?
]]>
< ![CDATA[
The container view is an instance of ItemLayout. It contains items, which are themselves a hierarchy of views, and items views have the same order as their z-index (views are displayed in order). So if you use Container.getItemZIndex you will find the index of the root view of the item in the ItemLayout.
Then each item view hierarchy is as below:
TransformLayout
BoxLayout
item content view, which can be:
IconLabelView for shortcuts and folders
MyTextView
IconView (can be swapped depending on label position)
AppWidgetHostView for widgets
ItemLayout for panels
]]>
< ![CDATA[
Pierre Hébert the problem is if you switch between desktops, all items of both desktops are loaded… so I always get items from the first desktop while I’m on the second
]]>
< ![CDATA[
For desktops, ItemLayout views are themselves included in a ViewAnimator but I can’t think at a public property that could link one view with a desktop, but ViewAnimator.getCurrentView will return the ItemLayout for the currently visible desktop.
]]>
< ![CDATA[
Pierre Hébert best would be a getView method on item! Shouldn’t be too hard as far as I see it. And we can’t even destroy sth with that, because structure gets rebuilt on restart…
]]>