Skip to content

Commit

Permalink
fix console text characters to same width for accurate columns. chess…
Browse files Browse the repository at this point in the history
… would send password to console fix.
  • Loading branch information
TimmyT123 committed Feb 16, 2016
1 parent 31cc445 commit 26103bd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion app/src/main/java/jwtc/android/chess/ics/ICSClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.app.AlertDialog;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.graphics.Typeface;
import android.media.MediaPlayer;
import android.media.Ringtone;
import android.media.RingtoneManager;
Expand Down Expand Up @@ -1537,6 +1538,9 @@ public void SendToApp(){

public void addConsoleText(final String s) {

_tvConsole.setTypeface(Typeface.MONOSPACE); // Monospace gives each character the same width
_tvPlayConsole.setTypeface(Typeface.MONOSPACE);

final String s2 = _tvConsole.getText() + "\n\n" + s;
if (s2.length() > 8192) {
_tvConsole.setText(s2.substring(s2.length() - 4096));
Expand Down Expand Up @@ -1859,7 +1863,9 @@ public void disconnect() {

public void sendString(String s) {

addConsoleText(s);
if (!s.equals(_pwd)){ // don't send password to console for security reasons
addConsoleText(s);
}

if (_socket == null || _socket.sendString(s + "\n") == false) {
switch (get_gameStartSound()) {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/icsclient.xml
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@
<TextView android:text="..." android:id="@+id/TextViewICSBoardConsole"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:padding="2dip"
android:textSize="11sp"
android:textSize="10sp"
/>
</ScrollView>

Expand Down

0 comments on commit 26103bd

Please sign in to comment.