mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-29 08:34:37 +01:00
add generic info dialog that, with luck, can be reused.
This commit is contained in:
parent
b718804a4b
commit
ab8c3f985e
1 changed files with 25 additions and 3 deletions
|
@ -45,7 +45,8 @@ public class Utils {
|
|||
static final String TAG = "XW4";
|
||||
|
||||
static final int DIALOG_ABOUT = 1;
|
||||
static final int DIALOG_LAST = DIALOG_ABOUT;
|
||||
static final int DIALOG_OKONLY = 2;
|
||||
static final int DIALOG_LAST = DIALOG_OKONLY;
|
||||
static final String DB_PATH = "XW_GAMES";
|
||||
|
||||
private static Time s_time = new Time();
|
||||
|
@ -72,9 +73,30 @@ public class Utils {
|
|||
Toast.makeText( context, text, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
static Dialog onCreateDialog( final Context context, int id )
|
||||
static Dialog onCreateDialog( final Context context, int id,
|
||||
Object... args )
|
||||
{
|
||||
Dialog dialog = null;
|
||||
if ( DIALOG_ABOUT == id ) {
|
||||
dialog = doAboutDialog( context );
|
||||
} else if ( DIALOG_OKONLY == id ) {
|
||||
dialog = doOKDialog( context, args );
|
||||
}
|
||||
return dialog;
|
||||
}
|
||||
|
||||
private static Dialog doOKDialog( final Context context, Object... args )
|
||||
{
|
||||
logf( "doOKDialog" );
|
||||
return new AlertDialog.Builder( context )
|
||||
.setTitle( R.string.info_title )
|
||||
.setMessage( ((Integer)args[0]).intValue() )
|
||||
.setPositiveButton( R.string.button_ok, null )
|
||||
.create();
|
||||
}
|
||||
|
||||
private static Dialog doAboutDialog( final Context context )
|
||||
{
|
||||
Assert.assertTrue( DIALOG_ABOUT == id );
|
||||
LayoutInflater factory = LayoutInflater.from( context );
|
||||
final View view = factory.inflate( R.layout.about_dlg, null );
|
||||
TextView vers = (TextView)view.findViewById( R.id.version_string );
|
||||
|
|
Loading…
Add table
Reference in a new issue