Devlog

Change Android homeAsUpIndicator icon in Titanium

For a project I wanted to show a hamburger menu icon in the main screen that shows a navigation drawer. The steps I did: I manually enabled the displayHomeAsUp property of the ActionBar and handled the onHomeIconItemSelected event to show the navigation drawer: $.mainWindow.activity.actionBar.displayHomeAsUp = true; $.mainWindow.activity.actionBar.onHomeIconItemSelected = function() { onMenu(); }; And also replaced the “back” […]

Remove shadow Android ActionBar

If you want to remove the shadow below the ActionBar (for example in the AppCompat.Light theme), first create a style: <style name=”ThemeActionBarWithoutShadow” parent=”@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse”> <item name=”elevation”>0dp</item> <!–<item name=”android:elevation”>0dp</item>–> </style> And then reference it from within a theme: <style name=”ThemeDefault” parent=”Theme.AppCompat.Light”> <item name=”colorPrimary”>#F2E49F</item> <item name=”colorPrimaryDark”>#F2E49F</item> <item name=”actionBarStyle”>@style/ThemeActionBarWithoutShadow</item> </style>

Android emulator screenshot

A simple way to take screenshots of your Android emulator: adb shell /system/bin/screencap -p /sdcard/screenshot.png adb pull /sdcard/screenshot.png screenshot.png

Laravel and SVN

Laravel assumes you’re using GIT to handle version control. Here is a guideline to fix it for SVN. In short: just add all the files and directories named  in the .gitignore files to the SVN ignore list. Add the contents of the following directories to the ignore list (so the directories will be in version […]

Remove web middleware for API in Laravel

The web middleware is by default loaded for ebery route in the app/Http/routes.php file. If you create an API, you mostly don’t need all the things this web middleware is loading, like cookie sessions and CRSF protection. To create routes for the API: Create a new app/Http/routes-api.php file and add the routes for the API. […]

CLI import new project Titanium Appcelerator

If get the error “Application not registered” after trying to build a Titanium Project, you can use the following command to register the app from the CLI: appc new –import

Update cache with ServiceWorker

There are many examples of updating the cache of a service worker, but they all assume you want to create a new cache. Most of the time, you only want to update just 1 or 2 files, like a stylesheet and some javascript file. A simpler approach for this is to just use the same […]

HTML5 history

For a web application I am developing (Courser) I need to control the history. The application can run in a browser but also as a “standalone” web app in Chrome and Safari. As a standalone app you have no navigation buttons, but I wanted to make the Android Back button work like expected and the […]

Titanium webview and local content

Working with local HTML, Javascript and CSS files in a webview can be very tricky in Titanium Appcelerator for a few reasons: The path to the HTML file is different on iOS and Android. Javascript files are optimized and encrypted during compiling stage. Only Javascript files that are referenced from within HTML files are left […]

Laravel dynamically detect environment

Laravel 5.2 comes with a .env file and tells you to not check it in. The idea behind it, is that you will have another .env file on your development, testing and production server. But if you want to dynamically detect and set your environment, this does not work too well. To make dynamically detection and […]