源码简介
该源码功能上非常单一,但请从源码封装及架构的角度来看待。
上传此源码主要有两点目的:
一、学习并体验Bmob云存储
二、站在架构的角度,学习Android平台下app开发过程中的整合【封装】
源码运行截图
源码片段
源码链接:http://down.51cto.com/data/1968339
- /**
- * 查询全部失物信息 queryLosts
- *
- * @return void
- * @throws
- */
- private void queryLosts() {
- showView();
- BmobQuery<lost> query = new BmobQuery<lost>();
- query.order("-createdAt");// 按照时间降序
- query.findObjects(this, new FindListener<lost>() {
- @Override
- public void onSuccess(List<lost> losts) {
- // TODO Auto-generated method stub
- LostAdapter.clear();
- FoundAdapter.clear();
- if (losts == null || losts.size() == 0) {
- showErrorView(0);
- LostAdapter.notifyDataSetChanged();
- return;
- }
- progress.setVisibility(View.GONE);
- LostAdapter.addAll(losts);
- listview.setAdapter(LostAdapter);
- }
- @Override
- public void onError(int code, String arg0) {
- // TODO Auto-generated method stub
- showErrorView(0);
- }
- });
- }
- public void queryFounds() {
- showView();
- BmobQuery<found> query = new BmobQuery<found>();
- query.order("-createdAt");// 按照时间降序
- query.findObjects(this, new FindListener<found>() {
- @Override
- public void onSuccess(List<found> arg0) {
- // TODO Auto-generated method stub
- LostAdapter.clear();
- FoundAdapter.clear();
- if (arg0 == null || arg0.size() == 0) {
- showErrorView(1);
- FoundAdapter.notifyDataSetChanged();
- return;
- }
- FoundAdapter.addAll(arg0);
- listview.setAdapter(FoundAdapter);
- progress.setVisibility(View.GONE);
- }
- @Override
- public void onError(int code, String arg0) {
- // TODO Auto-generated method stub
- showErrorView(1);
- }
- });
- }
- ······
- /**
- * Add links into a TextView.
- * @param viewId The id of the TextView to linkify.
- * @return The BaseAdapterHelper for chaining.
- */
- public BaseAdapterHelper linkify(int viewId) {
- TextView view = retrieveView(viewId);
- Linkify.addLinks(view, Linkify.ALL);
- return this;
- }
- /** Apply the typeface to the given viewId */
- public BaseAdapterHelper setTypeface(int viewId, Typeface typeface) {
- TextView view = retrieveView(viewId);
- view.setTypeface(typeface);
- return this;
- }
- /** Apply the typeface to all the given viewIds */
- public BaseAdapterHelper setTypeface(Typeface typeface, int... viewIds) {
- for (int viewId : viewIds) {
- TextView view = retrieveView(viewId);
- view.setTypeface(typeface);
- }
- return this;
- }
- </found></found></found></found></lost></lost></lost></lost>