ricardoalcocer / actionbarextras

Titanium Android Native Module that exposes ActionBar features not exposed by the Titanium SDK
MIT License
148 stars 61 forks source link

Not working on 4.0.x #69

Closed Indiepath closed 9 years ago

Indiepath commented 9 years ago

Does this need a fix or should I recompile?

Thanks, Tim.

manumaticx commented 9 years ago

@Indiepath I was successfully testing with 4.0.0.Beta3. What error do you get?

Indiepath commented 9 years ago

I'm using Appcelerator Studio with SDK 4.0.0.RC2 - it works fine on 3.5.1 and I am invoking within the open event listener.

[WARN] : W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.ActionBar.setBackgroundDrawable(android.graphics.drawable.Drawable)' on a null object reference [WARN] : W/System.err: at com.alcoapps.actionbarextras.ActionbarextrasModule.handleSetBackgroundColor(ActionbarextrasModule.java:213) [WARN] : W/System.err: at com.alcoapps.actionbarextras.ActionbarextrasModule.handleMessage(ActionbarextrasModule.java:93) [WARN] : W/System.err: at android.os.Handler.dispatchMessage(Handler.java:98) [WARN] : W/System.err: at android.os.Looper.loop(Looper.java:135) [WARN] : W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5254) [WARN] : W/System.err: at java.lang.reflect.Method.invoke(Native Method) [WARN] : W/System.err: at java.lang.reflect.Method.invoke(Method.java:372) [WARN] : W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) [WARN] : W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) [WARN] : W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence android.app.ActionBar.getTitle()' on a null object reference [WARN] : W/System.err: at com.alcoapps.actionbarextras.ActionbarextrasModule.handleSetTitleColor(ActionbarextrasModule.java:300) [WARN] : W/System.err: at com.alcoapps.actionbarextras.ActionbarextrasModule.handleMessage(ActionbarextrasModule.java:105) [WARN] : W/System.err: at android.os.Handler.dispatchMessage(Handler.java:98) [WARN] : W/System.err: at android.os.Looper.loop(Looper.java:135) [WARN] : W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5254) [WARN] : W/System.err: at java.lang.reflect.Method.invoke(Native Method) [WARN] : W/System.err: at java.lang.reflect.Method.invoke(Method.java:372) [WARN] : W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) [WARN] : W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) [WARN] : W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence android.app.ActionBar.getTitle()' on a null object reference [WARN] : W/System.err: at com.alcoapps.actionbarextras.ActionbarextrasModule.handleSetTitle(ActionbarextrasModule.java:143) [WARN] : W/System.err: at com.alcoapps.actionbarextras.ActionbarextrasModule.handleMessage(ActionbarextrasModule.java:85) [WARN] : W/System.err: at android.os.Handler.dispatchMessage(Handler.java:98) [WARN] : W/System.err: at android.os.Looper.loop(Looper.java:135) [WARN] : W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5254) [WARN] : W/System.err: at java.lang.reflect.Method.invoke(Native Method) [WARN] : W/System.err: at java.lang.reflect.Method.invoke(Method.java:372) [WARN] : W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) [WARN] : W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

manumaticx commented 9 years ago

I've tested with 4.0.0.v20150508112613, still not able to reproduce this.

Can you try using the example project. If this works, can you please share a reproducible test case?

Indiepath commented 9 years ago

Hi, I have just run the example (lots of errors), I'm running on a Nexus 5 with 5.1 installed.

