To Do List In Android With Source Code

Introduction

To Do List in android is a way of organizing the day-to-day work in a proper manner. To do list will help you to keep track of anything in one place so, you can complete the work.

This app will help you to do your work on time and complete it with in a deadline. It will help you to organize the plan according to your importance. The art of work will be done and peaceful mind will be captured accordingly.

Background Reading

To Do List in android is a well-designed app that does work what it is suppose to do and no any additional feature. Therefore, you can make tasks, create an explanation for them and then you can add some sub tasks.

To Do List is a software in a field of task management, which helps to track any project. This app will help you to make your life easier. Also, you can tick each completed sub tasks when deadline comes to an end.

Technology used

Features

  • User can easily add and delete items for their tasks and sub tasks.
  • Also, date and search bar are added to make more responsive and user-friendly.

 

To-do list dashboard

To-do list dashboard

Note:

  • You need to install Android SDK 16+
  • You have to add this to your dependency:
    allprojects {
    	repositories {
    	...
    	maven { url "https://jitpack.io" }
    	}
    }
    dependencies {
    	compile 'com.github.yalantis:todolist:v1.0.1'
    }
  • Add BatRecyclerView to your xml layout.
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/root"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/gradient"
        android:orientation="vertical">
    
        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?android:attr/actionBarSize"
            android:background="@android:color/transparent"
            app:logo="@drawable/ic_menu">
    
            <TextView
                android:id="@+id/text_title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:text="14 Feb, 2016"
                android:textColor="@android:color/white"
                android:textSize="20sp" />
    
        </android.support.v7.widget.Toolbar>
    
        <com.yalantis.beamazingtoday.ui.widget.BatRecyclerView
            android:id="@+id/bat_recycler_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center_horizontal"
            app:add_button_color="@drawable/selector_button_add"
            app:hint="@string/str_add_goal"
            app:radio_button_res="@drawable/selector_radio_button" />
    
    </LinearLayout>
  • Also you have to create BatListener:
    private BatListener mListener = new BatListener() {
            @Override
            public void add(String string) {
                mGoals.add(0, new Goal(string));
                mAdapter.notify(AnimationType.ADD, 0);
            }
    
            @Override
            public void delete(int position) {
                mGoals.remove(position);
                mAdapter.notify(AnimationType.REMOVE, position);
            }
    
            @Override
            public void move(int from, int to) {
                if (from >= 0 && to >= 0) {
                    
                    //if you use 'BatItemAnimator'
                    mAnimator.setPosition(to);
                    
                    BatModel model = mGoals.get(from);
                    mGoals.remove(model);
                    mGoals.add(to, model);
                    mAdapter.notify(AnimationType.MOVE, from, to);
    
                    if (from == 0 || to == 0) {
                        mRecyclerView.getView().scrollToPosition(Math.min(from, to));
                    }
                }
            }
        };
  • In addition, pass it to the BatModel:
    mAdapter = new BatAdapter(mGoals = new ArrayList<BatModel>() {{
          add(new Goal("first"));
          add(new Goal("second"));
          add(new Goal("third"));
          add(new Goal("fourth"));
          add(new Goal("fifth"));
          add(new Goal("sixth"));
          add(new Goal("seventh"));
          add(new Goal("eighth"));
          add(new Goal("ninth"));
          add(new Goal("tenth"));
    }}, mListener);
            
    mAdapter.setOnItemClickListener(new OnItemClickListener() {
          @Override
          public void onClick(BatModel item, int position) {
                Toast.makeText(ExampleActivity.this, item.getText(), Toast.LENGTH_SHORT).show();
          }
    });
  • Also initialize your recycle view
    mRecyclerView.getView().setLayoutManager(new LinearLayoutManager(this));
    mRecyclerView.getView().setAdapter(mAdapter);
    
    ItemTouchHelper itemTouchHelper = new ItemTouchHelper(new BatCallback(this));
    itemTouchHelper.attachToRecyclerView(mRecyclerView.getView());
    mRecyclerView.setAddItemListener(mListener);

Therefore, click on below button to download this project.

 

Also credit goes to Yalantis

 

 

 

You may also like...

Leave a Reply

avatar
  Subscribe  
Notify of