diff --git a/.travis.yml b/.travis.yml index 73d62c9f21..0041f4bb55 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,4 +16,4 @@ before_script: - echo yes | android update sdk -u -a -t extra-android-support,extra-google-google_play_services - export GRADLE_OPTS="-XX:MaxPermSize=2048m -Xmx1536m" -script: ./gradlew clean build --info --stacktrace +script: ./gradlew clean assembleDebug diff --git a/Android/res/drawable/ic_track_changes_24dp.xml b/Android/res/drawable/ic_track_changes_24dp.xml new file mode 100644 index 0000000000..ed807fc9f5 --- /dev/null +++ b/Android/res/drawable/ic_track_changes_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/Android/res/layout/activity_drawer_navigation_ui.xml b/Android/res/layout/activity_drawer_navigation_ui.xml index 1eea408606..fa201f9abb 100644 --- a/Android/res/layout/activity_drawer_navigation_ui.xml +++ b/Android/res/layout/activity_drawer_navigation_ui.xml @@ -51,12 +51,18 @@ - + android:id="@+id/navigation_drawer" + android:fitsSystemWindows="true"> + + + diff --git a/Android/res/layout/nav_header_main.xml b/Android/res/layout/nav_header_main.xml index e8dcf5af5e..996bc43640 100644 --- a/Android/res/layout/nav_header_main.xml +++ b/Android/res/layout/nav_header_main.xml @@ -2,10 +2,10 @@ @@ -13,15 +13,12 @@ android:id="@+id/imageView" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:paddingTop="16dp" - android:src="@drawable/ic_account_circle_white_48dp" /> + android:src="@drawable/ic_launcher" /> diff --git a/Android/res/menu/navigation_drawer_items.xml b/Android/res/menu/navigation_drawer_items.xml index 6b81f95cbd..3fa3553925 100755 --- a/Android/res/menu/navigation_drawer_items.xml +++ b/Android/res/menu/navigation_drawer_items.xml @@ -6,7 +6,7 @@ android:checkableBehavior="single"> #f7f6f6 #212121 - #00a6e3 + #068FD3 #FAAF4C #0a5242 diff --git a/Android/res/values/strings.xml b/Android/res/values/strings.xml index 2303dfd6f0..36a9016f2f 100644 --- a/Android/res/values/strings.xml +++ b/Android/res/values/strings.xml @@ -7,7 +7,7 @@ Others Drone Setup App Settings - Flight Data + Vehicle Data Editor Upload mission Download mission @@ -360,7 +360,7 @@ Enter Filename - Flight History + Vehicle History Open log file Waiting for GPS… diff --git a/Android/src/org/droidplanner/android/activities/DrawerNavigationUI.java b/Android/src/org/droidplanner/android/activities/DrawerNavigationUI.java index dbf6209e74..5366b3bfcc 100644 --- a/Android/src/org/droidplanner/android/activities/DrawerNavigationUI.java +++ b/Android/src/org/droidplanner/android/activities/DrawerNavigationUI.java @@ -2,7 +2,6 @@ import android.content.Intent; import android.content.res.Configuration; -import android.graphics.Typeface; import android.os.Bundle; import android.support.design.widget.NavigationView; import android.support.v4.content.LocalBroadcastManager; @@ -17,14 +16,12 @@ import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.LinearLayout; -import android.widget.TextView; import org.droidplanner.android.R; import org.droidplanner.android.activities.helpers.SuperUI; import org.droidplanner.android.fragments.SettingsFragment; import org.droidplanner.android.fragments.control.BaseFlightControlFragment; import org.droidplanner.android.view.SlidingDrawer; -import org.w3c.dom.Text; /** * This abstract activity provides its children access to a navigation drawer @@ -60,8 +57,6 @@ public abstract class DrawerNavigationUI extends SuperUI implements SlidingDrawe */ private NavigationView navigationView; - private TextView accountLabel; - @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -76,7 +71,7 @@ public void onCreate(Bundle savedInstanceState) { @Override public void onDrawerClosed(View drawerView) { switch (drawerView.getId()) { - case R.id.navigation_drawer_container: + case R.id.navigation_drawer: if (mNavigationIntent != null) { startActivity(mNavigationIntent); mNavigationIntent = null; @@ -125,22 +120,8 @@ public void setContentView(int layoutResID) { contentLayout.addView(contentView); setContentView(mDrawerLayout); - navigationView = (NavigationView) findViewById(R.id.navigation_drawer_container); + navigationView = (NavigationView) findViewById(R.id.navigation_drawer_view); navigationView.setNavigationItemSelectedListener(this); - - accountLabel = (TextView) findViewById(R.id.account_screen_label); - - final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); - - LinearLayout llAccount = (LinearLayout) findViewById(R.id.navigation_account); - llAccount.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - startActivity(new Intent(getApplicationContext(), AccountActivity.class)); - drawer.closeDrawer(GravityCompat.START); - } - }); - } @Override @@ -252,10 +233,6 @@ public void onResume(){ private void updateNavigationDrawer() { final int navDrawerEntryId = getNavigationDrawerMenuItemId(); switch (navDrawerEntryId) { - case R.id.navigation_account: - accountLabel.setTypeface(null, Typeface.BOLD); - break; - default: navigationView.setCheckedItem(navDrawerEntryId); break; diff --git a/Android/src/org/droidplanner/android/fragments/control/BaseFlightControlFragment.java b/Android/src/org/droidplanner/android/fragments/control/BaseFlightControlFragment.java index cc7aa223a6..12a3cb745d 100644 --- a/Android/src/org/droidplanner/android/fragments/control/BaseFlightControlFragment.java +++ b/Android/src/org/droidplanner/android/fragments/control/BaseFlightControlFragment.java @@ -11,6 +11,7 @@ import com.google.android.gms.location.LocationRequest; import com.o3dr.android.client.Drone; +import com.o3dr.android.client.apis.FollowApi; import com.o3dr.services.android.lib.drone.attribute.AttributeType; import com.o3dr.services.android.lib.gcs.follow.FollowState; import com.o3dr.services.android.lib.gcs.follow.FollowType; @@ -77,7 +78,7 @@ protected void toggleFollowMe() { final FollowState followState = drone.getAttribute(AttributeType.FOLLOW_STATE); if (followState.isEnabled()) { - drone.disableFollowMe(); + FollowApi.getApi(drone).disableFollowMe(); } else { enableFollowMe(drone); } @@ -97,7 +98,7 @@ private void enableFollowMe(final Drone drone) { new Runnable() { @Override public void run() { - drone.enableFollowMe(FollowType.LEASH); + FollowApi.getApi(drone).enableFollowMe(FollowType.LEASH); } }); diff --git a/Android/src/org/droidplanner/android/fragments/control/CopterFlightControlFragment.java b/Android/src/org/droidplanner/android/fragments/control/CopterFlightControlFragment.java index cee64b43d0..2492609554 100644 --- a/Android/src/org/droidplanner/android/fragments/control/CopterFlightControlFragment.java +++ b/Android/src/org/droidplanner/android/fragments/control/CopterFlightControlFragment.java @@ -13,6 +13,8 @@ import com.google.android.gms.analytics.HitBuilders; import com.o3dr.android.client.Drone; +import com.o3dr.android.client.apis.ControlApi; +import com.o3dr.android.client.apis.FollowApi; import com.o3dr.android.client.apis.VehicleApi; import com.o3dr.services.android.lib.drone.attribute.AttributeEvent; import com.o3dr.services.android.lib.drone.attribute.AttributeEventExtra; @@ -234,12 +236,12 @@ public void onClick(View v) { break; case R.id.mc_disarmBtn: - getDrone().arm(false); + VehicleApi.getApi(drone).arm(false); eventBuilder.setAction(ACTION_FLIGHT_ACTION_BUTTON).setLabel("Disarm"); break; case R.id.mc_land: - getDrone().changeVehicleMode(VehicleMode.COPTER_LAND); + VehicleApi.getApi(drone).setVehicleMode(VehicleMode.COPTER_LAND); eventBuilder.setAction(ACTION_FLIGHT_ACTION_BUTTON).setLabel(VehicleMode .COPTER_LAND.getLabel()); break; @@ -250,7 +252,7 @@ public void onClick(View v) { break; case R.id.mc_homeBtn: - getDrone().changeVehicleMode(VehicleMode.COPTER_RTL); + VehicleApi.getApi(drone).setVehicleMode(VehicleMode.COPTER_RTL); eventBuilder.setAction(ACTION_FLIGHT_ACTION_BUTTON).setLabel(VehicleMode.COPTER_RTL .getLabel()); break; @@ -258,16 +260,16 @@ public void onClick(View v) { case R.id.mc_pause: { final FollowState followState = drone.getAttribute(AttributeType.FOLLOW_STATE); if (followState.isEnabled()) { - drone.disableFollowMe(); + FollowApi.getApi(drone).disableFollowMe(); } - drone.pauseAtCurrentLocation(); + ControlApi.getApi(drone).pauseAtCurrentLocation(null); eventBuilder.setAction(ACTION_FLIGHT_ACTION_BUTTON).setLabel("Pause"); break; } case R.id.mc_autoBtn: - getDrone().changeVehicleMode(VehicleMode.COPTER_AUTO); + VehicleApi.getApi(drone).setVehicleMode(VehicleMode.COPTER_AUTO); eventBuilder.setAction(ACTION_FLIGHT_ACTION_BUTTON).setLabel(VehicleMode.COPTER_AUTO.getLabel()); break; @@ -312,7 +314,7 @@ private void getTakeOffConfirmation() { @Override public void run() { final double takeOffAltitude = getAppPrefs().getDefaultAltitude(); - getDrone().doGuidedTakeoff(takeOffAltitude); + ControlApi.getApi(getDrone()).takeoff(takeOffAltitude, null); } }); unlockDialog.show(getChildFragmentManager(), "Slide to take off"); @@ -326,7 +328,7 @@ public void run() { final double takeOffAltitude = getAppPrefs().getDefaultAltitude(); final Drone drone = getDrone(); - VehicleApi.getApi(drone).takeoff(takeOffAltitude, new SimpleCommandListener() { + ControlApi.getApi(drone).takeoff(takeOffAltitude, new SimpleCommandListener() { @Override public void onSuccess() { VehicleApi.getApi(drone).setVehicleMode(VehicleMode.COPTER_AUTO); @@ -372,6 +374,10 @@ private void updateFlightModeButtons() { } break; + case COPTER_BRAKE: + pauseBtn.setActivated(true); + break; + case COPTER_RTL: homeBtn.setActivated(true); break; diff --git a/Android/src/org/droidplanner/android/fragments/control/PlaneFlightControlFragment.java b/Android/src/org/droidplanner/android/fragments/control/PlaneFlightControlFragment.java index 8701fdfbc4..9a16895399 100644 --- a/Android/src/org/droidplanner/android/fragments/control/PlaneFlightControlFragment.java +++ b/Android/src/org/droidplanner/android/fragments/control/PlaneFlightControlFragment.java @@ -14,6 +14,9 @@ import com.google.android.gms.analytics.HitBuilders; import com.o3dr.android.client.Drone; +import com.o3dr.android.client.apis.ControlApi; +import com.o3dr.android.client.apis.FollowApi; +import com.o3dr.android.client.apis.VehicleApi; import com.o3dr.services.android.lib.drone.attribute.AttributeEvent; import com.o3dr.services.android.lib.drone.attribute.AttributeType; import com.o3dr.services.android.lib.drone.property.GuidedState; @@ -319,7 +322,7 @@ public void onClick(View v) { break; case R.id.mc_homeBtn: - drone.changeVehicleMode(VehicleMode.PLANE_RTL); + VehicleApi.getApi(drone).setVehicleMode(VehicleMode.PLANE_RTL); eventBuilder.setAction(ACTION_FLIGHT_ACTION_BUTTON) .setLabel(VehicleMode.PLANE_RTL.getLabel()); break; @@ -327,17 +330,17 @@ public void onClick(View v) { case R.id.mc_pause: { final FollowState followState = drone.getAttribute(AttributeType.FOLLOW_STATE); if (followState.isEnabled()) { - drone.disableFollowMe(); + FollowApi.getApi(drone).disableFollowMe(); } - drone.pauseAtCurrentLocation(); + ControlApi.getApi(drone).pauseAtCurrentLocation(null); eventBuilder.setAction(ACTION_FLIGHT_ACTION_BUTTON).setLabel("Pause"); break; } case R.id.mc_TakeoffInAutoBtn: case R.id.mc_autoBtn: - drone.changeVehicleMode(VehicleMode.PLANE_AUTO); + VehicleApi.getApi(drone).setVehicleMode(VehicleMode.PLANE_AUTO); eventBuilder.setAction(ACTION_FLIGHT_ACTION_BUTTON).setLabel(VehicleMode.PLANE_AUTO.getLabel()); break; diff --git a/Android/src/org/droidplanner/android/fragments/control/RoverFlightControlFragment.java b/Android/src/org/droidplanner/android/fragments/control/RoverFlightControlFragment.java index 4394320764..01eb269e73 100644 --- a/Android/src/org/droidplanner/android/fragments/control/RoverFlightControlFragment.java +++ b/Android/src/org/droidplanner/android/fragments/control/RoverFlightControlFragment.java @@ -12,6 +12,7 @@ import com.google.android.gms.analytics.HitBuilders; import com.o3dr.android.client.Drone; +import com.o3dr.android.client.apis.VehicleApi; import com.o3dr.services.android.lib.drone.attribute.AttributeEvent; import com.o3dr.services.android.lib.drone.attribute.AttributeType; import com.o3dr.services.android.lib.drone.property.State; @@ -177,18 +178,18 @@ public void onClick(View v) { break; case R.id.mc_homeBtn: - drone.changeVehicleMode(VehicleMode.ROVER_RTL); + VehicleApi.getApi(drone).setVehicleMode(VehicleMode.ROVER_RTL); eventBuilder.setAction(ACTION_FLIGHT_ACTION_BUTTON).setLabel(VehicleMode.ROVER_RTL.getLabel()); break; case R.id.mc_pause: { - drone.changeVehicleMode(VehicleMode.ROVER_HOLD); + VehicleApi.getApi(drone).setVehicleMode(VehicleMode.ROVER_HOLD); eventBuilder.setAction(ACTION_FLIGHT_ACTION_BUTTON).setLabel(VehicleMode.ROVER_HOLD.getLabel()); break; } case R.id.mc_autoBtn: - drone.changeVehicleMode(VehicleMode.ROVER_AUTO); + VehicleApi.getApi(drone).setVehicleMode(VehicleMode.ROVER_AUTO); eventBuilder.setAction(ACTION_FLIGHT_ACTION_BUTTON).setLabel(VehicleMode.ROVER_AUTO.getLabel()); break; diff --git a/build.gradle b/build.gradle index bc74f941be..47d94ebc29 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { kotlin_version = '1.0.0' play_services_version = '8.4.0' - support_lib_version = '23.0.1' + support_lib_version = '23.1.1' okhttp_version = '2.5.0' android_build_sdk_version = 23