Error catching spinner to catch crashes when rotating spinners in control sets (still leaks windows)

pull/14/head
Sam Bosley 12 years ago
parent 14c36867ed
commit 6e3f0d7765

@ -12,7 +12,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Spinner
<com.todoroo.astrid.ui.ErrorCatchingSpinner
android:id="@+id/calendars"
android:layout_width="0dip"
android:layout_height="0dip"/>

@ -4,7 +4,7 @@
android:orientation="vertical"
android:layout_width="0dip"
android:layout_height="0dip">
<Spinner
<com.todoroo.astrid.ui.ErrorCatchingSpinner
android:id="@+id/hideUntil"
android:layout_width="0dip"
android:layout_height="0dip" />

@ -51,7 +51,7 @@
android:layout_marginLeft="5dip"
android:button="@drawable/btn_check_small"
android:text="@string/TEA_reminder_randomly" />
<Spinner
<com.todoroo.astrid.ui.ErrorCatchingSpinner
android:id="@+id/reminder_random_interval"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
@ -61,7 +61,7 @@
android:layout_height="wrap_content"
android:text="@string/TEA_reminder_alarm_label"
style="@style/TextAppearance.GEN_EditLabel.DLG_EditLabel" />
<Spinner
<com.todoroo.astrid.ui.ErrorCatchingSpinner
android:id="@+id/reminder_alarm"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />

@ -34,7 +34,7 @@
</LinearLayout>
<Spinner android:id="@+id/repeatType"
<com.todoroo.astrid.ui.ErrorCatchingSpinner android:id="@+id/repeatType"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:entries="@array/repeat_type"/>

@ -0,0 +1,22 @@
package com.todoroo.astrid.ui;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.Spinner;
public class ErrorCatchingSpinner extends Spinner {
public ErrorCatchingSpinner(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void onDetachedFromWindow() {
try {
super.onDetachedFromWindow();
} catch (IllegalArgumentException e) {
// Bad times
}
}
}
Loading…
Cancel
Save