mirror of
https://github.com/Team4388/RidgeScout.git
synced 2026-06-09 08:38:03 -06:00
Add field image option
This commit is contained in:
@@ -13,6 +13,7 @@ import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.ridgebotics.ridgescout.R;
|
||||
import com.ridgebotics.ridgescout.utility.SettingsManager;
|
||||
|
||||
public class FieldPosView extends FrameLayout {
|
||||
private int x = -1;
|
||||
@@ -72,7 +73,14 @@ public class FieldPosView extends FrameLayout {
|
||||
return false;
|
||||
});
|
||||
|
||||
setImageResource(R.drawable.field_2025);
|
||||
switch(SettingsManager.getFieldImageIndex()){
|
||||
case "2025":
|
||||
setImageResource(R.drawable.field_2025);
|
||||
break;
|
||||
case "2025 (Flipped)":
|
||||
setImageResource(R.drawable.field_2025_flipped);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import static androidx.navigation.fragment.FragmentKt.findNavController;
|
||||
import static com.ridgebotics.ridgescout.utility.SettingsManager.AllyPosKey;
|
||||
import static com.ridgebotics.ridgescout.utility.SettingsManager.CustomEventsKey;
|
||||
import static com.ridgebotics.ridgescout.utility.SettingsManager.EnableQuickAllianceChangeKey;
|
||||
import static com.ridgebotics.ridgescout.utility.SettingsManager.FieldImageKey;
|
||||
import static com.ridgebotics.ridgescout.utility.SettingsManager.MatchNumKey;
|
||||
import static com.ridgebotics.ridgescout.utility.SettingsManager.SelEVCodeKey;
|
||||
import static com.ridgebotics.ridgescout.utility.SettingsManager.TeamNumKey;
|
||||
@@ -96,7 +97,15 @@ public class SettingsFragment extends Fragment {
|
||||
|
||||
manager.addItem(new CheckboxSettingsItem(WifiModeKey, "Wifi Mode", FTPEnabled));
|
||||
manager.addItem(new CheckboxSettingsItem(EnableQuickAllianceChangeKey, "Enable quick alliance swap", null));
|
||||
|
||||
manager.addItem(new DropdownSettingsItem(FieldImageKey, "Field Image", new String[]{
|
||||
"2025",
|
||||
"2025 (Flipped)"
|
||||
}));
|
||||
|
||||
manager.addItem(new NumberSettingsItem(YearNumKey, "Year", 0, 9999));
|
||||
|
||||
|
||||
manager.addItem(new DropdownSettingsItem(AllyPosKey, "Alliance Pos", alliance_pos_list));
|
||||
|
||||
int max = 0;
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.ridgebotics.ridgescout.utility;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
@@ -15,6 +16,7 @@ public class SettingsManager {
|
||||
|
||||
public static final String SelEVCodeKey = "selected_event_code";
|
||||
public static final String YearNumKey = "year_num";
|
||||
public static final String FieldImageKey = "field_image";
|
||||
|
||||
public static final String MatchNumKey = "match_num";
|
||||
public static final String AllyPosKey = "alliance_pos";
|
||||
@@ -39,6 +41,7 @@ public class SettingsManager {
|
||||
hm.put(SelEVCodeKey, "unset");
|
||||
hm.put(WifiModeKey, false);
|
||||
hm.put(YearNumKey, 2025);
|
||||
hm.put(FieldImageKey, "2025");
|
||||
hm.put(MatchNumKey, 0);
|
||||
hm.put(AllyPosKey, "red-1");
|
||||
hm.put(DataModeKey, 0);
|
||||
@@ -65,6 +68,7 @@ public class SettingsManager {
|
||||
getEditor().putBoolean(WifiModeKey, (boolean) defaults.get( WifiModeKey )).apply();
|
||||
|
||||
getEditor() .putInt(YearNumKey, (int) defaults.get( YearNumKey )).apply();
|
||||
getEditor() .putString(FieldImageKey, (String) defaults.get( FieldImageKey )).apply();
|
||||
getEditor() .putInt(MatchNumKey, (int) defaults.get( MatchNumKey )).apply();
|
||||
getEditor() .putString(AllyPosKey, (String) defaults.get( AllyPosKey )).apply();
|
||||
getEditor() .putInt(DataModeKey, (int) defaults.get( DataModeKey )).apply();
|
||||
@@ -80,8 +84,6 @@ public class SettingsManager {
|
||||
getEditor().putBoolean(CustomEventsKey, (boolean) defaults.get( CustomEventsKey )).apply();
|
||||
}
|
||||
|
||||
// IDK why I decided to format these functions like this. It looks cool though.
|
||||
|
||||
public static int getTeamNum(){return prefs.getInt( TeamNumKey, (int) defaults.get(TeamNumKey));}
|
||||
public static void setTeamNum(int num){ getEditor().putInt( TeamNumKey,num).apply();}
|
||||
|
||||
@@ -97,6 +99,9 @@ public class SettingsManager {
|
||||
public static int getYearNum(){return prefs.getInt( YearNumKey, (int) defaults.get(YearNumKey));}
|
||||
public static void setYearNum(int num){ getEditor().putInt( YearNumKey,num).apply();}
|
||||
|
||||
public static String getFieldImageIndex(){return prefs.getString( FieldImageKey, (String) defaults.get(FieldImageKey));}
|
||||
public static void setFieldImageIndex(String str){ getEditor().putString( FieldImageKey,str).apply();}
|
||||
|
||||
public static int getMatchNum(){return prefs.getInt( MatchNumKey, (int) defaults.get(MatchNumKey));}
|
||||
public static void setMatchNum(int num){ getEditor().putInt( MatchNumKey,num).apply();}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user