Ajout de deux trois détails sur la liste des cartes
This commit is contained in:
@@ -1,51 +1,60 @@
|
||||
package com.iutlaval.myapplication;
|
||||
|
||||
import android.app.SearchableInfo;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.util.Linkify;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.SearchView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.iutlaval.myapplication.Game.Cards.Card;
|
||||
import com.iutlaval.myapplication.Game.Cards.CardRegistery;
|
||||
import com.iutlaval.myapplication.Game.Cards.Mythes.Mythes_Perséphone;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
public class CardListActivity extends AppCompatActivity {
|
||||
|
||||
TextView test;
|
||||
LinearLayout linearLayout;
|
||||
int inf;
|
||||
int sup;
|
||||
ImageView cardPicture;
|
||||
private TextView deck;
|
||||
private LinearLayout linearLayout;
|
||||
private int inf;
|
||||
private int sup;
|
||||
private ImageView cardPicture;
|
||||
private Button buttonHome;
|
||||
private TextView cardName;
|
||||
private int screenHeight;
|
||||
private int screenWidth;
|
||||
private TextView cardStats;
|
||||
private TextView cardLink;
|
||||
|
||||
|
||||
private int screenHeight;
|
||||
private int screenWidth;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_card_list);
|
||||
test = findViewById(R.id.textViewDeck);
|
||||
deck = findViewById(R.id.textViewDeck);
|
||||
linearLayout = findViewById(R.id.linearLayout);
|
||||
|
||||
buttonHome = findViewById(R.id.buttonHome);
|
||||
buttonHome.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
returnHome();
|
||||
}
|
||||
});
|
||||
|
||||
//récupération de la taille de l'écran
|
||||
WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);
|
||||
@@ -59,7 +68,7 @@ public class CardListActivity extends AppCompatActivity {
|
||||
|
||||
String[] mTestArray = getResources().getStringArray(R.array.decks);
|
||||
|
||||
test.setText(mTestArray[deckIndex]);
|
||||
deck.setText("Vous êtes sur le deck : "+mTestArray[deckIndex]);
|
||||
|
||||
switch (deckIndex) {
|
||||
case 0 :
|
||||
@@ -79,8 +88,6 @@ public class CardListActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
public void showDeckCards(int inf, int sup) {
|
||||
|
||||
|
||||
for(int i = inf; i < sup; i++) {
|
||||
try {
|
||||
Class c = CardRegistery.get(i);
|
||||
@@ -88,7 +95,7 @@ public class CardListActivity extends AppCompatActivity {
|
||||
Card card = (Card) con.newInstance(null, null);
|
||||
cardPicture = new ImageView(this);
|
||||
cardPicture.setBackgroundResource(card.getCardPicture());
|
||||
cardPicture.setLayoutParams(new ViewGroup.LayoutParams((int) (screenWidth / 1.2), (int) (screenHeight / 1.4)));
|
||||
cardPicture.setLayoutParams(new ViewGroup.LayoutParams((int) (screenWidth / 1.2), (int) (screenHeight / 1.7)));
|
||||
linearLayout.addView(cardPicture);
|
||||
|
||||
cardName = new TextView(this);
|
||||
@@ -99,15 +106,21 @@ public class CardListActivity extends AppCompatActivity {
|
||||
cardStats.setText("Attaque : "+card.getAttack()+" Vie : "+card.getHealth()+"\n");
|
||||
linearLayout.addView(cardStats);
|
||||
|
||||
|
||||
cardLink = new TextView(this);
|
||||
cardLink.setText("Lien : "+card.getWikipediaLink()+"\n\n\n");
|
||||
Linkify.addLinks(cardLink, Linkify.ALL);
|
||||
linearLayout.addView(cardLink);
|
||||
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void returnHome() {
|
||||
Intent mainActivity = new Intent(this, MainActivity.class);
|
||||
startActivity(mainActivity);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class Mythes_Achille extends Card {
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return null;
|
||||
return "Achille, Roi des Myrmidons";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,10 +5,32 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="405dp"
|
||||
android:layout_height="64dp"
|
||||
android:orientation="vertical"
|
||||
tools:layout_editor_absoluteX="6dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonHome"
|
||||
android:layout_width="177dp"
|
||||
android:layout_height="616dp"
|
||||
android:layout_weight="1"
|
||||
android:text="Retour à l'accueil" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewDeck"
|
||||
style="@style/Widget.AppCompat.TextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="TextView" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView"
|
||||
android:layout_width="304dp"
|
||||
android:layout_height="677dp"
|
||||
android:layout_width="305dp"
|
||||
android:layout_height="632dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.491"
|
||||
@@ -20,14 +42,9 @@
|
||||
android:id="@+id/linearLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" />
|
||||
android:orientation="vertical">
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewDeck"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="TextView"
|
||||
tools:layout_editor_absoluteX="155dp"
|
||||
tools:layout_editor_absoluteY="116dp" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Reference in New Issue
Block a user