Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
jcarolus committed Aug 15, 2017
2 parents 11ff55c + aef2e56 commit 92a4f45
Show file tree
Hide file tree
Showing 25 changed files with 147 additions and 59 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ android {
}
}
compileSdkVersion 24
buildToolsVersion "24.0.0"
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "jwtc.android.chess"
minSdkVersion 11
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="jwtc.android.chess"
android:versionCode="148"
android:versionName="8.8.3"
android:versionCode="149"
android:versionName="8.8.4"
android:installLocation="auto"
>
<application android:name=".MyApplication" android:icon="@drawable/icon" android:label="@string/app_name"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/assets/about-ru.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ <h3>О приложении</h3>
<p><i>Тим Теннисон</i>: несколько улучшений.</p>
<p><i>Алессандро Дал Белло, Паоло Страффи</i>: итальянский перевод.</p>
<p><i>Ильдар Губайдулин</i>: русский перевод.</p>
<p><i>Марселла De Rosa</i>: Испанские и португальские переводы.</p>
<p><i>Стан Zheng</i>: Китайский перевод.</p>
<p><i>Марселья Де Роса</i>: Испанские и португальские переводы.</p>
<p><i>Стан Чжэн</i>: Китайский перевод.</p>

</body>
</html>
4 changes: 2 additions & 2 deletions app/src/main/assets/help-ru.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ <h3>Помощь</h3>
<p><i>Тим Теннисон</i>: несколько улучшений.</p>
<p><i>Алессандро Дал Белло, Паоло Страффи</i>: итальянский перевод.</p>
<p><i>Ильдар Губайдулин</i>: русский перевод.</p>
<p><i>Марселла De Rosa</i>: Испанские и португальские переводы.</p>
<p><i>Стан Zheng</i>: Китайский перевод.</p>
<p><i>Марселья Де Роса</i>: Испанские и португальские переводы.</p>
<p><i>Стан Чжэн</i>: Китайский перевод.</p>

<h4>Игра</h4>
<p>Играйте против Android или используйте шахматную доску для анализа игр.
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/assets/help_practice-ru.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ <h3>Помощь в тренировке</h3>
Ваше время и среднее время для каждой позиции указано рядом с доской.<br/>
Нажмите кнопку 'Показать' для решения.<br/>
Нажмите кнопку 'Далее', чтобы перейти к следующей позиции.<br/>
Иногда может быть найдено несколько решений, но приложение принимает только одно их них.
Иногда может быть найдено несколько решений, но приложение принимает только одно из них.
</p>

<p>
Expand Down
11 changes: 6 additions & 5 deletions app/src/main/java/jwtc/android/chess/puzzle/ChessViewPuzzle.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.res.Resources;
import android.os.Handler;
import android.os.Message;
import android.text.InputType;
Expand Down Expand Up @@ -65,7 +66,7 @@ public void handleMessage(Message msg) {
_progressDlg.setMessage(_parent.getString(R.string.msg_progress) + String.format(" %d", (_cnt * 100) / _num) + " %");
} else if (msg.what == 3) {
_progressDlg.hide();
_tvPuzzleText.setText("An error occured during install");
_tvPuzzleText.setText(_parent.getString(R.string.puzzle_error_install));
}
}

