derive from XWExpandableListActivity since it exists now

This commit is contained in:
Eric House 2012-12-18 07:56:48 -08:00
parent 9cbd76aae7
commit 6690fdf122

View file

@ -23,7 +23,6 @@ package org.eehouse.android.xw4;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.app.ExpandableListActivity;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface.OnClickListener; import android.content.DialogInterface.OnClickListener;
import android.content.DialogInterface; import android.content.DialogInterface;
@ -33,7 +32,6 @@ import android.content.res.Resources;
import android.database.DataSetObserver; import android.database.DataSetObserver;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.view.ContextMenu.ContextMenuInfo; import android.view.ContextMenu.ContextMenuInfo;
import android.view.ContextMenu; import android.view.ContextMenu;
@ -47,9 +45,7 @@ import android.widget.ExpandableListAdapter;
import android.widget.ExpandableListView.ExpandableListContextMenuInfo; import android.widget.ExpandableListView.ExpandableListContextMenuInfo;
import android.widget.ExpandableListView; import android.widget.ExpandableListView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import junit.framework.Assert; import junit.framework.Assert;
@ -58,7 +54,7 @@ import org.eehouse.android.xw4.jni.XwJNI;
import org.eehouse.android.xw4.jni.JNIUtilsImpl; import org.eehouse.android.xw4.jni.JNIUtilsImpl;
import org.eehouse.android.xw4.DictUtils.DictLoc; import org.eehouse.android.xw4.DictUtils.DictLoc;
public class DictsActivity extends ExpandableListActivity public class DictsActivity extends XWExpandableListActivity
implements View.OnClickListener, XWListItem.DeleteCallback, implements View.OnClickListener, XWListItem.DeleteCallback,
MountEventReceiver.SDCardNotifiee, DlgDelegate.DlgClickNotify, MountEventReceiver.SDCardNotifiee, DlgDelegate.DlgClickNotify,
DictImportActivity.DownloadFinishedListener { DictImportActivity.DownloadFinishedListener {
@ -86,10 +82,8 @@ public class DictsActivity extends ExpandableListActivity
private String m_deleteDict = null; private String m_deleteDict = null;
private String m_download; private String m_download;
private ExpandableListView m_expView; private ExpandableListView m_expView;
private DlgDelegate m_delegate;
private String[] m_locNames; private String[] m_locNames;
private DictListAdapter m_adapter; private DictListAdapter m_adapter;
private Handler m_handler;
private long m_packedPosition; private long m_packedPosition;
private DictLoc m_moveFromLoc; private DictLoc m_moveFromLoc;
@ -338,7 +332,6 @@ public class DictsActivity extends ExpandableListActivity
int lang = intent.getIntExtra( MultiService.LANG, -1 ); int lang = intent.getIntExtra( MultiService.LANG, -1 );
String name = intent.getStringExtra( MultiService.DICT ); String name = intent.getStringExtra( MultiService.DICT );
m_launchedForMissing = true; m_launchedForMissing = true;
m_handler = new Handler();
DictImportActivity DictImportActivity
.downloadDictInBack( DictsActivity.this, lang, .downloadDictInBack( DictsActivity.this, lang,
name, DictsActivity.this ); name, DictsActivity.this );
@ -355,7 +348,7 @@ public class DictsActivity extends ExpandableListActivity
break; break;
default: default:
dialog = m_delegate.onCreateDialog( id ); dialog = super.onCreateDialog( id );
doRemove = false; doRemove = false;
break; break;
} }
@ -371,7 +364,6 @@ public class DictsActivity extends ExpandableListActivity
protected void onPrepareDialog( int id, Dialog dialog ) protected void onPrepareDialog( int id, Dialog dialog )
{ {
super.onPrepareDialog( id, dialog ); super.onPrepareDialog( id, dialog );
m_delegate.onPrepareDialog( id, dialog );
if ( MOVE_DICT == id ) { if ( MOVE_DICT == id ) {
// The move button should always start out disabled // The move button should always start out disabled
@ -399,7 +391,6 @@ public class DictsActivity extends ExpandableListActivity
Resources res = getResources(); Resources res = getResources();
m_locNames = res.getStringArray( R.array.loc_names ); m_locNames = res.getStringArray( R.array.loc_names );
m_delegate = new DlgDelegate( this, this, savedInstanceState );
m_factory = LayoutInflater.from( this ); m_factory = LayoutInflater.from( this );
m_download = getString( R.string.download_dicts ); m_download = getString( R.string.download_dicts );
@ -447,7 +438,6 @@ public class DictsActivity extends ExpandableListActivity
protected void onSaveInstanceState( Bundle outState ) protected void onSaveInstanceState( Bundle outState )
{ {
super.onSaveInstanceState( outState ); super.onSaveInstanceState( outState );
m_delegate.onSaveInstanceState( outState );
outState.putLong( PACKED_POSITION, m_packedPosition ); outState.putLong( PACKED_POSITION, m_packedPosition );
outState.putString( NAME, m_name ); outState.putString( NAME, m_name );
@ -622,8 +612,7 @@ public class DictsActivity extends ExpandableListActivity
} }
} }
m_delegate.showConfirmThen( msg, R.string.button_delete, showConfirmThen( msg, R.string.button_delete, DELETE_DICT_ACTION );
DELETE_DICT_ACTION );
} }
// MountEventReceiver.SDCardNotifiee interface // MountEventReceiver.SDCardNotifiee interface
@ -632,7 +621,7 @@ public class DictsActivity extends ExpandableListActivity
DbgUtils.logf( "DictsActivity.cardMounted(%b)", nowMounted ); DbgUtils.logf( "DictsActivity.cardMounted(%b)", nowMounted );
// post so other SDCardNotifiee implementations get a chance // post so other SDCardNotifiee implementations get a chance
// to process first: avoid race conditions // to process first: avoid race conditions
new Handler().post( new Runnable() { post( new Runnable() {
public void run() { public void run() {
mkListAdapter(); mkListAdapter();
expandGroups(); expandGroups();
@ -773,7 +762,7 @@ public class DictsActivity extends ExpandableListActivity
public void downloadFinished( String name, final boolean success ) public void downloadFinished( String name, final boolean success )
{ {
if ( m_launchedForMissing ) { if ( m_launchedForMissing ) {
m_handler.post( new Runnable() { post( new Runnable() {
public void run() { public void run() {
if ( success ) { if ( success ) {
Intent intent = getIntent(); Intent intent = getIntent();