本文整理汇总了Java中com.o3dr.services.android.lib.drone.property.VehicleMode.getVehicleModePerDroneType方法的典型用法代码示例。如果您正苦于以下问题:Java VehicleMode.getVehicleModePerDroneType方法的具体用法?Java VehicleMode.getVehicleModePerDroneType怎么用?Java VehicleMode.getVehicleModePerDroneType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.o3dr.services.android.lib.drone.property.VehicleMode
的用法示例。
在下文中一共展示了VehicleMode.getVehicleModePerDroneType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateItemView
import com.o3dr.services.android.lib.drone.property.VehicleMode; //导入方法依赖的package包/类
@Override
public void updateItemView(final Context context, final Drone drone) {
mDrone = drone;
if (mItemView == null)
return;
final SpinnerSelfSelect modesSpinner = (SpinnerSelfSelect) mItemView;
final int droneType = drone == null || !drone.isConnected() ? -1 : drone.getType()
.getDroneType();
if (droneType != mLastDroneType) {
final List<VehicleMode> flightModes = VehicleMode.getVehicleModePerDroneType(droneType);
mModeAdapter.clear();
mModeAdapter.addAll(flightModes);
mModeAdapter.notifyDataSetChanged();
mLastDroneType = droneType;
}
if (mDrone != null && mDrone.isConnected()) {
modesSpinner.forcedSetSelection(mModeAdapter.getPosition(mDrone.getState()
.getVehicleMode()));
}
}
示例2: handleIntent
import com.o3dr.services.android.lib.drone.property.VehicleMode; //导入方法依赖的package包/类
private void handleIntent(Intent intent) {
VehicleMode flightMode = intent.getParcelableExtra(WearReceiverService.EXTRA_EVENT_DATA);
if(flightMode == null)
flightMode = VehicleMode.UNKNOWN;
List<VehicleMode> vehicleModes = VehicleMode.getVehicleModePerDroneType(flightMode.getDroneType());
WearableListView listView = (WearableListView) findViewById(R.id.wear_list);
listView.setAdapter(new VehicleModeAdapter(vehicleModes));
listView.setClickListener(this);
RecyclerView.LayoutManager layoutMgr = listView.getLayoutManager();
if (layoutMgr != null) {
int currentPos = vehicleModes.indexOf(flightMode);
if (currentPos != -1)
layoutMgr.scrollToPosition(currentPos);
}
}
示例3: updateFlightModeTelem
import com.o3dr.services.android.lib.drone.property.VehicleMode; //导入方法依赖的package包/类
private void updateFlightModeTelem() {
final Drone drone = getDrone();
final boolean isDroneConnected = drone.isConnected();
final int droneType;
if (isDroneConnected) {
Type type = drone.getAttribute(AttributeType.TYPE);
droneType = type.getDroneType();
} else {
droneType = -1;
}
if (droneType != lastDroneType) {
final List<VehicleMode> flightModes = VehicleMode.getVehicleModePerDroneType(droneType);
modeAdapter.clear();
modeAdapter.addAll(flightModes);
modeAdapter.notifyDataSetChanged();
lastDroneType = droneType;
}
if (isDroneConnected) {
final State droneState = drone.getAttribute(AttributeType.STATE);
flightModeTelem.forcedSetSelection(modeAdapter.getPosition(droneState.getVehicleMode()));
}
}
示例4: updateVehicleModesForType
import com.o3dr.services.android.lib.drone.property.VehicleMode; //导入方法依赖的package包/类
protected void updateVehicleModesForType(int droneType) {
List<VehicleMode> vehicleModes = VehicleMode.getVehicleModePerDroneType(droneType);
ArrayAdapter<VehicleMode> vehicleModeArrayAdapter = new ArrayAdapter<VehicleMode>(this, android.R.layout.simple_spinner_item, vehicleModes);
vehicleModeArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
this.modeSelector.setAdapter(vehicleModeArrayAdapter);
}