mirror of
https://github.com/Team4388/RidgeScout.git
synced 2026-06-09 08:38:03 -06:00
Finish up report tool
This commit is contained in:
@@ -4,13 +4,14 @@ import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
public class AutoSaveManager {
|
||||
private static final long AUTO_SAVE_DELAY = 2000; // 2 seconds
|
||||
public static final long AUTO_SAVE_DELAY = 2000; // 2 seconds
|
||||
|
||||
private final Handler handler;
|
||||
private final Runnable autoSaveRunnable;
|
||||
private boolean isAutoSaveScheduled = false;
|
||||
private final AutoSaveFunction autoSaveFunction;
|
||||
public boolean isRunning = false;
|
||||
private long delay;
|
||||
|
||||
// Functional interface for the auto-save function
|
||||
@FunctionalInterface
|
||||
@@ -18,8 +19,9 @@ public class AutoSaveManager {
|
||||
void save();
|
||||
}
|
||||
|
||||
public AutoSaveManager(AutoSaveFunction autoSaveFunction) {
|
||||
public AutoSaveManager(AutoSaveFunction autoSaveFunction, long delay) {
|
||||
this.autoSaveFunction = autoSaveFunction;
|
||||
this.delay = delay;
|
||||
handler = new Handler(Looper.getMainLooper());
|
||||
autoSaveRunnable = new Runnable() {
|
||||
@Override
|
||||
|
||||
@@ -32,6 +32,10 @@ public class SettingsManager {
|
||||
public static final String EnableQuickAllianceChangeKey = "enable_quick_alliance_change";
|
||||
public static final String CustomEventsKey = "enable_custom_event";
|
||||
|
||||
|
||||
public static final String ScoutingReportKey = "scouting_report";
|
||||
public static final String ScoutingReportIndexKey = "scouting_report_index";
|
||||
|
||||
public static Map defaults = getDefaults();
|
||||
private static Map getDefaults(){
|
||||
Map<String, Object> hm = new HashMap<>();
|
||||
@@ -52,6 +56,8 @@ public class SettingsManager {
|
||||
hm.put(FTPSendMetaFiles, false);
|
||||
hm.put(EnableQuickAllianceChangeKey, false);
|
||||
hm.put(CustomEventsKey, false);
|
||||
hm.put(ScoutingReportKey, "");
|
||||
hm.put(ScoutingReportIndexKey, 0);
|
||||
|
||||
return hm;
|
||||
}
|
||||
@@ -136,5 +142,12 @@ public class SettingsManager {
|
||||
|
||||
|
||||
|
||||
public static String getScoutingReport(String eventCode, int matchNum){return prefs.getString(ScoutingReportKey+"_"+eventCode+"_"+matchNum, (String) defaults.get(ScoutingReportKey));}
|
||||
public static void setScoutingReport(String eventCode, int matchNum, String data){getEditor().putString(ScoutingReportKey+"_"+eventCode+"_"+matchNum,data).apply();}
|
||||
|
||||
public static int getReportMatchIndex(String eveode){return prefs.getInt( ScoutingReportIndexKey+"_"+eveode, (int) defaults.get(ScoutingReportIndexKey));}
|
||||
public static void setReportIndex(int num, String evcode){ getEditor().putInt( ScoutingReportIndexKey+"_"+evcode,num).apply();}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user