From e6014ef123350d5c0cadabe9c18e26b3d5a3c729 Mon Sep 17 00:00:00 2001
From: guoshen <3129367635@qq.com>
Date: 星期六, 29 六月 2024 15:41:25 +0800
Subject: [PATCH] Revert "Initial commit"
---
app/src/main/java/com/application/zhangshi_app_android/adapter/ElectronicFileAdapter.java | 34 +++++++++++++++++++++++++++++++++-
1 files changed, 33 insertions(+), 1 deletions(-)
diff --git a/app/src/main/java/com/application/zhangshi_app_android/adapter/ElectronicFileAdapter.java b/app/src/main/java/com/application/zhangshi_app_android/adapter/ElectronicFileAdapter.java
index 3ffb361..b7e0147 100644
--- a/app/src/main/java/com/application/zhangshi_app_android/adapter/ElectronicFileAdapter.java
+++ b/app/src/main/java/com/application/zhangshi_app_android/adapter/ElectronicFileAdapter.java
@@ -1,10 +1,15 @@
package com.application.zhangshi_app_android.adapter;
import android.content.Context;
+import android.content.pm.ActivityInfo;
+import android.util.TypedValue;
+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
@@ -23,7 +28,34 @@
@Override
protected void onBind(BaseViewHolder<ItemElectronicFileBinding> holder, int position) {
- holder.getBinding().setUrl(mDataList.get(position));
+ String item = mDataList.get(position);
+ if (item != null) {
+ int resid;
+ if (item.endsWith(".pdf") || item.endsWith(".PDF")) {
+ resid = R.attr.icPdf;
+ } else if (item.endsWith(".zip") || item.endsWith(".ZIP") || item.endsWith(".aar") || item.endsWith(".AAR") || item.endsWith(".7z")) {
+ resid = R.attr.icZip;
+ } else if (item.endsWith(".doc") || item.endsWith(".docx") || item.endsWith(".DOC") || item.endsWith(".DOCX") || item.endsWith(".wps") || item.endsWith(".WPS")) {
+ resid = R.attr.icWord;
+ } else if (item.endsWith(".xls") || item.endsWith(".xlsx") || item.endsWith(".XLS") || item.endsWith(".XLSX")) {
+ resid = R.attr.icExcel;
+ } else if (item.endsWith(".ppt") || item.endsWith(".PPT") || item.endsWith(".pptx") || item.endsWith(".PPTX")) {
+ resid = R.attr.icPpt;
+ } else if (item.endsWith(".txt") || item.endsWith(".TXT")) {
+ resid = R.attr.icTxt;
+ } else if (item.endsWith(".jpg") || item.endsWith(".JPG") || item.endsWith(".jpeg") || item.endsWith(".JPEG") || item.endsWith(".png") || item.endsWith(".PNG") || item.endsWith(".gif") || item.endsWith(".GIF") || item.endsWith(".bmp") || item.endsWith(".BMP")) {
+ resid = R.attr.icImage;
+ } else if (item.endsWith(".mp4") || item.endsWith(".MP4") ) {
+ resid = R.attr.icVideo;
+ } else if (item.endsWith(".mp3") || item.endsWith(".m4a") || item.endsWith(".MP3") || item.endsWith(".M4A")) {
+ resid = R.attr.icAudio;
+ } else {
+ resid = R.attr.icOther;
+ }
+ TypedValue typedValue = new TypedValue();
+ mContext.getTheme().resolveAttribute(resid, typedValue, true);
+ holder.getBinding().ivImage.setImageResource(typedValue.resourceId);
+ }
}
@Override
--
Gitblit v1.9.1