Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
development
Commits
546d7e89
Commit
546d7e89
authored
15 years ago
by
Raphael
Browse files
Options
Download
Email Patches
Plain Diff
Project-lib sample: externalize strings in lib.
Change-Id: I5fff488ab96f1e28942143330c69370f2009e691
parent
bbfd2ed1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
10 deletions
+10
-10
samples/TicTacToeLib/res/values/strings.xml
samples/TicTacToeLib/res/values/strings.xml
+5
-1
samples/TicTacToeLib/src/com/example/android/tictactoe/library/GameActivity.java
...c/com/example/android/tictactoe/library/GameActivity.java
+5
-5
samples/TicTacToeLib/src/com/example/android/tictactoe/library/GameView.java
...b/src/com/example/android/tictactoe/library/GameView.java
+0
-4
No files found.
samples/TicTacToeLib/res/values/strings.xml
View file @
546d7e89
...
...
@@ -16,5 +16,9 @@
-->
<resources>
<!-- TODO externalize strings here. -->
<string
name=
"player2_win"
>
Player 2 (computer) wins!
</string>
<string
name=
"player1_win"
>
Player 1 (you) wins!
</string>
<string
name=
"tie"
>
This is a tie! No one wins!
</string>
<string
name=
"player2_turn"
>
Player 2\'s turn (that\'s the computer)
</string>
<string
name=
"player1_turn"
>
Player 1\'s turn -- that\'s you!
</string>
</resources>
This diff is collapsed.
Click to expand it.
samples/TicTacToeLib/src/com/example/android/tictactoe/library/GameActivity.java
View file @
546d7e89
...
...
@@ -106,11 +106,11 @@ public class GameActivity extends Activity {
mButtonNext
.
setEnabled
(
false
);
if
(
player
==
State
.
PLAYER1
)
{
mInfoView
.
setText
(
"Player 1's turn -- that's you!"
);
mInfoView
.
setText
(
R
.
string
.
player1_turn
);
mGameView
.
setEnabled
(
true
);
}
else
if
(
player
==
State
.
PLAYER2
)
{
mInfoView
.
setText
(
"Player 2's turn (that's the computer)"
);
mInfoView
.
setText
(
R
.
string
.
player2_turn
);
mGameView
.
setEnabled
(
false
);
}
...
...
@@ -248,11 +248,11 @@ public class GameActivity extends Activity {
String
text
;
if
(
player
==
State
.
EMPTY
)
{
text
=
"This is a tie! No one wins!"
;
text
=
getString
(
R
.
string
.
tie
)
;
}
else
if
(
player
==
State
.
PLAYER1
)
{
text
=
"Player 1 (you) wins!"
;
text
=
getString
(
R
.
string
.
player1_win
)
;
}
else
{
text
=
"Player 2 (computer) wins!"
;
text
=
getString
(
R
.
string
.
player2_win
)
;
}
mInfoView
.
setText
(
text
);
}
...
...
This diff is collapsed.
Click to expand it.
samples/TicTacToeLib/src/com/example/android/tictactoe/library/GameView.java
View file @
546d7e89
...
...
@@ -35,7 +35,6 @@ import android.os.Message;
import
android.os.Parcelable
;
import
android.os.Handler.Callback
;
import
android.util.AttributeSet
;
import
android.util.Log
;
import
android.view.MotionEvent
;
import
android.view.View
;
...
...
@@ -43,8 +42,6 @@ import android.view.View;
public
class
GameView
extends
View
{
private
static
final
String
TAG
=
"GameView"
;
public
static
final
long
FPS_MS
=
1000
/
2
;
public
enum
State
{
...
...
@@ -280,7 +277,6 @@ public class GameView extends View {
@Override
protected
void
onSizeChanged
(
int
w
,
int
h
,
int
oldw
,
int
oldh
)
{
super
.
onSizeChanged
(
w
,
h
,
oldw
,
oldh
);
Log
.
d
(
TAG
,
String
.
format
(
"onSizeChanged: %dx%d"
,
w
,
h
));
int
sx
=
(
w
-
2
*
MARGIN
)
/
3
;
int
sy
=
(
h
-
2
*
MARGIN
)
/
3
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment