G1 Storage Space

G1 Storage Space

by Stoyan Damov » Fri, 13 Mar 2009 05:00:24 GMT

~70MB for apps, 1GB SD card.
I know the 70MB is hilarious, tough luck.
Maybe a next release, when Google implement file system encryption
will allow installing and running apps off the SD card, but that's not
likely to happen soon.
On Thu, Mar 12, 2009 at 9:53 PM, WebsiteMagazine
--~--~---------~--~----~------------~-------~--~----~

I would like to take a RelativeLayout which has a bunch of sub views,
and mirror it along the X axis. I have followed the rotateView code
from the map example, but that one is subclassing a ViewGroup, not a
RelativeLayout (what's the difference by the way?)
The mirroring needs to be permanent, so while an animation would be
possible it is not desired (and during testing it also produced weird
side effects - the main view would flip but the child views would not
stay pinned correctly).
Here is my current code
public class MainScreen extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FlipMainScreen ms = new FlipMainScreen(getApplication());
TextView testText = new TextView(getApplication());
setContentView(ms);
testText.setText("Mirror test");
ms.addView(testText);
}
}
public class FlipMainScreen extends RelativeLayout {
public FlipMainScreen(Context context) {
super(context);
this.setWillNotDraw(false);
}
@Override
protected void dispatchDraw(Canvas canvas) {
canvas.save(Canvas.MATRIX_SAVE_FLAG);
super.dispatchDraw(canvas);
Log.v("This",""+getWidth());
canvas.scale(-1f,1f, getWidth() * 0.5f, getHeight() * 0.5f);
canvas.restore();
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int
b) {
final int width = getWidth();
final int height = getHeight();
final int count = getChildCount();
for (int i = 0; i < count; i++) {
final View view = getChildAt(i);
final int childWidth = view.getMeasuredWidth();
final int childHeight = view.getMeasuredHeight();
final int childLeft = (width - childWidth) / 2;
final int childTop = (height - childHeight) / 2;
view.layout(childLeft, childTop, childLeft + childWidth, childTop
+ childHeight);
}
}
}
The text view displays but it is not mirrored. Rather, it is centered
on the screen if I use the onLayout override.
How can I make the RelativeLayout flip completely, including all the
child views ?
(user interaction is obviously not required in that state)
--