Sharing some of the useful snippets of code i stumble across with the world. It will mostly be Android, cloud computing, ColdFusion, SQL, Amazon AWS and other web technologies. If you like what you read or it helps, drop in a comment and say so, it will be appreciated.
Showing posts with label lollipop. Show all posts
Showing posts with label lollipop. Show all posts
05 December 2014
Lollipop update for Nexus 7 (2012) - Update
I previously blogged about problems with Lollipop on my Nexus 7. After quite a few emails with Google Play support I have been promised that an update to fix this issue began roll out globally on 3rd December. So fingers crossed the many upset users out there will shortly have the problem solved. Well done Google (assuming it works).
20 November 2014
Lollipop with Nexus 7 (2012)
Just a quick one to anyone who owns the 2012 version of the Nexus 7. DON'T upgrade to Lollipop.
I got the Over the Air (OTA) update last week and put it off for a few days as I don't like to rush. Eventually I got fed up with the reminders and went ahead.
Well what a disaster, its made my Nexus 7 almost unusable. The Keyboard doesn't open for sometimes up to a minute, very few of the apps run at all and its generally slow and un-responsive.
This is a crying shame as I think Lollipop is a great release, I like the direction Android has taken. Its just a real shame Google didn't test this before pushing it out to everyone.
I got the Over the Air (OTA) update last week and put it off for a few days as I don't like to rush. Eventually I got fed up with the reminders and went ahead.
Well what a disaster, its made my Nexus 7 almost unusable. The Keyboard doesn't open for sometimes up to a minute, very few of the apps run at all and its generally slow and un-responsive.
This is a crying shame as I think Lollipop is a great release, I like the direction Android has taken. Its just a real shame Google didn't test this before pushing it out to everyone.
05 November 2014
Android ripple effect in Lollipop
Just a quick how-to today.
So Google have made a big thing of the new ripple effect in Android Lollipop.
http://android-developers.blogspot.co.uk/2014/10/implementing-material-design-in-your.html
To my eyes however it wasn't immediately clear how to implement it, particularly if you wanted your app to work in older versions of Android, which almost everyone will.
So the first point to note is android buttons automatically implement the ripple effect if you've got the material theme running. However I mostly used TextViews as buttons with custom drawables for their background and onClick state.
Second I'm not talking about getting ripple working in old versions of Android, just a graceful rollback to a pressed state.
So first create a drawable and a drawable-v21 folder under res, in each add a button_selector.xml
res/drawable/button_selector.xml
res/drawable-v21/button_selector.xml
now in your activity_main or wherever you need to add a button with a background
You'll notice the ripple xml basically incorporates the same drawables as the selector does, adding on the ripple effect.
So Google have made a big thing of the new ripple effect in Android Lollipop.
http://android-developers.blogspot.co.uk/2014/10/implementing-material-design-in-your.html
To my eyes however it wasn't immediately clear how to implement it, particularly if you wanted your app to work in older versions of Android, which almost everyone will.
So the first point to note is android buttons automatically implement the ripple effect if you've got the material theme running. However I mostly used TextViews as buttons with custom drawables for their background and onClick state.
Second I'm not talking about getting ripple working in old versions of Android, just a graceful rollback to a pressed state.
So first create a drawable and a drawable-v21 folder under res, in each add a button_selector.xml
res/drawable/button_selector.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Pressed -->
<item android:state_pressed="true" android:drawable="@color/colorPrimaryDark" />
<!-- Selected -->
<item android:state_selected="true" android:drawable="@color/colorPrimaryDark" />
<!-- Focus -->
<item android:state_focused="true" android:drawable="@color/colorPrimaryDark" />
<!-- Default -->
<item android:drawable="@color/colorPrimary"/>
</selector>
res/drawable-v21/button_selector.xml
<ripple
xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/accent">
<!-- Pressed -->
<item android:state_pressed="true" android:drawable="@color/colorPrimaryDark" />
<!-- Selected -->
<item android:state_selected="true" android:drawable="@color/colorPrimaryDark" />
<!-- Focus -->
<item android:state_focused="true" android:drawable="@color/colorPrimaryDark" />
<!-- Default -->
<item android:drawable="@color/colorPrimary"/>
</ripple>
now in your activity_main or wherever you need to add a button with a background
<TextView
android:id="@+id/activity_main_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@drawable/button_selector"
android:padding="20dp"
android:text="Button"/>
You'll notice the ripple xml basically incorporates the same drawables as the selector does, adding on the ripple effect.
Subscribe to:
Posts (Atom)