コード例 #1
0
  private FilterListItem[] prepareFilters(Context context) {
    DependencyInjectionService.getInstance().inject(this);
    Resources r = context.getResources();

    Filter[] savedFilters = buildSavedFilters(context, r);
    return savedFilters;
  }
コード例 #2
0
  @Override
  public void onReceive(Context context, Intent intent) {
    DependencyInjectionService.getInstance().inject(this);
    ContextManager.setContext(context);
    tagService = TagService.getInstance();

    Resources r = context.getResources();
    ArrayList<FilterListItem> list = new ArrayList<FilterListItem>();

    // --- header
    FilterListHeader tagsHeader = new FilterListHeader(context.getString(R.string.tag_FEx_header));
    list.add(tagsHeader);

    // --- untagged
    Filter untagged =
        new Filter(
            r.getString(R.string.tag_FEx_untagged),
            r.getString(R.string.tag_FEx_untagged),
            tagService.untaggedTemplate(),
            null);
    untagged.listingIcon = ((BitmapDrawable) r.getDrawable(R.drawable.filter_untagged)).getBitmap();
    list.add(untagged);

    addTags(list);

    // transmit filter list
    FilterListItem[] listAsArray = list.toArray(new FilterListItem[list.size()]);
    Intent broadcastIntent = new Intent(AstridApiConstants.BROADCAST_SEND_FILTERS);
    broadcastIntent.putExtra(AstridApiConstants.EXTRAS_RESPONSE, listAsArray);
    broadcastIntent.putExtra(AstridApiConstants.EXTRAS_ADDON, TagsPlugin.IDENTIFIER);
    context.sendBroadcast(broadcastIntent, AstridApiConstants.PERMISSION_READ);
  }
コード例 #3
0
    @Override
    protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setTheme(android.R.style.Theme_Dialog);

      final long id = getIntent().getLongExtra(TOKEN_FILTER_ID, -1);
      if (id == -1) {
        finish();
        return;
      }
      final String name = getIntent().getStringExtra(TOKEN_FILTER_NAME);

      DependencyInjectionService.getInstance().inject(this);
      DialogUtilities.okCancelDialog(
          this,
          getString(R.string.DLG_delete_this_item_question, name),
          new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
              PluginServices.getStoreObjectDao().delete(id);
              setResult(RESULT_OK);
              finish();
            }
          },
          new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
              setResult(RESULT_CANCELED);
              finish();
            }
          });
    }
コード例 #4
0
 public GtasksLegacyMigrator(
     GtasksInvoker service, GtasksListService listService, TaskLists allLists) {
   DependencyInjectionService.getInstance().inject(this);
   this.gtasksService = service;
   this.listService = listService;
   this.allLists = allLists;
 }
コード例 #5
0
  @Override
  public void onCreate() {
    DependencyInjectionService.getInstance().inject(this);

    database.openForReading();
    cursor = getCursor();
  }
コード例 #6
0
ファイル: EditNoteActivity.java プロジェクト: 2bfree/astrid
  public EditNoteActivity(Fragment fragment, View parent, long t) {
    super(fragment.getActivity());
    DependencyInjectionService.getInstance().inject(this);

    imageCache = AsyncImageView.getImageCache();
    this.fragment = fragment;

    this.activity = (AstridActivity) fragment.getActivity();

    this.resources = fragment.getResources();
    TypedValue tv = new TypedValue();
    fragment.getActivity().getTheme().resolveAttribute(R.attr.asTextColor, tv, false);
    color = tv.data;

    fragment.getActivity().getTheme().resolveAttribute(R.attr.asDueDateColor, tv, false);
    grayColor = tv.data;

    linkColor = UpdateAdapter.getLinkColor(fragment);

    cameraButton = getDefaultCameraButton();

    setOrientation(VERTICAL);

    commentsBar = parent.findViewById(R.id.updatesFooter);

    loadViewForTaskID(t);
  }
