- Added Clear button to all menu Activities - Added helper package (perhaps for BackgroundThread?)
/trunk/src/de/pointedears/converter/app/CurrenciesActivity.java |
---|
10,9 → 10,11 |
import android.view.MenuInflater; |
import android.view.MenuItem; |
import android.view.View; |
import android.view.View.OnClickListener; |
import android.view.View.OnKeyListener; |
import android.widget.AdapterView; |
import android.widget.AdapterView.OnItemSelectedListener; |
import android.widget.Button; |
import android.widget.EditText; |
import android.widget.Spinner; |
import de.pointedears.converter.R; |
165,6 → 167,19 |
/* no-op */ |
} |
}); |
Button buttonClear = |
(Button) this.findViewById(R.id.currencies_button_clear); |
buttonClear.setOnClickListener(new OnClickListener() { |
@SuppressWarnings("nls") |
@Override |
public void onClick(View v) |
{ |
editValue1.setText(""); |
editValue2.setText(""); |
} |
}); |
} |
/** |
/trunk/src/de/pointedears/converter/app/LengthsActivity.java |
---|
7,9 → 7,11 |
import android.text.Editable; |
import android.view.KeyEvent; |
import android.view.View; |
import android.view.View.OnClickListener; |
import android.view.View.OnKeyListener; |
import android.widget.AdapterView; |
import android.widget.AdapterView.OnItemSelectedListener; |
import android.widget.Button; |
import android.widget.EditText; |
import android.widget.Spinner; |
import de.pointedears.converter.R; |
158,6 → 160,19 |
/* no-op */ |
} |
}); |
Button buttonClear = |
(Button) this.findViewById(R.id.lengths_button_clear); |
buttonClear.setOnClickListener(new OnClickListener() { |
@SuppressWarnings("nls") |
@Override |
public void onClick(View v) |
{ |
editValue1.setText(""); |
editValue2.setText(""); |
} |
}); |
} |
/** |
/trunk/src/de/pointedears/converter/app/TemperaturesActivity.java |
---|
7,9 → 7,11 |
import android.text.Editable; |
import android.view.KeyEvent; |
import android.view.View; |
import android.view.View.OnClickListener; |
import android.view.View.OnKeyListener; |
import android.widget.AdapterView; |
import android.widget.AdapterView.OnItemSelectedListener; |
import android.widget.Button; |
import android.widget.EditText; |
import android.widget.Spinner; |
import android.widget.TextView; |
166,6 → 168,19 |
/* no-op */ |
} |
}); |
Button buttonClear = |
(Button) this.findViewById(R.id.temperatures_button_clear); |
buttonClear.setOnClickListener(new OnClickListener() { |
@SuppressWarnings("nls") |
@Override |
public void onClick(View v) |
{ |
editValue1.setText(""); |
editValue2.setText(""); |
} |
}); |
} |
/** |
/trunk/src/de/pointedears/converter/db/CurrenciesDatabase.java |
---|
27,7 → 27,7 |
private static final String COLUMN_CURRENCY2 = "currency2"; //$NON-NLS-1$ |
private static final String COLUMN_FACTOR = "factor"; //$NON-NLS-1$ |
private static HashMap<String, HashMap<String, Double>> currencyConversions = |
private static HashMap<String, HashMap<String, Double>> conversionRates = |
new HashMap<String, HashMap<String, Double>>(); |
static |
{ |
34,19 → 34,19 |
HashMap<String, Double> conversionFactors = new HashMap<String, Double>(); |
conversionFactors.put(CurrenciesActivity.VALUE_EUR, 0.767842293); |
conversionFactors.put(CurrenciesActivity.VALUE_USD, 1.03413); |
CurrenciesDatabase.currencyConversions.put(CurrenciesActivity.VALUE_CHF, |
CurrenciesDatabase.conversionRates.put(CurrenciesActivity.VALUE_CHF, |
conversionFactors); |
conversionFactors = new HashMap<String, Double>(); |
conversionFactors.put(CurrenciesActivity.VALUE_CHF, 1.30235077); |
conversionFactors.put(CurrenciesActivity.VALUE_USD, 1.3468); |
CurrenciesDatabase.currencyConversions.put(CurrenciesActivity.VALUE_EUR, |
CurrenciesDatabase.conversionRates.put(CurrenciesActivity.VALUE_EUR, |
conversionFactors); |
conversionFactors = new HashMap<String, Double>(); |
conversionFactors.put(CurrenciesActivity.VALUE_CHF, 0.966996412); |
conversionFactors.put(CurrenciesActivity.VALUE_EUR, 0.742500743); |
CurrenciesDatabase.currencyConversions.put(CurrenciesActivity.VALUE_USD, |
CurrenciesDatabase.conversionRates.put(CurrenciesActivity.VALUE_USD, |
conversionFactors); |
} |
private final CurrenciesActivity context; |
111,7 → 111,7 |
@Override |
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) |
{ |
/* NOTE: Should migrate database instead */ |
/* NOTE: We should migrate an existing database instead */ |
db.execSQL("DROP TABLE IF EXISTS " + CurrenciesDatabase.TABLE); |
this.onCreate(db); |
} |
121,7 → 121,7 |
*/ |
public HashMap<String, HashMap<String, Double>> getConversionRates() |
{ |
return CurrenciesDatabase.currencyConversions; |
return CurrenciesDatabase.conversionRates; |
} |
/** |
209,7 → 209,7 |
*/ |
newCurrencyConversions.put(currency1Str, mapForCurrency); |
CurrenciesDatabase.currencyConversions = newCurrencyConversions; |
CurrenciesDatabase.conversionRates = newCurrencyConversions; |
} |
} |
catch (IllegalArgumentException e) |
/trunk/bin/Converter.apk |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/bin/resources.ap_ |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/bin/classes.dex |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/res/values/strings.xml |
---|
9,7 → 9,9 |
<string name="temperatures_off_scale"><sup>*</sup> Theoretical value off the scale</string> |
<string name="activity_currencies">Currencies</string> |
<string name="option_update">Update</string> |
<string name="caption_update">Update</string> |
<string name="option_quit">Quit</string> |
<string name="bar">Quit</string> |
<string name="button_clear">Clear</string> |
</resources> |
/trunk/res/menu/options.xml |
---|
3,7 → 3,7 |
<!-- android:icon="@drawable/ic_new_game" --> |
<item android:id="@+id/item_options_update" |
android:title="@string/option_update" /> |
android:title="@string/caption_update" /> |
<!-- android:icon="@drawable/ic_quit" --> |
/trunk/res/layout/activity_lengths.xml |
---|
4,7 → 4,7 |
android:layout_width="fill_parent"> |
<TableLayout android:id="@+id/TableLayout01" |
android:layout_height="fill_parent" android:layout_width="fill_parent" |
android:layout_height="wrap_content" android:layout_width="fill_parent" |
android:stretchColumns="1,3" android:shrinkColumns="*" |
android:layout_marginTop="10sp"> |
<TableRow android:layout_height="wrap_content"> |
12,8 → 12,7 |
android:inputType="numberDecimal" /> |
<TextView android:layout_column="2" android:text="=" |
android:gravity="center" android:textSize="25sp" /> |
<EditText android:layout_column="3" |
android:id="@+id/edit_value2" |
<EditText android:layout_column="3" android:id="@+id/edit_value2" |
android:inputType="numberDecimal" /> |
</TableRow> |
<TableRow android:layout_height="wrap_content"> |
24,7 → 23,10 |
<Spinner android:layout_column="3" android:id="@+id/spinner_unit2" |
android:drawSelectorOnTop="true" android:entries="@array/length_units_display" |
android:entryValues="@array/length_units_values" /> |
</TableRow> |
</TableLayout> |
<Button android:text="@string/button_clear" android:id="@+id/lengths_button_clear" |
android:layout_height="wrap_content" android:layout_width="100sp" |
android:layout_gravity="center_horizontal" /> |
</LinearLayout> |
/trunk/res/layout/activity_temperatures.xml |
---|
31,4 → 31,7 |
<TextView android:text="@string/temperatures_off_scale" |
android:id="@+id/temperatures_text_off_scale" android:layout_width="wrap_content" |
android:layout_height="wrap_content" android:visibility="invisible" /> |
<Button android:text="@string/button_clear" android:id="@+id/temperatures_button_clear" |
android:layout_height="wrap_content" android:layout_width="100sp" |
android:layout_gravity="center_horizontal"></Button> |
</LinearLayout> |
/trunk/res/layout/activity_currencies.xml |
---|
27,4 → 27,7 |
android:entryValues="@array/currency_units_values" /> |
</TableRow> |
</TableLayout> |
<Button android:text="@string/button_clear" android:id="@+id/currencies_button_clear" |
android:layout_height="wrap_content" android:layout_width="100sp" |
android:layout_gravity="center_horizontal"></Button> |
</LinearLayout> |