コード例 #1
0
  public void startNewSong() {
    try {
      // PreLogUtil.put(Memory.getInfo(), this, CommonStrings.getInstance().PROCESS);

      ResourceUtil.getInstance().getContext().stopService(this.currentIntent);

      this.currentSongSound = (Sound) BasicArrayListUtil.getInstance().getRandom(this.songList);

      long duration = this.currentSongSound.getDuration();
      // 18000;
      // this.currentSongSound.getPlayer().getDuration();

      PreLogUtil.put(
          new StringBuilder()
              .append(PLAY)
              .append(this.currentSongSound.getResource())
              .append(FOR)
              .append(duration)
              .toString(),
          this,
          CommonStrings.getInstance().PROCESS);

      this.timeDelayHelper.setDelay((int) duration);

      this.currentIntent.putExtra(
          MusicStrings.getInstance().SONG_EXTRA,
          ResourceUtil.getInstance().getResourceId(this.currentSongSound.getResource()).intValue());

      ResourceUtil.getInstance().getContext().startService(this.currentIntent);
    } catch (Exception e) {
      String resource = StringUtil.getInstance().EMPTY_STRING;
      if (currentSongSound != null) {
        resource = currentSongSound.getResource();
      }

      PreLogUtil.put(
          CommonStrings.getInstance().EXCEPTION_LABEL + resource,
          this,
          CommonStrings.getInstance().PROCESS,
          e);
    }
  }
  public BasicArrayList getList() {
    try {
      LogUtil.put(
          LogFactory.getInstance(
              CommonStrings.getInstance().START, this, CommonStrings.getInstance().CONSTRUCTOR));

      final BasicArrayList list = new BasicArrayList();

      TouchButtonLocationHelper touchButtonLocationHelper = new TouchButtonLocationHelper();

      BasicTouchButtonCellPositionFactory basicTouchButtonCellPositionFactory =
          new BasicTouchButtonCellPositionFactory();

      FeaturedAnimationInterfaceFactoryInterfaceFactory
          featuredAnimationInterfaceFactoryInterfaceFactory =
              FeaturedAnimationInterfaceFactoryInterfaceFactory.getInstance();

      CommonButtons commonButtons = CommonButtons.getInstance();

      Animation animationInterface = NullAnimationFactory.getFactoryInstance().getInstance();

      BasicTouchInputFactory basicTouchInputFactory = BasicTouchInputFactory.getInstance();

      TouchButton LEFT =
          new FullTouchButton(
              basicTouchInputFactory.LEFT,
              animationInterface,
              // (Animation)
              // featuredAnimationInterfaceFactoryInterfaceFactory.get(TouchButtonTurnLeftResource.RESOURCE).getInstance(),
              commonButtons.NORMAL_BUTTON,
              basicTouchButtonCellPositionFactory.BOTTOM_LEFT,
              touchButtonLocationHelper.getColumnsRemainderHalf(),
              touchButtonLocationHelper.getRowsRemainderHalf());

      TouchButton LEFT2 =
          new FullTouchButton(
              basicTouchInputFactory.LEFT,
              animationInterface,
              // (Animation)
              // featuredAnimationInterfaceFactoryInterfaceFactory.get(TouchButtonTurnLeftResource.RESOURCE).getInstance(),
              commonButtons.NORMAL_BUTTON,
              basicTouchButtonCellPositionFactory.BOTTOM_SECOND_FROM_LEFT,
              touchButtonLocationHelper.getColumnsRemainderHalf(),
              touchButtonLocationHelper.getRowsRemainderHalf());

      TouchButton LEFT3 =
          new FullTouchButton(
              basicTouchInputFactory.LEFT,
              animationInterface,
              // (Animation)
              // featuredAnimationInterfaceFactoryInterfaceFactory.get(TouchButtonTurnLeftResource.RESOURCE).getInstance(),
              commonButtons.NORMAL_BUTTON,
              basicTouchButtonCellPositionFactory.SECOND_FROM_BOTTOM_LEFT,
              touchButtonLocationHelper.getColumnsRemainderHalf(),
              touchButtonLocationHelper.getRowsRemainderHalf());

      TouchButton LEFT4 =
          new FullTouchButton(
              basicTouchInputFactory.LEFT,
              animationInterface,
              // (Animation)
              // featuredAnimationInterfaceFactoryInterfaceFactory.get(TouchButtonTurnLeftResource.RESOURCE).getInstance(),
              commonButtons.NORMAL_BUTTON,
              basicTouchButtonCellPositionFactory.SECOND_FROM_BOTTOM_SECOND_FROM_LEFT,
              touchButtonLocationHelper.getColumnsRemainderHalf(),
              touchButtonLocationHelper.getRowsRemainderHalf());

      TouchButton RIGHT =
          new FullTouchButton(
              basicTouchInputFactory.RIGHT,
              animationInterface,
              // (Animation)
              // featuredAnimationInterfaceFactoryInterfaceFactory.get(TouchButtonTurnRightResource.RESOURCE).getInstance(),
              commonButtons.NORMAL_BUTTON,
              basicTouchButtonCellPositionFactory.BOTTOM_RIGHT,
              touchButtonLocationHelper.getColumnsRemainderHalf(),
              touchButtonLocationHelper.getRowsRemainderHalf());

      TouchButton RIGHT2 =
          new FullTouchButton(
              basicTouchInputFactory.RIGHT,
              animationInterface,
              // (Animation)
              // featuredAnimationInterfaceFactoryInterfaceFactory.get(TouchButtonTurnRightResource.RESOURCE).getInstance(),
              commonButtons.NORMAL_BUTTON,
              basicTouchButtonCellPositionFactory.BOTTOM_SECOND_FROM_RIGHT,
              touchButtonLocationHelper.getColumnsRemainderHalf(),
              touchButtonLocationHelper.getRowsRemainderHalf());

      TouchButton RIGHT3 =
          new FullTouchButton(
              basicTouchInputFactory.RIGHT,
              animationInterface,
              // (Animation)
              // featuredAnimationInterfaceFactoryInterfaceFactory.get(TouchButtonTurnRightResource.RESOURCE).getInstance(),
              commonButtons.NORMAL_BUTTON,
              basicTouchButtonCellPositionFactory.SECOND_FROM_BOTTOM_RIGHT,
              touchButtonLocationHelper.getColumnsRemainderHalf(),
              touchButtonLocationHelper.getRowsRemainderHalf());

      TouchButton RIGHT4 =
          new FullTouchButton(
              basicTouchInputFactory.RIGHT,
              animationInterface,
              // (Animation)
              // featuredAnimationInterfaceFactoryInterfaceFactory.get(TouchButtonTurnRightResource.RESOURCE).getInstance(),
              commonButtons.NORMAL_BUTTON,
              basicTouchButtonCellPositionFactory.SECOND_FROM_BOTTOM_SECOND_FROM_RIGHT,
              touchButtonLocationHelper.getColumnsRemainderHalf(),
              touchButtonLocationHelper.getRowsRemainderHalf());

      list.add(LEFT);
      list.add(LEFT2);
      list.add(LEFT3);
      list.add(LEFT4);

      list.add(RIGHT);
      list.add(RIGHT2);
      list.add(RIGHT3);
      list.add(RIGHT4);

      if (basicTouchButtonCellPositionFactory.THIRD_FROM_BOTTOM_RIGHT
          != CellPositionFactory.getInstance().NONE) {
        TouchButton WEAPON =
            new TouchButton(
                basicTouchInputFactory.SPECIAL_BUTTON_FIVE,
                featuredAnimationInterfaceFactoryInterfaceFactory
                    .get(TouchButtonGenericActionResource.RESOURCE)
                    .getInstance(),
                commonButtons.NORMAL_BUTTON,
                basicTouchButtonCellPositionFactory.THIRD_FROM_BOTTOM_RIGHT,
                touchButtonLocationHelper.getColumnsRemainderHalf(),
                touchButtonLocationHelper.getRowsRemainderHalf());

        list.add(WEAPON);
      }
      return list;
    } catch (Exception e) {
      LogUtil.put(
          LogFactory.getInstance(
              CommonStrings.getInstance().EXCEPTION,
              this,
              CommonStrings.getInstance().GET_LIST,
              e));
      return BasicArrayListUtil.getInstance().getImmutableInstance();
    }
  }