Skip to content

Commit a0837c8

Browse files
committed
Version 1.15.0
- Migration to API 23 - Handling requesting permissions - Switching configurations in UART profile - New scanner compat library used for scanning
1 parent 341ecf5 commit a0837c8

File tree

125 files changed

+7851
-6010
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+7851
-6010
lines changed

.idea/encodings.xml

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 25 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/app.iml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@
7171
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
7272
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
7373
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
74-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.1/jars" />
75-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/design/22.2.1/jars" />
74+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.0/jars" />
75+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/design/23.0.0/jars" />
76+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/no.nordicsemi.android.support.v18/scanner/0.1.1/jars" />
7677
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
7778
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
7879
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
@@ -88,15 +89,18 @@
8889
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
8990
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
9091
</content>
91-
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
92+
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
9293
<orderEntry type="sourceFolder" forTests="false" />
9394
<orderEntry type="library" exported="" name="gson-2.3.1" level="project" />
94-
<orderEntry type="library" exported="" name="design-22.2.1" level="project" />
95+
<orderEntry type="library" exported="" name="design-23.0.0" level="project" />
9596
<orderEntry type="library" exported="" name="nrf-logger-v2.0" level="project" />
96-
<orderEntry type="library" exported="" name="support-v4-22.2.1" level="project" />
97+
<orderEntry type="library" exported="" name="stax-1.2.0" level="project" />
98+
<orderEntry type="library" exported="" name="scanner-0.1.1" level="project" />
9799
<orderEntry type="library" exported="" name="achartengine-1.1.0" level="project" />
98-
<orderEntry type="library" exported="" name="support-annotations-22.2.1" level="project" />
99-
<orderEntry type="library" exported="" name="appcompat-v7-22.2.1" level="project" />
100+
<orderEntry type="library" exported="" name="simple-xml-2.7.1" level="project" />
101+
<orderEntry type="library" exported="" name="appcompat-v7-23.0.0" level="project" />
102+
<orderEntry type="library" exported="" name="support-v4-23.0.0" level="project" />
103+
<orderEntry type="library" exported="" name="support-annotations-23.0.0" level="project" />
100104
<orderEntry type="module" module-name="dfu" exported="" />
101105
</component>
102106
</module>

