diff --git a/Generator/app/src/main/java/com/example/generator/ColorActivity.java b/Generator/app/src/main/java/com/example/generator/ColorActivity.java index 18b5846..5c8106a 100644 --- a/Generator/app/src/main/java/com/example/generator/ColorActivity.java +++ b/Generator/app/src/main/java/com/example/generator/ColorActivity.java @@ -69,41 +69,41 @@ public class ColorActivity extends AppCompatActivity { int mainColorRes = 0; int bgTintRes = 0; - String hexColor = ""; + String Color = ""; switch (selectedItem) { case "Primary Orange": - hexColor = "#FF5722"; + Color = "Orange"; mainColorRes = R.color.orangeMain; bgTintRes = R.color.orangeMain_bg; break; case "Primary Green": - hexColor = "#0EE906"; + Color = "Green"; mainColorRes = R.color.greenMain; bgTintRes = R.color.greenMain_bg; break; case "Primary Blue": - hexColor = "#205CDF"; + Color = "Blue"; mainColorRes = R.color.blueMain; bgTintRes = R.color.blueMain_bg; break; case "Primary Pink": - hexColor = "#F200DD"; + Color = "Pink"; mainColorRes = R.color.pinkMain; bgTintRes = R.color.pinkMain_bg; break; case "Primary Purple": - hexColor = "#A30096"; + Color = "Purple"; mainColorRes = R.color.purpleMain; bgTintRes = R.color.purpleMain_bg; break; case "Primary Red": - hexColor = "#DF2020"; + Color = "Red"; mainColorRes = R.color.redMain; bgTintRes = R.color.redMain_bg; break; case "Primary Yellow": - hexColor = "#FFEB3B"; + Color = "Yellow"; mainColorRes = R.color.yellowMain; bgTintRes = R.color.yellowMain_bg; break; @@ -114,7 +114,7 @@ public class ColorActivity extends AppCompatActivity { ColorStateList bgTintStateList = ContextCompat.getColorStateList(ColorActivity.this, bgTintRes); int mainColorInt = ContextCompat.getColor(ColorActivity.this, mainColorRes); - MakeStartingActivity.Data.setColorP(hexColor); + MakeStartingActivity.Data.setColorP(Color); spinnerP.setBackgroundColor(mainColorInt); radioButton.setButtonTintList(mainColorStateList); @@ -127,6 +127,9 @@ public class ColorActivity extends AppCompatActivity { AutoExample2.setBackgroundTintList(bgTintStateList); NavExample2.setBackgroundColor(mainColorInt); NavExample1.setBackgroundColor(mainColorInt); + + backButton.setBackgroundColor(mainColorInt); + nextButton.setBackgroundColor(mainColorInt); } } @@ -141,41 +144,41 @@ public class ColorActivity extends AppCompatActivity { int mainColorRes = 0; int bgTintRes = 0; - String hexColor = ""; + String Color = ""; switch (selectedItem) { case "Secondary Orange": - hexColor = "#FF5722"; + Color = "Orange"; mainColorRes = R.color.orangeMain; bgTintRes = R.color.orangeMain_bg; break; case "Secondary Green": - hexColor = "#0EE906"; + Color = "Green"; mainColorRes = R.color.greenMain; bgTintRes = R.color.greenMain_bg; break; case "Secondary Blue": - hexColor = "#205CDF"; + Color = "Blue"; mainColorRes = R.color.blueMain; bgTintRes = R.color.blueMain_bg; break; case "Secondary Pink": - hexColor = "#F200DD"; + Color = "Pink"; mainColorRes = R.color.pinkMain; bgTintRes = R.color.pinkMain_bg; break; case "Secondary Purple": - hexColor = "#A30096"; + Color = "Purple"; mainColorRes = R.color.purpleMain; bgTintRes = R.color.purpleMain_bg; break; case "Secondary Red": - hexColor = "#DF2020"; + Color = "Red"; mainColorRes = R.color.redMain; bgTintRes = R.color.redMain_bg; break; case "Secondary Yellow": - hexColor = "#FFEB3B"; + Color = "Yellow"; mainColorRes = R.color.yellowMain; bgTintRes = R.color.yellowMain_bg; break; @@ -186,7 +189,7 @@ public class ColorActivity extends AppCompatActivity { ColorStateList bgTintStateList = ContextCompat.getColorStateList(ColorActivity.this, bgTintRes); int mainColorInt = ContextCompat.getColor(ColorActivity.this, mainColorRes); - MakeStartingActivity.Data.setColorS(hexColor); + MakeStartingActivity.Data.setColorS(Color); spinnerS.setBackgroundColor(mainColorInt); diff --git a/Generator/app/src/main/java/com/example/generator/MakeStartingActivity.java b/Generator/app/src/main/java/com/example/generator/MakeStartingActivity.java index 9845992..4d79b48 100644 --- a/Generator/app/src/main/java/com/example/generator/MakeStartingActivity.java +++ b/Generator/app/src/main/java/com/example/generator/MakeStartingActivity.java @@ -1,6 +1,7 @@ package com.example.generator; import android.content.Intent; +import android.content.res.ColorStateList; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; @@ -17,6 +18,7 @@ import androidx.activity.result.ActivityResultLauncher; import androidx.activity.result.PickVisualMediaRequest; import androidx.activity.result.contract.ActivityResultContracts; import androidx.appcompat.app.AppCompatActivity; +import androidx.core.content.ContextCompat; import androidx.core.graphics.Insets; import androidx.core.view.ViewCompat; import androidx.core.view.WindowInsetsCompat; @@ -29,6 +31,13 @@ public class MakeStartingActivity extends AppCompatActivity { public static Data Data = new Data(); private ImageView imageView; private int numPos = -1; + + private int mainColorResP = 0; + private int bgTintResP = 0; + private String ColorP = ""; + private int mainColorResS = 0; + private int bgTintResS = 0; + private String ColorS = ""; private EditText numPosEdit; private String Base64img = ""; private final ActivityResultLauncher pickMedia = @@ -56,6 +65,81 @@ public class MakeStartingActivity extends AppCompatActivity { }); + switch (Data.getColorS()) { + case "Orange": + ColorS = "Orange"; + mainColorResS = R.color.orangeMain; + bgTintResS = R.color.orangeMain_bg; + break; + case "Green": + ColorS = "Green"; + mainColorResS = R.color.greenMain; + bgTintResS = R.color.greenMain_bg; + break; + case "Blue": + ColorS = "Blue"; + mainColorResS = R.color.blueMain; + bgTintResS = R.color.blueMain_bg; + break; + case "Pink": + ColorS = "Pink"; + mainColorResS = R.color.pinkMain; + bgTintResS = R.color.pinkMain_bg; + break; + case "Purple": + ColorS = "Purple"; + mainColorResS = R.color.purpleMain; + bgTintResS = R.color.purpleMain_bg; + break; + case "Red": + ColorS = "Red"; + mainColorResS = R.color.redMain; + bgTintResS = R.color.redMain_bg; + break; + case "Yellow": + ColorS = "Yellow"; + mainColorResS = R.color.yellowMain; + bgTintResS = R.color.yellowMain_bg; + break; + } + + switch (Data.getColorP()) { + case "Orange": + ColorP = "Orange"; + mainColorResP = R.color.orangeMain; + bgTintResP = R.color.orangeMain_bg; + break; + case "Green": + ColorP = "Green"; + mainColorResP = R.color.greenMain; + bgTintResP = R.color.greenMain_bg; + break; + case "Blue": + ColorP = "Blue"; + mainColorResP = R.color.blueMain; + bgTintResP = R.color.blueMain_bg; + break; + case "Pink": + ColorP = "Pink"; + mainColorResP = R.color.pinkMain; + bgTintResP = R.color.pinkMain_bg; + break; + case "Purple": + ColorP = "Purple"; + mainColorResP = R.color.purpleMain; + bgTintResP = R.color.purpleMain_bg; + break; + case "Red": + ColorP = "Red"; + mainColorResP = R.color.redMain; + bgTintResP = R.color.redMain_bg; + break; + case "Yellow": + ColorP = "Yellow"; + mainColorResP = R.color.yellowMain; + bgTintResP = R.color.yellowMain_bg; + break; + } imageView = findViewById(R.id.imageView); Button nextButton = (Button) findViewById(R.id.button_next); @@ -63,6 +147,21 @@ public class MakeStartingActivity extends AppCompatActivity { Button chooseButton = (Button) findViewById(R.id.button_image); numPosEdit = findViewById(R.id.numPos); + if (mainColorResP != 0) { + // 1. Convert the Resource ID (R.color...) into the actual ARGB color integer + int actualColor = ContextCompat.getColor(this, mainColorResP); + + // 2. Turn that color into a ColorStateList + ColorStateList tintList = ColorStateList.valueOf(actualColor); + + // 3. Apply ONLY the tint so you keep your rounded button styling + ViewCompat.setBackgroundTintList(nextButton, tintList); + ViewCompat.setBackgroundTintList(backButton, tintList); + ViewCompat.setBackgroundTintList(chooseButton, tintList); + } + + + backButton.setOnClickListener((v) -> { Intent intent = new Intent(this, MainActivity.class); startActivity(intent); diff --git a/Generator/app/src/main/java/com/example/generator/StartingPreview.java b/Generator/app/src/main/java/com/example/generator/StartingPreview.java index 6b33c7f..5f78a6a 100644 --- a/Generator/app/src/main/java/com/example/generator/StartingPreview.java +++ b/Generator/app/src/main/java/com/example/generator/StartingPreview.java @@ -9,6 +9,7 @@ import android.util.Base64; import android.util.Log; import android.view.View; import android.widget.Button; +import android.widget.EditText; import android.widget.ImageView; import android.widget.RadioButton; import android.widget.RadioGroup; @@ -22,6 +23,14 @@ import androidx.core.view.WindowInsetsCompat; public class StartingPreview extends AppCompatActivity { + private int mainColorResP = 0; + private int bgTintResP = 0; + private String ColorP = ""; + private int mainColorResS = 0; + private int bgTintResS = 0; + private String ColorS = ""; + private EditText numPosEdit; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -33,6 +42,84 @@ public class StartingPreview extends AppCompatActivity { return insets; }); + + + switch (MakeStartingActivity.Data.getColorS()) { + case "Orange": + ColorS = "Orange"; + mainColorResS = R.color.orangeMain; + bgTintResS = R.color.orangeMain_bg; + break; + case "Green": + ColorS = "Green"; + mainColorResS = R.color.greenMain; + bgTintResS = R.color.greenMain_bg; + break; + case "Blue": + ColorS = "Blue"; + mainColorResS = R.color.blueMain; + bgTintResS = R.color.blueMain_bg; + break; + case "Pink": + ColorS = "Pink"; + mainColorResS = R.color.pinkMain; + bgTintResS = R.color.pinkMain_bg; + break; + case "Purple": + ColorS = "Purple"; + mainColorResS = R.color.purpleMain; + bgTintResS = R.color.purpleMain_bg; + break; + case "Red": + ColorS = "Red"; + mainColorResS = R.color.redMain; + bgTintResS = R.color.redMain_bg; + break; + case "Yellow": + ColorS = "Yellow"; + mainColorResS = R.color.yellowMain; + bgTintResS = R.color.yellowMain_bg; + break; + } + + switch (MakeStartingActivity.Data.getColorP ()) { + case "Orange": + ColorP = "Orange"; + mainColorResP = R.color.orangeMain; + bgTintResP = R.color.orangeMain_bg; + break; + case "Green": + ColorP = "Green"; + mainColorResP = R.color.greenMain; + bgTintResP = R.color.greenMain_bg; + break; + case "Blue": + ColorP = "Blue"; + mainColorResP = R.color.blueMain; + bgTintResP = R.color.blueMain_bg; + break; + case "Pink": + ColorP = "Pink"; + mainColorResP = R.color.pinkMain; + bgTintResP = R.color.pinkMain_bg; + break; + case "Purple": + ColorP = "Purple"; + mainColorResP = R.color.purpleMain; + bgTintResP = R.color.purpleMain_bg; + break; + case "Red": + ColorP = "Red"; + mainColorResP = R.color.redMain; + bgTintResP = R.color.redMain_bg; + break; + case "Yellow": + ColorP = "Yellow"; + mainColorResP = R.color.yellowMain; + bgTintResP = R.color.yellowMain_bg; + break; + } + ImageView imageView2 = findViewById(R.id.imageView2); String imageBase64 = MakeStartingActivity.Data.getBase64(); diff --git a/ScoutingApp/.idea/deploymentTargetSelector.xml b/ScoutingApp/.idea/deploymentTargetSelector.xml new file mode 100644 index 0000000..8cef4b7 --- /dev/null +++ b/ScoutingApp/.idea/deploymentTargetSelector.xml @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file