mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-07 20:46:17 +01:00
use a radio button for QRCode option
To make it clear it's an option like the others use the same widget type. Show the code only when it's selected.
This commit is contained in:
parent
98f8056b40
commit
5485f92116
7 changed files with 56 additions and 25 deletions
|
@ -1373,7 +1373,7 @@ public class BoardDelegate extends DelegateBase
|
|||
SentInvitesInfo info = 0 < params.length
|
||||
&& params[0] instanceof SentInvitesInfo
|
||||
? (SentInvitesInfo)params[0] : null;
|
||||
switch( means ) {
|
||||
switch ( means ) {
|
||||
case NFC:
|
||||
if ( ! NFCUtils.nfcAvail( m_activity )[1] ) {
|
||||
showDialogFragment( DlgID.ENABLE_NFC );
|
||||
|
@ -1423,6 +1423,8 @@ public class BoardDelegate extends DelegateBase
|
|||
recordInviteSent( means, null );
|
||||
|
||||
break;
|
||||
case QRCODE:
|
||||
break; // nothing to do
|
||||
default:
|
||||
Assert.failDbg();
|
||||
}
|
||||
|
|
|
@ -342,7 +342,8 @@ public class DlgDelegate {
|
|||
RELAY(R.string.invite_choice_relay, false),
|
||||
WIFIDIRECT(R.string.invite_choice_p2p, false),
|
||||
SMS_USER(R.string.invite_choice_user_sms, false), // just launch the SMS app, as with email
|
||||
MQTT(R.string.invite_choice_mqtt, false);
|
||||
MQTT(R.string.invite_choice_mqtt, false),
|
||||
QRCODE(R.string.invite_choice_qrcode, true);
|
||||
|
||||
private InviteMeans( int resid, boolean local) {
|
||||
mResID = resid;
|
||||
|
|
|
@ -103,6 +103,7 @@ public class InviteChoicesAlert extends DlgDelegateAlert
|
|||
means.add( InviteMeans.NFC );
|
||||
}
|
||||
means.add( InviteMeans.CLIPBOARD );
|
||||
means.add( InviteMeans.QRCODE );
|
||||
|
||||
int lastSelMeans = -1;
|
||||
if ( null != lastMeans ) {
|
||||
|
@ -174,9 +175,10 @@ public class InviteChoicesAlert extends DlgDelegateAlert
|
|||
{
|
||||
DlgDelegate.Builder builder = null;
|
||||
XWActivity activity = (XWActivity)getActivity();
|
||||
|
||||
switch ( means ) {
|
||||
case SMS_USER:
|
||||
builder =activity
|
||||
builder = activity
|
||||
.makeNotAgainBuilder( R.string.sms_invite_flakey,
|
||||
R.string.key_na_sms_invite_flakey );
|
||||
break;
|
||||
|
@ -187,6 +189,11 @@ public class InviteChoicesAlert extends DlgDelegateAlert
|
|||
builder = activity
|
||||
.makeNotAgainBuilder(msg, R.string.key_na_clip_expl);
|
||||
break;
|
||||
case QRCODE:
|
||||
builder = activity
|
||||
.makeNotAgainBuilder( R.string.qrcode_invite_expl,
|
||||
R.string.key_na_qrcode_invite );
|
||||
break;
|
||||
case SMS_DATA:
|
||||
if ( !Perms23.havePermissions( activity, Perm.SEND_SMS, Perm.RECEIVE_SMS )
|
||||
&& Perm.SEND_SMS.isBanned(activity) ) {
|
||||
|
|
|
@ -94,8 +94,8 @@ public class InviteView extends ScrollView
|
|||
.inflate( context, R.layout.invite_radio );
|
||||
button.setText( LocUtils.getString( context, means.getUserDescID() ) );
|
||||
int where = means.isForLocal()
|
||||
// -2: place before QR code and its explanatory text
|
||||
? mGroupHow.getChildCount() - 2
|
||||
// -1: place before QRcode-wrapper
|
||||
? mGroupHow.getChildCount() - 1
|
||||
: mGroupHow.indexOfChild( divider );
|
||||
mGroupHow.addView( button, where );
|
||||
mHowMeans.put( button, means );
|
||||
|
@ -147,7 +147,6 @@ public class InviteView extends ScrollView
|
|||
Object result = null;
|
||||
RadioButton checked = getCurCheckedFor();
|
||||
if ( null != checked ) {
|
||||
// result = new InviteChoice();
|
||||
if ( mIsWho ) {
|
||||
result = mWhoPlayers.get(checked);
|
||||
} else {
|
||||
|
@ -170,6 +169,7 @@ public class InviteView extends ScrollView
|
|||
RadioButton button = (RadioButton)group.findViewById(checkedId);
|
||||
InviteMeans means = mHowMeans.get( button );
|
||||
mProcs.meansClicked( means );
|
||||
setShowQR( means.equals( InviteMeans.QRCODE ) );
|
||||
break;
|
||||
case R.id.group_who:
|
||||
break;
|
||||
|
@ -177,6 +177,12 @@ public class InviteView extends ScrollView
|
|||
}
|
||||
}
|
||||
|
||||
private void setShowQR( boolean show )
|
||||
{
|
||||
findViewById( R.id.qrcode_stuff )
|
||||
.setVisibility( show ? View.VISIBLE: View.GONE );
|
||||
}
|
||||
|
||||
private RadioButton getCurCheckedFor()
|
||||
{
|
||||
RadioButton result = null;
|
||||
|
|
|
@ -63,28 +63,35 @@
|
|||
/>
|
||||
|
||||
<!-- intro for QR code: these two elems stay at the bottom -->
|
||||
<LinearLayout android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
<LinearLayout android:id="@+id/qrcode_stuff"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:visibility="gone"
|
||||
>
|
||||
<TextView android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/qrcode_invite_summary"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_weight="1"
|
||||
/>
|
||||
<org.eehouse.android.xw4.ExpandImageButton android:id="@+id/expander"
|
||||
style="@style/expander_button"
|
||||
android:layout_weight="0"
|
||||
/>
|
||||
<LinearLayout android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
>
|
||||
<TextView android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/qrcode_invite_summary"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_weight="1"
|
||||
/>
|
||||
<org.eehouse.android.xw4.ExpandImageButton android:id="@+id/expander"
|
||||
style="@style/expander_button"
|
||||
android:layout_weight="0"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<ImageView android:id="@+id/qr_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:paddingTop="10dp"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<ImageView android:id="@+id/qr_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:paddingTop="10dp"
|
||||
/>
|
||||
</RadioGroup>
|
||||
<TextView android:id="@+id/who_empty"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -132,6 +132,7 @@
|
|||
<string name="key_na_fmt_expl">key_na_fmt_expl</string>
|
||||
<string name="key_na_clip_expl">key_na_clip_expl</string>
|
||||
<string name="key_na_sms_invite_flakey">key_na_sms_invite_flakey</string>
|
||||
<string name="key_na_qrcode_invite">key_na_qrcode_invite</string>
|
||||
<string name="key_na_dicts">key_na_dicts</string>
|
||||
<string name="key_enable_debug">key_enable_debug</string>
|
||||
<string name="key_enable_pending_count">key_enable_pending_count</string>
|
||||
|
|
|
@ -519,6 +519,12 @@
|
|||
<string name="invit_expl_player_fmt">Invite forwarded via MQTT/internet
|
||||
to known player “%1$s” on %2$s.</string>
|
||||
|
||||
<!-- Explanation shown when you choose the radio button to invite
|
||||
by QR Code -->
|
||||
<string name="qrcode_invite_expl">To invite via QRCode, let your
|
||||
opponent scan the code with his/her phone (using the Camera app’s
|
||||
“Lens” feature or a QR-reader app.)</string>
|
||||
|
||||
<!-- Short for "points", this is shown at the right end of the
|
||||
tray in place of the first tile placed along with the points
|
||||
the current move would earn if committed. -->
|
||||
|
@ -1028,6 +1034,7 @@
|
|||
<string name="invite_choice_nfc">NFC (“Android beaming”)</string>
|
||||
<string name="invite_choice_relay">Internet/Relay</string>
|
||||
<string name="invite_choice_p2p">Wifi Direct</string>
|
||||
<string name="invite_choice_qrcode">QR Code (below)</string>
|
||||
<string name="invite_choice_title">Inviting a Player</string>
|
||||
|
||||
<!-- Text above choices for how to send invitations == ONLY WHEN
|
||||
|
|
Loading…
Add table
Reference in a new issue