Search in sources :

Example 1 with StorageSize

use of com.yzy.supercleanmaster.model.StorageSize in project superCleanMaster by joyoyao.

the class MemoryCleanActivity method refeshTextCounter.

private void refeshTextCounter() {
    mwaveView.setProgress(20);
    StorageSize mStorageSize = StorageUtil.convertStorageSize(Allmemory);
    textCounter.setStartValue(0f);
    textCounter.setEndValue(mStorageSize.value);
    sufix.setText(mStorageSize.suffix);
    //  textCounter.setSuffix(mStorageSize.suffix);
    textCounter.start();
}
Also used : StorageSize(com.yzy.supercleanmaster.model.StorageSize)

Example 2 with StorageSize

use of com.yzy.supercleanmaster.model.StorageSize in project superCleanMaster by joyoyao.

the class RubbishCleanActivity method onScanCompleted.

@Override
public void onScanCompleted(Context context, List<CacheListItem> apps) {
    showProgressBar(false);
    mCacheListItem.clear();
    mCacheListItem.addAll(apps);
    rublishMemoryAdapter.notifyDataSetChanged();
    header.setVisibility(View.GONE);
    if (apps.size() > 0) {
        header.setVisibility(View.VISIBLE);
        bottom_lin.setVisibility(View.VISIBLE);
        long medMemory = mCleanerService != null ? mCleanerService.getCacheSize() : 0;
        StorageSize mStorageSize = StorageUtil.convertStorageSize(medMemory);
        textCounter.setAutoFormat(false);
        textCounter.setFormatter(new DecimalFormatter());
        textCounter.setAutoStart(false);
        textCounter.setStartValue(0f);
        textCounter.setEndValue(mStorageSize.value);
        // the amount the number increments at each time interval
        textCounter.setIncrement(5f);
        // the time interval (ms) at which the text changes
        textCounter.setTimeInterval(50);
        sufix.setText(mStorageSize.suffix);
        //  textCounter.setSuffix(mStorageSize.suffix);
        textCounter.start();
    } else {
        header.setVisibility(View.GONE);
        bottom_lin.setVisibility(View.GONE);
    }
    if (!mAlreadyScanned) {
        mAlreadyScanned = true;
    }
}
Also used : StorageSize(com.yzy.supercleanmaster.model.StorageSize) DecimalFormatter(com.yzy.supercleanmaster.widget.textcounter.formatters.DecimalFormatter)

Example 3 with StorageSize

use of com.yzy.supercleanmaster.model.StorageSize in project superCleanMaster by joyoyao.

the class StorageUtil method convertStorageSize.

public static StorageSize convertStorageSize(long size) {
    long kb = 1024;
    long mb = kb * 1024;
    long gb = mb * 1024;
    StorageSize sto = new StorageSize();
    if (size >= gb) {
        sto.suffix = "GB";
        sto.value = (float) size / gb;
        return sto;
    } else if (size >= mb) {
        sto.suffix = "MB";
        sto.value = (float) size / mb;
        return sto;
    } else if (size >= kb) {
        sto.suffix = "KB";
        sto.value = (float) size / kb;
        return sto;
    } else {
        sto.suffix = "B";
        sto.value = (float) size;
        return sto;
    }
}
Also used : StorageSize(com.yzy.supercleanmaster.model.StorageSize)

Aggregations

StorageSize (com.yzy.supercleanmaster.model.StorageSize)3 DecimalFormatter (com.yzy.supercleanmaster.widget.textcounter.formatters.DecimalFormatter)1