Skip to content

Commit 020b1be

Browse files
committedSep 18, 2019
Add support for AppCompat theme
1 parent 91131e7 commit 020b1be

File tree

11 files changed

+304
-89
lines changed

11 files changed

+304
-89
lines changed
 

‎.idea/codeStyles/Project.xml

+116
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.idea/saveactions_settings.xml

+16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎gradle.properties

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## For more details on how to configure your build environment visit
2+
# http://www.gradle.org/docs/current/userguide/build_environment.html
3+
#
4+
# Specifies the JVM arguments used for the daemon process.
5+
# The setting is particularly useful for tweaking memory settings.
6+
# Default value: -Xmx1024m -XX:MaxPermSize=256m
7+
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
8+
#
9+
# When configured, Gradle will run in incubating parallel mode.
10+
# This option should only be used with decoupled projects. More details, visit
11+
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
12+
# org.gradle.parallel=true
13+
#Thu Aug 22 19:41:12 CEST 2019
14+
org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx1024M"

‎scidOnTheGo/src/main/AndroidManifest.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
android:icon="@drawable/icon"
2626
android:label="@string/app_name"
2727
android:name=".ScidApplication"
28-
android:theme="@style/Theme.AppCompat.Light">
28+
android:theme="@style/AppTheme">
2929
<activity
3030
android:configChanges="orientation"
3131
android:label="@string/app_name"

‎scidOnTheGo/src/main/java/org/scid/android/ColorTheme.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
package org.scid.android;
22

3+
import android.content.Context;
34
import android.content.SharedPreferences;
45
import android.content.SharedPreferences.Editor;
56
import android.graphics.Color;
7+
import android.support.v4.content.ContextCompat;
68

79
class ColorTheme {
810
private static ColorTheme inst = null;
@@ -51,7 +53,7 @@ static ColorTheme instance() {
5153
"#FFFFFFFF", "#FFAFC4D4", "#A01F1FFF", "#A0FF1F1F",
5254
"#501F1FFF", "#50FF1F1F", "#1E1F1FFF", "#28FF1F1F"}};
5355

