赞
踩
软件介绍:
1:软件使用Android stuido进行开发;
2:使用sqlite本地数据库进行数据的存储;
3:漫画数据来源于网页爬虫技术获取;
用户功能介绍:
1:注册模块,用户在使用软件前需要进行用户信息的注册
2:用户登录:用户通过自己的注册信息进行软件的登录,
3:首页信息:用户进入首页之后可以浏览漫画列表信息
4:查看漫画:点击一个漫画信息之后可以查看章节信息,以及点击章节进行详情的预览信息
5:我的收藏:用户可以对自己喜欢的漫画信息进行收藏
6:个人信息:用户可以浏览个人信息,以及对密码进行修改;
1:软件使用Android stuido进行开发;
2:使用sqlite本地数据库进行数据的存储;3:需要jdk1.7以上
4:使用雷电模拟器或者Androidstuio自带的模拟器进行运行
public class IndexFragment extends BaseFragment {
// 获取view
private View rootView;
// 获取控件
private ListviewForScrollView mListMessage;
private List<String> mImgList = new ArrayList<String>();MZBannerView mMZBanner;
SimpleDraweeView mivShop2;
TextView mtvTime2;
TextView mTvTitle2;
SimpleDraweeView mivShop1;
TextView mtvTime1;
TextView mTvTitle1;RelativeLayout topui;
GridviewForScrollView mBookType;
LinearLayout mll1;
LinearLayout mll2;
LinearLayout mll3;
LinearLayout mll4;TextView metName;
MaterialRefreshLayout materialRefreshLayout;
public LoadingDialog mdialog;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
rootView = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_message_index, null);
// isPrepared = true;
// setlazyLoad();initWidget();
initData();
return rootView;
}private Button mviTongJi;
@Override
public void initWidget() {
materialRefreshLayout = (MaterialRefreshLayout) rootView.findViewById(R.id.refresh);
mviTongJi = (Button) rootView.findViewById(R.id.mviTongJi);
mviTongJi.setOnClickListener(this);metName = (TextView) rootView.findViewById(R.id.metName);
metName.setOnClickListener(this);mBookType = (GridviewForScrollView) rootView.findViewById(R.id.mBookType);
mviTongJi.setVisibility(View.GONE);
mviTongJi.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {if (MemberUserUtils.getUid(getActivity()).equals("")) {
Intent intent = new Intent(getActivity(), LoginActivity.class);
startActivity(intent);
} else {Intent intent = new Intent(getActivity(), CreatSendActivity.class);
startActivity(intent);
}
}
});mll1 = (LinearLayout) rootView.findViewById(R.id.mll1);
mll1.setOnClickListener(this);mll2 = (LinearLayout) rootView.findViewById(R.id.mll2);
mll2.setOnClickListener(this);
mll3 = (LinearLayout) rootView.findViewById(R.id.mll3);
mll3.setOnClickListener(this);mll4 = (LinearLayout) rootView.findViewById(R.id.mll4);
mll4.setOnClickListener(this);mBookType = (GridviewForScrollView) rootView.findViewById(R.id.mBookType);
topui = (RelativeLayout) rootView.findViewById(R.id.topui);
topui.setFocusable(true);
topui.setFocusableInTouchMode(true);
topui.requestFocus();// tagFlowLayout = (TagFlowLayout) rootView.findViewById(R.id.id_flowlayout);
mMZBanner = (MZBannerView) rootView.findViewById(R.id.banner);
mListMessage = (ListviewForScrollView) rootView.findViewById(R.id.mAllListMessage);
mivShop1 = (SimpleDraweeView) rootView.findViewById(R.id.mivShop1);
mtvTime1 = (TextView) rootView.findViewById(R.id.mtvTime1);
mTvTitle1 = (TextView) rootView.findViewById(R.id.mTvTitle1);
mivShop2 = (SimpleDraweeView) rootView.findViewById(R.id.mivShop2);
mtvTime2 = (TextView) rootView.findViewById(R.id.mtvTime2);
mTvTitle2 = (TextView) rootView.findViewById(R.id.mTvTitle2);
}
public static class BannerViewHolder implements MZViewHolder<String> {
private SimpleDraweeView mImageView;@Override
public View createView(Context context) {
// 返回页面布局
View view = LayoutInflater.from(context).inflate(R.layout.banner_item, null);
mImageView = (SimpleDraweeView) view.findViewById(R.id.bannerImage);
return view;
}@Override
public void onBind(Context context, int position, String data) {
Uri uIconuri = Uri.parse(data);
FrescoUtils.initDraweeController(mImageView, uIconuri);}
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.metName:Intent mll1 = new Intent(getActivity(), SearchActivity.class);
startActivity(mll1);
break;
}
}@Override
public void initData() {
mdialog = new LoadingDialog(getActivity(), "加载中...");
/**
* 设置是否上拉加载更多,默认是false,要手动改为true,要不然不会出现上拉加载
*/
materialRefreshLayout.setLoadMore(true);
materialRefreshLayout.setMaterialRefreshListener(new MaterialRefreshListener() {
@Override
public void onRefresh(final MaterialRefreshLayout materialRefreshLayout) {
materialRefreshLayout.finishRefresh();
}@Override
public void onRefreshLoadMore(MaterialRefreshLayout materialRefreshLayout) {
//上拉加载更多...
// 结束上拉刷新...
materialRefreshLayout.finishRefreshLoadMore();
}
});
mImgList.add("https://tn1-f2.kkmh.com/image/230608/KIIlRRvlu.png");
mImgList.add("https://tn1-f2.kkmh.com/image/230607/GXHztJkNz.png");
mMZBanner.setPages(mImgList, new MZHolderCreator<BannerViewHolder>() {
@Override
public BannerViewHolder createViewHolder() {
return new BannerViewHolder();
}
});
// MessageAction(false);mListMessage.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent intent = new Intent(getActivity(), ComicLookActivity.class);
intent.putExtra("msg", listData.get(position));
startActivity(intent);}
});
mBookType.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent intent = new Intent(getActivity(), TypeListActivity.class);
intent.putExtra("msg", listType.get(position));
startActivity(intent);}
});
mdialog.show();
UploadFileTask uploadFileTaskSend = new UploadFileTask();
uploadFileTaskSend.execute();}
private List<ComicListModel> listData = new ArrayList<ComicListModel>();public class UploadFileTask extends AsyncTask<String, Void, String> {
@Override
protected void onPostExecute(String result) {
mdialog.dismiss();
System.out.println("-----------" + result);
}@Override
protected void onPreExecute() {
}@Override
protected void onCancelled() {
super.onCancelled();
}@Override
protected String doInBackground(String... params) {//
// if(isLoad){
//
// }else{
// listData.clear();
// }//首页信息
Document document;
try {
document = Jsoup.connect("http://www.mhua5.com/category/tags/11").timeout(5000).get();
Elements elementsAll = document.getElementsByClass("common-comic-item");// System.out.println(elementsAll);
ComicListModel comicListModel = null;
for (Element items : elementsAll) {
System.out.println(items.getElementsByTag("a").attr("href"));
System.out.println(items.getElementsByClass("comic__title").text());
System.out.println(items.getElementsByClass("lazy").get(0).attr("data-original"));
System.out.println();
comicListModel = new ComicListModel();
comicListModel.setComicTitle(items.getElementsByClass("comic__title").text());
comicListModel.setComicPath(items.getElementsByTag("a").attr("href"));
comicListModel.setComicImage(items.getElementsByClass("lazy").get(0).attr("data-original"));
listData.add(comicListModel);
}handler.sendEmptyMessage(1);
} catch (IOException e) {
e.printStackTrace();
}
return "";
}@Override
protected void onProgressUpdate(Void... values) {
}}
private List<TypeModel> listType = new ArrayList<TypeModel>();
@SuppressLint( "HandlerLeak" )
Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
//
TypeModel typeModel;
for (int i = 0; i < Consts.typeArr.length; i++) {
typeModel = new TypeModel();
typeModel.setTypeId(Consts.typeIDS[i]+"");
typeModel.setTypeName(Consts.typeArr[i]);
listType.add(typeModel);
}TypeHotAdapter typeHotAdapter = new TypeHotAdapter(getActivity(), listType);
mBookType.setAdapter(typeHotAdapter);ShopListNewsAdapter diaryAdapter = new ShopListNewsAdapter(getActivity(), listData);
mListMessage.setAdapter(diaryAdapter);}
};
}
public class ComicImageActivity extends BaseActivity {// 标题
private TextView mTvTitle;
// 返回
private ImageView mIvBack;
private TextView mIvStu;
ListView mListMessage;@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_im);
initWidget();
initData();
}@Override
public void onClick(View v) {final SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");// 设置日期格式
switch (v.getId()) {
case R.id.mIvBack:
ComicImageActivity.this.finish();
break;}
}
public LoadingDialog mdialog;
@Override
public void initWidget() {mdialog = new LoadingDialog(this, "加载中...");
mIvBack = (ImageView) this.findViewById(R.id.mIvBack);
mTvTitle = (TextView) findViewById(R.id.mTvTitle);
mIvStu = (TextView) findViewById(R.id.mIvStu);
mTvTitle.setText("漫画阅读");
mIvBack.setVisibility(View.VISIBLE);
mIvBack.setOnClickListener(this);
mIvStu.setOnClickListener(this);
mIvStu.setVisibility(View.GONE);
mListMessage = (ListView) findViewById(R.id.mListMessage);
}ChapterModel comicListModel;
@Override
public void initData() {
comicListModel = (ChapterModel) this.getIntent().getSerializableExtra("msg");// Uri uIconuri = Uri.parse(comicListModel.getComicImage());
// FrescoUtils.initDraweeController(mivUserImg, uIconuri);mdialog.show();
UploadFileTask uploadFileTaskSend = new UploadFileTask();
uploadFileTaskSend.execute();}
Document document;
private List<ComicImageModel> listData = new ArrayList<ComicImageModel>();public class UploadFileTask extends AsyncTask<String, Void, String> {
@Override
protected void onPostExecute(String result) {
mdialog.dismiss();
}@Override
protected void onPreExecute() {
}@Override
protected void onCancelled() {
super.onCancelled();
}@Override
protected String doInBackground(String... params) {
Document document;
try {
document = Jsoup.connect(comicListModel.getChapterPath()).timeout(5000).get();Elements elementsAll = document.getElementsByClass("lazy-read");
ComicImageModel comicImageModel;
for (Element items : elementsAll) {
comicImageModel = new ComicImageModel();
comicImageModel.setImagePath(items.getElementsByTag("img").attr("data-original"));
System.out.println(items.getElementsByTag("img").attr("data-original"));
System.out.println();
listData.add(comicImageModel);}
handler.sendEmptyMessage(1);
} catch (IOException e) {
e.printStackTrace();
}
return "";
}@Override
protected void onProgressUpdate(Void... values) {
}}
private List<TypeModel> listType = new ArrayList<TypeModel>();
@SuppressLint( "HandlerLeak" )
Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
ImageAdapter diaryAdapter = new ImageAdapter(ComicImageActivity.this, listData);
mListMessage.setAdapter(diaryAdapter);}
};
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。