[WARN] :   IInputConnectionWrapper: getSelectedText on inactive InputConnection
[WARN] :   IInputConnectionWrapper: requestCursorAnchorInfo on inactive InputConnection
[WARN] :   IInputConnectionWrapper: getTextBeforeCursor on inactive InputConnection
[WARN] :   IInputConnectionWrapper: getTextBeforeCursor on inactive InputConnection
[WARN] :   IInputConnectionWrapper: getTextBeforeCursor on inactive InputConnection
[WARN] :   W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence android.app.ActionBar.getSubtitle()' on a null object reference
[WARN] :   W/System.err:    at com.alcoapps.actionbarextras.ActionbarextrasModule.handleSetSubtitleFont(ActionbarextrasModule.java:260)
[WARN] :   W/System.err:    at com.alcoapps.actionbarextras.ActionbarextrasModule.handleMessage(ActionbarextrasModule.java:101)
[WARN] :   W/System.err:    at android.os.Handler.dispatchMessage(Handler.java:98)
[WARN] :   W/System.err:    at android.os.Looper.loop(Looper.java:135)
[WARN] :   W/System.err:    at android.app.ActivityThread.main(ActivityThread.java:5254)
[WARN] :   W/System.err:    at java.lang.reflect.Method.invoke(Native Method)
[WARN] :   W/System.err:    at java.lang.reflect.Method.invoke(Method.java:372)
[WARN] :   W/System.err:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
[WARN] :   W/System.err:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
[WARN] :   W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence android.app.ActionBar.getTitle()' on a null object reference
[WARN] :   W/System.err:    at com.alcoapps.actionbarextras.ActionbarextrasModule.handleSetTitleColor(ActionbarextrasModule.java:300)
[WARN] :   W/System.err:    at com.alcoapps.actionbarextras.ActionbarextrasModule.handleMessage(ActionbarextrasModule.java:105)
[WARN] :   W/System.err:    at android.os.Handler.dispatchMessage(Handler.java:98)
[WARN] :   W/System.err:    at android.os.Looper.loop(Looper.java:135)
[WARN] :   W/System.err:    at android.app.ActivityThread.main(ActivityThread.java:5254)
[WARN] :   W/System.err:    at java.lang.reflect.Method.invoke(Native Method)
[WARN] :   W/System.err:    at java.lang.reflect.Method.invoke(Method.java:372)
[WARN] :   W/System.err:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
[WARN] :   W/System.err:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
[WARN] :   W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence android.app.ActionBar.getSubtitle()' on a null object reference
[WARN] :   W/System.err:    at com.alcoapps.actionbarextras.ActionbarextrasModule.handleSetSubtitleColor(ActionbarextrasModule.java:331)
[WARN] :   W/System.err:    at com.alcoapps.actionbarextras.ActionbarextrasModule.handleMessage(ActionbarextrasModule.java:109)
[WARN] :   W/System.err:    at android.os.Handler.dispatchMessage(Handler.java:98)
[WARN] :   W/System.err:    at android.os.Looper.loop(Looper.java:135)
[WARN] :   W/System.err:    at android.app.ActivityThread.main(ActivityThread.java:5254)
[WARN] :   W/System.err:    at java.lang.reflect.Method.invoke(Native Method)
[WARN] :   W/System.err:    at java.lang.reflect.Method.invoke(Method.java:372)
[WARN] :   W/System.err:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
[WARN] :   W/System.err:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
[WARN] :   W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.ActionBar.setBackgroundDrawable(android.graphics.drawable.Drawable)' on a null object reference
[WARN] :   W/System.err:    at com.alcoapps.actionbarextras.ActionbarextrasModule.handleSetBackgroundColor(ActionbarextrasModule.java:213)
[WARN] :   W/System.err:    at com.alcoapps.actionbarextras.ActionbarextrasModule.handleMessage(ActionbarextrasModule.java:93)
[WARN] :   W/System.err:    at android.os.Handler.dispatchMessage(Handler.java:98)
[WARN] :   W/System.err:    at android.os.Looper.loop(Looper.java:135)
[WARN] :   W/System.err:    at android.app.ActivityThread.main(ActivityThread.java:5254)
[WARN] :   W/System.err:    at java.lang.reflect.Method.invoke(Native Method)
[WARN] :   W/System.err:    at java.lang.reflect.Method.invoke(Method.java:372)
[WARN] :   W/System.err:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
[WARN] :   W/System.err:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
[WARN] :   W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.ActionBar.setIcon(android.graphics.drawable.Drawable)' on a null object reference
[WARN] :   W/System.err:    at com.alcoapps.actionbarextras.ActionbarextrasModule.handleDisableIcon(ActionbarextrasModule.java:365)
[WARN] :   W/System.err:    at com.alcoapps.actionbarextras.ActionbarextrasModule.handleMessage(ActionbarextrasModule.java:113)
[WARN] :   W/System.err:    at android.os.Handler.dispatchMessage(Handler.java:98)
[WARN] :   W/System.err:    at android.os.Looper.loop(Looper.java:135)
[WARN] :   W/System.err:    at android.app.ActivityThread.main(ActivityThread.java:5254)
[WARN] :   W/System.err:    at java.lang.reflect.Method.invoke(Native Method)
[WARN] :   W/System.err:    at java.lang.reflect.Method.invoke(Method.java:372)
[WARN] :   W/System.err:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
[WARN] :   W/System.err:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
[WARN] :   W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.ActionBar.setLogo(android.graphics.drawable.Drawable)' on a null object reference
[WARN] :   W/System.err:    at com.alcoapps.actionbarextras.ActionbarextrasModule.handleHideLogo(ActionbarextrasModule.java:408)
[WARN] :   W/System.err:    at com.alcoapps.actionbarextras.ActionbarextrasModule.handleMessage(ActionbarextrasModule.java:121)
[WARN] :   W/System.err:    at android.os.Handler.dispatchMessage(Handler.java:98)
[WARN] :   W/System.err:    at android.os.Looper.loop(Looper.java:135)
[WARN] :   W/System.err:    at android.app.ActivityThread.main(ActivityThread.java:5254)
[WARN] :   W/System.err:    at java.lang.reflect.Method.invoke(Native Method)
[WARN] :   W/System.err:    at java.lang.reflect.Method.invoke(Method.java:372)
[WARN] :   W/System.err:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
[WARN] :   W/System.err:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
[ERROR] :  TiExceptionHandler: (main) [16805,22963] ----- Titanium Javascript Runtime Error -----
[ERROR] :  TiExceptionHandler: (main) [0,22963] - In app.js:204,17
[ERROR] :  TiExceptionHandler: (main) [0,22963] - Message: Uncaught TypeError: Object #<Actionbarextras> has no method 'setSearchView'
[ERROR] :  TiExceptionHandler: (main) [0,22963] - Source:             abx.setSearchView({
[ERROR] :  V8Exception: Exception occurred at app.js:204: Uncaught TypeError: Object #<Actionbarextras> has no method 'setSearchView'
[ERROR] :  TiExceptionHandler: (main) [4605,27568] ----- Titanium Javascript Runtime Error -----
[ERROR] :  TiExceptionHandler: (main) [1,27569] - In app.js:139,16
[ERROR] :  TiExceptionHandler: (main) [0,27569] - Message: Uncaught TypeError: Object #<Actionbarextras> has no method 'getActionbarHeight'
[ERROR] :  TiExceptionHandler: (main) [0,27569] - Source:     alert( abx.getActionbarHeight() );
[ERROR] :  V8Exception: Exception occurred at app.js:139: Uncaught TypeError: Object #<Actionbarextras> has no method 'getActionbarHeight'
Indiepath commented 9 years ago

I forgot to mention that I get what appears to be two action bars. screenshot_2015-05-12-12-05-32

manumaticx commented 9 years ago

@Indiepath Can you please provide a test project or something that allows me to reproduce this? I've again tested this with 4.0.0.RC3 but everything works fine here. You seem to be the only one facing this issue. Maybe this is theme related? Not sure... But I don't think it's a 4.0.X issue

Indiepath commented 9 years ago

I had the same issue with your example project - could it be the build tools version? I'm using 20.

manumaticx commented 9 years ago

I'm using 21 but I could not imagine that the build tools could be the reason for this behavior

manumaticx commented 9 years ago

@Indiepath You we're right. It's probably the build tools. The 4.0.0 Release notes state out:

"Due to the addition of Material Theme support in this Release, the target SDK version must be set to API 21 (Android 5.0) or greater. If you do not set the target SDK version, Android SDK 5.0 or greater must still be installed. Previously, the target SDK version could be API 14 or greater."

Can you install API 21 and test this again. If the problem still occurs feel free to reopen this issue.