add rate-me menu

This commit is contained in:
Eric House 2014-01-23 19:32:06 -08:00
parent cb9f095d93
commit acb090154d
3 changed files with 27 additions and 3 deletions

View file

@ -16,6 +16,11 @@
android:icon="@drawable/prefs__gen"
android:showAsAction="ifRoom"
/>
<item android:id="@+id/games_menu_rateme"
android:title="@string/menu_rateme"
/>
<item android:id="@+id/games_menu_dicts"
android:title="@string/gamel_menu_dicts"
android:icon="@drawable/dict__gen"

View file

@ -2197,4 +2197,7 @@
browsers for viewing the wordlists downloads page, DO NOT choose
Firefox. Some versions have a bug that can cause the wordlists to
be lost.</string>
<string name="menu_rateme">Rate Crosswords</string>
<string name="no_market">Google Play app not found</string>
</resources>

View file

@ -710,7 +710,12 @@ public class GamesList extends XWExpandableListActivity
Utils.setItemVisible( menu, R.id.games_game_move,
(1 < m_adapter.getGroupCount()
&& 0 < nGamesSelected) );
Utils.setItemVisible( menu, R.id.games_game_reset, 0 < nGamesSelected );
Utils.setItemVisible( menu, R.id.games_game_reset,
0 < nGamesSelected );
// Hide rate-me if not a google play app
enable = nothingSelected && Utils.isGooglePlayApp( this );
Utils.setItemVisible( menu, R.id.games_menu_rateme, enable );
m_menuPrepared = super.onPrepareOptionsMenu( menu );
} else {
@ -770,6 +775,16 @@ public class GamesList extends XWExpandableListActivity
Utils.launchSettings( this );
break;
case R.id.games_menu_rateme:
String str = String.format( "market://details?id=%s",
getPackageName() );
try {
startActivity( new Intent( Intent.ACTION_VIEW, Uri.parse( str ) ) );
} catch ( android.content.ActivityNotFoundException anf ) {
showOKOnlyDialog( R.string.no_market );
}
break;
case R.id.games_menu_about:
showAboutDialog();
break;
@ -1389,10 +1404,11 @@ public class GamesList extends XWExpandableListActivity
public static Intent makeRematchIntent( Context context, CurGameInfo gi,
long rowid )
{
Intent intent = makeSelfIntent( context );
Intent intent = null;
if ( CurGameInfo.DeviceRole.SERVER_STANDALONE == gi.serverRole ) {
intent.putExtra( REMATCH_ROWID_EXTRA, rowid );
intent = makeSelfIntent( context )
.putExtra( REMATCH_ROWID_EXTRA, rowid );
} else {
Utils.notImpl( context );
}