mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-04 20:46:28 +01:00
Merge branch 'android_branch' into android_translate
This commit is contained in:
commit
6caff930e7
23 changed files with 217 additions and 126 deletions
4
xwords4/android/.gitignore
vendored
4
xwords4/android/.gitignore
vendored
|
@ -2,3 +2,7 @@
|
||||||
/modules
|
/modules
|
||||||
XWords4-gcm/
|
XWords4-gcm/
|
||||||
/.gradle
|
/.gradle
|
||||||
|
**.iml
|
||||||
|
local.properties
|
||||||
|
.idea
|
||||||
|
|
||||||
|
|
|
@ -238,7 +238,7 @@ task cleanNDK(type: Exec) {
|
||||||
}
|
}
|
||||||
|
|
||||||
gradle.taskGraph.whenReady { taskGraph ->
|
gradle.taskGraph.whenReady { taskGraph ->
|
||||||
if ( taskGraph.hasTask(':app:validateReleaseSigning') ) {
|
if ( taskGraph.hasTask(':app:validateSigningXw4Release') ) {
|
||||||
def pass
|
def pass
|
||||||
if (System.getenv("ANDROID_RELEASE_PASSWORD")) {
|
if (System.getenv("ANDROID_RELEASE_PASSWORD")) {
|
||||||
pass = System.getenv("ANDROID_RELEASE_PASSWORD")
|
pass = System.getenv("ANDROID_RELEASE_PASSWORD")
|
||||||
|
|
|
@ -78,30 +78,24 @@
|
||||||
|
|
||||||
<activity android:name="DictsActivity"
|
<activity android:name="DictsActivity"
|
||||||
android:label="@string/title_dicts_list"
|
android:label="@string/title_dicts_list"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<activity android:name="BTInviteActivity"
|
<activity android:name="BTInviteActivity"
|
||||||
android:label="@string/bt_invite_title"
|
android:label="@string/bt_invite_title"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
|
||||||
/>
|
/>
|
||||||
<activity android:name="SMSInviteActivity"
|
<activity android:name="SMSInviteActivity"
|
||||||
android:label="@string/sms_invite_title"
|
android:label="@string/sms_invite_title"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
|
||||||
android:screenOrientation="sensor"
|
android:screenOrientation="sensor"
|
||||||
/>
|
/>
|
||||||
<activity android:name="RelayInviteActivity"
|
<activity android:name="RelayInviteActivity"
|
||||||
android:label="@string/relay_invite_title"
|
android:label="@string/relay_invite_title"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
|
||||||
/>
|
/>
|
||||||
<activity android:name="WiDirInviteActivity"
|
<activity android:name="WiDirInviteActivity"
|
||||||
android:label="@string/p2p_invite_title"
|
android:label="@string/p2p_invite_title"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<activity android:name="GameConfigActivity"
|
<activity android:name="GameConfigActivity"
|
||||||
android:screenOrientation="sensor"
|
android:screenOrientation="sensor"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
|
||||||
android:windowSoftInputMode="stateAlwaysHidden"
|
android:windowSoftInputMode="stateAlwaysHidden"
|
||||||
>
|
>
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
@ -112,17 +106,14 @@
|
||||||
<activity android:name="PrefsActivity"
|
<activity android:name="PrefsActivity"
|
||||||
android:label="@string/title_prefs"
|
android:label="@string/title_prefs"
|
||||||
android:screenOrientation="sensor"
|
android:screenOrientation="sensor"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<activity android:name="BoardActivity"
|
<activity android:name="BoardActivity"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
|
||||||
android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
|
android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<activity android:name="StudyListActivity"
|
<activity android:name="StudyListActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<receiver android:name="OnBootReceiver">
|
<receiver android:name="OnBootReceiver">
|
||||||
|
@ -170,7 +161,6 @@
|
||||||
<activity android:name=".DwnldActivity"
|
<activity android:name=".DwnldActivity"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@android:style/Theme.Dialog"
|
android:theme="@android:style/Theme.Dialog"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
|
||||||
>
|
>
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW"></action>
|
<action android:name="android.intent.action.VIEW"></action>
|
||||||
|
@ -186,16 +176,12 @@
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name="DictBrowseActivity"
|
<activity android:name="DictBrowseActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
|
||||||
/>
|
/>
|
||||||
<activity android:name="ChatActivity"
|
<activity android:name="ChatActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
|
||||||
/>
|
/>
|
||||||
<activity android:name=".loc.LocActivity"
|
<activity android:name=".loc.LocActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
|
||||||
/>
|
/>
|
||||||
<activity android:name=".loc.LocItemEditActivity"
|
<activity android:name=".loc.LocItemEditActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<service android:name="RelayService"/>
|
<service android:name="RelayService"/>
|
||||||
|
|
|
@ -28,10 +28,10 @@
|
||||||
<h3>New with this release</h3>
|
<h3>New with this release</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Enable side-by-side display for tablets</li>
|
<li>Enable side-by-side display for tablets</li>
|
||||||
|
<li>In service of above, rewrite pretty much everything
|
||||||
|
dialog-related. :-) (Please report bugs!)</li>
|
||||||
<li>Capitalize the W in CrossWords: this is not a crossword
|
<li>Capitalize the W in CrossWords: this is not a crossword
|
||||||
puzzle game</li>
|
puzzle game</li>
|
||||||
<li>In service of above, rewrite pretty much everything
|
|
||||||
dialog-related. :-)</li>
|
|
||||||
<li>Fix game timers</li>
|
<li>Fix game timers</li>
|
||||||
<li>Make blank-tile-picker dialog prettier</li>
|
<li>Make blank-tile-picker dialog prettier</li>
|
||||||
<li>Remove pick-face-up option for networked games. (It didn't
|
<li>Remove pick-face-up option for networked games. (It didn't
|
||||||
|
|
|
@ -37,6 +37,7 @@ import junit.framework.Assert;
|
||||||
import org.eehouse.android.xw4.loc.LocUtils;
|
import org.eehouse.android.xw4.loc.LocUtils;
|
||||||
|
|
||||||
public class AboutAlert extends XWDialogFragment {
|
public class AboutAlert extends XWDialogFragment {
|
||||||
|
private static final String TAG = AboutAlert.class.getSimpleName();
|
||||||
|
|
||||||
public static AboutAlert newInstance()
|
public static AboutAlert newInstance()
|
||||||
{
|
{
|
||||||
|
@ -82,4 +83,7 @@ public class AboutAlert extends XWDialogFragment {
|
||||||
.setPositiveButton( android.R.string.ok, null )
|
.setPositiveButton( android.R.string.ok, null )
|
||||||
.create();
|
.create();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getFragTag() { return TAG; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,6 +118,7 @@ public class BoardDelegate extends DelegateBase
|
||||||
private int[] m_missingCounts;
|
private int[] m_missingCounts;
|
||||||
private InviteMeans m_missingMeans = null;
|
private InviteMeans m_missingMeans = null;
|
||||||
private boolean m_progressShown = false;
|
private boolean m_progressShown = false;
|
||||||
|
private boolean m_isFirstLaunch;
|
||||||
private boolean m_firingPrefs;
|
private boolean m_firingPrefs;
|
||||||
private BoardUtilCtxt m_utils;
|
private BoardUtilCtxt m_utils;
|
||||||
private boolean m_gameOver = false;
|
private boolean m_gameOver = false;
|
||||||
|
@ -309,9 +310,8 @@ public class BoardDelegate extends DelegateBase
|
||||||
int title = (Integer)params[0];
|
int title = (Integer)params[0];
|
||||||
String msg = (String)params[1];
|
String msg = (String)params[1];
|
||||||
ab.setMessage( msg );
|
ab.setMessage( msg );
|
||||||
if ( 0 != title ) {
|
Assert.assertTrue( 0 != title );
|
||||||
ab.setTitle( title );
|
ab.setTitle( title );
|
||||||
}
|
|
||||||
ab.setPositiveButton( android.R.string.ok, null );
|
ab.setPositiveButton( android.R.string.ok, null );
|
||||||
if ( DlgID.DLG_SCORES == dlgID ) {
|
if ( DlgID.DLG_SCORES == dlgID ) {
|
||||||
if ( null != m_mySIS.words && m_mySIS.words.length > 0 ) {
|
if ( null != m_mySIS.words && m_mySIS.words.length > 0 ) {
|
||||||
|
@ -564,6 +564,7 @@ public class BoardDelegate extends DelegateBase
|
||||||
|
|
||||||
protected void init( Bundle savedInstanceState )
|
protected void init( Bundle savedInstanceState )
|
||||||
{
|
{
|
||||||
|
m_isFirstLaunch = null == savedInstanceState;
|
||||||
getBundledData( savedInstanceState );
|
getBundledData( savedInstanceState );
|
||||||
|
|
||||||
m_pendingChats = new ArrayList<String>();
|
m_pendingChats = new ArrayList<String>();
|
||||||
|
@ -1112,7 +1113,8 @@ public class BoardDelegate extends DelegateBase
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DISABLE_DUALPANE:
|
case DISABLE_DUALPANE:
|
||||||
XWPrefs.setPrefsBoolean( m_activity, R.string.key_disable_dualpane, true );
|
XWPrefs.setPrefsString( m_activity, R.string.key_force_tablet,
|
||||||
|
getString(R.string.force_tablet_phone) );
|
||||||
makeOkOnlyBuilder( R.string.after_restart ).show();
|
makeOkOnlyBuilder( R.string.after_restart ).show();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1183,7 +1185,7 @@ public class BoardDelegate extends DelegateBase
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inviteChoiceMade( Action action, InviteMeans means,
|
public void inviteChoiceMade( Action action, InviteMeans means,
|
||||||
Object[] params )
|
Object... params )
|
||||||
{
|
{
|
||||||
if ( action == Action.LAUNCH_INVITE_ACTION ) {
|
if ( action == Action.LAUNCH_INVITE_ACTION ) {
|
||||||
SentInvitesInfo info = params[0] instanceof SentInvitesInfo
|
SentInvitesInfo info = params[0] instanceof SentInvitesInfo
|
||||||
|
@ -1748,23 +1750,34 @@ public class BoardDelegate extends DelegateBase
|
||||||
|
|
||||||
// This is supposed to be called from the jni thread
|
// This is supposed to be called from the jni thread
|
||||||
@Override
|
@Override
|
||||||
public void notifyPickTileBlank( int playerNum, int col, int row, String[] texts )
|
public void notifyPickTileBlank( int playerNum, int col, int row,
|
||||||
|
String[] texts )
|
||||||
{
|
{
|
||||||
TilePickAlert.TilePickState tps =
|
final TilePickAlert.TilePickState tps =
|
||||||
new TilePickAlert.TilePickState( playerNum, texts, col, row );
|
new TilePickAlert.TilePickState( playerNum, texts, col, row );
|
||||||
|
runOnUiThread( new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
show( TilePickAlert.newInstance( Action.BLANK_PICKED, tps ) );
|
show( TilePickAlert.newInstance( Action.BLANK_PICKED, tps ) );
|
||||||
}
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void informNeedPickTiles( boolean isInitial,
|
public void informNeedPickTiles( boolean isInitial,
|
||||||
int playerNum, int nToPick,
|
int playerNum, int nToPick,
|
||||||
String[] texts, int[] counts )
|
String[] texts, int[] counts )
|
||||||
{
|
{
|
||||||
TilePickAlert.TilePickState tps
|
final TilePickAlert.TilePickState tps
|
||||||
= new TilePickAlert.TilePickState( isInitial, playerNum, nToPick,
|
= new TilePickAlert.TilePickState( isInitial, playerNum, nToPick,
|
||||||
texts, counts );
|
texts, counts );
|
||||||
|
runOnUiThread( new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
show( TilePickAlert.newInstance( Action.TRAY_PICKED, tps ) );
|
show( TilePickAlert.newInstance( Action.TRAY_PICKED, tps ) );
|
||||||
}
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void informNeedPassword( int player, String name )
|
public void informNeedPassword( int player, String name )
|
||||||
|
@ -2082,8 +2095,10 @@ public class BoardDelegate extends DelegateBase
|
||||||
gi.dictLang );
|
gi.dictLang );
|
||||||
break;
|
break;
|
||||||
case JNIThread.GAME_OVER:
|
case JNIThread.GAME_OVER:
|
||||||
|
if ( m_isFirstLaunch ) {
|
||||||
showDialogFragment( DlgID.GAME_OVER, m_summary, msg.arg1,
|
showDialogFragment( DlgID.GAME_OVER, m_summary, msg.arg1,
|
||||||
(String)msg.obj );
|
(String)msg.obj );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case JNIThread.MSGS_SENT:
|
case JNIThread.MSGS_SENT:
|
||||||
int nSent = (Integer)msg.obj;
|
int nSent = (Integer)msg.obj;
|
||||||
|
@ -2208,8 +2223,8 @@ public class BoardDelegate extends DelegateBase
|
||||||
m_relayMissing = false;
|
m_relayMissing = false;
|
||||||
}
|
}
|
||||||
if ( 0 == nMissing || !m_relayMissing ) {
|
if ( 0 == nMissing || !m_relayMissing ) {
|
||||||
|
Log.d( TAG, "dismissing invite alert %H", m_inviteAlert );
|
||||||
if ( null != m_inviteAlert ) {
|
if ( null != m_inviteAlert ) {
|
||||||
Log.d( TAG, "dismissing invite alert" );
|
|
||||||
m_inviteAlert.dismiss();
|
m_inviteAlert.dismiss();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2290,12 +2305,7 @@ public class BoardDelegate extends DelegateBase
|
||||||
Assert.fail();
|
Assert.fail();
|
||||||
}
|
}
|
||||||
|
|
||||||
final int fTitle = dlgTitle;
|
showDialogFragment( dlgID, dlgTitle, txt );
|
||||||
runOnUiThread( new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
showDialogFragment( dlgID, fTitle, txt );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showInviteAlertIf()
|
private void showInviteAlertIf()
|
||||||
|
@ -2794,8 +2804,10 @@ public class BoardDelegate extends DelegateBase
|
||||||
DBUtils.recordInviteSent( m_activity, m_rowid, means, dev );
|
DBUtils.recordInviteSent( m_activity, m_rowid, means, dev );
|
||||||
|
|
||||||
if ( !invitesSent ) {
|
if ( !invitesSent ) {
|
||||||
|
if ( null != m_inviteAlert ) {
|
||||||
m_inviteAlert.dismiss();
|
m_inviteAlert.dismiss();
|
||||||
m_inviteAlert = null;
|
m_inviteAlert = null;
|
||||||
|
}
|
||||||
Log.d( TAG, "recordInviteSent(): redoing invite alert" );
|
Log.d( TAG, "recordInviteSent(): redoing invite alert" );
|
||||||
showInviteAlertIf();
|
showInviteAlertIf();
|
||||||
}
|
}
|
||||||
|
@ -2813,12 +2825,19 @@ public class BoardDelegate extends DelegateBase
|
||||||
|
|
||||||
// If I'm upgrading and running this for the first time show an
|
// If I'm upgrading and running this for the first time show an
|
||||||
// explanation about the new dualpane feature
|
// explanation about the new dualpane feature
|
||||||
|
//
|
||||||
|
// TODO remove a few weeks after shipping a version that includes it
|
||||||
private static boolean s_dpShown = false;
|
private static boolean s_dpShown = false;
|
||||||
private void checkAddDualpaneExpl()
|
private void checkAddDualpaneExpl()
|
||||||
{
|
{
|
||||||
if ( !s_dpShown ) {
|
if ( !s_dpShown ) {
|
||||||
s_dpShown = true;
|
s_dpShown = true;
|
||||||
|
// Am I a tablet AND is that because my size says so rather than
|
||||||
|
// my having overridden it
|
||||||
if ( XWPrefs.getIsTablet( m_activity )
|
if ( XWPrefs.getIsTablet( m_activity )
|
||||||
|
&& getString(R.string.force_tablet_default)
|
||||||
|
.equals(XWPrefs.getPrefsString(m_activity,
|
||||||
|
R.string.key_force_tablet))
|
||||||
&& !Utils.onFirstVersion(m_activity ) ) {
|
&& !Utils.onFirstVersion(m_activity ) ) {
|
||||||
makeNotAgainBuilder( R.string.invite_dualpane,
|
makeNotAgainBuilder( R.string.invite_dualpane,
|
||||||
R.string.key_notagain_dualpane )
|
R.string.key_notagain_dualpane )
|
||||||
|
|
|
@ -26,6 +26,9 @@ import android.os.Bundle;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import org.eehouse.android.xw4.loc.LocUtils;
|
import org.eehouse.android.xw4.loc.LocUtils;
|
||||||
|
|
||||||
|
@ -62,12 +65,30 @@ public class DBAlert extends XWDialogFragment {
|
||||||
|
|
||||||
public DBAlert() {}
|
public DBAlert() {}
|
||||||
|
|
||||||
public DlgID getDlgID() { return mDlgID; }
|
public DlgID getDlgID() {
|
||||||
|
if ( null == mDlgID ) {
|
||||||
|
mDlgID = DlgID.values()[getArguments().getInt(DLG_ID_KEY, -1)];
|
||||||
|
}
|
||||||
|
return mDlgID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean belongsOnBackStack()
|
||||||
|
{
|
||||||
|
boolean result = getDlgID().belongsOnBackStack();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getFragTag()
|
||||||
|
{
|
||||||
|
return getDlgID().toString();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSaveInstanceState( Bundle bundle )
|
public void onSaveInstanceState( Bundle bundle )
|
||||||
{
|
{
|
||||||
bundle.putInt( DLG_ID_KEY, mDlgID.ordinal() );
|
bundle.putInt( DLG_ID_KEY, getDlgID().ordinal() );
|
||||||
bundle.putSerializable( PARMS_KEY, mParams );
|
bundle.putSerializable( PARMS_KEY, mParams );
|
||||||
super.onSaveInstanceState( bundle );
|
super.onSaveInstanceState( bundle );
|
||||||
}
|
}
|
||||||
|
@ -78,7 +99,6 @@ public class DBAlert extends XWDialogFragment {
|
||||||
if ( null == sis ) {
|
if ( null == sis ) {
|
||||||
sis = getArguments();
|
sis = getArguments();
|
||||||
}
|
}
|
||||||
mDlgID = DlgID.values()[sis.getInt(DLG_ID_KEY, -1)];
|
|
||||||
mParams = (Object[])sis.getSerializable(PARMS_KEY);
|
mParams = (Object[])sis.getSerializable(PARMS_KEY);
|
||||||
|
|
||||||
XWActivity activity = (XWActivity)getActivity();
|
XWActivity activity = (XWActivity)getActivity();
|
||||||
|
@ -87,7 +107,8 @@ public class DBAlert extends XWDialogFragment {
|
||||||
if ( null == dialog ) {
|
if ( null == dialog ) {
|
||||||
dialog = LocUtils.makeAlertBuilder( getActivity() )
|
dialog = LocUtils.makeAlertBuilder( getActivity() )
|
||||||
.setTitle( "Stub Alert" )
|
.setTitle( "Stub Alert" )
|
||||||
.setMessage( String.format( "Unable to create for %s", mDlgID.toString() ) )
|
.setMessage( String.format( "Unable to create for %s",
|
||||||
|
getDlgID().toString() ) )
|
||||||
.setPositiveButton( "Bummer", null )
|
.setPositiveButton( "Bummer", null )
|
||||||
// .setNegativeButton( "Try now", new OnClickListener() {
|
// .setNegativeButton( "Try now", new OnClickListener() {
|
||||||
// @Override
|
// @Override
|
||||||
|
@ -103,7 +124,7 @@ public class DBAlert extends XWDialogFragment {
|
||||||
public void run() {
|
public void run() {
|
||||||
MainActivity activity = (MainActivity)getActivity();
|
MainActivity activity = (MainActivity)getActivity();
|
||||||
if ( null != activity ) {
|
if ( null != activity ) {
|
||||||
DBAlert newMe = newInstance( mDlgID, mParams );
|
DBAlert newMe = newInstance( getDlgID(), mParams );
|
||||||
activity.show( newMe );
|
activity.show( newMe );
|
||||||
dismiss(); // kill myself...
|
dismiss(); // kill myself...
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -436,10 +436,14 @@ public class DelegateBase implements DlgClickNotify,
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void showDialogFragment( DlgID dlgID, Object... params )
|
protected void showDialogFragment( final DlgID dlgID, final Object... params )
|
||||||
{
|
{
|
||||||
DialogFragment fragment = DBAlert.newInstance( dlgID, params );
|
runOnUiThread( new Runnable() {
|
||||||
show( fragment );
|
@Override
|
||||||
|
public void run() {
|
||||||
|
show( DBAlert.newInstance( dlgID, params ) );
|
||||||
|
}
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void show( DlgState state )
|
protected void show( DlgState state )
|
||||||
|
@ -468,8 +472,9 @@ public class DelegateBase implements DlgClickNotify,
|
||||||
show( df );
|
show( df );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void show( DialogFragment df )
|
protected void show( XWDialogFragment df )
|
||||||
{
|
{
|
||||||
|
DbgUtils.assertOnUIThread();
|
||||||
if ( m_activity instanceof XWActivity ) {
|
if ( m_activity instanceof XWActivity ) {
|
||||||
((XWActivity)m_activity).show( df );
|
((XWActivity)m_activity).show( df );
|
||||||
} else if ( m_activity instanceof PrefsActivity ) {
|
} else if ( m_activity instanceof PrefsActivity ) {
|
||||||
|
@ -669,8 +674,7 @@ public class DelegateBase implements DlgClickNotify,
|
||||||
public boolean onPosButton( Action action, Object[] params )
|
public boolean onPosButton( Action action, Object[] params )
|
||||||
{
|
{
|
||||||
boolean handled = true;
|
boolean handled = true;
|
||||||
Log.d( TAG, "%s.posButtonClicked(%s)", getClass().getSimpleName(),
|
Log.d( TAG, "%s.onPosButton(%s)", getClass().getSimpleName(), action );
|
||||||
action.toString() );
|
|
||||||
switch( action ) {
|
switch( action ) {
|
||||||
case ENABLE_SMS_ASK:
|
case ENABLE_SMS_ASK:
|
||||||
showSMSEnableDialog( Action.ENABLE_SMS_DO );
|
showSMSEnableDialog( Action.ENABLE_SMS_DO );
|
||||||
|
@ -720,7 +724,7 @@ public class DelegateBase implements DlgClickNotify,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void inviteChoiceMade( Action action, DlgClickNotify.InviteMeans means, Object[] params )
|
public void inviteChoiceMade( Action action, DlgClickNotify.InviteMeans means, Object... params )
|
||||||
{
|
{
|
||||||
// Assert.fail();
|
// Assert.fail();
|
||||||
}
|
}
|
||||||
|
|
|
@ -301,7 +301,7 @@ public class DlgDelegate {
|
||||||
boolean onNegButton( Action action, Object... params );
|
boolean onNegButton( Action action, Object... params );
|
||||||
boolean onDismissed( Action action, Object... params );
|
boolean onDismissed( Action action, Object... params );
|
||||||
|
|
||||||
void inviteChoiceMade( Action action, InviteMeans means, Object[] params );
|
void inviteChoiceMade( Action action, InviteMeans means, Object... params );
|
||||||
}
|
}
|
||||||
public interface HasDlgDelegate {
|
public interface HasDlgDelegate {
|
||||||
OkOnlyBuilder makeOkOnlyBuilder( int msgID );
|
OkOnlyBuilder makeOkOnlyBuilder( int msgID );
|
||||||
|
@ -450,7 +450,7 @@ public class DlgDelegate {
|
||||||
public void run() {
|
public void run() {
|
||||||
DlgClickNotify.InviteMeans means
|
DlgClickNotify.InviteMeans means
|
||||||
= DlgClickNotify.InviteMeans.EMAIL;
|
= DlgClickNotify.InviteMeans.EMAIL;
|
||||||
m_clickCallback.inviteChoiceMade( action, means, null );
|
m_clickCallback.inviteChoiceMade( action, means );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,7 @@ abstract class DlgDelegateAlert extends XWDialogFragment {
|
||||||
|
|
||||||
protected final DlgState getState( Bundle sis )
|
protected final DlgState getState( Bundle sis )
|
||||||
{
|
{
|
||||||
|
if ( m_state == null ) {
|
||||||
if ( null != sis ) {
|
if ( null != sis ) {
|
||||||
m_state = (DlgState)sis.getParcelable( STATE_KEY );
|
m_state = (DlgState)sis.getParcelable( STATE_KEY );
|
||||||
} else {
|
} else {
|
||||||
|
@ -54,6 +55,7 @@ abstract class DlgDelegateAlert extends XWDialogFragment {
|
||||||
Assert.assertNotNull( args );
|
Assert.assertNotNull( args );
|
||||||
m_state = DlgState.fromBundle( args );
|
m_state = DlgState.fromBundle( args );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return m_state;
|
return m_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,12 +74,25 @@ abstract class DlgDelegateAlert extends XWDialogFragment {
|
||||||
@Override
|
@Override
|
||||||
public void onDismiss( DialogInterface dif )
|
public void onDismiss( DialogInterface dif )
|
||||||
{
|
{
|
||||||
|
super.onDismiss( dif );
|
||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
if ( activity instanceof DlgClickNotify ) {
|
if ( activity instanceof DlgClickNotify ) {
|
||||||
((DlgClickNotify)activity)
|
((DlgClickNotify)activity)
|
||||||
.onDismissed( m_state.m_action, m_state.m_params );
|
.onDismissed( m_state.m_action, m_state.m_params );
|
||||||
}
|
}
|
||||||
super.onDismiss( dif );
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getFragTag()
|
||||||
|
{
|
||||||
|
return getState(null).m_id.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean belongsOnBackStack()
|
||||||
|
{
|
||||||
|
boolean result = getState(null).m_id.belongsOnBackStack();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void checkNotAgainCheck( DlgState state, NotAgainView naView )
|
protected void checkNotAgainCheck( DlgState state, NotAgainView naView )
|
||||||
|
@ -100,7 +115,7 @@ abstract class DlgDelegateAlert extends XWDialogFragment {
|
||||||
@Override
|
@Override
|
||||||
public void onClick( DialogInterface dlg, int button ) {
|
public void onClick( DialogInterface dlg, int button ) {
|
||||||
checkNotAgainCheck( m_state, naView );
|
checkNotAgainCheck( m_state, naView );
|
||||||
XWActivity xwact = (XWActivity)getActivity();
|
DlgClickNotify xwact = (DlgClickNotify)getActivity();
|
||||||
xwact.onPosButton( pair.action, m_state.m_params );
|
xwact.onPosButton( pair.action, m_state.m_params );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,7 +22,6 @@ package org.eehouse.android.xw4;
|
||||||
|
|
||||||
public enum DlgID {
|
public enum DlgID {
|
||||||
NONE
|
NONE
|
||||||
, LOOKUP
|
|
||||||
, CHANGE_GROUP
|
, CHANGE_GROUP
|
||||||
, CONFIRM_CHANGE
|
, CONFIRM_CHANGE
|
||||||
, CONFIRM_CHANGE_PLAY
|
, CONFIRM_CHANGE_PLAY
|
||||||
|
@ -33,7 +32,7 @@ public enum DlgID {
|
||||||
, DICT_OR_DECLINE
|
, DICT_OR_DECLINE
|
||||||
, DLG_CONNSTAT
|
, DLG_CONNSTAT
|
||||||
, DLG_DELETED
|
, DLG_DELETED
|
||||||
, DLG_INVITE
|
, DLG_INVITE(true)
|
||||||
, DLG_OKONLY
|
, DLG_OKONLY
|
||||||
, ENABLE_NFC
|
, ENABLE_NFC
|
||||||
, FORCE_REMOTE
|
, FORCE_REMOTE
|
||||||
|
@ -64,10 +63,15 @@ public enum DlgID {
|
||||||
, ASK_PASSWORD
|
, ASK_PASSWORD
|
||||||
, DLG_RETRY
|
, DLG_RETRY
|
||||||
, DLG_SCORES
|
, DLG_SCORES
|
||||||
, PICK_TILE_REQUESTTRAY
|
|
||||||
, DLG_USEDICT
|
, DLG_USEDICT
|
||||||
, DLG_GETDICT
|
, DLG_GETDICT
|
||||||
, GAMES_LIST_NEWGAME
|
, GAMES_LIST_NEWGAME
|
||||||
, CHANGE_CONN
|
, CHANGE_CONN
|
||||||
, GAMES_LIST_NAME_REMATCH
|
, GAMES_LIST_NAME_REMATCH
|
||||||
|
;
|
||||||
|
|
||||||
|
private boolean m_addToStack;
|
||||||
|
private DlgID(boolean addToStack) { m_addToStack = addToStack; }
|
||||||
|
private DlgID() { m_addToStack = false; }
|
||||||
|
boolean belongsOnBackStack() { return m_addToStack; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class InviteChoicesAlert extends DlgDelegateAlert {
|
||||||
items.add( getString( R.string.invite_choice_relay ) );
|
items.add( getString( R.string.invite_choice_relay ) );
|
||||||
means.add( InviteMeans.RELAY );
|
means.add( InviteMeans.RELAY );
|
||||||
}
|
}
|
||||||
if ( WiDirService.enabled() ) {
|
if ( WiDirWrapper.enabled() ) {
|
||||||
items.add( getString( R.string.invite_choice_p2p ) );
|
items.add( getString( R.string.invite_choice_p2p ) );
|
||||||
means.add( InviteMeans.WIFIDIRECT );
|
means.add( InviteMeans.WIFIDIRECT );
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ import junit.framework.Assert;
|
||||||
import org.eehouse.android.xw4.loc.LocUtils;
|
import org.eehouse.android.xw4.loc.LocUtils;
|
||||||
|
|
||||||
public class LookupAlert extends XWDialogFragment {
|
public class LookupAlert extends XWDialogFragment {
|
||||||
|
private static final String TAG = LookupAlert.class.getSimpleName();
|
||||||
private LookupAlertView m_view;
|
private LookupAlertView m_view;
|
||||||
|
|
||||||
public static LookupAlert newInstance( String[] words, int lang, boolean noStudy )
|
public static LookupAlert newInstance( String[] words, int lang, boolean noStudy )
|
||||||
|
@ -73,4 +74,7 @@ public class LookupAlert extends XWDialogFragment {
|
||||||
result.setOnKeyListener( m_view );
|
result.setOnKeyListener( m_view );
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getFragTag() { return TAG; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class MainActivity extends XWActivity
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate( Bundle savedInstanceState )
|
protected void onCreate( Bundle savedInstanceState )
|
||||||
{
|
{
|
||||||
m_dpEnabled = XWPrefs.dualpaneEnabled( this );
|
m_dpEnabled = XWPrefs.getIsTablet( this );
|
||||||
|
|
||||||
m_dlgt = m_dpEnabled ? new DualpaneDelegate( this, savedInstanceState )
|
m_dlgt = m_dpEnabled ? new DualpaneDelegate( this, savedInstanceState )
|
||||||
: new GamesListDelegate( this, savedInstanceState );
|
: new GamesListDelegate( this, savedInstanceState );
|
||||||
|
@ -130,6 +130,7 @@ public class MainActivity extends XWActivity
|
||||||
if ( m_safeToCommit ) {
|
if ( m_safeToCommit ) {
|
||||||
handled = dispatchNewIntentImpl( intent );
|
handled = dispatchNewIntentImpl( intent );
|
||||||
} else {
|
} else {
|
||||||
|
DbgUtils.assertOnUIThread();
|
||||||
m_runWhenSafe.add( new Runnable() {
|
m_runWhenSafe.add( new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -300,7 +301,7 @@ public class MainActivity extends XWActivity
|
||||||
protected void finishFragment()
|
protected void finishFragment()
|
||||||
{
|
{
|
||||||
// Assert.assertTrue( fragment instanceof XWFragment );
|
// Assert.assertTrue( fragment instanceof XWFragment );
|
||||||
// DbgUtils.logf( "MainActivity.finishFragment(%s)", fragment.toString() );
|
// Log.d( TAG, "finishFragment()" );
|
||||||
getSupportFragmentManager().popBackStack/*Immediate*/();
|
getSupportFragmentManager().popBackStack/*Immediate*/();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,15 +359,28 @@ public class MainActivity extends XWActivity
|
||||||
private void logPaneFragments()
|
private void logPaneFragments()
|
||||||
{
|
{
|
||||||
if ( BuildConfig.DEBUG ) {
|
if ( BuildConfig.DEBUG ) {
|
||||||
List<String> pairs = new ArrayList<>();
|
List<String> panePairs = new ArrayList<>();
|
||||||
|
if ( null != m_root ) {
|
||||||
int childCount = m_root.getChildCount();
|
int childCount = m_root.getChildCount();
|
||||||
for ( int ii = 0; ii < childCount; ++ii ) {
|
for ( int ii = 0; ii < childCount; ++ii ) {
|
||||||
View child = m_root.getChildAt( ii );
|
View child = m_root.getChildAt( ii );
|
||||||
String name = findFragment( child ).getClass().getSimpleName();
|
String name = findFragment( child ).getClass().getSimpleName();
|
||||||
String pair = String.format("%d:%s", ii, name );
|
String pair = String.format("%d:%s", ii, name );
|
||||||
pairs.add( pair );
|
panePairs.add( pair );
|
||||||
}
|
}
|
||||||
Log.d( TAG, "logPaneFragments(): %s", TextUtils.join(", ", pairs) );
|
}
|
||||||
|
|
||||||
|
FragmentManager fm = getSupportFragmentManager();
|
||||||
|
List<String> fragPairs = new ArrayList<>();
|
||||||
|
int fragCount = fm.getBackStackEntryCount();
|
||||||
|
for ( int ii = 0; ii < fragCount; ++ii ) {
|
||||||
|
FragmentManager.BackStackEntry entry = fm.getBackStackEntryAt( ii );
|
||||||
|
String name = entry.getName();
|
||||||
|
String pair = String.format("%d:%s", ii, name );
|
||||||
|
fragPairs.add( pair );
|
||||||
|
}
|
||||||
|
Log.d( TAG, "panes: [%s]; frags: [%s]", TextUtils.join(",", panePairs),
|
||||||
|
TextUtils.join(",", fragPairs) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -452,6 +466,7 @@ public class MainActivity extends XWActivity
|
||||||
if ( m_safeToCommit ) {
|
if ( m_safeToCommit ) {
|
||||||
safeAddFragment( fragment, parentName );
|
safeAddFragment( fragment, parentName );
|
||||||
} else {
|
} else {
|
||||||
|
DbgUtils.assertOnUIThread();
|
||||||
m_runWhenSafe.add( new Runnable() {
|
m_runWhenSafe.add( new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -503,6 +518,7 @@ public class MainActivity extends XWActivity
|
||||||
|
|
||||||
private void setSafeToRun()
|
private void setSafeToRun()
|
||||||
{
|
{
|
||||||
|
DbgUtils.assertOnUIThread();
|
||||||
m_safeToCommit = true;
|
m_safeToCommit = true;
|
||||||
for ( Runnable proc : m_runWhenSafe ) {
|
for ( Runnable proc : m_runWhenSafe ) {
|
||||||
proc.run();
|
proc.run();
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class PrefsDelegate extends DelegateBase
|
||||||
R.string.key_disable_nag,
|
R.string.key_disable_nag,
|
||||||
R.string.key_disable_nag_solo,
|
R.string.key_disable_nag_solo,
|
||||||
R.string.key_disable_relay,
|
R.string.key_disable_relay,
|
||||||
R.string.key_disable_dualpane,
|
R.string.key_force_tablet,
|
||||||
};
|
};
|
||||||
private static Map<String, Integer> s_keysHash = null;
|
private static Map<String, Integer> s_keysHash = null;
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ public class PrefsDelegate extends DelegateBase
|
||||||
case R.string.key_disable_relay:
|
case R.string.key_disable_relay:
|
||||||
RelayService.enabledChanged( m_activity );
|
RelayService.enabledChanged( m_activity );
|
||||||
break;
|
break;
|
||||||
case R.string.key_disable_dualpane:
|
case R.string.key_force_tablet:
|
||||||
makeOkOnlyBuilder( R.string.after_restart ).show();
|
makeOkOnlyBuilder( R.string.after_restart ).show();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -367,7 +367,7 @@ public class PrefsDelegate extends DelegateBase
|
||||||
|
|
||||||
private void hideStuff()
|
private void hideStuff()
|
||||||
{
|
{
|
||||||
if ( !Utils.isGSMPhone( m_activity ) ) {
|
if ( !Utils.isGSMPhone( m_activity ) || Perms23.haveNativePerms() ) {
|
||||||
hideOne( R.string.key_enable_sms, R.string.key_network_behavior );
|
hideOne( R.string.key_enable_sms, R.string.key_network_behavior );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,14 +375,6 @@ public class PrefsDelegate extends DelegateBase
|
||||||
hideOne( R.string.key_hide_title, R.string.prefs_appearance );
|
hideOne( R.string.key_hide_title, R.string.prefs_appearance );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !XWPrefs.getIsTablet( m_activity ) ) {
|
|
||||||
hideOne( R.string.key_disable_dualpane, R.string.prefs_appearance );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( Perms23.haveNativePerms() ) {
|
|
||||||
hideOne( R.string.key_enable_sms, R.string.key_network_behavior );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! BuildConfig.WIDIR_ENABLED ) {
|
if ( ! BuildConfig.WIDIR_ENABLED ) {
|
||||||
hideOne( R.string.key_enable_p2p, R.string.key_network_behavior );
|
hideOne( R.string.key_enable_p2p, R.string.key_network_behavior );
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,6 +81,7 @@ public class SMSInviteDelegate extends InviteDelegate {
|
||||||
m_activity = delegator.getActivity();
|
m_activity = delegator.getActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void init( Bundle savedInstanceState )
|
protected void init( Bundle savedInstanceState )
|
||||||
{
|
{
|
||||||
String msg = getString( R.string.button_invite );
|
String msg = getString( R.string.button_invite );
|
||||||
|
@ -119,12 +120,17 @@ public class SMSInviteDelegate extends InviteDelegate {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onActivityResult( RequestCode requestCode, int resultCode,
|
protected void onActivityResult( RequestCode requestCode, int resultCode,
|
||||||
Intent data )
|
final Intent data )
|
||||||
{
|
{
|
||||||
if ( Activity.RESULT_CANCELED != resultCode && data != null ) {
|
if ( Activity.RESULT_CANCELED != resultCode && data != null ) {
|
||||||
switch ( requestCode ) {
|
switch ( requestCode ) {
|
||||||
case GET_CONTACT:
|
case GET_CONTACT:
|
||||||
|
post ( new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
addPhoneNumbers( data );
|
addPhoneNumbers( data );
|
||||||
|
}
|
||||||
|
} );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* -*- compile-command: "cd ../../../../../../../../ && ./gradlew installXw4Debug"; -*- */
|
/* -*- compile-command: "find-and-gradle.sh insXw4Deb"; -*- */
|
||||||
/*
|
/*
|
||||||
* Copyright 2017 by Eric House (xwords@eehouse.org). All rights reserved.
|
* Copyright 2017 by Eric House (xwords@eehouse.org). All rights reserved.
|
||||||
*
|
*
|
||||||
|
@ -39,6 +39,7 @@ import org.eehouse.android.xw4.loc.LocUtils;
|
||||||
|
|
||||||
public class TilePickAlert extends XWDialogFragment
|
public class TilePickAlert extends XWDialogFragment
|
||||||
implements TilePickView.TilePickListener {
|
implements TilePickView.TilePickListener {
|
||||||
|
private static final String TAG = TilePickAlert.class.getSimpleName();
|
||||||
private static final String TPS = "TPS";
|
private static final String TPS = "TPS";
|
||||||
private static final String ACTION = "ACTION";
|
private static final String ACTION = "ACTION";
|
||||||
private TilePickView m_view;
|
private TilePickView m_view;
|
||||||
|
@ -127,6 +128,8 @@ public class TilePickAlert extends XWDialogFragment
|
||||||
return m_dialog;
|
return m_dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected String getFragTag() { return TAG; }
|
||||||
|
|
||||||
// TilePickView.TilePickListener interface
|
// TilePickView.TilePickListener interface
|
||||||
@Override
|
@Override
|
||||||
public void onTilesChanged( int nToPick, int[] newTiles )
|
public void onTilesChanged( int nToPick, int[] newTiles )
|
||||||
|
|
|
@ -26,7 +26,10 @@ import android.content.Intent;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
|
import android.support.v4.app.FragmentManager;
|
||||||
|
import android.support.v4.app.FragmentTransaction;
|
||||||
import android.view.ContextMenu.ContextMenuInfo;
|
import android.view.ContextMenu.ContextMenuInfo;
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
@ -48,7 +51,8 @@ public class XWActivity extends FragmentActivity
|
||||||
protected void onCreate( Bundle savedInstanceState, DelegateBase dlgt )
|
protected void onCreate( Bundle savedInstanceState, DelegateBase dlgt )
|
||||||
{
|
{
|
||||||
if ( XWApp.LOG_LIFECYLE ) {
|
if ( XWApp.LOG_LIFECYLE ) {
|
||||||
Log.i( TAG, "onCreate(this=%H)", this );
|
Log.i( TAG, "%s.onCreate(this=%H,sis=%s)", getClass().getSimpleName(),
|
||||||
|
this, savedInstanceState );
|
||||||
}
|
}
|
||||||
super.onCreate( savedInstanceState );
|
super.onCreate( savedInstanceState );
|
||||||
m_dlgt = dlgt;
|
m_dlgt = dlgt;
|
||||||
|
@ -108,7 +112,7 @@ public class XWActivity extends FragmentActivity
|
||||||
protected void onStart()
|
protected void onStart()
|
||||||
{
|
{
|
||||||
if ( XWApp.LOG_LIFECYLE ) {
|
if ( XWApp.LOG_LIFECYLE ) {
|
||||||
Log.i( TAG, "%s.onStart(this=%H)", this );
|
Log.i( TAG, "%s.onStart(this=%H)", getClass().getSimpleName(), this );
|
||||||
}
|
}
|
||||||
super.onStart();
|
super.onStart();
|
||||||
m_dlgt.onStart();
|
m_dlgt.onStart();
|
||||||
|
@ -118,7 +122,7 @@ public class XWActivity extends FragmentActivity
|
||||||
protected void onStop()
|
protected void onStop()
|
||||||
{
|
{
|
||||||
if ( XWApp.LOG_LIFECYLE ) {
|
if ( XWApp.LOG_LIFECYLE ) {
|
||||||
Log.i( TAG, "%s.onStop(this=%H)", this );
|
Log.i( TAG, "%s.onStop(this=%H)", getClass().getSimpleName(), this );
|
||||||
}
|
}
|
||||||
m_dlgt.onStop();
|
m_dlgt.onStop();
|
||||||
super.onStop();
|
super.onStop();
|
||||||
|
@ -278,9 +282,23 @@ public class XWActivity extends FragmentActivity
|
||||||
Assert.fail();
|
Assert.fail();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void show( DialogFragment df )
|
protected void show( XWDialogFragment df )
|
||||||
{
|
{
|
||||||
df.show( getSupportFragmentManager(), "dialog" );
|
FragmentManager fm = getSupportFragmentManager();
|
||||||
|
String tag = df.getFragTag();
|
||||||
|
// Log.d( TAG, "show(%s); tag: %s", df.getClass().getSimpleName(), tag );
|
||||||
|
if ( df.belongsOnBackStack() ) {
|
||||||
|
FragmentTransaction trans = fm.beginTransaction();
|
||||||
|
|
||||||
|
Fragment prev = fm.findFragmentByTag( tag );
|
||||||
|
if ( null != prev && prev instanceof DialogFragment ) {
|
||||||
|
((DialogFragment)prev).dismiss();
|
||||||
|
}
|
||||||
|
trans.addToBackStack( tag );
|
||||||
|
df.show( trans, tag );
|
||||||
|
} else {
|
||||||
|
df.show( fm, tag );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Dialog makeDialog( DBAlert alert, Object[] params )
|
protected Dialog makeDialog( DBAlert alert, Object[] params )
|
||||||
|
@ -310,7 +328,7 @@ public class XWActivity extends FragmentActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inviteChoiceMade( Action action, InviteMeans means, Object[] params )
|
public void inviteChoiceMade( Action action, InviteMeans means, Object... params )
|
||||||
{
|
{
|
||||||
m_dlgt.inviteChoiceMade( action, means, params );
|
m_dlgt.inviteChoiceMade( action, means, params );
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ import java.util.Map;
|
||||||
|
|
||||||
import junit.framework.Assert;
|
import junit.framework.Assert;
|
||||||
|
|
||||||
public class XWDialogFragment extends DialogFragment {
|
abstract class XWDialogFragment extends DialogFragment {
|
||||||
private static final String TAG = XWDialogFragment.class.getSimpleName();
|
private static final String TAG = XWDialogFragment.class.getSimpleName();
|
||||||
|
|
||||||
private OnDismissListener m_onDismiss;
|
private OnDismissListener m_onDismiss;
|
||||||
|
@ -46,6 +46,8 @@ public class XWDialogFragment extends DialogFragment {
|
||||||
void onCancelled( XWDialogFragment frag );
|
void onCancelled( XWDialogFragment frag );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abstract String getFragTag();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume()
|
public void onResume()
|
||||||
{
|
{
|
||||||
|
@ -72,21 +74,26 @@ public class XWDialogFragment extends DialogFragment {
|
||||||
@Override
|
@Override
|
||||||
public void onCancel( DialogInterface dialog )
|
public void onCancel( DialogInterface dialog )
|
||||||
{
|
{
|
||||||
|
super.onCancel( dialog );
|
||||||
|
// Log.d( TAG, "%s.onCancel() called", getClass().getSimpleName() );
|
||||||
if ( null != m_onCancel ) {
|
if ( null != m_onCancel ) {
|
||||||
m_onCancel.onCancelled( this );
|
m_onCancel.onCancelled( this );
|
||||||
}
|
}
|
||||||
super.onCancel( dialog );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDismiss( DialogInterface dif )
|
public void onDismiss( DialogInterface dif )
|
||||||
{
|
{
|
||||||
|
// Log.d( TAG, "%s.onDismiss() called", getClass().getSimpleName() );
|
||||||
|
super.onDismiss( dif );
|
||||||
|
|
||||||
if ( null != m_onDismiss ) {
|
if ( null != m_onDismiss ) {
|
||||||
m_onDismiss.onDismissed( this );
|
m_onDismiss.onDismissed( this );
|
||||||
}
|
}
|
||||||
super.onDismiss( dif );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean belongsOnBackStack() { return false; }
|
||||||
|
|
||||||
protected void setOnDismissListener( OnDismissListener lstnr )
|
protected void setOnDismissListener( OnDismissListener lstnr )
|
||||||
{
|
{
|
||||||
Assert.assertTrue( null == lstnr || null == m_onDismiss || !BuildConfig.DEBUG );
|
Assert.assertTrue( null == lstnr || null == m_onDismiss || !BuildConfig.DEBUG );
|
||||||
|
|
|
@ -473,7 +473,7 @@ public class XWPrefs {
|
||||||
{
|
{
|
||||||
boolean result = isTablet( context );
|
boolean result = isTablet( context );
|
||||||
String setting = getPrefsString( context, R.string.key_force_tablet );
|
String setting = getPrefsString( context, R.string.key_force_tablet );
|
||||||
if ( setting.equals( context.getString(R.string.force_tablet_os) ) ) {
|
if ( setting.equals( context.getString(R.string.force_tablet_default) ) ) {
|
||||||
// Leave it alone
|
// Leave it alone
|
||||||
} else if ( setting.equals( context.getString(R.string.force_tablet_tablet) ) ) {
|
} else if ( setting.equals( context.getString(R.string.force_tablet_tablet) ) ) {
|
||||||
result = true;
|
result = true;
|
||||||
|
@ -485,11 +485,6 @@ public class XWPrefs {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean dualpaneEnabled( Context context )
|
|
||||||
{
|
|
||||||
return ! getPrefsBoolean( context, R.string.key_disable_dualpane, false );
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CommsConnTypeSet getAddrTypes( Context context )
|
public static CommsConnTypeSet getAddrTypes( Context context )
|
||||||
{
|
{
|
||||||
CommsConnTypeSet result;
|
CommsConnTypeSet result;
|
||||||
|
|
|
@ -69,7 +69,6 @@
|
||||||
<string name="key_summary_field">key_summary_field</string>
|
<string name="key_summary_field">key_summary_field</string>
|
||||||
<string name="key_default_loc">key_default_loc</string>
|
<string name="key_default_loc">key_default_loc</string>
|
||||||
<string name="key_force_tablet">key_force_tablet2</string>
|
<string name="key_force_tablet">key_force_tablet2</string>
|
||||||
<string name="key_disable_dualpane">key_disable_dualpane2</string>
|
|
||||||
<string name="key_force_radio">key_force_radio</string>
|
<string name="key_force_radio">key_force_radio</string>
|
||||||
<string name="key_addrs_pref">key_addrs_pref</string>
|
<string name="key_addrs_pref">key_addrs_pref</string>
|
||||||
|
|
||||||
|
@ -316,7 +315,7 @@
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="force_tablet_names">
|
<string-array name="force_tablet_names">
|
||||||
<item>@string/force_tablet_os</item>
|
<item>@string/force_tablet_default</item>
|
||||||
<item>@string/force_tablet_phone</item>
|
<item>@string/force_tablet_phone</item>
|
||||||
<item>@string/force_tablet_tablet</item>
|
<item>@string/force_tablet_tablet</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
|
@ -2316,12 +2316,10 @@
|
||||||
what\'s available.</string>
|
what\'s available.</string>
|
||||||
|
|
||||||
<string name="force_tablet_title">Use tablet (side-by-side) layout?</string>
|
<string name="force_tablet_title">Use tablet (side-by-side) layout?</string>
|
||||||
<string name="force_tablet_os">OS decides</string>
|
<string name="force_tablet_default">Use default for my device</string>
|
||||||
<string name="force_tablet_tablet">Force tablet layout</string>
|
<string name="force_tablet_tablet">Force tablet layout</string>
|
||||||
<string name="force_tablet_phone">Force phone layout</string>
|
<string name="force_tablet_phone">Force phone layout</string>
|
||||||
|
|
||||||
<string name="disable_dualpane_summary">Side-by-side views on tablets</string>
|
|
||||||
|
|
||||||
<!-- Nagging: title of notification reminder message -->
|
<!-- Nagging: title of notification reminder message -->
|
||||||
<string name="nag_title">Reminder: It\'s your turn</string>
|
<string name="nag_title">Reminder: It\'s your turn</string>
|
||||||
<!-- body of warning notification reminder message. First three
|
<!-- body of warning notification reminder message. First three
|
||||||
|
@ -2612,12 +2610,12 @@
|
||||||
<string name="no_invites">This game has sent no invitations</string>
|
<string name="no_invites">This game has sent no invitations</string>
|
||||||
|
|
||||||
<string name="invite_dualpane">This new version of CrossWords lets
|
<string name="invite_dualpane">This new version of CrossWords lets
|
||||||
devices like yours view two panes (e.g. Games List and Board)
|
larger-screened devices like yours view two panes (e.g. Games List
|
||||||
side-by-side. That\'s when your device is horizontal; when it\'s
|
and Board) side-by-side. You\'ll notice this when your device is
|
||||||
vertical there\'s no change.\n\n
|
horizontal; when it\'s vertical there\'s no change.\n\n
|
||||||
|
|
||||||
I hope you like it. If you don\'t you can disable it below or in App
|
I hope you like it. If you don\'t you can disable it below or in the
|
||||||
Settings.</string>
|
Appearance section of App Settings.</string>
|
||||||
|
|
||||||
<string name="disable_dualpane">Disable side-by-side</string>
|
<string name="disable_dualpane">Disable side-by-side</string>
|
||||||
<string name="after_restart">This change will take effect after you
|
<string name="after_restart">This change will take effect after you
|
||||||
|
|
|
@ -126,11 +126,15 @@
|
||||||
android:summary="@string/hide_title_summary"
|
android:summary="@string/hide_title_summary"
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
/>
|
/>
|
||||||
<CheckBoxPreference android:key="@string/key_disable_dualpane"
|
|
||||||
android:title="@string/disable_dualpane"
|
<org.eehouse.android.xw4.XWListPreference
|
||||||
android:summary="@string/disable_dualpane_summary"
|
android:key="@string/key_force_tablet"
|
||||||
android:defaultValue="false"
|
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"
|
<CheckBoxPreference android:key="@string/key_show_arrow"
|
||||||
android:title="@string/show_arrow"
|
android:title="@string/show_arrow"
|
||||||
android:summary="@string/show_arrow_summary"
|
android:summary="@string/show_arrow_summary"
|
||||||
|
@ -429,14 +433,6 @@
|
||||||
/>
|
/>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
||||||
<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_os"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<PreferenceScreen android:title="@string/pref_group_l10n_title"
|
<PreferenceScreen android:title="@string/pref_group_l10n_title"
|
||||||
android:summary="@string/pref_group_l10n_summary"
|
android:summary="@string/pref_group_l10n_summary"
|
||||||
>
|
>
|
||||||
|
|
Loading…
Add table
Reference in a new issue