Exemplo n.º 1
0
 private boolean userCanEditAtLeastOneSchedule(Experiment experiment) {
   List<ExperimentGroup> groups = experiment.getExperimentDAO().getGroups();
   for (ExperimentGroup experimentGroup : groups) {
     List<ActionTrigger> actionTriggers = experimentGroup.getActionTriggers();
     for (ActionTrigger actionTrigger : actionTriggers) {
       if (actionTrigger instanceof ScheduleTrigger) {
         ScheduleTrigger scheduleTrigger = (ScheduleTrigger) actionTrigger;
         List<Schedule> schedules = scheduleTrigger.getSchedules();
         for (Schedule schedule : schedules) {
           if (schedule.getUserEditable()) {
             boolean userCanOnlyEditOnJoin = schedule.getOnlyEditableOnJoin();
             if (!userCanOnlyEditOnJoin) {
               return true;
             }
           }
         }
       }
     }
   }
   return false;
 }
Exemplo n.º 2
0
          @Override
          public void onClick(final View v) {
            final int position = list.getPositionForView(v);
            if (position == ListView.INVALID_POSITION) {
              return;
            } else {
              final Long experimentServerId = (Long) v.getTag();
              final Experiment experiment = experiments.get(position);
              final List<ExperimentGroup> groups = experiment.getExperimentDAO().getGroups();

              if (v.getId() == R.id.menuButton) {
                showPopup(experiment, v);
              } else {
                Intent experimentIntent = null;
                if (groups.size() > 1) {
                  experimentIntent =
                      new Intent(MyExperimentsActivity.this, ExperimentGroupPicker.class);
                  experimentIntent.putExtra(
                      ExperimentGroupPicker.SHOULD_GO_TO_RENDER_NEXT,
                      ExperimentGroupPicker.RENDER_NEXT);
                } else {
                  Class clazz = null;
                  final ExperimentGroup experimentGroup = groups.get(0);
                  if (experimentGroup.getCustomRendering()) {
                    clazz = ExperimentExecutorCustomRendering.class;
                  } else {
                    clazz = ExperimentExecutor.class;
                  }
                  experimentIntent = new Intent(MyExperimentsActivity.this, clazz);
                  experimentIntent.putExtra(
                      Experiment.EXPERIMENT_GROUP_NAME_EXTRA_KEY, experimentGroup.getName());
                }
                experimentIntent.putExtra(
                    Experiment.EXPERIMENT_SERVER_ID_EXTRA_KEY, experimentServerId);
                startActivity(experimentIntent);
              }
            }
          }