Пример #1
0
 public static void shutdownDUBwise() {
   App.getMK().close_connections(true);
   App.getMK().stop();
   DUBwiseBackgroundHandler.getInstance().stopAll();
   App.disposeMK();
   did_init = false;
 }
Пример #2
0
  public void refresh_list() {
    MKCommunicator mk = App.getMK();
    List<IconicMenuItem> menuItemsList = new ArrayList<IconicMenuItem>();

    menuItemsList.add(
        new IconicMenuItem(
            "Connection",
            android.R.drawable.ic_menu_share,
            new Intent(this, ConnectionListActivity.class)));

    menuItemsList.add(
        new IconicMenuItem(
            "Settings",
            android.R.drawable.ic_menu_preferences,
            new Intent(this, SettingsListActivity.class)));

    if (DUBwisePrefs.isExpertModeEnabled()) {
      menuItemsList.add(
          new IconicMenuItem(
              "OpenGL",
              android.R.drawable.ic_menu_preferences,
              new Intent(this, OpenGLActivity.class)));

      menuItemsList.add(
          new IconicMenuItem(
              "Flash Firmware",
              android.R.drawable.ic_menu_preferences,
              new Intent(this, FlashFirmwareActivity.class)));

      menuItemsList.add(
          new IconicMenuItem(
              "Control Panel",
              android.R.drawable.ic_menu_preferences,
              new Intent(this, ControlPanelActivity.class)));

      menuItemsList.add(
          new IconicMenuItem(
              "Voice",
              android.R.drawable.ic_menu_view,
              new Intent(this, VoiceControlActivity.class)));
    }

    if (mk.connected) {

      menuItemsList.add(
          new IconicMenuItem(
              "Device Details",
              android.R.drawable.ic_menu_view,
              new Intent(this, DeviceDetails.class)));

      menuItemsList.add(
          new IconicMenuItem(
              "LCD", android.R.drawable.ic_menu_view, new Intent(this, LCDActivity.class)));

      if (mk.is_mk() || mk.is_navi() || mk.is_fake())
        menuItemsList.add(
            new IconicMenuItem(
                "Pilot",
                android.R.drawable.ic_menu_preferences,
                new Intent(this, PilotingListActivity.class)));

      if (mk.is_navi() || mk.is_fake())
        menuItemsList.add(
            new IconicMenuItem(
                "Follow me",
                android.R.drawable.ic_menu_crop,
                new Intent(this, FollowMeActivity.class)));

      if (mk.is_mk() || mk.is_fake())
        menuItemsList.add(
            new IconicMenuItem(
                "Motor Test",
                android.R.drawable.ic_menu_rotate,
                new Intent(this, MotorTestActivity.class)));

      if (mk.is_mk() || mk.is_fake())
        menuItemsList.add(
            new IconicMenuItem(
                "RCData", android.R.drawable.ic_menu_view, new Intent(this, RCDataActivity.class)));

      if (mk.is_mk() || mk.is_fake() || mk.is_navi())
        menuItemsList.add(
            new IconicMenuItem(
                "Balance",
                android.R.drawable.ic_menu_crop,
                new Intent(this, BalanceActivity.class)));

      if (mk.is_mk() || mk.is_navi() || mk.is_fake())
        menuItemsList.add(
            new IconicMenuItem(
                "Cockpit",
                android.R.drawable.ic_menu_view,
                new Intent(this, CockpitActivity.class)));

      if (mk.is_mk() || mk.is_navi() || mk.is_fake() || mk.is_mk3mag())
        menuItemsList.add(
            new IconicMenuItem(
                "Analog Values",
                android.R.drawable.ic_menu_view,
                new Intent(this, AnalogValuesActivity.class)));

      if (mk.is_mk() || mk.is_fake())
        menuItemsList.add(
            new IconicMenuItem(
                "Flight Settings",
                android.R.drawable.ic_menu_edit,
                new Intent(this, FlightSettingsActivity.class)));

      if (mk.is_mk() || mk.is_fake())
        menuItemsList.add(
            new IconicMenuItem(
                "Edit Mixer",
                android.R.drawable.ic_menu_edit,
                new Intent(this, MixerEditActivity.class)));

      if (mk.is_mk() || mk.is_fake())
        menuItemsList.add(
            new IconicMenuItem(
                "Graph", android.R.drawable.ic_menu_view, new Intent(this, GraphActivity.class)));
    }
    menuItemsList.add(
        new IconicMenuItem(
            "Information Desk",
            android.R.drawable.ic_menu_info_details,
            new Intent(this, InformationDeskActivity.class)));

    drawerList.setAdapter(new IconicAdapter(this, (menuItemsList.toArray())));

    getSupportActionBar().setDisplayShowCustomEnabled(true);
    getSupportActionBar().setCustomView(R.layout.top);
  }