Giter Site home page Giter Site logo

todolist's Introduction

ToDoList

License Yalantis

Get it on Google Play

Live DEMO on appetize.io

Check this project on dribbble

Read how we did it on our blog

##Requirements

  • Android SDK 16+

##Usage

Add to your root build.gradle:

allprojects {
	repositories {
	...
	maven { url "https://jitpack.io" }
	}
}

Add the dependency:

dependencies {
	compile 'com.github.yalantis:todolist:v1.0.1'
}

How to use this library

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>

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));
                }
            }
        }
    };

Create BatAdapter. Pass to its constructor list of models and BatListener. Note that your model should implement BatModel interface

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();
      }
});

Initialize your recycler 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);

Extra

You can use BatItemAnimator to animate list items just like in our demo:

mAnimator = new BatItemAnimator();
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, mAnimator);
mRecyclerView.getView().setItemAnimator(mAnimator);

You need to pass the animator instance to BatRecyclerView and to BatAdapter. Also it's necessary to pass the position of the moved item in move() callback:

@Override
public void move(int from, int to) {
     if (from >= 0 && to >= 0) {
           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));
           }
     }
}

For more usage examples please review sample app

Changelog

Version: 1.0.1

  • Cursor fixed.
  • cursor_drawable attribute and setCursorDrawable(@DrawableRes int res) method added. Should be used instead of cursor_color attribute and setCursorColor(@ColorInt int color) method respectively

Let us know!

We’d be really happy if you could send us links to your projects where you use our component. Just send an email to [email protected] And do let us know if you have any questions or suggestion regarding the animation.

P.S. We’re going to publish more awesomeness wrapped in code and a tutorial on how to make UI for iOS (Android) better than better. Stay tuned!

License

The MIT License (MIT)

Copyright © 2017 Yalantis, https://yalantis.com

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

todolist's People

Contributors

igalata avatar warko-san avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

todolist's Issues

Sugestion

upload your application Screenshots in your this project readme

Swipe support from com.github.yalantis:todolist:v1.0.1

Swipe works fine when
compile project(':library')
is used. but when I comment that and use outside library
// compile 'com.github.yalantis:todolist:v1.0.1'
After swipes I got exceptions.
There should not be such difference.

Need some flexibility to customize to be able to use this great library

I found this library great. However there some gaps that I have found. This will be greater if you please solve these issues to make this library more dynamic.

  1. Text color, background color, radio button, and icon color change feature
  2. Customization of layout width and height
  3. Use of the custom font

That's it, I think.

Flytt

  • Smart lampa badrum
  • Smart lampa kök
  • Packning garderober
  • Säng
  • Soffor
  • V rum bord
  • Väggfäste å tv
  • Speglar
  • Tavlor
  • Verktyg

Play Store

Please make your profile up to date your play store attached not working please update link

Add goal edit text

There´s a way to make add goal be on top of my fragment... when there´s no goal the add edit text goes to bottom of my fragment.

Can't change the cursor position by clicking the EditText or keyboard

The "Plus" animation is delightful and It is smooth to replace the EditText's cursor with the custom cursor. But the problem I find is that I can't change the cursor position by clicking the EditText or soft keyboard, and the actual input position has changed. I think it confuses users since input is important for a to-do list.

can not change the radio button color or the radio res

Thank you for create such a nice repo, I get a issue. When i try to change the color of default radio button by app:radio_button_color="" or app:radio_button_res="" in xml or setRadioButtonColor in java, it can not work.Also i try to change the cursor by app:cursor_color="",it can work well if i have not input word in EditText.If i input some words,the color of cursor change to default blue.

thanks

D/TextView: setTypeface with style : 0

 super(context, attrs, defStyleAttr);
    LayoutInflater.from(context).inflate(layout.bat_recycler_view, this, true);

this two lines go into infinite loop. In log only D/TextView: setTypeface with style : 0
It works in orginal example but using it outside of main projects produce that error.

Line-through and iOS Support

Hello,
I love this library, thanks a lot :)

I want to add a feature but i could not add by myself. I want to give a line-through style when one of them is selected. How can i do that ?

Also, i wonder that is there an iOS version of this library or Will Yalantis make an iOS version soon?

Thank you again :)

Readme Update

The markdown in readme is not used correctly as per the syntax.
Should i send a PR ?

Unable to change width and height

So the issue is I cannot override the width and height of the actual layout. My phone has a 4k screen so I have got tons of pixels and the layout doesn't look that nice because there's a lot of unused space around it.

Is there a way I can override the width so I can fill most of the screen?

layout

issue is on me

HI I am abdur rahman i need help to please

I have made a to do list and a close button but I do not use the fade out I used js code

`  
var myNodelist = document.getElementsByClassName("item");
var i;
for (i = 0; i < myNodelist.length; i++) {
  var span = document.createElement("SPAN");
  var txt = document.createTextNode("");
  span.className = "close";
  span.appendChild(txt);
  myNodelist[i].appendChild(span);
}
the issues is when I close one and make a new new they all come back


this.parentElement.style.display = 'none';
var close = document.getElementsByClassName("close");
var i;
for (i = 0; i < close.length; i++) {
  close[i].onclick = function() {
    var div = this.parentElement;
    div.style.display = "none";
  }
}

image

now I close it
image

and when I make another one this is what happens
image
they all come back

@oluwaseunasuni
@AnneLivia
@juliatotta
@Anteste
@Abbas
@Abbazz2020
@iam-abbas
@neodigm
@MatheusWilliam31
@BaseMax
@Obizim
@iamfortune
@timo-cmd
@JoneBulande
@payperlez
@izabellaribeiro

I met a problom

我原本的工程中使用到了 butterknife:8.4.0
新添加这个工程就会遇到冲突。。不知道怎么解决

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.