收藏 分享(赏)

艺术品授权.docx

上传人:kpmy5893 文档编号:6609786 上传时间:2019-04-18 格式:DOCX 页数:122 大小:41.25KB
下载 相关 举报
艺术品授权.docx_第1页
第1页 / 共122页
艺术品授权.docx_第2页
第2页 / 共122页
艺术品授权.docx_第3页
第3页 / 共122页
艺术品授权.docx_第4页
第4页 / 共122页
艺术品授权.docx_第5页
第5页 / 共122页
点击查看更多>>
资源描述

1、艺术品授权 V1.0 源代码1import java.util.List;import android.content.Context;import android.view.LayoutInflater;import android.view.View;import android.view.ViewGroup;import android.view.ViewGroup.LayoutParams;import android.widget.BaseAdapter;import android.widget.ImageView;import android.widget.RelativeLay

2、out;import com.android.domain.GallPic;import com.android.download.GallPicDownloader;import com.android.kexuemeishu.R;public class GalleryAdapter extends BaseAdapter Context mContext;List mGallPic;int res = new int R.drawable.t1, R.drawable.t2,R.drawable.t3, R.drawable.t4,R.drawable.t3, R.drawable.t4

3、 ;public void setList(List queryGallPic)this.mGallPic = queryGallPic;艺术品授权 V1.0 源代码2private final GallPicDownloader imageDownloader = new GallPicDownloader();public GallPicDownloader getImageDownloader() return imageDownloader;public GalleryAdapter(Context cnt,List queryGallPic) this.mContext = cnt;

4、this.mGallPic = queryGallPic;public GalleryAdapter(Context cnt) this.mContext = cnt;Overridepublic int getCount() / TODO Auto-generated method stubif(mGallPic = null)return res.length;elsereturn mGallPic.size();艺术品授权 V1.0 源代码3Overridepublic Object getItem(int arg0) / TODO Auto-generated method stubr

5、eturn arg0;Overridepublic long getItemId(int arg0) / TODO Auto-generated method stubreturn arg0;Overridepublic View getView(int arg0, View arg1, ViewGroup arg2) / TODO Auto-generated method stubif (arg1 = null) arg1 = LayoutInflater.from(mContext).inflate(R.layout.gallery_item,null);ImageView img =

6、(ImageView) arg1.findViewById(R.id.gall_img);RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);艺术品授权 V1.0 源代码4img.setBackgroundResource(resarg0);img.setLayoutParams(lp);if(mGallPic = null)elseimageDownloader.download(mGallPic.get(arg

7、0).getPicName(), img);/ String picName = mGallPic.get(arg0).getPicName();/ img.setBackgroundResource();return arg1;package com.android.adapter;import android.content.Context;import android.util.AttributeSet;import android.view.KeyEvent;import android.view.MotionEvent;import android.widget.Gallery;pu

8、blic class GarGallery extends Gallery public GarGallery(Context context, AttributeSet attrs) 艺术品授权 V1.0 源代码5super(context, attrs);private boolean isScrollingLeft(MotionEvent e1, MotionEvent e2) return e2.getX() e1.getX();Overridepublic boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,

