// Path: app/src/main/java/de/vier_bier/habpanelviewer/status/ApplicationStatus.java
// public class ApplicationStatus {
//     private final ArrayList<StatusItem> mValues = new ArrayList<>();
//     private final HashMap<String, StatusItem> mIndices = new HashMap<>();
// 
//     public synchronized void set(String key, String value) {
//         StatusItem item = mIndices.get(key);
//         if (item == null) {
//             item = new StatusItem(key, value);
//             mValues.add(item);
//             mIndices.put(key, item);
//         } else {
//             item.setValue(value);
//         }
//     }
// 
//     int getItemCount() {
//         return mValues.size();
//     }
// 
//     StatusItem getItem(int i) {
//         return mValues.get(i);
//     }
// }


import android.content.Context;
import android.content.res.Resources;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import de.vier_bier.habpanelviewer.R;
import de.vier_bier.habpanelviewer.status.ApplicationStatus;
                        toDuration(Math.max(currentOnlineTime, mOnlineMaxMillis)),
                        toDuration(averageOnlineTime),
                        toDuration(mOfflineMillis + currentOfflineTime),
                        (mOfflinePeriods + (mState == State.DISCONNECTED ? 1 : 0)),
                        toDuration(Math.max(currentOfflineTime, mOfflineMaxMillis)),
                        toDuration(averageOfflineTime)));
    }

    private String toDuration(long durationMillis) {
        if (durationMillis < 1000) {
            return "-";
        }

        Resources res = mCtx.getResources();

        String retVal = "";

        // days
        if (durationMillis > 86400000) {
            long days = durationMillis / 86400000;

            retVal += res.getQuantityString(R.plurals.days, (int) days, days);
            durationMillis %= 86400000;
        }

        // hours
        if (durationMillis > 3600000) {
            long hours = durationMillis / 3600000;

            retVal += res.getQuantityString(R.plurals.hours, (int) hours, hours);
// Path: app/src/main/java/de/vier_bier/habpanelviewer/status/ApplicationStatus.java
// public class ApplicationStatus {
//     private final ArrayList<StatusItem> mValues = new ArrayList<>();
//     private final HashMap<String, StatusItem> mIndices = new HashMap<>();
// 
//     public synchronized void set(String key, String value) {
//         StatusItem item = mIndices.get(key);
//         if (item == null) {
//             item = new StatusItem(key, value);
//             mValues.add(item);
//             mIndices.put(key, item);
//         } else {
//             item.setValue(value);
//         }
//     }
// 
//     int getItemCount() {
//         return mValues.size();
//     }
// 
//     StatusItem getItem(int i) {
//         return mValues.get(i);
//     }
// }


// Path: app/src/main/java/de/vier_bier/habpanelviewer/connection/ConnectionStatistics.java
import android.content.Context;
import android.content.res.Resources;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import de.vier_bier.habpanelviewer.R;
import de.vier_bier.habpanelviewer.status.ApplicationStatus;

                        toDuration(Math.max(currentOnlineTime, mOnlineMaxMillis)),
                        toDuration(averageOnlineTime),
                        toDuration(mOfflineMillis + currentOfflineTime),
                        (mOfflinePeriods + (mState == State.DISCONNECTED ? 1 : 0)),
                        toDuration(Math.max(currentOfflineTime, mOfflineMaxMillis)),
                        toDuration(averageOfflineTime)));
    }

    private String toDuration(long durationMillis) {
        if (durationMillis < 1000) {
            return "-";
        }

        Resources res = mCtx.getResources();

        String retVal = "";

        // days
        if (durationMillis > 86400000) {
            long days = durationMillis / 86400000;

            retVal += res.getQuantityString(R.plurals.days, (int) days, days);
            durationMillis %= 86400000;
        }

        // hours
        if (durationMillis > 3600000) {
            long hours = durationMillis / 3600000;

            retVal += res.getQuantityString(R.plurals.hours, (int) hours, hours);
            durationMillis %= 3600000;