コード例 #7
0
ファイル: TaskListFragment.java プロジェクト: junekai/astrid
 /** Called when loading up the activity */
 @Override
 public void onCreate(Bundle savedInstanceState) {
   DependencyInjectionService.getInstance().inject(this);
   super.onCreate(savedInstanceState);
   extras = getArguments() != null ? getArguments().getBundle(TOKEN_EXTRAS) : null;
   if (extras == null)
     extras = new Bundle(); // Just need an empty one to prevent potential null pointers
 }
コード例 #8
0
  public FilesControlSet(Activity activity, int viewLayout, int displayViewLayout, int title) {
    super(activity, viewLayout, displayViewLayout, title);
    DependencyInjectionService.getInstance().inject(this);

    displayText.setText(activity.getString(R.string.TEA_control_files));
    fileDisplayList = (LinearLayout) getDisplayView().findViewById(R.id.files_list);
    inflater = (LayoutInflater) activity.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
  }
コード例 #9
0
ファイル: ActFmSyncThread.java プロジェクト: jomNext/tasks
 private ActFmSyncThread(List<ClientToServerMessage<?>> messageQueue, Object syncMonitor) {
   DependencyInjectionService.getInstance().inject(this);
   this.pendingMessages = messageQueue;
   this.pendingCallbacks =
       Collections.synchronizedMap(new HashMap<ClientToServerMessage<?>, SyncMessageCallback>());
   this.monitor = syncMonitor;
   this.syncMigration = Preferences.getBoolean(AstridNewSyncMigrator.PREF_SYNC_MIGRATION, false);
   this.notificationManager = new AndroidNotificationManager(ContextManager.getContext());
 }
コード例 #10
0
ファイル: SyncProvider.java プロジェクト: rohitpawar/astrid
  public SyncProvider() {
    DependencyInjectionService.getInstance().inject(this);

    // initialize notification
    int icon = android.R.drawable.stat_notify_sync;
    long when = System.currentTimeMillis();
    notification = new Notification(icon, null, when);
    notification.flags |= Notification.FLAG_ONGOING_EVENT;
  }
コード例 #11
0
  public EditPeopleControlSet(Activity activity, int loginRequestCode) {
    DependencyInjectionService.getInstance().inject(this);
    this.activity = activity;
    this.loginRequestCode = loginRequestCode;

    sharedWithContainer = (PeopleContainer) activity.findViewById(R.id.share_container);
    assignedCustom = (EditText) activity.findViewById(R.id.assigned_custom);
    assignedSpinner = (Spinner) activity.findViewById(R.id.assigned_spinner);
    cbFacebook = (CheckBox) activity.findViewById(R.id.checkbox_facebook);
    cbTwitter = (CheckBox) activity.findViewById(R.id.checkbox_twitter);

    sharedWithContainer.addPerson(""); // $NON-NLS-1$
    setUpListeners();
  }
コード例 #12
0
ファイル: UpdateAdapter.java プロジェクト: nagabrahmam/astrid
  /**
   * Constructor
   *
   * @param activity
   * @param resource layout resource to inflate
   * @param c database cursor
   * @param autoRequery whether cursor is automatically re-queried on changes
   * @param onCompletedTaskListener goal listener. can be null
   */
  public UpdateAdapter(
      ListActivity activity,
      int resource,
      Cursor c,
      boolean autoRequery,
      OnCompletedTaskListener onCompletedTaskListener) {
    super(activity, c, autoRequery);
    DependencyInjectionService.getInstance().inject(this);

    inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    this.resource = resource;
    this.activity = activity;
  }