app/build.gradle

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 22
5-
buildToolsVersion '22.0.1'
4+
compileSdkVersion 23
5+
buildToolsVersion '23.0.0'
66
defaultConfig {
77
applicationId "no.nordicsemi.android.nrftoolbox"
88
minSdkVersion 18
9-
targetSdkVersion 22
10-
versionCode 36
11-
versionName "1.14.3"
9+
targetSdkVersion 23
10+
versionCode 37
11+
versionName "1.15.0"
1212
}
1313
buildTypes {
1414
release {
@@ -20,8 +20,13 @@ android {
2020

2121
dependencies {
2222
compile fileTree(dir: 'libs', include: ['*.jar'])
23-
compile 'com.android.support:appcompat-v7:22.2.1'
24-
compile 'com.android.support:design:22.2.1'
23+
compile 'com.android.support:appcompat-v7:23.0.0'
24+
compile 'com.android.support:design:23.0.0'
25+
compile 'no.nordicsemi.android.support.v18:scanner:0.1.1'
26+
compile('org.simpleframework:simple-xml:2.7.1') {
27+
exclude group: 'stax', module: 'stax-api'
28+
exclude group: 'xpp3', module: 'xpp3'
29+
}
2530
compile project(':dfu')
2631
compile files('libs/achartengine-1.1.0.jar')
2732
compile files('libs/nrf-logger-v2.0.jar')

app/src/main/AndroidManifest.xml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,20 @@
2222
-->
2323
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2424
package="no.nordicsemi.android.nrftoolbox"
25-
android:installLocation="auto"
26-
android:versionCode="35"
27-
android:versionName="1.14.2" >
28-
29-
<uses-sdk
30-
android:minSdkVersion="18"
31-
android:targetSdkVersion="22" />
25+
android:installLocation="auto">
3226

3327
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
3428
<uses-permission android:name="android.permission.BLUETOOTH" />
3529
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
30+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
3631
<uses-permission android:name="no.nordicsemi.android.LOG" />
3732

3833
<uses-feature
3934
android:name="android.hardware.bluetooth_le"
4035
android:required="true" />
4136

4237
<application
38+
android:fullBackupContent="true"
4339
android:allowBackup="true"
4440
android:icon="@drawable/ic_launcher"
4541
android:label="@string/app_name"
@@ -183,7 +179,7 @@
183179
android:name="no.nordicsemi.android.nrftoolbox.uart.UARTActivity"
184180
android:icon="@drawable/ic_uart_feature"
185181
android:label="@string/uart_feature_title"
186-
android:windowSoftInputMode="stateHidden"
182+
android:windowSoftInputMode="adjustResize"
187183
android:launchMode="singleTask" >
188184
<intent-filter>
189185
<action android:name="android.intent.action.MAIN" />
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
* Copyright (c) 2015, Nordic Semiconductor
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6+
*
7+
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8+
*
9+
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the
10+
* documentation and/or other materials provided with the distribution.
11+
*
12+
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this
13+
* software without specific prior written permission.
14+
*
15+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
17+
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
18+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19+
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
20+
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21+
*/
22+
package no.nordicsemi.android.nrftoolbox;
23+
24+
import android.app.Dialog;
25+
import android.content.Context;
26+
import android.content.DialogInterface;
27+
import android.os.Bundle;
28+
import android.support.annotation.NonNull;
29+
import android.support.v4.app.DialogFragment;
30+
import android.support.v7.app.AlertDialog;
31+
32+
public class PermissionRationaleFragment extends DialogFragment {
33+
private static final String ARG_PERMISSION = "ARG_PERMISSION";
34+
private static final String ARG_TEXT = "ARG_TEXT";
35+
36+
private PermissionDialogListener mListener;
37+
38+
public interface PermissionDialogListener {
39+
public void onRequestPermission(final String permission);
40+
}
41+
42+
@Override
43+
public void onAttach(final Context context) {
44+
super.onAttach(context);
45+
46+
if (context instanceof PermissionDialogListener) {
47+
mListener = (PermissionDialogListener) context;
48+
} else {
49+
throw new IllegalArgumentException("The parent activity must impelemnt PermissionDialogListener");
50+
}
51+
}
52+
53+
@Override
54+
public void onDetach() {
55+
super.onDetach();
56+
mListener = null;
57+
}
58+
59+
public static PermissionRationaleFragment getInstance(final int aboutResId, final String permission) {
60+
final PermissionRationaleFragment fragment = new PermissionRationaleFragment();
61+
62+
final Bundle args = new Bundle();
63+
args.putInt(ARG_TEXT, aboutResId);
64+
args.putString(ARG_PERMISSION, permission);
65+
fragment.setArguments(args);
66+
67+
return fragment;
68+
}
69+
70+
@Override
71+
@NonNull
72+
public Dialog onCreateDialog(final Bundle savedInstanceState) {
73+
final Bundle args = getArguments();
74+
final StringBuilder text = new StringBuilder(getString(args.getInt(ARG_TEXT)));
75+
return new AlertDialog.Builder(getActivity()).setTitle(R.string.permission_title).setMessage(text)
76+
.setNegativeButton(R.string.cancel, null)
77+
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
78+
@Override
79+
public void onClick(final DialogInterface dialog, final int which) {
80+
mListener.onRequestPermission(args.getString(ARG_PERMISSION));
81+
}
82+
}).create();
83+
}
84+
}

app/src/main/java/no/nordicsemi/android/nrftoolbox/csc/CSCService.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import android.content.SharedPreferences;
3333
import android.preference.PreferenceManager;
3434
import android.support.v4.content.LocalBroadcastManager;
35+
import android.support.v7.app.NotificationCompat;
3536

3637
import no.nordicsemi.android.log.Logger;
3738
import no.nordicsemi.android.nrftoolbox.FeaturesActivity;
@@ -138,7 +139,7 @@ public void onWheelMeasurementReceived(final int wheelRevolutions, final int las
138139
return;
139140

140141
if (mLastWheelRevolutions >= 0) {
141-
float timeDifference = 0;
142+
float timeDifference;
142143
if (lastWheelEventTime < mLastWheelEventTime)
143144
timeDifference = (65535 + lastWheelEventTime - mLastWheelEventTime) / 1024.0f; // [s]
144145
else
@@ -167,7 +168,7 @@ public void onCrankMeasurementReceived(int crankRevolutions, int lastCrankEventT
167168
return;
168169

169170
if (mLastCrankRevolutions >= 0) {
170-
float timeDifference = 0;
171+
float timeDifference;
171172
if (lastCrankEventTime < mLastCrankEventTime)
172173
timeDifference = (65535 + lastCrankEventTime - mLastCrankEventTime) / 1024.0f; // [s]
173174
else
@@ -206,11 +207,12 @@ private void createNotification(final int messageResId, final int defaults) {
206207

207208
// both activities above have launchMode="singleTask" in the AndroidManifest.xml file, so if the task is already running, it will be resumed
208209
final PendingIntent pendingIntent = PendingIntent.getActivities(this, OPEN_ACTIVITY_REQ, new Intent[] { parentIntent, targetIntent }, PendingIntent.FLAG_UPDATE_CURRENT);
209-
final Notification.Builder builder = new Notification.Builder(this).setContentIntent(pendingIntent);
210+
final NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
211+
builder.setContentIntent(pendingIntent);
210212
builder.setContentTitle(getString(R.string.app_name)).setContentText(getString(messageResId, getDeviceName()));
211213
builder.setSmallIcon(R.drawable.ic_stat_notify_csc);
212214
builder.setShowWhen(defaults != 0).setDefaults(defaults).setAutoCancel(true).setOngoing(true);
213-
builder.addAction(R.drawable.ic_action_bluetooth, getString(R.string.csc_notification_action_disconnect), disconnectAction);
215+
builder.addAction(new NotificationCompat.Action(R.drawable.ic_action_bluetooth, getString(R.string.csc_notification_action_disconnect), disconnectAction));
214216

215217
final Notification notification = builder.build();
216218
final NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

0 commit comments

Comments
 (0)