Added stuff
This commit is contained in:
@@ -15,8 +15,8 @@ public class Data {
|
|||||||
public void setNumPos(int numPos) {
|
public void setNumPos(int numPos) {
|
||||||
this.numPos = Math.max(0, numPos);
|
this.numPos = Math.max(0, numPos);
|
||||||
}
|
}
|
||||||
public String getNumPos() {
|
public int getNumPos() {
|
||||||
return String.valueOf(numPos);
|
return Math.max(0, numPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,21 @@
|
|||||||
package com.example.generator;
|
package com.example.generator;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.res.ColorStateList;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Base64;
|
import android.util.Base64;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.RadioButton;
|
||||||
|
import android.widget.RadioGroup;
|
||||||
|
|
||||||
import androidx.activity.EdgeToEdge;
|
import androidx.activity.EdgeToEdge;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.graphics.Insets;
|
import androidx.core.graphics.Insets;
|
||||||
import androidx.core.view.ViewCompat;
|
import androidx.core.view.ViewCompat;
|
||||||
import androidx.core.view.WindowInsetsCompat;
|
import androidx.core.view.WindowInsetsCompat;
|
||||||
@@ -40,5 +47,41 @@ public class StartingPreview extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RadioGroup radioGroup = findViewById(R.id.radioGroup);
|
||||||
|
int totalPositions;
|
||||||
|
totalPositions = makeActivity.Data.getNumPos();
|
||||||
|
|
||||||
|
int whiteColor = ContextCompat.getColor(this, R.color.white);
|
||||||
|
int mainColor = ContextCompat.getColor(this, R.color.main);
|
||||||
|
ColorStateList buttonTintList = ColorStateList.valueOf(mainColor);
|
||||||
|
RadioGroup.LayoutParams layoutParams = new RadioGroup.LayoutParams(
|
||||||
|
RadioGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
RadioGroup.LayoutParams.WRAP_CONTENT
|
||||||
|
);
|
||||||
|
|
||||||
|
for (int i = 1; i <= totalPositions; i++) {
|
||||||
|
RadioButton radioButton = new RadioButton(this);
|
||||||
|
|
||||||
|
radioButton.setId(View.generateViewId());
|
||||||
|
radioButton.setText("Starting Position " + i);
|
||||||
|
radioButton.setTextSize(20);
|
||||||
|
radioButton.setTextColor(whiteColor);
|
||||||
|
|
||||||
|
radioButton.setButtonTintList(buttonTintList);
|
||||||
|
|
||||||
|
|
||||||
|
radioGroup.addView(radioButton);
|
||||||
|
|
||||||
|
}
|
||||||
|
Button backButton = (Button) findViewById(R.id.backButton);
|
||||||
|
Button nextButton = (Button) findViewById(R.id.buttonNext);
|
||||||
|
backButton.setOnClickListener((v) -> {
|
||||||
|
Intent intent = new Intent(this, makeActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
});
|
||||||
|
nextButton.setOnClickListener((v) -> {
|
||||||
|
Intent intent = new Intent(this, MainActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -79,7 +79,6 @@ public class makeActivity extends AppCompatActivity {
|
|||||||
} else {
|
} else {
|
||||||
Data.setNumPos(numPos);
|
Data.setNumPos(numPos);
|
||||||
Data.setBase64(Base64img);
|
Data.setBase64(Base64img);
|
||||||
Log.d("Pos", Data.getNumPos());
|
|
||||||
Intent intent = new Intent(this, StartingPreview.class);
|
Intent intent = new Intent(this, StartingPreview.class);
|
||||||
intent.putExtra("EXTRA_IMAGE_BASE64", Base64img);
|
intent.putExtra("EXTRA_IMAGE_BASE64", Base64img);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
@@ -107,13 +106,13 @@ public class makeActivity extends AppCompatActivity {
|
|||||||
byte[] imageBytes = outputStream.toByteArray();
|
byte[] imageBytes = outputStream.toByteArray();
|
||||||
|
|
||||||
return Base64.encodeToString(imageBytes, Base64.DEFAULT);
|
return Base64.encodeToString(imageBytes, Base64.DEFAULT);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Toast.makeText(this, "Failed to convert image", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Failed to convert image", Toast.LENGTH_SHORT).show();
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -17,7 +17,6 @@
|
|||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="24sp"
|
android:textSize="24sp"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/button_next"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
@@ -43,49 +42,9 @@
|
|||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/notes">
|
app:layout_constraintTop_toBottomOf="@+id/notes">
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/Rbutton1"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/starting_position_1"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
app:buttonTint="@color/main" />
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/Rbutton2"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/starting_position_2"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
app:buttonTint="@color/main" />
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/Rbutton3"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/starting_position_3"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
app:buttonTint="@color/main" />
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/Rbutton4"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/starting_position_4"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
app:buttonTint="@color/main" />
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/Rbutton5"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/starting_position_5"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
app:buttonTint="@color/main" />
|
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
|
|
||||||
<!-- Empty ImageView: No source asset, but constraints are locked tight -->
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageView2"
|
android:id="@+id/imageView2"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
@@ -115,7 +74,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="0"
|
android:text="0"
|
||||||
android:background="@color/alliance_red"
|
android:background="@color/alliance_blue"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="34sp"
|
android:textSize="34sp"
|
||||||
app:layout_constraintTop_toTopOf="@+id/teamnumber"
|
app:layout_constraintTop_toTopOf="@+id/teamnumber"
|
||||||
|
|||||||
Reference in New Issue
Block a user