Luca4k4 Luca4k4 - 3 months ago 26
Android Question

Titanium with Alloy Material Design

first of all sorry for my english!
I readed this: http://www.appcelerator.com/blog/2015/07/understanding-the-android-material-theme/ following step by step to use Material Theme on my Android app! It works fine with Titanium Classic but doesn't with Alloy Framework. Are there differencies between the two approaches?

With Alloy i just don't see any differencies with or without theme.

The error I received is :

[ERROR] Detected legacy "/platform" directory in project directory.
[ERROR] Please move the "/platform" directory to "/app/platform" for Alloy 1.8.0 or later. [ERROR] Alloy compiler failed


But moving /platform to /app/platform it still not working

Thank you, Luca

EDIT:

I found a possible fix. In my tiapp.xml (generated with TiShadow), i have:

<android xmlns:android="http://schemas.android.com/apk/res/android">
**POSITION ONE**

<manifest android:versionCode="6" android:versionName="1.5.0">

<uses-permission android:name="android.permission.ACCESS_CHECKIN_PROPERTIES" />
//long list of uses-permission
<uses-feature android:name='android.hardware.microphone' android:required="false" />
//long list of uses-features
<application>
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true"/>
</application>
</manifest>
**POSITION TWO**
</android>


I have to insert:

<manifest>
<application android:theme="@style/Theme.Appcelerator"> </application>
</manifest>


If i insert it on POSITION ONE, it doesn't work (totally ignored); but if i insert it on POSITION TWO it works fine.

I tried more times with the same result. Could someone give me an explanation? :confused:

Answer

First of all, please edit your question by adding your answer into it as it is not an answer.

Now coming to your query, the reason behind two positions is that:

application tag must come inside manifest tag, otherwise it will be ignored.

Since manifest tag is the topmost tag, that's why Pos 1 is ignored and rest below manifest tag is considered within manifest, so that's why Pos 2 works.

Now, you already have the application tag below uses-feature and all you need is to add the android:theme="@style/Theme.Appcelerator" attribute to application tag.

So your final android tag in tiapp.xml will look like this:

<android xmlns:android="http://schemas.android.com/apk/res/android">
  <manifest android:versionCode="6" android:versionName="1.5.0">

    <uses-permission android:name="android.permission.ACCESS_CHECKIN_PROPERTIES" />

    <uses-feature android:name='android.hardware.microphone' android:required="false" />

    <application android:theme="@style/Theme.Appcelerator">
      <meta-data android:name="com.sec.android.support.multiwindow" android:value="true"/>
    </application>

  </manifest>
</android>