| | |
| | | package com.application.zhangshi_app_android.adapter; |
| | | |
| | | import android.content.Context; |
| | | import android.content.pm.ActivityInfo; |
| | | import android.view.View; |
| | | |
| | | import com.android.app_base.base.adapter.BaseRVAdapter; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.databinding.ItemElectronicFileBinding; |
| | | import com.application.zhangshi_app_android.ui.ImagePreviewActivity; |
| | | import com.application.zhangshi_app_android.ui.VideoPlayActivity; |
| | | |
| | | /** |
| | | * @author Ljj |
| | |
| | | |
| | | @Override |
| | | protected void onBind(BaseViewHolder<ItemElectronicFileBinding> holder, int position) { |
| | | holder.getBinding().setUrl(mDataList.get(position)); |
| | | String item = mDataList.get(position); |
| | | if (item != null) { |
| | | if (item.endsWith(".pdf")) { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_pdf); |
| | | } else if (item.endsWith(".zip") || item.endsWith(".aar") || item.endsWith(".7z")) { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_zip); |
| | | } else if (item.endsWith(".doc") || item.endsWith(".docx")) { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_word); |
| | | } else if (item.endsWith(".xls") || item.endsWith(".xlsx")) { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_excel); |
| | | } else if (item.endsWith(".ppt") || item.endsWith(".pptx")) { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_ppt); |
| | | } else if (item.endsWith(".txt")) { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_txt); |
| | | } else if (item.endsWith(".jpg") || item.endsWith(".jpeg") || item.endsWith(".png") || item.endsWith(".gif")) { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_img); |
| | | } else if (item.endsWith(".mp4")) { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_video); |
| | | } else if (item.endsWith(".mp3") || item.endsWith(".m4a")) { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_audio); |
| | | } else { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_others); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |