【Android】 分享一个完整的项目,适合新手!

写这个app之前是因为看了头条的一篇文章:http://www.managershare.com/post/155110,然后心想要不做一个这样的app,让手机计算就行了。也就没多想就去开始整了。

 
项目用到了三个开源包:
 
 
使用方法:
1.在Appliction的onCreate里初始化
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/**
      * 初始化imageLoader
      */
     public  void  initImageLoader() {
         File cacheDir = StorageUtils.getCacheDirectory(getApplicationContext());
         ImageLoaderConfiguration config =  new  ImageLoaderConfiguration.Builder(
                 getApplicationContext())
                 .memoryCache( new  LruMemoryCache( 5  1024  1024 ))
                 .memoryCacheSize( 10  1024  1024 )
                 .discCache( new  UnlimitedDiscCache(cacheDir))
                 .discCacheFileNameGenerator( new  HashCodeFileNameGenerator())
                 .build();
         ImageLoader.getInstance().init(config);
     }
 
     public  DisplayImageOptions getOptions( int  drawableId) {
         return  new  DisplayImageOptions.Builder().showImageOnLoading(drawableId)
                 .showImageForEmptyUri(drawableId).showImageOnFail(drawableId)
                 .resetViewBeforeLoading( true ).cacheInMemory( true )
                 .cacheOnDisc( true ).imageScaleType(ImageScaleType.EXACTLY)
                 .bitmapConfig(Bitmap.Config.RGB_565).build();
     }

  2.使用时调用:

1
2
3
4
5
6
7
8
9
10
11
12
ImageLoader.getInstance().displayImage(
                     avatarUrl,
                     holder.mImage,
                     MyApplication.getInstance().getOptions(
                             R.drawable.user_icon_default_main),
                     new  SimpleImageLoadingListener() {
                         @Override
                         public  void  onLoadingComplete(String imageUri,
                                 View view, Bitmap loadedImage) {
                             super .onLoadingComplete(imageUri, view, loadedImage);
                         }
                     });
 
 
使用方法:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// 设置PullToRefresh
         mListView.setMode(Mode.BOTH);
         mListView.setOnRefreshListener( new  OnRefreshListener2<ListView>() {
             // 下拉Pulling Down
             @Override
             public  void  onPullDownToRefresh(
                     PullToRefreshBase<ListView> refreshView) {
                 String label = DateUtils.formatDateTime(MainAct. this ,
                         System.currentTimeMillis(), DateUtils.FORMAT_SHOW_TIME
                                 | DateUtils.FORMAT_SHOW_DATE
                                 | DateUtils.FORMAT_ABBREV_ALL);
                 refreshView.getLoadingLayoutProxy().setLastUpdatedLabel(label);
                 mListView.setMode(Mode.BOTH);
                 pullFromUser =  true ;
                 mRefreshType = RefreshType.REFRESH;
                 pageNum =  0 ;
                 lastItemTime = getCurrentTime();
                 //获取数据
                 fetchData();
             }
 
             // 上拉Pulling Up
             @Override
             public  void  onPullUpToRefresh(
                     PullToRefreshBase<ListView> refreshView) {
                 // 上拉的时候添加选项
                 mRefreshType = RefreshType.LOAD_MORE;
                 //获取数据
                 fetchData();
             }
 
         });
         actualListView = mListView.getRefreshableView();
         actualListView.setFastScrollEnabled( true );
         mEntities =  new  ArrayList<RankEntity>();
         mAdapter =  new  MainListAdapter(MainAct. this , mEntities);
         actualListView.setAdapter(mAdapter);
         if  (mEntities.size() ==  0 ) {
             fetchData();
         }
         mListView.setState(State.RELEASE_TO_REFRESH,  true );

  

一个是向导流程: https://github.com/TechFreak/WizardPager
 这个源码包有修改过,只使用了单选这个Fragment!内容比较多想看的下载代码吧
 
 
项目虽然很渣很没新意,完成是出于一个瞬间的念头,开发完成后自己测试都觉得无聊,40多个选择,点到手抽筋!然后又加上了一个自动翻页的开关!
 
 
QQ:471497524
微信:519659991
 
新开的交流群,欢迎广州的开发者加入:  http://jq.qq.com/?_wv=1027&k=cgvXpA,另外群里有一个HR需要找一位1年工作经验以上,能够独立开发App的安卓哥,正在找工作的一定要加这个群阿
 
最后附截图:
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值