Android Open Source - Tasque-for-Android Category






From Project

Back to project page Tasque-for-Android.

License

The source code is released under:

MIT License

If you think the Android project Tasque-for-Android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.bustiblelemons.tasque.frontend;
//from   ww  w . j  av a  2  s.c om
import java.util.Collection;

import android.content.Context;

import com.bustiblelemons.tasque.database.Database;
import com.bustiblelemons.tasque.rtm.RTMBackend;
import com.bustiblelemons.tasque.utilities.Connection;

public class Category {

  public static boolean rename(Context context, String categoryId, String categoryName) {
    long r = -1;
    if (RTMBackend.useRTM(context)) {
      if (Connection.isUp(context)) {
        RTMBackend.setListName(context, categoryId, categoryName);
        r = Database.setCategoryName(context, categoryId, categoryName);
      } else {
        r = Database.cacheCateogryRenamed(context, categoryId, categoryName);
      }
    } else {
      r = Database.setCategoryName(context, categoryId, categoryName);
    }
    
    if (r > 0) {
      return true;
    } else {
      return false;
    }
  }

  public static boolean insert(Context context, String categoryName) {
    long r = -1;
    if (RTMBackend.useRTM(context)) {
      if (Connection.isUp(context)) {
        String listId = RTMBackend.newList(context, categoryName);
        if (listId.length() > 0) {
          r = Database.newCategory(context, categoryName, listId);
        }
      } else {
        r = Database.cacheNewCategory(context, categoryName);
      }

    } else {
      r = Database.newCategory(context, categoryName);
    }
    if (r > 0) {
      return true;
    } else {
      return false;
    }
  }

  /**
   * Tasks in a list should be moved to inbox, they are not deleted.
   * @param context
   * @param listIds
   */
  public static void delete(Context context, Collection<String> listIds) {
    if (RTMBackend.useRTM(context)) {
      if (Connection.isUp(context)) {
        RTMBackend.deleteLists(context, listIds);
        Database.deleteCategories(context, listIds);
      } else {
        Database.cacheCategoriesDeleted(context, listIds);
      }
    } else {
      Database.deleteCategories(context, listIds);
    }
  }
}




Java Source Code List

com.bustiblelemons.tasque.database.DatabaseAdapter.java
com.bustiblelemons.tasque.database.Database.java
com.bustiblelemons.tasque.frontend.Alarms.java
com.bustiblelemons.tasque.frontend.Category.java
com.bustiblelemons.tasque.frontend.Note.java
com.bustiblelemons.tasque.frontend.Task.java
com.bustiblelemons.tasque.main.CategoriesFragment.java
com.bustiblelemons.tasque.main.CompletedTasksFragment.java
com.bustiblelemons.tasque.main.NotesAdapter.java
com.bustiblelemons.tasque.main.NotesFragment.java
com.bustiblelemons.tasque.main.RightSideFragmentPocketListener.java
com.bustiblelemons.tasque.main.SpinnerAdapter.java
com.bustiblelemons.tasque.main.TasqueAdapter.java
com.bustiblelemons.tasque.main.TasqueCategoryAdapter.java
com.bustiblelemons.tasque.main.TasqueGroupFragment.java
com.bustiblelemons.tasque.main.TasqueRTMCategoryAdapter.java
com.bustiblelemons.tasque.main.Tasque.java
com.bustiblelemons.tasque.rtm.RTMAuthFragment.java
com.bustiblelemons.tasque.rtm.RTMBackend.java
com.bustiblelemons.tasque.rtm.RTMConnectivityReceiver.java
com.bustiblelemons.tasque.rtm.RTMLoginFromSettings.java
com.bustiblelemons.tasque.rtm.RTMSyncBroadcastReceiver.java
com.bustiblelemons.tasque.rtm.RTMSyncService.java
com.bustiblelemons.tasque.rtm.SynchronizingFragment.java
com.bustiblelemons.tasque.settings.RTMBackendFragmentSettings.java
com.bustiblelemons.tasque.settings.SettingsActivity.java
com.bustiblelemons.tasque.settings.SettingsUtil.java
com.bustiblelemons.tasque.splash.ExportToExternalFragment.java
com.bustiblelemons.tasque.splash.ExternalProblemsFragment.java
com.bustiblelemons.tasque.splash.ImporterActivity.java
com.bustiblelemons.tasque.splash.Splash.java
com.bustiblelemons.tasque.tutorial.OSChooserFragment.java
com.bustiblelemons.tasque.tutorial.OSListAdapter.java
com.bustiblelemons.tasque.tutorial.SynchronizeTutorialActivity.java
com.bustiblelemons.tasque.tutorial.SynchronizedFilesAdapter.java
com.bustiblelemons.tasque.tutorial.TutorialTabFragment.java
com.bustiblelemons.tasque.utilities.Connection.java
com.bustiblelemons.tasque.utilities.PermissionParser.java
com.bustiblelemons.tasque.utilities.PriorityParser.java
com.bustiblelemons.tasque.utilities.Utility.java
com.bustiblelemons.tasque.utilities.Values.java