mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-28 07:58:08 +01:00
first step in implementing lookup of words: add button and browser
launch to single website for hard-coded word.
This commit is contained in:
parent
131bb561bc
commit
b579bb0bca
3 changed files with 38 additions and 1 deletions
|
@ -84,6 +84,8 @@
|
|||
<string name="app_version">4.4 beta 34</string>
|
||||
<string name="game_url_pathf">//%1$s/newgame.php</string>
|
||||
|
||||
<string name="word_lookupf">http://dictionary.com/browse/%s</string>
|
||||
|
||||
<!-- Debugging stuff. No point in localizing it. -->
|
||||
<string name="advanced">For debugging</string>
|
||||
<string name="advanced_summary">You should never need these...</string>
|
||||
|
|
|
@ -1764,5 +1764,8 @@
|
|||
dialog -->
|
||||
<string name="changes_button">Recent changes</string>
|
||||
|
||||
|
||||
<string name="button_lookup">Lookup word</string>
|
||||
|
||||
</resources>
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ import android.widget.Toast;
|
|||
import junit.framework.Assert;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.net.Uri;
|
||||
|
||||
import org.eehouse.android.xw4.jni.*;
|
||||
import org.eehouse.android.xw4.jni.JNIThread.*;
|
||||
|
@ -70,6 +71,7 @@ public class BoardActivity extends XWActivity
|
|||
private static final int QUERY_ENDGAME = DLG_OKONLY + 7;
|
||||
private static final int DLG_DELETED = DLG_OKONLY + 8;
|
||||
private static final int DLG_INVITE = DLG_OKONLY + 9;
|
||||
private static final int DLG_SCORES_BLK = DLG_OKONLY + 10;
|
||||
|
||||
private static final int CHAT_REQUEST = 1;
|
||||
private static final int SCREEN_ON_TIME = 10 * 60 * 1000; // 10 mins
|
||||
|
@ -208,6 +210,7 @@ public class BoardActivity extends XWActivity
|
|||
|
||||
case QUERY_REQUEST_BLK:
|
||||
case QUERY_INFORM_BLK:
|
||||
case DLG_SCORES_BLK:
|
||||
ab = new AlertDialog.Builder( this )
|
||||
.setMessage( m_dlgBytes );
|
||||
if ( 0 != m_dlgTitle ) {
|
||||
|
@ -230,6 +233,14 @@ public class BoardActivity extends XWActivity
|
|||
}
|
||||
};
|
||||
ab.setNegativeButton( R.string.button_no, lstnr );
|
||||
} else if ( DLG_SCORES_BLK == id ) {
|
||||
lstnr = new DialogInterface.OnClickListener() {
|
||||
public void onClick( DialogInterface dialog,
|
||||
int whichButton ) {
|
||||
lookupRecent();
|
||||
}
|
||||
};
|
||||
ab.setNegativeButton( R.string.button_lookup, lstnr );
|
||||
}
|
||||
|
||||
dialog = ab.create();
|
||||
|
@ -1032,7 +1043,8 @@ public class BoardActivity extends XWActivity
|
|||
case UtilCtxt.QUERY_ROBOT_TRADE:
|
||||
m_dlgBytes = query;
|
||||
m_dlgTitle = R.string.info_title;
|
||||
waitBlockingDialog( QUERY_INFORM_BLK, 0 );
|
||||
waitBlockingDialog( QUERY_ROBOT_MOVE == id ?
|
||||
DLG_SCORES_BLK : QUERY_INFORM_BLK, 0 );
|
||||
result = true;
|
||||
break;
|
||||
|
||||
|
@ -1501,4 +1513,24 @@ public class BoardActivity extends XWActivity
|
|||
which );
|
||||
}
|
||||
}
|
||||
|
||||
private void lookupRecent()
|
||||
{
|
||||
// String[] words = XwJNI.model_getLastTurnWords( m_jniGamePtr );
|
||||
String[] words = { "mastodon", "elephant" };
|
||||
|
||||
String fmt = getString( R.string.word_lookupf );
|
||||
String dict_url = String.format( fmt, words[0] );
|
||||
Uri uri = Uri.parse( dict_url );
|
||||
Intent intent = new Intent( Intent.ACTION_VIEW, uri );
|
||||
intent.setFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
|
||||
|
||||
try {
|
||||
startActivity( intent );
|
||||
} catch ( android.content.ActivityNotFoundException anfe ) {
|
||||
Utils.logf( "%s", anfe.toString() );
|
||||
// Toast.makeText( this, R.string.no_download_warning,
|
||||
// Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
} // class BoardActivity
|
||||
|
|
Loading…
Add table
Reference in a new issue