diff --git a/apps/zftlive-framework-samples/src/main/java/com/zftlive/android/sample/imagepicker/ImageFileBean.java b/apps/zftlive-framework-samples/src/main/java/com/zftlive/android/sample/imagepicker/ImageFileBean.java index d03c263..f12d255 100644 --- a/apps/zftlive-framework-samples/src/main/java/com/zftlive/android/sample/imagepicker/ImageFileBean.java +++ b/apps/zftlive-framework-samples/src/main/java/com/zftlive/android/sample/imagepicker/ImageFileBean.java @@ -25,11 +25,9 @@ import com.zftlive.android.library.base.bean.AdapterModelBean; */ public class ImageFileBean extends AdapterModelBean { - public String title = ""; - public String imageURL = ""; - public int id = 0; + public String id = ""; public String displayName = ""; @@ -41,11 +39,49 @@ public class ImageFileBean extends AdapterModelBean { public String path = ""; + public String resolution = ""; + + public String addDate = ""; + + /** + * 原图uri + */ + public String originUri; + + /** + * 原图path + */ + public String originPath; + + /** + * 缩略图uri + */ + public String thumbnailUri; + + /** + * 是否视频 + */ + public boolean isVideo = false; + + /** + * 标题 + */ + public String title = ""; + + /** + * 视频时长 ms + */ public long duration = 0; - public long size = 0; + /** + * 视频时长文案 + */ + public String durationText = ""; - public String resolution = ""; + /** + * 视频大小 byte + */ + public long size = 0; public ImageFileBean() { diff --git a/apps/zftlive-framework-samples/src/main/java/com/zftlive/android/sample/imagepicker/ImagePickerActivity.java b/apps/zftlive-framework-samples/src/main/java/com/zftlive/android/sample/imagepicker/ImagePickerActivity.java index 272ee4f..a3ad979 100644 --- a/apps/zftlive-framework-samples/src/main/java/com/zftlive/android/sample/imagepicker/ImagePickerActivity.java +++ b/apps/zftlive-framework-samples/src/main/java/com/zftlive/android/sample/imagepicker/ImagePickerActivity.java @@ -18,31 +18,49 @@ package com.zftlive.android.sample.imagepicker; +import android.Manifest; import android.annotation.SuppressLint; +import android.annotation.TargetApi; +import android.app.Activity; import android.content.Context; +import android.content.pm.PackageManager; import android.database.Cursor; +import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.provider.MediaStore; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.support.v4.app.ActivityCompat; +import android.support.v4.app.LoaderManager; +import android.support.v4.content.ContextCompat; +import android.support.v4.content.CursorLoader; +import android.support.v4.content.Loader; +import android.text.TextUtils; import android.view.View; import android.widget.GridView; import com.zftlive.android.R; +import com.zftlive.android.library.Logger; import com.zftlive.android.library.base.ui.CommonActivity; import com.zftlive.android.library.common.adapter.SingleTypeAdapter; +import com.zftlive.android.library.tools.ToolDateTime; import java.util.ArrayList; +import java.util.Date; /** - * 异步加载图片示例DEMO,防止图片错位 + * 加载本地图片和视频展示+预览 * @author 曾繁添 * @version 1.0 * */ -public class ImagePickerActivity extends CommonActivity { +public class ImagePickerActivity extends CommonActivity implements LoaderManager.LoaderCallbacks{ private GridView mListView; private SingleTypeAdapter mMyListViewAdapter; - + private static final int REQUEST_READ_EXTERNAL_STORAGE_PERMISSION = 123; + private String strCenterTitle = ""; @Override public int bindLayout() { return R.layout.activity_image_grid; @@ -58,7 +76,7 @@ public class ImagePickerActivity extends CommonActivity { public void initView(View view) { mListView = (GridView)findViewById(R.id.gv_square); //初始化带返回按钮的标题栏 - String strCenterTitle = getResources().getString(R.string.ImagePickerActivity); + strCenterTitle = getResources().getString(R.string.ImagePickerActivity); // ActionBarManager.initBackTitle(getContext(), getActionBar(), strCenterTitle); mWindowTitle.initBackTitleBar(strCenterTitle); } @@ -67,27 +85,43 @@ public class ImagePickerActivity extends CommonActivity { public void doBusiness(Context mContext) { mMyListViewAdapter = new SingleTypeAdapter(this); mMyListViewAdapter.registeViewTemplet(MyGridViewTemplet.class); - initData(); mListView.setAdapter(mMyListViewAdapter); + initData(); } private void initData(){ - mMyListViewAdapter.clear(); - mMyListViewAdapter.addItem(getLoadMedia()); +// mMyListViewAdapter.clear(); +// mMyListViewAdapter.addItem(getLoadMedia()); -// //构造数据 -// for (int i = 0; i < 20; i++) { -// mMyListViewAdapter.addItem(new ImageRowBean(i+1+"-"+titles[i],imageURLs[i])); -// } -// mListView.postDelayed(new Runnable() { -// @Override -// public void run() { -// if(mListView.isRefreshing()){ -// mListView.setRefreshing(false); -// } -// } -// },200); + // 检测读取、写入权限 + if (ContextCompat.checkSelfPermission(mActivity, Manifest.permission.READ_EXTERNAL_STORAGE) + == PackageManager.PERMISSION_GRANTED && + ContextCompat.checkSelfPermission(mActivity, Manifest.permission.WRITE_EXTERNAL_STORAGE) + == PackageManager.PERMISSION_GRANTED) { + startLoader(); + } else if (ActivityCompat.shouldShowRequestPermissionRationale(mActivity, Manifest.permission.READ_EXTERNAL_STORAGE) + || ActivityCompat.shouldShowRequestPermissionRationale(mActivity, Manifest.permission.WRITE_EXTERNAL_STORAGE)) { + // empty code + } else { + ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE}, + REQUEST_READ_EXTERNAL_STORAGE_PERMISSION); + } + } + @Override + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { + super.onRequestPermissionsResult(requestCode, permissions, grantResults); + // 权限授权结果 + if (requestCode == REQUEST_READ_EXTERNAL_STORAGE_PERMISSION && + grantResults[0] == PackageManager.PERMISSION_GRANTED && + grantResults[1] == PackageManager.PERMISSION_GRANTED) { + startLoader(); + } + } + + private void startLoader() { + mOperation.showLoading("正在查询数据"); + mActivity.getSupportLoaderManager().initLoader(0, null, this); } public ArrayList getLoadMedia() { @@ -109,7 +143,7 @@ public class ImagePickerActivity extends CommonActivity { String resolution =cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Video.Media.RESOLUTION)); ImageFileBean item = new ImageFileBean(); - item.id = id; + item.id = id+""; item.displayName = displayName; item.album = album; item.artist = artist; @@ -121,6 +155,8 @@ public class ImagePickerActivity extends CommonActivity { item.size = size; item.resolution = resolution; + Logger.d(TAG,"id="+id + " title="+title + " mimeType="+mimeType +" resolution="+resolution+ " path="+path +" duration="+duration + " size="+size); + result.add(item); } } catch (Exception e) { @@ -131,4 +167,213 @@ public class ImagePickerActivity extends CommonActivity { return result; } + + public static String[] thumbColumns = { MediaStore.Video.Thumbnails.DATA }; + public static String[] mediaColumns = { MediaStore.Video.Media._ID }; + + public static String getThumbnailPathForLocalFile(Activity context, Uri fileUri) { + + long fileId = getFileId(context, fileUri); + + MediaStore.Video.Thumbnails.getThumbnail(context.getContentResolver(), + fileId, MediaStore.Video.Thumbnails.MICRO_KIND, null); + + Cursor thumbCursor = null; + try { + + thumbCursor = context.managedQuery( + MediaStore.Video.Thumbnails.EXTERNAL_CONTENT_URI, + thumbColumns, MediaStore.Video.Thumbnails.VIDEO_ID + " = " + + fileId, null, null); + + if (thumbCursor.moveToFirst()) { + String thumbPath = thumbCursor.getString(thumbCursor + .getColumnIndex(MediaStore.Video.Thumbnails.DATA)); + + return thumbPath; + } + + } finally { + } + + return ""; + } + + public static long getFileId(Activity context, Uri fileUri) { + + Cursor cursor = context.managedQuery(fileUri, mediaColumns, null, null, + null); + + if (cursor.moveToFirst()) { + int columnIndex = cursor + .getColumnIndexOrThrow(MediaStore.Video.Media._ID); + int id = cursor.getInt(columnIndex); + + return id; + } + + return 0; + } + + @TargetApi(Build.VERSION_CODES.HONEYCOMB) + @NonNull + @Override + public Loader onCreateLoader(int id, @Nullable Bundle bundle) { + String selection = null; + String[] mimeTypes = new String[]{MimeType.MP4, MimeType.JPEG, MimeType.PNG}; + if (mimeTypes != null) { + StringBuilder sb = new StringBuilder(); + for (int j = 0; j < mimeTypes.length; j++) { + sb.append("mime_type=?"); + if (j + 1 < mimeTypes.length) { + sb.append(" or "); + } + } + selection = sb.toString(); + } + + Uri uri = MediaStore.Files.getContentUri("external"); +// uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; +// uri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; + + return new CursorLoader( + mActivity, + uri, + COLUMNS_NAME, + selection, + mimeTypes, + DATE_ADDED + " DESC" + ); + } + + @Override + public void onLoadFinished(@NonNull Loader loader, Cursor cursor) { + + ArrayList result = new ArrayList(); + + try { + int countVideo = 0; + if (cursor != null && cursor.getCount() > 0 && cursor.moveToFirst()) { + do { + String _id = cursor.getString(cursor.getColumnIndex(_ID)); + String storage_id = cursor.getString(cursor.getColumnIndex(STORAGE_ID)); + String title =cursor.getString(cursor.getColumnIndex(TITLE)); + String _data = cursor.getString(cursor.getColumnIndex(DATA)); + String _display_name = cursor.getString(cursor.getColumnIndex(DISPLAY_NAME)); + String mime_type = cursor.getString(cursor.getColumnIndex(MIME_TYPE)); + String media_type = cursor.getString(cursor.getColumnIndex(MEDIA_TYPE)); + String bucket_display_name = cursor.getString(cursor.getColumnIndex(BUCKET_DISPLAY_NAME)); + long size = cursor.getLong(cursor.getColumnIndex(SIZE)); // 大小 + long addDate = cursor.getLong(cursor.getColumnIndex(DATE_ADDED)); // 添加日期 + + String originalUri = + MediaStore.Images.Media.EXTERNAL_CONTENT_URI + .buildUpon() + .appendPath(_id) + .build() + .toString(); + + ImageFileBean bean = new ImageFileBean(); + bean.title = title; + bean.originUri = originalUri; + bean.originPath = _data; + // 这里不用缩略图测试下 + bean.thumbnailUri = originalUri;//getThumbnailPathForLocalFile(mActivity,Uri.parse(path)); + bean.isVideo = (MimeType.MP4.equals(mime_type) ? true : false); + if(bean.isVideo){ + countVideo++; + } + bean.id = _id; + bean.displayName = _display_name; +// bean.album = album; +// bean.artist = artist; + bean.title = title; + bean.mimeType = mime_type; + bean.path = _data; + bean.imageURL = _data; + bean.durationText = (bean.isVideo?getMediaDuring(_data):""); + bean.duration = getMediaDuringLong(bean.durationText); + bean.size = size; +// bean.resolution = resolution; + bean.addDate = ToolDateTime.formatDateTime(new Date(addDate * 1000L),ToolDateTime.DF_YYYY_MM_DD_HH_MM_SS); + result.add(bean); + + Logger.d(TAG,"id="+_id +" storage_id="+storage_id+ " addDate="+bean.addDate+ " durationText="+bean.durationText+" size="+size + " mimeType="+mime_type +" title="+title + " path="+_data +" _display_name="+_display_name ); + + } while (cursor.moveToNext()); + } + + mWindowTitle.getTitleTextView().setText(strCenterTitle+"(总计:"+result.size()+" 视频:"+countVideo +"其余:"+(result.size()-countVideo)+")"); + mMyListViewAdapter.clear(); + mMyListViewAdapter.addItem(result); + mMyListViewAdapter.notifyDataSetChanged(); + + } catch (Throwable e) { + e.printStackTrace(); + } finally { + if(null != cursor && !cursor.isClosed()){ + cursor.close(); + } + } + + //关闭loading + mOperation.closeLoading(); + } + + @Override + public void onLoaderReset(@NonNull Loader loader) { + mMyListViewAdapter.clear(); + mMyListViewAdapter.notifyDataSetChanged(); + } + + private static final String _ID = MediaStore.Files.FileColumns._ID; + private static final String STORAGE_ID = "storage_id"; + private static final String SIZE = MediaStore.Files.FileColumns.SIZE; + private static final String TITLE = MediaStore.Files.FileColumns.TITLE; + private static final String DATE_ADDED = MediaStore.Files.FileColumns.DATE_ADDED; + private static final String DATA = MediaStore.Files.FileColumns.DATA; + private static final String DISPLAY_NAME = MediaStore.Files.FileColumns.DISPLAY_NAME; + private static final String MIME_TYPE = MediaStore.Files.FileColumns.MIME_TYPE; + private static final String MEDIA_TYPE = MediaStore.Files.FileColumns.MEDIA_TYPE; + private static final String BUCKET_DISPLAY_NAME = "bucket_display_name"; + + private static final String[] COLUMNS_NAME = { + _ID, + STORAGE_ID, + TITLE, + DATE_ADDED, + SIZE, + DATA, + DISPLAY_NAME, + MIME_TYPE, + MEDIA_TYPE, + BUCKET_DISPLAY_NAME + }; + + @TargetApi(Build.VERSION_CODES.GINGERBREAD_MR1) + public static String getMediaDuring(String mUri) { + String duration = ""; + android.media.MediaMetadataRetriever mmr = new android.media.MediaMetadataRetriever(); + try { + if (mUri != null) { + mmr.setDataSource(mUri); + } + duration = mmr.extractMetadata(android.media.MediaMetadataRetriever.METADATA_KEY_DURATION); + } catch (Exception ex) { + } finally { + mmr.release(); + } + return duration; + } + + public static Long getMediaDuringLong(String strDuration) { + Long duration = 0L; + try { + if(!TextUtils.isEmpty(strDuration)){ + duration = Long.parseLong(strDuration); + } + } catch (Throwable ex) { + } + return duration; + } } diff --git a/apps/zftlive-framework-samples/src/main/java/com/zftlive/android/sample/imagepicker/MimeType.java b/apps/zftlive-framework-samples/src/main/java/com/zftlive/android/sample/imagepicker/MimeType.java new file mode 100644 index 0000000..2ed96e7 --- /dev/null +++ b/apps/zftlive-framework-samples/src/main/java/com/zftlive/android/sample/imagepicker/MimeType.java @@ -0,0 +1,55 @@ +package com.zftlive.android.sample.imagepicker; + +/** + * Created by jay on 2017/11/29 下午4:28 + */ +public final class MimeType { + + /** + * image + */ + public final static int IMAGE = 1; + /** + * video + */ + public final static int VIDEO = 2; + /** + * image + video + */ + public final static int IMAGE_AND_VIDEO = 3; + + // IMAGE + public final static String JPG = "image/jpeg"; + public final static String JPEG = "image/jpeg"; + public final static String GIF = "image/gif"; + public final static String PNG = "image/png"; + public final static String BMP = "image/x-ms-bmp"; + public final static String WBMP = "image/vnd.wap.wbmp"; + public final static String DNG = "image/x-adobe-dng"; + public final static String CR2 = "image/x-canon-cr2"; + public final static String NEF = "image/x-nikon-nef"; + public final static String NRW = "image/x-nikon-nrw"; + public final static String ARW = "image/x-sony-arw"; + public final static String RW2 = "image/x-panasonic-rw2"; + public final static String ORF = "image/x-olympus-orf"; + public final static String RAF = "image/x-fuji-raf"; + public final static String PEF = "image/x-pentax-pef"; + public final static String SRW = "image/x-samsung-srw"; + + // VIDEO + public final static String MPEG = "video/mpeg"; + public final static String MPG = "video/mpeg"; + public final static String MP4 = "video/mp4"; + public final static String M4V = "video/mp4"; + public final static String MOV = "video/quicktime"; + public final static String THREEGP = "video/3gpp"; + public final static String THREEGPP = "video/3gpp"; + public final static String THREEG2 = "video/3gpp2"; + public final static String THREEGPP2 = "video/3gpp2"; + public final static String MKV = "video/x-matroska"; + public final static String WEBM = "video/webm"; + public final static String TS = "video/mp2ts"; + public final static String AVI = "video/avi"; + public final static String WMV = "video/x-ms-wmv"; + public final static String ASF = "video/x-ms-asf"; +} diff --git a/apps/zftlive-framework-samples/src/main/java/com/zftlive/android/sample/imagepicker/MyGridViewTemplet.java b/apps/zftlive-framework-samples/src/main/java/com/zftlive/android/sample/imagepicker/MyGridViewTemplet.java index e369569..7b7b856 100644 --- a/apps/zftlive-framework-samples/src/main/java/com/zftlive/android/sample/imagepicker/MyGridViewTemplet.java +++ b/apps/zftlive-framework-samples/src/main/java/com/zftlive/android/sample/imagepicker/MyGridViewTemplet.java @@ -25,11 +25,19 @@ import android.view.View; import android.widget.ImageView; import android.widget.TextView; +import com.bumptech.glide.Glide; import com.nostra13.universalimageloader.core.DisplayImageOptions; import com.zftlive.android.R; +import com.zftlive.android.library.base.IBaseConstant; import com.zftlive.android.library.base.adapter.IAdapterModel; import com.zftlive.android.library.base.templet.AbsViewTemplet; import com.zftlive.android.library.imageloader.ToolImage; +import com.zftlive.android.library.imageloader.picture.PictureBean; +import com.zftlive.android.library.imageloader.picture.PictureViewerActivity; + +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.Locale; /** * 视图模板 @@ -38,7 +46,8 @@ public class MyGridViewTemplet extends AbsViewTemplet { DisplayImageOptions option; ImageView iv_icon; - TextView tv_title; + TextView tv_title,tv_adddate,tv_size,tv_video_duration; + View rl_video_area; public MyGridViewTemplet(Context mContext) { super(mContext); @@ -54,15 +63,24 @@ public class MyGridViewTemplet extends AbsViewTemplet { public void initView() { iv_icon = (ImageView) findViewById(R.id.iv_icon); tv_title = (TextView) findViewById(R.id.tv_title); + tv_adddate = (TextView) findViewById(R.id.tv_adddate); + tv_size = (TextView) findViewById(R.id.tv_size); + tv_video_duration = (TextView)findViewById(R.id.tv_video_duration); + rl_video_area = findViewById(R.id.rl_video_area); } @Override public void fillData(IAdapterModel model, int postion) { ImageFileBean rowBean = (ImageFileBean) model; - //ImageLoader.getInstance().displayImage((String) rowBean.imageURL, iv_icon,option); - ToolImage.getInstance().displayFile(rowBean.imageURL, iv_icon); - tv_title.setText(rowBean.title); + //ToolImage.getInstance().displayFile(rowBean.imageURL, iv_icon); + Glide.with(mContext).load(rowBean.imageURL).crossFade().centerCrop().into(iv_icon); + tv_title.setText(rowBean.displayName); + tv_adddate.setText(rowBean.addDate); + tv_size.setText(getNetFileSizeDescription(rowBean.size)); + //视频类型 + rl_video_area.setVisibility(rowBean.isVideo?View.VISIBLE:View.GONE); + tv_video_duration.setText(formatSeconds(rowBean.duration / 1000)); } @Override @@ -70,18 +88,106 @@ public class MyGridViewTemplet extends AbsViewTemplet { try{ ImageFileBean rowBean = (ImageFileBean) rowData; //ToolToast.showShort(mContext,"点击了"+ rowBean.title); - - //打开系统的播放器 ACTION_VIEW - Intent intent = new Intent(Intent.ACTION_VIEW); - //得到视频 - //Environment.getExternalStorageDirectory() 得到Sdcard的根目录、 - Uri uri = Uri.parse(rowBean.path); - //加载视频 和 类型 - intent.setDataAndType(uri, "video/*"); - mContext.startActivity(intent); + if(rowBean.isVideo){ + playVideo(mContext,rowBean.path); + }else{ + imageBrower(mContext,rowBean.path); + } }catch (Throwable e){ e.printStackTrace(); } } + /** + * 打开图片查看器 + * + * @param mContext + * @param path + */ + protected void imageBrower(Context mContext,String path) { +// //打开系统的查看器 +// Intent intent = new Intent(Intent.ACTION_VIEW); +// Uri uri = Uri.parse(path); +// //加载图片 +// intent.setDataAndType(uri, "image/*"); +// mContext.startActivity(intent); + + Intent mIntent = new Intent(mContext, PictureViewerActivity.class); + ArrayList dataSource = new ArrayList(); + PictureBean image = new PictureBean(PictureBean.FILE_TYPE_SDCARD, path, path); + dataSource.add(image); + mIntent.putExtra(IBaseConstant.PICTURE_VIEWER_DEFAULT_POSTION, position); + mIntent.putExtra(IBaseConstant.PICTURE_VIEWER_DATASOURCE, dataSource); + mContext.startActivity(mIntent); + } + + /** + * 打开视频 + * + * @param mContext + * @param path + */ + private void playVideo(Context mContext,String path){ + //打开系统的播放器 ACTION_VIEW + Intent intent = new Intent(Intent.ACTION_VIEW); + //得到视频 + //Environment.getExternalStorageDirectory() 得到Sdcard的根目录、 + Uri uri = Uri.parse(path); + //加载视频 和 类型 + intent.setDataAndType(uri, "video/*"); + mContext.startActivity(intent); + } + + /** + * 格式化时长 + * + * @param seconds + * @return + */ + public static String formatSeconds(long seconds){ + String standardTime; + if (seconds <= 0){ + standardTime = "00:00"; + } else if (seconds < 60) { + standardTime = String.format(Locale.getDefault(), "00:%02d", seconds % 60); + } else if (seconds < 3600) { + standardTime = String.format(Locale.getDefault(), "%02d:%02d", seconds / 60, seconds % 60); + } else { + standardTime = String.format(Locale.getDefault(), "%02d:%02d:%02d", seconds / 3600, seconds % 3600 / 60, seconds % 60); + } + return standardTime; + } + + /** + * 格式化byte + * + * @param size + * @return + */ + public static String getNetFileSizeDescription(long size) { + StringBuffer bytes = new StringBuffer(); + DecimalFormat format = new DecimalFormat("###.0"); + if (size >= 1024 * 1024 * 1024) { + double i = (size / (1024.0 * 1024.0 * 1024.0)); + bytes.append(format.format(i)).append("GB"); + } + else if (size >= 1024 * 1024) { + double i = (size / (1024.0 * 1024.0)); + bytes.append(format.format(i)).append("MB"); + } + else if (size >= 1024) { + double i = (size / (1024.0)); + bytes.append(format.format(i)).append("KB"); + } + else if (size < 1024) { + if (size <= 0) { + bytes.append("0B"); + } + else { + bytes.append((int) size).append("B"); + } + } + return bytes.toString(); + } + } diff --git a/apps/zftlive-framework-samples/src/main/res/drawable-xxhdpi/common_album_video.png b/apps/zftlive-framework-samples/src/main/res/drawable-xxhdpi/common_album_video.png new file mode 100644 index 0000000..1e1e3f0 Binary files /dev/null and b/apps/zftlive-framework-samples/src/main/res/drawable-xxhdpi/common_album_video.png differ diff --git a/apps/zftlive-framework-samples/src/main/res/layout/activity_image_grid.xml b/apps/zftlive-framework-samples/src/main/res/layout/activity_image_grid.xml index e881bb4..e8901e7 100644 --- a/apps/zftlive-framework-samples/src/main/res/layout/activity_image_grid.xml +++ b/apps/zftlive-framework-samples/src/main/res/layout/activity_image_grid.xml @@ -10,10 +10,10 @@ android:background="#cccccc" android:columnWidth="@dimen/itemSize" android:gravity="center" - android:horizontalSpacing="10dp" + android:horizontalSpacing="5dp" android:numColumns="3" - android:scrollbars="none" + android:scrollbars="vertical" android:stretchMode="columnWidth" - android:verticalSpacing="10dp" /> + android:verticalSpacing="5dp" /> \ No newline at end of file diff --git a/apps/zftlive-framework-samples/src/main/res/layout/activity_image_grid_item.xml b/apps/zftlive-framework-samples/src/main/res/layout/activity_image_grid_item.xml index a95abc9..a1f356c 100644 --- a/apps/zftlive-framework-samples/src/main/res/layout/activity_image_grid_item.xml +++ b/apps/zftlive-framework-samples/src/main/res/layout/activity_image_grid_item.xml @@ -19,13 +19,75 @@ android:id="@+id/tv_title" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_alignParentBottom="true" + android:layout_alignParentTop="true" android:ellipsize="end" android:gravity="left|center_vertical" - android:padding="10dp" + android:padding="4dp" android:singleLine="false" - android:text="1:00" - android:textColor="@color/anl_white" - android:textSize="14sp" /> + tools:text="XXXXX.mp4" + android:textColor="@color/anl_red" + android:textSize="11dp" /> + + + + + + + + + + + + + + + \ No newline at end of file