Skip to content

Commit

Permalink
Merge branch 'master' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurbenemann committed Aug 22, 2014
2 parents 949ccbf + 2df70e7 commit 2dad5c8
Show file tree
Hide file tree
Showing 106 changed files with 1,965 additions and 1,945 deletions.
2 changes: 1 addition & 1 deletion Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.droidplanner"
android:versionCode="91"
android:versionCode="92"
android:versionName="please run version.sh to get the version name">

<uses-sdk
Expand Down
5 changes: 2 additions & 3 deletions Android/src/org/droidplanner/android/DroidPlannerApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@
import org.droidplanner.android.utils.prefs.DroidPlannerPrefs;
import org.droidplanner.core.MAVLink.MAVLinkStreams;
import org.droidplanner.core.MAVLink.MavLinkMsgHandler;
import org.droidplanner.core.model.Drone;
import org.droidplanner.core.drone.DroneImpl;
import org.droidplanner.core.drone.DroneInterfaces;
import org.droidplanner.core.drone.DroneInterfaces.Clock;
import org.droidplanner.core.drone.DroneInterfaces.DroneEventsType;
import org.droidplanner.core.drone.DroneInterfaces.Handler;
import org.droidplanner.core.gcs.follow.Follow;
import org.droidplanner.core.model.Drone;

import android.content.Context;
import android.os.SystemClock;
import android.widget.Toast;

import com.MAVLink.Messages.MAVLinkMessage;

Expand Down Expand Up @@ -110,7 +109,7 @@ public void onDroneEvent(DroneEventsType event, Drone drone) {
}
}

public DroidPlannerPrefs getPreferences(){
public DroidPlannerPrefs getPreferences() {
return prefs;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
import org.droidplanner.android.utils.file.IO.MissionReader;
import org.droidplanner.android.utils.file.IO.MissionWriter;
import org.droidplanner.android.utils.prefs.AutoPanMode;
import org.droidplanner.core.model.Drone;
import org.droidplanner.core.drone.DroneInterfaces.DroneEventsType;
import org.droidplanner.core.helpers.coordinates.Coord2D;
import org.droidplanner.core.model.Drone;

import android.os.Bundle;
import android.support.v4.app.FragmentManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
import org.droidplanner.android.fragments.mode.FlightModePanel;
import org.droidplanner.android.utils.analytics.GAUtils;
import org.droidplanner.android.utils.prefs.AutoPanMode;
import org.droidplanner.core.model.Drone;
import org.droidplanner.core.drone.DroneInterfaces.DroneEventsType;
import org.droidplanner.core.drone.DroneInterfaces.OnDroneListener;
import org.droidplanner.core.model.Drone;

import android.app.Dialog;
import android.content.DialogInterface;
Expand All @@ -31,7 +31,7 @@
import com.google.android.gms.common.GooglePlayServicesUtil;

//TODO find some newer class to use instead of the SlidingDrawer
@SuppressWarnings("deprecation")
@SuppressWarnings("deprecation")
public class FlightActivity extends DrawerNavigationUI implements
FlightActionsFragment.OnMissionControlInteraction, OnDroneListener {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
import org.droidplanner.android.utils.Utils;
import org.droidplanner.android.utils.prefs.DroidPlannerPrefs;
import org.droidplanner.android.widgets.actionProviders.InfoBarActionProvider;
import org.droidplanner.core.model.Drone;
import org.droidplanner.core.drone.DroneInterfaces.DroneEventsType;
import org.droidplanner.core.drone.DroneInterfaces.OnDroneListener;
import org.droidplanner.core.gcs.GCSHeartbeat;
import org.droidplanner.core.model.Drone;

import android.app.ActionBar;
import android.content.Context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,10 @@ private void saveToLog(MAVLinkPacket receivedPacket) throws IOException {
Log.e(TAG, "Ignoring Buffer Overflow in saveToLog: " + e);
} catch (NullPointerException e) {
Log.e(TAG, "Ignoring NPE in " + e);
// There was a null pointer error for some users on
// logBuffer.clear();
}
} catch (ArrayIndexOutOfBoundsException e){
//TODO fix this exception in a proper manner
Log.e(TAG, "Ignoring Buffer overflow " + e);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,40 @@
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;

/**
* When the device's network connectivity is restored, check and see if there's anymore data to
* upload.
* When the device's network connectivity is restored, check and see if there's
* anymore data to upload.
*/
public class NetworkConnectivityReceiver extends BroadcastReceiver {

private static final String TAG = NetworkConnectivityReceiver.class.getSimpleName();
private static final String TAG = NetworkConnectivityReceiver.class.getSimpleName();

@Override
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
if(ConnectivityManager.CONNECTIVITY_ACTION.equals(action)) {
final boolean noConnectivity = intent.getBooleanExtra(ConnectivityManager
.EXTRA_NO_CONNECTIVITY, false);
final String action = intent.getAction();
if (ConnectivityManager.CONNECTIVITY_ACTION.equals(action)) {
final boolean noConnectivity = intent.getBooleanExtra(
ConnectivityManager.EXTRA_NO_CONNECTIVITY, false);

if(noConnectivity){
//No connectivity. Keep the receiver enabled to listen for possible connectivity
// changes in the future.
return;
}
if (noConnectivity) {
// No connectivity. Keep the receiver enabled to listen for
// possible connectivity
// changes in the future.
return;
}

//There is connectivity! Restart the droneshare uploader service,
// and disable this connectivity receiver.
context.startService(UploaderService.createIntent(context));
// There is connectivity! Restart the droneshare uploader service,
// and disable this connectivity receiver.
context.startService(UploaderService.createIntent(context));

Log.d(TAG, "Disabling connectivity receiver.");
enableConnectivityReceiver(context, false);
}
Log.d(TAG, "Disabling connectivity receiver.");
enableConnectivityReceiver(context, false);
}
}

public static boolean isNetworkAvailable(Context context) {
Expand All @@ -47,19 +47,20 @@ public static boolean isNetworkAvailable(Context context) {
return activeNetworkInfo != null && activeNetworkInfo.isConnected();
}

/**
* Toggles the connectivity listener component of the app.
* @param context application context
* @param enable true to enable
*/
public static void enableConnectivityReceiver(Context context, boolean enable) {
final ComponentName receiver = new ComponentName(context, NetworkConnectivityReceiver
.class);
final int newState = enable
? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
: PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
/**
* Toggles the connectivity listener component of the app.
*
* @param context
* application context
* @param enable
* true to enable
*/
public static void enableConnectivityReceiver(Context context, boolean enable) {
final ComponentName receiver = new ComponentName(context, NetworkConnectivityReceiver.class);
final int newState = enable ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
: PackageManager.COMPONENT_ENABLED_STATE_DISABLED;

context.getPackageManager().setComponentEnabledSetting(receiver, newState,
PackageManager.DONT_KILL_APP);
}
context.getPackageManager().setComponentEnabledSetting(receiver, newState,
PackageManager.DONT_KILL_APP);
}
}
Loading

0 comments on commit 2dad5c8

Please sign in to comment.