<!-- NOTE: You must set the build action to None (instead of Content) on the web.configs in your project
to prevent the build from blowing up when it cannot copy the deleted original configs. -->
<PropertyGroup>
<!-- Register the WebConfigTransformation target as a dependency of the get operation -->
<GetDependsOn>
$(GetDependsOn);
WebConfigTransformation;
</GetDependsOn>
</PropertyGroup>
<Target Name="WebConfigTransformation">
<!-- Transform web.config files -->
<BuildStep
Name="TransformConfigurationFiles"
Message="Transforming configuration files for: %(ConfigurationToBuild.FlavorToBuild)"
TeamFoundationServerUrl="$(TeamFoundationServerUrl)" BuildUri="$(BuildURI)"
Condition="'$(IsDesktopBuild)'!='true'">
<Output TaskParameter="Id" PropertyName="StepId" />
</BuildStep>
<!-- Set all the files we will be using as writable. -->
<ItemGroup>
<_WebConfigFiles Include="$(SolutionRoot)\MyFirstProject\*.config">
<Attributes>Normal</Attributes>
</_WebConfigFiles>
<_WebConfigFiles Include="$(SolutionRoot)\MySecondProject\*.config">
<Attributes>Normal</Attributes>
</_WebConfigFiles>
<!-- etc for more config files in your solution -->
</ItemGroup>
<MSBuild.ExtensionPack.FileSystem.File
TaskAction="SetAttributes"
Files="@(_WebConfigFiles)" />
<!-- Execute msbuild with the command line switches to transform the configuration files -->
<Exec Command="$(FrameworkVersion40Dir)\msbuild.exe &quot;$(SolutionRoot)\MyFirstProject\MyFirstProject.csproj&quot; /T:TransformWebConfig /P:Configuration=%(ConfigurationToBuild.FlavorToBuild);RunCodeAnalysis=Never"/>
<Exec Command="$(FrameworkVersion40Dir)\msbuild.exe &quot;$(SolutionRoot)\MySecondProject\MySecondProject.csproj&quot; /T:TransformWebConfig /P:Configuration=%(ConfigurationToBuild.FlavorToBuild);RunCodeAnalysis=Never"/>
<!-- etc for more projects -->
<!-- Delete the other original configs -->
<Delete Files="@(_WebConfigFiles)" />
<!-- Copy the transformed config to the root -->
<Copy
SourceFiles="$(SolutionRoot)\MyFirstProject\obj\%(ConfigurationToBuild.FlavorToBuild)\TransformWebConfig\Transformed\Web.config"
DestinationFiles="$(SolutionRoot)\MyFirstProject\Web.config" />
<Copy
SourceFiles="$(SolutionRoot)\MySecondProject\obj\%(ConfigurationToBuild.FlavorToBuild)\TransformWebConfig\Transformed\Web.config"
DestinationFiles="$(SolutionRoot)\MySecondProject\Web.config" />
<!-- etc for more projects -->
<BuildStep Id="$(StepId)" Name="TransformConfigurationFiles" Status="Succeeded"
TeamFoundationServerUrl="$(TeamFoundationServerUrl)" BuildUri="$(BuildURI)"
Condition="'$(IsDesktopBuild)'!='true'" />
<OnError ExecuteTargets="WebConfigTransformationError"/>
</Target>
<Target Name="WebConfigTransformationError">
<BuildStep Id="$(StepId)" Name="WebConfigTransformation" Status="Failed"
TeamFoundationServerUrl="$(TeamFoundationServerUrl)" BuildUri="$(BuildURI)"
Condition="'$(IsDesktopBuild)'!='true'" />
</Target>
If you do not want views to reload on orientation changes simply override onConfigurationChanged in your Activity class:
@Override
public void onConfigurationChanged(Configuration newConfig){
super.onConfigurationChanged(newConfig);
}
And set the android:configChanges attribute in the manifest:
<activity android:name="..."
android:label="@string/appName"
android:configChanges="orientation"
<?xml version="1.0"?>
<!-- http://classyllama.com/development/magento-development/the-better-way-to-modify-magento-layout/ -->
<layout version="0.1.0">
<default>
<reference name="head">
<!-- Magento looks in /skin/frontend/<INTERFACE>/<THEME>/js/buyprinting.js
for this file -->
<action method="addItem"><type>skin_js</type><name>js/buyprinting.js</name></action>
<!-- This removes the item that was set in the page.xml file -->
<action method="removeItem"><type>skin_js</type><name>js/iehover-fix.js</name></action>
<!-- Magento looks in /js/prototype/element.storage.js for this file -->
<action method="addJs"><name>prototype/element.storage.js</name></action>
<action method="addCss">
<stylesheet>css/buyprinting.css</stylesheet></action>
</reference>
<reference name="header">
<!-- This adds a CMS block that can be called from the template file
associated with the header block. -->
<block type="cms/block" name="cms_quick_help">
<action method="setBlockId"><block_id>quick_help</block_id></action>
</block>
<!-- The remove tag removes the blocks with the specified name from the layout -->
<remove name="top.menu"/>
<remove name="store_language"/>
<remove name="breadcrumbs"/>
</reference>
<reference name="top.nav">
<remove name="catalog.topnav"/>
</reference>
<reference name="left">
<remove name="left.newsletter"/>
<remove name="left.permanent.callout"/>
<remove name="catalogsearch.leftnav"/>
<!-- When you use the remove tag, it removes any blocks with the specified name from
the entire layout, regardless of the context. So, if I remove right.newsletter in
the <default> context and that name is used in say the <catalog_product_view> context,
then both blocks will be removed. Because remove operates on the global context,
you can only remove an element once. Since <remove name="right.newsletter" /> is
being called in catalogsearch.xml, we have to unset it, or else we'll get an error.
The line below only unsets the block from the parent's context, not the global
layout context -->
<action method="unsetChild"><name>right.newsletter</name></action>
</reference>
<reference name="right">
<!-- Some blocks have to be removed using remove, others via unsetChild.
I've not spent the time digging into the code to figure out why -->
<remove name="right.permanent.callout"/>
<remove name="catalog.compare.sidebar"/>
<remove name="left.reports.product.viewed"/>
<action method="unsetChild"><name>sale.reorder.sidebar</name></action>
<action method="unsetChild"><name>wishlist_sidebar</name></action>
<action method="unsetChild"><name>right.reports.product.viewed</name></action>
<remove name="cart_sidebar"/>
</reference>
</default>
<!-- CATALOG PAGES -->
<catalog_product_view><!-- 2columns-right -->
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
<reference name="content">
<reference name="product.info">
<block type="cms/block" name="cms_product_info_tabs">
<action method="setBlockId"><block_id>product_info_tabs</block_id></action>
</block>
<block type="catalog/product_view" name="product.clone_prices" as="prices" template="catalog/product/view/price_clone.phtml"/>
<action method="unsetChild"><name>tierprices</name></action>
<action method="unsetChild"><name>addto</name></action>
<remove name="addto"/>
<reference name="product.info.options.wrapper.bottom">
<action method="unsetChild"><name>product.tierprices</name></action>
</reference>
</reference>
</reference>
</catalog_product_view>
</layout>
Here's the code to do a nice smooth fade between two Activities..
Create a file called fadein.xml in res/anim
<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator"
android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="2000" />
Create a file called fadeout.xml in res/anim
<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator"
android:fromAlpha="1.0" android:toAlpha="0.0" android:duration="2000" />
If you want to fade from Activity A to Activity B, put the following in the onCreate method for Activity B. Before setContentView works for me.
overridePendingTransition(R.anim.fadein, R.anim.fadeout);
If the fades are too slow for you, change android:duration in the xml files above to something smaller.