Skip to content

Commit

Permalink
Version 1.14.0
Browse files Browse the repository at this point in the history
Switching to AppCompatActivity, better Navigation drawer, DFU bug fixed.
  • Loading branch information
philips77 committed Jun 4, 2015
1 parent fe23ee9 commit 93e2bb2
Show file tree
Hide file tree
Showing 93 changed files with 4,689 additions and 3,958 deletions.
15 changes: 8 additions & 7 deletions app/app.iml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="nRFToolbox" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="nRFToolbox" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
Expand All @@ -12,8 +12,9 @@
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugAndroidTestSources" />
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugAndroidTestSources" />
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
Expand Down Expand Up @@ -85,13 +86,13 @@
</content>
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="appcompat-v7-22.1.1" level="project" />
<orderEntry type="library" exported="" name="gson-2.3.1" level="project" />
<orderEntry type="library" exported="" name="design-22.2.0" level="project" />
<orderEntry type="library" exported="" name="nrf-logger-v2.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-22.2.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-22.2.0" level="project" />
<orderEntry type="library" exported="" name="achartengine-1.1.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-22.1.1" level="project" />
<orderEntry type="library" exported="" name="support-annotations-22.1.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-22.2.0" level="project" />
<orderEntry type="module" module-name="dfu" exported="" />
</component>
</module>

