mirror of
https://github.com/Team4388/RidgeScout.git
synced 2026-06-08 16:28:00 -06:00
Start work on settings
This commit is contained in:
@@ -58,6 +58,7 @@ dependencies {
|
||||
implementation("androidx.camera:camera-lifecycle:1.3.2")
|
||||
implementation("androidx.camera:camera-view:${camerax_version}")
|
||||
|
||||
|
||||
implementation("com.journeyapps:zxing-android-embedded:4.3.0")
|
||||
|
||||
implementation("com.github.skydoves:powerspinner:1.2.7")
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import java.nio.BufferOverflowException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.zip.DataFormatException;
|
||||
import java.util.zip.Deflater;
|
||||
import java.util.zip.Inflater;
|
||||
@@ -185,9 +186,10 @@ public final class fileEditor {
|
||||
if(files == null){return outFiles;}
|
||||
for (File file : files) {
|
||||
if(!file.isDirectory() && file.getName().endsWith(".eventdata")) {
|
||||
outFiles.add(file.getName());
|
||||
outFiles.add(file.getName().substring(0,file.getName().length()-10));
|
||||
}
|
||||
}
|
||||
Collections.sort(outFiles);
|
||||
return outFiles;
|
||||
}
|
||||
|
||||
|
||||
+28
-1
@@ -5,14 +5,23 @@ import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.astatin3.scoutingapp2025.databinding.FragmentSettingsBinding;
|
||||
import com.astatin3.scoutingapp2025.fileEditor;
|
||||
import com.skydoves.powerspinner.IconSpinnerAdapter;
|
||||
import com.skydoves.powerspinner.IconSpinnerItem;
|
||||
import com.skydoves.powerspinner.PowerSpinnerView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class Settings extends Fragment {
|
||||
public class settingsFragment extends Fragment {
|
||||
private FragmentSettingsBinding binding;
|
||||
private android.widget.ScrollView ScrollArea;
|
||||
private android.widget.TableLayout Table;
|
||||
@@ -26,6 +35,10 @@ public class Settings extends Fragment {
|
||||
alert.create().show();
|
||||
}
|
||||
|
||||
private void setDropdownItems(Spinner dropdown, String[] items){
|
||||
ArrayAdapter<String> adapter = new ArrayAdapter<>(requireActivity(), android.R.layout.simple_spinner_item, items);
|
||||
dropdown.setAdapter(adapter);
|
||||
}
|
||||
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
ViewGroup container, Bundle savedInstanceState) {
|
||||
@@ -33,6 +46,20 @@ public class Settings extends Fragment {
|
||||
binding = FragmentSettingsBinding.inflate(inflater, container, false);
|
||||
View root = binding.getRoot();
|
||||
|
||||
PowerSpinnerView spinnerView = binding.eventDropdown;
|
||||
|
||||
List<IconSpinnerItem> iconSpinnerItems = new ArrayList<>();
|
||||
|
||||
for(String name : fileEditor.getEventList()){
|
||||
iconSpinnerItems.add(new IconSpinnerItem(name));
|
||||
}
|
||||
|
||||
IconSpinnerAdapter iconSpinnerAdapter = new IconSpinnerAdapter(spinnerView);
|
||||
spinnerView.setSpinnerAdapter(iconSpinnerAdapter);
|
||||
spinnerView.setItems(iconSpinnerItems);
|
||||
spinnerView.selectItemByIndex(0);
|
||||
spinnerView.setLifecycleOwner(this);
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ public class dataFragment extends Fragment {
|
||||
binding = FragmentDataBinding.inflate(inflater, container, false);
|
||||
View root = binding.getRoot();
|
||||
|
||||
|
||||
return root;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
z1package com.astatin3.scoutingapp2025.ui.scouting;
|
||||
package com.astatin3.scoutingapp2025.ui.scouting;
|
||||
|
||||
|
||||
import android.os.Bundle;
|
||||
@@ -20,20 +20,12 @@ public class scoutingFragment extends Fragment {
|
||||
|
||||
private FragmentScoutingBinding binding;
|
||||
|
||||
private void setDropdownItems(Spinner dropdown, String[] items){
|
||||
ArrayAdapter<String> adapter = new ArrayAdapter<>(requireActivity(), android.R.layout.simple_spinner_item, items);
|
||||
dropdown.setAdapter(adapter);
|
||||
}
|
||||
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
|
||||
binding = FragmentScoutingBinding.inflate(inflater, container, false);
|
||||
View root = binding.getRoot();
|
||||
|
||||
Spinner dropdown = binding.eventDropdown;
|
||||
|
||||
setDropdownItems(dropdown, fileEditor.getEventList().toArray(new String[0]));
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -9,12 +9,4 @@
|
||||
android:focusable="false"
|
||||
android:focusableInTouchMode="false"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/eventDropdown"
|
||||
android:layout_width="409dp"
|
||||
android:layout_height="wrap_content"
|
||||
tools:layout_editor_absoluteX="1dp"
|
||||
tools:layout_editor_absoluteY="32dp" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.Settings.Settings">
|
||||
tools:context=".ui.Settings.settingsFragment">
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/ScrollArea"
|
||||
@@ -12,6 +12,7 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="57dp"
|
||||
android:fillViewport="true"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
@@ -22,10 +23,88 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TableLayout
|
||||
android:id="@+id/matchTable"
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkBox"
|
||||
android:layout_width="412dp"
|
||||
android:layout_height="79dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="Wifi Mode"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/eventDropdown" />
|
||||
|
||||
<com.skydoves.powerspinner.PowerSpinnerView
|
||||
android:id="@+id/eventDropdown"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/black_2"
|
||||
android:gravity="center"
|
||||
android:hint="Question 1"
|
||||
android:padding="10dp"
|
||||
android:textColor="@color/main_500"
|
||||
android:textColorHint="@color/teal_700"
|
||||
android:textSize="14.5sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView1"
|
||||
app:spinner_arrow_gravity="end"
|
||||
app:spinner_arrow_padding="8dp"
|
||||
app:spinner_divider_color="@color/teal_200"
|
||||
app:spinner_divider_show="true"
|
||||
app:spinner_divider_size="0.4dp"
|
||||
app:spinner_item_height="46dp"
|
||||
app:spinner_popup_background="@color/black_2"
|
||||
app:spinner_popup_elevation="14dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editTextText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:inputType="text"
|
||||
android:text="Username"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="107dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="152dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="152dp"
|
||||
android:text="Event Code"
|
||||
android:textAlignment="center"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/editTextText" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="66dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="172dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="173dp"
|
||||
android:text="Name"
|
||||
android:textAlignment="center"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
<fragment
|
||||
android:id="@+id/navigation_settings"
|
||||
android:name="com.astatin3.scoutingapp2025.ui.Settings.Settings"
|
||||
android:name="com.astatin3.scoutingapp2025.ui.Settings.settingsFragment"
|
||||
android:label="@string/title_settings"
|
||||
tools:layout="@layout/fragment_settings" >
|
||||
</fragment>
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.ScoutingApp2025" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_200</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
<item name="colorPrimary">@color/main_200</item>
|
||||
<item name="colorPrimaryVariant">@color/main_700</item>
|
||||
<item name="colorOnPrimary">@color/black</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/teal_200</item>
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="purple_200">#FFBB86FC</color>
|
||||
<color name="purple_500">#FF6200EE</color>
|
||||
<color name="purple_700">#FF3700B3</color>
|
||||
<color name="main_200">#FFBBFC86</color>
|
||||
<color name="main_500">#FF62EE00</color>
|
||||
<color name="main_700">#FF37B300</color>
|
||||
<color name="teal_200">#FF03DAC5</color>
|
||||
<color name="teal_700">#FF018786</color>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
<color name="black_2">#FF252025</color>
|
||||
</resources>
|
||||
@@ -2,8 +2,8 @@
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.ScoutingApp2025" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_500</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
<item name="colorPrimary">@color/main_500</item>
|
||||
<item name="colorPrimaryVariant">@color/main_700</item>
|
||||
<item name="colorOnPrimary">@color/white</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/teal_200</item>
|
||||
|
||||
Reference in New Issue
Block a user