mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-09 22:00:39 +01:00
Merge branch 'android_branch' into android_sms_kitkat
This commit is contained in:
commit
f7a09551d5
15 changed files with 60 additions and 91 deletions
|
@ -22,7 +22,7 @@
|
|||
to come from a domain that you own or have control over. -->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.eehouse.android.xw4"
|
||||
android:versionCode="64"
|
||||
android:versionCode="65"
|
||||
android:versionName="@string/app_version"
|
||||
>
|
||||
|
||||
|
@ -51,7 +51,7 @@
|
|||
<uses-feature android:name="android.hardware.telephony"
|
||||
android:required = "false"
|
||||
/>
|
||||
<uses-feature android:name="android.hardware.nfc" android:required="true" />
|
||||
<uses-feature android:name="android.hardware.nfc" android:required="false" />
|
||||
|
||||
<!-- GCM stuff -->
|
||||
<permission android:name="org.eehouse.android.xw4.permission.C2D_MESSAGE"
|
||||
|
|
|
@ -640,7 +640,6 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1figureLayout
|
|||
jint width, jint height, jint scorePct, jint trayPct, jint scoreWidth,
|
||||
jint fontWidth, jint fontHt, jboolean squareTiles, jobject jdims )
|
||||
{
|
||||
LOG_FUNC();
|
||||
XWJNI_START();
|
||||
CurGameInfo* gi = makeGI( MPPARM(mpool) env, jgi );
|
||||
|
||||
|
@ -656,7 +655,6 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1figureLayout
|
|||
dimsCtoJ( env, jdims, &dims );
|
||||
}
|
||||
XWJNI_END();
|
||||
LOG_RETURN_VOID();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<resources>
|
||||
<string name="app_version">4.4 beta 72</string>
|
||||
<string name="app_version">4.4 beta 73</string>
|
||||
</resources>
|
||||
|
|
|
@ -58,7 +58,6 @@
|
|||
<string name="key_enable_sms">key_enable_sms</string>
|
||||
<string name="key_keep_screenon">key_keep_screenon</string>
|
||||
<string name="key_thumbsize">key_thumbsize3</string>
|
||||
<string name="key_thumb_enabled">key_thumb_disabled</string>
|
||||
|
||||
<string name="key_summary_field">key_summary_field</string>
|
||||
<string name="key_default_loc">key_default_loc</string>
|
||||
|
|
|
@ -2166,13 +2166,11 @@
|
|||
<string name="sel_gamesf">Games: %d</string>
|
||||
<string name="sel_groupsf">Groups: %d</string>
|
||||
<string name="summary_thumbsize">Thumbnail size</string>
|
||||
<string name="thumb_off">Disabled</string>
|
||||
<string name="sel_dictsf">Wordlists: %d</string>
|
||||
|
||||
<string name="thumb_enabled">Show thumbnails</string>
|
||||
<string name="summary_thumb_enabled">Display snapshots of games</string>
|
||||
<!-- <string name="summary_thumb_enabled">Display snapshots of games</string> -->
|
||||
|
||||
<string name="prefs_thumb">Thumbnails</string>
|
||||
<string name="prefs_thumb_summary">Setting for game snapshots</string>
|
||||
<string name="dropped_dupe">Invitation received but ignored: it
|
||||
has already been used to create a game.</string>
|
||||
<string name="cur_menu_markerf">%1$s (yours)</string>
|
||||
|
|
|
@ -110,22 +110,13 @@
|
|||
<PreferenceScreen android:title="@string/prefs_appearance"
|
||||
android:summary="@string/prefs_appearance_summary"
|
||||
>
|
||||
<PreferenceScreen android:title="@string/prefs_thumb"
|
||||
android:summary="@string/prefs_thumb_summary"
|
||||
>
|
||||
<CheckBoxPreference android:key="@string/key_thumb_enabled"
|
||||
android:title="@string/thumb_enabled"
|
||||
android:summary="@string/summary_thumb_enabled"
|
||||
android:defaultValue="true"
|
||||
/>
|
||||
|
||||
<!-- " pct." below must match R.string.pct_suffix -->
|
||||
<org.eehouse.android.xw4.XWThumbListPreference
|
||||
android:key="@string/key_thumbsize"
|
||||
android:title="@string/summary_thumbsize"
|
||||
android:defaultValue="30 pct."
|
||||
/>
|
||||
</PreferenceScreen>
|
||||
<!-- " pct." below must match R.string.pct_suffix -->
|
||||
<org.eehouse.android.xw4.XWThumbListPreference
|
||||
android:key="@string/key_thumbsize"
|
||||
android:title="@string/summary_thumbsize"
|
||||
android:defaultValue="30 pct."
|
||||
/>
|
||||
|
||||
<org.eehouse.android.xw4.XWSumListPreference
|
||||
android:key="@string/key_summary_field"
|
||||
|
|
|
@ -49,7 +49,6 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
|
|||
private static final int PINCH_THRESHOLD = 40;
|
||||
|
||||
private Context m_context;
|
||||
private Paint m_drawPaint;
|
||||
private int m_defaultFontHt;
|
||||
private int m_mediumFontHt;
|
||||
private int m_jniGamePtr;
|
||||
|
@ -59,7 +58,6 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
|
|||
private BoardCanvas m_canvas; // owns the bitmap
|
||||
private JNIThread m_jniThread;
|
||||
private XWActivity m_parent;
|
||||
private Rect m_boundsScratch;
|
||||
private boolean m_measuredFromDims = false;
|
||||
private BoardDims m_dims;
|
||||
private CommsAddrRec.CommsConnType m_connType =
|
||||
|
@ -78,19 +76,6 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
|
|||
final float scale = getResources().getDisplayMetrics().density;
|
||||
m_defaultFontHt = (int)(MIN_FONT_DIPS * scale + 0.5f);
|
||||
m_mediumFontHt = m_defaultFontHt * 3 / 2;
|
||||
|
||||
m_drawPaint = new Paint();
|
||||
|
||||
m_boundsScratch = new Rect();
|
||||
|
||||
// m_bonusSummaries = new String[5];
|
||||
// int[] ids = { R.string.bonus_l2x_summary,
|
||||
// R.string.bonus_w2x_summary ,
|
||||
// R.string.bonus_l3x_summary,
|
||||
// R.string.bonus_w3x_summary };
|
||||
// for ( int ii = 0; ii < ids.length; ++ii ) {
|
||||
// m_bonusSummaries[ ii+1 ] = getResources().getString( ids[ii] );
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -181,7 +166,6 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
|
|||
height = View.MeasureSpec.getSize( heightMeasureSpec );
|
||||
}
|
||||
|
||||
int heightMode = View.MeasureSpec.getMode( heightMeasureSpec );
|
||||
int minHeight = getSuggestedMinimumHeight();
|
||||
if ( height < minHeight ) {
|
||||
height = minHeight;
|
||||
|
@ -199,7 +183,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
|
|||
{
|
||||
synchronized( this ) {
|
||||
if ( layoutBoardOnce() && m_measuredFromDims ) {
|
||||
canvas.drawBitmap( s_bitmap, 0, 0, m_drawPaint );
|
||||
canvas.drawBitmap( s_bitmap, 0, 0, new Paint() );
|
||||
ConnStatusHandler.draw( m_context, canvas, getResources(),
|
||||
0, 0, m_connType );
|
||||
} else {
|
||||
|
@ -222,8 +206,9 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
|
|||
// need to synchronize??
|
||||
Paint paint = new Paint();
|
||||
paint.setTextSize( m_mediumFontHt );
|
||||
paint.getTextBounds( "-00:00", 0, 6, m_boundsScratch );
|
||||
int timerWidth = m_boundsScratch.width();
|
||||
Rect scratch = new Rect();
|
||||
paint.getTextBounds( "-00:00", 0, 6, scratch );
|
||||
int timerWidth = scratch.width();
|
||||
int fontWidth = timerWidth / 6;
|
||||
m_jniThread.handle( JNIThread.JNICmd.CMD_LAYOUT, width, height,
|
||||
fontWidth, m_defaultFontHt );
|
||||
|
@ -287,7 +272,6 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
|
|||
// SyncedDraw interface implementation
|
||||
public void doJNIDraw()
|
||||
{
|
||||
DbgUtils.logf( "doJNIDraw() called" );
|
||||
boolean drew;
|
||||
synchronized( this ) {
|
||||
if ( !XwJNI.board_draw( m_jniGamePtr ) ) {
|
||||
|
@ -306,8 +290,6 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
|
|||
public void dimsChanged( BoardDims dims )
|
||||
{
|
||||
m_dims = dims;
|
||||
DbgUtils.logf( "BoardView.dimsChanged() called; new dims %dx%d",
|
||||
dims.width, dims.height );
|
||||
m_parent.runOnUiThread( new Runnable() {
|
||||
public void run()
|
||||
{
|
||||
|
|
|
@ -246,7 +246,6 @@ public class DBUtils {
|
|||
|
||||
if ( null == summary && lock.canWrite() ) {
|
||||
summary = GameUtils.summarize( context, lock );
|
||||
saveSummary( context, lock, summary );
|
||||
}
|
||||
return summary;
|
||||
} // getSummary
|
||||
|
@ -1205,17 +1204,17 @@ public class DBUtils {
|
|||
public static void deleteGroup( Context context, long groupid )
|
||||
{
|
||||
// Nuke games having this group id
|
||||
String selection =
|
||||
String selectionGames =
|
||||
String.format( "%s=%d", DBHelper.GROUPID, groupid );
|
||||
|
||||
// And nuke the group record itself
|
||||
selection = String.format( ROW_ID_FMT, groupid );
|
||||
String selectionGroups = String.format( ROW_ID_FMT, groupid );
|
||||
|
||||
initDB( context );
|
||||
synchronized( s_dbHelper ) {
|
||||
SQLiteDatabase db = s_dbHelper.getWritableDatabase();
|
||||
db.delete( DBHelper.TABLE_NAME_SUM, selection, null );
|
||||
db.delete( DBHelper.TABLE_NAME_GROUPS, selection, null );
|
||||
db.delete( DBHelper.TABLE_NAME_SUM, selectionGames, null );
|
||||
db.delete( DBHelper.TABLE_NAME_GROUPS, selectionGroups, null );
|
||||
|
||||
db.close();
|
||||
}
|
||||
|
|
|
@ -51,12 +51,8 @@ public class DbgUtils {
|
|||
|
||||
public static void logEnable( Context context )
|
||||
{
|
||||
boolean on;
|
||||
if ( XWApp.DEBUG || BuildConstants.IS_DEBUG_BUILD ) {
|
||||
on = true;
|
||||
} else {
|
||||
on = XWPrefs.getPrefsBoolean( context, R.string.key_logging_on, false );
|
||||
}
|
||||
boolean on = BuildConstants.IS_DEBUG_BUILD ||
|
||||
XWPrefs.getPrefsBoolean( context, R.string.key_logging_on, false );
|
||||
logEnable( on );
|
||||
}
|
||||
|
||||
|
|
|
@ -411,7 +411,7 @@ public class GameUtils {
|
|||
{
|
||||
long rowid = -1;
|
||||
|
||||
Assert.assertNotNull( inviteID ); // firing
|
||||
Assert.assertNotNull( inviteID );
|
||||
CurGameInfo gi = new CurGameInfo( context, inviteID );
|
||||
gi.setLang( lang[0], dict[0] );
|
||||
lang[0] = gi.dictLang;
|
||||
|
@ -742,6 +742,10 @@ public class GameUtils {
|
|||
saveGame( context, gamePtr, gi, lock, false );
|
||||
summarizeAndClose( context, lock, gamePtr, gi, feedImpl );
|
||||
|
||||
if ( draw && XWPrefs.getThumbEnabled( context ) ) {
|
||||
DBUtils.saveThumbnail( context, lock, null );
|
||||
}
|
||||
|
||||
int flags = setFromFeedImpl( feedImpl );
|
||||
if ( GameSummary.MSG_FLAGS_NONE != flags ) {
|
||||
draw = true;
|
||||
|
|
|
@ -60,24 +60,26 @@ public class NFCUtils {
|
|||
public void register( final Activity activity )
|
||||
{
|
||||
Assert.assertTrue( activity instanceof NFCActor );
|
||||
final NFCActor actor = (NFCActor)activity;
|
||||
NfcAdapter.CreateNdefMessageCallback cb =
|
||||
new NfcAdapter.CreateNdefMessageCallback() {
|
||||
public NdefMessage createNdefMessage( NfcEvent event ) {
|
||||
NdefMessage msg = null;
|
||||
String data = actor.makeNFCMessage();
|
||||
if ( null != data ) {
|
||||
msg = makeMessage( activity, data );
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
};
|
||||
|
||||
NfcManager manager =
|
||||
(NfcManager)activity.getSystemService( Context.NFC_SERVICE );
|
||||
NfcAdapter adapter = manager.getDefaultAdapter();
|
||||
if ( null != adapter ) {
|
||||
adapter.setNdefPushMessageCallback( cb, activity );
|
||||
if ( null != manager ) {
|
||||
NfcAdapter adapter = manager.getDefaultAdapter();
|
||||
if ( null != adapter ) {
|
||||
final NFCActor actor = (NFCActor)activity;
|
||||
NfcAdapter.CreateNdefMessageCallback cb =
|
||||
new NfcAdapter.CreateNdefMessageCallback() {
|
||||
public NdefMessage createNdefMessage( NfcEvent evt )
|
||||
{
|
||||
NdefMessage msg = null;
|
||||
String data = actor.makeNFCMessage();
|
||||
if ( null != data ) {
|
||||
msg = makeMessage( activity, data );
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
};
|
||||
adapter.setNdefPushMessageCallback( cb, activity );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,6 @@ public class PrefsActivity extends PreferenceActivity
|
|||
private String m_smsToasting;
|
||||
private String m_smsEnable;
|
||||
private String m_downloadPath;
|
||||
private String m_thumbEnabled;
|
||||
private String m_thumbSize;
|
||||
private String m_hideTitle;
|
||||
|
||||
|
@ -137,7 +136,6 @@ public class PrefsActivity extends PreferenceActivity
|
|||
m_smsToasting = getString( R.string.key_show_sms );
|
||||
m_smsEnable = getString( R.string.key_enable_sms );
|
||||
m_downloadPath = getString( R.string.key_download_path );
|
||||
m_thumbEnabled = getString( R.string.key_thumb_enabled );
|
||||
m_thumbSize = getString( R.string.key_thumbsize );
|
||||
m_hideTitle = getString( R.string.key_hide_title );
|
||||
|
||||
|
@ -202,8 +200,7 @@ public class PrefsActivity extends PreferenceActivity
|
|||
}
|
||||
}
|
||||
DictUtils.invalDictList();
|
||||
} else if ( key.equals( m_thumbEnabled )
|
||||
|| key.equals( m_thumbSize ) ) {
|
||||
} else if ( key.equals( m_thumbSize ) ) {
|
||||
DBUtils.clearThumbnails( this );
|
||||
} else if ( key.equals( m_hideTitle ) ) {
|
||||
if ( sp.getBoolean( key, false ) && ABUtils.haveActionBar() ) {
|
||||
|
|
|
@ -35,9 +35,8 @@ public class XWApp extends Application {
|
|||
public static final boolean GCMSUPPORTED = true;
|
||||
public static final boolean ATTACH_SUPPORTED = true;
|
||||
public static final boolean REMATCH_SUPPORTED = false;
|
||||
public static final boolean DEBUG = false;
|
||||
public static final boolean DEBUG_LOCKS = false && DEBUG;
|
||||
public static final boolean DEBUG_EXP_TIMERS = false && DEBUG;
|
||||
public static final boolean DEBUG_LOCKS = false;
|
||||
public static final boolean DEBUG_EXP_TIMERS = false;
|
||||
public static final boolean GCM_IGNORED = false;
|
||||
public static final boolean UDP_ENABLED = true;
|
||||
|
||||
|
|
|
@ -344,21 +344,24 @@ public class XWPrefs {
|
|||
|
||||
public static boolean getThumbEnabled( Context context )
|
||||
{
|
||||
return getPrefsBoolean( context, R.string.key_thumb_enabled, false );
|
||||
return 0 < getThumbPct( context );
|
||||
}
|
||||
|
||||
public static int getThumbPct( Context context )
|
||||
{
|
||||
String pct = getPrefsString( context, R.string.key_thumbsize );
|
||||
int result;
|
||||
try {
|
||||
String suffix = context.getString( R.string.pct_suffix );
|
||||
result = Integer.parseInt( pct.substring( 0, pct.length()
|
||||
- suffix.length() ) );
|
||||
} catch (Exception ex ) {
|
||||
result = 30;
|
||||
if ( context.getString( R.string.thumb_off ).equals( pct ) ) {
|
||||
result = 0;
|
||||
} else {
|
||||
try {
|
||||
String suffix = context.getString( R.string.pct_suffix );
|
||||
result = Integer.parseInt( pct.substring( 0, pct.length()
|
||||
- suffix.length() ) );
|
||||
} catch (Exception ex ) {
|
||||
result = 30;
|
||||
}
|
||||
}
|
||||
DbgUtils.logf( "pct: %s => %d", pct, result );
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,8 +37,9 @@ public class XWThumbListPreference extends XWListPreference {
|
|||
{
|
||||
super.onAttachedToActivity();
|
||||
|
||||
CharSequence[] newEntries = new CharSequence[6];
|
||||
CharSequence[] newEntries = new CharSequence[7];
|
||||
int indx = 0;
|
||||
newEntries[indx++] = m_context.getString( R.string.thumb_off );
|
||||
String suffix = m_context.getString( R.string.pct_suffix );
|
||||
for ( int pct = 20; pct <= 45; pct += 5 ) {
|
||||
newEntries[indx++] = String.format( "%d%s", pct, suffix );
|
||||
|
|
Loading…
Add table
Reference in a new issue