コード例 #13
0
  @Override
  public void onReceive(Context context, Intent intent) {
    ContextManager.setContext(context);
    DependencyInjectionService.getInstance().inject(this);
    long taskId = intent.getLongExtra(AstridApiConstants.EXTRAS_TASK_ID, -1);
    if (taskId == -1) return;

    Task task = PluginServices.getTaskService().fetchById(taskId, Task.PROPERTIES);
    if (task == null || !task.isCompleted()) return;

    String recurrence = task.getValue(Task.RECURRENCE);
    if (recurrence != null && recurrence.length() > 0) {
      long newDueDate;
      try {
        newDueDate = computeNextDueDate(task, recurrence);
        if (newDueDate == -1) return;
      } catch (ParseException e) {
        PluginServices.getExceptionService().reportError("repeat-parse", e); // $NON-NLS-1$
        return;
      }

      StatisticsService.reportEvent(StatisticsConstants.V2_TASK_REPEAT);

      long oldDueDate = task.getValue(Task.DUE_DATE);
      long repeatUntil = task.getValue(Task.REPEAT_UNTIL);

      boolean repeatFinished = repeatUntil > 0 && newDueDate >= repeatUntil;
      if (repeatFinished) {
        Intent repeatFinishedIntent =
            new Intent(AstridApiConstants.BROADCAST_EVENT_TASK_REPEAT_FINISHED);
        repeatFinishedIntent.putExtra(AstridApiConstants.EXTRAS_TASK_ID, task.getId());
        repeatFinishedIntent.putExtra(AstridApiConstants.EXTRAS_OLD_DUE_DATE, oldDueDate);
        repeatFinishedIntent.putExtra(AstridApiConstants.EXTRAS_NEW_DUE_DATE, newDueDate);
        context.sendOrderedBroadcast(repeatFinishedIntent, null);
        return;
      }

      rescheduleTask(task, newDueDate);

      // send a broadcast
      Intent broadcastIntent = new Intent(AstridApiConstants.BROADCAST_EVENT_TASK_REPEATED);
      broadcastIntent.putExtra(AstridApiConstants.EXTRAS_TASK_ID, task.getId());
      broadcastIntent.putExtra(AstridApiConstants.EXTRAS_OLD_DUE_DATE, oldDueDate);
      broadcastIntent.putExtra(AstridApiConstants.EXTRAS_NEW_DUE_DATE, newDueDate);
      context.sendOrderedBroadcast(broadcastIntent, null);
      Flags.set(Flags.REFRESH);
      return;
    }
  }
コード例 #14
0
  /**
   * Constructor
   *
   * @param activity
   * @param resource layout resource to inflate
   * @param c database cursor
   * @param autoRequery whether cursor is automatically re-queried on changes
   * @param onCompletedTaskListener goal listener. can be null
   */
  public UpdateAdapter(
      Fragment fragment, int resource, Cursor c, boolean autoRequery, String fromView) {
    super(fragment.getActivity(), c, autoRequery);
    DependencyInjectionService.getInstance().inject(this);

    linkColor = getLinkColor(fragment);

    inflater =
        (LayoutInflater) fragment.getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    imageCache = ImageDiskCache.getInstance();
    this.fromView = fromView;

    this.resource = resource;
    this.fragment = fragment;
  }
コード例 #15
0
ファイル: FetchHistory.java プロジェクト: ryabenko-pro/astrid
 public FetchHistory(
     RemoteModelDao<TYPE> dao,
     LongProperty historyTimeProperty,
     String table,
     String uuid,
     String taskTitle,
     long modifiedAfter,
     boolean includeTaskHistory,
     SyncMessageCallback done) {
   DependencyInjectionService.getInstance().inject(this);
   this.dao = dao;
   this.historyTimeProperty = historyTimeProperty;
   this.table = table;
   this.uuid = uuid;
   this.taskTitle = taskTitle;
   this.modifiedAfter = modifiedAfter;
   this.includeTaskHistory = includeTaskHistory;
   this.done = done;
 }
コード例 #16
0
    @Override
    protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setTheme(android.R.style.Theme_Dialog);

      tag = getIntent().getStringExtra(TAG);
      if (tag == null) {
        finish();
        return;
      }
      DependencyInjectionService.getInstance().inject(this);

      TagData tagData = tagDataService.getTag(tag, TagData.MEMBER_COUNT);
      if (tagData != null && tagData.getValue(TagData.MEMBER_COUNT) > 0) {
        DialogUtilities.okDialog(
            this, getString(R.string.actfm_tag_operation_disabled), getCancelListener());
        return;
      }
      showDialog();
    }
