Пример #1
0
 public boolean existLookDataByName(LookData look) {
   for (LookData lookdata : lookList) {
     if (lookdata.getLookName().equals(look.getLookName())) {
       return true;
     }
   }
   return false;
 }
Пример #2
0
  @Override
  public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, view, menuInfo);

    selectedLookData = adapter.getItem(selectedLookPosition);
    menu.setHeaderTitle(selectedLookData.getLookName());

    getSherlockActivity().getMenuInflater().inflate(R.menu.context_menu_default, menu);
    menu.findItem(R.id.context_edit_in_pocket_paint).setVisible(true);
  }
Пример #3
0
 private Object interpretObjectSensor(Sensors sensor, Sprite sprite) {
   Object returnValue = 0d;
   LookData lookData = sprite.look.getLookData();
   List<LookData> lookDataList = sprite.getLookDataList();
   if (lookData == null && lookDataList.size() > 0) {
     lookData = lookDataList.get(0);
   }
   switch (sensor) {
     case OBJECT_BRIGHTNESS:
       returnValue = (double) sprite.look.getBrightnessInUserInterfaceDimensionUnit();
       break;
     case OBJECT_COLOR:
       returnValue = (double) sprite.look.getColorInUserInterfaceDimensionUnit();
       break;
     case OBJECT_TRANSPARENCY:
       returnValue = (double) sprite.look.getTransparencyInUserInterfaceDimensionUnit();
       break;
     case OBJECT_LAYER:
       returnValue = (double) sprite.look.getZIndex();
       break;
     case OBJECT_ROTATION:
       returnValue = (double) sprite.look.getDirectionInUserInterfaceDimensionUnit();
       break;
     case OBJECT_SIZE:
       returnValue = (double) sprite.look.getSizeInUserInterfaceDimensionUnit();
       break;
     case OBJECT_X:
       returnValue = (double) sprite.look.getXInUserInterfaceDimensionUnit();
       break;
     case OBJECT_Y:
       returnValue = (double) sprite.look.getYInUserInterfaceDimensionUnit();
       break;
     case OBJECT_ANGULAR_VELOCITY:
       returnValue = (double) sprite.look.getAngularVelocityInUserInterfaceDimensionUnit();
       break;
     case OBJECT_X_VELOCITY:
       returnValue = (double) sprite.look.getXVelocityInUserInterfaceDimensionUnit();
       break;
     case OBJECT_Y_VELOCITY:
       returnValue = (double) sprite.look.getYVelocityInUserInterfaceDimensionUnit();
       break;
     case OBJECT_LOOK_NUMBER:
     case OBJECT_BACKGROUND_NUMBER:
       returnValue = 1.0d + ((lookData != null) ? lookDataList.indexOf(lookData) : 0);
       break;
     case OBJECT_LOOK_NAME:
     case OBJECT_BACKGROUND_NAME:
       returnValue = (lookData != null) ? lookData.getLookName() : "";
       break;
     case OBJECT_DISTANCE_TO:
       returnValue = (double) sprite.look.getDistanceToTouchPositionInUserInterfaceDimensions();
   }
   return returnValue;
 }
Пример #4
0
  private void copyLook(int position) {
    LookData lookData = lookDataList.get(position);

    try {
      String projectName = ProjectManager.getInstance().getCurrentProject().getName();

      StorageHandler.getInstance().copyImage(projectName, lookData.getAbsolutePath(), null);

      String imageName = lookData.getLookName() + "_" + getString(R.string.copy_look_addition);
      String imageFileName = lookData.getLookFileName();

      updateLookAdapter(imageName, imageFileName);
    } catch (IOException e) {
      Utils.showErrorDialog(getActivity(), getString(R.string.error_load_image));
      e.printStackTrace();
    }
    getActivity().sendBroadcast(new Intent(ScriptActivity.ACTION_BRICK_LIST_CHANGED));
  }
Пример #5
0
 @Override
 protected void showRenameDialog() {
   RenameLookDialog renameLookDialog =
       RenameLookDialog.newInstance(selectedLookData.getLookName());
   renameLookDialog.show(getFragmentManager(), RenameLookDialog.DIALOG_FRAGMENT_TAG);
 }