nickmao1985 / apndroid

Automatically exported from code.google.com/p/apndroid
0 stars 0 forks source link

Use EXTRA_BUNDLE for Locale Plug-in #91

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
APNDroid's Locale Plug-in implementation is using a deprecated API and needs to 
be updated to support the Locale 1.0 plug-in specification.  Specifically, 
APNDroid needs to read/write extras from a Bundle extra 
http://www.twofortyfouram.com/developer/doc/com/twofortyfouram/Intent.html#EXTRA
_BUNDLE in the Intent rather than directly from the Intent.

I believe the only changes needed are in:
  LocaleActivity's onCreate() method
  LocaleActivity's finish() method
  LocaleEventReceiver's onReceive() method

For testing, simply use the strict mode enabler which was provided as part of 
the Locale 1.4 release: 
http://blog.twofortyfouram.com/post/1556337843/locale-1-4

Original issue reported on code.google.com by supp...@twofortyfouram.com on 1 Apr 2011 at 11:02

GoogleCodeExporter commented 9 years ago

Original comment by zeldigas on 6 Apr 2011 at 5:41

GoogleCodeExporter commented 9 years ago
Updated locale plugin code.
I does not have installed version of locale, so please the one who have check 
if all is wright and does not cause force close.
Built version with api rewrite changes: 
https://code.google.com/p/apndroid/downloads/detail?name=apndroid-locale-api-upd
ate.ver3.0.1.apk

Original comment by zeldigas on 6 Apr 2011 at 8:47

GoogleCodeExporter commented 9 years ago
Code review shows the following line needs to be changed in the 
broadcastreceiver:
boolean showNotification = intent.getBooleanExtra(Constants.SHOW_NOTIFICATION, 
true);   should be replaced with  boolean showNotification = 
**bundle**.getBoolean(Constants.SHOW_NOTIFICATION, true);

I'm also seeing the following exception is being thrown/caught by the bread 
crumb generator.  So it doesn’t crash, but it appears in logcat.  It looks 
like you're using a JAR instead of the Locale library project.  The library 
project contains a string resource that the breadcrumb class looks for, and I 
think that's causing the exception.  My recommendation would be to use the 
library project, or to simply add the 
R.string.twofortyfouram_locale_breadcrumb_format and 
R.string.twofortyfouram_locale_breadcrumb_separator strings into the APNDroid 
string resources.

E/Locale  ( 4242): BreadCrumber.generateBreadcrumb.(Context, Intent, String): 
Encountered error generating breadcrumb
E/Locale  ( 4242): android.content.res.Resources$NotFoundException: String 
resource ID #0x7f040002
E/Locale  ( 4242):  at android.content.res.Resources.getText(Resources.java:201)
E/Locale  ( 4242):  at 
android.content.res.Resources.getString(Resources.java:254)
E/Locale  ( 4242):  at android.content.Context.getString(Context.java:183)
E/Locale  ( 4242):  at 
com.twofortyfouram.locale.BreadCrumber.generateBreadcrumb(Unknown Source)
E/Locale  ( 4242):  at 
com.google.code.apndroid.locale.LocaleActivity.onCreate(LocaleActivity.java:104)
E/Locale  ( 4242):  at 
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/Locale  ( 4242):  at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1586)
E/Locale  ( 4242):  at 
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1638)
E/Locale  ( 4242):  at 
android.app.ActivityThread.access$1500(ActivityThread.java:117)
E/Locale  ( 4242):  at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:928)
E/Locale  ( 4242):  at android.os.Handler.dispatchMessage(Handler.java:99)
E/Locale  ( 4242):  at android.os.Looper.loop(Looper.java:123)
E/Locale  ( 4242):  at android.app.ActivityThread.main(ActivityThread.java:3647)
E/Locale  ( 4242):  at java.lang.reflect.Method.invokeNative(Native Method)
E/Locale  ( 4242):  at java.lang.reflect.Method.invoke(Method.java:507)
E/Locale  ( 4242):  at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/Locale  ( 4242):  at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/Locale  ( 4242):  at dalvik.system.NativeStart.main(Native Method)

Original comment by supp...@twofortyfouram.com on 6 Apr 2011 at 9:07

GoogleCodeExporter commented 9 years ago
Thank you for help! Does to use locale library project, we need to add locale 
sources to apndroid instead of using precompilled jar?

Original comment by zeldigas on 6 Apr 2011 at 9:11

GoogleCodeExporter commented 9 years ago
Just a note - current Market version is from 2x private branch, not the tip.

Original comment by martin.adamek on 6 Apr 2011 at 9:12

GoogleCodeExporter commented 9 years ago
Re comment #4: I would remove the JAR, add the Locale library project to 
APNDroid's default.properties (e.g. something like 
android.library.reference.1=../LocalePlatform/), and then make a copy of the 
Locale library project's source in APNDroid's root directory under a directory 
like "LocalePlatform" or whatever you'd like to call it.  That way you have a 
snapshot of the version of the library project used when you wrote the APNDroid 
code.

Original comment by supp...@twofortyfouram.com on 6 Apr 2011 at 9:27

GoogleCodeExporter commented 9 years ago
Ok, i'll publish updated version today (about 19:30 UTC).

Original comment by Pavlov.D...@gmail.com on 7 Apr 2011 at 7:03

GoogleCodeExporter commented 9 years ago
Uploaded next version of locale api rewrite.
http://code.google.com/p/apndroid/downloads/detail?name=apndroid-locale-api-upda
te.ver3.0.1.2.apk

Original comment by zeldigas on 7 Apr 2011 at 9:02

GoogleCodeExporter commented 9 years ago
fixed, in revision 369da56f2dee: 
http://code.google.com/p/apndroid/source/detail?r=369da56f2dee5635d8d0753d65f10f
b129720b4e

report if issue still present.

Original comment by zeldigas on 8 Apr 2011 at 6:37

GoogleCodeExporter commented 9 years ago
We've tested the 3.0.1.2 APK and it appears to resolve this issue.

Original comment by supp...@twofortyfouram.com on 12 Apr 2011 at 7:58

GoogleCodeExporter commented 9 years ago

Original comment by zeldigas on 13 Apr 2011 at 5:40