コード例 #17
0
ファイル: UpdateAdapter.java プロジェクト: kvite/Tasquid
  /**
   * Constructor
   *
   * @param activity
   * @param resource layout resource to inflate
   * @param c database cursor
   * @param autoRequery whether cursor is automatically re-queried on changes
   * @param onCompletedTaskListener goal listener. can be null
   */
  public UpdateAdapter(
      Fragment fragment, int resource, Cursor c, boolean autoRequery, String fromView) {
    super(fragment.getActivity(), c, autoRequery);
    DependencyInjectionService.getInstance().inject(this);

    linkColor = getLinkColor(fragment);

    inflater =
        (LayoutInflater) fragment.getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    imageCache = AsyncImageView.getImageCache();
    this.fromView = fromView;

    this.resource = resource;
    this.fragment = fragment;
    this.self = getSelfUser();

    TypedValue tv = new TypedValue();
    fragment.getActivity().getTheme().resolveAttribute(R.attr.asTextColor, tv, false);
    color = tv.data;

    fragment.getActivity().getTheme().resolveAttribute(R.attr.asDueDateColor, tv, false);
    grayColor = tv.data;
  }
コード例 #18
0
ファイル: ReminderService.java プロジェクト: jomNext/tasks
 private ReminderService() {
   DependencyInjectionService.getInstance().inject(this);
   setPreferenceDefaults();
 }
コード例 #19
0
 public EditPreferences() {
   DependencyInjectionService.getInstance().inject(this);
 }
コード例 #20
0
 public Astrid2To3UpgradeHelper() {
   DependencyInjectionService.getInstance().inject(this);
 }
