Commit 53dcc56f authored by mengcuiguang's avatar mengcuiguang

删除清理代码

parent 7e8f055b
...@@ -120,86 +120,10 @@ ...@@ -120,86 +120,10 @@
android:exported="false" android:exported="false"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan" /> android:windowSoftInputMode="adjustPan" />
<activity
android:name=".ui.activitys.IncreasespeedActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.OneCleanActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.clean.MultiCleanActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.clean.AlbumCleanActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.PreviewActivity"
android:exported="false"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.TranslucentSplish" />
<activity
android:name=".ui.activitys.WxCleanActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.VirusCleanActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.JunkCleanActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.VedioCompressActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".appmanagement.CategoryAppsActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.DuplicateActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".bigfile.ActivityBigFile"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".bigfile.ActivityBigFileList"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.NewResultActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.VedioComingActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.VedioActivity"
android:exported="false"
android:configChanges="orientation|screenSize|keyboardHidden"
android:screenOrientation="portrait" />
<activity <activity
android:name=".ui.activitys.ManageOrderActivity" android:name=".ui.activitys.ManageOrderActivity"
android:exported="false" android:exported="false"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity
android:name=".similarpic.PicSimilarActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".similarpic.PicPreviewActivity"
android:exported="false"
android:screenOrientation="portrait" />
<service <service
android:name=".ui.service.UpdateService" android:name=".ui.service.UpdateService"
......
package com.mints.wisdomclean.appmanagement
import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.text.TextUtils
import android.view.View
import androidx.fragment.app.Fragment
import androidx.viewpager.widget.ViewPager
import com.google.android.material.tabs.TabLayout
import com.mints.library.utils.ConstantUtil
import com.mints.wisdomclean.BuildConfig
import com.mints.wisdomclean.R
import com.mints.wisdomclean.ui.activitys.base.BaseActivity
import kotlinx.android.synthetic.main.activity_aboutus.*
import kotlinx.android.synthetic.main.header_layout.*
/**
* @author Assen
* @date 2023/6/12
* @desc
*/
class CategoryAppsActivity : BaseActivity() {
companion object {
private const val TAG = "CategoryAppsActivity"
const val MODULE_TYPE = "module_type"
const val INSTALLED = AppInstallFragment.TAG
const val APK = ApkFilesFragment.TAG
}
//tab
private var mTabLayout: TabLayout? = null
//viewpager
private var mViewPager: ViewPager? = null
private var mFragmentList: ArrayList<Fragment>? = null
private var mAppInstallFragment: AppInstallFragment? = null
private val position_install = 0
private var mApkFilesFragment: ApkFilesFragment? = null
private val position_uninstall = 1
private val tag_fragments = arrayOf(
"tag_install", "tag_uninstall"
)
override fun getContentViewLayoutID() = R.layout.activity_category_apps
override fun initViewsAndEvents() {
headerContainer.setBackgroundColor(resources.getColor(R.color.applock_bg_green))
line.visibility = View.GONE
tv_title.text = "软件管理"
tv_title.setTextColor(Color.WHITE)
iv_left_icon.visibility = View.VISIBLE
iv_left_icon.setImageResource(R.mipmap.ic_arrow_back_white)
iv_left_icon.setOnClickListener { finish() }
mTabLayout = findViewById(R.id.tab_category_download)
mViewPager = findViewById(R.id.vp_category_download)
val fragmentManager = supportFragmentManager
val transaction = fragmentManager.beginTransaction()
if (savedInstanceState != null) {
mAppInstallFragment = fragmentManager.getFragment(
savedInstanceState,
tag_fragments[position_install]
) as AppInstallFragment?
mApkFilesFragment = fragmentManager.getFragment(
savedInstanceState,
tag_fragments[position_uninstall]
) as ApkFilesFragment?
} else {
mAppInstallFragment = AppInstallFragment.newInstance()
mApkFilesFragment = ApkFilesFragment.newInstance()
}
mFragmentList = ArrayList()
mFragmentList?.add(mAppInstallFragment!!)
mFragmentList?.add(mApkFilesFragment!!)
transaction.commit()
val titles = intArrayOf(
R.string.tab_fragment_app_install,
R.string.tab_fragment_app_apk
)
val mFragmentAdapter = HomePagerFragmentAdapter(
this, supportFragmentManager, mFragmentList, titles
)
mViewPager?.setAdapter(mFragmentAdapter)
val type = intent.getStringExtra(MODULE_TYPE)
if (!TextUtils.isEmpty(type)) {
if (type == APK) {
mViewPager?.currentItem = 1
} else {
mViewPager?.currentItem = 0
}
}
mTabLayout?.setupWithViewPager(mViewPager)
mViewPager?.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
override fun onPageScrolled(
position: Int,
positionOffset: Float,
positionOffsetPixels: Int
) {
}
override fun onPageSelected(position: Int) {}
override fun onPageScrollStateChanged(state: Int) {}
})
}
override fun isApplyKitKatTranslucency() = false
}
\ No newline at end of file
package com.mints.wisdomclean.appmanagement;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.text.TextUtils;
import android.util.Log;
import com.mints.wisdomclean.common.Constant;
import com.mints.wisdomclean.utils.CategoryUtils;
/**
* No comments
*/
public class FileBroadcast extends BroadcastReceiver {
private Callback callback;
public FileBroadcast() {
// Required empty public constructor
}
public static FileBroadcast registerBroadcast(Context context) {
FileBroadcast broadcast = new FileBroadcast();
IntentFilter filter = new IntentFilter();
filter.addAction(Constant.FILE_OBSERVER_BROADCAST);
filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
filter.addAction(Intent.ACTION_PACKAGE_ADDED);
filter.addDataScheme("package");
context.registerReceiver(broadcast, filter);
return broadcast;
}
public void setCallback(Callback callback) {
this.callback = callback;
}
@Override
public void onReceive(Context context, Intent intent) {
if (intent == null) {
return;
}
String action = intent.getAction();
String dataString = intent.getDataString();
switch (action) {
case Constant.FILE_OBSERVER_BROADCAST:
String path = intent.getStringExtra("path");
String mimeTypeFromPath = CategoryUtils.getMimeTypeFromPath(path);
Log.i("FileBroadcast", "onReceive: " + mimeTypeFromPath);
if (callback != null) {
callback.onDataReceive(intent,path);
}
break;
case Intent.ACTION_PACKAGE_ADDED:
if (TextUtils.isEmpty(dataString)) {
return;
}
if (callback != null) {
//dataString return ---> package:com.xxx.xx
//'package:' length = 8;
String pkgName = dataString.substring(8);
callback.onDataReceive(intent,pkgName);
}
break;
case Intent.ACTION_PACKAGE_REMOVED:
if (TextUtils.isEmpty(dataString)) {
return;
}
if (callback != null) {
String pkgName = dataString.substring(8);
callback.onDataReceive(intent,pkgName);
}
break;
}
}
public interface Callback{
void onDataReceive(Intent intent,String path);
}
}
package com.mints.wisdomclean.appmanagement;
import android.content.Context;
import android.content.SharedPreferences;
public class FileDataRecord {
public static String tree_document_root_uri_value;
// File Name
public static final String SP_FILE_OPEN = "manager_data";
// Count Key name
public static final String SP_KEY_OPEN_COUNT = "open_count";
public static final String tree_document_root_uri = "tree_document_root_uri";
public static void setTreeDocumentRoot(Context context, String volumeKey, String uri) {
SharedPreferences sp = context.getSharedPreferences(SP_FILE_OPEN, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sp.edit();
tree_document_root_uri_value = uri;
editor.putString(volumeKey, uri);
editor.apply();
}
public static String getTreeDocumentRoot(Context context, String volumeKey) {
// if(TextUtils.isEmpty(tree_document_root_uri_value)){
SharedPreferences sp = context.getSharedPreferences(SP_FILE_OPEN, Context.MODE_PRIVATE);
tree_document_root_uri_value = sp.getString(volumeKey, null);
// }
return tree_document_root_uri_value;
}
}
package com.mints.wisdomclean.appmanagement;
//import androidx.documentfile.provider.DocumentFile;
import android.text.TextUtils;
import androidx.documentfile.provider.DocumentFile;
import com.mints.wisdomclean.common.Constant;
import java.io.File;
/**
* No comments
*/
public class FileListBean {
private File file = null;
private boolean isCheck = false;
private String showName;
private String userLabel; //showUUID
private String UUID;
private DocumentFile documentFile;
// private Uri documentFileUri;
private String include;
private int type = Constant.File;//Storage,SDCard
public File getFile() {
return file;
}
public void setFile(File file) {
this.file = file;
documentFile = null;
}
public boolean getCheck() {
return isCheck;
}
public void setCheck(boolean check) {
isCheck = check;
}
public String getShowName() {
return showName;
}
public void setShowName(String showName) {
this.showName = showName;
}
public String getUserLabel() {
if(TextUtils.isEmpty(userLabel)){
userLabel = UUID;
}
return userLabel;
}
public void setUserLabel(String userLabel) {
this.userLabel = userLabel;
}
public String getUUID() {
return UUID;
}
public void setUUID(String UUID) {
this.UUID = UUID;
}
public boolean getDir() {
return (file != null && file.isDirectory()) || (documentFile != null && documentFile.isDirectory());
}
public String getInclude() {
return include;
}
public void setInclude(String include) {
this.include = include;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
}
package com.mints.wisdomclean.appmanagement;
import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.mints.wisdomclean.R;
public class FileOperateDialog extends Dialog implements View.OnClickListener{
private Context context;
private TextView title_tv;
private TextView cancel;
private TextView hide;
private TextView percentage;
private TextView file_path;
private TextView progress_count;
private ProgressBar progress1;
private int progress_total;
private int progress_count_value;
private String file_path_value;
private OnClickListener mOnClickListener;
public FileOperateDialog(Context context) {
super(context, R.style.dialog/*, R.style.MyDialog*/);
this.context = context;
initView();
}
public FileOperateDialog(Context context, OnClickListener mOnClickListener) {
this(context);
this.mOnClickListener = mOnClickListener;
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.cancel:
if (mOnClickListener != null) {
mOnClickListener.onCancel();
}
dismiss();
break;
case R.id.hide:
if (mOnClickListener != null) {
mOnClickListener.onHide();
}
dismiss();
break;
}
}
private void initView() {
try {
setContentView(R.layout.file_operate_progress);
}catch (NumberFormatException e){
//Lenovo S930, Android 4.2.2: Caused by: java.lang.NumberFormatException: Invalid int: "res/drawable/bg_radius3_white.xml"
//次dialog theme会用到bg_radius3_white.xml
//FirebaseAnalyticsLogger.logException(e);
}
title_tv = (TextView) findViewById(R.id.title);
cancel = (TextView) findViewById(R.id.cancel);
hide = (TextView) findViewById(R.id.hide);
percentage = (TextView) findViewById(R.id.percentage);
file_path = (TextView) findViewById(R.id.file_path);
progress_count = (TextView) findViewById(R.id.progress_count);
progress1 = (ProgressBar) findViewById(R.id.progress1);
cancel.setOnClickListener(this);
hide.setOnClickListener(this);
// cancel.setVisibility(showCancel? View.VISIBLE : View.GONE);
setCanceledOnTouchOutside(false);
setCancelable(false); //press BACK KEY can't dismiss
}
public void setTitle(String title){
if(title == null){
title = "";
}
title_tv.setText(title);
}
public void startStatus(String file_path, int progress_count, int progress_total){
this.progress_total = progress_total;
if(file_path == null){
file_path = "";
}
file_path_value = file_path;
progress_count_value = progress_count;
this.file_path.setText(file_path_value);
this.progress1.setProgress(0);
this.percentage.setText(context.getString(R.string.storage_percent, 0));
this.progress_count.setText(context.getString(R.string.fraction_format, progress_count_value, progress_total));
}
public void updateStatus(String file_path, int progress1, int progress_count, int progress_total){
this.progress_total = progress_total;
if(file_path == null){
file_path = "";
}
file_path_value = file_path;
progress_count_value = progress_count;
this.file_path.setText(file_path_value);
this.progress1.setProgress(progress1);
this.percentage.setText(context.getString(R.string.storage_percent, progress1));
this.progress_count.setText(context.getString(R.string.fraction_format, progress_count, progress_total));
}
public void updateStatus(int progress1){
this.progress1.setProgress(progress1);
this.percentage.setText(context.getString(R.string.storage_percent, progress1));
this.progress_count.setText(context.getString(R.string.fraction_format, progress_count_value, progress_total));
}
/**
* 设置按钮的显示内容和监听
*
* @param mOnClickListener
*/
public FileOperateDialog setOnClickListener(OnClickListener mOnClickListener) {
this.mOnClickListener = mOnClickListener;
return this;
}
/**
* 设置确定按钮和取消被点击的接口
*/
public interface OnClickListener {
void onCancel();
void onHide();
}
}
package com.mints.wisdomclean.appmanagement;
import android.os.Handler;
import android.os.Message;
import android.widget.Toast;
import com.mints.wisdomclean.R;
import com.mints.wisdomclean.ui.activitys.base.BaseActivity;
import java.lang.ref.WeakReference;
/**
* No comments
*/
public class FileOperateHandler<T> extends Handler {
private WeakReference<ApkFilesFragment> appContext;
private WeakReference<BaseActivity> aContext;
private String contextFrom;
public FileOperateHandler(T context) {
contextFrom = ApkFilesFragment.TAG;
appContext = new WeakReference<>((ApkFilesFragment) context);
}
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
int what = msg.what;
handlerApp(msg, what);
}
private void handlerApp(Message msg, int what) {
ApkFilesFragment contextInstance = appContext.get();
if (contextInstance == null) {
return;
}
switch (what) {
case FileOperationUtil.Status_Success:
case FileOperationUtil.Status_End:
contextInstance.ExitFileOperation(what);
break;
case FileOperationUtil.UpdateFileOperateDialog_Init:
int progressFileCount = msg.arg1;
int totalFileCount = msg.arg2;
String path = (String) msg.obj;
int resId = R.string.Delete;
contextInstance.getFileOperateDialog().setTitle(
contextInstance.getString(R.string.value_ellipse,
contextInstance.getString(resId))
);
contextInstance.getFileOperateDialog().startStatus(path, progressFileCount, totalFileCount);
contextInstance.getFileOperateDialog().startStatus(path, progressFileCount, totalFileCount);
if (!contextInstance.getFileOperateDialog().isShowing()) {
contextInstance.getFileOperateDialog().show();
}
break;
case FileOperationUtil.UpdateFileOperateDialog:
int progress1 = msg.arg1;
contextInstance.getFileOperateDialog().updateStatus(progress1);
break;
// case FileOperationUtil.ShowDuplicateFileDialog:
// String name = (String) msg.obj;
// int file = msg.arg1;
// contextInstance.duplicateFileDialog.setContent(file, name);
// contextInstance.duplicateFileDialog.show();
// break;
case FileOperationUtil.Status_InsufficientSpace: //this may not be called, copy or move will navigate to storageFragment
contextInstance.ExitFileOperation(what);
break;
case FileOperationUtil.Status_ShowTips:
if (msg.obj != null) {
Toast.makeText(contextInstance.getContext(), msg.obj.toString(), Toast.LENGTH_SHORT).show();
}
}
}
}
package com.mints.wisdomclean.appmanagement;
import android.content.Context;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import java.util.List;
/**
* No comments
*/
public class HomePagerFragmentAdapter extends FragmentPagerAdapter {
private int[] mTitles;
private List<Fragment> mFragments;
private Context mContext;
public HomePagerFragmentAdapter(Context context, FragmentManager fm,
List<Fragment> fragments, int[] titles) {
super(fm);
mContext = context;
mFragments = fragments;
mTitles = titles;
}
@Override
public Fragment getItem(int position) {
return (mFragments == null || mFragments.size() == 0) ? null : mFragments.get(position);
}
@Override
public int getCount() {
return (mFragments == null || mFragments.size() == 0) ? 0 : mFragments.size();
}
@Override
public CharSequence getPageTitle(int position) {
return mContext.getString(mTitles[position]);
}
}
package com.mints.wisdomclean.appmanagement;
import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.os.AsyncTask;
import android.provider.MediaStore;
import android.text.format.Formatter;
import com.mints.wisdomclean.mvp.model.AppBean;
import com.mints.wisdomclean.utils.CategoryUtils;
import com.mints.wisdomclean.utils.LogUtil;
import java.util.ArrayList;
import java.util.List;
/**
* No comments
*/
public class LocalApkCursorTask extends AsyncTask<Object, Object, Object> {
private Context mContext;
private List<AppBean> appBeen = new ArrayList<>();
private boolean isExist = false;
private ContentResolver resolver;
private LoadCallback loadCallback;
public LocalApkCursorTask(Context context) {
mContext = context;
resolver = mContext.getContentResolver();
}
public void setExist(boolean exist) {
isExist = exist;
}
public interface LoadCallback {
void onLoadAPK(List<AppBean> appBeen);
}
public void setLoadCallback(LoadCallback loadCallback) {
this.loadCallback = loadCallback;
}
@Override
protected Object doInBackground(Object... params) {
if (isExist) {
return appBeen = new ArrayList<>();
}
String[] projection = new String[]{
MediaStore.Files.FileColumns._ID,
MediaStore.Files.FileColumns.DATA,
MediaStore.Files.FileColumns.SIZE
};
/**
* select _id, _data, _size from files
* where (_data like '%.apk')
* order by date_modified desc
*/
Uri ex_uri = MediaStore.Files.getContentUri("external");
Cursor cursor = resolver.query(
ex_uri,
projection,
MediaStore.Files.FileColumns.DATA + " like \'%.apk\'",
null,
MediaStore.Files.FileColumns.DATE_MODIFIED + " desc"
);
if (cursor == null) {
return null;
}
while (cursor.moveToNext()) {
long id = cursor.getLong(0);
String path = cursor.getString(1);
long size = cursor.getLong(2);
String apkSize = Formatter.formatFileSize(mContext, size);
AppBean appBean = CategoryUtils.apkInfo(mContext, path, apkSize);
if (appBean == null) {
continue;
}
appBean.setId(id);
appBeen.add(appBean);
}
cursor.close();
return null;
}
@Override
protected void onPostExecute(Object o) {
super.onPostExecute(o);
if (!isExist && loadCallback != null) {
loadCallback.onLoadAPK(appBeen);
}
}
@Override
protected void onCancelled() {
super.onCancelled();
isExist = true;
}
}
package com.mints.wisdomclean.appmanagement;
/**
* No comments
*/
public interface OnCheckChangeListener {
void onCheckChanged(int position, boolean isChecked);
}
package com.mints.wisdomclean.appmanagement;
import android.view.View;
/**
* No comments
*/
public interface OnItemClickListener {
void onItemClick(View itemView, int position, boolean isChecked);//点击回调
}
package com.mints.wisdomclean.appmanagement;
import android.view.View;
/**
* No comments
*/
public interface OnItemLongClickListener {
// void onItemClick(View itemView, int position);//点击回调
void onItemLongClick(View itemView, int position, boolean isChecked);//长按回调
}
package com.mints.wisdomclean.appmanagement;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
/**
* No comments
*/
public class SDCardUnmountedReceiver extends BroadcastReceiver {
private Callback callback;
public void setCallback(Callback callback) {
this.callback = callback;
}
public static SDCardUnmountedReceiver registerBroadcast(Context context) {
SDCardUnmountedReceiver broadcast = new SDCardUnmountedReceiver();
IntentFilter filter = new IntentFilter();
// filter.addAction("android.intent.action.MEDIA_UNMOUNTED");
filter.addAction("android.intent.action.ACTION_MEDIA_SCANNER_FINISHED");
filter.addAction("android.intent.action.MEDIA_MOUNTED_ACTION");
filter.addAction(Intent.ACTION_MEDIA_MOUNTED);
filter.addAction(Intent.ACTION_MEDIA_UNMOUNTED);
filter.addAction("android.intent.action.ACTION_MEDIA_EJECT");
filter.addAction("android.intent.action.ACTION_MEDIA_REMOVED");
filter.addAction("android.intent.action.ACTION_MEDIA_SHARED");
filter.addAction("android.intent.action.ACTION_MEDIA_BAD_REMOVAL");
filter.addDataScheme("file");
context.registerReceiver(broadcast, filter);
return broadcast;
}
@Override
public void onReceive(Context context, Intent intent) {
callback.onDataReceive(intent.getAction());
}
public interface Callback{
void onDataReceive(String action);
}
}
package com.mints.wisdomclean.appmanagement;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.storage.StorageManager;
import java.lang.reflect.Method;
/**
* Project Name: PhoneCleaner
* Package Name: wonder.city.baseutility.utility.bigfile.util
* File Name: StaticUtil
* Creator: xuzhihui
* Create Time: 2018/2/6 20:14
* Description: TODO
*/
public class StaticUtil {
private static volatile String[] sdPaths = null;
// 获取应用安装时长
public static long getAppInstallTime(Context context) {
try {
PackageManager packageManager = context.getPackageManager();
PackageInfo packageInfo = packageManager.getPackageInfo(context.getPackageName(), 0);
return System.currentTimeMillis() - packageInfo.firstInstallTime;
} catch (PackageManager.NameNotFoundException e) {
return 0L;
}
}
public static String[] getAllExtSDCardPath(Context context) {
if (sdPaths == null) {
StorageManager storageManager = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE);
try {
Class<?>[] paramClasses = {};
Method getVolumePathsMethod = StorageManager.class.getMethod("getVolumePaths", paramClasses);
getVolumePathsMethod.setAccessible(true);
Object[] params = {};
Object invoke = getVolumePathsMethod.invoke(storageManager, params);
sdPaths = (String[]) invoke;
//return (String[]) invoke;
} /*catch (NoSuchMethodException e1) {
e1.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} */ catch (Exception e) {
sdPaths = null;
}
}
return sdPaths;
}
}
package com.mints.wisdomclean.bigfile;
import java.util.ArrayList;
/**
* Project Name: BigFileDemo
* Package Name: www.xuzhihui.com.bigfiledemo.util
* File Name: BigFileLoader
* Creator: xuzhihui
* Create Time: 2018/1/19 20:19
* Description: TODO
*/
public class BigFileLoader {
private static volatile ArrayList<FileItem> sVideoList = null;
private static volatile ArrayList<FileItem> sAudioList = null;
private static volatile ArrayList<FileItem> sDocumentList = null;
private BigFileLoader() {
}
public static ArrayList<FileItem> getVideoList() {
if (sVideoList == null) {
synchronized (BigFileLoader.class) {
if (sVideoList == null)
sVideoList = new ArrayList<>();
}
}
return sVideoList;
}
public static ArrayList<FileItem> getAudioList() {
if (sAudioList == null) {
synchronized (BigFileLoader.class) {
if (sAudioList == null)
sAudioList = new ArrayList<>();
}
}
return sAudioList;
}
public static ArrayList<FileItem> getDocumentList() {
if (sDocumentList == null) {
synchronized (BigFileLoader.class) {
if (sDocumentList == null)
sDocumentList = new ArrayList<>();
}
}
return sDocumentList;
}
public static void clearLoader() {
if (sVideoList != null) {
sVideoList = null;
}
if (sAudioList != null) {
sAudioList = null;
}
if (sDocumentList != null) {
sDocumentList = null;
}
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment