diff --git a/xwords4/android/app/src/main/assets/BasEnglish2to8.xwd b/xwords4/android/app/src/main/assets/BasEnglish2to8.xwd index 225935e3c..4a070bc2c 100644 Binary files a/xwords4/android/app/src/main/assets/BasEnglish2to8.xwd and b/xwords4/android/app/src/main/assets/BasEnglish2to8.xwd differ diff --git a/xwords4/android/app/src/main/assets/CollegeEng_2to8.xwd b/xwords4/android/app/src/main/assets/CollegeEng_2to8.xwd index cd160a725..2cdb39cc3 100644 Binary files a/xwords4/android/app/src/main/assets/CollegeEng_2to8.xwd and b/xwords4/android/app/src/main/assets/CollegeEng_2to8.xwd differ diff --git a/xwords4/android/app/src/main/assets/Top5000.xwd b/xwords4/android/app/src/main/assets/Top5000.xwd index 138713a4c..52d5d325f 100644 Binary files a/xwords4/android/app/src/main/assets/Top5000.xwd and b/xwords4/android/app/src/main/assets/Top5000.xwd differ diff --git a/xwords4/android/app/src/main/assets/changes.html b/xwords4/android/app/src/main/assets/changes.html index eb5c2a542..72b26e3ac 100644 --- a/xwords4/android/app/src/main/assets/changes.html +++ b/xwords4/android/app/src/main/assets/changes.html @@ -38,6 +38,7 @@ work anyway.)
  • Don't open a closed group when moving games to it
  • Fix occasional crash
  • +
  • Switch from ant to gradle (dev. detail)
  • (The full changelog diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java index 5bba257ea..51a7dc8a5 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java @@ -83,15 +83,8 @@ public class BoardDelegate extends DelegateBase NFCUtils.NFCActor { private static final String TAG = BoardDelegate.class.getSimpleName(); - public static final String INTENT_KEY_CHAT = "chat"; - private static final int SCREEN_ON_TIME = 10 * 60 * 1000; // 10 mins - private static final String DLG_TITLE = "DLG_TITLE"; - private static final String DLG_TITLESTR = "DLG_TITLESTR"; - private static final String DLG_BYTES = "DLG_BYTES"; - private static final String ROOM = "ROOM"; - private static final String PWDNAME = "PWDNAME"; private static final String SAVE_MYSIS = TAG + "/MYSIS"; private Activity m_activity; @@ -617,7 +610,6 @@ public class BoardDelegate extends DelegateBase { super.onResume(); doResume( false ); - checkAddDualpaneExpl(); } protected void onPause() @@ -736,14 +728,6 @@ public class BoardDelegate extends DelegateBase showInviteChoicesThen( Action.LAUNCH_INVITE_ACTION, info ); } - @Override - public void orientationChanged() - { - Log.d( TAG, "BoardDelegate.orientationChanged()" ); - initToolbar(); - m_view.orientationChanged(); - } - @Override protected void setTitle() { @@ -1443,8 +1427,6 @@ public class BoardDelegate extends DelegateBase data = nli.makeLaunchJSON(); } if ( null != data ) { - removeDialog( DlgID.CONFIRM_THEN ); - recordInviteSent( InviteMeans.NFC, null ); } return data; @@ -2822,29 +2804,4 @@ public class BoardDelegate extends DelegateBase m_jniThread.handle( cmd, args ); } } - - // If I'm upgrading and running this for the first time show an - // explanation about the new dualpane feature - // - // TODO remove a few weeks after shipping a version that includes it - private static boolean s_dpShown = false; - private void checkAddDualpaneExpl() - { - if ( !s_dpShown ) { - s_dpShown = true; - // Am I a tablet AND is that because my size says so rather than - // my having overridden it - if ( XWPrefs.getIsTablet( m_activity ) - && getString(R.string.force_tablet_default) - .equals(XWPrefs.getPrefsString(m_activity, - R.string.key_force_tablet)) - && !Utils.onFirstVersion(m_activity ) ) { - makeNotAgainBuilder( R.string.invite_dualpane, - R.string.key_notagain_dualpane ) - .setActionPair(new ActionPair(Action.DISABLE_DUALPANE, - R.string.disable_dualpane)) - .show(); - } - } - } } // class BoardDelegate diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBAlert.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBAlert.java index 94ad546a7..b8e308127 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBAlert.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBAlert.java @@ -50,7 +50,7 @@ public class DBAlert extends XWDialogFragment { if ( null != obj && !(obj instanceof Serializable) ) { Log.d( TAG, "OOPS: %s not Serializable", obj.getClass().getName() ); - // Assert.fail(); + Assert.assertFalse( BuildConfig.DEBUG ); } } } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DelegateBase.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DelegateBase.java index 22fa58dbd..a3568418e 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DelegateBase.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DelegateBase.java @@ -84,7 +84,7 @@ public class DelegateBase implements DlgClickNotify, Assert.assertTrue( 0 < menuID ); m_delegator = delegator; m_activity = delegator.getActivity(); - m_dlgDelegate = new DlgDelegate( m_activity, this, this, bundle ); + m_dlgDelegate = new DlgDelegate( m_activity, this, this ); m_layoutID = layoutID; m_optionsMenuID = menuID; LocUtils.xlateTitle( m_activity ); @@ -100,12 +100,10 @@ public class DelegateBase implements DlgClickNotify, protected void onCreateContextMenu( ContextMenu menu, View view, ContextMenuInfo menuInfo ) {} protected boolean onContextItemSelected( MenuItem item ) { return false; } + protected void onStop() {} protected void onDestroy() {} protected void onWindowFocusChanged( boolean hasFocus ) {} protected boolean handleBackPressed() { return false; } - public void orientationChanged() {} - protected Dialog onCreateDialog( int id ) { return null; } - protected void prepareDialog( DlgID dlgId, Dialog dialog ) {} protected void requestWindowFeature( int feature ) {} @@ -156,16 +154,6 @@ public class DelegateBase implements DlgClickNotify, XWService.setListener( null ); } - protected void onStop() - { - // Alerts disappear on their own if not in dualpane mode - if ( false - && m_activity instanceof MainActivity - && ((MainActivity)m_activity).inDPMode() ) { - DlgDelegate.closeAlerts( m_activity, this ); - } - } - protected DelegateBase curThis() { DelegateBase result = null; @@ -424,15 +412,11 @@ public class DelegateBase implements DlgClickNotify, return cbx.isChecked(); } - protected void showDialog( DlgID dlgID ) - { - m_dlgDelegate.showDialog( dlgID ); - } - protected Dialog makeDialog( DBAlert alert, Object[] params ) { DlgID dlgID = alert.getDlgID(); - Log.d( TAG, "makeDialog(): not handling %s", dlgID.toString() ); + Log.d( TAG, "%s.makeDialog(): not handling %s", getClass().getSimpleName(), + dlgID.toString() ); return null; } @@ -477,32 +461,11 @@ public class DelegateBase implements DlgClickNotify, DbgUtils.assertOnUIThread(); if ( m_activity instanceof XWActivity ) { ((XWActivity)m_activity).show( df ); - } else if ( m_activity instanceof PrefsActivity ) { - ((PrefsActivity)m_activity).show( df ); } else { Assert.assertTrue( !BuildConfig.DEBUG ); } } - protected void removeDialog( DlgID dlgID ) - { - removeDialog( dlgID.ordinal() ); - } - - protected void dismissDialog( DlgID dlgID ) - { - try { - m_activity.dismissDialog( dlgID.ordinal() ); - } catch ( Exception ex ) { - // Log.ex( ex ); - } - } - - protected void removeDialog( int id ) - { - m_activity.removeDialog( id ); - } - protected AlertDialog.Builder makeAlertBuilder() { return LocUtils.makeAlertBuilder( m_activity ); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictBrowseDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictBrowseDelegate.java index 000b1e2c8..9bdb8fb39 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictBrowseDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DictBrowseDelegate.java @@ -312,7 +312,7 @@ public class DictBrowseDelegate extends DelegateBase finish(); break; default: - Assert.assertTrue( !BuildConfig.DEBUG ); + Assert.assertFalse( BuildConfig.DEBUG ); } return handled; } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgDelegate.java index b1f2fb259..6d54b030c 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgDelegate.java @@ -28,28 +28,13 @@ import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface.OnCancelListener; import android.content.DialogInterface.OnClickListener; -import android.content.DialogInterface; import android.os.Bundle; import android.os.Handler; import android.view.View; -import android.widget.AdapterView.OnItemSelectedListener; -import android.widget.AdapterView; -import android.widget.Button; -import android.widget.Spinner; -import android.widget.TextView; import junit.framework.Assert; import org.eehouse.android.xw4.DBUtils.SentInvitesInfo; -import org.eehouse.android.xw4.loc.LocUtils; - -import java.lang.ref.WeakReference; -import java.text.DateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; public class DlgDelegate { private static final String TAG = DlgDelegate.class.getSimpleName(); @@ -288,9 +273,6 @@ public class DlgDelegate { public static final int NFC_BTN = AlertDialog.BUTTON_NEUTRAL; public static final int DISMISS_BUTTON = 0; - private static final String IDS = "IDS"; - private static final String STATE_KEYF = "STATE_%d"; - public interface DlgClickNotify { // These are stored in the INVITES table. Don't change order // gratuitously @@ -311,8 +293,6 @@ public class DlgDelegate { NotAgainBuilder makeNotAgainBuilder( int msgID, int prefsKey ); } - private static Map> s_pendings - = new HashMap>(); private Activity m_activity; private DelegateBase m_dlgt; private DlgClickNotify m_clickCallback; @@ -320,52 +300,13 @@ public class DlgDelegate { private ProgressDialog m_progress; private Handler m_handler; - private HashMap m_dlgStates; - public DlgDelegate( Activity activity, DelegateBase dlgt, - DlgClickNotify callback, Bundle bundle ) + DlgClickNotify callback ) { m_activity = activity; m_dlgt = dlgt; m_clickCallback = callback; m_handler = new Handler(); - m_dlgStates = new HashMap(); - - if ( null != bundle ) { - int[] ids = bundle.getIntArray( IDS ); - if ( null != ids ) { - for ( int id : ids ) { - String key = String.format( STATE_KEYF, id ); - addState( (DlgState)bundle.getParcelable( key ) ); - } - } - } - } - - public void onSaveInstanceState( Bundle outState ) - { - int[] ids = new int[m_dlgStates.size()]; - if ( 0 < ids.length ) { - int indx = 0; - Iterator iter = m_dlgStates.values().iterator(); - while ( iter.hasNext() ) { - DlgState state = iter.next(); - int id = state.m_id.ordinal(); - String key = String.format( STATE_KEYF, id ); - outState.putParcelable( key, state ); - ids[indx++] = id; - } - } - outState.putIntArray( IDS, ids ); - } - - protected void showDialog( DlgID dlgID ) - { - // DbgUtils.logf( "showDialog(%s)", dlgID.toString() ); - if ( !m_activity.isFinishing() ) { - s_pendings.put( dlgID, new WeakReference(m_dlgt) ); - m_activity.showDialog( dlgID.ordinal() ); - } } private void showOKOnlyDialogThen( String msg, Action action, @@ -544,80 +485,6 @@ public class DlgDelegate { } } - private DlgState findForID( DlgID dlgID ) - { - DlgState state = m_dlgStates.get( dlgID ); - // DbgUtils.logf( "findForID(%d)=>%H", id, state ); - return state; - } - - private void dropState( DlgState state ) - { - int nDlgs = m_dlgStates.size(); - Assert.assertNotNull( state ); - // Assert.assertTrue( state == m_dlgStates.get( state.m_id ) ); - m_dlgStates.remove( state.m_id ); - // DbgUtils.logf( "dropState: active dialogs now %d from %d ", - // m_dlgStates.size(), nDlgs ); - } - - private void addState( DlgState state ) - { - // I'm getting serialization failures on devices pointing at - // DlgState but the code below says the object's fine (as it - // should be.) Just to have a record.... - // - // Bundle bundle = new Bundle(); - // DbgUtils.logf( "addState: testing serializable" ); - // bundle.putSerializable( "foo", state ); - // state = (DlgState)bundle.getSerializable( "foo" ); - // DbgUtils.logf( "addState: serializable is ok" ); - - m_dlgStates.put( state.m_id, state ); - } - - public static Dialog onCreateDialog( int id ) - { - Dialog result = null; - DlgID dlgID = DlgID.values()[id]; - WeakReference ref = s_pendings.get( dlgID ); - if ( null != ref ) { - DelegateBase dlgt = ref.get(); - if ( null != dlgt ) { - result = dlgt.onCreateDialog( id ); - } - } - return result; - } - - public static void onPrepareDialog( int id, Dialog dialog ) - { - DlgID dlgID = DlgID.values()[id]; - WeakReference ref = s_pendings.get( dlgID ); - DelegateBase dlgt = ref.get(); - if ( null != dlgt ) { - dlgt.prepareDialog( dlgID, dialog ); - } - } - - protected static void closeAlerts( Activity activity, DelegateBase base ) - { - DbgUtils.assertOnUIThread(); - Iterator iter = s_pendings.keySet().iterator(); - while ( iter.hasNext() ) { - DlgID dlgID = iter.next(); - DelegateBase oneBase = s_pendings.get( dlgID ).get(); - if ( null == oneBase ) { - iter.remove(); // no point in keeping it - } else if ( base.equals( oneBase ) ) { - Log.d( TAG, "removing alert %s for %s", dlgID.toString(), - oneBase.toString() ); - activity.removeDialog( dlgID.ordinal() ); - iter.remove(); // no point in keeping this either - } - } - } - private String getString( int id, Object... params ) { return m_dlgt.getString( id, params ); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DualpaneDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DualpaneDelegate.java index af65611c4..5b7b57ca8 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DualpaneDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DualpaneDelegate.java @@ -61,18 +61,6 @@ public class DualpaneDelegate extends DelegateBase { return dialog; } - @Override - protected Dialog onCreateDialog( int id ) - { - return DlgDelegate.onCreateDialog( id ); - } - - @Override - protected void prepareDialog( DlgID dlgId, Dialog dialog ) - { - DlgDelegate.onPrepareDialog( dlgId.ordinal(), dialog ); - } - @Override protected void handleNewIntent( Intent intent ) { diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/FragActivity.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/FragActivity.java deleted file mode 100644 index 894654676..000000000 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/FragActivity.java +++ /dev/null @@ -1,309 +0,0 @@ -// /* -*- compile-command: "find-and-gradle.sh installXw4Debug"; -*- */ -// /* -// * Copyright 2014-2016 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.graphics.Rect; -// import android.app.Dialog; -// import android.content.res.Configuration; -// import android.os.Bundle; -// import android.support.v4.app.Fragment; -// import android.support.v4.app.FragmentActivity; -// import android.support.v4.app.FragmentManager; -// import android.support.v4.app.FragmentManager.BackStackEntry; -// import android.support.v4.app.FragmentTransaction; -// import android.view.View; -// import android.widget.FrameLayout; -// import android.widget.LinearLayout.LayoutParams; -// import android.widget.LinearLayout; -// import android.widget.LinearLayout; - -// import junit.framework.Assert; - -// public class FragActivity extends FragmentActivity -// implements FragmentManager.OnBackStackChangedListener { - -// private static final int MAX_PANES_LANDSCAPE = 3; - -// // public interface OrientChangeListener { -// // void orientationChanged(); -// // } - -// private static FragActivity s_this; - -// private LinearLayout m_root; -// private int m_nextID = 0x00FFFFFF; -// private int m_maxPanes; -// private Boolean m_isPortrait; - -// @Override -// public void onCreate( Bundle savedInstanceState ) -// { -// s_this = this; -// super.onCreate( savedInstanceState ); -// setContentView( R.layout.dualcontainer ); - -// m_root = (LinearLayout)findViewById( R.id.main_container ); -// getSupportFragmentManager().addOnBackStackChangedListener( this ); - -// m_maxPanes = maxPanes(); - -// // Nothing to do if we're restarting -// if ( savedInstanceState == null ) { -// // In case this activity was started with special instructions from an Intent, -// // pass the Intent's extras to the fragment as arguments -// addFragmentImpl( new GamesListFrag(), getIntent().getExtras(), null ); -// } -// } - -// @Override -// public void onBackPressed() -// { -// DbgUtils.logf( "FragActivity.onBackPressed()" ); -// super.onBackPressed(); -// } - -// @Override -// public void onConfigurationChanged( Configuration newConfig ) -// { -// Rect rect = new Rect(); -// m_root.getWindowVisibleDisplayFrame( rect ); - -// boolean isPortrait -// = Configuration.ORIENTATION_PORTRAIT == newConfig.orientation; -// DbgUtils.logf( "FragActivity.onConfigurationChanged(isPortrait=%b)", -// isPortrait ); -// m_isPortrait = isPortrait; -// if ( isPortrait != (rect.width() <= rect.height()) ) { -// Log.df( "FragActivity.onConfigurationChanged(): isPortrait:" -// + " %b; width: %d; height: %d", -// isPortrait, rect.width(), rect.height() ); -// } -// int maxPanes = isPortrait? 1 : MAX_PANES_LANDSCAPE; -// if ( m_maxPanes != maxPanes ) { -// m_maxPanes = maxPanes; -// setVisiblePanes(); -// } -// tellOrientationChanged(); -// super.onConfigurationChanged( newConfig ); -// } - -// protected void getFragmentDims( int[] dims ) -// { -// Rect rect = new Rect(); -// m_root.getWindowVisibleDisplayFrame( rect ); -// int width = rect.width(); -// int height = rect.height(); -// if ( null != m_isPortrait && m_isPortrait && height < width ) { -// int tmp = width; -// width = height; -// height = tmp; -// } -// dims[0] = width / Math.min( m_maxPanes, m_root.getChildCount() ); -// dims[1] = height; -// } - -// @Override -// protected Dialog onCreateDialog( int id ) -// { -// return DlgDelegate.onCreateDialog( id ); -// } - -// @Override -// protected void onPrepareDialog( int id, Dialog dialog ) -// { -// DlgDelegate.onPrepareDialog( id, dialog ); -// } - -// ////////////////////////////////////////////////////////////////////// -// // FragmentManager.OnBackStackChangedListener -// ////////////////////////////////////////////////////////////////////// -// public void onBackStackChanged() -// { -// DbgUtils.logf( "FragActivity.onBackStackChanged()" ); -// // make sure the right-most are visible -// int fragCount = getSupportFragmentManager().getBackStackEntryCount(); -// if ( 0 == fragCount ) { -// finish(); -// } else if ( fragCount == m_root.getChildCount() - 1 ) { -// m_root.removeViewAt( fragCount ); -// setVisiblePanes(); -// } -// } - -// // public void launchDictFrag( Bundle args ) -// // { -// // // DictBrowseFrag dbf = new DictBrowseFrag(); -// // // dbf.setArguments( args ); -// // // addFragment( dbf ); -// // } - -// protected void finishFragment() -// { -// popFragment( null ); -// } - -// protected void popFragment( Fragment frag ) -// { -// getSupportFragmentManager().popBackStack(); -// } - -// private void addFragmentImpl( Fragment fragment, Bundle bundle, -// Delegator parent ) -// { -// fragment.setArguments( bundle ); -// addFragmentImpl( fragment, parent ); -// } - -// private void addFragmentImpl( Fragment fragment, Delegator delegator ) -// { -// String newName = fragment.getClass().getName(); -// boolean replace = false; -// FragmentManager fm = getSupportFragmentManager(); -// int fragCount = fm.getBackStackEntryCount(); -// int containerCount = m_root.getChildCount(); -// DbgUtils.logf( "fragCount: %d; containerCount: %d", fragCount, containerCount ); -// // Assert.assertTrue( fragCount == containerCount ); - -// // Replace IF we're adding something of the same class at right OR if -// // we're adding something with the existing left pane as its parent -// // (delegator) -// if ( 0 < fragCount ) { -// FragmentManager.BackStackEntry entry = fm.getBackStackEntryAt( fragCount - 1 ); -// String curName = entry.getName(); -// DbgUtils.logf( "name of last entry: %s", curName ); -// replace = curName.equals( newName ); - -// if ( !replace && 1 < fragCount ) { -// entry = fm.getBackStackEntryAt( fragCount - 2 ); -// curName = entry.getName(); -// String delName = delegator.getClass().getName(); -// DbgUtils.logf( "comparing %s, %s", curName, delName ); -// replace = curName.equals( delName ); -// } - -// if ( replace ) { -// fm.popBackStack(); -// } -// } - -// // Replace doesn't seem to work with generated IDs, so we'll create a -// // new FrameLayout each time. If we're replacing, we'll replace the -// // current rightmost FrameLayout. Otherwise we'll add a new one. -// FrameLayout cont = new FrameLayout( this ); -// cont.setLayoutParams( new LayoutParams(0, LayoutParams.MATCH_PARENT, 1.0f) ); -// int id = --m_nextID; -// cont.setId( id ); -// m_root.addView( cont, replace ? containerCount - 1 : containerCount ); - -// if ( !replace && containerCount >= m_maxPanes ) { -// int indx = containerCount - m_maxPanes; -// View child = m_root.getChildAt( indx ); -// child.setVisibility( View.GONE ); - -// setMenuVisibility( child, false ); - -// DbgUtils.logf( "hiding %dth container", indx ); -// } - -// fm.beginTransaction() -// .add( id, fragment ) -// .addToBackStack( newName ) -// .commit(); -// // fm.executePendingTransactions(); -// } - -// private void setVisiblePanes() -// { -// // hide all but the right-most m_maxPanes children -// int nPanes = m_root.getChildCount(); -// for ( int ii = 0; ii < nPanes; ++ii ) { -// View child = m_root.getChildAt( ii ); -// boolean visible = ii >= nPanes - m_maxPanes; -// DbgUtils.logf( "pane %d: visible=%b", ii, visible ); -// child.setVisibility( visible ? View.VISIBLE : View.GONE ); -// setMenuVisibility( child, visible ); -// } -// } - -// private void setMenuVisibility( View cont, boolean visible ) -// { -// FrameLayout layout = (FrameLayout)cont; -// FragmentManager fm = getSupportFragmentManager(); -// int hidingId = layout.getId(); -// Fragment frag = fm.findFragmentById( hidingId ); -// if ( null != frag ) { // hasn't been popped? -// frag.setMenuVisibility( visible ); -// } -// } - -// // Walk all Fragment children and if they care notify of change. -// private void tellOrientationChanged() -// { -// FragmentManager fm = getSupportFragmentManager(); -// int nPanes = m_root.getChildCount(); -// for ( int ii = 0; ii < nPanes; ++ii ) { -// FrameLayout frame = (FrameLayout)m_root.getChildAt( ii ); -// int id = frame.getId(); -// Fragment frag = fm.findFragmentById( id ); -// if ( null == frag ) { -// DbgUtils.logf( "tellOrienationChanged: NO FRAG at %d, id=%d", ii, id ); -// } else if ( frag instanceof XWFragment ) { -// ((XWFragment)frag).getDelegate().orientationChanged(); -// } -// } -// } - -// private int maxPanes() -// { -// int result; -// int orientation = getResources().getConfiguration().orientation; -// if ( XWPrefs.getIsTablet( this ) -// && Configuration.ORIENTATION_LANDSCAPE == orientation ) { -// result = 2; -// } else { -// result = 1; -// } -// return result; -// } - -// private static FragActivity getThis() -// { -// Assert.assertNotNull( s_this ); -// return s_this; -// } - -// public static void addFragment( Fragment fragment, Bundle bundle ) -// { -// addFragment( fragment, bundle, null ); -// } - -// public static void addFragment( Fragment fragment, Bundle bundle, -// Delegator parent ) -// { -// getThis().addFragmentImpl( fragment, bundle, parent ); -// } - -// public static void addFragmentForResult( Fragment fragment, Bundle bundle, -// RequestCode requestCode, Delegator parent ) -// { -// getThis().addFragmentImpl( fragment, bundle, parent ); -// } -// } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java index eb4315735..83dabe748 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java @@ -929,20 +929,6 @@ public class GamesListDelegate extends ListDelegateBase .setEnabled( 0 <= m_mySIS.groupSelItem ); } - @Override - protected void prepareDialog( DlgID dlgID, Dialog dialog ) - { - Assert.fail(); - /* - AlertDialog ad = (AlertDialog)dialog; - switch( dlgID ) { - case CHANGE_GROUP: - ad.getButton( AlertDialog.BUTTON_POSITIVE ).setEnabled( false ); - break; - } - */ - } - @Override protected void init( Bundle savedInstanceState ) { diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/HostActivity.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/HostActivity.java index 5bff99313..c50923579 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/HostActivity.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/HostActivity.java @@ -1,7 +1,6 @@ /* -*- compile-command: "find-and-gradle.sh installXw4Debug"; -*- */ /* - * Copyright 2009-2010 by Eric House (xwords@eehouse.org). All - * rights reserved. + * Copyright 2017 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 @@ -21,16 +20,11 @@ package org.eehouse.android.xw4; import android.os.Bundle; -import android.app.Activity; -import android.content.Intent; public class HostActivity extends XWActivity { - private HostDelegate m_dlgt; @Override public void onCreate( Bundle sis ) { - m_dlgt = new HostDelegate( this, sis ); - super.onCreate( sis, m_dlgt ); + super.onCreate( sis, new HostDelegate( this, sis ) ); } - } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsActivity.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsActivity.java index 17d6cffe2..4cb7ae02b 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsActivity.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsActivity.java @@ -96,13 +96,6 @@ public class PrefsActivity extends PreferenceActivity return m_dlgt.onCreateDialog( id ); } - @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 ) @@ -163,11 +156,4 @@ public class PrefsActivity extends PreferenceActivity public void addFragment( XWFragment fragment, Bundle extras ) { Assert.fail(); } public void addFragmentForResult( XWFragment fragment, Bundle extras, RequestCode code ) { Assert.fail(); } - public void show( DialogFragment fragment ) - { - // This can't work right now because PrefsActivity doesn't inherit - // from anything that can show fragments. So I need to convert to the - // newer preferences framework too. :-( - Assert.fail(); - } } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsDelegate.java index a4f16cad9..9bd6e686e 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsDelegate.java @@ -75,65 +75,63 @@ public class PrefsDelegate extends DelegateBase protected Dialog onCreateDialog( int id ) { - Dialog dialog = super.onCreateDialog( id ); - if ( null == dialog ) { - DialogInterface.OnClickListener lstnr = null; - int confirmID = 0; + DialogInterface.OnClickListener lstnr = null; + int confirmID = 0; - switch( DlgID.values()[id] ) { - case REVERT_COLORS: - confirmID = R.string.confirm_revert_colors; - lstnr = new DialogInterface.OnClickListener() { - public void onClick( DialogInterface dlg, int item ) { - PrefsDelegate self = (PrefsDelegate)curThis(); - SharedPreferences sp = self.getSharedPreferences(); - SharedPreferences.Editor editor = sp.edit(); - int[] colorKeys = { - R.string.key_player0, - R.string.key_player1, - R.string.key_player2, - R.string.key_player3, - R.string.key_bonus_l2x, - R.string.key_bonus_l3x, - R.string.key_bonus_w2x, - R.string.key_bonus_w3x, - R.string.key_tile_back, - R.string.key_clr_crosshairs, - R.string.key_empty, - R.string.key_background, - R.string.key_clr_bonushint, - }; - for ( int colorKey : colorKeys ) { - editor.remove( getString(colorKey) ); - } - editor.commit(); - self.relaunch(); + switch( DlgID.values()[id] ) { + case REVERT_COLORS: + confirmID = R.string.confirm_revert_colors; + lstnr = new DialogInterface.OnClickListener() { + public void onClick( DialogInterface dlg, int item ) { + PrefsDelegate self = (PrefsDelegate)curThis(); + SharedPreferences sp = self.getSharedPreferences(); + SharedPreferences.Editor editor = sp.edit(); + int[] colorKeys = { + R.string.key_player0, + R.string.key_player1, + R.string.key_player2, + R.string.key_player3, + R.string.key_bonus_l2x, + R.string.key_bonus_l3x, + R.string.key_bonus_w2x, + R.string.key_bonus_w3x, + R.string.key_tile_back, + R.string.key_clr_crosshairs, + R.string.key_empty, + R.string.key_background, + R.string.key_clr_bonushint, + }; + for ( int colorKey : colorKeys ) { + editor.remove( getString(colorKey) ); } - }; - break; - case REVERT_ALL: - confirmID = R.string.confirm_revert_all; - lstnr = new DialogInterface.OnClickListener() { - public void onClick( DialogInterface dlg, int item ) { - PrefsDelegate self = (PrefsDelegate)curThis(); - SharedPreferences sp = self.getSharedPreferences(); - SharedPreferences.Editor editor = sp.edit(); - editor.clear(); - editor.commit(); - self.relaunch(); - } - }; - break; - } + editor.commit(); + self.relaunch(); + } + }; + break; + case REVERT_ALL: + confirmID = R.string.confirm_revert_all; + lstnr = new DialogInterface.OnClickListener() { + public void onClick( DialogInterface dlg, int item ) { + PrefsDelegate self = (PrefsDelegate)curThis(); + SharedPreferences sp = self.getSharedPreferences(); + SharedPreferences.Editor editor = sp.edit(); + editor.clear(); + editor.commit(); + self.relaunch(); + } + }; + break; + } - if ( null == dialog && null != lstnr ) { - dialog = makeAlertBuilder() - .setTitle( R.string.query_title ) - .setMessage( confirmID ) - .setPositiveButton( android.R.string.ok, lstnr ) - .setNegativeButton( android.R.string.cancel, null ) - .create(); - } + Dialog dialog = null; + if ( null != lstnr ) { + dialog = makeAlertBuilder() + .setTitle( R.string.query_title ) + .setMessage( confirmID ) + .setPositiveButton( android.R.string.ok, lstnr ) + .setNegativeButton( android.R.string.cancel, null ) + .create(); } return dialog; } @@ -154,13 +152,13 @@ public class PrefsDelegate extends DelegateBase Button button = (Button)findViewById( R.id.revert_colors ); button.setOnClickListener( new View.OnClickListener() { public void onClick( View v ) { - curThis().showDialog( DlgID.REVERT_COLORS ); + showDialog( DlgID.REVERT_COLORS ); } } ); button = (Button)findViewById( R.id.revert_all ); button.setOnClickListener(new View.OnClickListener() { public void onClick( View v ) { - curThis().showDialog( DlgID.REVERT_ALL ); + showDialog( DlgID.REVERT_ALL ); } } ); @@ -365,6 +363,13 @@ public class PrefsDelegate extends DelegateBase } } + private void showDialog( DlgID dlgID ) + { + if ( !m_activity.isFinishing() ) { + m_activity.showDialog( dlgID.ordinal() ); + } + } + private void hideStuff() { if ( !Utils.isGSMPhone( m_activity ) || Perms23.haveNativePerms() ) { diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayInviteDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayInviteDelegate.java index 1393e2c14..cc5a0a08b 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayInviteDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayInviteDelegate.java @@ -122,24 +122,23 @@ public class RelayInviteDelegate extends InviteDelegate { @Override protected void onBarButtonClicked( int id ) { - switch( id ) { - case R.id.button_relay_add: - Utils.notImpl( m_activity ); - break; - case R.id.manual_add_button: - showDialog( DlgID.GET_NUMBER ); - break; - case R.id.button_clear: - Utils.notImpl( m_activity ); - // int count = getChecked().size(); - // String msg = getQuantityString( R.plurals.confirm_clear_sms_fmt, - // count, count ); - // makeConfirmThenBuilder( msg, Action.CLEAR_ACTION ).show(); - break; - } + // switch( id ) { + // case R.id.button_relay_add: + // Utils.notImpl( m_activity ); + // break; + // case R.id.manual_add_button: + // showDialog( DlgID.GET_NUMBER ); + // break; + // case R.id.button_clear: + // Utils.notImpl( m_activity ); + // // int count = getChecked().size(); + // // String msg = getQuantityString( R.plurals.confirm_clear_sms_fmt, + // // count, count ); + // // makeConfirmThenBuilder( msg, Action.CLEAR_ACTION ).show(); + // break; + // } } - // protected void onSaveInstanceState( Bundle outState ) // { // outState.putString( SAVE_NAME, m_pendingName ); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/SMSInviteDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/SMSInviteDelegate.java index 27a0421a2..a037e9e15 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/SMSInviteDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/SMSInviteDelegate.java @@ -125,7 +125,7 @@ public class SMSInviteDelegate extends InviteDelegate { if ( Activity.RESULT_CANCELED != resultCode && data != null ) { switch ( requestCode ) { case GET_CONTACT: - post ( new Runnable() { + post( new Runnable() { @Override public void run() { addPhoneNumbers( data ); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWActivity.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWActivity.java index 42f494ec3..e0ad26d1b 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWActivity.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWActivity.java @@ -192,31 +192,6 @@ public class XWActivity extends FragmentActivity return m_dlgt.onContextItemSelected( item ); } - @Override - protected Dialog onCreateDialog( int id ) - { - Dialog dialog = super.onCreateDialog( id ); - Assert.assertNull( dialog ); - 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 - public void onConfigurationChanged( Configuration newConfig ) - { - m_dlgt.orientationChanged(); - super.onConfigurationChanged( newConfig ); - } - @Override protected void onActivityResult( int requestCode, int resultCode, Intent data ) diff --git a/xwords4/android/app/src/main/res/values/common_rsrc.xml b/xwords4/android/app/src/main/res/values/common_rsrc.xml index 0bb613fad..4ea1d6a19 100644 --- a/xwords4/android/app/src/main/res/values/common_rsrc.xml +++ b/xwords4/android/app/src/main/res/values/common_rsrc.xml @@ -92,7 +92,6 @@ key_notagain_sync key_notagain_newselect - key_notagain_dualpane key_notagain_backclears key_notagain_chat key_notagain_relay diff --git a/xwords4/android/app/src/main/res/values/strings.xml b/xwords4/android/app/src/main/res/values/strings.xml index 5ef80e112..6b0cf490a 100644 --- a/xwords4/android/app/src/main/res/values/strings.xml +++ b/xwords4/android/app/src/main/res/values/strings.xml @@ -2609,14 +2609,6 @@ This game has sent no invitations - This new version of CrossWords lets - larger-screened devices like yours view two panes (e.g. Games List - and Board) side-by-side. You\'ll notice this when your device is - horizontal; when it\'s vertical there\'s no change.\n\n - - I hope you like it. If you don\'t you can disable it below or in the - Appearance section of App Settings. - Disable side-by-side This change will take effect after you restart CrossWords. diff --git a/xwords4/dawg/English/Makefile.BasEnglishBowd b/xwords4/dawg/English/Makefile.BasEnglishBowd new file mode 100644 index 000000000..9f169ab8a --- /dev/null +++ b/xwords4/dawg/English/Makefile.BasEnglishBowd @@ -0,0 +1,20 @@ +# -*- mode: makefile; compile-command: "make -f Makefile.top5000Bowd"; -*- +# Copyright 2017 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. + +DIRTY_LIST=dirtywords.txt +include Makefile.BasEnglish diff --git a/xwords4/dawg/English/Makefile.CollegeEngBowd b/xwords4/dawg/English/Makefile.CollegeEngBowd new file mode 100644 index 000000000..ef8f17065 --- /dev/null +++ b/xwords4/dawg/English/Makefile.CollegeEngBowd @@ -0,0 +1,19 @@ +# -*- mode: makefile; compile-command: "make -f Makefile.CollegeEngBowd"; -*- +# Copyright 2017 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. + +DIRTY_LIST=dirtywords.txt +include Makefile.CollegeEng diff --git a/xwords4/dawg/English/Makefile.top5000Bowd b/xwords4/dawg/English/Makefile.top5000Bowd new file mode 100644 index 000000000..a9a4101a5 --- /dev/null +++ b/xwords4/dawg/English/Makefile.top5000Bowd @@ -0,0 +1,20 @@ +# -*- mode: makefile; compile-command: "make -f Makefile.top5000Bowd"; -*- +# Copyright 2017 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. + +DIRTY_LIST=dirtywords.txt +include Makefile.top5000 diff --git a/xwords4/dawg/English/dirtywords.txt b/xwords4/dawg/English/dirtywords.txt new file mode 100644 index 000000000..0ebb36774 --- /dev/null +++ b/xwords4/dawg/English/dirtywords.txt @@ -0,0 +1,204 @@ +ABO +ABOS +ARSE +ASSHOLE +ASSHOLES +BADASS +BADASSED +BADASSES +BALLSIER +BALLSIEST +BALLSY +BAZOOMS +BLOWJOB +BLOWJOBS +BOCHE +BOCHES +BOOBIE +BUBBIES +BUBBY +BUCKRA +BUCKRAS +BULLSHIT +BULLSHITS +BULLSHITTED +BULLSHITTING +CLIT +COLOREDS +COMSYMP +COMSYMPS +CRAPPER +CRAPPERS +CUNT +CUNTS +DAGO +DAGOES +DAGOS +DARKEY +DARKEYS +DARKIE +DARKIES +DARKY +DICKED +DICKING +DIKEY +DYKEY +FAGGOTRIES +FAGGOTRY +FAGGOTY +FAGGY +FART +FARTED +FARTING +FARTS +FATSO +FATSOES +FATSOS +FRIG +FRIGGED +FRIGGING +FRIGS +FUCK +FUCKED +FUCKER +FUCKERS +FUCKING +FUCKS +FUCKUP +FUCKUPS +GANGBANG +GANGBANGS +GOY +GOYIM +GOYISH +GOYS +GRINGO +GRINGOS +HAOLE +HAOLES +HEBE +HEBES +HONKEY +HONKEYS +HONKIE +HONKIES +HONKY +HUNKIES +JESUIT +JESUITIC +JESUITRIES +JESUITRY +JESUITS +JEW +JEWED +JEWING +JEWS +JIGABOO +JIGABOOS +JISM +JISMS +KIKE +KIKES +LEZ +LEZES +LEZZIE +LEZZIES +LEZZY +LIBBER +LIBBERS +MERDE +MERDES +MICK +MICKS +NANCE +NANCES +NANCIES +NANCY +NIGGER +NIGGERS +NITCHIE +NITCHIES +NOOKIES +NOOKY +OFAY +OFAYS +PAPIST +PAPISTIC +PAPISTRIES +PAPISTRY +PAPISTS +PEED +PEEING +PISS +PISSED +PISSER +PISSERS +PISSES +PISSING +POM +POMMIE +POMMIES +POMMY +POMS +POOFS +POOFTAH +POOFTAHS +POOFTER +POOFTERS +POOFY +POOVE +POOVES +POPERIES +POPERY +POPISH +POPISHLY +REDNECK +REDNECKS +REDSKIN +REDSKINS +SHAT +SHEENEY +SHEENEYS +SHEENIE +SHEENIES +SHEGETZ +SHICKSA +SHICKSAS +SHIKSA +SHIKSAS +SHIKSE +SHIKSES +SHIT +SHITHEAD +SHITHEADS +SHITS +SHITTED +SHITTIER +SHITTIEST +SHITTING +SHITTY +SHKOTZIM +SKIMO +SKIMOS +SPIC +SPICK +SPICKS +SPICS +SPIK +SPIKS +TOMMED +TOMMING +TURD +TURDS +TWAT +TWATS +WETBACK +WETBACKS +WHITEYS +WHITIES +WOG +WOGS +WOP +WOPS +YID +YIDS diff --git a/xwords4/dawg/Makefile.langcommon b/xwords4/dawg/Makefile.langcommon index 500789a91..670481051 100644 --- a/xwords4/dawg/Makefile.langcommon +++ b/xwords4/dawg/Makefile.langcommon @@ -16,6 +16,14 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +ifneq ($(DIRTY_LIST),) + BOWDLERIZER = ../remove-dirty.py $(DIRTY_LIST) + XWLANG := $(XWLANG)_BOWD + DICTNOTE := "$(DICTNOTE) (Bowdlerized)" +else + BOWDLERIZER = cat +endif + XWLANG := $(XWLANG)_ FRANK_EXT = xwd @@ -242,7 +250,7 @@ dawg$(XWLANG)%.stamp: $(XWLANG)Main.dict.gz $(DICT2DAWG) table.bin ../Makefile.l start=$$(echo $@ | sed -e 's/dawg$(XWLANG)\([0-9]*\)to[0-9]*.stamp/\1/'); \ end=$$(echo $@ | sed -e 's/dawg$(XWLANG)[0-9]*to\([0-9]*\).stamp/\1/'); \ echo $${start} and $${end}; \ - zcat $< | $(DICT2DAWG) $(DICT2DAWGARGS) $(TABLE_ARG) table.bin -b 28000 \ + zcat $< | $(BOWDLERIZER) | $(DICT2DAWG) $(DICT2DAWGARGS) $(TABLE_ARG) table.bin -b 28000 \ -ob dawg$(XWLANG)$* $(ENCP) \ -sn $(XWLANG)StartLoc.bin -min $${start} -max $${end} \ -wc $(XWLANG)$*_wordcount.bin $(FORCE_4) -ns $(XWLANG)$*_nodesize.bin @@ -295,9 +303,6 @@ $(XWLANG)%_newheader.bin: $(XWLANG)%_wordcount.bin $(XWLANG)%_note.bin $(XWLANG) perl -e "print pack(\"n\",$$SIZ)" > $@ cat $+ >> $@ -%.dict: %.dict.gz - zcat $< > $@ - # clean this up.... ../dict2dawg: ../dict2dawg.cpp g++ -DDEBUG -O0 -g -Wall -o $@ $< diff --git a/xwords4/dawg/remove-dirty.py b/xwords4/dawg/remove-dirty.py new file mode 100755 index 000000000..2a1d4ced7 --- /dev/null +++ b/xwords4/dawg/remove-dirty.py @@ -0,0 +1,18 @@ +#!/usr/bin/python + +# Invoked with path to bad words list as single parameter, and with a +# stream of words via stdin, loads the bad words into a map and for +# every word in stdin echos it to stdout IFF it's not in the map. + +import sys + +dirtyMap = {} +dirtyList = sys.argv[1] +for f in open(dirtyList): + dirtyMap[f] = True + +for word in sys.stdin: + if word in dirtyMap: + sys.stderr.write( sys.argv[0] + ": dropping: " + word ) + else: + sys.stdout.write( word )