use of com.yzy.supercleanmaster.bean.AppProcessInfo in project superCleanMaster by joyoyao.
the class ClearMemoryAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
if (convertView == null) {
convertView = infater.inflate(R.layout.listview_memory_clean, null);
holder = new ViewHolder();
holder.appIcon = (ImageView) convertView.findViewById(R.id.image);
holder.appName = (TextView) convertView.findViewById(R.id.name);
holder.memory = (TextView) convertView.findViewById(R.id.memory);
holder.cb = (RadioButton) convertView.findViewById(R.id.choice_radio);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
final AppProcessInfo appInfo = (AppProcessInfo) getItem(position);
holder.appIcon.setImageDrawable(appInfo.icon);
holder.appName.setText(appInfo.appName);
holder.memory.setText(StorageUtil.convertStorage(appInfo.memory));
if (appInfo.checked) {
holder.cb.setChecked(true);
} else {
holder.cb.setChecked(false);
}
holder.cb.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (appInfo.checked) {
appInfo.checked = false;
} else {
appInfo.checked = true;
}
notifyDataSetChanged();
}
});
return convertView;
}
use of com.yzy.supercleanmaster.bean.AppProcessInfo in project superCleanMaster by joyoyao.
the class AppUtil method getRunningAppProcesses.
/**
* 描述:获取运行的进程列表.
*
* @param context
* @return
*/
public static List<AppProcessInfo> getRunningAppProcesses(Context context) {
ActivityManager activityManager = null;
List<AppProcessInfo> list = null;
PackageManager packageManager = null;
try {
activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
packageManager = context.getApplicationContext().getPackageManager();
list = new ArrayList<AppProcessInfo>();
// 所有运行的进程
List<RunningAppProcessInfo> appProcessList = activityManager.getRunningAppProcesses();
ApplicationInfo appInfo = null;
AppProcessInfo abAppProcessInfo = null;
PackageInfo packageInfo = getPackageInfo(context);
if (mProcessList != null) {
mProcessList.clear();
}
mProcessList = getProcessRunningInfo();
for (RunningAppProcessInfo appProcessInfo : appProcessList) {
abAppProcessInfo = new AppProcessInfo(appProcessInfo.processName, appProcessInfo.pid, appProcessInfo.uid);
appInfo = getApplicationInfo(context, appProcessInfo.processName);
if (appInfo != null) {
if ((appInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
abAppProcessInfo.isSystem = true;
} else {
abAppProcessInfo.isSystem = false;
}
Drawable icon = appInfo.loadIcon(packageManager);
String appName = appInfo.loadLabel(packageManager).toString();
abAppProcessInfo.icon = icon;
abAppProcessInfo.appName = appName;
} else {
// :服务的命名
if (appProcessInfo.processName.indexOf(":") != -1) {
appInfo = getApplicationInfo(context, appProcessInfo.processName.split(":")[0]);
Drawable icon = appInfo.loadIcon(packageManager);
abAppProcessInfo.icon = icon;
}
abAppProcessInfo.isSystem = true;
abAppProcessInfo.appName = appProcessInfo.processName;
}
/*
* AbPsRow psRow = getPsRow(appProcessInfo.processName);
* if(psRow!=null){ abAppProcessInfo.memory = psRow.mem; }
*/
ProcessInfo processInfo = getMemInfo(appProcessInfo.processName);
abAppProcessInfo.memory = processInfo.memory;
abAppProcessInfo.cpu = processInfo.cpu;
abAppProcessInfo.status = processInfo.status;
abAppProcessInfo.threadsCount = processInfo.threadsCount;
list.add(abAppProcessInfo);
}
} catch (Exception e) {
e.printStackTrace();
}
return list;
}
use of com.yzy.supercleanmaster.bean.AppProcessInfo in project superCleanMaster by joyoyao.
the class MemoryCleanActivity method onScanCompleted.
@Override
public void onScanCompleted(Context context, List<AppProcessInfo> apps) {
mAppProcessInfos.clear();
Allmemory = 0;
for (AppProcessInfo appInfo : apps) {
if (!appInfo.isSystem) {
mAppProcessInfos.add(appInfo);
Allmemory += appInfo.memory;
}
}
refeshTextCounter();
mClearMemoryAdapter.notifyDataSetChanged();
showProgressBar(false);
if (apps.size() > 0) {
header.setVisibility(View.VISIBLE);
bottom_lin.setVisibility(View.VISIBLE);
} else {
header.setVisibility(View.GONE);
bottom_lin.setVisibility(View.GONE);
}
// mClearMemoryAdapter = new ClearMemoryAdapter(mContext,
// apps); mClearMemoryAdapter = new ClearMemoryAdapter(mContext,
// apps);
// swingBottomInAnimationAdapter = new SwingBottomInAnimationAdapter(new SwipeDismissAdapter(mClearMemoryAdapter, MemoryCleanActivity.this));
// swingBottomInAnimationAdapter.setAbsListView(mListView);
// assert swingBottomInAnimationAdapter.getViewAnimator() != null;
// swingBottomInAnimationAdapter.getViewAnimator().setInitialDelayMillis(INITIAL_DELAY_MILLIS);
//
// mListView.setAdapter(swingBottomInAnimationAdapter);
//clearMem.setText("200M");
}
Aggregations