@@ -455,8 +455,8 @@ private void flipBoardForPlayerNames(String white, String black) {
455
455
this .lastWhitePlayerName = white ;
456
456
this .lastBlackPlayerName = black ;
457
457
String [] names = myPlayerNames .split ("\\ n" );
458
- for (int i = 0 ; i < names . length ; i ++ ) {
459
- String playerName = names [ i ] .trim ();
458
+ for (String name : names ) {
459
+ String playerName = name .trim ();
460
460
if (playerName .length () > 0 ) {
461
461
if (white .equalsIgnoreCase (playerName )) {
462
462
setFlipped (false );
@@ -510,7 +510,7 @@ public void onFlipBoardClick(View view) {
510
510
setFlipped (!cb .flipped );
511
511
}
512
512
513
- private final byte [] strToByteArr (String str ) {
513
+ private byte [] strToByteArr (String str ) {
514
514
int nBytes = str .length () / 2 ;
515
515
byte [] ret = new byte [nBytes ];
516
516
for (int i = 0 ; i < nBytes ; i ++) {
@@ -521,11 +521,11 @@ private final byte[] strToByteArr(String str) {
521
521
return ret ;
522
522
}
523
523
524
- private final String byteArrToString (byte [] data ) {
524
+ private String byteArrToString (byte [] data ) {
525
525
StringBuilder ret = new StringBuilder (32768 );
526
526
int nBytes = data .length ;
527
- for (int i = 0 ; i < nBytes ; i ++ ) {
528
- int b = data [ i ] ;
527
+ for (int datum : data ) {
528
+ int b = datum ;
529
529
if (b < 0 ) {
530
530
b += 256 ;
531
531
}
@@ -560,7 +560,7 @@ public void onConfigurationChanged(Configuration newConfig) {
560
560
setFavoriteRating ();
561
561
}
562
562
563
- private final void initUI (boolean initTitle ) {
563
+ private void initUI (boolean initTitle ) {
564
564
if (initTitle ) {
565
565
requestWindowFeature (Window .FEATURE_CUSTOM_TITLE );
566
566
}
@@ -681,7 +681,7 @@ public boolean onDoubleTapEvent(MotionEvent e) {
681
681
return true ;
682
682
}
683
683
684
- private final void handleClick (MotionEvent e ) {
684
+ private void handleClick (MotionEvent e ) {
685
685
int sq = cb .eventToSquare (e );
686
686
Move m = cb .mousePressed (sq );
687
687
makeHumanMove (m );
@@ -884,7 +884,7 @@ protected void onDestroy() {
884
884
super .onDestroy ();
885
885
}
886
886
887
- private final void readPrefs () {
887
+ private void readPrefs () {
888
888
this .myPlayerNames = preferences .getString ("playerNames" , "" );
889
889
setFlipped (preferences .getBoolean ("boardFlipped" , false ));
890
890
studyOrientation = Integer .parseInt (preferences .getString ("studyOrientation" , "0" ));
@@ -939,7 +939,7 @@ private final void readPrefs() {
939
939
ctrl .prefsChanged ();
940
940
}
941
941
942
- private final void setFullScreenMode (boolean fullScreenMode ) {
942
+ private void setFullScreenMode (boolean fullScreenMode ) {
943
943
WindowManager .LayoutParams attrs = getWindow ().getAttributes ();
944
944
if (fullScreenMode ) {
945
945
attrs .flags |= WindowManager .LayoutParams .FLAG_FULLSCREEN ;
@@ -973,7 +973,7 @@ public boolean onCreateOptionsMenu(Menu menu) {
973
973
static private final int RESULT_PGN_FILE_IMPORT = 11 ;
974
974
static private final int RESULT_GET_FEN = 12 ;
975
975
static private final int RESULT_EXPORT_PGN = 13 ;
976
-
976
+ static private final int RESULT_PERMISSION_REQUEST = 14 ;
977
977
@ Override
978
978
public boolean onOptionsItemSelected (MenuItem item ) {
979
979
switch (item .getItemId ()) {
@@ -1217,7 +1217,7 @@ private boolean currentGameIsValid() {
1217
1217
&& getScidAppContext ().getNoGames () > 0 ;
1218
1218
}
1219
1219
1220
- private final void getFen () {
1220
+ private void getFen () {
1221
1221
Intent i = new Intent (Intent .ACTION_GET_CONTENT );
1222
1222
i .setType ("application/x-chess-fen" );
1223
1223
try {
@@ -1586,7 +1586,7 @@ public void engineChanged(EngineChangeEvent event) {
1586
1586
engineManager .addEngine (engineName , executable , enginePackage , engineVersion );
1587
1587
}
1588
1588
1589
- private final void setFlipped (boolean flipped ) {
1589
+ private void setFlipped (boolean flipped ) {
1590
1590
if (flipped != cb .flipped ){
1591
1591
cb .setFlipped (flipped );
1592
1592
ImageButton flip_button = (ImageButton )findViewById (R .id .flip_board );
@@ -1680,7 +1680,7 @@ public void setThinkingInfo(String pvStr, String bookInfo,
1680
1680
updateThinkingInfo ();
1681
1681
}
1682
1682
1683
- private final void updateThinkingInfo () {
1683
+ private void updateThinkingInfo () {
1684
1684
boolean thinkingEmpty = true ;
1685
1685
{
1686
1686
String s = "" ;
@@ -1782,8 +1782,7 @@ public void onClick(DialogInterface dialog, int whichButton) {
1782
1782
}
1783
1783
});
1784
1784
builder .setNegativeButton (android .R .string .cancel , null );
1785
- AlertDialog alert = builder .create ();
1786
- return alert ;
1785
+ return builder .create ();
1787
1786
}
1788
1787
1789
1788
private void showAboutDialog () {
@@ -1818,8 +1817,7 @@ public void onClick(DialogInterface dialog, int whichButton) {
1818
1817
dialog .cancel ();
1819
1818
}
1820
1819
});
1821
- AlertDialog alert = builder .create ();
1822
- return alert ;
1820
+ return builder .create ();
1823
1821
}
1824
1822
1825
1823
private boolean hasNoDataBaseViewOpened () {
@@ -1882,8 +1880,7 @@ public void onClick(DialogInterface dialog, int item) {
1882
1880
}
1883
1881
}
1884
1882
});
1885
- AlertDialog alert = builder .create ();
1886
- return alert ;
1883
+ return builder .create ();
1887
1884
}
1888
1885
1889
1886
private AlertDialog createClipboardDialog () {
@@ -1975,8 +1972,7 @@ public void onClick(DialogInterface dialog, int item) {
1975
1972
}
1976
1973
}
1977
1974
});
1978
- AlertDialog alert = builder .create ();
1979
- return alert ;
1975
+ return builder .create ();
1980
1976
}
1981
1977
1982
1978
private AlertDialog createImportDialog () {
@@ -2006,8 +2002,7 @@ public void onClick(DialogInterface dialog, int item) {
2006
2002
}
2007
2003
}
2008
2004
});
2009
- AlertDialog alert = builder .create ();
2010
- return alert ;
2005
+ return builder .create ();
2011
2006
}
2012
2007
2013
2008
private void editBoard (String fen ) {
0 commit comments