Merge branch 'android_branch' into android_bt

Conflicts:
	xwords4/android/XWords4/jni/xwjni.c
This commit is contained in:
Eric House 2012-02-15 18:18:26 -08:00
commit 1f4f6a06a8
13 changed files with 66 additions and 35 deletions

View file

@ -1,4 +1,4 @@
/* -*- compile-command: "../../scripts/ndkbuild.sh"; -*- */ /* -*- compile-command: "cd ..; ../scripts/ndkbuild.sh -j3"; -*- */
/* /*
* Copyright © 2009 - 2011 by Eric House (xwords@eehouse.org). All rights * Copyright © 2009 - 2011 by Eric House (xwords@eehouse.org). All rights
* reserved. * reserved.

View file

@ -1,4 +1,4 @@
/* -*-mode: C; compile-command: "../../scripts/ndkbuild.sh"; -*- */ /* -*-mode: C; compile-command: "cd ..; ../scripts/ndkbuild.sh -j3"; -*- */
/* /*
* Copyright © 2009-2010 by Eric House (xwords@eehouse.org). All * Copyright © 2009-2010 by Eric House (xwords@eehouse.org). All
* rights reserved. * rights reserved.

View file

@ -1,4 +1,4 @@
/* -*-mode: C; compile-command: "../../scripts/ndkbuild.sh"; -*- */ /* -*-mode: C; compile-command: "cd ..; ../scripts/ndkbuild.sh -j3"; -*- */
/* /*
* Copyright © 2009-2010 by Eric House (xwords@eehouse.org). All * Copyright © 2009-2010 by Eric House (xwords@eehouse.org). All
* rights reserved. * rights reserved.

View file

@ -1,4 +1,4 @@
/* -*-mode: C; compile-command: "../../scripts/ndkbuild.sh"; -*- */ /* -*-mode: C; compile-command: "cd ..; ../scripts/ndkbuild.sh -j3"; -*- */
/* /*
* Copyright 2001-2010 by Eric House (xwords@eehouse.org). All rights * Copyright 2001-2010 by Eric House (xwords@eehouse.org). All rights
* reserved. * reserved.

View file

@ -1,4 +1,4 @@
/* -*-mode: C; compile-command: "../../scripts/ndkbuild.sh"; -*- */ /* -*-mode: C; compile-command: "cd ..; ../scripts/ndkbuild.sh -j3"; -*- */
/* /*
* Copyright 2001-2010 by Eric House (xwords@eehouse.org). All rights * Copyright 2001-2010 by Eric House (xwords@eehouse.org). All rights
* reserved. * reserved.

View file

@ -1,4 +1,4 @@
/* -*-mode: C; compile-command: "../../scripts/ndkbuild.sh"; -*- */ /* -*-mode: C; compile-command: "cd ..; ../scripts/ndkbuild.sh -j3"; -*- */
/* /*
* Copyright © 2012 by Eric House (xwords@eehouse.org). All rights reserved. * Copyright © 2012 by Eric House (xwords@eehouse.org). All rights reserved.
* *

View file

@ -1,4 +1,4 @@
/* -*-mode: C; compile-command: "../../scripts/ndkbuild.sh"; -*- */ /* -*-mode: C; compile-command: "cd ..; ../scripts/ndkbuild.sh -j3"; -*- */
/* /*
* Copyright 2001-2010 by Eric House (xwords@eehouse.org). All rights * Copyright 2001-2010 by Eric House (xwords@eehouse.org). All rights
* reserved. * reserved.

View file

@ -1,4 +1,4 @@
/* -*-mode: C; compile-command: "../../scripts/ndkbuild.sh"; -*- */ /* -*-mode: C; compile-command: "cd ..; ../scripts/ndkbuild.sh -j3"; -*- */
/* /*
* Copyright 2001-2010 by Eric House (xwords@eehouse.org). All rights * Copyright 2001-2010 by Eric House (xwords@eehouse.org). All rights
* reserved. * reserved.

View file

@ -1,4 +1,4 @@
/* -*-mode: C; compile-command: "../../scripts/ndkbuild.sh -j3"; -*- */ /* -*-mode: C; compile-command: "cd ../; ../scripts/ndkbuild.sh -j3"; -*- */
/* /*
* Copyright © 2009 - 2011 by Eric House (xwords@eehouse.org). All rights * Copyright © 2009 - 2011 by Eric House (xwords@eehouse.org). All rights
* reserved. * reserved.

View file

@ -57,6 +57,9 @@
<string name="key_keep_screenon">key_keep_screenon</string> <string name="key_keep_screenon">key_keep_screenon</string>
<string name="key_summary_field">key_summary_field</string> <string name="key_summary_field">key_summary_field</string>
<!-- database keys whose entries aren't visible prefs -->
<string name="key_closed_langs">key_closed_langs</string>
<string name="key_notagain_sync">key_notagain_sync</string> <string name="key_notagain_sync">key_notagain_sync</string>
<string name="key_notagain_chat">key_notagain_chat</string> <string name="key_notagain_chat">key_notagain_chat</string>
<string name="key_notagain_relay">key_notagain_relay</string> <string name="key_notagain_relay">key_notagain_relay</string>

View file

@ -1,6 +1,6 @@
/* -*- compile-command: "cd ../../../../../; ant debug install"; -*- */ /* -*- compile-command: "cd ../../../../../; ant debug install"; -*- */
/* /*
* Copyright 2009 - 2011 by Eric House (xwords@eehouse.org). All * Copyright 2009 - 2012 by Eric House (xwords@eehouse.org). All
* rights reserved. * rights reserved.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -24,32 +24,33 @@ 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.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;
import android.database.DataSetObserver; import android.database.DataSetObserver;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.widget.Button; import android.preference.PreferenceManager;
import android.widget.TextView;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.res.Resources;
import android.content.SharedPreferences;
import android.view.View;
import android.view.ViewGroup;
import android.view.ContextMenu;
import android.view.MenuItem;
import android.view.ContextMenu.ContextMenuInfo; import android.view.ContextMenu.ContextMenuInfo;
import android.view.ContextMenu;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MenuInflater; import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ExpandableListAdapter; import android.widget.ExpandableListAdapter;
import android.widget.ExpandableListView;
import android.widget.ExpandableListView.ExpandableListContextMenuInfo; import android.widget.ExpandableListView.ExpandableListContextMenuInfo;
import android.widget.ExpandableListView;
import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import android.preference.PreferenceManager;
import android.net.Uri;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import junit.framework.Assert; import junit.framework.Assert;
import org.eehouse.android.xw4.DictUtils.DictAndLoc; import org.eehouse.android.xw4.DictUtils.DictAndLoc;
@ -70,8 +71,7 @@ public class DictsActivity extends ExpandableListActivity
private static final String LANG = "lang"; private static final String LANG = "lang";
private static final String MOVEFROMLOC = "movefromloc"; private static final String MOVEFROMLOC = "movefromloc";
private static HashMap<String,Boolean> s_openStates = private HashSet<String> m_closedLangs;
new HashMap<String,Boolean>();
// For new callback alternative // For new callback alternative
private static final int DELETE_DICT_ACTION = 1; private static final int DELETE_DICT_ACTION = 1;
@ -214,10 +214,12 @@ public class DictsActivity extends ExpandableListActivity
public boolean isEmpty() { return false; } public boolean isEmpty() { return false; }
public void onGroupCollapsed(int groupPosition) public void onGroupCollapsed(int groupPosition)
{ {
s_openStates.put( m_langs[groupPosition], false ); m_closedLangs.add( m_langs[groupPosition] );
saveClosed();
} }
public void onGroupExpanded(int groupPosition){ public void onGroupExpanded(int groupPosition){
s_openStates.put( m_langs[groupPosition], true ); m_closedLangs.remove( m_langs[groupPosition] );
saveClosed();
} }
public void registerDataSetObserver( DataSetObserver obs ){} public void registerDataSetObserver( DataSetObserver obs ){}
public void unregisterDataSetObserver( DataSetObserver obs ){} public void unregisterDataSetObserver( DataSetObserver obs ){}
@ -380,6 +382,14 @@ public class DictsActivity extends ExpandableListActivity
super.onCreate( savedInstanceState ); super.onCreate( savedInstanceState );
getBundledData( savedInstanceState ); getBundledData( savedInstanceState );
m_closedLangs = new HashSet<String>();
String[] closed = CommonPrefs.getClosedLangs( this );
if ( null != closed ) {
for ( String str : closed ) {
m_closedLangs.add( str );
}
}
Resources res = getResources(); Resources res = getResources();
m_locNames = res.getStringArray( R.array.loc_names ); m_locNames = res.getStringArray( R.array.loc_names );
@ -670,15 +680,18 @@ public class DictsActivity extends ExpandableListActivity
for ( int ii = 0; ii < m_langs.length; ++ii ) { for ( int ii = 0; ii < m_langs.length; ++ii ) {
boolean open = true; boolean open = true;
String lang = m_langs[ii]; String lang = m_langs[ii];
if ( s_openStates.containsKey( lang ) ) { if ( ! m_closedLangs.contains( lang ) ) {
open = s_openStates.get( lang );
}
if ( open ) {
m_expView.expandGroup( ii ); m_expView.expandGroup( ii );
} }
} }
} }
private void saveClosed()
{
String[] asArray = m_closedLangs.toArray( new String[m_closedLangs.size()] );
CommonPrefs.setClosedLangs( this, asArray );
}
private static Intent mkDownloadIntent( Context context, private static Intent mkDownloadIntent( Context context,
int lang, String dict ) int lang, String dict )
{ {

View file

@ -22,9 +22,10 @@ package org.eehouse.android.xw4.jni;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.graphics.Paint;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.Paint;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import junit.framework.Assert; import junit.framework.Assert;
import org.eehouse.android.xw4.R; import org.eehouse.android.xw4.R;
@ -331,6 +332,19 @@ public class CommonPrefs {
return getString( context, R.string.key_summary_field ); return getString( context, R.string.key_summary_field );
} }
public static void setClosedLangs( Context context, String[] langs )
{
setPrefsString( context, R.string.key_closed_langs,
TextUtils.join( "\n", langs ) );
}
public static String[] getClosedLangs( Context context )
{
String asStr = getString( context, R.string.key_closed_langs );
String[] result = null == asStr ? null : TextUtils.split( asStr, "\n" );
return result;
}
public static boolean getPrefsBoolean( Context context, int keyID, public static boolean getPrefsBoolean( Context context, int keyID,
boolean defaultValue ) boolean defaultValue )
{ {

View file

@ -76,6 +76,7 @@ static StateTable g_stateTable[] = {
{ XWS_ALLCONND, XWE_GOTONEACK, XWA_NONE, XWS_ALLCONND }, { XWS_ALLCONND, XWE_GOTONEACK, XWA_NONE, XWS_ALLCONND },
{ XWS_EMPTY, XWE_PROXYMSG, XWA_PROXYMSG, XWS_SAME }, { XWS_EMPTY, XWE_PROXYMSG, XWA_PROXYMSG, XWS_SAME },
{ XWS_WAITMORE, XWE_PROXYMSG, XWA_PROXYMSG, XWS_SAME },
{ XWS_ALLCONND, XWE_PROXYMSG, XWA_PROXYMSG, XWS_SAME }, { XWS_ALLCONND, XWE_PROXYMSG, XWA_PROXYMSG, XWS_SAME },
/* { XWS_WAITMORE, XWE_GAMEFULL, XWA_SENDALLHERE, XWS_ALLCONND }, */ /* { XWS_WAITMORE, XWE_GAMEFULL, XWA_SENDALLHERE, XWS_ALLCONND }, */