mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-30 08:34:16 +01:00
add changes summary dialog shown on first launch after an upgrade.
This commit is contained in:
parent
269bd15a45
commit
287ab2485f
4 changed files with 151 additions and 0 deletions
32
xwords4/android/XWords4/res/raw/changes
Normal file
32
xwords4/android/XWords4/res/raw/changes
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<style type="text/css">
|
||||||
|
body {font-size: smaller;}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<b>Crosswords 4.4 beta 14 release</b>
|
||||||
|
|
||||||
|
<ul>New features:
|
||||||
|
<li>This spiffy per-release dialog</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<ul>Bugs fixed:
|
||||||
|
<li>bug 1</li>
|
||||||
|
<li>bug 2</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<ul>Coming soon
|
||||||
|
<li>builtin online help</li>
|
||||||
|
<li>rewrite of gameplay via relay to make connecting easier etc.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>Please remember that this is beta software. Letting me know (at
|
||||||
|
eehouse@eehouse.org) what's broken and what features you'd most like
|
||||||
|
to see is the best way to help get this to release quality
|
||||||
|
quickly.</p>
|
||||||
|
|
||||||
|
<p>Thanks!<br>--Eric</p>
|
||||||
|
|
||||||
|
</body>
|
|
@ -361,5 +361,6 @@
|
||||||
<string name="initial_player_minutes">Timer minutes per player</string>
|
<string name="initial_player_minutes">Timer minutes per player</string>
|
||||||
|
|
||||||
<string name="git_rev_title">Source version id</string>
|
<string name="git_rev_title">Source version id</string>
|
||||||
|
<string name="changes_title">Recent changes</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -0,0 +1,116 @@
|
||||||
|
/* -*- compile-command: "cd ../../../../../; ant install"; -*- */
|
||||||
|
/*
|
||||||
|
* Copyright 2010 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.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.SharedPreferences.Editor;
|
||||||
|
import android.content.pm.PackageInfo;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.webkit.WebView;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.Reader;
|
||||||
|
|
||||||
|
/* Put up a dialog greeting user after every upgrade. Based on
|
||||||
|
* similar feature in OpenSudoku, to whose author "Thanks".
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class FirstRunDialog {
|
||||||
|
private static final String HIDDEN_PREFS = "xwprefs_hidden";
|
||||||
|
private static final String SHOWN_VERSION_KEY = "SHOWN_VERSION_KEY";
|
||||||
|
|
||||||
|
static void show( Context context )
|
||||||
|
{
|
||||||
|
int thisVersion = 0;
|
||||||
|
try {
|
||||||
|
thisVersion = context.getPackageManager()
|
||||||
|
.getPackageInfo(context.getPackageName(), 0)
|
||||||
|
.versionCode;
|
||||||
|
Utils.logf( "versionCode: %d", thisVersion );
|
||||||
|
} catch ( Exception e ) {
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( thisVersion > 0 ) {
|
||||||
|
SharedPreferences prefs =
|
||||||
|
context.getSharedPreferences( HIDDEN_PREFS,
|
||||||
|
Context.MODE_PRIVATE );
|
||||||
|
int shownVersion = prefs.getInt( SHOWN_VERSION_KEY, 0 );
|
||||||
|
if ( shownVersion < thisVersion ) {
|
||||||
|
showDialog( context );
|
||||||
|
|
||||||
|
Editor editor = prefs.edit();
|
||||||
|
editor.putInt( SHOWN_VERSION_KEY, thisVersion );
|
||||||
|
editor.commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void showDialog( Context context )
|
||||||
|
{
|
||||||
|
String page = null;
|
||||||
|
InputStream inputStream = null;
|
||||||
|
try {
|
||||||
|
inputStream = context.getResources()
|
||||||
|
.openRawResource(R.raw.changes);
|
||||||
|
|
||||||
|
final char[] buf = new char[0x1000];
|
||||||
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
Reader reader = new InputStreamReader( inputStream, "UTF-8" );
|
||||||
|
int nRead;
|
||||||
|
do {
|
||||||
|
nRead = reader.read( buf, 0, buf.length );
|
||||||
|
if ( nRead > 0 ) {
|
||||||
|
stringBuilder.append( buf, 0, nRead );
|
||||||
|
}
|
||||||
|
} while ( nRead >= 0 );
|
||||||
|
|
||||||
|
page = stringBuilder.toString();
|
||||||
|
}
|
||||||
|
catch ( IOException ioe ) {
|
||||||
|
Utils.logf( ioe.toString() );
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
// could just catch NPE....
|
||||||
|
if ( null != inputStream ) {
|
||||||
|
try {
|
||||||
|
inputStream.close();
|
||||||
|
} catch ( IOException ioe ) {
|
||||||
|
Utils.logf( ioe.toString() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// This won't support e.g mailto refs. Probably want to
|
||||||
|
// launch the browser with an intent eventually.
|
||||||
|
WebView view = new WebView( context );
|
||||||
|
view.loadData( page, "text/html", "utf-8" );
|
||||||
|
|
||||||
|
AlertDialog dialog = new AlertDialog.Builder( context )
|
||||||
|
.setIcon(android.R.drawable.ic_menu_info_details)
|
||||||
|
.setTitle( R.string.changes_title )
|
||||||
|
.setView( view )
|
||||||
|
.setPositiveButton( R.string.button_ok, null)
|
||||||
|
.create();
|
||||||
|
dialog.show();
|
||||||
|
}
|
||||||
|
}
|
|
@ -127,6 +127,8 @@ public class GamesList extends ListActivity {
|
||||||
|
|
||||||
m_adapter = new GameListAdapter( this );
|
m_adapter = new GameListAdapter( this );
|
||||||
setListAdapter( m_adapter );
|
setListAdapter( m_adapter );
|
||||||
|
|
||||||
|
FirstRunDialog.show( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Reference in a new issue