package epson.scan.activity;

import android.content.Context;
import android.content.SharedPreferences;

import epson.print.CommonDefine;
import epson.print.ScanFileNumber;

class ScanCount {
    ScanCount() {
    }

    private static int getScanCount(@NonNull Context context) {
        return getPreferences(context).getInt(CommonDefine.PREFS_NAME_PRESCAN_COUNT_NUMBER, 0);
    }

    static void saveScanCount(@NonNull Context context, int i) {
        SharedPreferences.Editor edit = getPreferences(context).edit();
        edit.putInt(CommonDefine.PREFS_NAME_PRESCAN_COUNT_NUMBER, i);
        edit.commit();
    }

    private static SharedPreferences getPreferences(@NonNull Context context) {
        return context.getSharedPreferences(CommonDefine.PREFS_NAME_PRESCAN_COUNT_NUMBER, 0);
    }

    static void countUpScanPage(@NonNull Context context) {
        ScanFileNumber.addCount(context, getScanCount(context));
    }
}
