Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue #1127 #1196

Merged
merged 1 commit into from
Oct 22, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Android/res/values/preferences_keys.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ This file is used to store the preferences keys so that it's accessible and modi
<string name="pref_dialogs_key">pref_dialogs</string>
<string name="pref_warn_on_arm_key">pref_warn_on_arm</string>
<string name="pref_auto_insert_mission_takeoff_rtl_land_key">pref_auto_insert_mission_takeoff_rtl_land</string>
<string name="pref_warn_on_takeoff_in_auto_key">pref_warn_on_takeoff_in_auto</string>

<string name="pref_enable_tts_key">pref_enable_tts</string>
<string name="pref_tts_periodic_key">tts_periodic</string>
Expand Down
2 changes: 2 additions & 0 deletions Android/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -506,5 +506,7 @@
<string name="pref_dialog_entry_never">Never</string>
<string name="pref_dialog_entry_ask">Ask</string>
<string name="pref_dialog_selection_reset_desc"><![CDATA[Reset selection through: Settings -> User Interface -> Preference Dialogs]]></string>
<string name="dialog_confirm_take_off_in_auto_title">Take off in Auto?</string>
<string name="dialog_confirm_take_off_in_auto_msg">Warning! The drone will now take off and start the mission.</string>

</resources>
7 changes: 7 additions & 0 deletions Android/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,13 @@
android:defaultValue="@string/pref_dialog_entry_ask"
android:entryValues="@array/preference_dialog_entry"/>

<ListPreference
android:key="@string/pref_warn_on_takeoff_in_auto_key"
android:title="@string/dialog_confirm_take_off_in_auto_title"
android:entries="@array/preference_dialog_entry"
android:defaultValue="@string/pref_dialog_entry_ask"
android:entryValues="@array/preference_dialog_entry"/>

</PreferenceScreen>
</PreferenceCategory>
</PreferenceScreen>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,7 @@ public void onClick(View v) {
break;

case R.id.mc_TakeoffInAutoBtn:
drone.getState().doTakeoff(new Altitude(TAKEOFF_ALTITUDE));
drone.getState().changeFlightMode(ApmModes.ROTOR_AUTO);
getTakeOffInAutoConfirmation();
eventBuilder.setAction(ACTION_FLIGHT_ACTION_BUTTON).setLabel(ApmModes.ROTOR_AUTO.getName());
break;

Expand Down Expand Up @@ -224,6 +223,26 @@ public void onClick(View v) {

}

private void getTakeOffInAutoConfirmation() {
YesNoWithPrefsDialog ynd = YesNoWithPrefsDialog.newInstance(getActivity()
.getApplicationContext(), getString(R.string.dialog_confirm_take_off_in_auto_title),
getString(R.string.dialog_confirm_take_off_in_auto_msg), new YesNoDialog.Listener() {
@Override
public void onYes() {
drone.getState().doTakeoff(new Altitude(TAKEOFF_ALTITUDE));
drone.getState().changeFlightMode(ApmModes.ROTOR_AUTO);
}

@Override
public void onNo() {
}
}, getString(R.string.pref_warn_on_takeoff_in_auto_key));

if(ynd != null){
ynd.show(getChildFragmentManager(), "Confirm take off in auto");
}
}

private void getArmingConfirmation() {
YesNoWithPrefsDialog ynd = YesNoWithPrefsDialog.newInstance(getActivity().getApplicationContext(),
getString(R.string.dialog_confirm_arming_title),
Expand Down