Botones en la pantalla de inicio

This commit is contained in:
2026-04-15 09:21:04 +02:00
parent 54fa17e88d
commit 31aac6252d
74 changed files with 225 additions and 170 deletions

3
.gitignore vendored
View File

@@ -36,3 +36,6 @@ google-services.json
# Claude
.claude/
.settings/
skills-lock.json
.agents

View File

@@ -4,6 +4,8 @@ import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
@@ -86,9 +88,9 @@ public class ActivityGame extends AppCompatActivity {
private SoundManager soundManager;
private Handler handler = new Handler();
private TextView tvSequence;
private TextView tvStratagemName;
private TextView tvCounter;
private Button btnUp, btnDown, btnLeft, btnRight;
private ImageButton btnUp, btnDown, btnLeft, btnRight;
private Button btnVolver;
private int[] sequence;
@@ -97,6 +99,7 @@ public class ActivityGame extends AppCompatActivity {
private boolean esperando = false;
private boolean juegoActivo = true;
private String[] ultimosArrows;
private String ultimosArrowsStratagem;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -106,7 +109,7 @@ public class ActivityGame extends AppCompatActivity {
try { soundManager = new SoundManager(this); }
catch (Exception e) { soundManager = null; }
tvSequence = findViewById(R.id.tv_sequence);
tvStratagemName = findViewById(R.id.tv_stratagem_name);
tvCounter = findViewById(R.id.tv_counter);
btnUp = findViewById(R.id.btn_up);
btnDown = findViewById(R.id.btn_down);
@@ -130,16 +133,11 @@ public class ActivityGame extends AppCompatActivity {
playerIndex = 0;
juegoActivo = true;
ultimosArrows = new String[sequence.length];
ultimosArrowsStratagem = NAMES[idx];
StringBuilder sb = new StringBuilder();
for (int i = 0; i < sequence.length; i++) {
int dir = sequence[i];
ultimosArrows[i] = ARROWS[dir];
sb.append(ultimosArrows[i]).append(" ");
}
if (tvSequence != null) {
tvSequence.setText(sb.toString().trim());
tvSequence.setTextColor(Color.parseColor("#FFD700"));
if (tvStratagemName != null) {
tvStratagemName.setText(ultimosArrowsStratagem);
tvStratagemName.setTextColor(Color.parseColor("#FFD700"));
}
handler.removeCallbacksAndMessages(null);
@@ -159,7 +157,7 @@ public class ActivityGame extends AppCompatActivity {
if (dir == sequence[playerIndex]) {
playerIndex++;
if (tvSequence != null) {
if (tvStratagemName != null) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < sequence.length; i++) {
if (i < playerIndex) {
@@ -169,9 +167,9 @@ public class ActivityGame extends AppCompatActivity {
}
}
try {
tvSequence.setText(android.text.Html.fromHtml(sb.toString()));
tvStratagemName.setText(android.text.Html.fromHtml(sb.toString()));
} catch (Exception e) {
tvSequence.setText(sb.toString().replaceAll("<[^>]*>", ""));
tvStratagemName.setText(sb.toString().replaceAll("<[^>]*>", ""));
}
}
@@ -181,9 +179,9 @@ public class ActivityGame extends AppCompatActivity {
}
completadas++;
if (tvCounter != null) tvCounter.setText(String.valueOf(completadas));
if (tvSequence != null) {
tvSequence.setText("OK!");
tvSequence.setTextColor(Color.parseColor("#00FF00"));
if (tvStratagemName != null) {
tvStratagemName.setText("OK!");
tvStratagemName.setTextColor(Color.parseColor("#00FF00"));
}
esperando = false;
handler.postDelayed(this::nuevaRonda, 1200);
@@ -192,9 +190,9 @@ public class ActivityGame extends AppCompatActivity {
if (soundManager != null) {
try { soundManager.playFailure(); } catch (Exception e) {}
}
if (tvSequence != null) {
tvSequence.setText("X");
tvSequence.setTextColor(Color.parseColor("#FF0000"));
if (tvStratagemName != null) {
tvStratagemName.setText("X");
tvStratagemName.setTextColor(Color.parseColor("#FF0000"));
}
juegoActivo = false;
handler.postDelayed(this::nuevaRonda, 1500);

View File

@@ -4,75 +4,80 @@ import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import androidx.appcompat.app.AppCompatActivity;
/**
* Main Activity - Menu principal con tematica Helldivers 2
* Optimizado para Samsung Galaxy S3 (720x1280 xhdpi, landscape)
*/
public class MainActivity extends AppCompatActivity {
private SoundManager soundManager;
private Button btnQrInstagram;
private Button btnMinijuego;
private ImageButton btnUp, btnDown, btnLeft, btnRight;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Inicializar SoundManager
soundManager = new SoundManager(this);
// Referencias UI
btnQrInstagram = findViewById(R.id.btn_qr_instagram);
btnMinijuego = findViewById(R.id.btn_minijuego);
if (btnQrInstagram == null || btnMinijuego == null) {
throw new RuntimeException("Button not found in layout");
try {
soundManager = new SoundManager(this);
} catch (Exception e) {
soundManager = null;
}
// Configurar listeners
btnQrInstagram.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
soundManager.playButtonClick();
Intent intent = new Intent(MainActivity.this, ActivityQR.class);
startActivity(intent);
}
});
btnQrInstagram = findViewById(R.id.btn_qr_instagram);
btnMinijuego = findViewById(R.id.btn_minijuego);
btnUp = findViewById(R.id.btn_up);
btnDown = findViewById(R.id.btn_down);
btnLeft = findViewById(R.id.btn_left);
btnRight = findViewById(R.id.btn_right);
btnMinijuego.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
soundManager.playButtonClick();
Intent intent = new Intent(MainActivity.this, ActivityGame.class);
startActivity(intent);
if (btnQrInstagram != null) {
btnQrInstagram.setOnClickListener(v -> {
if (soundManager != null) {
try { soundManager.playButtonClick(); } catch (Exception e) {}
}
startActivity(new Intent(this, ActivityQR.class));
});
}
if (btnMinijuego != null) {
btnMinijuego.setOnClickListener(v -> {
if (soundManager != null) {
try { soundManager.playButtonClick(); } catch (Exception e) {}
}
startActivity(new Intent(this, ActivityGame.class));
});
}
View.OnClickListener arrowSoundListener = v -> {
if (soundManager != null) {
try { soundManager.playButtonClick(); } catch (Exception e) {}
}
});
};
if (btnUp != null) btnUp.setOnClickListener(arrowSoundListener);
if (btnDown != null) btnDown.setOnClickListener(arrowSoundListener);
if (btnLeft != null) btnLeft.setOnClickListener(arrowSoundListener);
if (btnRight != null) btnRight.setOnClickListener(arrowSoundListener);
}
@Override
protected void onResume() {
super.onResume();
if (soundManager != null) {
soundManager.resume();
}
if (soundManager != null) soundManager.resume();
}
@Override
protected void onPause() {
super.onPause();
if (soundManager != null) {
soundManager.pause();
}
if (soundManager != null) soundManager.pause();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (soundManager != null) {
soundManager.release();
}
if (soundManager != null) soundManager.release();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -17,40 +17,48 @@
android:textStyle="bold"
android:textColor="#00FF00" />
<!-- Secuencia - arriba -->
<TextView
android:id="@+id/tv_counter_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@id/tv_counter"
android:layout_marginTop="5dp"
android:layout_marginEnd="26dp"
android:layout_marginEnd="8dp"
android:layout_toStartOf="@id/tv_counter"
android:text="ESTRATAGEMAS: "
android:textColor="#00FF00"
android:textSize="16sp" />
<!-- Nombre de la estratagema -->
<TextView
android:id="@+id/tv_sequence"
android:id="@+id/tv_stratagem_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
android:layout_marginTop="8dp"
android:text=""
android:textSize="20sp"
android:textStyle="bold"
android:textColor="#FFD700" />
<!-- Secuencia displayed as images -->
<LinearLayout
android:id="@+id/sequence_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_above="@id/buttons_grid"
android:layout_marginBottom="8dp"
android:text=""
android:textSize="36sp"
android:textStyle="bold"
android:textColor="#FFD700" />
android:orientation="horizontal"
android:gravity="center" />
<!-- Botones - mas separadas -->
<!-- Grid de Flechas - Centro -->
<GridLayout
android:id="@+id/buttons_grid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="48dp"
android:layout_centerInParent="true"
android:rowCount="3"
android:columnCount="3"
android:padding="16dp">
@@ -61,16 +69,16 @@
android:layout_row="0"
android:layout_column="0" />
<Button
<ImageButton
android:id="@+id/btn_up"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="0"
android:layout_column="1"
android:background="@drawable/btn_direction"
android:text="↑"
android:textColor="#FFD700"
android:textSize="36sp"
android:src="@drawable/stepforward"
android:scaleType="centerInside"
android:background="@android:color/transparent"
android:contentDescription="Up"
android:layout_margin="6dp" />
<Space
@@ -79,57 +87,60 @@
android:layout_row="0"
android:layout_column="2" />
<Button
<ImageButton
android:id="@+id/btn_left"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="1"
android:layout_column="0"
android:background="@drawable/btn_direction"
android:text="←"
android:textColor="#FFD700"
android:textSize="36sp"
android:src="@drawable/stepforward"
android:scaleType="centerInside"
android:rotation="-90"
android:background="@android:color/transparent"
android:contentDescription="Left"
android:layout_margin="6dp" />
<Button
<ImageButton
android:id="@+id/btn_down"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="1"
android:layout_column="1"
android:background="@drawable/btn_direction"
android:text="↓"
android:textColor="#FFD700"
android:textSize="36sp"
android:src="@drawable/stepforward"
android:scaleType="centerInside"
android:rotation="180"
android:background="@android:color/transparent"
android:contentDescription="Down"
android:layout_margin="6dp" />
<Button
<ImageButton
android:id="@+id/btn_right"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="1"
android:layout_column="2"
android:background="@drawable/btn_direction"
android:text="→"
android:textColor="#FFD700"
android:textSize="36sp"
android:src="@drawable/stepforward"
android:scaleType="centerInside"
android:rotation="90"
android:background="@android:color/transparent"
android:contentDescription="Right"
android:layout_margin="6dp" />
<Space
android:layout_width="80dp"
android:layout_height="10dp"
android:layout_height="80dp"
android:layout_row="2"
android:layout_column="0" />
<Space
android:layout_width="80dp"
android:layout_height="10dp"
android:layout_height="80dp"
android:layout_row="2"
android:layout_column="1" />
<Space
android:layout_width="80dp"
android:layout_height="10dp"
android:layout_height="80dp"
android:layout_row="2"
android:layout_column="2" />

View File

@@ -1,87 +1,125 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/bg_helldivers_gradient"
android:gravity="center_horizontal"
android:padding="16dp">
android:background="@drawable/bg_helldivers_gradient">
<!-- Logo Helldivers 2 - Area superior -->
<TextView
android:id="@+id/logo_helldivers"
<!-- Logo Super Tierra - Arriba centro -->
<ImageView
android:id="@+id/logo_super_tierra"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
android:layout_marginTop="16dp"
android:layout_marginBottom="24dp"
android:text="HELLDIVERS"
android:textSize="36sp"
android:textStyle="bold"
android:textColor="#FFD700"
android:fontFamily="monospace"
android:shadowColor="#FF6B00"
android:shadowDx="2"
android:shadowDy="2"
android:shadowRadius="4" />
android:src="@drawable/hd_logo"
android:contentDescription="Super Tierra"
android:adjustViewBounds="true"
android:maxWidth="300dp"
android:tint="#FFD700" />
<!-- Contenedor principal de botones -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:gravity="center"
android:paddingHorizontal="48dp">
<!-- Boton Estratagemas - Izquierda debajo del logo -->
<!-- Boton QR Instagram -->
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_qr_instagram"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginEnd="32dp"
android:minHeight="72dp"
android:text="@string/btn_qr_instagram"
android:textColor="@color/helldivers_yellow"
android:textSize="18sp"
android:textAllCaps="true"
android:fontFamily="sans-serif-medium"
android:background="@drawable/btn_helldivers_primary"
android:drawableTop="@drawable/ic_qr_code"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:gravity="center" />
<!-- Boton Minijuego -->
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_minijuego"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="32dp"
android:minHeight="72dp"
android:text="@string/btn_minijuego"
android:textColor="@color/helldivers_yellow"
android:textSize="18sp"
android:textAllCaps="true"
android:fontFamily="sans-serif-medium"
android:background="@drawable/btn_helldivers_primary"
android:drawableTop="@drawable/ic_gamepad"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:gravity="center" />
</LinearLayout>
<!-- Footer con version -->
<TextView
<!-- Boton QR Instagram - Derecha debajo del logo -->
<Button
android:id="@+id/btn_minijuego"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:text="@string/app_version"
android:textColor="@color/helldivers_gray"
android:textSize="12sp"
android:fontFamily="sans-serif-condensed" />
android:layout_below="@id/logo_super_tierra"
android:layout_alignParentStart="true"
android:layout_marginStart="1dp"
android:layout_marginTop="-46dp"
android:background="@drawable/btn_helldivers_primary"
android:paddingHorizontal="20dp"
android:paddingVertical="12dp"
android:text="ESTRATAGEMAS"
android:textAllCaps="true"
android:textColor="#FFD700"
android:textSize="16sp" />
</LinearLayout>
<!-- Grid de Flechas - Centro -->
<Button
android:id="@+id/btn_qr_instagram"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/logo_super_tierra"
android:layout_alignParentEnd="true"
android:layout_marginTop="-43dp"
android:layout_marginEnd="2dp"
android:background="@drawable/btn_helldivers_primary"
android:paddingHorizontal="20dp"
android:paddingVertical="12dp"
android:text="@string/btn_qr_instagram"
android:textAllCaps="true"
android:textColor="#FFD700"
android:textSize="14sp" />
<GridLayout
android:id="@+id/buttons_grid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:rowCount="3"
android:columnCount="3"
android:padding="16dp">
<Space android:layout_width="100dp" android:layout_height="100dp" android:layout_row="0" android:layout_column="0" />
<ImageButton
android:id="@+id/btn_up"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_row="0"
android:layout_column="1"
android:background="@android:color/transparent"
android:contentDescription="Up"
android:scaleType="centerInside"
android:src="@drawable/stepforward" />
<Space android:layout_width="100dp" android:layout_height="100dp" android:layout_row="0" android:layout_column="2" />
<ImageButton
android:id="@+id/btn_left"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_row="1"
android:layout_column="0"
android:background="@android:color/transparent"
android:contentDescription="Left"
android:rotation="-90"
android:scaleType="centerInside"
android:src="@drawable/stepforward" />
<ImageButton
android:id="@+id/btn_down"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_row="1"
android:layout_column="1"
android:background="@android:color/transparent"
android:contentDescription="Down"
android:rotation="180"
android:scaleType="centerInside"
android:src="@drawable/stepforward" />
<ImageButton
android:id="@+id/btn_right"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_row="1"
android:layout_column="2"
android:background="@android:color/transparent"
android:contentDescription="Right"
android:rotation="90"
android:scaleType="centerInside"
android:src="@drawable/stepforward" />
<Space android:layout_width="100dp" android:layout_height="10dp" android:layout_row="2" android:layout_column="0" />
<Space android:layout_width="100dp" android:layout_height="10dp" android:layout_row="2" android:layout_column="1" />
<Space android:layout_width="100dp" android:layout_height="10dp" android:layout_row="2" android:layout_column="2" />
</GridLayout>
<!-- Footer version -->
</RelativeLayout>