Move to using androidx-based prefs classes and recipes

Use the current recommended classes and organization of app
settings. Means breaking xwprefs.xml into eight or so files and a bunch
of changes to classes derived from Preference. Seems to work, but there
will be bugs. Also got rid of most Activity subclasses that were
alternatives to Fragments, since all Android versions I'm allowed to
support now support Fragments.
This commit is contained in:
Eric House 2021-01-29 15:42:28 -08:00
parent 31cfbaab1a
commit 4fef4e4b29
52 changed files with 1205 additions and 1312 deletions

View file

@ -340,6 +340,7 @@ android {
dependencies {
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.core:core:1.0.0'
implementation 'androidx.preference:preference:1.1.+'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
annotationProcessor 'androidx.lifecycle:lifecycle-compiler:2.0.0'

View file

@ -97,10 +97,6 @@
android:theme="@android:style/Theme.Translucent.NoTitleBar"
/>
<activity android:name="DictsActivity"
android:label="@string/title_dicts_list"
/>
<activity android:name="BTInviteActivity"
android:label="@string/bt_invite_title"
/>
@ -115,27 +111,13 @@
android:label="@string/mqtt_invite_title"
/>
<activity android:name="GameConfigActivity"
android:screenOrientation="sensor"
android:windowSoftInputMode="stateAlwaysHidden"
>
<intent-filter>
<action android:name="android.intent.action.EDIT" />
</intent-filter>
</activity>
<activity android:name="PrefsActivity"
android:label="@string/title_prefs"
android:screenOrientation="sensor"
android:theme="@style/Theme.AppCompat"
/>
<activity android:name="BoardActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
/>
<activity android:name="StudyListActivity" />
<activity android:name="KnownPlayersActivity" />
<receiver android:name="OnBootReceiver">
<intent-filter>
@ -154,7 +136,7 @@
</intent-filter>
</receiver>
<!-- downloading dicts -->
<!-- downloading dicts == can be fragment?? -->
<activity android:name=".DwnldActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.Dialog"

View file

@ -1,68 +0,0 @@
/* -*- compile-command: "find-and-gradle.sh inXw4dDeb"; -*- */
/*
* Copyright 2009 - 2013 by Eric House (xwords@eehouse.org). All
* rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.eehouse.android.xw4;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Window;
import org.eehouse.android.xw4.jni.CommonPrefs;
public class BoardActivity extends XWActivity {
private BoardDelegate m_dlgt;
@Override
protected void onCreate( Bundle savedInstanceState )
{
if ( CommonPrefs.getHideTitleBar( this )
&& ABUtils.haveMenuKey( this ) ) {
requestWindowFeature( Window.FEATURE_NO_TITLE );
}
m_dlgt = new BoardDelegate( this, savedInstanceState );
super.onCreate( savedInstanceState, m_dlgt );
int orientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
if ( XWPrefs.getIsTablet( this ) ) {
orientation = ActivityInfo.SCREEN_ORIENTATION_USER;
} else if ( 9 <= Integer.valueOf( android.os.Build.VERSION.SDK ) ) {
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
}
if ( ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED != orientation ) {
setRequestedOrientation( orientation );
}
} // onCreate
@Override
public boolean onKeyDown( int keyCode, KeyEvent event )
{
return m_dlgt.onKeyDown( keyCode, event )
|| super.onKeyDown( keyCode, event );
}
@Override
public boolean onKeyUp( int keyCode, KeyEvent event )
{
return m_dlgt.onKeyUp( keyCode, event ) || super.onKeyUp( keyCode, event );
}
} // class BoardActivity

View file

@ -1,33 +0,0 @@
/* -*- compile-command: "find-and-gradle.sh inXw4dDeb"; -*- */
/*
* Copyright 2011 by Eric House (xwords@eehouse.org). All rights
* reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.eehouse.android.xw4;
import android.os.Bundle;
public class ChatActivity extends XWActivity {
@Override
public void onCreate( Bundle savedInstanceState )
{
ChatDelegate dlgt = new ChatDelegate( this, savedInstanceState );
super.onCreate( savedInstanceState, dlgt );
}
}

View file

@ -275,13 +275,6 @@ public class ChatDelegate extends DelegateBase {
bundle.putStringArray( INTENT_KEY_NAMES, names );
bundle.putBooleanArray( INTENT_KEY_LOCS, locs );
if ( delegator.inDPMode() ) {
delegator.addFragment( ChatFrag.newInstance( delegator ), bundle );
} else {
Activity activity = delegator.getActivity();
Intent intent = new Intent( activity, ChatActivity.class );
intent.putExtras( bundle );
activity.startActivity( intent );
}
delegator.addFragment( ChatFrag.newInstance( delegator ), bundle );
}
}

View file

@ -21,7 +21,7 @@
package org.eehouse.android.xw4;
import android.content.Context;
import android.preference.CheckBoxPreference;
import androidx.preference.CheckBoxPreference;
import android.util.AttributeSet;
public abstract class ConfirmingCheckBoxPreference extends CheckBoxPreference {
@ -33,8 +33,9 @@ public abstract class ConfirmingCheckBoxPreference extends CheckBoxPreference {
}
@Override
protected void onAttachedToActivity() {
super.onAttachedToActivity();
public void onAttached()
{
super.onAttached();
m_attached = true;
}

View file

@ -296,7 +296,7 @@ public abstract class DelegateBase implements DlgClickNotify,
boolean handled = false;
if ( m_activity instanceof MainActivity ) {
MainActivity main = (MainActivity)m_activity;
if ( main.inDPMode() ) {
if ( true /*main.inDPMode()*/ ) {
if ( !m_finishCalled ) {
m_finishCalled = true;
main.finishFragment( (XWFragment)m_delegator );

View file

@ -28,7 +28,6 @@ public interface Delegator {
Activity getActivity();
Bundle getArguments();
void finish();
boolean inDPMode();
void addFragment( XWFragment fragment, Bundle extras );
void addFragmentForResult( XWFragment fragment, Bundle extras,
RequestCode requestCode );

View file

@ -1,35 +0,0 @@
/* -*- compile-command: "find-and-gradle.sh inXw4dDeb"; -*- */
/*
* Copyright 2009 - 2011 by Eric House (xwords@eehouse.org). All
* rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.eehouse.android.xw4;
import android.os.Bundle;
public class DictBrowseActivity extends XWActivity {
private DictBrowseDelegate m_dlgt;
@Override
protected void onCreate( Bundle savedInstanceState )
{
m_dlgt = new DictBrowseDelegate( this, savedInstanceState );
super.onCreate( savedInstanceState, m_dlgt );
} // onCreate
}

View file

@ -794,15 +794,8 @@ public class DictBrowseDelegate extends DelegateBase
private static void launch( Delegator delegator, Bundle bundle )
{
if ( delegator.inDPMode() ) {
delegator.addFragment( DictBrowseFrag.newInstance( delegator ),
bundle );
} else {
Activity activity = delegator.getActivity();
Intent intent = new Intent( activity, DictBrowseActivity.class );
intent.putExtras( bundle );
activity.startActivity( intent );
}
delegator.addFragment( DictBrowseFrag.newInstance( delegator ),
bundle );
}
public static void launch( Delegator delegator, String name,

View file

@ -1,37 +0,0 @@
/* -*- compile-command: "find-and-gradle.sh inXw4dDeb"; -*- */
/*
* Copyright 2009 - 2014 by Eric House (xwords@eehouse.org). All
* rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.eehouse.android.xw4;
import android.os.Bundle;
public class DictsActivity extends XWActivity {
// I can't provide a subclass of MenuItem to hold DictAndLoc, so
// settle for a hash on the side.
private DictsDelegate m_dlgt;
@Override
protected void onCreate( Bundle savedInstanceState )
{
m_dlgt = new DictsDelegate( this, savedInstanceState );
super.onCreate( savedInstanceState, m_dlgt );
} // onCreate
}

View file

@ -32,7 +32,7 @@ import android.content.SharedPreferences;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.PreferenceManager;
import androidx.preference.PreferenceManager;
import android.text.TextUtils;
import android.view.Menu;
import android.view.MenuItem;
@ -1501,13 +1501,7 @@ public class DictsDelegate extends ListDelegateBase
public static void start( Delegator delegator )
{
if ( delegator.inDPMode() ) {
delegator.addFragment( DictsFrag.newInstance( delegator ), null );
} else {
Activity activity = delegator.getActivity();
Intent intent = new Intent( activity, DictsActivity.class );
activity.startActivity( intent );
}
delegator.addFragment( DictsFrag.newInstance( delegator ), null );
}
public static void downloadForResult( Delegator delegator,
@ -1523,14 +1517,7 @@ public class DictsDelegate extends ListDelegateBase
Assert.assertTrue( lang != 0 );
bundle.putString( DICT_NAME_EXTRA, name );
}
if ( delegator.inDPMode() ) {
delegator.addFragmentForResult( DictsFrag.newInstance( delegator ),
bundle, requestCode );
} else {
Activity activity = delegator.getActivity();
Intent intent = new Intent( activity, DictsActivity.class );
intent.putExtras( bundle );
activity.startActivityForResult( intent, requestCode.ordinal() );
}
delegator.addFragmentForResult( DictsFrag.newInstance( delegator ),
bundle, requestCode );
}
}

View file

@ -20,25 +20,29 @@
package org.eehouse.android.xw4;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.TypedArray;
import android.preference.DialogPreference;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.view.View;
import android.widget.EditText;
import android.widget.SeekBar;
import androidx.preference.DialogPreference;
import androidx.preference.PreferenceViewHolder;
import org.eehouse.android.xw4.loc.LocUtils;
public class EditColorPreference extends DialogPreference {
public class EditColorPreference extends DialogPreference
implements PrefsActivity.DialogProc {
private static final String TAG = EditColorPreference.class.getSimpleName();
private Context m_context;
private int m_curColor;
private Context mContext;
private int mCurColor;
private View mWidget;
// m_updateText: prevent loop that resets edittext cursor
private boolean m_updateText = true;
private static final int m_seekbarIds[] = { R.id.seek_red, R.id.seek_green,
@ -57,6 +61,7 @@ public class EditColorPreference extends DialogPreference {
m_editTxt = editTxt;
}
@Override
public void onProgressChanged( SeekBar seekBar, int progress,
boolean fromUser )
{
@ -66,29 +71,27 @@ public class EditColorPreference extends DialogPreference {
int shift = 16 - (m_index * 8);
// mask out the byte we're changing
int color = m_curColor & ~(0xFF << shift);
int color = mCurColor & ~(0xFF << shift);
// add in the new version of the byte
color |= progress << shift;
m_curColor = color;
m_sample.setBackgroundColor( m_curColor );
mCurColor = color;
m_sample.setBackgroundColor( mCurColor );
}
@Override
public void onStartTrackingTouch( SeekBar seekBar ) {}
@Override
public void onStopTrackingTouch( SeekBar seekBar ) {}
}
private class TCL implements TextWatcher {
private SeekBar m_seekBar;
public TCL( SeekBar seekBar ) { m_seekBar = seekBar; }
public void afterTextChanged( Editable s )
{
}
public void beforeTextChanged( CharSequence s, int st, int cnt, int a )
{
}
@Override
public void afterTextChanged( Editable s ) {}
@Override
public void beforeTextChanged( CharSequence s, int st, int cnt, int a ) {}
@Override
public void onTextChanged( CharSequence s, int start,
int before, int count )
{
@ -107,80 +110,116 @@ public class EditColorPreference extends DialogPreference {
public EditColorPreference( Context context, AttributeSet attrs )
{
super( context, attrs );
m_context = context;
mContext = context;
setWidgetLayoutResource( R.layout.color_display );
setDialogLayoutResource( R.layout.color_edit );
String title = getDialogTitle().toString();
String newTitle = LocUtils.xlateString( m_context, title );
if ( null != newTitle ) {
setDialogTitle( newTitle );
}
setNegativeButtonText( LocUtils.getString( context, android.R.string.cancel ) );
}
@Override
protected Object onGetDefaultValue(TypedArray a, int index) {
return a.getInteger(index, 0);
public void onBindViewHolder( PreferenceViewHolder holder )
{
mWidget = holder.itemView;
setWidgetColor();
super.onBindViewHolder( holder );
}
private void setWidgetColor()
{
mWidget.findViewById( R.id.color_display_sample )
.setBackgroundColor( getPersistedColor() );
}
@Override
protected void onSetInitialValue(boolean restoreValue, Object defaultValue) {
protected Object onGetDefaultValue( TypedArray arr, int index )
{
return arr.getInteger( index, 0 );
}
@Override
protected void onSetInitialValue( boolean restoreValue, Object defaultValue )
{
if ( !restoreValue ) {
persistInt( (Integer)defaultValue );
}
}
// PrefsActivity.DialogProc interface
@Override
protected void onBindView( View parent )
public XWDialogFragment makeDialogFrag()
{
super.onBindView( parent );
View sample = parent.findViewById( R.id.color_display_sample );
sample.setBackgroundColor( getPersistedColor() );
return new ColorEditDialogFrag( this );
}
@Override
protected void onBindDialogView( View view )
{
LocUtils.xlateView( m_context, view );
public static class ColorEditDialogFrag extends XWDialogFragment
implements DialogInterface.OnShowListener {
m_curColor = getPersistedColor();
private EditColorPreference mPref;
private View mView;
ColorEditDialogFrag( EditColorPreference pref ) { mPref = pref; }
@Override
public Dialog onCreateDialog( Bundle sis )
{
mView = LocUtils.inflate( mPref.getContext(), R.layout.color_edit );
DialogInterface.OnClickListener onOk =
new DialogInterface.OnClickListener() {
@Override
public void onClick( DialogInterface di,
int which )
{
Log.d( TAG, "onClick()" );
int color = (getOneByte( di, R.id.seek_red ) << 16)
| (getOneByte( di, R.id.seek_green ) << 8)
| getOneByte( di, R.id.seek_blue );
mPref.persistInt( color );
mPref.setWidgetColor();
// notifyChanged();
}
};
Dialog dialog = LocUtils.makeAlertBuilder( mPref.getContext() )
.setView( mView )
.setTitle( mPref.getTitle() )
.setPositiveButton( android.R.string.ok, onOk )
.setNegativeButton( android.R.string.cancel, null )
.create();
dialog.setOnShowListener( this );
return dialog;
}
@Override
public void onShow( DialogInterface dlg )
{
mPref.onBindDialogView( mView );
}
@Override
protected String getFragTag() { return getClass().getSimpleName(); }
}
private void onBindDialogView( View view )
{
LocUtils.xlateView( mContext, view );
mCurColor = getPersistedColor();
setOneByte( view, 0 );
setOneByte( view, 1 );
setOneByte( view, 2 );
View sample = view.findViewById( R.id.color_edit_sample );
sample.setBackgroundColor( m_curColor );
}
@Override
protected void onPrepareDialogBuilder( AlertDialog.Builder builder )
{
DialogInterface.OnClickListener lstnr =
new DialogInterface.OnClickListener() {
@Override
public void onClick( DialogInterface dialog, int which )
{
int color = (getOneByte( dialog, R.id.seek_red ) << 16)
| (getOneByte( dialog, R.id.seek_green ) << 8)
| getOneByte( dialog, R.id.seek_blue );
persistInt( color );
notifyChanged();
}
};
String okText = LocUtils.getString( m_context, android.R.string.ok );
builder.setPositiveButton( okText, lstnr );
super.onPrepareDialogBuilder( builder );
view.findViewById( R.id.color_edit_sample )
.setBackgroundColor( mCurColor );
}
private void setOneByte( View parent, int indx )
{
int shift = 16 - (indx*8);
int byt = (m_curColor >> shift) & 0xFF;
int byt = (mCurColor >> shift) & 0xFF;
SeekBar seekbar = (SeekBar)parent.findViewById( m_seekbarIds[indx] );
EditText edittext = (EditText)parent.findViewById( m_editIds[indx] );
@ -197,7 +236,8 @@ public class EditColorPreference extends DialogPreference {
}
}
private int getOneByte( DialogInterface parent, int id ) {
private static int getOneByte( DialogInterface parent, int id )
{
int val = 0;
Dialog dialog = (Dialog)parent;
SeekBar seekbar = (SeekBar)dialog.findViewById( id );

View file

@ -1,33 +0,0 @@
/* -*- compile-command: "find-and-gradle.sh inXw4dDeb"; -*- */
/*
* Copyright 2009-2010 by Eric House (xwords@eehouse.org). All
* rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.eehouse.android.xw4;
import android.os.Bundle;
public class GameConfigActivity extends XWActivity {
@Override
public void onCreate( Bundle savedInstanceState )
{
super.onCreate( savedInstanceState,
new GameConfigDelegate( this, savedInstanceState ) );
} // onCreate
}

View file

@ -1390,17 +1390,9 @@ public class GameConfigDelegate extends DelegateBase
bundle.putLong( GameUtils.INTENT_KEY_ROWID, rowID );
bundle.putBoolean( INTENT_FORRESULT_NEWGAME, newGame );
if ( delegator.inDPMode() ) {
delegator
.addFragmentForResult( GameConfigFrag.newInstance( delegator ),
bundle, requestCode );
} else {
Activity activity = delegator.getActivity();
Intent intent = new Intent( activity, GameConfigActivity.class );
intent.setAction( Intent.ACTION_EDIT );
intent.putExtras( bundle );
activity.startActivityForResult( intent, requestCode.ordinal() );
}
delegator
.addFragmentForResult( GameConfigFrag.newInstance( delegator ),
bundle, requestCode );
}
private void setConnLabel()

View file

@ -962,14 +962,7 @@ public class GameUtils {
extras.putAll( moreExtras );
}
if ( delegator.inDPMode() ) {
delegator.addFragment( BoardFrag.newInstance( delegator ), extras );
} else {
Activity activity = delegator.getActivity();
Intent intent = new Intent( activity, BoardActivity.class );
intent.putExtras( extras );
activity.startActivity( intent );
}
delegator.addFragment( BoardFrag.newInstance( delegator ), extras );
}
private static class FeedUtilsImpl extends UtilCtxtImpl {

View file

@ -1,33 +0,0 @@
/* -*- compile-command: "find-and-gradle.sh inXw4dDeb"; -*- */
/*
* Copyright 2020 by Eric House (xwords@eehouse.org). All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.eehouse.android.xw4;
import android.os.Bundle;
public class KnownPlayersActivity extends XWActivity {
@Override
protected void onCreate( Bundle savedInstanceState )
{
KnownPlayersDelegate dlgt =
new KnownPlayersDelegate( this, savedInstanceState );
super.onCreate( savedInstanceState, dlgt );
}
}

View file

@ -312,13 +312,8 @@ public class KnownPlayersDelegate extends DelegateBase {
Activity activity = delegator.getActivity();
if ( XwJNI.hasKnownPlayers() ) {
if ( delegator.inDPMode() ) {
delegator.addFragment( KnownPlayersFrag.newInstance( delegator ),
null );
} else {
Intent intent = new Intent( activity, KnownPlayersActivity.class );
activity.startActivity( intent );
}
delegator.addFragment( KnownPlayersFrag.newInstance( delegator ),
null );
} else {
Assert.failDbg();
}

View file

@ -21,23 +21,101 @@
package org.eehouse.android.xw4;
import android.content.Context;
import android.os.Handler;
import android.util.AttributeSet;
import androidx.preference.Preference;
import androidx.preference.PreferenceManager;
import org.eehouse.android.xw4.loc.LocUtils;
public class LangListPreference extends XWListPreference {
private Context m_context;
public class LangListPreference extends XWListPreference
implements Preference.OnPreferenceChangeListener {
private static final String TAG = LangListPreference.class.getSimpleName();
private Context mContext;
private String mKey;
public LangListPreference( Context context, AttributeSet attrs )
{
super( context, attrs );
m_context = context;
mContext = context;
mKey = context.getString( R.string.key_default_language );
}
@Override
public void setSummary( CharSequence summary )
{
super.setSummary( LocUtils.xlateLang( m_context, summary.toString(), true ) );
super.setSummary( LocUtils.xlateLang( mContext, summary.toString(), true ) );
}
@Override
public void onAttached()
{
super.onAttached();
setOnPreferenceChangeListener( this );
setupLangPref();
}
@Override
public boolean onPreferenceChange( Preference preference, Object newValue )
{
final String newLang = (String)newValue;
new Handler().post( new Runnable() {
@Override
public void run() {
forceDictsMatch( newLang );
}
} );
return true;
}
private void setupLangPref()
{
String keyLangs = mContext.getString( R.string.key_default_language );
String value = getValue();
String curLang = null == value ? null : value.toString();
boolean haveDictForLang = false;
String[] langs = DictLangCache.listLangs( m_context );
String[] langsLoc = new String[langs.length];
for ( int ii = 0; ii < langs.length; ++ii ) {
String lang = langs[ii];
haveDictForLang = haveDictForLang || lang.equals( curLang );
langsLoc[ii] = LocUtils.xlateLang( mContext, lang, true );
}
if ( !haveDictForLang ) {
curLang = DictLangCache.getLangName( mContext, 1 ); // English, unlocalized
setValue( curLang );
}
forceDictsMatch( curLang );
setEntries( langsLoc );
setDefaultValue( LocUtils.xlateLang( mContext, curLang, true ) );
setEntryValues( langs );
}
private void forceDictsMatch( String newLang )
{
if ( null != newLang ) {
int code = DictLangCache.getLangLangCode( mContext, newLang );
int[] keyIds = { R.string.key_default_dict,
R.string.key_default_robodict };
for ( int id : keyIds ) {
String key = mContext.getString( id );
PreferenceManager mgr = getPreferenceManager();
Assert.assertNotNull( mgr );
DictListPreference pref = (DictListPreference)mgr.findPreference( key );
Assert.assertNotNull( pref );
String curDict = pref.getValue().toString();
if ( ! DictUtils.dictExists( mContext, curDict )
|| code != DictLangCache.getDictLangCode( mContext,
curDict ) ) {
pref.invalidate();
}
}
}
}
}

View file

@ -47,9 +47,6 @@ public class MainActivity extends XWActivity
private static final boolean LOG_IDS = true;
private DelegateBase m_dlgt;
private boolean m_dpEnabled;
// Used only if m_dpEnabled is true
private LinearLayout m_root;
private boolean m_safeToCommit;
private ArrayList<Runnable> m_runWhenSafe = new ArrayList<>();
@ -66,23 +63,18 @@ public class MainActivity extends XWActivity
Log.e( TAG, "isTaskRoot() => false!!! What to do?" );
}
m_dpEnabled = XWPrefs.getIsTablet( this );
m_dlgt = m_dpEnabled ? new DualpaneDelegate( this, savedInstanceState )
: new GamesListDelegate( this, savedInstanceState );
m_dlgt = new DualpaneDelegate( this, savedInstanceState );
super.onCreate( savedInstanceState, m_dlgt );
if ( m_dpEnabled ) {
m_root = (LinearLayout)findViewById( R.id.main_container );
getSupportFragmentManager().addOnBackStackChangedListener( this );
m_root = (LinearLayout)findViewById( R.id.main_container );
getSupportFragmentManager().addOnBackStackChangedListener( this );
// Nothing to do if we're restarting
if ( savedInstanceState == null ) {
// In case this activity was started with special instructions from an Intent,
// pass the Intent's extras to the fragment as arguments
addFragmentImpl( GamesListFrag.newInstance(),
getIntent().getExtras(), null );
}
// Nothing to do if we're restarting
if ( savedInstanceState == null ) {
// In case this activity was started with special instructions from an Intent,
// pass the Intent's extras to the fragment as arguments
addFragmentImpl( GamesListFrag.newInstance(),
getIntent().getExtras(), null );
}
setSafeToRun();
@ -100,9 +92,7 @@ public class MainActivity extends XWActivity
{
setSafeToRun();
super.onPostResume();
if ( m_dpEnabled ) {
setVisiblePanes();
}
setVisiblePanes();
logPaneFragments();
}
@ -250,11 +240,6 @@ public class MainActivity extends XWActivity
//////////////////////////////////////////////////////////////////////
// Delegator interface
//////////////////////////////////////////////////////////////////////
@Override
public boolean inDPMode() {
return m_dpEnabled;
}
@Override
public void addFragment( XWFragment fragment, Bundle extras )
{

View file

@ -129,7 +129,7 @@ public class MultiService {
public static Intent makeMissingDictIntent( Context context, NetLaunchInfo nli,
DictFetchOwner owner )
{
Intent intent = new Intent( context, DictsActivity.class );
Intent intent = new Intent( context, MainActivity.class ); // PENDING TEST THIS!!!
intent.setAction( ACTION_FETCH_DICT );
intent.putExtra( LANG, nli.lang );
intent.putExtra( DICT, nli.dict );

View file

@ -1,6 +1,6 @@
/* -*- compile-command: "find-and-gradle.sh inXw4dDeb"; -*- */
/*
* Copyright 2009-2010 by Eric House (xwords@eehouse.org). All
* Copyright 2009 - 2021 by Eric House (xwords@eehouse.org). All
* rights reserved.
*
* This program is free software; you can redistribute it and/or
@ -22,133 +22,242 @@ package org.eehouse.android.xw4;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.view.View;
import androidx.fragment.app.Fragment;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat.OnPreferenceDisplayDialogCallback;
import androidx.preference.PreferenceFragmentCompat.OnPreferenceStartFragmentCallback;
import androidx.preference.PreferenceFragmentCompat.OnPreferenceStartScreenCallback;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceScreen;
import androidx.preference.PreferenceViewHolder;
import java.util.HashSet;
import java.util.Set;
import org.eehouse.android.xw4.DlgDelegate.Action;
import org.eehouse.android.xw4.DlgDelegate.Builder;
import org.eehouse.android.xw4.loc.LocUtils;
import org.eehouse.android.xw4.jni.CommonPrefs;
public class PrefsActivity extends PreferenceActivity
implements Delegator, DlgDelegate.HasDlgDelegate {
public class PrefsActivity extends XWActivity
implements Delegator, DlgDelegate.HasDlgDelegate,
// OnPreferenceStartScreenCallback,
OnPreferenceStartFragmentCallback,
OnPreferenceDisplayDialogCallback {
private final static String TAG = PrefsActivity.class.getSimpleName();
private PrefsDelegate m_dlgt;
interface DialogProc {
XWDialogFragment makeDialogFrag();
}
@Override
protected void onCreate( Bundle savedInstanceState )
{
super.onCreate( savedInstanceState );
m_dlgt = new PrefsDelegate( this, this, savedInstanceState );
super.onCreate( savedInstanceState, m_dlgt );
int layoutID = m_dlgt.getLayoutID();
if ( 0 < layoutID ) {
m_dlgt.setContentView( layoutID );
}
Assert.assertTrue( 0 < layoutID );
m_dlgt.setContentView( layoutID );
m_dlgt.init( savedInstanceState );
PreferenceFragmentCompat rootFrag = new FragPrefs();
m_dlgt.setRootFragment( rootFrag );
getSupportFragmentManager()
.beginTransaction()
.replace( R.id.main_container, rootFrag )
.commit();
}
@Override
protected void onStart()
{
LocUtils.xlatePreferences( this );
super.onStart();
m_dlgt.onStart();
}
@Override
protected void onResume()
{
super.onResume();
m_dlgt.onResume();
}
@Override
protected void onPause()
{
super.onPause();
m_dlgt.onPause();
}
@Override
protected void onStop()
{
m_dlgt.onStop();
super.onStop();
}
@Override
protected void onDestroy()
{
m_dlgt.onDestroy();
super.onDestroy();
}
@Override
protected Dialog onCreateDialog( int id )
{
return m_dlgt.onCreateDialog( id );
}
@Override
protected void onActivityResult( int requestCode, int resultCode,
Intent data )
{
RequestCode rc = RequestCode.values()[requestCode];
m_dlgt.onActivityResult( rc, resultCode, data );
}
public Builder makeOkOnlyBuilder( int msgID )
{
return m_dlgt.makeOkOnlyBuilder( msgID );
}
public Builder makeOkOnlyBuilder( String msg )
{
return m_dlgt.makeOkOnlyBuilder( msg );
}
@Override
public Builder makeNotAgainBuilder(int msgID, int key, Action action)
{
return m_dlgt.makeNotAgainBuilder( msgID, key, action );
}
public Builder makeNotAgainBuilder( int msgID, int key )
@Override
public boolean onPreferenceDisplayDialog( PreferenceFragmentCompat caller,
Preference pref )
{
return m_dlgt.makeNotAgainBuilder( msgID, key );
boolean success = false;
if ( pref instanceof DialogProc ) {
show( ((DialogProc)pref).makeDialogFrag() );
success = true;
} else {
Log.e( TAG, "unexpected class: %s", pref.getClass().getSimpleName() );
}
return success;
}
public Builder makeConfirmThenBuilder( String msg, Action action )
@Override
public boolean onPreferenceStartFragment( PreferenceFragmentCompat caller,
Preference pref )
{
final Bundle args = pref.getExtras();
final Fragment fragment = getSupportFragmentManager().getFragmentFactory()
.instantiate( getClassLoader(), pref.getFragment());
fragment.setArguments(args);
fragment.setTargetFragment( caller, 0 );
getSupportFragmentManager().beginTransaction()
.replace( R.id.main_container, fragment)
.addToBackStack(null)
.commit();
setTitle( pref.getTitle() );
return true;
}
Builder makeConfirmThenBuilder( String msg, Action action )
{
return m_dlgt.makeConfirmThenBuilder( msg, action );
}
public Builder makeConfirmThenBuilder( int msgID, Action action )
{
return m_dlgt.makeConfirmThenBuilder( msgID, action );
}
protected void showSMSEnableDialog( Action action )
{
m_dlgt.showSMSEnableDialog( action );
}
//////////////////////////////////////////////////////////////////////
// Delegator interface
//////////////////////////////////////////////////////////////////////
public Activity getActivity()
private static Set<String> sHideSet = null;
private synchronized static Set<String> getHideSet( Context context )
{
return this;
if ( null == sHideSet ) {
Set<Integer> tmp = new HashSet<>();
if ( !Utils.isGSMPhone( context ) || Perms23.haveNativePerms() ) {
tmp.add( R.string.key_enable_nbs );
}
if ( ABUtils.haveActionBar() ) {
tmp.add( R.string.key_hide_title );
}
if ( ! BuildConfig.WIDIR_ENABLED ) {
tmp.add( R.string.key_enable_p2p );
}
if ( null == FBMService.getFCMDevID( context ) ) {
tmp.add( R.string.key_show_fcm );
}
if ( BuildConfig.DEBUG ) {
tmp.add( R.string.key_logging_on );
tmp.add( R.string.key_enable_debug );
} else {
tmp.add( R.string.key_unhide_dupmode );
}
if ( CommonPrefs.getDupModeHidden( context ) ) {
tmp.add( R.string.key_init_dupmodeon );
}
if ( null == BuildConfig.KEY_FCMID ) {
tmp.add( R.string.key_relay_poll );
}
sHideSet = new HashSet<>();
for ( int key : tmp ) {
sHideSet.add( context.getString( key ) );
}
}
return sHideSet;
}
public Bundle getArguments()
{
return getIntent().getExtras();
// Every subscreen in the prefs.xml heierarchy has to have a class
// associated with it just to provide its xml-file ID. Stupid design; not
// mine!
private abstract static class BasePrefsFrag extends PreferenceFragmentCompat {
@Override
public void onCreatePreferences( Bundle savedInstanceState, String rootKey )
{
setPreferencesFromResource( getResID(), rootKey );
}
@Override
public void onViewCreated( View view, Bundle savedInstanceState )
{
Context context = view.getContext();
Set<String> hideSet = getHideSet( context );
for ( String key : hideSet ) {
Preference pref = findPreference( key );
if ( null != pref ) {
Log.d( TAG, "in %s, found pref %s", getClass().getSimpleName(),
pref.getTitle() );
pref.setVisible( false );
}
}
super.onViewCreated( view, savedInstanceState );
}
abstract int getResID();
}
public boolean inDPMode() { Assert.failDbg(); return false; }
public void addFragment( XWFragment fragment, Bundle extras ) { Assert.failDbg(); }
public void addFragmentForResult( XWFragment fragment, Bundle extras,
RequestCode code ) { Assert.failDbg(); }
public static class FragPrefs extends BasePrefsFrag {
@Override
int getResID() { return R.xml.prefs; }
}
public static class FragPrefsDflts extends BasePrefsFrag {
@Override
int getResID() { return R.xml.prefs_dflts; }
}
public static class FragPrefsDfltsNames extends BasePrefsFrag {
@Override
int getResID() { return R.xml.prefs_dflts_names; }
}
public static class FragPrefsDfltsDicts extends BasePrefsFrag {
@Override
int getResID() { return R.xml.prefs_dflts_dicts; }
}
public static class FragPrefsAppear extends BasePrefsFrag {
@Override
int getResID() { return R.xml.prefs_appear; }
}
public static class FragPrefsAppearColors extends BasePrefsFrag {
@Override
int getResID() { return R.xml.prefs_appear_colors; }
}
public static class FragPrefsBehave extends BasePrefsFrag {
@Override
int getResID() { return R.xml.prefs_behave; }
}
public static class FragPrefsBehaveNag extends BasePrefsFrag {
@Override
int getResID() { return R.xml.prefs_behave_nag; }
}
public static class FragPrefsNet extends BasePrefsFrag {
@Override
int getResID() { return R.xml.prefs_net; }
}
public static class FragPrefsNetAdv extends BasePrefsFrag {
@Override
int getResID() { return R.xml.prefs_net_adv; }
}
public static class FragPrefsDbg extends BasePrefsFrag {
@Override
int getResID() { return R.xml.prefs_dbg; }
}
public static class FragPrefsDbgNet extends BasePrefsFrag {
@Override
int getResID() { return R.xml.prefs_dbg_net; }
}
public static class FragPrefsDbgSms extends BasePrefsFrag {
@Override
int getResID() { return R.xml.prefs_dbg_sms; }
}
public static class FragPrefsDbgL10n extends BasePrefsFrag {
@Override
int getResID() { return R.xml.prefs_dbg_l10n; }
}
}

View file

@ -28,11 +28,12 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceManager;
import androidx.preference.PreferenceScreen;
import androidx.preference.PreferenceCategory;
import android.view.View;
import android.widget.Button;
@ -45,10 +46,12 @@ import java.util.HashMap;
import java.util.Map;
public class PrefsDelegate extends DelegateBase
implements SharedPreferences.OnSharedPreferenceChangeListener {
implements SharedPreferences.OnSharedPreferenceChangeListener,
View.OnClickListener {
private static final String TAG = PrefsDelegate.class.getSimpleName();
private PreferenceActivity m_activity;
private XWActivity mActivity;
private PreferenceFragmentCompat mFragment;
private static int[] s_keys = {
R.string.key_logging_on,
R.string.key_show_sms,
@ -69,22 +72,25 @@ public class PrefsDelegate extends DelegateBase
};
private static Map<String, Integer> s_keysHash = null;
public PrefsDelegate( PreferenceActivity activity, Delegator delegator,
public PrefsDelegate( XWActivity activity, Delegator delegator,
Bundle savedInstanceState )
{
super( delegator, savedInstanceState, R.layout.prefs_w_buttons );
m_activity = activity;
mActivity = activity;
}
protected Dialog onCreateDialog( int id )
@Override
protected Dialog makeDialog( DBAlert alert, Object[] params )
{
final DlgID dlgID = alert.getDlgID();
DialogInterface.OnClickListener lstnr = null;
int confirmID = 0;
switch( DlgID.values()[id] ) {
switch( dlgID ) {
case REVERT_COLORS:
confirmID = R.string.confirm_revert_colors;
lstnr = new DialogInterface.OnClickListener() {
@Override
public void onClick( DialogInterface dlg, int item ) {
PrefsDelegate self = (PrefsDelegate)curThis();
SharedPreferences sp = self.getSharedPreferences();
@ -116,6 +122,7 @@ public class PrefsDelegate extends DelegateBase
case REVERT_ALL:
confirmID = R.string.confirm_revert_all;
lstnr = new DialogInterface.OnClickListener() {
@Override
public void onClick( DialogInterface dlg, int item ) {
PrefsDelegate self = (PrefsDelegate)curThis();
SharedPreferences sp = self.getSharedPreferences();
@ -143,6 +150,7 @@ public class PrefsDelegate extends DelegateBase
@Override
protected void init( Bundle savedInstanceState )
{
// Assert.assertNotNull( m_fragment );
if ( null == s_keysHash ) {
s_keysHash = new HashMap<>();
for ( int key : s_keys ) {
@ -150,26 +158,12 @@ public class PrefsDelegate extends DelegateBase
s_keysHash.put( str, key );
}
}
}
// Load the preferences from an XML resource
m_activity.addPreferencesFromResource( R.xml.xwprefs );
Button button = (Button)findViewById( R.id.revert_colors );
button.setOnClickListener( new View.OnClickListener() {
public void onClick( View v ) {
showDialog( DlgID.REVERT_COLORS );
}
} );
button = (Button)findViewById( R.id.revert_all );
button.setOnClickListener(new View.OnClickListener() {
public void onClick( View v ) {
showDialog( DlgID.REVERT_ALL );
}
} );
setupLangPref();
hideStuff();
void setRootFragment( PreferenceFragmentCompat fragment )
{
Assert.assertNotNull( fragment );
mFragment = fragment;
}
@Override
@ -177,14 +171,42 @@ public class PrefsDelegate extends DelegateBase
{
super.onResume();
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);
}
@Override
protected void onPause()
{
getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
super.onPause();
}
// interface View.OnClickListener
@Override
public void onClick( View view )
{
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;
break;
default:
Assert.failDbg();
}
if ( null != dlgID ) {
showDialogFragment( dlgID );
}
}
// interface SharedPreferences.OnSharedPreferenceChangeListener
@Override
public void onSharedPreferenceChanged( SharedPreferences sp, String key )
{
@ -220,26 +242,26 @@ public class PrefsDelegate extends DelegateBase
DictUtils.invalDictList();
break;
case R.string.key_thumbsize:
DBUtils.clearThumbnails( m_activity );
DBUtils.clearThumbnails( mActivity );
break;
case R.string.key_xlations_locale:
LocUtils.localeChanged( m_activity, sp.getString( key, null ) );
LocUtils.localeChanged( mActivity, sp.getString( key, null ) );
break;
case R.string.key_default_language:
forceDictsMatch( sp.getString( key, null ) );
// forceDictsMatch( sp.getString( key, null ) );
break;
case R.string.key_force_radio:
SMSPhoneInfo.reset();
break;
case R.string.key_disable_nag:
case R.string.key_disable_nag_solo:
NagTurnReceiver.resetNagsDisabled( m_activity );
NagTurnReceiver.resetNagsDisabled( mActivity );
break;
case R.string.key_disable_relay:
RelayService.enabledChanged( m_activity );
RelayService.enabledChanged( mActivity );
break;
case R.string.key_disable_bt:
BTUtils.disabledChanged( m_activity );
BTUtils.disabledChanged( mActivity );
break;
case R.string.key_force_tablet:
makeOkOnlyBuilder( R.string.after_restart ).show();
@ -247,7 +269,7 @@ public class PrefsDelegate extends DelegateBase
case R.string.key_mqtt_host:
case R.string.key_mqtt_port:
case R.string.key_mqtt_qos:
MQTTUtils.onConfigChanged( m_activity );
MQTTUtils.onConfigChanged( mActivity );
break;
default:
Assert.failDbg();
@ -262,15 +284,15 @@ public class PrefsDelegate extends DelegateBase
boolean handled = true;
switch ( action ) {
case ENABLE_NBS_DO:
XWPrefs.setNBSEnabled( m_activity, true );
XWPrefs.setNBSEnabled( mActivity, true );
SMSCheckBoxPreference.setChecked();
break;
case DISABLE_RELAY_DO:
RelayService.setEnabled( m_activity, false );
RelayService.setEnabled( mActivity, false );
RelayCheckBoxPreference.setChecked();
break;
case DISABLE_BT_DO:
BTUtils.setEnabled( m_activity, false );
BTUtils.setEnabled( mActivity, false );
BTCheckBoxPreference.setChecked();
break;
default:
@ -288,7 +310,7 @@ public class PrefsDelegate extends DelegateBase
case DIALOG_OKONLY:
case DIALOG_ENABLESMS:
case DIALOG_NOTAGAIN:
HostDelegate.showForResult( m_activity, state );
HostDelegate.showForResult( mActivity, state );
break;
default:
@ -307,118 +329,18 @@ public class PrefsDelegate extends DelegateBase
private void relaunch()
{
PreferenceManager.setDefaultValues( m_activity, R.xml.xwprefs,
PreferenceManager.setDefaultValues( mActivity, R.xml.prefs,
false );
// Now replace this activity with a new copy
// so the new values get loaded.
PrefsDelegate.launch( m_activity );
PrefsDelegate.launch( mActivity );
finish();
}
private SharedPreferences getSharedPreferences()
{
return m_activity.getPreferenceScreen().getSharedPreferences();
}
private void setupLangPref()
{
String keyLangs = getString( R.string.key_default_language );
ListPreference lp = (ListPreference)
m_activity.findPreference( keyLangs );
String curLang = lp.getValue().toString();
boolean haveDictForLang = false;
String[] langs = DictLangCache.listLangs( m_activity );
String[] langsLoc = new String[langs.length];
for ( int ii = 0; ii < langs.length; ++ii ) {
String lang = langs[ii];
haveDictForLang = haveDictForLang
|| lang.equals( curLang );
langsLoc[ii] = xlateLang( lang, true );
}
if ( !haveDictForLang ) {
curLang = DictLangCache.getLangName( m_activity, 1 ); // English, unlocalized
lp.setValue( curLang );
}
forceDictsMatch( curLang );
lp.setEntries( langsLoc );
lp.setDefaultValue( xlateLang( curLang, true ) );
lp.setEntryValues( langs );
}
private void forceDictsMatch( String newLang )
{
int code = DictLangCache.getLangLangCode( m_activity, newLang );
int[] keyIds = { R.string.key_default_dict,
R.string.key_default_robodict };
for ( int id : keyIds ) {
String key = getString( id );
DictListPreference pref = (DictListPreference)m_activity.findPreference( key );
String curDict = pref.getValue().toString();
if ( ! DictUtils.dictExists( m_activity, curDict )
|| code != DictLangCache.getDictLangCode( m_activity,
curDict ) ) {
pref.invalidate();
}
}
}
private void hideOne( int prefID, int screenID )
{
try {
Preference pref = m_activity.findPreference( getString( prefID ) );
String key = getString( screenID );
((PreferenceScreen)m_activity.findPreference( key ))
.removePreference( pref );
} catch ( NullPointerException ex ) {
// This is happening hiding key_enable_sms, but the hide still
// works!
// Log.ex( TAG, ex );
}
}
private void showDialog( DlgID dlgID )
{
if ( !m_activity.isFinishing() ) {
m_activity.showDialog( dlgID.ordinal() );
}
}
private void hideStuff()
{
if ( !Utils.isGSMPhone( m_activity ) || Perms23.haveNativePerms() ) {
hideOne( R.string.key_enable_nbs, R.string.key_network_behavior );
}
if ( ABUtils.haveActionBar() ) {
hideOne( R.string.key_hide_title, R.string.prefs_appearance );
}
if ( ! BuildConfig.WIDIR_ENABLED ) {
hideOne( R.string.key_enable_p2p, R.string.key_network_behavior );
}
if ( null == FBMService.getFCMDevID( m_activity ) ) {
hideOne( R.string.key_show_fcm, R.string.pref_group_relay_title );
}
if ( BuildConfig.DEBUG ) {
hideOne( R.string.key_logging_on, R.string.advanced_summary );
hideOne( R.string.key_enable_debug, R.string.advanced_summary );
} else {
hideOne( R.string.key_unhide_dupmode, R.string.advanced_summary );
}
if ( CommonPrefs.getDupModeHidden( m_activity ) ) {
hideOne( R.string.key_init_dupmodeon, R.string.key_prefs_defaults );
}
if ( null == BuildConfig.KEY_FCMID ) {
hideOne( R.string.key_relay_poll, R.string.pref_group_relay_title );
}
return mFragment.getPreferenceScreen().getSharedPreferences();
}
public static void launch( Context context )

View file

@ -36,9 +36,9 @@ public class SMSCheckBoxPreference extends ConfirmingCheckBoxPreference {
}
@Override
protected void onAttachedToActivity()
public void onAttached()
{
super.onAttachedToActivity();
super.onAttached();
if ( !Utils.deviceSupportsNBS( getContext() ) ) {
setEnabled( false );
}

View file

@ -1,34 +0,0 @@
/* -*- compile-command: "find-and-gradle.sh inXw4dDeb"; -*- */
/*
* Copyright 2014 by Eric House (xwords@eehouse.org). All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.eehouse.android.xw4;
import android.os.Bundle;
public class StudyListActivity extends XWActivity {
@Override
protected void onCreate( Bundle savedInstanceState )
{
StudyListDelegate dlgt =
new StudyListDelegate( this, savedInstanceState );
super.onCreate( savedInstanceState, dlgt );
}
}

View file

@ -401,14 +401,8 @@ public class StudyListDelegate extends ListDelegateBase
bundle.putInt( START_LANG, lang );
}
if ( delegator.inDPMode() ) {
delegator.addFragment( StudyListFrag.newInstance( delegator ),
bundle );
} else {
Intent intent = new Intent( activity, StudyListActivity.class );
intent.putExtras( bundle );
activity.startActivity( intent );
}
delegator.addFragment( StudyListFrag.newInstance( delegator ),
bundle );
}
if ( null != msg ) {

View file

@ -401,8 +401,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
String name, DictUtils.DictLoc loc,
boolean isUpdate )
{
Intent intent =
new Intent( context, DictsActivity.class );
Intent intent = new Intent( context, MainActivity.class ); // PENDING TEST THIS!!!
intent.putExtra( NEW_DICT_URL, url );
intent.putExtra( NEW_DICT_NAME, name );
intent.putExtra( NEW_DICT_LOC, loc.ordinal() );

View file

@ -23,12 +23,8 @@ package org.eehouse.android.xw4;
import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.ContextMenu;
import android.view.Menu;
@ -36,6 +32,11 @@ import android.view.MenuItem;
import android.view.View;
import android.widget.ListAdapter;
import android.widget.ListView;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import org.eehouse.android.xw4.DlgDelegate.Action;
@ -52,12 +53,24 @@ public class XWActivity extends FragmentActivity
this, savedInstanceState );
}
super.onCreate( savedInstanceState );
Assert.assertNotNull( dlgt );
m_dlgt = dlgt;
Assert.assertTrue( getApplicationContext() == XWApp.getContext() );
int orientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
if ( XWPrefs.getIsTablet( this ) ) {
orientation = ActivityInfo.SCREEN_ORIENTATION_USER;
} else {
Assert.assertTrueNR( 9 <= Integer.valueOf( android.os.Build.VERSION.SDK ) );
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
}
if ( ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED != orientation ) {
setRequestedOrientation( orientation );
}
int layoutID = m_dlgt.getLayoutID();
if ( 0 < layoutID ) {
Log.d( TAG, "onCreate() calling setContentView()" );
m_dlgt.setContentView( layoutID );
}
@ -116,7 +129,8 @@ public class XWActivity extends FragmentActivity
Log.i( TAG, "%s.onStart(this=%H)", getClass().getSimpleName(), this );
}
super.onStart();
m_dlgt.onStart();
Assert.assertNotNull( m_dlgt );
m_dlgt.onStart(); // m_dlgt null?
}
@Override
@ -252,10 +266,6 @@ public class XWActivity extends FragmentActivity
return getListView().getAdapter();
}
public boolean inDPMode() {
return false;
}
@Override
public void addFragment( XWFragment fragment, Bundle extras )
{

View file

@ -29,7 +29,7 @@ import androidx.lifecycle.ProcessLifecycleOwner;
import android.content.Context;
import android.graphics.Color;
import android.os.Build;
import android.preference.PreferenceManager;
import androidx.preference.PreferenceManager;
import org.eehouse.android.nbsplib.NBSProxy;
@ -80,7 +80,7 @@ public class XWApp extends Application
OnBootReceiver.startTimers( this );
boolean mustCheck = Utils.firstBootThisVersion( this );
PreferenceManager.setDefaultValues( this, R.xml.xwprefs, mustCheck );
PreferenceManager.setDefaultValues( this, R.xml.prefs, mustCheck );
if ( mustCheck ) {
XWPrefs.setHaveCheckedUpgrades( this, false );
} else {

View file

@ -20,44 +20,55 @@
package org.eehouse.android.xw4;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.preference.DialogPreference;
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.View;
import androidx.preference.DialogPreference;
import androidx.preference.Preference;
import org.eehouse.android.xw4.DlgDelegate.Action;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnTypeSet;
import org.eehouse.android.xw4.loc.LocUtils;
public class XWConnAddrPreference extends DialogPreference {
public class XWConnAddrPreference extends DialogPreference
implements PrefsActivity.DialogProc {
private static final String TAG = XWConnAddrPreference.class.getSimpleName();
private Context m_context;
private ConnViaViewLayout m_view;
public XWConnAddrPreference( Context context, AttributeSet attrs )
{
super( context, attrs );
m_context = context;
setDialogLayoutResource( R.layout.conn_types_display );
setNegativeButtonText( LocUtils.getString( context, android.R.string.cancel ) );
CommsConnTypeSet curSet = XWPrefs.getAddrTypes( context );
setSummary( curSet.toString( context, true ) );
}
@Override
protected void onBindDialogView( View view )
public XWDialogFragment makeDialogFrag()
{
LocUtils.xlateView( m_context, view );
m_view = (ConnViaViewLayout)view.findViewById( R.id.conn_types );
final PrefsActivity activity = (PrefsActivity)m_context;
m_view.configure( XWPrefs.getAddrTypes( m_context ),
return new XWConnAddrDialogFrag( this );
}
public static class XWConnAddrDialogFrag extends XWDialogFragment {
private XWConnAddrPreference mSelf;
public XWConnAddrDialogFrag( XWConnAddrPreference self )
{
mSelf = self;
}
@Override
public Dialog onCreateDialog( Bundle sis )
{
final PrefsActivity activity = (PrefsActivity)getContext();
View view = LocUtils.inflate( activity, R.layout.conn_types_display );
final ConnViaViewLayout cvl = (ConnViaViewLayout)view.findViewById( R.id.conn_types );
cvl.configure( XWPrefs.getAddrTypes( activity ),
new ConnViaViewLayout.CheckEnabledWarner() {
@Override
public void warnDisabled( CommsConnType typ ) {
@ -78,10 +89,10 @@ public class XWConnAddrPreference extends DialogPreference {
break;
case COMMS_CONN_RELAY:
msg = LocUtils
.getString( m_context, R.string
.getString( activity, R.string
.warn_relay_disabled );
msg += "\n\n" + LocUtils
.getString( m_context,
.getString( activity,
R.string.warn_relay_later );
action = Action.ENABLE_RELAY_DO;
buttonID = R.string.button_enable_relay;
@ -106,22 +117,34 @@ public class XWConnAddrPreference extends DialogPreference {
new ConnViaViewLayout.SetEmptyWarner() {
@Override
public void typeSetEmpty() {
PrefsActivity activity = (PrefsActivity)m_context;
activity
.makeOkOnlyBuilder( R.string.warn_no_comms )
.show();
}
}, activity );
}
@Override
public void onClick( DialogInterface dialog, int which )
{
if ( AlertDialog.BUTTON_POSITIVE == which && null != m_view ) {
CommsConnTypeSet curSet = m_view.getTypes();
XWPrefs.setAddrTypes( m_context, curSet );
setSummary( curSet.toString( m_context, true ) );
DialogInterface.OnClickListener onOk =
new DialogInterface.OnClickListener() {
@Override
public void onClick( DialogInterface di,
int which )
{
Log.d( TAG, "onClick()" );
CommsConnTypeSet curSet = cvl.getTypes();
XWPrefs.setAddrTypes( activity, curSet );
mSelf.setSummary( curSet.toString( activity, true ) );
}
};
return LocUtils.makeAlertBuilder( activity )
.setTitle( R.string.title_addrs_pref )
.setView( view )
.setPositiveButton( android.R.string.ok, onOk )
.setNegativeButton( android.R.string.cancel, null )
.create();
}
super.onClick( dialog, which );
@Override
protected String getFragTag() { return getClass().getSimpleName(); }
}
}

View file

@ -21,7 +21,7 @@
package org.eehouse.android.xw4;
import android.content.Context;
import android.preference.EditTextPreference;
import androidx.preference.EditTextPreference;
import android.util.AttributeSet;
public class XWEditTextPreference extends EditTextPreference {
@ -31,9 +31,10 @@ public class XWEditTextPreference extends EditTextPreference {
super( context, attrs );
}
protected void onAttachedToActivity()
@Override
public void onAttached()
{
super.onAttachedToActivity();
super.onAttached();
setSummary( getPersistedString( "" ) );
}

View file

@ -213,13 +213,6 @@ abstract class XWFragment extends Fragment implements Delegator {
public void setTitle() { m_dlgt.setTitle(); }
@Override
public boolean inDPMode() {
MainActivity main = (MainActivity)getActivity();
Assert.assertTrue( !isAdded() || main.inDPMode() ); // otherwise should be somewhere else
return true;
}
@Override
public void addFragment( XWFragment fragment, Bundle extras )
{

View file

@ -21,7 +21,7 @@
package org.eehouse.android.xw4;
import android.content.Context;
import android.preference.ListPreference;
import androidx.preference.ListPreference;
import android.util.AttributeSet;
import org.eehouse.android.xw4.loc.LocUtils;
@ -36,9 +36,9 @@ public class XWListPreference extends ListPreference {
}
@Override
protected void onAttachedToActivity()
public void onAttached()
{
super.onAttachedToActivity();
super.onAttached();
setSummary( getPersistedString( "" ) );
}

View file

@ -23,7 +23,7 @@ package org.eehouse.android.xw4;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.preference.PreferenceManager;
import androidx.preference.PreferenceManager;
import android.text.TextUtils;
import org.json.JSONException;

View file

@ -42,9 +42,9 @@ public class XWSumListPreference extends XWListPreference {
// Why I exist: insert the rowid and gameid lines if debug is on
@Override
protected void onAttachedToActivity()
public void onAttached()
{
super.onAttachedToActivity();
super.onAttached();
CharSequence[] entries = getEntries();
CharSequence[] newEntries = LocUtils.xlateStrings( m_context, entries );

View file

@ -35,9 +35,10 @@ public class XWThumbListPreference extends XWListPreference {
}
// Why I exist: insert the rowid and gameid lines if debug is on
protected void onAttachedToActivity()
@Override
public void onAttached()
{
super.onAttachedToActivity();
super.onAttached();
CharSequence[] newEntries = new CharSequence[7];
newEntries[0] = LocUtils.getString( m_context, R.string.thumb_off );

View file

@ -7,12 +7,12 @@
android:layout_weight="1"
>
<ListView android:id="@id/android:list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:drawSelectorOnTop="false"
/>
<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"

View file

@ -0,0 +1,34 @@
<?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 app:title="@string/title_prefs"
>
<Preference app:title="@string/prefs_defaults"
app:summary="@string/prefs_defaults_summary"
app:key="@string/key_prefs_defaults"
app:fragment="org.eehouse.android.xw4.PrefsActivity$FragPrefsDflts"
/>
<Preference app:title="@string/prefs_appearance"
app:summary="@string/prefs_appearance_summary"
app:key="@string/prefs_appearance"
app:fragment="org.eehouse.android.xw4.PrefsActivity$FragPrefsAppear"
/>
<Preference app:title="@string/prefs_behavior"
app:summary="@string/prefs_behavior_summary"
app:fragment="org.eehouse.android.xw4.PrefsActivity$FragPrefsBehave"
/>
<Preference app:title="@string/network_behavior"
app:summary="@string/network_behavior_summary"
app:fragment="org.eehouse.android.xw4.PrefsActivity$FragPrefsNet"
/>
<Preference app:title="@string/advanced"
app:summary="@string/advanced_summary"
app:fragment="org.eehouse.android.xw4.PrefsActivity$FragPrefsDbg"
/>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
<PreferenceCategory app:title="@string/prefs_appearance"
>
<org.eehouse.android.xw4.XWThumbListPreference
app:key="@string/key_thumbsize"
app:title="@string/summary_thumbsize"
app:defaultValue="30"
/>
<org.eehouse.android.xw4.XWSumListPreference
app:key="@string/key_summary_field"
app:title="@string/summary_field"
app:entries="@array/game_summary_values"
app:entryValues="@array/game_summary_values"
app:defaultValue="@string/game_summary_field_opponents"
/>
<CheckBoxPreference app:key="@string/key_hide_newgames"
app:title="@string/hide_newgames_title"
app:summary="@string/hide_newgames_summary"
app:defaultValue="false"
/>
<CheckBoxPreference app:key="@string/key_hide_title"
app:title="@string/hide_title"
app:summary="@string/hide_title_summary"
app:defaultValue="false"
/>
<org.eehouse.android.xw4.XWListPreference
app:key="@string/key_force_tablet"
app:title="@string/force_tablet_title"
app:entries="@array/force_tablet_names"
app:entryValues="@array/force_tablet_names"
app:defaultValue="@string/force_tablet_default"
/>
<CheckBoxPreference app:key="@string/key_show_arrow"
app:title="@string/show_arrow"
app:summary="@string/show_arrow_summary"
app:defaultValue="true"
/>
<CheckBoxPreference app:key="@string/key_square_tiles"
app:title="@string/square_tiles"
app:summary="@string/square_tiles_summary"
app:defaultValue="false"
/>
<CheckBoxPreference app:key="@string/key_keep_screenon"
app:title="@string/keep_screenon"
app:summary="@string/keep_screenon_summary"
app:defaultValue="false"
/>
<Preference app:title="@string/prefs_colors"
app:summary="@string/prefs_colors_summary"
app:fragment="org.eehouse.android.xw4.PrefsActivity$FragPrefsAppearColors"
/>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -0,0 +1,83 @@
<?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 app:title="@string/prefs_colors"
>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_player0"
android:title="@string/pref_player1_name"
android:defaultValue="0x000000"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_player1"
android:title="@string/pref_player2_name"
android:defaultValue="0xFF0000"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_player2"
android:title="@string/pref_player3_name"
android:defaultValue="0x0000FF"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_player3"
android:title="@string/pref_player4_name"
android:defaultValue="0x008F00"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_bonus_l2x"
android:title="@string/bonus_l2x"
android:defaultValue="0xAFAF00"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_bonus_l3x"
android:title="@string/bonus_l3x"
android:defaultValue="0x00AFAF"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_bonus_w2x"
android:title="@string/bonus_w2x"
android:defaultValue="0xAF00AF"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_bonus_w3x"
android:title="@string/bonus_w3x"
android:defaultValue="0xAFAFAF"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_clr_crosshairs"
android:title="@string/clr_crosshairs"
android:defaultValue="0x7070FF"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_clr_bonushint"
android:title="@string/key_bonushint"
android:defaultValue="0x7F7F7F"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_tile_back"
android:title="@string/tile_back"
android:defaultValue="0xFFFF99"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_empty"
android:title="@string/empty"
android:defaultValue="0xFFFFFF"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_background"
android:title="@string/background"
android:defaultValue="0xFFFFFF"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_cellline"
android:title="@string/cellline"
android:defaultValue="0x101010"
/>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -0,0 +1,56 @@
<?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 app:title="@string/prefs_behavior"
>
<CheckBoxPreference android:key="@string/key_explain_robot"
android:title="@string/explain_robot"
android:summary="@string/explain_robot_summary"
android:defaultValue="true"
/>
<CheckBoxPreference android:key="@string/key_skip_confirm"
android:title="@string/skip_confirm_turn"
android:summary="@string/skip_confirm_turn_summary"
android:defaultValue="false"
/>
<CheckBoxPreference android:key="@string/key_notify_sound"
android:title="@string/notify_sound"
android:summary="@string/notify_other_summary"
android:defaultValue="true"
/>
<Preference app:title="@string/disable_nags_title"
app:fragment="org.eehouse.android.xw4.PrefsActivity$FragPrefsBehaveNag"
/>
<CheckBoxPreference android:key="@string/key_default_loc"
android:title="@string/default_loc"
android:summary="@string/default_loc_summary"
android:defaultValue="true"
/>
<CheckBoxPreference android:key="@string/key_sort_tiles"
android:title="@string/title_sort_tiles"
android:summary="@string/summary_sort_tiles"
android:defaultValue="true"
/>
<CheckBoxPreference android:key="@string/key_studyon"
android:title="@string/title_studyon"
android:summary="@string/summary_studyon"
android:defaultValue="true"
/>
<CheckBoxPreference android:key="@string/key_hide_crosshairs"
android:title="@string/hide_crosshairs"
android:summary="@string/hide_crosshairs_summary"
android:defaultValue="false"
/>
<CheckBoxPreference android:key="@string/key_peek_other"
android:title="@string/peek_other"
android:summary="@string/peek_other_summary"
android:defaultValue="false"
/>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -0,0 +1,18 @@
<?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 app:title="@string/disable_nags_title"
>
<CheckBoxPreference android:key="@string/key_disable_nag"
android:title="@string/disable_nag_title"
android:summary="@string/disable_nag_summary"
android:defaultValue="false"
/>
<CheckBoxPreference android:key="@string/key_disable_nag_solo"
android:title="@string/disable_nag_solo_title"
android:summary="@string/disable_nag_summary"
android:defaultValue="true"
/>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -0,0 +1,74 @@
<?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 app:title="@string/advanced"
>
<CheckBoxPreference android:key="@string/key_logging_on"
android:title="@string/logging_on"
android:defaultValue="@bool/DEBUG"
/>
<CheckBoxPreference android:key="@string/key_enable_debug"
android:title="@string/debug_features"
android:summary="@string/debug_features_summary"
android:defaultValue="@bool/DEBUG"
/>
<org.eehouse.android.xw4.XWEditTextPreference
android:key="@string/key_nag_intervals"
android:title="@string/nag_intervals"
/>
<CheckBoxPreference android:key="@string/key_enable_pending_count"
android:title="@string/enable_pending_count_title"
android:summary="@string/enable_pending_count_summary"
android:defaultValue="@bool/DEBUG"
/>
<Preference app:title="@string/pref_group_relay_title"
app:fragment="org.eehouse.android.xw4.PrefsActivity$FragPrefsDbgNet"
/>
<Preference app:title="@string/pref_group_sms_title"
app:fragment="org.eehouse.android.xw4.PrefsActivity$FragPrefsDbgSms"
/>
<Preference app:title="@string/pref_group_l10n_title"
app:fragment="org.eehouse.android.xw4.PrefsActivity$FragPrefsDbgL10n"
/>
<!-- For broken devices like my Blaze 4G that report a download
directory that doesn't exist, allow users to set it. Mine:
/sdcard/external_sd/download
-->
<org.eehouse.android.xw4.XWEditTextPreference
android:key="@string/key_download_path"
android:title="@string/download_path_title"
android:hint="@string/download_path_hint"
/>
<org.eehouse.android.xw4.XWEditTextPreference
android:key="@string/key_dict_host4"
android:title="@string/dict_host"
android:defaultValue="@string/dict_url"
/>
<org.eehouse.android.xw4.XWEditTextPreference
android:key="@string/key_update_url"
android:title="@string/expl_update_url"
android:defaultValue="@string/default_update_url"
/>
<CheckBoxPreference android:key="@string/key_update_prerel"
android:title="@string/pref_item_update_title"
android:summary="@string/pref_item_update_summary"
android:defaultValue="false"
/>
<!-- Keep all dup-mode related stuff hidden -->
<CheckBoxPreference android:key="@string/key_unhide_dupmode"
android:title="@string/unhide_dupmode_title"
android:summary="@string/unhide_dupmode_summary"
android:defaultValue="false"
/>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -0,0 +1,24 @@
<?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 app:title="@string/pref_group_l10n_title"
>
<CheckBoxPreference android:key="@string/key_got_langdict"
android:title="@string/got_langdict_title"
android:summary="@string/got_langdict_summary"
android:defaultValue="false"
/>
<org.eehouse.android.xw4.XWEditTextPreference
android:key="@string/key_xlations_locale"
android:title="@string/xlations_locale"
/>
<CheckBoxPreference android:key="@string/key_xlations_enabled"
android:title="@string/xlations_enabled_title"
android:summary="@string/xlations_enabled_summary"
android:defaultValue="false"
/>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -0,0 +1,54 @@
<?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 app:title="@string/pref_group_relay_title"
>
<org.eehouse.android.xw4.XWEditTextPreference
android:key="@string/key_nag_intervals"
android:title="@string/nag_intervals"
/>
<CheckBoxPreference android:key="@string/key_enable_pending_count"
android:title="@string/enable_pending_count_title"
android:summary="@string/enable_pending_count_summary"
android:defaultValue="@bool/DEBUG"
/>
<!-- For broken devices like my Blaze 4G that report a download
directory that doesn't exist, allow users to set it. Mine:
/sdcard/external_sd/download
-->
<org.eehouse.android.xw4.XWEditTextPreference
android:key="@string/key_download_path"
android:title="@string/download_path_title"
android:hint="@string/download_path_hint"
/>
<org.eehouse.android.xw4.XWEditTextPreference
android:key="@string/key_dict_host4"
android:title="@string/dict_host"
android:defaultValue="@string/dict_url"
/>
<org.eehouse.android.xw4.XWEditTextPreference
android:key="@string/key_update_url"
android:title="@string/expl_update_url"
android:defaultValue="@string/default_update_url"
/>
<CheckBoxPreference android:key="@string/key_update_prerel"
android:title="@string/pref_item_update_title"
android:summary="@string/pref_item_update_summary"
android:defaultValue="false"
/>
<!-- Keep all dup-mode related stuff hidden -->
<CheckBoxPreference android:key="@string/key_unhide_dupmode"
android:title="@string/unhide_dupmode_title"
android:summary="@string/unhide_dupmode_summary"
android:defaultValue="false"
/>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -0,0 +1,27 @@
<?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 app:title="@string/pref_group_sms_title"
>
<CheckBoxPreference android:key="@string/key_enable_sms_toself"
android:title="@string/enable_sms_toself_title"
android:summary="@string/enable_sms_toself_summary"
android:defaultValue="false"
/>
<org.eehouse.android.xw4.XWListPreference
android:key="@string/key_force_radio"
android:title="@string/force_radio_title"
android:entries="@array/force_radio_names"
android:entryValues="@array/force_radio_names"
android:defaultValue="@string/radio_name_real"
/>
<CheckBoxPreference android:key="@string/key_show_sms"
android:title="@string/show_sms_title"
android:defaultValue="false"
/>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -0,0 +1,77 @@
<?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 app:title="@string/prefs_defaults"
>
<Preference app:title="@string/prefs_names"
app:summary="@string/prefs_names_summary"
app:fragment="org.eehouse.android.xw4.PrefsActivity$FragPrefsDfltsNames"
/>
<org.eehouse.android.xw4.XWConnAddrPreference
app:key="@string/key_addrs_pref"
app:title="@string/title_addrs_pref"
/>
<Preference app:title="@string/prefs_dicts"
app:summary="@string/prefs_dicts_summary"
app:fragment="org.eehouse.android.xw4.PrefsActivity$FragPrefsDfltsDicts"
/>
<CheckBoxPreference app:key="@string/key_init_hintsallowed"
app:title="@string/hints_allowed"
app:summary="@string/hints_allowed_sum"
app:defaultValue="true"
/>
<CheckBoxPreference app:key="@string/key_init_nethintsallowed"
app:title="@string/nethints_allowed"
app:summary="@string/nethints_allowed_sum"
app:defaultValue="true"
/>
<CheckBoxPreference app:key="@string/key_init_dupmodeon"
app:title="@string/offerdupmode_title"
app:summary="@string/offerdupmode_sum"
app:defaultValue="false"
/>
<CheckBoxPreference app:key="@string/key_init_autojuggle"
app:title="@string/init_autojuggle"
app:summary="@string/init_autojuggle_sum"
app:defaultValue="false"
/>
<org.eehouse.android.xw4.XWListPreference
app:key="@string/key_default_phonies"
app:title="@string/default_phonies"
app:entries="@array/phony_names"
app:entryValues="@array/phony_names"
app:defaultValue="@string/phonies_warn"
/>
<CheckBoxPreference app:key="@string/key_default_timerenabled"
app:title="@string/use_timer"
app:defaultValue="false"
/>
<org.eehouse.android.xw4.XWEditTextPreference
app:key="@string/key_initial_player_minutes"
app:title="@string/initial_player_minutes"
app:defaultValue="25"
android:numeric="decimal"
/>
<org.eehouse.android.xw4.XWListPreference
app:key="@string/key_board_size"
app:title="@string/board_size"
app:entries="@array/board_sizes"
app:entryValues="@array/board_sizes"
app:defaultValue="15x15"
/>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -0,0 +1,28 @@
<?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 app:title="@string/prefs_dicts"
>
<!-- entries provided programatically -->
<org.eehouse.android.xw4.LangListPreference
app:key="@string/key_default_language"
app:title="@string/default_language"
app:defaultValue="@string/lang_name_english"
/>
<org.eehouse.android.xw4.DictListPreference
app:key="@string/key_default_dict"
app:title="@string/default_dict"
app:defaultValue="CollegeEng_2to8"
/>
<org.eehouse.android.xw4.DictListPreference
app:key="@string/key_default_robodict"
app:title="@string/default_robodict"
app:defaultValue="Top5000"
/>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -0,0 +1,28 @@
<?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 app:title="@string/prefs_names"
>
<org.eehouse.android.xw4.XWEditTextPreference
android:key="@string/key_player1_name"
android:title="@string/pref_human_name"
android:capitalize="words"
android:defaultValue=""
android:maxLines="1"
android:maxLength="32"
android:inputType="text"
/>
<org.eehouse.android.xw4.XWEditTextPreference
android:key="@string/key_robot_name"
android:title="@string/robot_label"
android:capitalize="words"
android:defaultValue="@string/button_default_robot"
android:maxLines="1"
android:maxLength="32"
android:inputType="text"
/>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -0,0 +1,45 @@
<?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 app:title="@string/network_behavior"
>
<org.eehouse.android.xw4.SMSCheckBoxPreference
android:key="@string/key_enable_nbs"
android:title="@string/enable_sms"
android:summary="@string/enable_sms_summary"
android:defaultValue="false"
/>
<CheckBoxPreference android:key="@string/key_notify_vibrate"
android:title="@string/notify_vibrate"
android:summary="@string/notify_other_summary"
android:defaultValue="false"
/>
<CheckBoxPreference android:key="@string/key_enable_p2p"
android:title="@string/title_enable_p2p"
android:summary="@string/summary_enable_p2p"
android:defaultValue="false"
/>
<Preference app:title="@string/network_advanced_title"
app:summary="@string/network_advanced_summary"
app:fragment="org.eehouse.android.xw4.PrefsActivity$FragPrefsNetAdv"
/>
<org.eehouse.android.xw4.RelayCheckBoxPreference
android:key="@string/key_disable_relay"
android:title="@string/disable_relay"
android:summary="@string/disable_relay_summary"
android:defaultValue="false"
/>
<org.eehouse.android.xw4.BTCheckBoxPreference
android:key="@string/key_disable_bt"
android:title="@string/disable_bt"
android:summary="@string/disable_bt_summary"
android:defaultValue="false"
/>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -0,0 +1,18 @@
<?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 app:title="@string/network_advanced_title"
>
<CheckBoxPreference android:key="@string/key_enable_pubroom"
android:title="@string/enable_pubroom_title"
android:summary="@string/enable_pubroom_summary"
android:defaultValue="false"
/>
<CheckBoxPreference android:key="@string/key_invite_multi"
android:title="@string/invite_multi_title"
android:summary="@string/invite_multi_summary"
android:defaultValue="false"
/>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -1,554 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
>
<PreferenceScreen android:title="@string/prefs_defaults"
android:summary="@string/prefs_defaults_summary"
android:key="@string/key_prefs_defaults"
>
<PreferenceScreen android:title="@string/prefs_names"
android:summary="@string/prefs_names_summary"
>
<org.eehouse.android.xw4.XWEditTextPreference
android:key="@string/key_player1_name"
android:title="@string/pref_human_name"
android:capitalize="words"
android:defaultValue=""
android:maxLines="1"
android:maxLength="32"
android:inputType="text"
/>
<org.eehouse.android.xw4.XWEditTextPreference
android:key="@string/key_robot_name"
android:title="@string/robot_label"
android:capitalize="words"
android:defaultValue="@string/button_default_robot"
android:maxLines="1"
android:maxLength="32"
android:inputType="text"
/>
</PreferenceScreen>
<org.eehouse.android.xw4.XWConnAddrPreference
android:key="@string/key_addrs_pref"
android:title="@string/title_addrs_pref"
/>
<PreferenceScreen android:title="@string/prefs_dicts"
android:summary="@string/prefs_dicts_summary"
>
<!-- entries provided programatically -->
<org.eehouse.android.xw4.LangListPreference
android:key="@string/key_default_language"
android:title="@string/default_language"
android:defaultValue="@string/lang_name_english"
/>
<org.eehouse.android.xw4.DictListPreference
android:key="@string/key_default_dict"
android:title="@string/default_dict"
android:defaultValue="CollegeEng_2to8"
/>
<org.eehouse.android.xw4.DictListPreference
android:key="@string/key_default_robodict"
android:title="@string/default_robodict"
android:defaultValue="Top5000"
/>
</PreferenceScreen>
<CheckBoxPreference android:key="@string/key_init_hintsallowed"
android:title="@string/hints_allowed"
android:summary="@string/hints_allowed_sum"
android:defaultValue="true"
/>
<CheckBoxPreference android:key="@string/key_init_nethintsallowed"
android:title="@string/nethints_allowed"
android:summary="@string/nethints_allowed_sum"
android:defaultValue="true"
/>
<CheckBoxPreference android:key="@string/key_init_dupmodeon"
android:title="@string/offerdupmode_title"
android:summary="@string/offerdupmode_sum"
android:defaultValue="false"
/>
<CheckBoxPreference android:key="@string/key_init_autojuggle"
android:title="@string/init_autojuggle"
android:summary="@string/init_autojuggle_sum"
android:defaultValue="false"
/>
<org.eehouse.android.xw4.XWListPreference
android:key="@string/key_default_phonies"
android:title="@string/default_phonies"
android:entries="@array/phony_names"
android:entryValues="@array/phony_names"
android:defaultValue="@string/phonies_warn"
/>
<CheckBoxPreference android:key="@string/key_default_timerenabled"
android:title="@string/use_timer"
android:defaultValue="false"
/>
<org.eehouse.android.xw4.XWEditTextPreference
android:key="@string/key_initial_player_minutes"
android:title="@string/initial_player_minutes"
android:defaultValue="25"
android:numeric="decimal"
/>
<org.eehouse.android.xw4.XWListPreference
android:key="@string/key_board_size"
android:title="@string/board_size"
android:entries="@array/board_sizes"
android:entryValues="@array/board_sizes"
android:defaultValue="15x15"
/>
</PreferenceScreen>
<PreferenceScreen android:title="@string/prefs_appearance"
android:summary="@string/prefs_appearance_summary"
android:key="@string/prefs_appearance"
>
<org.eehouse.android.xw4.XWThumbListPreference
android:key="@string/key_thumbsize"
android:title="@string/summary_thumbsize"
android:defaultValue="30"
/>
<org.eehouse.android.xw4.XWSumListPreference
android:key="@string/key_summary_field"
android:title="@string/summary_field"
android:entries="@array/game_summary_values"
android:entryValues="@array/game_summary_values"
android:defaultValue="@string/game_summary_field_opponents"
/>
<CheckBoxPreference android:key="@string/key_hide_newgames"
android:title="@string/hide_newgames_title"
android:summary="@string/hide_newgames_summary"
android:defaultValue="false"
/>
<CheckBoxPreference android:key="@string/key_hide_title"
android:title="@string/hide_title"
android:summary="@string/hide_title_summary"
android:defaultValue="false"
/>
<org.eehouse.android.xw4.XWListPreference
android:key="@string/key_force_tablet"
android:title="@string/force_tablet_title"
android:entries="@array/force_tablet_names"
android:entryValues="@array/force_tablet_names"
android:defaultValue="@string/force_tablet_default"
/>
<CheckBoxPreference android:key="@string/key_show_arrow"
android:title="@string/show_arrow"
android:summary="@string/show_arrow_summary"
android:defaultValue="true"
/>
<CheckBoxPreference android:key="@string/key_square_tiles"
android:title="@string/square_tiles"
android:summary="@string/square_tiles_summary"
android:defaultValue="false"
/>
<CheckBoxPreference android:key="@string/key_keep_screenon"
android:title="@string/keep_screenon"
android:summary="@string/keep_screenon_summary"
android:defaultValue="false"
/>
<PreferenceScreen android:title="@string/prefs_colors"
android:summary="@string/prefs_colors_summary"
>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_player0"
android:title="@string/pref_player1_name"
android:defaultValue="0x000000"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_player1"
android:title="@string/pref_player2_name"
android:defaultValue="0xFF0000"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_player2"
android:title="@string/pref_player3_name"
android:defaultValue="0x0000FF"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_player3"
android:title="@string/pref_player4_name"
android:defaultValue="0x008F00"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_bonus_l2x"
android:title="@string/bonus_l2x"
android:defaultValue="0xAFAF00"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_bonus_l3x"
android:title="@string/bonus_l3x"
android:defaultValue="0x00AFAF"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_bonus_w2x"
android:title="@string/bonus_w2x"
android:defaultValue="0xAF00AF"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_bonus_w3x"
android:title="@string/bonus_w3x"
android:defaultValue="0xAFAFAF"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_clr_crosshairs"
android:title="@string/clr_crosshairs"
android:defaultValue="0x7070FF"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_clr_bonushint"
android:title="@string/key_bonushint"
android:defaultValue="0x7F7F7F"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_tile_back"
android:title="@string/tile_back"
android:defaultValue="0xFFFF99"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_empty"
android:title="@string/empty"
android:defaultValue="0xFFFFFF"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_background"
android:title="@string/background"
android:defaultValue="0xFFFFFF"
/>
<org.eehouse.android.xw4.EditColorPreference
android:key="@string/key_cellline"
android:title="@string/cellline"
android:defaultValue="0x101010"
/>
</PreferenceScreen>
<!-- <org.eehouse.android.xw4.XWEditTextPreference -->
<!-- android:key="@string/key_board_line_pct" -->
<!-- android:title="@string/board_line_pct" -->
<!-- android:defaultValue="1" -->
<!-- android:numeric="decimal" -->
<!-- /> -->
</PreferenceScreen>
<PreferenceScreen android:title="@string/prefs_behavior"
android:summary="@string/prefs_behavior_summary"
>
<CheckBoxPreference android:key="@string/key_explain_robot"
android:title="@string/explain_robot"
android:summary="@string/explain_robot_summary"
android:defaultValue="true"
/>
<CheckBoxPreference android:key="@string/key_skip_confirm"
android:title="@string/skip_confirm_turn"
android:summary="@string/skip_confirm_turn_summary"
android:defaultValue="false"
/>
<CheckBoxPreference android:key="@string/key_notify_sound"
android:title="@string/notify_sound"
android:summary="@string/notify_other_summary"
android:defaultValue="true"
/>
<PreferenceScreen android:title="@string/disable_nags_title"
>
<CheckBoxPreference android:key="@string/key_disable_nag"
android:title="@string/disable_nag_title"
android:summary="@string/disable_nag_summary"
android:defaultValue="false"
/>
<CheckBoxPreference android:key="@string/key_disable_nag_solo"
android:title="@string/disable_nag_solo_title"
android:summary="@string/disable_nag_summary"
android:defaultValue="true"
/>
</PreferenceScreen>
<CheckBoxPreference android:key="@string/key_default_loc"
android:title="@string/default_loc"
android:summary="@string/default_loc_summary"
android:defaultValue="true"
/>
<CheckBoxPreference android:key="@string/key_sort_tiles"
android:title="@string/title_sort_tiles"
android:summary="@string/summary_sort_tiles"
android:defaultValue="true"
/>
<CheckBoxPreference android:key="@string/key_studyon"
android:title="@string/title_studyon"
android:summary="@string/summary_studyon"
android:defaultValue="true"
/>
<CheckBoxPreference android:key="@string/key_hide_crosshairs"
android:title="@string/hide_crosshairs"
android:summary="@string/hide_crosshairs_summary"
android:defaultValue="false"
/>
<CheckBoxPreference android:key="@string/key_peek_other"
android:title="@string/peek_other"
android:summary="@string/peek_other_summary"
android:defaultValue="false"
/>
</PreferenceScreen>
<PreferenceScreen android:title="@string/network_behavior"
android:summary="@string/network_behavior_summary"
android:key="@string/key_network_behavior"
>
<org.eehouse.android.xw4.SMSCheckBoxPreference
android:key="@string/key_enable_nbs"
android:title="@string/enable_sms"
android:summary="@string/enable_sms_summary"
android:defaultValue="false"
/>
<CheckBoxPreference android:key="@string/key_notify_vibrate"
android:title="@string/notify_vibrate"
android:summary="@string/notify_other_summary"
android:defaultValue="false"
/>
<CheckBoxPreference android:key="@string/key_enable_p2p"
android:title="@string/title_enable_p2p"
android:summary="@string/summary_enable_p2p"
android:defaultValue="false"
/>
<PreferenceScreen android:title="@string/network_advanced_title"
android:summary="@string/network_advanced_summary"
>
<CheckBoxPreference android:key="@string/key_enable_pubroom"
android:title="@string/enable_pubroom_title"
android:summary="@string/enable_pubroom_summary"
android:defaultValue="false"
/>
<CheckBoxPreference android:key="@string/key_invite_multi"
android:title="@string/invite_multi_title"
android:summary="@string/invite_multi_summary"
android:defaultValue="false"
/>
</PreferenceScreen>
<org.eehouse.android.xw4.RelayCheckBoxPreference
android:key="@string/key_disable_relay"
android:title="@string/disable_relay"
android:summary="@string/disable_relay_summary"
android:defaultValue="false"
/>
<org.eehouse.android.xw4.BTCheckBoxPreference
android:key="@string/key_disable_bt"
android:title="@string/disable_bt"
android:summary="@string/disable_bt_summary"
android:defaultValue="false"
/>
</PreferenceScreen>
<!-- For Debugging -->
<PreferenceScreen android:title="@string/advanced"
android:summary="@string/advanced_summary"
android:key="@string/advanced_summary"
>
<CheckBoxPreference android:key="@string/key_logging_on"
android:title="@string/logging_on"
android:defaultValue="@bool/DEBUG"
/>
<CheckBoxPreference android:key="@string/key_enable_debug"
android:title="@string/debug_features"
android:summary="@string/debug_features_summary"
android:defaultValue="@bool/DEBUG"
/>
<org.eehouse.android.xw4.XWEditTextPreference
android:key="@string/key_nag_intervals"
android:title="@string/nag_intervals"
/>
<CheckBoxPreference android:key="@string/key_enable_pending_count"
android:title="@string/enable_pending_count_title"
android:summary="@string/enable_pending_count_summary"
android:defaultValue="@bool/DEBUG"
/>
<PreferenceScreen android:title="@string/pref_group_relay_title"
android:summary="@string/pref_group_relay_summary"
android:key="@string/pref_group_relay_title"
>
<org.eehouse.android.xw4.XWListPreference
android:key="@string/key_relay_poll"
android:title="@string/relay_poll_title"
android:entries="@array/relay_poll_names"
android:entryValues="@array/relay_poll_names"
android:defaultValue="@string/relay_poll_name_both"
/>
<CheckBoxPreference android:key="@string/key_show_fcm"
android:title="@string/show_fcm_title"
android:defaultValue="@bool/DEBUG"
/>
<org.eehouse.android.xw4.XWEditTextPreference
android:key="@string/key_relay_host"
android:title="@string/relay_host"
android:defaultValue="@string/default_host"
/>
<CheckBoxPreference android:key="@string/key_relay_via_http_first"
android:title="@string/relay_via_http_first"
android:summary="@string/relay_via_http_first_summary"
android:defaultValue="false"
/>
<org.eehouse.android.xw4.XWEditTextPreference
android:key="@string/key_relay_url"
android:title="@string/expl_relay_url"
android:defaultValue="@string/default_relay_url"
/>
<org.eehouse.android.xw4.XWEditTextPreference
android:key="@string/key_relay_port"
android:title="@string/relay_port"
android:defaultValue="10997"
android:numeric="decimal"
/>
<org.eehouse.android.xw4.XWEditTextPreference
android:key="@string/key_proxy_port"
android:title="@string/proxy_port"
android:defaultValue="10998"
android:numeric="decimal"
/>
<org.eehouse.android.xw4.XWEditTextPreference
android:key="@string/key_mqtt_host"
android:title="@string/mqtt_host"
android:defaultValue="@string/default_host"
/>
<org.eehouse.android.xw4.XWEditTextPreference
android:key="@string/key_mqtt_port"
android:title="@string/mqtt_port"
android:defaultValue="1883"
android:numeric="decimal"
/>
<org.eehouse.android.xw4.XWListPreference
android:key="@string/key_mqtt_qos"
android:title="@string/mqtt_qos"
android:entries="@array/mqtt_qos_values"
android:entryValues="@array/mqtt_qos_values"
android:defaultValue="2"
/>
<org.eehouse.android.xw4.XWEditTextPreference
android:key="@string/key_mqtt_url2"
android:title="@string/expl_mqtt_url"
android:defaultValue="@string/default_mqtt_url2"
/>
</PreferenceScreen>
<PreferenceScreen android:title="@string/pref_group_sms_title"
android:summary="@string/pref_group_sms_summary"
>
<CheckBoxPreference android:key="@string/key_enable_sms_toself"
android:title="@string/enable_sms_toself_title"
android:summary="@string/enable_sms_toself_summary"
android:defaultValue="false"
/>
<org.eehouse.android.xw4.XWListPreference
android:key="@string/key_force_radio"
android:title="@string/force_radio_title"
android:entries="@array/force_radio_names"
android:entryValues="@array/force_radio_names"
android:defaultValue="@string/radio_name_real"
/>
<CheckBoxPreference android:key="@string/key_show_sms"
android:title="@string/show_sms_title"
android:defaultValue="false"
/>
</PreferenceScreen>
<PreferenceScreen android:title="@string/pref_group_l10n_title"
android:summary="@string/pref_group_l10n_summary"
>
<CheckBoxPreference android:key="@string/key_got_langdict"
android:title="@string/got_langdict_title"
android:summary="@string/got_langdict_summary"
android:defaultValue="false"
/>
<org.eehouse.android.xw4.XWEditTextPreference
android:key="@string/key_xlations_locale"
android:title="@string/xlations_locale"
/>
<CheckBoxPreference android:key="@string/key_xlations_enabled"
android:title="@string/xlations_enabled_title"
android:summary="@string/xlations_enabled_summary"
android:defaultValue="false"
/>
</PreferenceScreen>
<!-- For broken devices like my Blaze 4G that report a download
directory that doesn't exist, allow users to set it. Mine:
/sdcard/external_sd/download
-->
<org.eehouse.android.xw4.XWEditTextPreference
android:key="@string/key_download_path"
android:title="@string/download_path_title"
android:hint="@string/download_path_hint"
/>
<org.eehouse.android.xw4.XWEditTextPreference
android:key="@string/key_dict_host4"
android:title="@string/dict_host"
android:defaultValue="@string/dict_url"
/>
<org.eehouse.android.xw4.XWEditTextPreference
android:key="@string/key_update_url"
android:title="@string/expl_update_url"
android:defaultValue="@string/default_update_url"
/>
<CheckBoxPreference android:key="@string/key_update_prerel"
android:title="@string/pref_item_update_title"
android:summary="@string/pref_item_update_summary"
android:defaultValue="false"
/>
<!-- Keep all dup-mode related stuff hidden -->
<CheckBoxPreference android:key="@string/key_unhide_dupmode"
android:title="@string/unhide_dupmode_title"
android:summary="@string/unhide_dupmode_summary"
android:defaultValue="false"
/>
</PreferenceScreen>
</PreferenceScreen>