mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-23 07:27:22 +01:00
add newbie hints to checkboxes enabling communication types (bt, sms,
etc.)
This commit is contained in:
parent
4f53ccd5db
commit
63aae3d4e8
10 changed files with 919 additions and 837 deletions
File diff suppressed because it is too large
Load diff
|
@ -14,4 +14,12 @@
|
|||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<CheckBox android:id="@+id/default_check"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/dicts_item_select"
|
||||
android:layout_marginLeft="20dip"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -128,6 +128,10 @@
|
|||
<string name="key_invite_multi">key_invite_multi</string>
|
||||
<string name="key_notagain_enablepublic">key_notagain_enablepublic</string>
|
||||
|
||||
<string name="key_na_comms_bt">key_na_comms_bt</string>
|
||||
<string name="key_na_comms_sms">key_na_comms_sms</string>
|
||||
<string name="key_na_comms_relay">key_na_comms_relay</string>
|
||||
|
||||
<!-- Nor is my email address -->
|
||||
<string name="email_author_email">xwords@eehouse.org</string>
|
||||
|
||||
|
|
|
@ -2493,4 +2493,8 @@
|
|||
|
||||
<string name="button_enable">Enable</string>
|
||||
|
||||
<string name="not_again_comms_relay">About relay connecting</string>
|
||||
<string name="not_again_comms_sms">About SMS connecting</string>
|
||||
<string name="not_again_comms_bt">About BT connecting</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -2155,4 +2155,7 @@
|
|||
<string name="confirm_drop_relay_sms">Ton lla sreirrac troppus yalp
|
||||
aiv SMS.</string>
|
||||
<string name="button_enable">Elbane</string>
|
||||
<string name="not_again_comms_relay">Tuoba yaler gnitcennoc</string>
|
||||
<string name="not_again_comms_sms">Tuoba SMS gnitcennoc</string>
|
||||
<string name="not_again_comms_bt">Tuoba TB gnitcennoc</string>
|
||||
</resources>
|
||||
|
|
|
@ -2155,4 +2155,7 @@
|
|||
<string name="confirm_drop_relay_sms">NOT ALL CARRIERS SUPPORT PLAY
|
||||
VIA SMS.</string>
|
||||
<string name="button_enable">ENABLE</string>
|
||||
<string name="not_again_comms_relay">ABOUT RELAY CONNECTING</string>
|
||||
<string name="not_again_comms_sms">ABOUT SMS CONNECTING</string>
|
||||
<string name="not_again_comms_bt">ABOUT BT CONNECTING</string>
|
||||
</resources>
|
||||
|
|
|
@ -33,8 +33,11 @@ import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
|
|||
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnTypeSet;
|
||||
import org.eehouse.android.xw4.loc.LocUtils;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
public class ConnViaViewLayout extends LinearLayout {
|
||||
private CommsConnTypeSet m_curSet;
|
||||
private DlgDelegate.HasDlgDelegate m_dlgDlgt;
|
||||
|
||||
public interface CheckEnabledWarner {
|
||||
public void warnDisabled( CommsConnType typ );
|
||||
|
@ -52,7 +55,8 @@ public class ConnViaViewLayout extends LinearLayout {
|
|||
|
||||
protected void configure( CommsConnTypeSet types,
|
||||
CheckEnabledWarner cew,
|
||||
SetEmptyWarner sew )
|
||||
SetEmptyWarner sew,
|
||||
DlgDelegate.HasDlgDelegate dlgDlgt )
|
||||
{
|
||||
m_curSet = (CommsConnTypeSet)types.clone();
|
||||
|
||||
|
@ -60,6 +64,7 @@ public class ConnViaViewLayout extends LinearLayout {
|
|||
|
||||
m_disabledWarner = cew;
|
||||
m_emptyWarner = sew;
|
||||
m_dlgDlgt = dlgDlgt;
|
||||
}
|
||||
|
||||
protected CommsConnTypeSet getTypes()
|
||||
|
@ -88,6 +93,7 @@ public class ConnViaViewLayout extends LinearLayout {
|
|||
public void onCheckedChanged( CompoundButton buttonView,
|
||||
boolean isChecked ) {
|
||||
if ( isChecked ) {
|
||||
showNotAgainTypeTip( typf );
|
||||
enabledElseWarn( typf );
|
||||
m_curSet.add( typf );
|
||||
} else {
|
||||
|
@ -117,4 +123,32 @@ public class ConnViaViewLayout extends LinearLayout {
|
|||
m_disabledWarner.warnDisabled( typ );
|
||||
}
|
||||
}
|
||||
|
||||
private void showNotAgainTypeTip( CommsConnType typ )
|
||||
{
|
||||
if ( null != m_dlgDlgt ) {
|
||||
int keyID = 0;
|
||||
int msgID = 0;
|
||||
switch( typ ) {
|
||||
case COMMS_CONN_RELAY:
|
||||
msgID = R.string.not_again_comms_relay;
|
||||
keyID = R.string.key_na_comms_relay;
|
||||
break;
|
||||
case COMMS_CONN_SMS:
|
||||
msgID = R.string.not_again_comms_sms;
|
||||
keyID = R.string.key_na_comms_sms;
|
||||
break;
|
||||
case COMMS_CONN_BT:
|
||||
msgID = R.string.not_again_comms_bt;
|
||||
keyID = R.string.key_na_comms_bt;
|
||||
break;
|
||||
default:
|
||||
Assert.fail();
|
||||
break;
|
||||
}
|
||||
m_dlgDlgt.showNotAgainDlgThen( msgID, keyID,
|
||||
DlgDelegate.Action.SKIP_CALLBACK );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -285,11 +285,18 @@ public class GameConfigDelegate extends DelegateBase
|
|||
LinearLayout layout = (LinearLayout)inflate( R.layout.conn_types_display );
|
||||
final ConnViaViewLayout items = (ConnViaViewLayout)
|
||||
layout.findViewById( R.id.conn_types );
|
||||
final CheckBox cb = (CheckBox)layout
|
||||
.findViewById(R.id.default_check);
|
||||
cb.setVisibility( View.VISIBLE );
|
||||
|
||||
final DialogInterface.OnClickListener lstnr =
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick( DialogInterface dlg, int button ) {
|
||||
m_conTypes = items.getTypes();
|
||||
if ( cb.isChecked()) {
|
||||
XWPrefs.setAddrTypes( m_activity, m_conTypes );
|
||||
}
|
||||
|
||||
m_car.populate( m_activity, m_conTypes );
|
||||
|
||||
setConnLabel();
|
||||
|
@ -349,7 +356,7 @@ public class GameConfigDelegate extends DelegateBase
|
|||
break;
|
||||
}
|
||||
}
|
||||
}, null );
|
||||
}, null, this );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,8 @@ import android.preference.PreferenceActivity;
|
|||
import org.eehouse.android.xw4.loc.LocUtils;
|
||||
import org.eehouse.android.xw4.DlgDelegate.Action;
|
||||
|
||||
public class PrefsActivity extends PreferenceActivity implements Delegator {
|
||||
public class PrefsActivity extends PreferenceActivity
|
||||
implements Delegator, DlgDelegate.HasDlgDelegate {
|
||||
|
||||
private PrefsDelegate m_dlgt;
|
||||
|
||||
|
@ -88,11 +89,22 @@ public class PrefsActivity extends PreferenceActivity implements Delegator {
|
|||
super.onDestroy();
|
||||
}
|
||||
|
||||
protected void showOKOnlyDialog( int msgID )
|
||||
public void showOKOnlyDialog( int msgID )
|
||||
{
|
||||
m_dlgt.showOKOnlyDialog( msgID );
|
||||
}
|
||||
|
||||
public void showOKOnlyDialog( String msg )
|
||||
{
|
||||
m_dlgt.showOKOnlyDialog( msg );
|
||||
}
|
||||
|
||||
public void showNotAgainDlgThen( int msgID, int prefsKey,
|
||||
DlgDelegate.Action action )
|
||||
{
|
||||
m_dlgt.showNotAgainDlgThen( msgID, prefsKey, action );
|
||||
}
|
||||
|
||||
protected void showConfirmThen( int msg, int posButton, int negButton,
|
||||
Action action )
|
||||
{
|
||||
|
|
|
@ -55,10 +55,10 @@ public class XWConnAddrPreference extends DialogPreference {
|
|||
{
|
||||
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 ),
|
||||
new ConnViaViewLayout.CheckEnabledWarner() {
|
||||
public void warnDisabled( CommsConnType typ ) {
|
||||
PrefsActivity activity = (PrefsActivity)m_context;
|
||||
switch( typ ) {
|
||||
case COMMS_CONN_SMS:
|
||||
activity.showConfirmThen( R.string.warn_sms_disabled,
|
||||
|
@ -80,7 +80,7 @@ public class XWConnAddrPreference extends DialogPreference {
|
|||
PrefsActivity activity = (PrefsActivity)m_context;
|
||||
activity.showOKOnlyDialog( R.string.warn_no_comms );
|
||||
}
|
||||
} );
|
||||
}, activity );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue