mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-18 22:26:30 +01:00
get rid of XWExpandableListActivity
This commit is contained in:
parent
b78514ca6c
commit
c988859063
6 changed files with 26 additions and 167 deletions
|
@ -85,6 +85,16 @@ public class DelegateBase implements DlgDelegate.DlgClickNotify {
|
|||
m_delegate.showConfirmThen( msg, posButton, action, params );
|
||||
}
|
||||
|
||||
protected boolean post( Runnable runnable )
|
||||
{
|
||||
return m_delegate.post( runnable );
|
||||
}
|
||||
|
||||
protected void doSyncMenuitem()
|
||||
{
|
||||
m_delegate.doSyncMenuitem();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// DlgDelegate.DlgClickNotify interface
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
|
||||
package org.eehouse.android.xw4;
|
||||
|
||||
import android.text.TextUtils;
|
||||
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;
|
||||
|
@ -34,16 +34,17 @@ import android.database.DataSetObserver;
|
|||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.Button;
|
||||
import android.widget.ExpandableListAdapter;
|
||||
import android.widget.ExpandableListView;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.PopupMenu;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -61,7 +62,7 @@ import org.eehouse.android.xw4.jni.JNIUtilsImpl;
|
|||
import org.eehouse.android.xw4.jni.GameSummary;
|
||||
import org.eehouse.android.xw4.DictUtils.DictLoc;
|
||||
|
||||
public class DictsActivity extends XWExpandableListActivity {
|
||||
public class DictsActivity extends ExpandableListActivity {
|
||||
|
||||
private static interface SafePopup {
|
||||
public void doPopup( Context context, View button, String curDict );
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
|
||||
package org.eehouse.android.xw4;
|
||||
|
||||
import android.text.TextUtils;
|
||||
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;
|
||||
|
@ -34,16 +34,17 @@ import android.database.DataSetObserver;
|
|||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.Button;
|
||||
import android.widget.ExpandableListAdapter;
|
||||
import android.widget.ExpandableListView;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.PopupMenu;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -71,7 +72,7 @@ public class DictsDelegate extends DelegateBase
|
|||
protected static final String DICT_LANG_EXTRA = "use_lang";
|
||||
protected static final String DICT_NAME_EXTRA = "use_dict";
|
||||
|
||||
private XWExpandableListActivity m_activity;
|
||||
private ExpandableListActivity m_activity;
|
||||
private HashSet<String> m_closedLangs;
|
||||
|
||||
|
||||
|
@ -230,7 +231,7 @@ public class DictsDelegate extends DelegateBase
|
|||
}
|
||||
}
|
||||
|
||||
protected DictsDelegate( XWExpandableListActivity activity, Bundle savedInstanceState )
|
||||
protected DictsDelegate( ExpandableListActivity activity, Bundle savedInstanceState )
|
||||
{
|
||||
super( activity, savedInstanceState );
|
||||
m_activity = activity;
|
||||
|
@ -602,7 +603,7 @@ public class DictsDelegate extends DelegateBase
|
|||
DbgUtils.logf( "DictsActivity.cardMounted(%b)", nowMounted );
|
||||
// post so other SDCardNotifiee implementations get a chance
|
||||
// to process first: avoid race conditions
|
||||
m_activity.post( new Runnable() {
|
||||
post( new Runnable() {
|
||||
public void run() {
|
||||
mkListAdapter();
|
||||
expandGroups();
|
||||
|
@ -797,7 +798,7 @@ public class DictsDelegate extends DelegateBase
|
|||
public void downloadFinished( String name, final boolean success )
|
||||
{
|
||||
if ( m_launchedForMissing ) {
|
||||
m_activity.post( new Runnable() {
|
||||
post( new Runnable() {
|
||||
public void run() {
|
||||
if ( success ) {
|
||||
Intent intent = m_activity.getIntent();
|
||||
|
|
|
@ -35,7 +35,7 @@ import org.eehouse.android.xw4.jni.CurGameInfo;
|
|||
|
||||
import junit.framework.Assert;
|
||||
|
||||
public class GamesListActivity extends XWExpandableListActivity {
|
||||
public class GamesListActivity extends ExpandableListActivity {
|
||||
|
||||
// private static final String RELAYIDS_EXTRA = "relayids";
|
||||
private static final String ROWID_EXTRA = "rowid";
|
||||
|
|
|
@ -536,7 +536,7 @@ public class GamesListDelegate extends DelegateBase
|
|||
{
|
||||
switch( event ) {
|
||||
case HOST_PONGED:
|
||||
m_activity.post( new Runnable() {
|
||||
post( new Runnable() {
|
||||
public void run() {
|
||||
DbgUtils.showf( m_activity,
|
||||
"Pong from %s", args[0].toString() );
|
||||
|
@ -567,7 +567,7 @@ public class GamesListDelegate extends DelegateBase
|
|||
onContentChanged(); // required because position may change
|
||||
break;
|
||||
case SYNC_MENU:
|
||||
m_activity.doSyncMenuitem();
|
||||
doSyncMenuitem();
|
||||
break;
|
||||
case NEW_FROM:
|
||||
long curID = (Long)params[0];
|
||||
|
@ -819,7 +819,7 @@ public class GamesListDelegate extends DelegateBase
|
|||
showOKOnlyDialog( R.string.no_copy_network );
|
||||
} else {
|
||||
dropSels = true; // will select the new game instead
|
||||
m_activity.post( new Runnable() {
|
||||
post( new Runnable() {
|
||||
public void run() {
|
||||
GamesListActivity self = m_activity;
|
||||
byte[] stream =
|
||||
|
@ -903,7 +903,7 @@ public class GamesListDelegate extends DelegateBase
|
|||
// DictImportActivity.DownloadFinishedListener interface
|
||||
public void downloadFinished( String name, final boolean success )
|
||||
{
|
||||
m_activity.post( new Runnable() {
|
||||
post( new Runnable() {
|
||||
public void run() {
|
||||
boolean madeGame = false;
|
||||
if ( success ) {
|
||||
|
|
|
@ -1,153 +0,0 @@
|
|||
/* -*- compile-command: "find-and-ant.sh debug install"; -*- */
|
||||
/*
|
||||
* Copyright 2010 - 2012 by Eric House (xwords@eehouse.org). All
|
||||
* rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
package org.eehouse.android.xw4;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.app.ExpandableListActivity;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.eehouse.android.xw4.DlgDelegate.Action;
|
||||
|
||||
public class XWExpandableListActivity extends ExpandableListActivity
|
||||
implements DlgDelegate.DlgClickNotify, DlgDelegate.HasDlgDelegate,
|
||||
MultiService.MultiEventListener {
|
||||
|
||||
private DlgDelegate m_delegate;
|
||||
|
||||
@Override
|
||||
protected void onCreate( Bundle savedInstanceState )
|
||||
{
|
||||
DbgUtils.logf( "%s.onCreate(this=%H)", getClass().getName(), this );
|
||||
super.onCreate( savedInstanceState );
|
||||
m_delegate = new DlgDelegate( this, this, savedInstanceState );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume()
|
||||
{
|
||||
DbgUtils.logf( "%s.onResume(this=%H)", getClass().getName(), this );
|
||||
XWService.setListener( this );
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause()
|
||||
{
|
||||
DbgUtils.logf( "%s.onPause(this=%H)", getClass().getName(), this );
|
||||
XWService.setListener( null );
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState( Bundle outState )
|
||||
{
|
||||
super.onSaveInstanceState( outState );
|
||||
m_delegate.onSaveInstanceState( outState );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Dialog onCreateDialog( final int id )
|
||||
{
|
||||
Dialog dialog = m_delegate.onCreateDialog( id );
|
||||
if ( null == dialog ) {
|
||||
dialog = super.onCreateDialog( id );
|
||||
}
|
||||
return dialog;
|
||||
}
|
||||
|
||||
protected boolean post( Runnable runnable )
|
||||
{
|
||||
return m_delegate.post( runnable );
|
||||
}
|
||||
|
||||
protected void doSyncMenuitem()
|
||||
{
|
||||
m_delegate.doSyncMenuitem();
|
||||
}
|
||||
|
||||
protected void showNotAgainDlgThen( int msgID, int prefsKey,
|
||||
Action action, Object... params )
|
||||
{
|
||||
m_delegate.showNotAgainDlgThen( msgID, prefsKey, action, params );
|
||||
}
|
||||
|
||||
protected void showNotAgainDlgThen( int msgID, int prefsKey,
|
||||
Action action )
|
||||
{
|
||||
m_delegate.showNotAgainDlgThen( msgID, prefsKey, action );
|
||||
}
|
||||
|
||||
protected void showNotAgainDlg( int msgID, int prefsKey )
|
||||
{
|
||||
m_delegate.showNotAgainDlgThen( msgID, prefsKey );
|
||||
}
|
||||
|
||||
// It sucks that these must be duplicated here and XWActivity
|
||||
protected void showAboutDialog()
|
||||
{
|
||||
m_delegate.showAboutDialog();
|
||||
}
|
||||
|
||||
public void showOKOnlyDialog( int msgID )
|
||||
{
|
||||
m_delegate.showOKOnlyDialog( msgID );
|
||||
}
|
||||
|
||||
public void showOKOnlyDialog( String msg )
|
||||
{
|
||||
m_delegate.showOKOnlyDialog( msg );
|
||||
}
|
||||
|
||||
protected void showConfirmThen( String msg, Action action, Object... params )
|
||||
{
|
||||
m_delegate.showConfirmThen( msg, action, params );
|
||||
}
|
||||
|
||||
protected void showConfirmThen( String msg, int posButton, Action action,
|
||||
Object... params )
|
||||
{
|
||||
m_delegate.showConfirmThen( msg, posButton, action, params );
|
||||
}
|
||||
|
||||
protected void showConfirmThen( int msg, int posButton, Action action,
|
||||
Object... params )
|
||||
{
|
||||
m_delegate.showConfirmThen( msg, posButton, action, params );
|
||||
}
|
||||
|
||||
// DlgDelegate.DlgClickNotify interface
|
||||
public void dlgButtonClicked( DlgDelegate.Action action, int which,
|
||||
Object[] params )
|
||||
{
|
||||
Assert.fail();
|
||||
}
|
||||
|
||||
// BTService.BTEventListener interface
|
||||
public void eventOccurred( MultiService.MultiEvent event,
|
||||
final Object ... args )
|
||||
{
|
||||
m_delegate.eventOccurred( event, args );
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue