How to define animations for all transitions at one spot? - android-animation

I wanna use the same animations for different actions. Is there any way to define them at one spot like a stylesheet?
At the moment my nav_graph.xml looks like this:
<fragment
android:id="#+id/questionnaireFragment"
android:name="de.fragdichselbst.view.ui.QuestionnaireFragment"
android:label="fragment_questionnaire"
tools:layout="#layout/fragment_questionnaire" >
<action
android:id="#+id/action_questionnaireFragment_to_subjectFragment"
app:destination="#id/subjectFragment"
app:enterAnim="#anim/slide_in_right"
app:exitAnim="#anim/slide_out_left"
app:popEnterAnim="#anim/slide_in_left"
app:popExitAnim="#anim/slide_out_right" />
</fragment>
<fragment
android:id="#+id/subjectFragment"
android:name="de.fragdichselbst.view.ui.SubjectFragment"
android:label="fragment_subject"
tools:layout="#layout/fragment_subject" >
<argument
android:name="questionnaire_id"
app:argType="integer" />
<action
android:id="#+id/action_subjectFragment_to_quizSettingsFragment"
app:destination="#id/quizSettingsFragment"
app:enterAnim="#anim/slide_in_right"
app:exitAnim="#anim/slide_out_left"
app:popEnterAnim="#anim/slide_in_left"
app:popExitAnim="#anim/slide_out_right" />
<action
android:id="#+id/action_subjectFragment_to_savedQuizFragment"
app:destination="#id/savedQuizFragment" />
</fragment>
As you can see I use the same animations for each action. But what if I have multiple fragments and I wanna change the animations? I would have to change a lot of code lines. So I would like to have one spot where I define the animation for all transitions.

Related

Android intent filter - React Native 0.70

I am trying to launch a custom react native app from the Community Health Toolkit (CHT App Launcher). The goal is that a button is pressed in CHT and that the user is then forwarded directly to the custom app.
I am using the below code right now for my custom react native app in the AndroidManifest.xml file to launch it:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<application
android:name=".MainApplication"
android:label="#string/app_name"
android:icon="#mipmap/ic_launcher"
android:roundIcon="#mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:label="string resource">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:mimeType="*/*" />
</intent-filter>
</activity>
</application>
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<!-- If you don't know the MIME type in advance, set "mimeType" to "*/*". -->
<data android:mimeType="*/*" />
</intent>
</queries>
However, I have difficulties launching the react native app from CHT even though both apps are installed on the emulator. CHT works in such a way that we can define an intent directly in the xlsx form. Currently, we use the following format in the xlsx default column to start the react native app “android.intent.action.VIEW”.
Unfortunately, the custom app does not appear when we press the button on CHT.
The preview window just prompts me to open other apps (e.g., Adobe Reader etc..).
If I define another intent in the xlsx form in CHT such as "android.media.action.image_capture", the standard camera app on the emulator opens successfully.
As a result, I believe I misdefined something in the AndroidManifest.xml file.
What am I missing?
Your intent-filter must be like
<intent-filter android:excludeFromRecents="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="app.applinking" />
</intent-filter>
The android:scheme must be your app linking URL.

Is there any similar kind of configure to rolingStyle="once" of log4net is available for NLog?

