mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
move dialog creation stuff into activity base class
This commit is contained in:
parent
174ee22a4b
commit
6f6781ceed
11 changed files with 39 additions and 114 deletions
|
@ -21,7 +21,6 @@
|
|||
package org.eehouse.android.xw4;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.os.Bundle;
|
||||
|
@ -31,23 +30,6 @@ public class BoardActivity extends XWActivity {
|
|||
|
||||
private BoardDelegate m_dlgt;
|
||||
|
||||
@Override
|
||||
protected Dialog onCreateDialog( int id )
|
||||
{
|
||||
Dialog dialog = super.onCreateDialog( id );
|
||||
if ( null == dialog ) {
|
||||
dialog = m_dlgt.onCreateDialog( id );
|
||||
}
|
||||
return dialog;
|
||||
} // onCreateDialog
|
||||
|
||||
@Override
|
||||
public void onPrepareDialog( int id, Dialog dialog )
|
||||
{
|
||||
super.onPrepareDialog( id, dialog );
|
||||
m_dlgt.prepareDialog( id, dialog );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate( Bundle savedInstanceState )
|
||||
{
|
||||
|
|
|
@ -65,6 +65,7 @@ public class DelegateBase implements DlgDelegate.DlgClickNotify,
|
|||
protected void onPause() {}
|
||||
protected void onStop() {}
|
||||
protected void onDestroy() {}
|
||||
protected void prepareDialog( int id, Dialog dialog ) {}
|
||||
|
||||
// public boolean onOptionsItemSelected( MenuItem item )
|
||||
// {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* -*- compile-command: "find-and-ant.sh debug install"; -*- */
|
||||
/*
|
||||
* Copyright 2009 - 2012 by Eric House (xwords@eehouse.org). All
|
||||
* Copyright 2009 - 2014 by Eric House (xwords@eehouse.org). All
|
||||
* rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -21,12 +21,8 @@
|
|||
package org.eehouse.android.xw4;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.ExpandableListActivity;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
|
@ -82,23 +78,6 @@ public class DictsActivity extends ExpandableListActivity {
|
|||
m_dlgt.init( savedInstanceState );
|
||||
} // onCreate
|
||||
|
||||
@Override
|
||||
protected Dialog onCreateDialog( int id )
|
||||
{
|
||||
Dialog dialog = super.onCreateDialog( id );
|
||||
if ( null == dialog ) {
|
||||
dialog = m_dlgt.onCreateDialog( id );
|
||||
}
|
||||
return dialog;
|
||||
} // onCreateDialog
|
||||
|
||||
@Override
|
||||
protected void onPrepareDialog( int id, Dialog dialog )
|
||||
{
|
||||
super.onPrepareDialog( id, dialog );
|
||||
m_dlgt.prepareDialog( id, dialog );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if ( !m_dlgt.onBackPressed() ) {
|
||||
|
|
|
@ -22,7 +22,6 @@ package org.eehouse.android.xw4;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.app.Dialog;
|
||||
import android.view.KeyEvent;
|
||||
|
||||
public class GameConfigActivity extends XWActivity {
|
||||
|
@ -36,23 +35,6 @@ public class GameConfigActivity extends XWActivity {
|
|||
super.onCreate( savedInstanceState, m_dlgt );
|
||||
} // onCreate
|
||||
|
||||
@Override
|
||||
protected Dialog onCreateDialog( int id )
|
||||
{
|
||||
Dialog dialog = super.onCreateDialog( id );
|
||||
if ( null == dialog ) {
|
||||
dialog = m_dlgt.onCreateDialog( id );
|
||||
}
|
||||
return dialog;
|
||||
} // onCreateDialog
|
||||
|
||||
@Override
|
||||
protected void onPrepareDialog( int id, Dialog dialog )
|
||||
{
|
||||
m_dlgt.onPrepareDialog( id, dialog );
|
||||
super.onPrepareDialog( id, dialog );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState( Bundle outState )
|
||||
{
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
package org.eehouse.android.xw4;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.app.ListActivity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
@ -43,23 +42,6 @@ public class GamesListActivity extends XWListActivity {
|
|||
|
||||
private GamesListDelegate m_dlgt;
|
||||
|
||||
@Override
|
||||
protected Dialog onCreateDialog( int id )
|
||||
{
|
||||
Dialog dialog = super.onCreateDialog( id );
|
||||
if ( null == dialog && null != m_dlgt ) {
|
||||
dialog = m_dlgt.onCreateDialog( id );
|
||||
}
|
||||
return dialog;
|
||||
} // onCreateDialog
|
||||
|
||||
@Override
|
||||
protected void onPrepareDialog( int id, Dialog dialog )
|
||||
{
|
||||
super.onPrepareDialog( id, dialog );
|
||||
m_dlgt.prepareDialog( id, dialog );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate( Bundle savedInstanceState )
|
||||
{
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
package org.eehouse.android.xw4;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
@ -56,14 +55,4 @@ public class NewGameActivity extends XWActivity {
|
|||
{
|
||||
m_dlgt.onActivityResult( requestCode, resultCode, data );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Dialog onCreateDialog( int id )
|
||||
{
|
||||
Dialog dialog = super.onCreateDialog( id );
|
||||
if ( null == dialog ) {
|
||||
dialog = m_dlgt.onCreateDialog( id );
|
||||
}
|
||||
return dialog;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
package org.eehouse.android.xw4;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
|
@ -50,14 +49,4 @@ public class SMSInviteActivity extends InviteActivity {
|
|||
super.onActivityResult( requestCode, resultCode, data );
|
||||
m_dlgt.onActivityResult( requestCode, resultCode, data );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Dialog onCreateDialog( int id )
|
||||
{
|
||||
Dialog dialog = super.onCreateDialog( id );
|
||||
if ( null == dialog ) {
|
||||
dialog = m_dlgt.onCreateDialog( id );
|
||||
}
|
||||
return dialog;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,14 +19,10 @@
|
|||
|
||||
package org.eehouse.android.xw4;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.app.ListActivity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
|
@ -50,16 +46,6 @@ public class StudyListActivity extends XWListActivity {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Dialog onCreateDialog( int id )
|
||||
{
|
||||
Dialog dialog = m_dlgt.onCreateDialog( id );
|
||||
if ( null == dialog ) {
|
||||
dialog = super.onCreateDialog( id );
|
||||
}
|
||||
return dialog;
|
||||
} // onCreateDialog
|
||||
|
||||
public static void launchOrAlert( Context context, int lang,
|
||||
DlgDelegate.HasDlgDelegate dlg )
|
||||
{
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package org.eehouse.android.xw4;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
@ -91,4 +92,21 @@ public class XWActivity extends Activity {
|
|||
return m_dlgt.onOptionsItemSelected( item )
|
||||
|| super.onOptionsItemSelected( item );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Dialog onCreateDialog( int id )
|
||||
{
|
||||
Dialog dialog = super.onCreateDialog( id );
|
||||
if ( null == dialog ) {
|
||||
dialog = m_dlgt.onCreateDialog( id );
|
||||
}
|
||||
return dialog;
|
||||
} // onCreateDialog
|
||||
|
||||
@Override
|
||||
public void onPrepareDialog( int id, Dialog dialog )
|
||||
{
|
||||
super.onPrepareDialog( id, dialog );
|
||||
m_dlgt.prepareDialog( id, dialog );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
package org.eehouse.android.xw4;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.app.ListActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
|
@ -91,4 +92,21 @@ public class XWListActivity extends ListActivity {
|
|||
return m_dlgt.onOptionsItemSelected( item )
|
||||
|| super.onOptionsItemSelected( item );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Dialog onCreateDialog( int id )
|
||||
{
|
||||
Dialog dialog = super.onCreateDialog( id );
|
||||
if ( null == dialog ) {
|
||||
dialog = m_dlgt.onCreateDialog( id );
|
||||
}
|
||||
return dialog;
|
||||
} // onCreateDialog
|
||||
|
||||
@Override
|
||||
public void onPrepareDialog( int id, Dialog dialog )
|
||||
{
|
||||
super.onPrepareDialog( id, dialog );
|
||||
m_dlgt.prepareDialog( id, dialog );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -143,8 +143,7 @@ public class LocItemEditDelegate extends DelegateBase {
|
|||
== m_key.split( "%[\\d]\\$[ds]" ).length;
|
||||
|
||||
if ( !ok ) {
|
||||
// FIX ME -- should be an alert
|
||||
Utils.showToast( m_activity, "Bad xlation" );
|
||||
showOKOnlyDialog( "Bad xlation" );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue