build with SDK version 23

Meant using NotificationCompat, dropping FloatMath, and changing a bunch
of build config stuff. Not done for gradle builds yet. Currently crashes
on a new install until you go into Apps/Crosswords/Permissions and turn
on the four "dangerous" ones it's using. Now the work is to check for
and request missing permissions on demand.
This commit is contained in:
Eric House 2016-10-31 07:46:04 -07:00
parent 579f11613f
commit b56c4d13b4
6 changed files with 54 additions and 29 deletions

View file

@ -1,19 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- -*- compile-command: "ant install"; -*- -->
<!-- Copyright (C) 2007 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- Declare the contents of this Android application. The namespace
attribute brings in the Android platform namespace, and the package
@ -26,10 +11,10 @@
android:versionName="@string/app_version"
>
<!-- BE SURE TO MODIFY project.project AND the variable TARGET in
<!-- BE SURE TO MODIFY project.properties AND the variable TARGET in
../scripts/setup_local_props.sh if targetSdkVersion changes!!!
-->
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="19" />
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="23" />
<supports-screens android:resizeable="true"
android:smallScreens="true"

View file

@ -11,4 +11,4 @@
# proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-19
target=android-23

View file

@ -27,7 +27,6 @@ import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.FloatMath;
import android.view.MotionEvent;
import android.view.View;
@ -383,7 +382,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
} else {
float xx = event.getX( 0 ) - event.getX( 1 );
float yy = event.getY( 0 ) - event.getY( 1 );
result = (int)FloatMath.sqrt( (xx * xx) + (yy * yy) );
result = (int)Math.sqrt( (xx * xx) + (yy * yy) );
}
return result;
}

View file

@ -0,0 +1,33 @@
/* -*- compile-command: "find-and-ant.sh debug install"; -*- */
/*
* Copyright 2009-2010 by Eric House (xwords@eehouse.org). All
* rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.eehouse.android.xw4;
public class Perms23 {
public static enum PermString {
READ_PHONE_STATE("android.permission.READ_PHONE_STATE");
private String m_str;
private PermString(String str) { m_str = str; }
public String toString() { return m_str; }
}
}

View file

@ -33,12 +33,15 @@ import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Configuration;
import android.database.Cursor;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.provider.ContactsContract.PhoneLookup;
import android.support.v4.app.NotificationCompat;
import android.telephony.TelephonyManager;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@ -213,19 +216,24 @@ public class Utils {
: PendingIntent.getActivity( context, Utils.nextRandomInt(), intent,
PendingIntent.FLAG_ONE_SHOT );
Notification notification =
new Notification( R.drawable.icon48x48, title,
System.currentTimeMillis() );
notification.flags |= Notification.FLAG_AUTO_CANCEL;
int defaults = Notification.FLAG_AUTO_CANCEL;
if ( CommonPrefs.getSoundNotify( context ) ) {
notification.defaults |= Notification.DEFAULT_SOUND;
defaults |= Notification.DEFAULT_SOUND;
}
if ( CommonPrefs.getVibrateNotify( context ) ) {
notification.defaults |= Notification.DEFAULT_VIBRATE;
defaults |= Notification.DEFAULT_VIBRATE;
}
notification.setLatestEventInfo( context, title, body, pi );
Notification notification = new NotificationCompat.Builder( context )
.setContentIntent( pi )
.setSmallIcon( R.drawable.icon48x48 ) // CHANGE ME!!!
//.setTicker(body)
//.setWhen(time)
.setAutoCancel( true )
.setDefaults( defaults )
.setContentTitle( title )
.setContentText( body )
.build();
NotificationManager nm = (NotificationManager)
context.getSystemService( Context.NOTIFICATION_SERVICE );

View file

@ -2,7 +2,7 @@
set -u -e
TARGET="android-19"
TARGET="android-23"
usage() {
echo "usage: $0 [--target TARGET]"