Expand Down Expand Up @@ -282,7 +283,7 @@ public void flipBoard() {
@Override
protected boolean requestMove(int from, int to) {
if (_arrPGN.size() <= _jni.getNumBoard() - 1) {
setMessage("(position allready solved)");
setMessage(_parent.getString(R.string.puzzle_already_solved));
return super.requestMove(from, to);
}
int move = _arrPGN.get(_jni.getNumBoard() - 1)._move;
Expand All @@ -307,7 +308,7 @@ protected boolean requestMove(int from, int to) {
return true;
} else {
// check for illegal move
setMessage("Move " + Move.toDbgString(theMove) + (checkIsLegalMove(from, to) ? " is not the expected move" : " is an invalid move"));
setMessage(Move.toDbgString(theMove) + (checkIsLegalMove(from, to) ? _parent.getString(R.string.puzzle_not_correct_move) : _parent.getString(R.string.puzzle_invalid_move)));
_imgStatus.setImageResource(R.drawable.indicator_error);
m_iFrom = -1;

Expand All @@ -331,7 +332,7 @@ public void play() {
if (_iPos < 1)
_iPos = 1;
if (_iPos > _num) {
setMessage("You completed all puzzles!!!");
setMessage(_parent.getString(R.string.puzzle_all_completed));
return;
}

Expand Down Expand Up @@ -398,7 +399,7 @@ public boolean handleClick(int index) {
final String[] items = _parent.getResources().getStringArray(R.array.promotionpieces);

AlertDialog.Builder builder = new AlertDialog.Builder(_parent);
builder.setTitle("Pick promotion piece");
builder.setTitle(_parent.getString(R.string.puzzle_pick_promotion));
builder.setSingleChoiceItems(items, 0, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
dialog.dismiss();
Expand Down
33 changes: 20 additions & 13 deletions app/src/main/java/jwtc/android/chess/tools/FileListView.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.view.Gravity;
import android.view.MenuItem;
import android.view.View;
Expand Down Expand Up @@ -38,7 +40,11 @@ public void onCreate(Bundle savedInstanceState) {
}

private void browseToRoot() {
browseTo(new File("/"));
String sRoot = "";
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
sRoot = Environment.getExternalStorageDirectory().toString();
}
browseTo(new File(sRoot));
}

@Override
Expand Down Expand Up @@ -165,19 +171,20 @@ private void fill(File[] files) {
getResources().getDrawable(R.drawable.navigation_previous_item)));
}
Drawable currentIcon = null;
for (File currentFile : files){
if (currentFile.canRead() /*&& (_mode == MODE_IMPORT || _mode == MODE_EXPORT && currentFile.canWrite())*/){
if (currentFile.isDirectory()) {
currentIcon = getResources().getDrawable(R.drawable.collections_collection);
this.directoryEntries.add(new IconifiedText(currentFile.getPath(), currentIcon));
}else {
String fileName = currentFile.getName();

if(fileNameFilterByMode(fileName))
{
currentIcon = getResources().getDrawable(R.drawable.navigation_next_item);
if(files != null) {
for (File currentFile : files) {
if (currentFile.canRead() /*&& (_mode == MODE_IMPORT || _mode == MODE_EXPORT && currentFile.canWrite())*/) {
if (currentFile.isDirectory()) {
currentIcon = getResources().getDrawable(R.drawable.collections_collection);
this.directoryEntries.add(new IconifiedText(currentFile.getPath(), currentIcon));
}
} else {
String fileName = currentFile.getName();

if (fileNameFilterByMode(fileName)) {
currentIcon = getResources().getDrawable(R.drawable.navigation_next_item);
this.directoryEntries.add(new IconifiedText(currentFile.getPath(), currentIcon));
}
}
}
}
}
Expand Down
24 changes: 24 additions & 0 deletions app/src/main/java/jwtc/android/chess/tools/pgntool.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,19 @@
import jwtc.chess.PGNColumns;
import jwtc.chess.algorithm.UCIWrapper;

import android.Manifest;
import android.app.AlertDialog;
import android.app.ListActivity;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.util.Log;
import android.view.*;
import android.widget.AdapterView;
Expand All @@ -42,6 +47,7 @@ public class pgntool extends ListActivity {
protected static final String MODE_IMPORT_PRACTICE = "import_practice";
protected static final String MODE_IMPORT_PUZZLE = "import_puzzle";
protected static final String MODE_IMPORT_OPENINGDATABASE = "import_openingdatabase";
protected static final int MY_PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE = 1;

protected static final String EXTRA_MODE = "jwtc.android.chess.tools.Mode";

Expand Down Expand Up @@ -70,6 +76,11 @@ public void onCreate(Bundle savedInstanceState) {

@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {

if(false == pgntool.this.hasPermission()) {
return;
}

if (arrString[arg2].equals(getString(R.string.pgntool_export_explanation))) {
doExport();

Expand Down Expand Up @@ -271,6 +282,19 @@ public boolean onOptionsItemSelected(MenuItem item) {
return super.onOptionsItemSelected(item);
}

public boolean hasPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
return true;
} else {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, MY_PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE);
return false;
}
} else {
return true;
}
}

public void doExport() {
try {
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout-land/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:background="@color/bgColorText" android:gravity="center" android:id="@+id/LayoutMain"
android:gravity="center" android:id="@+id/LayoutMain"
>

<RelativeLayout android:id="@+id/LayoutBoard"
Expand Down Expand Up @@ -222,7 +222,7 @@
android:layout_marginTop="2dp"
>
<TextView android:id="@+id/TextViewAnnotate"
android:background="@android:drawable/editbox_background_normal" android:textColor="#000000"
android:background="@android:drawable/editbox_background_normal"
android:padding="8dp"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:minHeight="80dp"
Expand Down
8 changes: 2 additions & 6 deletions app/src/main/res/layout-large-land/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:background="@color/bgColorText" android:gravity="center" android:id="@+id/LayoutMain"
android:gravity="center" android:id="@+id/LayoutMain"
>

<RelativeLayout android:id="@+id/LayoutBoard"
Expand All @@ -14,7 +14,6 @@
layout="@layout/board"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:id="@+id/includeboard" />

<!--
<TextView android:layout_width="@dimen/boardSize" android:layout_height="@dimen/boardSize"
android:id="@+id/includeboard"
Expand Down Expand Up @@ -94,8 +93,7 @@
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background_normal"
android:minHeight="40dp"
android:padding="8dp"
android:textColor="#000000" />
android:padding="8dp" />

</ScrollView>

Expand Down Expand Up @@ -135,8 +133,6 @@

</LinearLayout>



<RelativeLayout android:id="@+id/LayoutRight"
android:layout_width="wrap_content" android:layout_height="fill_parent"
android:padding="4dip"
Expand Down
11 changes: 4 additions & 7 deletions app/src/main/res/layout/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:background="@color/bgColorText" android:id="@+id/LayoutMain"
android:id="@+id/LayoutMain"
>

<TableLayout android:id="@+id/LayoutTopTitle"
android:layout_width="fill_parent" android:layout_height="wrap_content"
>
Expand Down Expand Up @@ -33,7 +32,6 @@
android:text="Title..."
/>
</TableRow>

</TableLayout>

<include
Expand Down Expand Up @@ -209,7 +207,7 @@

<HorizontalScrollView android:id="@+id/HScrollViewHistory"
android:layout_width="fill_parent" android:layout_height="40dip"
android:background="@color/bgColorLight" android:textColor="@color/textColor"
android:background="@color/bgColorMiddle" android:textColor="@color/textColor"
android:padding="2dip"
>
<RelativeLayout android:id="@+id/LayoutHistory"
Expand All @@ -221,14 +219,13 @@
<ScrollView android:layout_width="fill_parent" android:layout_height="wrap_content"
android:fadingEdge="none" android:padding="2dip"
>
<TextView android:id="@+id/TextViewAnnotate"
android:background="@android:drawable/editbox_background_normal" android:textColor="#000000"
<TextView android:id="@+id/TextViewAnnotate"
android:background="@color/bgColorLight" android:textColor="@color/textColorInverse"
android:padding="8dip"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:minHeight="50dip"/>
</ScrollView>


<TableLayout android:layout_width="fill_parent" android:layout_height="wrap_content"
android:padding="2dip" android:stretchColumns="2"
>
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
<string name="start_convergence">Pantalla TV</string>

<string name="globalpreferences">Configuración global</string>
<string name="puzzlepreferences">Configuración rompecabezas</string>
<string name="playpreferences">Configuración jugar</string>
<string name="playonlinepreferences">Configuración línea jugar</string>
<string name="preferences">Configuración</string>
<string name="pref_wakelock">Utilice bloqueo modo reposo</string>
<string name="pref_wakelock_desc">Esto evitará que el teléfono se ponga en modo reposo</string>
Expand Down Expand Up @@ -219,6 +222,13 @@
<string name="choice_edit">Editare</string>
<string name="choice_delete">Eliminar</string>

<string name="puzzle_error_install">Se produjo un error durante la instalación</string>
<string name="puzzle_already_solved">(Posición ya resuelto)</string>
<string name="puzzle_not_correct_move"> no es el movimiento esperado</string>
<string name="puzzle_invalid_move"> es un movimiento no válido</string>
<string name="puzzle_all_completed">Has completado todos los puzzles!!!</string>
<string name="puzzle_pick_promotion">Escoja piece la promoción</string>

<string name="color_picker_brightness">Brillo</string>
<string name="color_picker_light">claro</string>
<string name="color_picker_dark">oscuro</string>
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
<string name="start_convergence">Schermo TV</string>

<string name="globalpreferences">Preferenze globali</string>
<string name="puzzlepreferences">Preferenze Puzzle</string>
<string name="playpreferences">Preferenze giocare</string>
<string name="playonlinepreferences">Configurazione gioco online</string>
<string name="preferences">Preferenze</string>
<string name="pref_wakelock">Usa blocco sospensione</string>
<string name="pref_wakelock_desc">Impedisce al telefono di andare in sospensione</string>
Expand Down Expand Up @@ -219,6 +222,13 @@
<string name="choice_edit">Modifica</string>
<string name="choice_delete">Cancella</string>

<string name="puzzle_error_install">Verificato un errore durante l\'installazione</string>
<string name="puzzle_already_solved">(Posizione già risolto)</string>
<string name="puzzle_not_correct_move"> non è prevista la mossa</string>
<string name="puzzle_invalid_move"> è una mossa non valida</string>
<string name="puzzle_all_completed">Hai completato tutti i puzzle!!!</string>
<string name="puzzle_pick_promotion">Scegli piece Promozione</string>

<string name="color_picker_brightness">Luminosità</string>
<string name="color_picker_light">chiaro</string>
<string name="color_picker_dark">scuro</string>
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/res/values-pt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
<string name="start_convergence">Tela da TV</string>

<string name="globalpreferences">Configuração global</string>
<string name="puzzlepreferences">Configuração enigma</string>
<string name="playpreferences">Configuração jogar</string>
<string name="playonlinepreferences">Configuração jogar online</string>
<string name="preferences">Configuração</string>
<string name="pref_wakelock">Use wake lock</string>
<string name="pref_wakelock_desc">Isso impedirá que o seu teléfono fique em modo repouso</string>
Expand Down Expand Up @@ -219,6 +222,13 @@
<string name="choice_edit">Editar</string>
<string name="choice_delete">Remover</string>

<string name="puzzle_error_install">Ocorreu um erro durante a instalação</string>
<string name="puzzle_already_solved">(Posição já resolvido)</string>
<string name="puzzle_not_correct_move"> não é o movimento esperado</string>
<string name="puzzle_invalid_move"> é um movimento inválido</string>
<string name="puzzle_all_completed">Você completou todos os enigmas!!!</string>
<string name="puzzle_pick_promotion">Escolha pedaço promoção</string>

<string name="color_picker_brightness">Brilho</string>
<string name="color_picker_light">clara</string>
<string name="color_picker_dark">escura</string>
Expand Down
Loading

0 comments on commit 92a4f45

Please sign in to comment.