From b41ce1d9c45c11c6a42ccddd93727ec157581b68 Mon Sep 17 00:00:00 2001 From: Tanguy Herbron Date: Tue, 6 Feb 2018 17:47:12 +0100 Subject: [PATCH] Preparing layout inflater instead of dynamic generation --- .../Activities/CurrencyDetailsActivity.java | 2 - .../LayoutManagers/HomeLayoutGenerator.java | 7 +- app/src/main/res/layout/cardview_currency.xml | 151 ++++++++++++++++++ 3 files changed, 152 insertions(+), 8 deletions(-) create mode 100644 app/src/main/res/layout/cardview_currency.xml diff --git a/app/src/main/java/com/nauk/coinfolio/Activities/CurrencyDetailsActivity.java b/app/src/main/java/com/nauk/coinfolio/Activities/CurrencyDetailsActivity.java index dca9c6a..1cede5e 100644 --- a/app/src/main/java/com/nauk/coinfolio/Activities/CurrencyDetailsActivity.java +++ b/app/src/main/java/com/nauk/coinfolio/Activities/CurrencyDetailsActivity.java @@ -77,7 +77,6 @@ public class CurrencyDetailsActivity extends AppCompatActivity { @Override public void onBackPressed() { - Log.d(this.getResources().getString(R.string.debug), "Back pressed"); Intent intent = new Intent(this, HomeActivity.class); intent.putExtra("update", hasBeenModified); intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); @@ -538,7 +537,6 @@ public class CurrencyDetailsActivity extends AppCompatActivity { @Override public void onClick(View view) { databaseManager.deleteTransactionFromId(Integer.parseInt(view.getTag().toString())); - Log.d(CurrencyDetailsActivity.this.getResources().getString(R.string.debug), "Id : " + view.getTag()); drawTransactionList(); hasBeenModified = true; } diff --git a/app/src/main/java/com/nauk/coinfolio/LayoutManagers/HomeLayoutGenerator.java b/app/src/main/java/com/nauk/coinfolio/LayoutManagers/HomeLayoutGenerator.java index 91f5925..628dca1 100644 --- a/app/src/main/java/com/nauk/coinfolio/LayoutManagers/HomeLayoutGenerator.java +++ b/app/src/main/java/com/nauk/coinfolio/LayoutManagers/HomeLayoutGenerator.java @@ -43,7 +43,7 @@ public class HomeLayoutGenerator { this.context = context; } - public CardView getInfoLayout(final Currency currency) + public CardView getInfoLayout(final Currency currency, boolean isExtended) //public CardView getInfoLayout(int index) { CardView mainCard = new CardView(context); @@ -69,10 +69,8 @@ public class HomeLayoutGenerator { mainCard.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - //switchingView(view); view.animate(); Intent intent = new Intent(context.getApplicationContext(), CurrencyDetailsActivity.class); - //intent.putExtra("symbol", currency.getSymbol()); intent.putExtra("currency", currency); context.getApplicationContext().startActivity(intent); } @@ -116,9 +114,6 @@ public class HomeLayoutGenerator { mainCard.setLayoutParams(paramsCard); mainCard.setRadius(8); - //infoLayout.addView(topLayoutGenerator(currencyList.get(index).getName(), currencyList.get(index).getSymbol(), currencyList.get(index).getValue(), currencyList.get(index).getIcon())); - //infoLayout.addView(bottomLayoutGenerator(currencyList.get(index).getSymbol(), currencyList.get(index).getBalance(), currencyList.get(index).getValue() * currencyList.get(index).getBalance(), currencyList.get(index).getDayFluctuationPercentage(), currencyList.get(index).getDayFluctuation())); - infoLayout.addView(topLayoutGenerator(currency.getName(), currency.getSymbol(), currency.getValue(), currency.getIcon())); infoLayout.addView(bottomLayoutGenerator(currency.getSymbol(), currency.getBalance(), currency.getValue() * currency.getBalance(), currency.getDayFluctuationPercentage(), currency.getDayFluctuation())); diff --git a/app/src/main/res/layout/cardview_currency.xml b/app/src/main/res/layout/cardview_currency.xml new file mode 100644 index 0000000..09aee34 --- /dev/null +++ b/app/src/main/res/layout/cardview_currency.xml @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file