Search in sources :

Example 1 with AppProcessInfo

use of com.balaganovrocks.yourmasterclean.bean.AppProcessInfo in project superCleanMaster by joyoyao.

the class BatterySavingActivity 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();
    mBatterySavingAdapter.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");
}
Also used : AppProcessInfo(com.balaganovrocks.yourmasterclean.bean.AppProcessInfo)

Example 2 with AppProcessInfo

use of com.balaganovrocks.yourmasterclean.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");
}
Also used : AppProcessInfo(com.balaganovrocks.yourmasterclean.bean.AppProcessInfo)

Example 3 with AppProcessInfo

use of com.balaganovrocks.yourmasterclean.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;
}
Also used : PackageInfo(android.content.pm.PackageInfo) ApplicationInfo(android.content.pm.ApplicationInfo) Drawable(android.graphics.drawable.Drawable) ProcessInfo(com.balaganovrocks.yourmasterclean.bean.ProcessInfo) AppProcessInfo(com.balaganovrocks.yourmasterclean.bean.AppProcessInfo) RunningAppProcessInfo(android.app.ActivityManager.RunningAppProcessInfo) ActivityManager(android.app.ActivityManager) AppProcessInfo(com.balaganovrocks.yourmasterclean.bean.AppProcessInfo) RunningAppProcessInfo(android.app.ActivityManager.RunningAppProcessInfo) IOException(java.io.IOException) PackageManager(android.content.pm.PackageManager) RunningAppProcessInfo(android.app.ActivityManager.RunningAppProcessInfo)

Example 4 with AppProcessInfo

use of com.balaganovrocks.yourmasterclean.bean.AppProcessInfo in project superCleanMaster by joyoyao.

the class BatterySavingAdapter method getView.

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder = null;
    if (convertView == null) {
        convertView = infater.inflate(R.layout.listview_battery_saving, 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;
}
Also used : ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) AppProcessInfo(com.balaganovrocks.yourmasterclean.bean.AppProcessInfo)

Example 5 with AppProcessInfo

use of com.balaganovrocks.yourmasterclean.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;
}
Also used : ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) AppProcessInfo(com.balaganovrocks.yourmasterclean.bean.AppProcessInfo)

Aggregations

AppProcessInfo (com.balaganovrocks.yourmasterclean.bean.AppProcessInfo)5 View (android.view.View)2 ImageView (android.widget.ImageView)2 TextView (android.widget.TextView)2 ActivityManager (android.app.ActivityManager)1 RunningAppProcessInfo (android.app.ActivityManager.RunningAppProcessInfo)1 ApplicationInfo (android.content.pm.ApplicationInfo)1 PackageInfo (android.content.pm.PackageInfo)1 PackageManager (android.content.pm.PackageManager)1 Drawable (android.graphics.drawable.Drawable)1 ProcessInfo (com.balaganovrocks.yourmasterclean.bean.ProcessInfo)1 IOException (java.io.IOException)1