</module>
7 changes: 4 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "no.nordicsemi.android.nrftoolbox"
minSdkVersion 18
targetSdkVersion 22
versionCode 32
versionName "1.13.1"
versionCode 33
versionName "1.14.0"
}
buildTypes {
release {
Expand All @@ -20,7 +20,8 @@ android {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:design:22.2.0'
compile project(':..:DFULibrary:dfu')
compile files('libs/achartengine-1.1.0.jar')
compile files('libs/nrf-logger-v2.0.jar')
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="no.nordicsemi.android.nrftoolbox"
android:installLocation="auto"
android:versionCode="32"
android:versionName="1.13.1" >
android:versionCode="33"
android:versionName="1.14.1" >

<uses-sdk
android:minSdkVersion="18"
Expand Down Expand Up @@ -57,6 +57,7 @@
<activity
android:name="no.nordicsemi.android.nrftoolbox.FeaturesActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.TranslucentStatusBar"
android:launchMode="singleTask" >
</activity>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@
*/
package no.nordicsemi.android.nrftoolbox;

import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;

public class AppHelpFragment extends DialogFragment {
private static final String ARG_TEXT = "ARG_TEXT";
Expand Down Expand Up @@ -54,6 +55,7 @@ public static AppHelpFragment getInstance(final int aboutResId) {
}

@Override
@NonNull
public Dialog onCreateDialog(final Bundle savedInstanceState) {
final Bundle args = getArguments();
final StringBuilder text = new StringBuilder(getString(args.getInt(ARG_TEXT)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@
import android.os.Bundle;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
Expand All @@ -50,7 +51,7 @@

import no.nordicsemi.android.nrftoolbox.adapter.AppAdapter;

public class FeaturesActivity extends ActionBarActivity {
public class FeaturesActivity extends AppCompatActivity {
private static final String MCP_CATEGORY = "no.nordicsemi.android.nrftoolbox.LAUNCHER";
private static final String UTILS_CATEGORY = "no.nordicsemi.android.nrftoolbox.UTILS";
private static final String MCP_PACKAGE = "no.nordicsemi.android.mcp";
Expand All @@ -65,6 +66,9 @@ protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_features);

final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_actionbar);
setSupportActionBar(toolbar);

// ensure that Bluetooth exists
if (!ensureBLEExists())
finish();
Expand All @@ -73,7 +77,13 @@ protected void onCreate(final Bundle savedInstanceState) {
drawer.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);

// Set the drawer toggle as the DrawerListener
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.drawer_open, R.string.drawer_close);
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.drawer_open, R.string.drawer_close) {
@Override
public void onDrawerSlide(final View drawerView, final float slideOffset) {
// Disable the Hamburger icon animation
super.onDrawerSlide(drawerView, 0);
}
};
drawer.setDrawerListener(mDrawerToggle);

// setup plug-ins in the drawer
Expand Down Expand Up @@ -117,7 +127,7 @@ public boolean onOptionsItemSelected(final MenuItem item) {
switch (item.getItemId()) {
case R.id.action_about:
final AppHelpFragment fragment = AppHelpFragment.getInstance(R.string.about_text, true);
fragment.show(getFragmentManager(), null);
fragment.show(getSupportFragmentManager(), null);
break;
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
import android.app.Activity;
import android.database.Cursor;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View;
Expand Down Expand Up @@ -132,7 +133,7 @@
* @see #setListAdapter
* @see android.widget.ExpandableListView
*/
public class ExpandableListActivity extends ActionBarActivity implements
public class ExpandableListActivity extends AppCompatActivity implements
OnCreateContextMenuListener,
ExpandableListView.OnChildClickListener, ExpandableListView.OnGroupCollapseListener,
ExpandableListView.OnGroupExpandListener {
Expand Down Expand Up @@ -182,18 +183,18 @@ public void onGroupExpand(int groupPosition) {
* @see Activity#onRestoreInstanceState(Bundle)
*/
@Override
protected void onRestoreInstanceState(Bundle state) {
protected void onRestoreInstanceState(@NonNull Bundle state) {
ensureList();
super.onRestoreInstanceState(state);
}

/**
* Updates the screen state (current list and other views) when the content changes.
*
* @see ActionBarActivity#onSupportContentChanged()
* @see android.support.v7.app.AppCompatActivity#onContentChanged()
*/
@Override
public void onSupportContentChanged() {
public void onContentChanged() {
super.onContentChanged();
View emptyView = findViewById(R.id.empty);
mList = (ExpandableListView) findViewById(R.id.list);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class BPMActivity extends BleProfileActivity implements BPMManagerCallbac
private TextView mTimestampView;

@Override
protected void onCreateView(Bundle savedInstanceState) {
protected void onCreateView(final Bundle savedInstanceState) {
setContentView(R.layout.activity_feature_bpm);
setGUI();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,25 @@
package no.nordicsemi.android.nrftoolbox.csc.settings;

import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;

public class SettingsActivity extends ActionBarActivity {
import no.nordicsemi.android.nrftoolbox.R;

public class SettingsActivity extends AppCompatActivity {

@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);

final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_actionbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);

// Display the fragment as the main content.
getFragmentManager().beginTransaction().replace(android.R.id.content, new SettingsFragment()).commit();
getFragmentManager().beginTransaction().replace(R.id.content, new SettingsFragment()).commit();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@

import android.app.ActivityManager;
import android.app.ActivityManager.RunningServiceInfo;
import android.app.AlertDialog;
import android.app.FragmentManager;
import android.app.LoaderManager.LoaderCallbacks;
import android.app.NotificationManager;
import android.bluetooth.BluetoothAdapter;
Expand All @@ -47,8 +45,9 @@
import android.preference.PreferenceManager;
import android.provider.MediaStore;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.view.Menu;
import android.view.MenuItem;
Expand Down Expand Up @@ -81,7 +80,7 @@
* DeviceScannerFragment.OnDeviceSelectedListener callback to receive callback when device is selected from scanning dialog The activity supports portrait and
* landscape orientations
*/
public class DfuActivity extends ActionBarActivity implements LoaderCallbacks<Cursor>, ScannerFragment.OnDeviceSelectedListener,
public class DfuActivity extends AppCompatActivity implements LoaderCallbacks<Cursor>, ScannerFragment.OnDeviceSelectedListener,
UploadCancelFragment.CancelFragmentListener {
private static final String TAG = "DfuActivity";

Expand Down Expand Up @@ -197,8 +196,9 @@ protected void onSaveInstanceState(final Bundle outState) {
}

private void setGUI() {
final ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_actionbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);

mDeviceNameView = (TextView) findViewById(R.id.device_name);
mFileNameView = (TextView) findViewById(R.id.file_name);
Expand Down Expand Up @@ -270,9 +270,8 @@ private void showBLEDialog() {
}

private void showDeviceScanningDialog() {
final FragmentManager fm = getFragmentManager();
final ScannerFragment dialog = ScannerFragment.getInstance(DfuActivity.this, null, false); // Device that is advertising directly does not have the GENERAL_DISCOVERABLE nor LIMITED_DISCOVERABLE flag set.
dialog.show(fm, "scan_fragment");
dialog.show(getSupportFragmentManager(), "scan_fragment");
}

private void ensureSamplesExist() {
Expand Down Expand Up @@ -436,7 +435,7 @@ public boolean onOptionsItemSelected(final MenuItem item) {
break;
case R.id.action_about:
final AppHelpFragment fragment = AppHelpFragment.getInstance(R.string.dfu_about_text);
fragment.show(getFragmentManager(), "help_fragment");
fragment.show(getSupportFragmentManager(), "help_fragment");
break;
case R.id.action_settings:
final Intent intent = new Intent(this, SettingsActivity.class);
Expand Down Expand Up @@ -676,7 +675,7 @@ public void onClick(final DialogInterface dialog, final int which) {
@Override
public void onClick(final DialogInterface dialog, final int which) {
final ZipInfoFragment fragment = new ZipInfoFragment();
fragment.show(getFragmentManager(), "help_fragment");
fragment.show(getSupportFragmentManager(), "help_fragment");
}
}).setNegativeButton(R.string.cancel, null).show();
}
Expand Down Expand Up @@ -763,7 +762,7 @@ private void showUploadCancelDialog() {
manager.sendBroadcast(pauseAction);

final UploadCancelFragment fragment = UploadCancelFragment.getInstance();
fragment.show(getFragmentManager(), TAG);
fragment.show(getSupportFragmentManager(), TAG);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@

package no.nordicsemi.android.nrftoolbox.dfu;

import android.app.Activity;
import android.bluetooth.BluetoothDevice;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import no.nordicsemi.android.nrftoolbox.scanner.ScannerFragment;

/**
* The activity is started only by a remote connected computer using ADB. It shows a list of DFU-supported devices in range and allows user to select target device. The HEX file will be uploaded to
* selected device using {@link DfuService}.
*/
public class DfuInitiatorActivity extends Activity implements ScannerFragment.OnDeviceSelectedListener {
public class DfuInitiatorActivity extends AppCompatActivity implements ScannerFragment.OnDeviceSelectedListener {

@Override
protected void onCreate(final Bundle savedInstanceState) {
Expand All @@ -46,7 +46,7 @@ protected void onCreate(final Bundle savedInstanceState) {

if (savedInstanceState == null) {
final ScannerFragment fragment = ScannerFragment.getInstance(this, null, false); // Device that is advertising directly does not have the GENERAL_DISCOVERABLE nor LIMITED_DISCOVERABLE flag set.
fragment.show(getFragmentManager(), null);
fragment.show(getSupportFragmentManager(), null);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@
package no.nordicsemi.android.nrftoolbox.dfu.fragment;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v7.app.AlertDialog;
import android.util.Log;

import no.nordicsemi.android.nrftoolbox.R;
Expand Down Expand Up @@ -61,7 +62,8 @@ public void onAttach(final Activity activity) {
}
}

@Override
@NonNull
@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
return new AlertDialog.Builder(getActivity()).setTitle(R.string.dfu_confirmation_dialog_title).setMessage(R.string.dfu_upload_dialog_cancel_message).setCancelable(false)
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@
*/
package no.nordicsemi.android.nrftoolbox.dfu.fragment;

import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;

Expand All @@ -33,6 +34,7 @@
public class ZipInfoFragment extends DialogFragment {

@Override
@NonNull
public Dialog onCreateDialog(final Bundle savedInstanceState) {
final View view = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_zip_info, null);
return new AlertDialog.Builder(getActivity()).setView(view).setTitle(R.string.dfu_file_info).setPositiveButton(R.string.ok, null).create();
Expand Down
Loading

0 comments on commit 93e2bb2

Please sign in to comment.