54-
final void readColors(SharedPreferences preferences) {
56+
final void readColors(Context context, SharedPreferences preferences) {
5557
for (int i = 0; i < numColors; i++) {
5658
String prefName = prefPrefix + prefNames[i];
5759
String defaultColor = themeColors[0][i];
@@ -61,16 +63,17 @@ final void readColors(SharedPreferences preferences) {
6163
} catch (IllegalArgumentException e) {
6264
colorTable[i] = 0;
6365
}
66+
colorTable[CURRENT_MOVE] = ContextCompat.getColor(context, R.color.accent);
6467
}
6568
}
6669

67-
final void setTheme(SharedPreferences preferences, int themeType) {
70+
final void setTheme(Context context, SharedPreferences preferences, int themeType) {
6871
Editor editor = preferences.edit();
6972
for (int i = 0; i < numColors; i++)
7073
editor.putString(prefPrefix + prefNames[i],
7174
themeColors[themeType][i]);
7275
editor.commit();
73-
readColors(preferences);
76+
readColors(context, preferences);
7477
}
7578

7679
final int getColor(int colorType) {

‎scidOnTheGo/src/main/java/org/scid/android/ScidAndroidActivity.java

+11-11
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public void onRequestPermissionsResult(int requestCode, String[] permissions, in
170170
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
171171
initAfterPermissionSuccess();
172172
} else {
173-
final AlertDialog d = new AlertDialog.Builder(this)
173+
AlertDialog d = new AlertDialog.Builder(this)
174174
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
175175
@Override
176176
public void onClick(DialogInterface dialog, int which) {
@@ -900,7 +900,7 @@ private void readPrefs() {
900900
pgnOptions.exp.playerAction = false;
901901
pgnOptions.exp.clockInfo = false;
902902

903-
ColorTheme.instance().readColors(preferences);
903+
ColorTheme.instance().readColors(this, preferences);
904904
cb.setColors();
905905

906906
String engineName = preferences.getString(ANALYSIS_ENGINE, engineManager
@@ -1281,7 +1281,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
12811281
case RESULT_PREFERENCES:
12821282
readPrefs();
12831283
String theme = preferences.getString("colorTheme", "0");
1284-
ColorTheme.instance().setTheme(preferences, Integer.parseInt(theme));
1284+
ColorTheme.instance().setTheme(this, preferences, Integer.parseInt(theme));
12851285
cb.setColors();
12861286
setGameMode();
12871287
break;
@@ -1429,7 +1429,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
14291429
ANALYSIS_ENGINE, null);
14301430
if (analysisEngine != null
14311431
&& analysisEngine.equals(_engineName)) {
1432-
final EngineManager.EngineChangeListener _listener = new EngineManager.EngineChangeListener() {
1432+
EngineManager.EngineChangeListener _listener = new EngineManager.EngineChangeListener() {
14331433

14341434
@Override
14351435
public void engineChanged(EngineChangeEvent event) {
@@ -1534,7 +1534,7 @@ private void loadScidFile(String fileName) {
15341534
private void addNewEngine(final String engineName, String executable,
15351535
final String enginePackage, final int engineVersion, boolean makeCurrentEngine, boolean copied) {
15361536
if (makeCurrentEngine) {
1537-
final EngineManager.EngineChangeListener _listener = new EngineManager.EngineChangeListener() {
1537+
EngineManager.EngineChangeListener _listener = new EngineManager.EngineChangeListener() {
15381538

15391539
@Override
15401540
public void engineChanged(EngineChangeEvent event) {
@@ -1578,7 +1578,7 @@ public void setFromSelection(int sq) {
15781578
}
15791579

15801580
@Override
1581-
public void setStatusString(final String str) {
1581+
public void setStatusString(String str) {
15821582
String prefix = "";
15831583
if (getScidAppContext().isDeleted()) {
15841584
prefix = "<font color='red'><b>DELETED</b></font> ";
@@ -1766,7 +1766,7 @@ private void showAboutDialog() {
17661766
}
17671767

17681768
private AlertDialog createCreateDatabaseDialog() {
1769-
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
1769+
AlertDialog.Builder builder = new AlertDialog.Builder(this);
17701770
final EditText input = new EditText(this);
17711771
builder.setTitle(getText(R.string.create_db_title));
17721772
builder.setMessage(getText(R.string.create_db_message));
@@ -1804,8 +1804,8 @@ private AlertDialog createSearchDialog() {
18041804
final int SEARCH_CURRENT_BOARD = 1;
18051805
final int SEARCH_HEADER = 2;
18061806
final int SHOW_FAVORITES = 3;
1807-
List<CharSequence> lst = new ArrayList<CharSequence>();
1808-
List<Integer> actions = new ArrayList<Integer>();
1807+
List<CharSequence> lst = new ArrayList<>();
1808+
List<Integer> actions = new ArrayList<>();
18091809
lst.add(getString(R.string.reset_filter));
18101810
actions.add(RESET_FILTER);
18111811
lst.add(getString(R.string.search_current_board));
@@ -2088,7 +2088,7 @@ private void saveCurrentGameId() {
20882088
}
20892089

20902090
private void resetFilter() {
2091-
final String fileName = getScidAppContext().getCurrentFileName();
2091+
String fileName = getScidAppContext().getCurrentFileName();
20922092
if (fileName.length() != 0) {
20932093
DataBaseView dbv = setDataBaseViewFromFile();
20942094
if (dbv != null) {
@@ -2144,7 +2144,7 @@ private DataBaseView setDataBaseViewFromFile() {
21442144
* if set to false only reset the dbv if the file name changes or the current dbv is null
21452145
*/
21462146
private DataBaseView setDataBaseViewFromFile(boolean alwaysResetDbView) {
2147-
final String currentScidFile = preferences.getString("currentScidFile", "");
2147+
String currentScidFile = preferences.getString("currentScidFile", "");
21482148
if (currentScidFile.length() == 0) {
21492149
return null;
21502150
}

‎scidOnTheGo/src/main/res/layout-land/main.xml

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
android:includeFontPadding="true"
1919
android:typeface="monospace"
2020
android:textStyle="bold"
21-
android:textSize="18dip" />
21+
android:textSize="18dip"
22+
android:textColor="?attr/colorAccent"/>
2223
<ScrollView
2324
android:id="@+id/moveListScrollView"
2425
android:layout_width="fill_parent"
@@ -31,7 +32,8 @@
3132
android:layout_height="wrap_content"
3233
android:includeFontPadding="true"
3334
android:typeface="monospace"
34-
android:textSize="10dip" />
35+
android:textSize="10dip"
36+
android:textColor="?android:attr/textColorPrimary"/>
3537
</ScrollView>
3638
</LinearLayout>
3739
<view

0 commit comments

Comments
 (0)
Failed to load comments.