add special title to permissions rationale alerts

This commit is contained in:
Eric House 2016-12-31 16:27:17 -08:00
parent 8c7e1646fa
commit 59c80f8277
9 changed files with 35 additions and 23 deletions

View file

@ -5040,6 +5040,7 @@ XLATE-ME
explanation of the above
*/
public static final int peek_other_summary=0x7f05015d;
public static final int perms_rationale_title=0x7f050361;
/**
<string name="phone_label">Connected number[s]:</string>
@ -6887,9 +6888,7 @@ string name="str_robot_moved">O robô fez esta jogada:\u0020</string
feature is not yet supported on Android.)
*/
public static final int title_tile_picker=0x7f0501b4;
/** <string name="perms_rationale_title">Android Permissions</string>
*/
public static final int toast_no_permission=0x7f050361;
public static final int toast_no_permission=0x7f050362;
/** <string name="update_dicts_fmt">Updates are available for one or more
installed wordlists. Would you like to download the new
version[s] of %1$s now?</string>

View file

@ -2734,9 +2734,8 @@
deny permission.
</string>
<string name="phone_lookup_rationale">Crosswords needs your phone
number to initialize a game played via SMS, and needs your
permission now in order to access it.</string>
<string name="phone_lookup_rationale">To rematch a game using SMS
Crosswords needs permission to access your phone number.</string>
<!-- Case where SMS is the only way the game can communicate -->
<string name="phone_lookup_rationale_drop">Rematching this SMS-only
@ -2755,7 +2754,7 @@
<string name="contact_not_found">Not in Contacts</string>
<string name="sms_send_failed">SMS send failed</string>
<!-- <string name="perms_rationale_title">Android Permissions</string> -->
<string name="perms_rationale_title">Android Permissions</string>
<string name="toast_no_permission">Permission not granted</string>
</resources>

View file

@ -2334,9 +2334,8 @@
e(.g. esuaceb uoy yap rof hcae ,)egassem ti\'s efas ot yltnenamrep
yned noissimrep.
</string>
<string name="phone_lookup_rationale">Sdrowssorc sdeen ruoy enohp
rebmun ot ezilaitini a emag deyalp aiv ,SMs dna sdeen ruoy
noissimrep won ni redro ot ssecca ti.</string>
<string name="phone_lookup_rationale">Ot hctamer a emag gnisu SMS
Sdrowssorc sdeen noissimrep ot ssecca ruoy enohp rebmun.</string>
<!-- Case where SMS is the only way the game can communicate -->
<string name="phone_lookup_rationale_drop">Gnihctamer siht YLNo-sms
emag si ton elbissop tuohtiw siht noissimrep.</string>
@ -2351,6 +2350,6 @@
<string name="remove_sms">Evomer SMS</string>
<string name="contact_not_found">Ton ni Stcatnoc</string>
<string name="sms_send_failed">SMS dnes deliaf</string>
<!-- <string name="perms_rationale_title">Android Permissions</string> -->
<string name="perms_rationale_title">Diordna Snoissimrep</string>
<string name="toast_no_permission">Noissimrep ton detnarg</string>
</resources>

View file

@ -2334,9 +2334,8 @@
(E.G. BECAUSE YOU PAY FOR EACH MESSAGE), IT\'S SAFE TO PERMANENTLY
DENY PERMISSION.
</string>
<string name="phone_lookup_rationale">CROSSWORDS NEEDS YOUR PHONE
NUMBER TO INITIALIZE A GAME PLAYED VIA SMS, AND NEEDS YOUR
PERMISSION NOW IN ORDER TO ACCESS IT.</string>
<string name="phone_lookup_rationale">TO REMATCH A GAME USING SMS
CROSSWORDS NEEDS PERMISSION TO ACCESS YOUR PHONE NUMBER.</string>
<!-- Case where SMS is the only way the game can communicate -->
<string name="phone_lookup_rationale_drop">REMATCHING THIS SMS-ONLY
GAME IS NOT POSSIBLE WITHOUT THIS PERMISSION.</string>
@ -2351,6 +2350,6 @@
<string name="remove_sms">REMOVE SMS</string>
<string name="contact_not_found">NOT IN CONTACTS</string>
<string name="sms_send_failed">SMS SEND FAILED</string>
<!-- <string name="perms_rationale_title">Android Permissions</string> -->
<string name="perms_rationale_title">ANDROID PERMISSIONS</string>
<string name="toast_no_permission">PERMISSION NOT GRANTED</string>
</resources>

View file

@ -736,6 +736,7 @@ public class BoardDelegate extends DelegateBase
public void onShouldShowRationale( Set<Perm> perms )
{
makeOkOnlyBuilder( R.string.phone_state_rationale )
.setTitle( R.string.perms_rationale_title )
.setAction( Action.RETRY_PHONE_STATE_ACTION )
.setParams( action, info )
.show();

View file

@ -165,6 +165,7 @@ public class DlgDelegate {
protected int m_negButton = android.R.string.cancel;
protected Action m_action;
protected Object[] m_params;
protected int m_titleId = 0;
public DlgDelegateBuilder( String msg, Action action )
{ m_msgString = msg; m_action = action; }
@ -196,11 +197,13 @@ public class DlgDelegate {
public OkOnlyBuilder(int msgId) { super( msgId, Action.SKIP_CALLBACK ); }
public OkOnlyBuilder setAction( Action action )
{ m_action = action; return this; }
public OkOnlyBuilder setTitle( int titleId )
{ m_titleId = titleId; return this; }
@Override
public void show()
{
showOKOnlyDialogThen( m_msgString, m_action, m_params );
showOKOnlyDialogThen( m_msgString, m_action, m_params, m_titleId );
}
}
@ -208,11 +211,14 @@ public class DlgDelegate {
public ConfirmThenBuilder(String msg, Action action) {super(msg, action);}
public ConfirmThenBuilder(int msgId, Action action) {super(msgId, action);}
public ConfirmThenBuilder setTitle( int titleId )
{ m_titleId = titleId; return this; }
@Override
public void show()
{
showConfirmThen( m_nakey, m_onNA, m_msgString, m_posButton,
m_negButton, m_action, m_params );
m_negButton, m_action, m_titleId, m_params );
}
}
@ -412,12 +418,13 @@ public class DlgDelegate {
}
private void showOKOnlyDialogThen( String msg, Action action,
Object[] params )
Object[] params, int titleId )
{
// Assert.assertNull( m_dlgStates );
DlgState state = new DlgState( DlgID.DIALOG_OKONLY )
.setMsg( msg )
.setParams( params )
.setTitle( titleId )
.setAction(action);
addState( state );
showDialog( DlgID.DIALOG_OKONLY );
@ -471,8 +478,9 @@ public class DlgDelegate {
}
}
private void showConfirmThen( NAKey nakey, Runnable onNA, String msg, int posButton,
int negButton, Action action, Object[] params )
private void showConfirmThen( NAKey nakey, Runnable onNA, String msg,
int posButton, int negButton, Action action,
int titleId, Object[] params )
{
if ( null != nakey ) {
Assert.assertNull( onNA );
@ -484,6 +492,7 @@ public class DlgDelegate {
.setPosButton( posButton )
.setNegButton( negButton )
.setAction( action )
.setTitle( titleId )
.setParams( params );
addState( state );
showDialog( DlgID.CONFIRM_THEN );
@ -662,7 +671,7 @@ public class DlgDelegate {
private Dialog createOKDialog( DlgState state, DlgID dlgID )
{
Dialog dialog = LocUtils.makeAlertBuilder( m_activity )
.setTitle( R.string.info_title )
.setTitle( state.m_titleId == 0 ? R.string.info_title : state.m_titleId )
.setMessage( state.m_msg )
.setPositiveButton( android.R.string.ok, null )
.create();
@ -711,7 +720,7 @@ public class DlgDelegate {
OnClickListener lstnr = mkCallbackClickListener( state, naView );
AlertDialog.Builder builder = LocUtils.makeAlertBuilder( m_activity )
.setTitle( R.string.query_title )
.setTitle( state.m_titleId == 0 ? R.string.query_title : state.m_titleId )
.setView( naView )
.setPositiveButton( state.m_posButton, lstnr )
.setNegativeButton( state.m_negButton, lstnr );

View file

@ -37,6 +37,7 @@ public class DlgState implements Parcelable {
// These can't be serialized!!!!
public Object[] m_params;
public Runnable m_onNAChecked;
public int m_titleId;
public DlgState( DlgID dlgID )
{
@ -59,6 +60,8 @@ public class DlgState implements Parcelable {
{ m_posButton = id; return this; }
public DlgState setNegButton( int id )
{ m_negButton = id; return this; }
public DlgState setTitle( int id )
{ m_titleId = id; return this; }
public int describeContents() {
return 0;
@ -70,6 +73,7 @@ public class DlgState implements Parcelable {
out.writeInt( m_negButton );
out.writeInt( null == m_action ? -1 : m_action.ordinal() );
out.writeInt( m_prefsKey );
out.writeInt( m_titleId );
out.writeString( m_msg );
}
@ -82,6 +86,7 @@ public class DlgState implements Parcelable {
int tmp = in.readInt();
Action action = 0 > tmp ? null : Action.values()[tmp];
int prefsKey = in.readInt();
int titleId = in.readInt();
String msg = in.readString();
DlgState state = new DlgState(id)
.setMsg( msg )

View file

@ -2189,7 +2189,7 @@ public class GamesListDelegate extends ListDelegateBase
String msg = getString( R.string.phone_lookup_rationale )
+ "\n\n" + getString( id );
makeConfirmThenBuilder( msg, Action.RETRY_REMATCH )
// .setTitle( R.string.perms_rationale_title )
.setTitle( R.string.perms_rationale_title )
.setParams( gameName )
.show();
}

View file

@ -338,6 +338,7 @@ public class SMSInviteDelegate extends InviteDelegate {
public void onShouldShowRationale( Set<Perm> perms )
{
makeOkOnlyBuilder( R.string.contacts_rationale )
.setTitle( R.string.perms_rationale_title )
.setAction( Action.RETRY_CONTACTS_ACTION )
.show();
}