DROID CARDS
We Publish Kids Card Games for Droid Phones

Wednesday, May 19, 2010

Lose Your Sock upgrade and new Italian version Ruba Mazzetto

I finally was able to release the upgrade to Lose Your Socks. Now you can play in landscape as well as on portrait mode. Also I did some enhancements ...okay I fixed some bugs and now it's all rock solid! I also have the Italian version with the original title "Ruba Mazzetto". Unfortunately I couldn't do it in "Lose Your Socks" with the localization strings, because I had to change the graphics and also I wanted to be recognized by its real Italian name. In my next game, which is all American I will use the localization. In fact, I am working on a new game of cards for kids, available in the next few weeks...time is the essence :)

In Droid Cards we like to give some geeky details, always in the spirit to give back to the community out there.

For the change of orientation:
I don't allow the application to be restarted by the OS. Instead I add this line to the manifest.xml file within my activity tag:
android:configChanges="keyboardHidden|orientation"
This allows for a callback when the device's keypad is open or in any change in screen orientation.
In my activity code, I override the callback:
@Override
public void onConfigurationChanged (Configuration newConfig)
{
//I keep track of the orientation with a member variable,
if(orientation != newConfig.orientation)
{
setContentView(R.layout.main);
game.changeOrientation(newConfig.orientation);
}
orientation = newConfig.orientation;
super.onConfigurationChanged(newConfig);
}
In this way in the changeOrientation function I have to redo only the layout for the new orientation, but I don't need to store any settings or game values because the app never quits.

Other point, I changed the Help and About Buttons to be Dialog boxes instead of lame views (yes, they were lame and they created issues). Actually I wanted to create a Custom Dialog without a title box and with a different font size and color. But I wanted the functionality of the AlertDialog. So as described on http://developer.android.com/guide/topics/ui/dialogs.html I use the LayoutInflater and expanded my Custom view. But I didn't want to have buttons and I wanted the user to be able to click on the dialog to dismiss it.

private void displayAboutDialog() {
final AlertDialog.Builder builder;
final AlertDialog alertDialog;

LayoutInflater inflater = (LayoutInflater)this.getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.aboutdialog,(ViewGroup)findViewById(R.id.ScrollViewAboutDialog));
//save a pointer to the the relative layout inside the scroll view
View aboutview = (View)layout.findViewById(R.id.RRlayoutAboutDialog);
//then create
builder = new AlertDialog.Builder(this);
builder.setView(layout);
alertDialog = builder.create();
//now set the listener
aboutview.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
alertDialog.dismiss();
}
});
alertDialog.show();
}
I hope this will be useful to you. Any comments will be greatly appreciated.

No comments:

Post a Comment