Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6e03a325 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Always show at least 1% when some space used."

parents 0175533a 52aa9fb1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -269,7 +269,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
                result.value, result.units));
        mSummary.setSummary(getString(R.string.storage_volume_used,
                Formatter.formatFileSize(context, mTotalSize)));
        mSummary.setPercent((int) ((usedBytes * 100) / mTotalSize));
        mSummary.setPercent(usedBytes, mTotalSize);

        mMeasure.forceMeasure();
        mNeedsUpdate = false;
+1 −1
Original line number Diff line number Diff line
@@ -166,7 +166,7 @@ public class PublicVolumeSettings extends SettingsPreferenceFragment {
                    result.value, result.units));
            mSummary.setSummary(getString(R.string.storage_volume_used,
                    Formatter.formatFileSize(context, totalBytes)));
            mSummary.setPercent((int) ((usedBytes * 100) / totalBytes));
            mSummary.setPercent(usedBytes, totalBytes);
        }

        if (mVolume.getState() == VolumeInfo.STATE_UNMOUNTED) {
+4 −2
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.content.Context;
import android.graphics.Color;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceViewHolder;
import android.util.MathUtils;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.TextView;
@@ -36,8 +37,9 @@ public class StorageSummaryPreference extends Preference {
        setEnabled(false);
    }

    public void setPercent(int percent) {
        mPercent = percent;
    public void setPercent(long usedBytes, long totalBytes) {
        mPercent = MathUtils.constrain((int) ((usedBytes * 100) / totalBytes),
                (usedBytes > 0) ? 1 : 0, 100);
    }

    @Override