Monday, 21 November 2016

Android material theme text input - changing colours of underline and floating label

Android styling/theming is an unholy mess, and I battled once again today with trying to get an input field to look like this:


This is how it's done - the important thing to note is that these style items go on your main app theme. Applying them directly to a specific input-field-only style/theme will not work.


Thursday, 3 November 2016

Android configuration qualifiers for alternative resources

I discovered today that there's loads more configuration qualifiers for providing alternative Android resources than I was aware of. Here's a handy table, taken from here.


Configuration
Example Qualifier Values
MCC and MNC
Examples:mcc310
mcc310-mnc004
mcc208-mnc00
etc.
Language and region
Examples:en
fr
en-rUS
fr-rFR
fr-rCA
etc.
Layout Direction
ldrtl
ldltr
smallestWidth
swdp

Examples:
sw320dp
sw600dp
sw720dp
etc.
Available width
wdp

Examples:
w720dp
w1024dp
etc.
Available height
hdp

Examples:
h720dp
h1024dp
etc.
Screen size
small
normal
large
xlarge
Screen aspect
long
notlong
Round screen
round
notround
Screen orientation
port
land
UI mode
car
desk
television
appliancewatch
Night mode
night
notnight
Screen pixel density (dpi)
ldpi
mdpi
hdpi
xhdpi
xxhdpi
xxxhdpi
nodpi
tvdpi
anydpi
Touchscreen type
notouch
finger
Keyboard availability
keysexposed
keyshidden
keyssoft
Primary text input method
nokeys
qwerty
12key
Navigation key availability
navexposed
navhidden
Primary non-touch navigation method
nonav
dpad
trackball
wheel
Platform Version (API level)
Examples:v3
v4
v7
etc.

Monday, 31 October 2016

Creating a Toast equivalent in Xamarin iOS

I love Android's toast - the UI widget that allows us to tell the user something. It's simple and accessible, and something iOS lacks unless you find a plugin of some sort.

I've started a new app build recently, using Xamarin with native Android and iOS interfaces, and it was with great joy today that I found a Xamarin toast component for iOS.

Really simple to use with a using ToastIOS statement, and then the following kind of call:
Toast.MakeText("Toast!", Toast.LENGTH_LONG)
.SetFontSize(10)
.SetGravity(ToastGravity.Center)
.Show(ToastType.None);

Wednesday, 21 September 2016

Cordova phone keyboard 'Go' button event

If you need to capture the keyboard's 'Go' button event to automatically submit your form, do something like this, where I'm capturing keypresses during password field focus and checking to see if it's the Go button:

 $('#loginPassword').on('keypress',function(e){ if (e.keyCode == 13)
                {
                    loginPress(); 
                } });

Monday, 29 August 2016

Headspace app store subscription phishing scam

I got quite a convincing phishing email today, it looked like a legit app store receipt for the Headspace, for £9.99. Many of the links go to Apple, and the link at the bottom 'Cancel and Manage my subscriptions' goes to something that looks like the App Store, but had my email address appended to the end.

I removed my address and visited the link http://rdr34623.3ls-secureapp.com/index.php If you input realistic data, it asks you for more information about yourself, and you may think you're correcting your erroneous headspace subscription.

If however, like me, you put in something like f***off@youscammers.com they redirect you to google with a search for something child-porn related. These people are real nice huh.

Tuesday, 12 July 2016

JQuery mobile go back in history using Javascript

It's not clear at all in the documentation, but here it is:
$.mobile.back();
And if you want to use this to make the Android back button work properly on your Cordova app, do this:

document.addEventListener("backbutton", onBackKeyDown, false);
        function onBackKeyDown() {
            $.mobile.back();
        }