8000 GitHub - bobdeng/androidannotations
[go: up one dir, main page]

Skip to content

bobdeng/androidannotations

Repository files navigation

<<<<<<< HEAD <<<<<<< HEAD #Use androidannotations to MVP ###Declare a Interface of View

public interface MyView{
  public void showName(String name);
}

###Declare bean interface

public interface IMyBean{
  public void getUserName();
}

###Implement bean

@EBean
public MyBean implements IMyBean{
  @ViewInterface //New Annotation
  MyView myView;
  @Override
  @Background //Use AA to run background
  public void getUserName(){
     //read user from db or Http server or other
     myView.showName("hello");
  }
}

###In Activity,Fragment,Service or only a common Class

@EActivity(R.layout.layout_main)
public MyActivity{
  @Bean(MyBean.class)
  IMyBean myBean;
  
  @Click(R.id.btn)
  public void click(){
    //Call myBean, excuted in background
    myBean.getUserName();
  }
  //MyBean will invoke this in method getUserName, so need to be UIThread safe
  @UIThread
  public void showName(String nam
8E41
e){
    showToast(name);
  }
}

#EIntent,IntentExtra

@EIntent("BroadcastAction-XX")
public class MyIntent{
  @IntentExtra
  public String name;
  @IntentExtra(IntentObjectType.PARCELABLE)
  public UserInfo userInfo;
  @IntentExtra
  public SerializableObject obj;
}

###sendBroadCast

sendBroadCast(new MyIntent_().setName("name").setUserInfo(userInfo).getIntent());

###receive broadcast

MyIntent_ myIntent=MyIntent_.build(intent);
myIntent.getName()

#ContextEvent ###Write a event interface

public interface IMyEvent{
	public void onEvent1(String action);
}

###In Fragment,Adapter,View..

@ContextEvent
IMyEvent myEvent;
.............
myEvent.onEvent1("action");

###In activity

//Not necessary,but recommend implements IMyEvent
implements IMyEvent
public void onEvent1(String action){
	//do something
}

Fast Android Development. Easy maintenance.

=======

Fast Android Development. Easy maintenance.

Note: we presented AndroidAnnotations at Devoxx 2012, video available on Parleys.com!

96090578b57011fab18dcfe714da38bca2899feb Android Annotations Logo

AndroidAnnotations is an Open Source framework that speeds up Android development. It takes care of the plumbing, and lets you concentrate on what's really important. By simplifying your code, it facilitates its maintenance.

<<<<<<< HEAD Build Status Android Arsenal Gitter

dd05c0576d7b8da39d46c5589ee672f2d2c6c556 ======= githalytics.com alpha 96090578b57011fab18dcfe714da38bca2899feb

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 50

Languages

0