- 首先在vendor/mediateck/proprietary/packages/apps/FileManager/res/values/strings.xml中添加字符串显示
<plurals name="zuk_files_count"> <item quantity="one">%1$d item</item> <item quantity="other">%1$d items</item> </plurals>
- 在vendor/mediateck/proprietary/packages/apps/FileManager/res/values-zh-rCN/strings.xml添加中文显示
<plurals name="zuk_files_count"> <item quantity="one">共%1$d个文件</item> <item quantity="other">共%1$d个文件</item> </plurals>
- 注意:如果手机的当前语音使用的中文环境,但是还没有在values-zh-rCN设置相应的字符串,那么系统会始终加载英文strings中other对应的内容
- 在vendor/mediateck/proprietary/packages/apps/FileManager/res/layout/adapter_fileinfos.xml中添加TextView
<TextView android:id="@+id/edit_adapter_size_time" android:textColor="@color/zuk_gray" android:textSize="12sp" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignStart="@id/edit_adapter_name" android:layout_below="@id/edit_adapter_name" android:textDirection="locale" android:textAppearance"?android:attr/textAppearanceSmall"/>
- 在vendor/mediateck/proprietary/packages/apps/FileManager/src/com/mediatek/filemanager/FileInfo.java
public int getFilesCount(){ File[] filesList=mFile.listFile(); if(filesList!=null){ return filesList.length; } return 0; }
- 在vendor/mediateck/proprietary/packages/apps/FileManager/src/com/mediatek/filemanager/FileInfoAdapter.java
import java.text.SimpleDateFormat; private String getFormatTime(long LastModifiedTime){ SimpleDateFormat sdformat=new SimpleDateFormat("yyyy-MM-dd HH:mm"); return sdformat.format(LastModifiedTime); } private void setSizeText(TextView textView,FileInfo fileInfo){ if(fileInfo.isDirectory()){ if(MountPointManager.getInstance().isMountPoint(fileInfo.getFileAbsolutePath())){ StringBuilder sb=new StringBuilder(); String freeSpaceString=FileUtils.sizeToString(MountPointManager.getInstance().getMountPointFreeSpace(fileInfo.getFileAbsolutePath())); String totalSpace=FileUtils.sizeToString(MountPointManager.getInstance().getMountPointTotalSpace(fileInfo.getFileAbsolutePath())); sb.append(mResources.getString(R.string.free_space)).append(" "); sb.append(freeSpaceString).append(" \n"); sb.append(mResources.getString(R.string.total_space)).append(" "); sb.append(totalSpaces).append(" "); textView.setText(sb.toString()); textView.setVisibility(View.VISIBLE); }else{ StringBuilder sbFile=new StringBuilder(); String filesCount=mResources.getQuantityString(R.plurals.zuk_files_count,fileInfo.getFilesCount(),fileInfo.getFilesCount()); sbFile.append(filesCount).append(" ").append(getFormatTime(fileInfo.getFileLastModifiedTime())): textView.setText(sbFile.toString()); } }else{ StringBuilder sb=new StringBuilder(); sb.append(fileInfo.getFileSizeStr()).append(" ").append(getFormatTime(fileInfo.getFileLastModifiedTime())); textView.setText(sb.toString()); textView.setVisibility(View.VISIBLE); } }
给列表文件添加内存和修改时间显示
最新推荐文章于 2021-10-15 14:33:18 发布