diff --git a/xwords4/android/XWords4/.gitignore b/xwords4/android/XWords4/.gitignore index dac0be121..5dfbbc251 100644 --- a/xwords4/android/XWords4/.gitignore +++ b/xwords4/android/XWords4/.gitignore @@ -13,7 +13,6 @@ ant_out.txt bin gen -libs local.properties obj proguard.cfg diff --git a/xwords4/android/XWords4/libs/.gitignore b/xwords4/android/XWords4/libs/.gitignore new file mode 100644 index 000000000..e3f56da7c --- /dev/null +++ b/xwords4/android/XWords4/libs/.gitignore @@ -0,0 +1,2 @@ +/armeabi +/x86 diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictBrowseDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictBrowseDelegate.java index ff0a2956d..2b6a1caf0 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictBrowseDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictBrowseDelegate.java @@ -21,7 +21,6 @@ package org.eehouse.android.xw4; import android.app.Activity; -import android.app.ListActivity; import android.content.Context; import android.content.Intent; import android.database.DataSetObserver; diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsDelegate.java index 268451827..7c6963de7 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsDelegate.java @@ -23,7 +23,6 @@ package org.eehouse.android.xw4; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; -import android.app.ListActivity; import android.content.Context; import android.content.DialogInterface.OnCancelListener; import android.content.DialogInterface.OnClickListener; diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DwnldDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DwnldDelegate.java index 872faff6e..542d31168 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DwnldDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DwnldDelegate.java @@ -21,7 +21,6 @@ package org.eehouse.android.xw4; import android.app.Activity; -import android.app.ListActivity; import android.content.Context; import android.content.Intent; import android.net.Uri; diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/InviteActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/InviteActivity.java index 9b1adf622..d6c7a070b 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/InviteActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/InviteActivity.java @@ -20,7 +20,6 @@ package org.eehouse.android.xw4; -import android.app.ListActivity; import android.os.Bundle; import android.view.Window; diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/InviteDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/InviteDelegate.java index 7cf3aacdc..d53b6de0b 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/InviteDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/InviteDelegate.java @@ -22,7 +22,6 @@ package org.eehouse.android.xw4; import android.app.Activity; import android.app.Dialog; -import android.app.ListActivity; import android.content.Context; import android.content.Intent; import android.os.Bundle; diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayInviteDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayInviteDelegate.java index de9331276..99f6aedc2 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayInviteDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayInviteDelegate.java @@ -23,7 +23,6 @@ package org.eehouse.android.xw4; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; -import android.app.ListActivity; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSInviteDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSInviteDelegate.java index 54f91d969..f2773e691 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSInviteDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSInviteDelegate.java @@ -23,7 +23,6 @@ package org.eehouse.android.xw4; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; -import android.app.ListActivity; import android.content.DialogInterface; import android.content.Intent; import android.database.Cursor; diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWActivity.java index 7686c143f..1bf367315 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWActivity.java @@ -23,8 +23,12 @@ import android.app.Activity; import android.app.Dialog; import android.content.Intent; import android.os.Bundle; +import android.view.ContextMenu.ContextMenuInfo; +import android.view.ContextMenu; import android.view.Menu; import android.view.MenuItem; +import android.view.MenuItem; +import android.view.View; import junit.framework.Assert; @@ -139,6 +143,19 @@ public class XWActivity extends Activity implements Delegator { || super.onOptionsItemSelected( item ); } + @Override + public void onCreateContextMenu( ContextMenu menu, View view, + ContextMenuInfo menuInfo ) + { + m_dlgt.onCreateContextMenu( menu, view, menuInfo ); + } + + @Override + public boolean onContextItemSelected( MenuItem item ) + { + return m_dlgt.onContextItemSelected( item ); + } + @Override protected Dialog onCreateDialog( int id ) { diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWListActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWListActivity.java index 677383ff0..8827745ff 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWListActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWListActivity.java @@ -19,175 +19,28 @@ package org.eehouse.android.xw4; -import android.app.Activity; -import android.app.Dialog; -import android.app.ListActivity; -import android.content.Intent; import android.os.Bundle; -import android.view.ContextMenu.ContextMenuInfo; -import android.view.ContextMenu; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; +import android.widget.ListAdapter; +import android.widget.ListView; -public class XWListActivity extends ListActivity implements ListDelegator { - - private DelegateBase m_dlgt; - - protected void onCreate( Bundle savedInstanceState, DelegateBase dlgt ) - { - if ( XWApp.LOG_LIFECYLE ) { - DbgUtils.logf( "%s.onCreate(this=%H)", getClass().getName(), this ); - } - super.onCreate( savedInstanceState ); - m_dlgt = dlgt; - - int layoutID = dlgt.getLayoutID(); - if ( 0 < layoutID ) { - dlgt.setContentView( layoutID ); - } - - dlgt.init( savedInstanceState ); - } - - @Override - protected void onSaveInstanceState( Bundle outState ) - { - super.onSaveInstanceState( outState ); - m_dlgt.onSaveInstanceState( outState ); - } - - @Override - protected void onPause() - { - if ( XWApp.LOG_LIFECYLE ) { - DbgUtils.logf( "%s.onPause(this=%H)", getClass().getName(), this ); - } - m_dlgt.onPause(); - super.onPause(); - } - - @Override - protected void onResume() - { - if ( XWApp.LOG_LIFECYLE ) { - DbgUtils.logf( "%s.onResume(this=%H)", getClass().getName(), this ); - } - super.onResume(); - m_dlgt.onResume(); - } - - @Override - protected void onStart() - { - if ( XWApp.LOG_LIFECYLE ) { - DbgUtils.logf( "%s.onStart(this=%H)", getClass().getName(), this ); - } - super.onStart(); - m_dlgt.onStart(); - } - - @Override - protected void onStop() - { - if ( XWApp.LOG_LIFECYLE ) { - DbgUtils.logf( "%s.onStop(this=%H)", getClass().getName(), this ); - } - m_dlgt.onStop(); - super.onStop(); - } - - @Override - protected void onDestroy() - { - if ( XWApp.LOG_LIFECYLE ) { - DbgUtils.logf( "%s.onDestroy(this=%H)", getClass().getName(), this ); - } - m_dlgt.onDestroy(); - super.onDestroy(); - } - - @Override - public void onWindowFocusChanged( boolean hasFocus ) - { - super.onWindowFocusChanged( hasFocus ); - m_dlgt.onWindowFocusChanged( hasFocus ); - } - - @Override - public void onBackPressed() { - if ( !m_dlgt.onBackPressed() ) { - super.onBackPressed(); - } - } - - @Override - public boolean onCreateOptionsMenu( Menu menu ) - { - return m_dlgt.onCreateOptionsMenu( menu ); - } - - @Override - public void onCreateContextMenu( ContextMenu menu, View view, - ContextMenuInfo menuInfo ) - { - m_dlgt.onCreateContextMenu( menu, view, menuInfo ); - } - - @Override - public boolean onContextItemSelected( MenuItem item ) - { - return m_dlgt.onContextItemSelected( item ); - } - - @Override - public boolean onPrepareOptionsMenu( Menu menu ) - { - return m_dlgt.onPrepareOptionsMenu( menu ) - || super.onPrepareOptionsMenu( menu ); - } // onPrepareOptionsMenu - - @Override - public boolean onOptionsItemSelected( MenuItem item ) - { - 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( DlgID.values()[id], dialog ); - } - - @Override - protected void onActivityResult( int requestCode, int resultCode, - Intent data ) - { - m_dlgt.onActivityResult( requestCode, resultCode, data ); - } +public class XWListActivity extends XWActivity implements ListDelegator { ////////////////////////////////////////////////////////////////////// - // Delegator interface + // ListDelegator interface ////////////////////////////////////////////////////////////////////// - public Activity getActivity() + public ListView getListView() { - return this; + ListView view = (ListView)findViewById( android.R.id.list ); + return view; } - public Bundle getArguments() + public void setListAdapter( ListAdapter adapter ) + { + getListView().setAdapter( adapter ); + } + + public ListAdapter getListAdapter() { - return getIntent().getExtras(); + return getListView().getAdapter(); } } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWListAdapter.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWListAdapter.java index e3cc4d7e0..6435b82fe 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWListAdapter.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWListAdapter.java @@ -20,7 +20,6 @@ package org.eehouse.android.xw4; -import android.app.ListActivity; import android.widget.ListAdapter; import android.content.Context; import android.database.DataSetObserver; diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocDelegate.java index dbdbeb43f..3738b09ad 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocDelegate.java @@ -20,7 +20,6 @@ package org.eehouse.android.xw4.loc; import android.app.Activity; -import android.app.ListActivity; import android.os.Bundle; import android.view.View; import android.widget.AdapterView;