Git Product home page Git Product logo

dnolib's Introduction

DnoLib

Android library with all can be useful for the applications developement when i don`t have much time to invest in a custom implementation, ok that i will use it always. the modules are subdivided in:

  • business
    contains rules that determine how data can be created, displayed, stored, and changed,utilities and useful codesnip.

  • Widgets Contains components can be used on ui in java or direct in xml

Version

0.0.1

COMPONENTS

##AutoBinding Adapter

Its a simple adapter that allows to map model direct on view without any lines of code. That is possible thanks to the annotations added on the model class.

###HOW TO USE simple instance and set AutoBinder in ListView

ArrayList<Example> mList=new ArrayList<Example>();

mListView.setAdapter(new AutoBindAdapter(mList,R.layout.element_example));

###MODEL

Bind annotation specify id and type of component

public class Example {

        @Bind(to = R.id.name,type = TextView.class)
        public String name;

        @Bind(to = {R.id.img1,R.id.img2},type ={ImageView.class, ImageButton.class})
        public int resourceImage;

        public Example(String name,int resourceId){

            this.name=name;
            this.resourceImage=resourceId;


        }

    }

###CUSTOM BINDING first extends AutoBindAdapter


public class MyAdapter extends AutoBindAdapter {


/*this method will be execute if
the annotation on field specify
skipAutoBinding=true or if the view is not
supported by internal adapter binding */

@override
protected  void binding(View view,Object value){

    //instructions to set value on view
    if(view.getId()== R.id.name){

       TextView textview=(TextView) view;

       value+=" ciao";

       textview.setText((String)value);

    }
  }

/*
in this method you can do
any transformation before pass value on
binding method
*/

  @override
  protected  Object beforeBinding(View view,Object value){

      //instructions to set value on view
      if(view.getId()== R.id.name){

         TextView textview=(TextView) view;

         value+=" ciao";

         textview.setText((String)value);

      }

    }
}


##Teacher Useful component for creating app tour for now its just implements a default tutorial lesson card.

###Characteristics

  • allows to add lesson card view related to activity or button click
  • manage persistence of lesson already learn
  • internal holder pattern

###Todo

  1. implements view custom layout
  2. when a lesson is set to be repeated more than once, implements possibility to pass LessonArgs List as arguments
  3. any help suggestion is appreciated


 if(Teacher.instance(this).areLessonsLearned()==false) {


                    Teacher.instance(this)
                    .addLessonCard(new Teacher.LessonArgs(-1, "SingleFadeImageActivity", "immagine singola scorrevole", "red"))
                    .showOnActivityStart(SingleFadeImageActivity.class)
                    .addDependency(CarouselActivity.class);

                     Teacher.instance(this)
                    .addLessonCard(new Teacher.LessonArgs(-1, "CarouselActivity", "Images slide", "black"))
                    .showOnActivityStart(CarouselActivity.class).printLog();

        }

##ALTERNATIVE WITH CLICKLISTENERS ,CONDITION

   /**define lessons array in sequence**/
         Teacher.LessonArgs[]  lessonsSameOnSameView=new Teacher.LessonArgs[2];
         /**first lesson**/
         lessonsSameOnSameView[0]=new Teacher.LessonArgs(-1, "CarouselActivity", "Images slide", "black");
         /**second lesson with visibility condition**/
         lessonsSameOnSameView[1]=new Teacher.LessonArgs(-1, "CarouselActivity", "Images slide2", "green", new Teacher.LessonCardViewVisibilityCondition() {
             @Override
             public boolean visibilityIsAllowed() {
                 return holderActivityLessonCondition;
             }
         });
         /**add lesson click listener**/
         lessonsSameOnSameView[1].addLessonCardListener(new Teacher.LessonCardOnClickListener() {
             @Override
             public void onActionClick(Teacher.LessonClickEvent event) {Log.i("lessonCard","action clicked");}
             @Override
             public void onCloseClick(Teacher.LessonClickEvent event) {Log.i("lessonCard","action clsoe clicked");  }
         });


         /**check if all lesson are learned**/
         if(Teacher.instance(this).areLessonsLearned()==false) {

                     Teacher.instance(this)
                     /**add lesson show on singleFadeImageActivityShowed**/
                     .addLessonCard(new Teacher.LessonArgs(-1, "SingleFadeImageActivity", "immagine singola scorrevole", "red"))
                     .showOnActivityStart(SingleFadeImageActivity.class)
                     /** dependency mean that this lesson depends of carouselActivity lesson **/
                     .addDependency(CarouselActivity.class);
                     /**add second lessons array | more lessons in the same view **/
                     Teacher.instance(this)
                     .addLessonCard(lessonsSameOnSameView)
                     .showOnActivityStart(CarouselActivity.class).printLog();

         }

License

MIT

dnolib's People

Contributors

dnocode avatar

Watchers

James Cloos avatar  avatar

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.