fragments
This commit is contained in:
@@ -1,71 +0,0 @@
|
||||
package com.example.lifegrid;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
public class NovaTransacao extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
EdgeToEdge.enable(this);
|
||||
setContentView(R.layout.activity_nova_transacao);
|
||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
// 1. Encontrar os elementos no ecrã
|
||||
Button botaoPrincipal = findViewById(R.id.botaoPrincipal);
|
||||
LinearLayout grupoOpcoes = findViewById(R.id.grupoOpcoes);
|
||||
Button botaoOpcao1 = findViewById(R.id.botaoOpcao1);
|
||||
Button botaoOpcao2 = findViewById(R.id.botaoOpcao2);
|
||||
|
||||
// 2. Lógica para mostrar/esconder as opções
|
||||
botaoPrincipal.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// Se as opções estiverem escondidas, mostra-as. Se estiverem à vista, esconde-as.
|
||||
if (grupoOpcoes.getVisibility() == View.GONE) {
|
||||
grupoOpcoes.setVisibility(View.VISIBLE);
|
||||
botaoPrincipal.setText("Esconder Opções"); // Muda o texto do botão
|
||||
} else {
|
||||
grupoOpcoes.setVisibility(View.GONE);
|
||||
botaoPrincipal.setText("Mostrar Opções");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 3. Lógica para quando o utilizador escolhe uma opção
|
||||
botaoOpcao1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(NovaTransacao.this, "Escolheste a Opção 1", Toast.LENGTH_SHORT).show();
|
||||
// Opcional: esconder a lista depois de escolher
|
||||
grupoOpcoes.setVisibility(View.GONE);
|
||||
botaoPrincipal.setText("Mostrar Opções");
|
||||
}
|
||||
});
|
||||
|
||||
botaoOpcao2.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(NovaTransacao.this, "Escolheste a Opção 2", Toast.LENGTH_SHORT).show();
|
||||
// Opcional: esconder a lista depois de escolher
|
||||
grupoOpcoes.setVisibility(View.GONE);
|
||||
botaoPrincipal.setText("Mostrar Opções");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/botaoPrincipal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Mostrar Opções" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/grupoOpcoes"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
android:layout_marginTop="8dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/botaoOpcao1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Opção 1"
|
||||
style="?android:attr/buttonBarButtonStyle" /> <Button
|
||||
android:id="@+id/botaoOpcao2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Opção 2"
|
||||
style="?android:attr/buttonBarButtonStyle" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -344,17 +344,17 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/ativosCardView">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:id="@+id/alvoImageView"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="57dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView5"
|
||||
app:layout_constraintStart_toEndOf="@+id/graficoImageView"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/alvo" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView2"
|
||||
android:id="@+id/carteiraImageView"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="24dp"
|
||||
@@ -365,19 +365,19 @@
|
||||
app:srcCompat="@drawable/carteira" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView3"
|
||||
android:id="@+id/documentoImageView"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="40dp"
|
||||
android:layout_marginEnd="40dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/imageView4"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView"
|
||||
app:layout_constraintEnd_toStartOf="@+id/definicoesImageView"
|
||||
app:layout_constraintStart_toEndOf="@+id/alvoImageView"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/documento" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView4"
|
||||
android:id="@+id/definicoesImageView"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
@@ -387,23 +387,23 @@
|
||||
app:srcCompat="@drawable/engrenaje" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView5"
|
||||
android:id="@+id/graficoImageView"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="40dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView6"
|
||||
app:layout_constraintStart_toEndOf="@+id/setaImageView"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.578"
|
||||
app:srcCompat="@drawable/grafico" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView6"
|
||||
android:id="@+id/setaImageView"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_marginStart="40dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView2"
|
||||
app:layout_constraintStart_toEndOf="@+id/carteiraImageView"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/diagonalarrowrightup_110941" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
Reference in New Issue
Block a user