Added stuff
This commit is contained in:
@@ -15,8 +15,8 @@ public class Data {
|
||||
public void setNumPos(int numPos) {
|
||||
this.numPos = Math.max(0, numPos);
|
||||
}
|
||||
public String getNumPos() {
|
||||
return String.valueOf(numPos);
|
||||
public int getNumPos() {
|
||||
return Math.max(0, numPos);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,14 +1,21 @@
|
||||
package com.example.generator;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Bundle;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
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;
|
||||
@@ -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 {
|
||||
Data.setNumPos(numPos);
|
||||
Data.setBase64(Base64img);
|
||||
Log.d("Pos", Data.getNumPos());
|
||||
Intent intent = new Intent(this, StartingPreview.class);
|
||||
intent.putExtra("EXTRA_IMAGE_BASE64", Base64img);
|
||||
startActivity(intent);
|
||||
@@ -107,13 +106,13 @@ public class makeActivity extends AppCompatActivity {
|
||||
byte[] imageBytes = outputStream.toByteArray();
|
||||
|
||||
return Base64.encodeToString(imageBytes, Base64.DEFAULT);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Toast.makeText(this, "Failed to convert image", Toast.LENGTH_SHORT).show();
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,7 +17,6 @@
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/button_next"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@@ -43,49 +42,9 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
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>
|
||||
|
||||
<!-- Empty ImageView: No source asset, but constraints are locked tight -->
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView2"
|
||||
android:layout_width="0dp"
|
||||
@@ -115,7 +74,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="0"
|
||||
android:background="@color/alliance_red"
|
||||
android:background="@color/alliance_blue"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="34sp"
|
||||
app:layout_constraintTop_toTopOf="@+id/teamnumber"
|
||||
|
||||
Reference in New Issue
Block a user