Android Open Source - android-to-do-list Functions






From Project

Back to project page android-to-do-list.

License

The source code is released under:

GNU General Public License

If you think the Android project android-to-do-list 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.android.ansidev.todolist;
/*from  www .j  a va2s.  co  m*/
import java.util.ArrayList;


public class Functions {
  public static void swapItem(ArrayList<String> arrList, int pos1, int pos2) {
    String temp = arrList.get(pos1);
    arrList.set(pos1, arrList.get(pos2));
    arrList.set(pos2, temp);
  }
  
  public static void moveTop(ArrayList<String> arrList, int pos) {
    arrList.add(0, arrList.get(pos));
    arrList.remove(pos + 1);
    
  }
  
  public static void moveBottom(ArrayList<String> arrList, int pos) {
    arrList.add(arrList.get(pos));
    arrList.remove(pos);
  }
  
  public static void moveUp(ArrayList<String> arrList, int pos) {
    if(pos > 0) {
      swapItem(arrList, pos, pos - 1);
    }
    else {
      return;
    }
  }
  
  public static void moveDown(ArrayList<String> arrList, int pos) {
    if(pos < arrList.size() - 1) {
      swapItem(arrList, pos, pos + 1);
    }
    else {
      return;
    }
  }
}




Java Source Code List

com.android.ansidev.todolist.Functions.java
com.android.ansidev.todolist.MainActivity.java
com.android.ansidev.todolist.SettingsActivity.java