1,6 → 1,7 |
package de.pointedears.converter.app; |
|
import java.util.HashMap; |
import java.util.Map.Entry; |
|
import android.app.Activity; |
import android.os.Bundle; |
17,6 → 18,9 |
import android.widget.Button; |
import android.widget.EditText; |
import android.widget.Spinner; |
import android.widget.TableLayout; |
import android.widget.TableRow; |
import android.widget.TextView; |
import de.pointedears.converter.R; |
import de.pointedears.converter.db.CurrenciesDatabase; |
|
66,6 → 70,7 |
/* Set up currency database, and retrieve conversion rates */ |
this.db = new CurrenciesDatabase(this); |
this.conversionRates = this.db.getConversionRates(); |
this.fillTableRates(); |
|
final EditText editValue1 = |
(EditText) this.findViewById(R.id.currencies_edit_value1); |
183,6 → 188,38 |
} |
|
/** |
* Fills the table with currency conversion rates |
*/ |
private void fillTableRates() |
{ |
TableLayout tableRates = |
(TableLayout) this.findViewById(R.id.currencies_table_rates); |
|
for (String key : this.conversionRates.keySet()) |
{ |
for (Entry<String, Double> factorEntry : this.conversionRates.get(key) |
.entrySet()) |
{ |
TableRow row = new TableRow(this); |
|
TextView columnCurrency1 = new TextView(this); |
columnCurrency1.setText(key); |
row.addView(columnCurrency1); |
|
TextView columnCurrency2 = new TextView(this); |
columnCurrency2.setText(factorEntry.getKey()); |
row.addView(columnCurrency2); |
|
TextView columnRate = new TextView(this); |
columnRate.setText(factorEntry.getValue().toString()); |
row.addView(columnRate); |
|
tableRates.addView(row); |
} |
} |
} |
|
/** |
* @param value |
* @return |
*/ |