MeasureChina/Ti.DrawerLayout

1.1.0 Theme Isssue

ankesh27 opened this issue · 9 comments

Hey, I tried building the app(test app) using 1.1.0 Drawer version and below are the errors I saw

Also just a question, why is it on 3.3.0 when I suppose this SDK version is still in pre-release phase.

TiApplication: (main) [908,908] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mydala/org.appcelerator.titanium.TiActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.; Titanium 3.3.0,2014/05/19 17:41,0f50581
[ERROR] : TiApplication: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mydala/org.appcelerator.titanium.TiActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
[ERROR] : TiApplication: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
[ERROR] : TiApplication: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
[ERROR] : TiApplication: at android.app.ActivityThread.access$600(ActivityThread.java:123)
[ERROR] : TiApplication: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
[ERROR] : TiApplication: at android.os.Handler.dispatchMessage(Handler.java:99)
[ERROR] : TiApplication: at android.os.Looper.loop(Looper.java:137)
[ERROR] : TiApplication: at android.app.ActivityThread.main(ActivityThread.java:4424)
[ERROR] : TiApplication: at java.lang.reflect.Method.invokeNative(Native Method)
[ERROR] : TiApplication: at java.lang.reflect.Method.invoke(Method.java:511)
[ERROR] : TiApplication: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
[ERROR] : TiApplication: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
[ERROR] : TiApplication: at dalvik.system.NativeStart.main(Native Method)
[ERROR] : TiApplication: Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
[ERROR] : TiApplication: at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:108)
[ERROR] : TiApplication: at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:57)
[ERROR] : TiApplication: at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98)
[ERROR] : TiApplication: at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:510)
[ERROR] : TiApplication: at org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:18)
[ERROR] : TiApplication: at android.app.Activity.performCreate(Activity.java:4465)
[ERROR] : TiApplication: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
[ERROR] : TiApplication: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
[ERROR] : TiApplication: ... 11 more
[ERROR] : AndroidRuntime: FATAL EXCEPTION: main
[ERROR] : AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mydala/org.appcelerator.titanium.TiActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
[ERROR] : AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
[ERROR] : AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
[ERROR] : AndroidRuntime: at android.app.ActivityThread.access$600(ActivityThread.java:123)
[ERROR] : AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
[ERROR] : AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
[ERROR] : AndroidRuntime: at android.os.Looper.loop(Looper.java:137)
[ERROR] : AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:4424)
[ERROR] : AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
[ERROR] : AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:511)
[ERROR] : AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
[ERROR] : AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
[ERROR] : AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
[ERROR] : AndroidRuntime: Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
[ERROR] : AndroidRuntime: at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:108)
[ERROR] : AndroidRuntime: at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:57)
[ERROR] : AndroidRuntime: at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98)
[ERROR] : AndroidRuntime: at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:510)
[ERROR] : AndroidRuntime: at org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:18)
[ERROR] : AndroidRuntime: at android.app.Activity.performCreate(Activity.java:4465)
[ERROR] : AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
[ERROR] : AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
[ERROR] : AndroidRuntime: ... 11 more

Yes, you need to install pre-release version of Titanium 3.3.0,
because of native actionBar feature.

Or you can use old 1.0.2 version.

titanium sdk install --branch master --default

You can uninstall it anytime or select 3.2.0.GA as default.

titanium sdk uninstall 3.3.0.v201405xxxxxxxxx
titanium sdk select 3.2.0.GA

Okay, but what is the error ? I am using pre release 3.3.0 and getting those errors.

check tiapp.xml and ensure target sdk version in android manifest section.

<android xmlns:android="http://schemas.android.com/apk/res/android">
    <manifest>
        <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="18" />
        ...

targetSdkVersion should be 14 at least.

Things are working fine, I was using HOLO theme and the module supports AppCompact as a base theme.

Do you have an Idea how to hide the left actionbar Icon(the one which animates) when there is only Right Nav menu...

You can set displayHomeAsUp property as false after window opened (activity became available).

http://docs.appcelerator.com/titanium/3.0/#!/api/Titanium.Android.ActionBar-property-displayHomeAsUp

win.addEventListener("open", function() {
    win.activity.actionBar.displayHomeAsUp = false;
});

Yes True, this is the first thing I tried, but them if we set displayHomeAsUp as False then there is no Back button too. I think there should be back button if no Left Drawer.

Please correct me if I am wrong.

Is is the top-level window? (the first page user can see)

I think the top-level window don't need to have back button.
https://developer.android.com/design/patterns/navigation-drawer.html

I checked some apps,
and I found that the top-level window has no back button generally.
They just have logo.

It's the Sub Window. Parent window has the left drawer and the child window has the right drawer.

Something like the parent window has categories(in left drawer) and child window has the Sub categories(right drawer).

ok. I just added 'drawerIndicatorEnabled' property (which will be passed to setDrawerIndicatorEnabled() of ActionBarDrawerToggle).

so you can set 'drawerIndicatorEnabled' as false, then the back arrow will be appear instead of drawer indicator icon.

use 1.1.1 version