diff --git a/astrid/common-src/com/mdimension/jchronic/AstridChronic.java b/astrid/common-src/com/mdimension/jchronic/AstridChronic.java index 7cf5b3251..935999efc 100644 --- a/astrid/common-src/com/mdimension/jchronic/AstridChronic.java +++ b/astrid/common-src/com/mdimension/jchronic/AstridChronic.java @@ -82,21 +82,12 @@ public class AstridChronic { throw new RuntimeException("Failed to scan tokens.", e); } - List scannerClasses = new LinkedList(); - scannerClasses.add(Grabber.class); - scannerClasses.add(Pointer.class); - scannerClasses.add(Scalar.class); - scannerClasses.add(Ordinal.class); - scannerClasses.add(Separator.class); - scannerClasses.add(TimeZone.class); - for (Class scannerClass : scannerClasses) { - try { - tokens = (List) scannerClass.getMethod("scan", List.class, Options.class).invoke(null, tokens, options); - } - catch (Throwable e) { - throw new RuntimeException("Failed to scan tokens.", e); - } - } + tokens = Grabber.scan(tokens, options); + tokens = Pointer.scan(tokens, options); + tokens = Scalar.scan(tokens, options); + tokens = Ordinal.scan(tokens, options); + tokens = Separator.scan(tokens, options); + tokens = TimeZone.scan(tokens, options); List taggedTokens = new LinkedList(); for (Token token : tokens) { diff --git a/astrid/proguard.cfg b/astrid/proguard.cfg index 142e82af5..3ecbb315e 100644 --- a/astrid/proguard.cfg +++ b/astrid/proguard.cfg @@ -9,6 +9,7 @@ -dontobfuscate -keepattributes SourceFile, SourceDir, LineNumberTable, LocalVariableTable, LocalVariableTypeTable -keep, allowshrinking, allowoptimization class com.todoroo.** +-keep class com.mdimension.** # ignore reflection-based access from google libraries -dontwarn com.google.** diff --git a/astrid/src/com/todoroo/astrid/adapter/TaskAdapter.java b/astrid/src/com/todoroo/astrid/adapter/TaskAdapter.java index 99dc0752a..36aa55ead 100644 --- a/astrid/src/com/todoroo/astrid/adapter/TaskAdapter.java +++ b/astrid/src/com/todoroo/astrid/adapter/TaskAdapter.java @@ -1025,7 +1025,12 @@ public class TaskAdapter extends CursorAdapter implements Filterable { R.anim.slide_left_in, R.anim.slide_left_out); } } - activity.unregisterReceiver(this); + + try { + activity.unregisterReceiver(this); + } catch (IllegalArgumentException e) { + // ignore + } } } diff --git a/astrid/src/com/todoroo/astrid/helper/ProgressBarSyncResultCallback.java b/astrid/src/com/todoroo/astrid/helper/ProgressBarSyncResultCallback.java index eda27d80b..b530c8ba8 100644 --- a/astrid/src/com/todoroo/astrid/helper/ProgressBarSyncResultCallback.java +++ b/astrid/src/com/todoroo/astrid/helper/ProgressBarSyncResultCallback.java @@ -12,7 +12,7 @@ import com.todoroo.astrid.service.SyncV2Service.SyncResultCallback; public class ProgressBarSyncResultCallback implements SyncResultCallback { - private final ProgressBar progressBar; + private ProgressBar progressBar; private final Activity activity; private final Runnable onFinished; @@ -23,6 +23,10 @@ public class ProgressBarSyncResultCallback implements SyncResultCallback { this.progressBar = (ProgressBar) activity.findViewById(progressBarId); this.activity = activity; this.onFinished = onFinished; + + if(progressBar == null) + progressBar = new ProgressBar(activity); + progressBar.setProgress(0); progressBar.setMax(0); } @@ -33,14 +37,18 @@ public class ProgressBarSyncResultCallback implements SyncResultCallback { activity.runOnUiThread(new Runnable() { @Override public void run() { - progressBar.setMax(100); - progressBar.setProgress(100); - AlphaAnimation animation = new AlphaAnimation(1, 0); - animation.setFillAfter(true); - animation.setDuration(1000L); - progressBar.startAnimation(animation); + try { + progressBar.setMax(100); + progressBar.setProgress(100); + AlphaAnimation animation = new AlphaAnimation(1, 0); + animation.setFillAfter(true); + animation.setDuration(1000L); + progressBar.startAnimation(animation); - onFinished.run(); + onFinished.run(); + } catch (Exception e) { + // ignore, view could have been destroyed + } } }); new Thread() { @@ -50,7 +58,11 @@ public class ProgressBarSyncResultCallback implements SyncResultCallback { activity.runOnUiThread(new Runnable() { @Override public void run() { - progressBar.setVisibility(View.GONE); + try { + progressBar.setVisibility(View.GONE); + } catch (Exception e) { + // ignore + } } }); } @@ -63,7 +75,11 @@ public class ProgressBarSyncResultCallback implements SyncResultCallback { activity.runOnUiThread(new Runnable() { @Override public void run() { - progressBar.setMax(progressBar.getMax() + incrementBy); + try { + progressBar.setMax(progressBar.getMax() + incrementBy); + } catch (Exception e) { + // ignore + } } }); } @@ -73,7 +89,11 @@ public class ProgressBarSyncResultCallback implements SyncResultCallback { activity.runOnUiThread(new Runnable() { @Override public void run() { - progressBar.incrementProgressBy(incrementBy); + try { + progressBar.incrementProgressBy(incrementBy); + } catch (Exception e) { + // ignore + } } }); } diff --git a/astrid/src/com/todoroo/astrid/ui/EditTitleControlSet.java b/astrid/src/com/todoroo/astrid/ui/EditTitleControlSet.java index ac432664b..006e5e8aa 100644 --- a/astrid/src/com/todoroo/astrid/ui/EditTitleControlSet.java +++ b/astrid/src/com/todoroo/astrid/ui/EditTitleControlSet.java @@ -21,7 +21,8 @@ public class EditTitleControlSet extends EditTextControlSet implements Importanc @Override public void importanceChanged(int i, int color) { - importance.setImageResource(IMPORTANCE_DRAWABLES[i]); + if(importance != null) + importance.setImageResource(IMPORTANCE_DRAWABLES[i]); } } diff --git a/astrid/src/com/todoroo/astrid/welcome/tutorial/ViewPagerAdapter.java b/astrid/src/com/todoroo/astrid/welcome/tutorial/ViewPagerAdapter.java index f10f4a42a..2089ea5ab 100644 --- a/astrid/src/com/todoroo/astrid/welcome/tutorial/ViewPagerAdapter.java +++ b/astrid/src/com/todoroo/astrid/welcome/tutorial/ViewPagerAdapter.java @@ -13,8 +13,9 @@ import android.widget.ImageView; import android.widget.TextView; import com.timsu.astrid.R; +import com.viewpagerindicator.TitleProvider; -public class ViewPagerAdapter extends PagerAdapter +public class ViewPagerAdapter extends PagerAdapter implements TitleProvider { private static int[] images = new int[] { @@ -120,4 +121,11 @@ public class ViewPagerAdapter extends PagerAdapter @Override public void startUpdate( View view ) {} + + + @Override + public String getTitle(int position) { + return context.getString(title[position]); + } + } \ No newline at end of file