コード例 #21
0
ファイル: TasksWidget.java プロジェクト: netrus/astrid
    @SuppressWarnings("nls")
    public RemoteViews buildUpdate(Context context, int widgetId) {
      DependencyInjectionService.getInstance().inject(this);

      RemoteViews views = null;

      views = new RemoteViews(context.getPackageName(), R.layout.widget_initialized);

      int[] textIDs = TEXT_IDS;
      int[] separatorIDs = SEPARATOR_IDS;
      int numberOfTasks = 5;

      for (int i = 0; i < textIDs.length; i++) views.setTextViewText(textIDs[i], "");

      TodorooCursor<Task> cursor = null;
      Filter filter = null;
      try {
        filter = getFilter(widgetId);
        views.setTextViewText(R.id.widget_title, filter.title);

        SharedPreferences publicPrefs = AstridPreferences.getPublicPrefs(this);
        int flags = publicPrefs.getInt(SortHelper.PREF_SORT_FLAGS, 0);
        int sort = publicPrefs.getInt(SortHelper.PREF_SORT_SORT, 0);
        String query =
            SortHelper.adjustQueryForFlagsAndSort(filter.sqlQuery, flags, sort)
                    .replaceAll("LIMIT \\d+", "")
                + " LIMIT "
                + numberOfTasks;

        database.openForReading();
        cursor =
            taskService.fetchFiltered(
                query, null, Task.ID, Task.TITLE, Task.DUE_DATE, Task.COMPLETION_DATE);
        Task task = new Task();
        for (int i = 0; i < cursor.getCount() && i < numberOfTasks; i++) {
          cursor.moveToPosition(i);
          task.readFromCursor(cursor);

          String textContent = "";
          int textColor = Color.WHITE;

          textContent = task.getValue(Task.TITLE);

          if (task.isCompleted())
            textColor = context.getResources().getColor(R.color.task_list_done);
          else if (task.hasDueDate() && task.getValue(Task.DUE_DATE) < DateUtilities.now())
            textColor = context.getResources().getColor(R.color.task_list_overdue);

          if (i > 0) views.setViewVisibility(separatorIDs[i - 1], View.VISIBLE);
          views.setTextViewText(textIDs[i], textContent);
          views.setTextColor(textIDs[i], textColor);
        }

        for (int i = cursor.getCount() - 1; i < separatorIDs.length; i++) {
          if (i >= 0) views.setViewVisibility(separatorIDs[i], View.INVISIBLE);
        }
      } catch (Exception e) {
        // can happen if database is not ready
        Log.e("WIDGET-UPDATE", "Error updating widget", e);
      } finally {
        if (cursor != null) cursor.close();
      }

      updateForScreenSize(views);

      Intent listIntent = new Intent(context, TaskListActivity.class);
      String customIntent =
          Preferences.getStringValue(WidgetConfigActivity.PREF_CUSTOM_INTENT + widgetId);
      if (customIntent != null) {
        listIntent.setComponent(ComponentName.unflattenFromString(customIntent));
        String serializedExtras =
            Preferences.getStringValue(WidgetConfigActivity.PREF_CUSTOM_EXTRAS + widgetId);
        Bundle extras = AndroidUtilities.bundleFromSerializedString(serializedExtras);
        listIntent.putExtras(extras);
      }
      listIntent.putExtra(TaskListActivity.TOKEN_SOURCE, Constants.SOURCE_WIDGET);
      listIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
      if (filter != null) {
        listIntent.putExtra(TaskListActivity.TOKEN_FILTER, filter);
        listIntent.setAction("L" + widgetId + filter.sqlQuery);
      }
      PendingIntent pendingIntent =
          PendingIntent.getActivity(
              context, widgetId, listIntent, PendingIntent.FLAG_CANCEL_CURRENT);
      views.setOnClickPendingIntent(R.id.taskbody, pendingIntent);

      Intent editIntent = new Intent(context, TaskEditActivity.class);
      editIntent.setFlags(
          Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
      if (filter != null && filter.valuesForNewTasks != null) {
        String values = AndroidUtilities.contentValuesToSerializedString(filter.valuesForNewTasks);
        editIntent.putExtra(TaskEditActivity.TOKEN_VALUES, values);
        editIntent.setType(values);
      }
      pendingIntent = PendingIntent.getActivity(context, 0, editIntent, 0);
      views.setOnClickPendingIntent(R.id.widget_button, pendingIntent);

      return views;
    }
コード例 #22
0
ファイル: GtasksSyncService.java プロジェクト: reezzo/astrid
 public GtasksSyncService() {
   DependencyInjectionService.getInstance().inject(this);
 }
コード例 #23
0
ファイル: UpgradeService.java プロジェクト: harippa/astrid
 public UpgradeService() {
   DependencyInjectionService.getInstance().inject(this);
 }
コード例 #24
0
ファイル: FilterCounter.java プロジェクト: credil/astrid
 FilterCounter(ExecutorService executorService) {
   this.executorService = executorService;
   DependencyInjectionService.getInstance().inject(this);
 }
コード例 #25
0
ファイル: Eula.java プロジェクト: kvite/Tasquid
 private Eula() {
   // don't construct me
   DependencyInjectionService.getInstance().inject(this);
 }
コード例 #26
0
ファイル: MetadataDao.java プロジェクト: ralph961/tasks
 public MetadataDao() {
   super(Metadata.class);
   DependencyInjectionService.getInstance().inject(this);
   setDatabase(database);
 }
コード例 #27
0
 public OrderedMetadataListFragmentHelper(
     TaskListFragment fragment, OrderedMetadataListUpdater<LIST> updater) {
   DependencyInjectionService.getInstance().inject(this);
   this.fragment = fragment;
   this.updater = updater;
 }
コード例 #28
0
 public TaskEditActivity() {
   DependencyInjectionService.getInstance().inject(this);
 }
コード例 #29
0
ファイル: ActFmInvoker.java プロジェクト: benwh/astrid
 /**
  * Create new api invoker service with a token
  *
  * @token access token
  */
 public ActFmInvoker(String token) {
   this.token = token;
   DependencyInjectionService.getInstance().inject(this);
 }
コード例 #30
0
ファイル: ActFmInvoker.java プロジェクト: benwh/astrid
 /** Create new api invoker service without a token */
 public ActFmInvoker() {
   //
   DependencyInjectionService.getInstance().inject(this);
 }