Skip to content

Commit

Permalink
Merge pull request #1706 from DroidPlanner/droneshare_removal
Browse files Browse the repository at this point in the history
Droneshare removal
  • Loading branch information
m4gr3d committed Feb 22, 2016
2 parents 305e497 + 4792c5f commit 2f4a64b
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 9 additions & 0 deletions Android/res/drawable/ic_track_changes_24dp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#626262"
android:pathData="M19.07,4.93l-1.41,1.41C19.1,7.79 20,9.79 20,12c0,4.42 -3.58,8 -8,8s-8,-3.58 -8,-8c0,-4.08 3.05,-7.44 7,-7.93v2.02C8.16,6.57 6,9.03 6,12c0,3.31 2.69,6 6,6s6,-2.69 6,-6c0,-1.66 -0.67,-3.16 -1.76,-4.24l-1.41,1.41C15.55,9.9 16,10.9 16,12c0,2.21 -1.79,4 -4,4s-4,-1.79 -4,-4c0,-1.86 1.28,-3.41 3,-3.86v2.14c-0.6,0.35 -1,0.98 -1,1.72 0,1.1 0.9,2 2,2s2,-0.9 2,-2c0,-0.74 -0.4,-1.38 -1,-1.72V2h-1C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10c0,-2.76 -1.12,-5.26 -2.93,-7.07z" />
</vector>
16 changes: 11 additions & 5 deletions Android/res/layout/activity_drawer_navigation_ui.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,18 @@
</org.droidplanner.android.view.FitsSystemWindowsFrameLayout>
</FrameLayout>

<android.support.design.widget.NavigationView
android:id="@+id/navigation_drawer_container"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/navigation_drawer_items" />
android:id="@+id/navigation_drawer"
android:fitsSystemWindows="true">

<android.support.design.widget.NavigationView
android:id="@+id/navigation_drawer_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/navigation_drawer_items" />
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
13 changes: 5 additions & 8 deletions Android/res/layout/nav_header_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,23 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/navigation_account"
android:layout_width="match_parent"
android:layout_height="160dp"
android:layout_height="72dp"
android:background="@color/header_background"
android:gravity="bottom"
android:orientation="vertical"
android:gravity="center"
android:orientation="horizontal"
android:padding="16dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark">

<ImageView
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" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:text="@string/account_label"
android:id="@+id/account_screen_label"
android:text="@string/app_title"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />

</LinearLayout>
2 changes: 1 addition & 1 deletion Android/res/menu/navigation_drawer_items.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
android:checkableBehavior="single">
<item
android:id="@+id/navigation_flight_data"
android:icon="@drawable/ic_menu_flight_data_grey600_24dp"
android:icon="@drawable/ic_track_changes_24dp"
android:title="@string/flight_data" />

<item
Expand Down
2 changes: 1 addition & 1 deletion Android/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<color name="white_grey">#f7f6f6</color>
<color name="navigation_entry_color">#212121</color>

<color name="header_background">#00a6e3</color>
<color name="header_background">#068FD3</color>

<color name="orange">#FAAF4C</color>
<color name="ground_speed_label">#0a5242</color>
Expand Down
4 changes: 2 additions & 2 deletions Android/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<string name="label_other">Others</string>
<string name="menu_drone_setup">Drone Setup</string>
<string name="app_settings">App Settings</string>
<string name="flight_data">Flight Data</string>
<string name="flight_data">Vehicle Data</string>
<string name="editor">Editor</string>
<string name="upload_mission">Upload mission</string>
<string name="download_mission">Download mission</string>
Expand Down Expand Up @@ -360,7 +360,7 @@
<string name="label_enter_filename">Enter Filename</string>

<!-- Drone locator strings -->
<string name="locator">Flight History</string>
<string name="locator">Vehicle History</string>
<string name="open_tlog_file">Open log file</string>
<string name="status_waiting_for_gps">Waiting for GPS…</string>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand All @@ -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);
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -250,24 +252,24 @@ 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;

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;

Expand Down Expand Up @@ -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");
Expand All @@ -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);
Expand Down Expand Up @@ -372,6 +374,10 @@ private void updateFlightModeButtons() {
}
break;

case COPTER_BRAKE:
pauseBtn.setActivated(true);
break;

case COPTER_RTL:
homeBtn.setActivated(true);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -319,25 +322,25 @@ 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;

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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2f4a64b

Please sign in to comment.