cleanup: use import more for new class

This commit is contained in:
Eric House 2016-12-28 13:52:04 -08:00
parent 497567ac2d
commit 531f30aae8
5 changed files with 24 additions and 25 deletions

View file

@ -54,6 +54,7 @@ import junit.framework.Assert;
import org.eehouse.android.xw4.DBUtils.SentInvitesInfo;
import org.eehouse.android.xw4.DlgDelegate.Action;
import org.eehouse.android.xw4.DlgDelegate.ActionPair;
import org.eehouse.android.xw4.Perms23.Perm;
import org.eehouse.android.xw4.Toolbar.Buttons;
import org.eehouse.android.xw4.jni.CommonPrefs;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
@ -725,12 +726,12 @@ public class BoardDelegate extends DelegateBase
boolean showRationale )
{
Perms23.Builder builder =
new Perms23.Builder( Perms23.Perm.READ_PHONE_STATE );
new Perms23.Builder( Perm.READ_PHONE_STATE );
if ( showRationale ) {
builder.setOnShowRationale( new Perms23.OnShowRationale() {
@Override
public void onShouldShowRationale( Set<Perms23.Perm> perms )
public void onShouldShowRationale( Set<Perm> perms )
{
makeOkOnlyBuilder( R.string.phone_state_rationale )
.setAction( Action.RETRY_PHONE_STATE_ACTION )
@ -742,7 +743,7 @@ public class BoardDelegate extends DelegateBase
builder.asyncQuery( m_activity, new Perms23.PermCbck() {
@Override
public void onPermissionResult( Map<Perms23.Perm,
public void onPermissionResult( Map<Perm,
Boolean> perms )
{
// Do the work regardless of result; just won't have
@ -2229,13 +2230,13 @@ public class BoardDelegate extends DelegateBase
&& null == m_permCbck ) { // already asked?
m_permCbck = new Perms23.PermCbck() {
@Override
public void onPermissionResult( Map<Perms23.Perm,
public void onPermissionResult( Map<Perm,
Boolean> perms )
{
ActionPair pair = new ActionPair( Action.DROP_SMS_ACTION,
R.string.remove_sms );
if ( ! perms.get(Perms23.Perm.SEND_SMS) ) {
if ( ! perms.get(Perm.SEND_SMS) ) {
makeNotAgainBuilder( R.string.not_again_missing_perms,
R.string.key_notagain_missing_perms )
.setActionPair( pair )
@ -2243,7 +2244,7 @@ public class BoardDelegate extends DelegateBase
}
}
};
new Perms23.Builder(Perms23.Perm.SEND_SMS)
new Perms23.Builder(Perm.SEND_SMS)
.asyncQuery( m_activity, m_permCbck );
}
}

View file

@ -53,6 +53,7 @@ import org.eehouse.android.xw4.DlgDelegate.ActionPair;
import org.eehouse.android.xw4.DlgDelegate.NAKey;
import org.eehouse.android.xw4.DwnldDelegate.DownloadFinishedListener;
import org.eehouse.android.xw4.DwnldDelegate.OnGotLcDictListener;
import org.eehouse.android.xw4.Perms23.Perm;
import org.eehouse.android.xw4.jni.CommonPrefs;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnTypeSet;
import org.eehouse.android.xw4.jni.CommsAddrRec;
@ -1560,14 +1561,14 @@ public class GamesListDelegate extends ListDelegateBase
break;
case R.id.games_menu_loaddb:
new Perms23.Builder( Perms23.Perm.STORAGE )
new Perms23.Builder( Perm.STORAGE )
.asyncQuery( m_activity, new Perms23.PermCbck() {
@Override
public void onPermissionResult( Map<Perms23.Perm,
public void onPermissionResult( Map<Perm,
Boolean> granted )
{
Assert.assertTrue( granted.containsKey(Perms23.Perm.STORAGE) );
if ( granted.get(Perms23.Perm.STORAGE) ) {
Assert.assertTrue( granted.containsKey(Perm.STORAGE) );
if ( granted.get(Perm.STORAGE) ) {
DBUtils.loadDB( m_activity );
XWPrefs.clearGroupPositions( m_activity );
mkListAdapter();
@ -1576,13 +1577,13 @@ public class GamesListDelegate extends ListDelegateBase
} );
break;
case R.id.games_menu_storedb:
new Perms23.Builder( Perms23.Perm.STORAGE )
new Perms23.Builder( Perm.STORAGE )
.asyncQuery( m_activity, new Perms23.PermCbck() {
@Override
public void onPermissionResult( Map<Perms23.Perm, Boolean> granted )
public void onPermissionResult( Map<Perm, Boolean> granted )
{
Assert.assertTrue( granted.containsKey( Perms23.Perm.STORAGE ) );
if ( granted.get( Perms23.Perm.STORAGE ) ) {
Assert.assertTrue( granted.containsKey( Perm.STORAGE ) );
if ( granted.get( Perm.STORAGE ) ) {
DBUtils.saveDB( m_activity );
showToast( R.string.db_store_done );
}

View file

@ -61,7 +61,7 @@ public class Perms23 {
void onPermissionResult( Map<Perm, Boolean> perms );
}
public interface OnShowRationale {
void onShouldShowRationale( Set<Perms23.Perm> perms );
void onShouldShowRationale( Set<Perm> perms );
}
public static class Builder {

View file

@ -39,6 +39,7 @@ import junit.framework.Assert;
import org.eehouse.android.xw4.DBUtils.SentInvitesInfo;
import org.eehouse.android.xw4.DlgDelegate.Action;
import org.eehouse.android.xw4.Perms23.Perm;
import java.util.ArrayList;
import java.util.Collections;
@ -57,9 +58,6 @@ public class SMSInviteDelegate extends InviteDelegate {
R.id.button_clear,
};
private static final String SAVE_NAME = "SAVE_NAME";
private static final String SAVE_NUMBER = "SAVE_NUMBER";
private ArrayList<PhoneRec> m_phoneRecs;
private boolean m_immobileConfirmed;
private Activity m_activity;
@ -91,8 +89,6 @@ public class SMSInviteDelegate extends InviteDelegate {
super.init( msg, R.string.empty_sms_inviter );
addButtonBar( R.layout.sms_buttons, BUTTONIDS );
// getBundledData( savedInstanceState );
getSavedState();
rebuildList( true );
@ -339,11 +335,11 @@ public class SMSInviteDelegate extends InviteDelegate {
private void askContactsPermission( boolean showRationale )
{
Perms23.Builder builder = new Perms23.Builder( Perms23.Perm.READ_CONTACTS );
Perms23.Builder builder = new Perms23.Builder( Perm.READ_CONTACTS );
if ( showRationale ) {
builder.setOnShowRationale( new Perms23.OnShowRationale() {
@Override
public void onShouldShowRationale( Set<Perms23.Perm> perms )
public void onShouldShowRationale( Set<Perm> perms )
{
makeOkOnlyBuilder( R.string.contacts_rationale )
.setAction( Action.RETRY_CONTACTS_ACTION )

View file

@ -63,6 +63,7 @@ import java.util.Random;
import junit.framework.Assert;
import org.eehouse.android.xw4.Perms23.Perm;
import org.eehouse.android.xw4.jni.CommonPrefs;
import org.eehouse.android.xw4.loc.LocUtils;
@ -113,7 +114,7 @@ public class Utils {
public static boolean isGSMPhone( Context context )
{
boolean result = false;
if ( Perms23.havePermission( Perms23.Perm.READ_PHONE_STATE ) ) {
if ( Perms23.havePermission( Perm.READ_PHONE_STATE ) ) {
SMSService.SMSPhoneInfo info = SMSService.getPhoneInfo( context );
result = info.isPhone && info.isGSM;
}
@ -129,7 +130,7 @@ public class Utils {
public static boolean deviceSupportsSMS( Context context )
{
boolean result = false;
if ( Perms23.havePermission( Perms23.Perm.READ_PHONE_STATE ) ) {
if ( Perms23.havePermission( Perm.READ_PHONE_STATE ) ) {
TelephonyManager tm = (TelephonyManager)
context.getSystemService( Context.TELEPHONY_SERVICE );
result = null != tm;
@ -283,7 +284,7 @@ public class Utils {
synchronized ( s_phonesHash ) {
if ( s_phonesHash.containsKey( phone ) ) {
name = s_phonesHash.get( phone );
} else if ( Perms23.havePermission( Perms23.Perm.READ_CONTACTS ) ) {
} else if ( Perms23.havePermission( Perm.READ_CONTACTS ) ) {
try {
ContentResolver contentResolver = context
.getContentResolver();