9、float velocityY) int keyCode;if (isScrollingLeft(e1, e2) keyCode = KeyEvent.KEYCODE_DPAD_LEFT; else keyCode = KeyEvent.KEYCODE_DPAD_RIGHT;onKeyDown(keyCode, null);艺术品授权 V1.0 源代码6return true;package com.android.adapter;import java.text.SimpleDateFormat;import java.util.HashMap;import java.util.List;i

10、mport android.content.Context;import android.view.Gravity;import android.view.LayoutInflater;import android.view.View;import android.view.ViewGroup;import android.widget.AbsListView;import android.widget.BaseAdapter;import android.widget.ImageView;import android.widget.LinearLayout;import android.wi

11、dget.LinearLayout.LayoutParams;import android.widget.TextView;import com.android.assistant.BaseApp;import com.android.assistant.ShowConstant;艺术品授权 V1.0 源代码7import com.android.download.NewsPicDownloader;import com.android.kexuemeishu.R;import com.android.util.StreamUtils;public class HelperShowAdapte

12、r extends BaseAdapter Context mContext;/ List mLis;List mLis;private final NewsPicDownloader newPicDownloader = new NewsPicDownloader();public NewsPicDownloader getImageDownloader() return newPicDownloader;public HelperShowAdapter(Context context,List lis) super();this.mContext = context;this.mLis =

13、 lis;Overridepublic int getCount() / TODO Auto-generated method stubreturn mLis.size();艺术品授权 V1.0 源代码8Overridepublic Object getItem(int position) / TODO Auto-generated method stubreturn position;Overridepublic long getItemId(int position) / TODO Auto-generated method stubreturn position;Overridepubl

14、ic View getView(int position, View convertView, ViewGroup parent) ShowViewHolder viewHolder;String classname = mLis.get(position).get(“classNames“).toString().trim();if (convertView = null) viewHolder = new ShowViewHolder();if(“product“.equals(classname)convertView = LayoutInflater.from(mContext).in

15、flate(R.layout.list_child_product,null);AbsListView.LayoutParams lay = new 艺术品授权 V1.0 源代码9AbsListView.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);convertView.setLayoutParams(lay);viewHolder.newPic = (ImageView) convertView.findViewById(R.id.imageView1);LinearLayout.LayoutParams

16、 picLay = new LayoutParams(int)(ShowConstant.displayWidth*0.2f), (int)(ShowConstant.displayWidth*0.18f);picLay.gravity = Gravity.CENTER_VERTICAL;picLay.leftMargin =(int)(ShowConstant.displayWidth*0.027f);picLay.rightMargin =(int)(ShowConstant.displayWidth*0.027f);viewHolder.newPic.setLayoutParams(pi

17、cLay);elseconvertView = LayoutInflater.from(mContext).inflate(R.layout.list_child_item,null);AbsListView.LayoutParams lay = new AbsListView.LayoutParams(LayoutParams.FILL_PARENT, (int)(ShowConstant.displayWidth*0.30f);convertView.setLayoutParams(lay);viewHolder.newPic = (ImageView) convertView.findV

18、iewById(R.id.imageView1);/ RelativeLayout.LayoutParams picLay = new LayoutParams(int)(ShowConstant.displayWidth*0.2f), (int)(ShowConstant.displayWidth*0.23f);艺术品授权 V1.0 源代码10/ lay.gravity = Gravity.CENTER_VERTICAL;viewHolder.newTitle = (TextView) convertView.findViewById(R.id.textView1);/ RelativeLa

19、yout.LayoutParams titleLay = new RelativeLayout.LayoutParams(int)(ShowConstant.displayWidth*0.74f), (int)(ShowConstant.displayHeight*0.05f);/ LinearLayout.LayoutParams titleLay = new LayoutParams(int)(ShowConstant.displayWidth*0.74f), LayoutParams.WRAP_CONTENT);/ titleLay.topMargin = (int)(ShowConst

20、ant.displayWidth*0.064f);/ titleLay.bottomMargin = (int)(ShowConstant.displayHeight*0.01f);/ viewHolder.newTitle.setLayoutParams(titleLay);viewHolder.newBrief = (TextView) convertView.findViewById(R.id.textView2);/ LinearLayout.LayoutParams briefLay = new LayoutParams(int)(ShowConstant.displayWidth*

21、0.74f), (int)(ShowConstant.displayHeight*0.03f);/ briefLay.topMargin = (int)(ShowConstant.displayWidth*0.027f);/ briefLay.leftMargin =(int)(ShowConstant.displayWidth*0.027f);/ briefLay.rightMargin =(int)(ShowConstant.displayWidth*0.027f);艺术品授权 V1.0 源代码11/ briefLay.bottomMargin = (int)(ShowConstant.d

22、isplayHeight*0.0156f + 0.5f);/ viewHolder.newBrief.setPadding(0, 0, 0, 0);/ viewHolder.newBrief.setLayoutParams(briefLay);viewHolder.newUpDate = (TextView) convertView.findViewById(R.id.textView3);/ RelativeLayout.LayoutParams upDateLay = new RelativeLayout.LayoutParams(int)(ShowConstant.displayWidt

23、h*0.3f), (int)(ShowConstant.displayHeight*0.03f);/ upDateLay.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);/ upDateLay.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);/ upDateLay.bottomMargin = (int)(ShowConstant.displayHeight*0.0156f + 0.5f);/ upDateLay.rightMargin = (int)(ShowConstant.displayHeight*0.01f

24、);/ viewHolder.newUpDate.setGravity(Gravity.RIGHT);/ viewHolder.newUpDate.setPadding(0, 0, 2, 0);/ viewHolder.newUpDate.setLayoutParams(upDateLay);convertView.setTag(viewHolder); elseviewHolder = (ShowViewHolder)convertView.getTag();if(“product“.equals(classname)String newTitles = mLis.get(position)

25、.get(“name“).toString();艺术品授权 V1.0 源代码12String newBrief = mLis.get(position).get(“intro“).toString();String text = StreamUtils.replaceBlank(newBrief);viewHolder.newTitle.setText(newTitles.trim();viewHolder.newBrief.setText(text);/ viewHolder.newBrief.setText(newBrief.trim();elseString newTitles = mL

26、is.get(position).get(“name“).toString();String newBrief = mLis.get(position).get(“content“).toString();String isTimeShow = mLis.get(position).get(“isTimeShow“).toString();if(“0“.equals(isTimeShow)try String date = mLis.get(position).get(“date“).toString();SimpleDateFormat format = new SimpleDateForm

27、at(“yyyy-MM-dd“);String dateString = format.format(date);viewHolder.newUpDate.setText(dateString); catch (Exception e) / TODO: handle exceptione.printStackTrace();/ String text = newBrief.replace(“, “ “);艺术品授权 V1.0 源代码13String text = StreamUtils.replaceBlank(newBrief);viewHolder.newTitle.setText(new

28、Titles.trim();viewHolder.newBrief.setText(text);/ viewHolder.newBrief.setText(newBrief.trim();/ viewHolder.newBrief.setText(mLis.get(position).getBrief();/ viewHolder.newUpDate.setText(mLis.get(position).getUpdate_date();String url1 = BaseApp.getInstance().APP_SERVICE+mLis.get(position).get(“imageUr

29、l“);String imgUrl = mLis.get(position).get(“imageUrl“).toString();String imgName = imgUrl.replace(/, .);newPicDownloader.download(imgName,url1, viewHolder.newPic);/ newPicDownloader.download(mLis.get(position).get(“tel“)+“.jpg“,url1, viewHolder.newPic);return convertView;private final class ShowView

30、Holder public ImageView newPic;public TextView newTitle;public TextView newUpDate;public TextView newBrief;艺术品授权 V1.0 源代码14package com.android.adapter;import java.util.HashMap;import java.util.List;import android.app.Activity;import android.content.Context;import android.view.Gravity;import android.

31、view.LayoutInflater;import android.view.View;import android.view.ViewGroup;import android.widget.BaseAdapter;import android.widget.ImageView;import android.widget.LinearLayout;import android.widget.LinearLayout.LayoutParams;import android.widget.TextView;import com.android.assistant.ShowConstant;imp

32、ort com.android.download.NewsPicDownloader;import com.android.kexuemeishu.R;import school.adapter.ImageLoader;public class MenuGridAdapter extends BaseAdapter 艺术品授权 V1.0 源代码15private Context mContext;/ List mLis;/ List menuData;List lstImageItem;String column;private final NewsPicDownloader newPicDo

33、wnloader = new NewsPicDownloader();public NewsPicDownloader getImageDownloader() return newPicDownloader;public MenuGridAdapter() super();/ TODO Auto-generated constructor stub/* public MenuGridAdapter(Context context, List mLis) * super(); this.mContext = context; this.menuData = mLis; / TODO* Auto

34、-generated constructor stub */public MenuGridAdapter(Activity mActivity,艺术品授权 V1.0 源代码16List lstImageItem, String column) super();this.mContext = mActivity;this.lstImageItem = lstImageItem;this.column = column;/ TODO Auto-generated constructor stubOverridepublic int getCount() / TODO Auto-generated

35、method stubreturn lstImageItem.size();Overridepublic Object getItem(int position) / TODO Auto-generated method stubreturn position;Overridepublic long getItemId(int position) / TODO Auto-generated method stubreturn position;艺术品授权 V1.0 源代码17Overridepublic View getView(int position, View convertView,

36、ViewGroup parent) / TODO Auto-generated method stubMenuViewHolder viewHolder;if (convertView = null) viewHolder = new MenuViewHolder();convertView = LayoutInflater.from(mContext).inflate(R.layout.menu_gridview_item, null);/ AbsListView.LayoutParams lay = new/ AbsListView.LayoutParams(LayoutParams.FI

37、LL_PARENT,/ (int)(ShowConstant.displayHeight*0.24f+0.5f);/ lay.gravity = Gravity.CENTER_VERTICAL;/ convertView.setLayoutParams(lay);if (“3“.equals(column) viewHolder.menuPic = (ImageView) convertView.findViewById(R.id.ItemImage);LinearLayout.LayoutParams picLay = new LayoutParams(int) (ShowConstant.

38、displayWidth * 0.20f),(int) (ShowConstant.displayWidth * 0.20f);picLay.topMargin = (int) (ShowConstant.displayWidth * 0.05f);picLay.bottomMargin = (int) (ShowConstant.displayWidth * 0.05f);/ picLay.leftMargin =(int)(ShowConstant.displayWidth*0.027f);艺术品授权 V1.0 源代码18/ picLay.rightMargin =(int)(ShowCo

39、nstant.displayWidth*0.027f);picLay.gravity = Gravity.CENTER_HORIZONTAL;viewHolder.menuPic.setLayoutParams(picLay);viewHolder.menuTitle = (TextView) convertView.findViewById(R.id.ItemText);LinearLayout.LayoutParams titleLay = new LayoutParams(int) (ShowConstant.displayWidth * 0.30f),(int) (ShowConsta

40、nt.displayHeight * 0.05f);titleLay.topMargin = (int) (ShowConstant.displayWidth * 0.008f);/ titleLay.leftMargin =(int)(ShowConstant.displayWidth*0.01f);/ titleLay.rightMargin =(int)(ShowConstant.displayWidth*0.01f);/ titleLay.bottomMargin =/ (int)(ShowConstant.displayHeight*0.01f);titleLay.gravity =

41、 Gravity.CENTER_HORIZONTAL;viewHolder.menuTitle.setLayoutParams(titleLay);convertView.setTag(viewHolder); else viewHolder.menuPic = (ImageView) convertView.findViewById(R.id.ItemImage);LinearLayout.LayoutParams picLay = new LayoutParams(int) (ShowConstant.displayWidth * 0.20f),(int) (ShowConstant.di

42、splayWidth * 0.16f);艺术品授权 V1.0 源代码19picLay.topMargin = (int) (ShowConstant.displayWidth * 0.02f);/ picLay.bottomMargin = (int)(ShowConstant.displayWidth*0.05f);/ picLay.leftMargin =(int)(ShowConstant.displayWidth*0.027f);/ picLay.rightMargin =(int)(ShowConstant.displayWidth*0.027f);picLay.gravity =

43、Gravity.CENTER_HORIZONTAL;viewHolder.menuPic.setLayoutParams(picLay);viewHolder.menuTitle = (TextView) convertView.findViewById(R.id.ItemText);LinearLayout.LayoutParams titleLay = new LayoutParams(int) (ShowConstant.displayWidth * 0.30f),(int) (ShowConstant.displayHeight * 0.05f);titleLay.topMargin

44、= (int) (ShowConstant.displayWidth * 0.008f);/ titleLay.leftMargin =(int)(ShowConstant.displayWidth*0.01f);/ titleLay.rightMargin =(int)(ShowConstant.displayWidth*0.01f);/ titleLay.bottomMargin =/ (int)(ShowConstant.displayHeight*0.01f);titleLay.gravity = Gravity.CENTER_HORIZONTAL;viewHolder.menuTit

45、le.setLayoutParams(titleLay);convertView.setTag(viewHolder); else 艺术品授权 V1.0 源代码20viewHolder = (MenuViewHolder) convertView.getTag();viewHolder.menuTitle.setText(lstImageItem.get(position).get(“idname“).toString();/* viewHolder.menuPic.setBackgroundResource(R.drawable.icon_1_c);viewHolder.menuTitle.

46、setText(mLis.get(position).getTitle();String url = BaseApp.getInstance().APP_SERVICE +lstImageItem.get(position).get(“imageUrl“);newPicDownloader.download(lstImageItem.get(position).get(“id“)+“.jpg“,url, viewHolder.menuPic);String imgUrl =lstImageItem.get(position).get(“imageUrl“).toString();String

47、imgName = imgUrl.replace(/, .);String url = BaseApp.getInstance().APP_SERVICE+ lstImageItem.get(position).get(“imageUrl“).toString();newPicDownloader.download(lstImageItem.get(position).get(“imageUrl“).toString().replace(/, .), url, viewHolder.menuPic);String imageUrl = “/“+lstImageItem.get(position

48、).get(“imageUrl“).toString().substring(1);viewHolder.menuPic.setTag(imageUrl);LoadImageTask task = new LoadImageTask(viewHolder.menuPic);task.execute(imageUrl);*/艺术品授权 V1.0 源代码21ImageLoader.getInstance().loadMenuImage(“/“+lstImageItem.get(position).get(“imageUrl“).toString().substring(1), viewHolder.menuPic, R.drawable.def_icon);return convertView;private final class MenuViewHolder public ImageView menuPic;public TextView menuTitle;package com.android.adapter;import java.util.List;import android.content.Context;import android.view.

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 企业管理 > 管理学资料

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报