Add dark- and light-mode themes for board

Allow user to choose a new dark-mode color scheme for the board, with
colors editable same as the old mode. Support exporting a URL
encapsulating those colors to clipboard and importing from the URL
when it's tapped e.g. in email.
This commit is contained in:
Eric House 2021-08-09 08:42:35 -07:00
parent 1776638467
commit bfd7963ea6
22 changed files with 508 additions and 106 deletions

2
.gitignore vendored
View file

@ -15,3 +15,5 @@ nohup.out
/xwords4/android/obj-debug-xw4d
/xwords4/android/app/build
/xwords4/android/app/src/main/java/org/eehouse/android/xw4/loc/LocIDsData.java
/xwords4/android/app/src/main/java/org/eehouse/android/xw4/gen/*
/xwords4/dawg/*/*.bin*

View file

@ -102,6 +102,7 @@ android {
buildConfigField "String", "BUILD_INFO_NAME", "\"${BUILD_INFO_NAME}\""
buildConfigField "boolean", "IS_TAGGED_BUILD", "${CURTAG}" == '' ? "false" : "true"
resValue "string", "invite_prefix", "/and/"
resValue "string", "conf_prefix", "/cnf/"
resValue "string", "newgame_scheme", "newxwgame"
buildConfigField "boolean", "UDP_ENABLED", "true"
buildConfigField "boolean", "REPORT_LOCKS", "false"
@ -155,6 +156,7 @@ android {
resValue "string", "app_name", "CrossDbg"
resValue "string", "nbs_port", "3345"
resValue "string", "invite_prefix", "/andd/"
resValue "string", "conf_prefix", "/cnfd/"
resValue "string", "newgame_scheme", "newxwgamed"
buildConfigField "boolean", "WIDIR_ENABLED", "true"
buildConfigField "String", "VARIANT_NAME", "\"Dev/Debug\""
@ -175,6 +177,7 @@ android {
resValue "string", "app_name", "CrossDbg"
resValue "string", "nbs_port", "3345"
resValue "string", "invite_prefix", "/andd/"
resValue "string", "conf_prefix", "/cnfd/"
resValue "string", "newgame_scheme", "newxwgamed"
buildConfigField "boolean", "WIDIR_ENABLED", "true"
buildConfigField "String", "VARIANT_NAME", "\"Dev/Debug GPlay\""

View file

@ -83,6 +83,10 @@
android:host="@string/invite_host"
android:pathPrefix="@string/invite_prefix"
/>
<data android:scheme="http"
android:host="@string/invite_host"
android:pathPrefix="@string/conf_prefix"
/>
</intent-filter>
<intent-filter>

View file

@ -1,6 +1,6 @@
/* -*- compile-command: "find-and-gradle.sh inXw4dDeb"; -*- */
/*
* Copyright 2009 - 2019 by Eric House (xwords@eehouse.org). All rights
* Copyright 2009 - 2021 by Eric House (xwords@eehouse.org). All rights
* reserved.
*
* This program is free software; you can redistribute it and/or

View file

@ -54,6 +54,7 @@ public class DlgDelegate {
CLEAR_LOG_DB,
QUARANTINE_CLEAR,
QUARANTINE_DELETE,
APPLY_CONFIG,
// BoardDelegate
UNDO_LAST_ACTION,
@ -129,6 +130,7 @@ public class DlgDelegate {
PERMS_QUERY,
PERMS_BANNED_INFO,
SHOW_FAQ,
EXPORT_THEME,
} // Action enum
public static class ActionPair implements Serializable {

View file

@ -1562,6 +1562,11 @@ public class GamesListDelegate extends ListDelegateBase
}
break;
case APPLY_CONFIG:
Uri data = Uri.parse( (String)params[0] );
CommonPrefs.loadColorPrefs( m_activity, data );
break;
default:
handled = super.onPosButton( action, params );
}
@ -2471,6 +2476,28 @@ public class GamesListDelegate extends ListDelegateBase
return handled;
} // startNewNetGame
private boolean loadConfig( Intent intent )
{
boolean success = false;
try {
Uri data = intent.getData();
String path = data.getPath();
String prefix = LocUtils.getString( m_activity, R.string.conf_prefix );
if ( path.startsWith( prefix ) ) {
makeConfirmThenBuilder( R.string.apply_config, Action.APPLY_CONFIG )
.setPosButton( R.string.button_apply_config )
.setNegButton( android.R.string.cancel )
.setParams( data.toString() )
.show();
success = true;
}
} catch ( Exception ex ) {
Log.ex( TAG, ex );
}
return success;
}
private boolean startHasGameID( int gameID )
{
boolean handled = false;
@ -2847,6 +2874,7 @@ public class GamesListDelegate extends ListDelegateBase
boolean handled = startFirstHasDict( intent )
|| startWithInvitee( intent )
|| postWordlistURL( intent )
|| loadConfig( intent )
|| startNewNetGame( intent )
|| startHasGameID( intent )
|| startRematch( intent )

View file

@ -21,21 +21,18 @@
package org.eehouse.android.xw4;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.os.Bundle;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import android.view.MenuItem;
import android.view.View;
import android.widget.PopupMenu;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceManager;
import androidx.preference.PreferenceScreen;
import androidx.preference.PreferenceCategory;
import android.view.View;
import android.widget.Button;
import org.eehouse.android.xw4.DlgDelegate.Action;
import org.eehouse.android.xw4.gen.PrefsWrappers;
@ -48,7 +45,7 @@ import java.util.Map;
public class PrefsDelegate extends DelegateBase
implements SharedPreferences.OnSharedPreferenceChangeListener,
View.OnClickListener {
View.OnClickListener, PopupMenu.OnMenuItemClickListener {
private static final String TAG = PrefsDelegate.class.getSimpleName();
private XWActivity mActivity;
@ -76,12 +73,12 @@ public class PrefsDelegate extends DelegateBase
public PrefsDelegate( XWActivity activity, Delegator delegator,
Bundle savedInstanceState )
{
super( delegator, savedInstanceState, R.layout.prefs_w_buttons );
super( delegator, savedInstanceState, R.layout.prefs );
mActivity = activity;
}
@Override
protected Dialog makeDialog( DBAlert alert, Object[] params )
protected Dialog makeDialog( final DBAlert alert, Object[] params )
{
final DlgID dlgID = alert.getDlgID();
DialogInterface.OnClickListener lstnr = null;
@ -94,26 +91,17 @@ public class PrefsDelegate extends DelegateBase
@Override
public void onClick( DialogInterface dlg, int item ) {
PrefsDelegate self = (PrefsDelegate)curThis();
SharedPreferences sp = self.getSharedPreferences();
SharedPreferences.Editor editor = sp.edit();
int[] colorKeys = {
R.string.key_player0,
R.string.key_player1,
R.string.key_player2,
R.string.key_player3,
R.string.key_bonus_l2x,
R.string.key_bonus_l3x,
R.string.key_bonus_w2x,
R.string.key_bonus_w3x,
R.string.key_tile_back,
R.string.key_clr_crosshairs,
R.string.key_empty,
R.string.key_background,
R.string.key_clr_bonushint,
R.string.key_cellline,
Resources res = alert.getContext().getResources();
SharedPreferences.Editor editor =
self.getSharedPreferences().edit();
int[] themeKeys = { R.array.color_ids_light,
R.array.color_ids_dark,
};
for ( int colorKey : colorKeys ) {
editor.remove( getString(colorKey) );
for ( int themeKey : themeKeys ) {
String[] colorKeys = res.getStringArray( themeKey );
for ( String colorKey : colorKeys ) {
editor.remove( colorKey );
}
}
editor.commit();
self.relaunch();
@ -174,8 +162,7 @@ public class PrefsDelegate extends DelegateBase
getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
// It's too early somehow to do this in init() above
findViewById( R.id.revert_colors ).setOnClickListener(this);
findViewById( R.id.revert_all ).setOnClickListener(this);
findViewById( R.id.prefs_menu ).setOnClickListener(this);
}
@Override
@ -192,11 +179,11 @@ public class PrefsDelegate extends DelegateBase
DlgID dlgID = null;
int id = view.getId();
switch ( id ) {
case R.id.revert_all:
dlgID = DlgID.REVERT_ALL;
break;
case R.id.revert_colors:
dlgID = DlgID.REVERT_COLORS;
case R.id.prefs_menu:
PopupMenu popup = new PopupMenu( mActivity, view );
popup.inflate( R.menu.prefs_popup );
popup.setOnMenuItemClickListener( this );
popup.show();
break;
default:
Assert.failDbg();
@ -207,6 +194,44 @@ public class PrefsDelegate extends DelegateBase
}
}
@Override
public boolean onMenuItemClick( MenuItem item )
{
boolean handled = true;
Log.d( TAG, "item: %s", item );
DlgID dlgID = null;
CommonPrefs.ColorTheme theme = null;
switch ( item.getItemId() ) {
case R.id.prefs_revert_colors:
dlgID = DlgID.REVERT_COLORS;
break;
case R.id.prefs_revert_all:
dlgID = DlgID.REVERT_ALL;
break;
case R.id.prefs_copy_light:
theme = CommonPrefs.ColorTheme.LIGHT;
break;
case R.id.prefs_copy_dark:
theme = CommonPrefs.ColorTheme.DARK;
break;
default:
Assert.failDbg();
handled = false;
}
if ( null != dlgID ) {
showDialogFragment( dlgID );
} else if ( null != theme ) {
makeNotAgainBuilder( R.string.not_again_copytheme,
R.string.key_na_copytheme,
Action.EXPORT_THEME )
.setParams( theme )
.show();
}
return handled;
}
// interface SharedPreferences.OnSharedPreferenceChangeListener
@Override
public void onSharedPreferenceChanged( SharedPreferences sp, String key )
@ -296,6 +321,11 @@ public class PrefsDelegate extends DelegateBase
BTUtils.setEnabled( mActivity, false );
BTCheckBoxPreference.setChecked();
break;
case EXPORT_THEME:
CommonPrefs.ColorTheme theme = (CommonPrefs.ColorTheme)params[0];
CommonPrefs.colorPrefsToClip( mActivity, theme );
DbgUtils.showf( mActivity, R.string.theme_data_success );
break;
default:
handled = super.onPosButton( action, params );
}

View file

@ -241,7 +241,7 @@ public class Utils {
}
}
static void stringToClip( Context context, String str )
public static void stringToClip( Context context, String str )
{
ClipboardManager clipboard = (ClipboardManager)
context.getSystemService(Context.CLIPBOARD_SERVICE);

View file

@ -22,13 +22,18 @@ package org.eehouse.android.xw4.jni;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Build;
import android.preference.PreferenceManager;
import org.eehouse.android.xw4.Assert;
import org.eehouse.android.xw4.DictUtils;
import org.eehouse.android.xw4.Log;
import org.eehouse.android.xw4.NetUtils;
import org.eehouse.android.xw4.R;
import org.eehouse.android.xw4.Utils;
import org.eehouse.android.xw4.XWPrefs;
import org.eehouse.android.xw4.loc.LocUtils;
@ -100,39 +105,47 @@ public class CommonPrefs extends XWPrefs {
int ord = getInt(context, sp, R.string.key_tile_valuetype, 0);
tvType = TileValueType.values()[ord];
int ids[] = { R.string.key_player0,
R.string.key_player1,
R.string.key_player2,
R.string.key_player3,
};
for ( int ii = 0; ii < ids.length; ++ii ) {
playerColors[ii] = prefToColor( context, sp, ids[ii] );
Resources res = context.getResources();
int strsID = R.array.color_ids_light;
String which = LocUtils.getString( context, R.string.key_theme_which );
which = sp.getString( which, null );
if ( null == which ) {
// do nothing
} else if ( which.equals( LocUtils.getString( context,
R.string.color_use_theme_light ) ) ) {
// do nothing
} else if ( which.equals( LocUtils.getString( context,
R.string.color_use_theme_dark ) ) ) {
strsID = R.array.color_ids_dark;
} else {
int uiMode = res.getConfiguration().uiMode;
if ( Configuration.UI_MODE_NIGHT_YES
== (uiMode & Configuration.UI_MODE_NIGHT_MASK) ) {
strsID = R.array.color_ids_dark;
}
int ids2[] = { R.string.key_bonus_l2x,
R.string.key_bonus_w2x,
R.string.key_bonus_l3x,
R.string.key_bonus_w3x,
};
for ( int ii = 0; ii < ids2.length; ++ii ) {
bonusColors[ii+1] = prefToColor( context, sp, ids2[ii] );
}
String[] colorStrIds = res.getStringArray( strsID );
int idsOther[] = { R.string.key_tile_back,
R.string.key_empty,
R.string.key_clr_crosshairs,
R.string.key_background,
R.string.key_clr_bonushint,
R.string.key_cellline,
};
for ( int ii = 0; ii < idsOther.length; ++ii ) {
otherColors[ii] = prefToColor( context, sp, idsOther[ii] );
}
int offset = copyColors( sp, colorStrIds, 0, playerColors, 0 );
offset += copyColors( sp, colorStrIds, offset, bonusColors, 1 );
offset += copyColors( sp, colorStrIds, offset, otherColors, 0 );
return this;
}
private int copyColors( SharedPreferences sp, String[] colorStrIds,
int idsStart, int[] colors, int colorsStart )
{
int nUsed = 0;
while ( colorsStart < colors.length ) {
String key = colorStrIds[idsStart + nUsed++];
int color = 0xFF000000 | sp.getInt( key, 0 );
colors[colorsStart++] = color;
}
return nUsed;
}
private boolean getBoolean( Context context, SharedPreferences sp,
int id, boolean dflt )
{
@ -147,12 +160,6 @@ public class CommonPrefs extends XWPrefs {
return sp.getInt( key, dflt );
}
private int prefToColor( Context context, SharedPreferences sp, int id )
{
String key = LocUtils.getString( context, id );
return 0xFF000000 | sp.getInt( key, 0 );
}
/*
* static methods
*/
@ -303,4 +310,74 @@ public class CommonPrefs extends XWPrefs {
return getPrefsString( context, R.string.key_summary_field );
}
public enum ColorTheme {
LIGHT(R.array.color_ids_light),
DARK(R.array.color_ids_dark);
private int mArrayID;
private ColorTheme(int arrayID) {
mArrayID = arrayID;
}
int getArrayID() { return mArrayID; }
};
private static final String THEME_KEY = "theme";
public static void colorPrefsToClip( Context context, ColorTheme theme )
{
String host = LocUtils.getString( context, R.string.invite_host );
Uri.Builder ub = new Uri.Builder()
.scheme( "http" ) // PENDING: should be https soon
.path( String.format( "//%s%s", NetUtils.forceHost( host ),
LocUtils.getString(context, R.string.conf_prefix) ) )
.appendQueryParameter( THEME_KEY, theme.toString() );
Resources res = context.getResources();
String[] urlKeys = res.getStringArray( R.array.color_url_keys );
String[] dataKeys = res.getStringArray( theme.getArrayID() );
Assert.assertTrue( urlKeys.length == dataKeys.length );
SharedPreferences sp = PreferenceManager
.getDefaultSharedPreferences( context );
for ( int ii = 0; ii < urlKeys.length; ++ii ) {
int val = sp.getInt( dataKeys[ii], 0 );
ub.appendQueryParameter( urlKeys[ii], String.format("%X", val ) );
}
String data = ub.build().toString();
Utils.stringToClip( context, data );
}
public static void loadColorPrefs( Context context, Uri uri )
{
String themeName = uri.getQueryParameter( THEME_KEY );
int arrayID = 0;
for ( ColorTheme theme : ColorTheme.values() ) {
if ( theme.toString().equals(themeName) ) {
arrayID = theme.getArrayID();
break;
}
}
Assert.assertTrueNR( 0 != arrayID );
if ( 0 != arrayID ) {
Resources res = context.getResources();
String[] urlKeys = res.getStringArray( R.array.color_url_keys );
String[] dataKeys = res.getStringArray( arrayID );
SharedPreferences sp = PreferenceManager
.getDefaultSharedPreferences( context );
SharedPreferences.Editor editor = sp.edit();
for ( int ii = 0; ii < urlKeys.length; ++ii ) {
String urlKey = urlKeys[ii];
try {
String val = uri.getQueryParameter( urlKey );
editor.putInt( dataKeys[ii], Integer.parseInt( val, 16 ) );
Log.d( TAG, "set %s => %s", dataKeys[ii], val ); // here
} catch ( Exception ex ) {
Log.ex( TAG, ex );
Log.d( TAG, "bad/missing data for url key: %s", urlKey );
}
}
editor.commit();
}
}
}

View file

@ -0,0 +1,10 @@
<vector android:height="18dp"
android:viewportHeight="32"
android:viewportWidth="32"
android:width="18dp"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<path android:fillColor="#FF000000"
android:pathData="M4,10h24c1.104,0 2,-0.896 2,-2s-0.896,-2 -2,-2H4C2.896,6 2,6.896 2,8S2.896,10 4,10zM28,14H4c-1.104,0 -2,0.896 -2,2s0.896,2 2,2h24c1.104,0 2,-0.896 2,-2S29.104,14 28,14zM28,22H4c-1.104,0 -2,0.896 -2,2s0.896,2 2,2h24c1.104,0 2,-0.896 2,-2S29.104,22 28,22z"
/>
</vector>

View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ImageButton android:id="@+id/prefs_menu"
android:src="@drawable/ic_hamburger"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:layout_gravity="right"
/>
<LinearLayout android:id="@+id/main_container"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
/>
</LinearLayout>

View file

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout android:id="@+id/main_container"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
/>
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
>
<Button android:id="@+id/revert_colors"
android:text="@string/button_revert_colors"
style="@style/evenly_spaced_horizontal"
/>
<Button android:id="@+id/revert_all"
android:text="@string/button_revert_all"
style="@style/evenly_spaced_horizontal"
/>
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/prefs_revert_colors"
android:title="@string/button_revert_colors"
/>
<item android:id="@+id/prefs_revert_all"
android:title="@string/button_revert_all"
/>
<item android:id="@+id/prefs_copy_light"
android:title="@string/prefs_copy_light"
/>
<item android:id="@+id/prefs_copy_dark"
android:title="@string/prefs_copy_dark"
/>
</menu>

View file

@ -37,6 +37,22 @@
<string name="key_clr_bonushint">key_clr_bonushint</string>
<string name="key_board_line_width">key_board_line_width</string>
<string name="key_player0_dark">key_clr_player0_dark</string>
<string name="key_player1_dark">key_clr_player1_dark</string>
<string name="key_player2_dark">key_clr_player2_dark</string>
<string name="key_player3_dark">key_clr_player3_dark</string>
<string name="key_bonus_l2x_dark">key_clr_bonus_l2x_dark</string>
<string name="key_bonus_l3x_dark">key_clr_bonus_l3x_dark</string>
<string name="key_bonus_w2x_dark">key_clr_bonus_w2x_dark</string>
<string name="key_bonus_w3x_dark">key_clr_bonus_w3x_dark</string>
<string name="key_tile_back_dark">key_clr_tile_back_dark</string>
<string name="key_empty_dark">key_clr_empty_dark</string>
<string name="key_background_dark">key_clr_background_dark</string>
<string name="key_cellline_dark">key_cellline_dark</string>
<string name="key_clr_crosshairs_dark">key_clr_crosshairs_dark</string>
<string name="key_clr_bonushint_dark">key_clr_bonushint_dark</string>
<string name="key_board_line_width_dark">key_board_line_width_dark</string>
<string name="key_relay_host">key_relay_host</string>
<string name="key_relay_port">key_relay_port2</string>
<string name="key_relay_via_http_first">key_relay_via_http_first</string>
@ -147,6 +163,7 @@
<string name="key_na_rematch_two_only">key_notagain_rematch_two_only</string>
<string name="key_notagain_dfltname">key_notagain_dfltname</string>
<string name="key_notagain_nbsGamesOnUpgrade">key_notagain_nbsGamesOnUpgrade</string>
<string name="key_na_copytheme">key_na_copytheme</string>
<string name="key_na_comms_bt">key_na_comms_bt</string>
<string name="key_na_comms_p2p">key_na_comms_p2p</string>
<string name="key_na_comms_mqtt">key_na_comms_mqtt</string>
@ -164,6 +181,8 @@
<string name="key_na_dupstatus_guest">key_na_dupstatus_guest</string>
<string name="key_na_quicknetgame">key_na_quicknetgame</string>
<string name="key_theme_which">key_theme_which</string>
<!-- Nor is my email address -->
<string name="email_author_email">xwords@eehouse.org</string>
@ -364,4 +383,68 @@
<item>@string/loc_filters_modified</item>
</string-array>
<string-array name="color_themes">
<item>@string/color_use_theme_light</item>
<item>@string/color_use_theme_dark</item>
<item>@string/color_use_theme_os</item>
</string-array>
<!-- Keep in sync with the color_ids_{light,dark} below -->
<string-array name="color_url_keys">
<item>p1</item>
<item>p2</item>
<item>p3</item>
<item>p4</item>
<item>l2</item>
<item>w2</item>
<item>l3</item>
<item>w3</item>
<item>tb</item>
<item>em</item>
<item>xh</item>
<item>bk</item>
<item>bh</item>
<item>cl</item>
</string-array>
<string-array name="color_ids_light">
<item>@string/key_player0</item>
<item>@string/key_player1</item>
<item>@string/key_player2</item>
<item>@string/key_player3</item>
<item>@string/key_bonus_l2x</item>
<item>@string/key_bonus_w2x</item>
<item>@string/key_bonus_l3x</item>
<item>@string/key_bonus_w3x</item>
<item>@string/key_tile_back</item>
<item>@string/key_empty</item>
<item>@string/key_clr_crosshairs</item>
<item>@string/key_background</item>
<item>@string/key_clr_bonushint</item>
<item>@string/key_cellline</item>
</string-array>
<string-array name="color_ids_dark">
<item>@string/key_player0_dark</item>
<item>@string/key_player1_dark</item>
<item>@string/key_player2_dark</item>
<item>@string/key_player3_dark</item>
<item>@string/key_bonus_l2x_dark</item>
<item>@string/key_bonus_w2x_dark</item>
<item>@string/key_bonus_l3x_dark</item>
<item>@string/key_bonus_w3x_dark</item>
<item>@string/key_tile_back_dark</item>
<item>@string/key_empty_dark</item>
<item>@string/key_clr_crosshairs_dark</item>
<item>@string/key_background_dark</item>
<item>@string/key_clr_bonushint_dark</item>
<item>@string/key_cellline_dark</item>
</string-array>
</resources>

View file

@ -2740,4 +2740,36 @@
<string name="values_values">Values only</string>
<string name="values_both">Letters and Values</string>
<!-- For color "themes", currently light and dark
supported. Custom may follow. -->
<string name="prefs_themes">Board color themes</string>
<string name="theme_which">Board color theme</string>
<string name="color_use_theme_light">Use Light theme</string>
<string name="color_use_theme_dark">Use Dark theme</string>
<string name="color_use_theme_os">Use Theme from Android Settings</string>
<string name="color_theme_edit_light">Edit Light theme</string>
<string name="color_theme_edit_dark">Edit Dark theme</string>
<!-- Menus in Prefs for copying color config data to clipboard -->
<string name="prefs_copy_light">Copy Light theme</string>
<string name="prefs_copy_dark">Copy Dark theme</string>
<!-- Hint about what copying theme data does -->
<string name="not_again_copytheme">Copying a theme puts a URL in
your clipboard. The URL encodes your settings for that theme. Send
the URL to another CrossWords user to share your settings: when
they tap on the URL on a device with the latest version of
CrossWords installed theyll be able to import your
settings.</string>
<!-- Posted when copy data completes -->
<string name="theme_data_success">Theme copied to Clipboard</string>
<!-- Confirmation query when you launch with a url containing color config changes -->
<string name="apply_config">Would you like to import theme
settings from the URL you opened? They will replace any local
changes you have made.
\n\nThis action cannot be undone, but you can always restore the
default colors for this theme.</string>
<string name="button_apply_config">Import</string>
</resources>

View file

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="android:Theme"/>
<style name="config_separator">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">fill_parent</item>

View file

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="android:Theme"/>
</resources>

View file

@ -58,7 +58,7 @@
<Preference app:title="@string/prefs_colors"
app:summary="@string/prefs_colors_summary"
app:fragment="org.eehouse.android.xw4.gen.PrefsWrappers$prefs_appear_colors"
app:fragment="org.eehouse.android.xw4.gen.PrefsWrappers$prefs_appear_themes"
/>
</PreferenceCategory>

View file

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
>
<PreferenceCategory android:title="@string/prefs_colors"
android:summary="@string/prefs_colors_summary"
>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_player0_dark"
android:title="@string/pref_player1_name"
android:defaultValue="0xF0F0F0"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_player1_dark"
android:title="@string/pref_player2_name"
android:defaultValue="0xFFB0B0"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_player2_dark"
android:title="@string/pref_player3_name"
android:defaultValue="0xB0B0FF"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_player3_dark"
android:title="@string/pref_player4_name"
android:defaultValue="0xB0FFB0"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_bonus_l2x_dark"
android:title="@string/bonus_l2x"
android:defaultValue="0x3F3F00"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_bonus_l3x_dark"
android:title="@string/bonus_l3x"
android:defaultValue="0x003F3F"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_bonus_w2x_dark"
android:title="@string/bonus_w2x"
android:defaultValue="0x3F003F"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_bonus_w3x_dark"
android:title="@string/bonus_w3x"
android:defaultValue="0x3F3F3F"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_clr_bonushint_dark"
android:title="@string/key_bonushint"
android:defaultValue="0x7F7F7F"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_clr_crosshairs_dark"
android:title="@string/clr_crosshairs"
android:defaultValue="0x7070FF"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_tile_back_dark"
android:title="@string/tile_back"
android:defaultValue="0x585858"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_empty_dark"
android:title="@string/empty"
android:defaultValue="0x080808"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_background_dark"
android:title="@string/background"
android:defaultValue="0x1E2327"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_cellline_dark"
android:title="@string/cellline"
android:defaultValue="0x202020"
/>
<org.eehouse.android.xw4.XWListPreference
android:key="@string/key_board_line_width_dark"
android:title="@string/cellline_width"
android:entries="@array/cellline_widths"
android:entryValues="@array/cellline_widths"
android:defaultValue="2"
/>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
>
<PreferenceCategory android:title="@string/prefs_themes"
>
<org.eehouse.android.xw4.XWListPreference
android:key="@string/key_theme_which"
android:title="@string/theme_which"
android:entries="@array/color_themes"
android:entryValues="@array/color_themes"
android:defaultValue="@string/color_use_theme_os"
/>
<Preference app:title="@string/color_theme_edit_light"
app:fragment="org.eehouse.android.xw4.gen.PrefsWrappers$prefs_appear_colors_light"
/>
<Preference app:title="@string/color_theme_edit_dark"
app:fragment="org.eehouse.android.xw4.gen.PrefsWrappers$prefs_appear_colors_dark"
/>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -0,0 +1,5 @@
<?xml version="1.0"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="32px" id="Layer_1" style="enable-background:new 0 0 32 32;" version="1.1" viewBox="0 0 32 32" width="32px" xml:space="preserve">
<path d="M4,10h24c1.104,0,2-0.896,2-2s-0.896-2-2-2H4C2.896,6,2,6.896,2,8S2.896,10,4,10z M28,14H4c-1.104,0-2,0.896-2,2 s0.896,2,2,2h24c1.104,0,2-0.896,2-2S29.104,14,28,14z M28,22H4c-1.104,0-2,0.896-2,2s0.896,2,2,2h24c1.104,0,2-0.896,2-2 S29.104,22,28,22z"/>
</svg>

After

Width:  |  Height:  |  Size: 609 B