Example #1
0
 private void updateProgress() {
   for (Action a : Action.values()) {
     if (a == currentAction) {
       // this is the current action
       showInProgress(a.viewId);
     } else if (a.ordinal() < currentAction.ordinal()) {
       // this action has completed
       showResult(a.viewId, results[a.ordinal()]);
     } else {
       // this action hasn't started
       showNotStarted(a.viewId);
     }
   }
   ChipsetDetection detection = ChipsetDetection.getDetection();
   if (currentAction == Action.Finished)
     if (detection == null
         || detection.getWifiChipset() == null
         || detection.getWifiChipset().supportedModes == null
         || detection.getWifiChipset().supportedModes.contains(WifiMode.Adhoc) == false) {
       app.showNoAdhocDialog = true;
       LogActivity.logMessage(
           "detect",
           "Could not work out how to control your WiFi chipset. Relying on operating system, so no ad-hoc WiFi.",
           false);
     }
 }
Example #2
0
    private void stepProgress(Action a) {

      updateProgress();
      boolean result = results[a.ordinal()];

      switch (a) {
        case Unpacking:
          installedFiles(result);
          break;

        case Supported:
          checkedChipsetSupported(result);
          break;

        case CheckSupport:
          if (fatalError) {
            Intent intent = new Intent(ServalBatPhoneApplication.context, WifiJammedActivity.class);
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(intent);
            finish();
          }
          break;

        case Finished:
          app.getReady();
          // TODO tell user if we can't do Adhoc??
          finish();
      }
    }
Example #3
0
 /**
  * Creates a new {@link ServerEditFragment} dialog. Results will be delivered to the parent
  * activity via {@link ServerEditListener}.
  *
  * @param server Optional, if set will populate the fragment with data from the server.
  * @param action The action the fragment is performing (i.e. Add, Edit)
  * @param ignoreTitle If true, don't show fields related to the server title (useful for quick
  *     connect dialogs)
  */
 public static DialogFragment createServerEditDialog(
     Context context, Server server, Action action, boolean ignoreTitle) {
   Bundle args = new Bundle();
   args.putParcelable(ARGUMENT_SERVER, server);
   args.putInt(ARGUMENT_ACTION, action.ordinal());
   args.putBoolean(ARGUMENT_IGNORE_TITLE, ignoreTitle);
   return (DialogFragment) Fragment.instantiate(context, ServerEditFragment.class.getName(), args);
 }
Example #4
0
 @Override
 public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) {
   if (protocolVersion < ProtocolConstants.MINECRAFT_SNAPSHOT) {
     Item item = items[0]; // Only one at a time
     writeString(item.displayName, buf); // TODO: Server unique only!
     buf.writeBoolean(action != Action.REMOVE_PLAYER);
     buf.writeShort(item.ping);
   } else {
     DefinedPacket.writeVarInt(action.ordinal(), buf);
     DefinedPacket.writeVarInt(items.length, buf);
     for (Item item : items) {
       DefinedPacket.writeUUID(item.uuid, buf);
       switch (action) {
         case ADD_PLAYER:
           DefinedPacket.writeString(item.username, buf);
           DefinedPacket.writeVarInt(item.properties.length, buf);
           for (String[] prop : item.properties) {
             DefinedPacket.writeString(prop[0], buf);
             DefinedPacket.writeString(prop[1], buf);
             if (prop.length >= 3) {
               buf.writeBoolean(true);
               DefinedPacket.writeString(prop[2], buf);
             } else {
               buf.writeBoolean(false);
             }
           }
           DefinedPacket.writeVarInt(item.gamemode, buf);
           DefinedPacket.writeVarInt(item.ping, buf);
           buf.writeBoolean(item.displayName != null);
           if (item.displayName != null) {
             DefinedPacket.writeString(item.displayName, buf);
           }
           break;
         case UPDATE_GAMEMODE:
           DefinedPacket.writeVarInt(item.gamemode, buf);
           break;
         case UPDATE_LATENCY:
           DefinedPacket.writeVarInt(item.ping, buf);
           break;
         case UPDATE_DISPLAY_NAME:
           buf.writeBoolean(item.displayName != null);
           if (item.displayName != null) {
             DefinedPacket.writeString(item.displayName, buf);
           }
           break;
       }
     }
   }
 }