예제 #1
0
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
      if (savedInstanceState != null) {
        long objId = savedInstanceState.getLong("objId");
        loadFromObj(App.instance().getMusubi().objForId(objId));
      }

      final DbEntryHandler dbType = DbObjects.forType(mType);
      final List<ObjAction> actions = new ArrayList<ObjAction>();
      for (ObjAction action : ObjActions.getObjActions()) {
        if (action.isActive(getActivity(), dbType, mJson)) {
          actions.add(action);
        }
      }
      final String[] actionLabels = new String[actions.size()];
      int i = 0;
      for (ObjAction action : actions) {
        actionLabels[i++] = action.getLabel(getActivity());
      }
      return new AlertDialog.Builder(getActivity())
          .setTitle("Handle...")
          .setItems(
              actionLabels,
              new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                  Log.d(TAG, "getting for " + getActivity());
                  actions.get(which).actOn(getActivity(), dbType, mObj);
                }
              })
          .create();
    }
예제 #2
0
  private String getFeedObjectClause() {
    // TODO: Enumerate all Object classes, look for FeedRenderables.

    String[] types = DbObjects.getRenderableTypes();
    StringBuffer allowed = new StringBuffer();
    for (String type : types) {
      allowed.append(",'").append(type).append("'");
    }
    return DbObject.TYPE
        + " in ("
        + allowed.substring(1)
        + ") AND "
        + DbObject.TABLE
        + "."
        + DbObject.FEED_NAME
        + " NOT IN ('direct', 'friend', '')";
  }