androidInject
=============
###使用注解来简化android开发 <br/>(Use annotations inject to simplify the development of android)<br/>
###注意: <br/>
> 使用fragment的注解,需要android-support-v4.jar的支持(以兼容低版本)
>
> 使用网络请求的注解时,如果需要自动返回封装类,则需要[gson.jar](https://code.google.com/p/google-gson/downloads/list)的支持
>
> 使用文件上传的注解,需要[httpmime.jar](http://hc.apache.org/downloads.cgi)的支持
###例子1:Android注解<br/>
@AIFullScreen
@AINoTitle
@AILayout(R.layout.main)
public class MainActivity extends AIActivity{
@AIView(id = R.id.insertBtn, clickMethod = "onClickCallback", longClickMethod = "onLongClickCallback")
private Button insertBtn;
@AIView(clickMethod = "onClickCallback", longClickMethod = "onLongClickCallback")
private Button queryBtn;
// @AIView(id = R.id.btn3)
// private Button btn3;
// @AIView(id = R.id.listView, itemClickMethod = "onItemClickCallback", itemLongClickMethod = "onItemLongClickCallbackForListView")
@AIView(R.id.listView)
private ListView listView;
@AIBean
private Person person;
@AISystemService
private AlarmManager alarmManager;
@AISystemService
private LocationManager locationManager;
@AISystemService
private LayoutInflater inflater;
@AIScreenSize
private Point sSize;
@AINetWorker
private PersonWorker personWorker;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
List<Map<String, String>> list = new ArrayList<Map<String, String>>();
Map<String, String> map;
for(int i = 0; i < 10; i++){
map = new HashMap<String, String>();
map.put("title", "item_" + i);
list.add(map);
}
SimpleAdapter adapter = new SimpleAdapter(context, list, R.layout.list_item, new String[]{"title"}, new int[]{R.id.list_item_title_tv});
listView.setAdapter(adapter);
person.setName("wangjie");
person.setAge(23);
System.out.println(person.toString());
System.out.println("alarmManager: " + alarmManager + ", locationManager: " + locationManager + ", inflater: " + inflater);
System.out.println("screen size --> width: " + sSize.x + ", height: " + sSize.y);
new Thread(new Runnable() {
@Override
public void run() {
try{
// RetMessage<Person> retMsg = personWorker.getPersonsForGet("a1", "b1", "c1");
RetMessage<Person> retMsg = personWorker.getPersonsForGet2(new Params().add("aa", "a1").add("bb", "b1").add("cc", "c1"));
// RetMessage<Person> retMsg = personWorker.getPersonsForPost2(new Params().add("aa", "a1").add("bb", "b1").add("cc", "c1"));
System.out.println("getPersonsForGet2: " + retMsg.getList().toString());
}catch(Exception ex){
ex.printStackTrace();
}
}
}).start();
new Thread(new Runnable() {
@Override
public void run() {
try {
String jsonStr = personWorker.getPersonsForGetToString(new Params().add("aa", "a1").add("bb", "b1").add("cc", "c1"));
System.out.println("getPersonsForGetToString: " + jsonStr);
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
new Thread(new Runnable() {
@Override
public void run() {
try{
// 上传多个文件
/*
List<File> files = new ArrayList<File>();
files.add(new File("/storage/emulated/0/DCIM/Camera/20140130_132710.jpg"));
files.add(new File("/storage/emulated/0/DCIM/Camera/20140130_132559.jpg"));
files.add(new File("/storage/emulated/0/DCIM/Camera/20140130_132533.jpg"));
files.add(new File("/storage/emulated/0/DCIM/Camera/20140130_132508.jpg"));
RetMessage<UploadFile> retMsg = personWorker.uploadFile(files);
System.out.println(retMsg.getList().toString());
*/
// 上传单个文件
RetMessage<UploadFile> retMsg = personWorker.uploadFile2(new File("/storage/emulated/0/DCIM/Camera/20140130_132710.jpg"));
System.out.println(retMsg.getList().toString());
}catch(Exception ex){
ex.printStackTrace();
}
}
}).start();
userExecutor = new DbExecutor<User>(context);
}
DbExecutor<User> userExecutor = null;
User dbUser = null;
List<User> users = null;
Random rd = new Random();
@AIClick({R.id.deletebtn, R.id.updateBtn})
public void onClickCallback(View view) throws Exception{
if(view instanceof Button){
Toast.makeText(context, "onClickCallback: " + ((Button)view).getText(), Toast.LENGTH_SHORT).show();
}
switch(view.getId()){
case R.id.insertBtn: // 插入user对象到user表
dbUser = new User("wangjie" + rd.nextInt(10000), String.valueOf(rd.nextInt(10000) + 10000), System.currentTimeMillis(), rd.nextInt(80) + 120, rd.nextInt(80) + 120, "aaaa");
userExecutor.executeSave(dbUser);
break;
case R.id.queryBtn: // 查询user表
users = userExecutor.executeQuery("select * from user where uid > ?", new String[]{"4"}, User.class);
System.out.println("[queryBtn]users: " + users);
break;
case R.id.deletebtn: // 删除user表的一条数据
if(null == users || users.size() <= 0){
break;
}
userExecutor.executeDelete(users.get(0));
break;
case R.id.updateBtn: // 更新user表的一条数据
if(null == users || users.size() <= 0){
break;
}
User user = users.get(0);
user.setUsername(user.getUsername().startsWith("wangjie") ? "jiewang" + rd.nextInt(10000) : "wangjie" + rd.nextInt(10000));
user.setPassword(user.getPassword().startsWith("123456") ? "abcdef" : "123456");
user.setCreatemillis(System.currentTimeMillis());
user.setHeight(rd.nextInt(80) + 120);
user.setWeight(rd.nextInt(80) + 120);
user.setNotCol("bbb");
userExecutor.executeUpdate(user, null, new String[]{"createmill
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
AndroidInject增加sqlite3数据库映射注解(ORM).zip项目安卓应用源码下载AndroidInject增加sqlite3数据库映射注解(ORM).zip项目安卓应用源码下载 1.适合学生毕业设计研究参考 2.适合个人学习研究参考 3.适合公司开发项目技术参考
资源推荐
资源详情
资源评论
收起资源包目录
AndroidInject增加sqlite3数据库映射注解(ORM).zip (78个子文件)
AndroidInject增加sqlite3数据库映射注解(ORM)
AndroidInject增加sqlite3数据库映射注解(ORM)
androidInject-master
.gitignore 332B
ant.properties 698B
README.md 19KB
library
androidInject_1.2.jar 41KB
androidInject_1.3.jar 48KB
androidInject_1.0.jar 29KB
META-INF
MANIFEST.MF 23B
AndroidManifest.xml 867B
proguard-project.txt 781B
src
com
wangjie
androidinject
annotation
listener
OnItemLongClickViewListener.java 2KB
OnItemClickViewListener.java 2KB
OnLongClickViewListener.java 2KB
OnClickViewListener.java 2KB
present
AISupportFragment.java 3KB
AISupportFragmentActivity.java 1KB
AIPresent.java 471B
AIActivity.java 2KB
common
CallbackSample.java 594B
annotations
orm
AIPrimaryKey.java 642B
AIColumn.java 606B
AITable.java 616B
net
AIGet.java 854B
AIParam.java 547B
AINetWorker.java 547B
AIUpload.java 891B
AIPost.java 786B
base
AIClick.java 544B
AIItemClick.java 548B
AINoTitle.java 450B
AILongClick.java 548B
AILayout.java 467B
AIFullScreen.java 453B
AIBean.java 450B
AIView.java 889B
AIItemLongClick.java 551B
AISystemService.java 457B
dimens
AIScreenSize.java 458B
core
orm
AIDbExecutor.java 14KB
AIDatabaseHelper.java 1KB
net
NetInvoHandler.java 6KB
RetMessage.java 2KB
AINetWork.java 4KB
AIUploadNetWork.java 2KB
thread
ThreadPool.java 858B
Runtask.java 2KB
base
ParticularAnnotation.java 828B
AnnotationManager.java 2KB
RealizeMethodAnnotation.java 7KB
RealizeAnnotation.java 343B
RealizeFieldAnnotation.java 9KB
RealizeTypeAnnotation.java 4KB
util
AIDbUtil.java 3KB
SystemServiceUtil.java 2KB
StringUtil.java 769B
AITextUtil.java 1KB
ReflectionUtils.java 893B
Params.java 369B
example
MainActivityGeneral.java 3KB
net
PersonWorker.java 2KB
database
DbExecutor.java 785B
DatabaseHelper.java 1KB
model
User.java 2KB
Person.java 855B
UploadFile.java 392B
FragmentA.java 3KB
SecendActivity.java 817B
MainActivity.java 9KB
project.properties 563B
res
values
strings.xml 115B
layout
fragment_a.xml 860B
list_item.xml 515B
secend.xml 460B
main.xml 1KB
drawable-ldpi
ic_launcher.png 3KB
drawable-hdpi
ic_launcher.png 9KB
drawable-mdpi
ic_launcher.png 5KB
drawable-xhdpi
ic_launcher.png 14KB
build.xml 4KB
共 78 条
- 1
资源评论
yxkfw
- 粉丝: 81
- 资源: 2万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功