I am using log4net currently and on every hour log file archive is being performed.
Now I am changing log4net to NLog
Is there similar setting available in NLog Like rolingStyle="once"? which was configure setting available in log4net.
For example earlier while using log4net the files created were used to be like:
LogFile.log
LogFile.log.1 <-last archive file
Following is configuration I used in log4net and I want to use the exact configure settings so that archived file naming should remains as it was in log4net:
<appender name="Work" type="RMM.Common.Logger.LogFileRollingAppender, Common">
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<dateTimeStrategy type="log4net.Appender.RollingFileAppender+UniversalDateTime" />
<file type="log4net.Util.PatternString" value="%property{EdgeAPILogPath}\WebAPI_Work.log" />
<param name="AppendToFile" value="true"/>
<rollingStyle value="Once" />
<rollingStyle value="Composite" />
<datePattern value=".yyyyMMdd-HH" />
<maxSizeRollBackups value="300" />
<maximumFileSize value="20MB" />
<Encoding value="UTF-8" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%utcdate{yyyy/MM/dd HH:mm:ss,fff} [%-5p] [%3t] %m%n" />
</layout>
<filter type="log4net.Filter.LevelRangeFilter">
<levelMin value="DEBUG" />
<levelMax value="FATAL" />
</filter>
</appender>
You can:
Use fileName="${basedir}/logs/${cached:${date:format=yyyy-MM-dd HH_mm_ss}}.log" as a way to ensure one log file per application instance.
Use archiveFileName="${archiveLogDirectory}/LogFile.log.{####}" to append numbers at the end (feel free to add or remove # as required, depending on your maxArchiveFiles).
Use archiveNumbering="Sequence" to achieve the order you want (higher numbers = newer logs).
Source: this piece of documentation and some personal experience.
Hopefully this basic example will help you getting closer to your final target:
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
internalLogLevel="Error"
internalLogFile="./internal-nlog.txt"
throwExceptions="true">
<variable name="logDirectory" value="./logs"/>
<variable name="archiveLogDirectory" value="./logs/archive"/>
<targets>
<target name="errors"
xsi:type="File"
fileName="${logDirectory}/${cached:${date:format=yyyy-MM-dd HH_mm_ss}}.log"
archiveFileName="${archiveLogDirectory}/LogFile.log.{#}"
maxArchiveFiles="9"
archiveEvery="Hour"
archiveNumbering="Sequence"
/>
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="errors"/>
</rules>
</nlog>
Not an expert on log4net, but it sounds like that rolingStyle="once" is the same as NLog FileTarget ArchiveOldFileOnStartup. So maybe something like this:
<nlog>
<variable name="EdgeAPILogPath" layout="${basedir}" />
<targets>
<target xsi:type="file" name="work"
fileName="${EdgeAPILogPath}/WebAPI_Work.log"
encoding="utf-8"
archiveNumbering="DateAndSequence"
archiveFileName="${EdgeAPILogPath}/WebAPI_Work.{#}.log"
archiveDateFormat="yyyyMMdd-HH"
archiveEvery="Hour"
archiveAboveSize="20000000"
archiveOldFileOnStartup="true"
maxArchiveFiles="300" />
</targets>
<rules>
<logger name="*" minLevel="Debug" writeTo="work" />
</rules>
</nlog>
See also: https://github.com/NLog/NLog/wiki/FileTarget-Archive-Examples

How can I create a special character shortcut for an IntelliJ plugin?

I would like to attach the shortcut ctrl + [ to an action in an IntelliJ plugin I'm writing.
For ctrl plus any letter, this works. However, for a square bracket, this doesn't seem to work. I have tried escpaing using \[.
For example, this doesn't work:
<action id="DoTheThingAction" class="DoTheThingAction" text="Do It" description="Does The Thing">
<keyboard-shortcut first-keystroke="ctrl \[" keymap="$default" />
</action>
While this works:
<action id="DoTheThingAction" class="DoTheThingAction" text="Do It" description="Does The Thing">
<keyboard-shortcut first-keystroke="ctrl w" keymap="$default" />
</action>
Do I need to do anything special to create a shortcut for a special character like "["?
You can't use [ or \[ directly. You need to use OPEN_BRACKET.
For example, this works:
<action id="DoTheThingAction" class="DoTheThingAction" text="Do It" description="Does The Thing">
<keyboard-shortcut first-keystroke="ctrl OPEN_BRACKET" keymap="$default" />
</action>

Can I allow a user to choose either applicationPoolIdentity or specify a user using WiX-IIS extension?

My web application typically will be installed to use applicationPoolIdentity:
<iis:WebAppPool Id="MyAppPool" Identity="applicationPoolIdentity" Name="MyAppPool"/>
but I have a class of users that will want to use a specific domain user instead, which I would typically author like this:
<util:User Id="MyUser" Name="[MY_USER]" Domain="[MY_DOMAIN]" Password="[MY_PASSWORD]" CreateUser="no"/>
<iis:WebAppPool Id="MyAppPool" Identity="other" User="MyUser" Name="MyAppPool" />
Making the user interface for this is simple enough, but is there a way to conditionally switch between Identity="applicationPoolIdentity" and Identity="other" without writing a custom action?
Yes, it is possible but you will need to create a component group with two components that have conditionals. As this solution is a bit verbose, I recommend having it in a separate file.
Here is an example, based on https://www.codeproject.com/Articles/115036/Creating-WIX-Installer-for-ASP-NET-Web-Application.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:iis="http://schemas.microsoft.com/wix/IIsExtension"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Fragment>
<Property Id="IIS_WEBSITE" Value="root"/>
<Property Id="VIRTUAL_DIR_VAL" Value="myappdir" />
<!-- +++++++++++++++++++ web app name properties initialize ++++++++++++++++++++ -->
<Property Id="WEB_APP_NAME" Value="myapp" />
<Property Id="WEB_APP_USE_CUSTOM_APP_POOL_IDENTITY" Value="1" />
<!-- +++++++++++++++++++ app pool identity properties initialize +++++++++++++++ -->
<Property Id="WEB_APP_POOL_IDENTITY_DOMAIN" Value="domain" />
<Property Id="WEB_APP_POOL_IDENTITY_NAME" Value="user" />
<Property Id="WEB_APP_POOL_IDENTITY_PWD" Hidden="yes" />
<!-- Reference to IIS Website to install to, but not create -->
<iis:WebSite Id='rootwebsite'
Description='[IIS_WEBSITE]'
Directory='INSTALLFOLDER'>
<!-- This element has to be here or WiX does not compile. It’s ignored
in this case. -->
<iis:WebAddress Id="AllUnassignedHTTP" Port="80" />
<iis:WebAddress Id="AllUnassignedHTTPS" Port="443" />
</iis:WebSite>
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="InstallWebsiteCustomUser" Guid="[guid]" KeyPath="yes" Win64="yes">
<Condition><![CDATA[WEB_APP_USE_CUSTOM_APP_POOL_IDENTITY = 1]]></Condition>
<util:User Id="WebAppPoolUser"
CreateUser="no"
Name="[WEB_APP_POOL_IDENTITY_NAME]"
Password="[WEB_APP_POOL_IDENTITY_PWD]"
Domain="[WEB_APP_POOL_IDENTITY_DOMAIN]" />
<iis:WebAppPool Id="WebAppPoolCustom"
Name="[WEB_APP_NAME]"
Identity="other"
User="WebAppPoolUser"
ManagedPipelineMode="Integrated"
ManagedRuntimeVersion="v4.0"
RecycleMinutes="200" />
<iis:WebVirtualDir Id="WebVirtualDirCustom"
Alias="[VIRTUAL_DIR_VAL]"
Directory="INSTALLFOLDER"
WebSite="rootwebsite">
<!-- Turn the Virtual Directory into a web application. -->
<iis:WebApplication Id="WebApplicationCustom"
Name="[WEB_APP_NAME]"
WebAppPool="WebAppPoolCustom" />
</iis:WebVirtualDir>
</Component>
<Component Id="InstallWebsite" Guid="[guid]" KeyPath="yes" Win64="yes">
<Condition><![CDATA[WEB_APP_USE_CUSTOM_APP_POOL_IDENTITY <> 1]]></Condition>
<iis:WebAppPool Id="WebAppPool"
Name="[WEB_APP_NAME]"
Identity="applicationPoolIdentity"
ManagedPipelineMode="Integrated"
ManagedRuntimeVersion="v4.0"
RecycleMinutes="200"/>
<iis:WebVirtualDir Id="WebVirtualDir"
Alias="[VIRTUAL_DIR_VAL]"
Directory="INSTALLFOLDER"
WebSite="rootwebsite">
<!-- Turn the Virtual Directory into a web application. -->
<iis:WebApplication Id="WebApplication"
Name="[WEB_APP_NAME]"
WebAppPool="WebAppPool" />
</iis:WebVirtualDir>
</Component>
</DirectoryRef>
<ComponentGroup Id="IisConfiguration">
<ComponentRef Id="InstallWebsiteCustomUser" />
<ComponentRef Id="InstallWebsite" />
</ComponentGroup>
</Fragment>
</Wix>

Can WixUiBannerBmp be set in a wixlib?

Currently I'm trying to move the WixUIBannerBmp, WixUIDialogBmp and WixUILicenseRtf WixVariables and their corresponding binary files to a wixlib. Unfortunately when building it ignores these and uses the defaults.
My Library.wxs:
<Fragment>
<WixVariable Id="WixUILicenseRtf" Value="licence.rtf" />
<WixVariable Id="WixUIBannerBmp" Value="binaries/bannrbmp.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="binaries/dlgbmp.bmp" />
</Fragment>
where the rtf and bmp files are included in the wixlib project and the paths are relative to the Library.wxs file.
Anyone have any ideas why this isn't working?
Thanks
Managed to work this out myself! :)
Firstly the fragment is not automatically included into the main Product.wxs unless something is explicitly referenced. In this case I'm using the ARPPRODUCTICON property. If you don't have anything that you can use you can just add a dummy property that will never be used.
Also the paths to the binaries will then be incorrect as the path will be relative to the Product.wxs file. Therefore you need to use the Preprocessor variable to the current project path.
Product.wxs
<Wix>
<PropertyRef Id="ARPPRODUCTICON" />
</Wix>
Library.wxs
<Fragment>
<WixVariable Id="WixUILicenseRtf" Value="$(var.ProjectDir)\adastra-licence.rtf" />
<WixVariable Id="WixUIBannerBmp" Value="$(var.ProjectDir)\Bitmaps\bannrbmp.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="$(var.ProjectDir)\Bitmaps\dlgbmp.bmp" />
<Property Id="ARPPRODUCTICON" Value="icon.ico" />
<Icon Id="icon.ico" SourceFile="$(var.ProjectDir)/App.ico"/>
<UIRef Id="WixUI_Common" />
</Fragment>