JellyBean 4.2   added a lovely little callback to the ViewPager class called the PageTransformer.  (Also available in the Compatibility Lib 11)

Big deal you may ask? Look at this:

GreenTree on Moupp – Page fades in

So the page from the right fades in and the page going left fades out! Really simple, but nice effect. Works nicely with picture pagers. Code? Sure!

            mViewPager.setPageTransformer(false, new PageTransformer()
            {
                @SuppressLint("NewApi")
                @Override
                public void transformPage(View v, float pos)
                {
                    final float invt = Math.abs(Math.abs(pos) - 1);
                    v.setAlpha(invt);
                }
            });

Lovely bit of code, we normalise the float coming in (so its always 0 to 1) then we apply that to the View.setAlpha(float) method. This works with any of the View transformation methods! (Alpha,setX/Y, rotateX/Y).

You can of course get a bit silly with this! So please be sensible, I don’t want to be seeing 360 spins on page transitions…  (yeah I’ve tried!)

Update: Damian Flannery made this neat little transition https://gist.github.com/4197613


Middleware project.

Sitting between your phone and gorgeous hi-res imagery is that rubbish thing called mobile internet!

There are few things you can do to get that content:

  1. Download the image and use it on your phone
    Of course this is just a very bad idea! Why?

    1. Huge file, slow internet connection; could be minutes before your user sees the image!
    2. Huge file saved to your users device, low mem phones; OutOfMemory error waiting to happen.
    3. Caching on the phone? Great! But, you are storing a large image that the user will never utilise… wasted space!
    4. Down scale on the phone.. OK, but then you are asking the phone to manipulate images which is not a fast task, so wasting the users CPU and subsequently battery!
  2. Have pre rendered different sized images and use based on screen size.
    This is of course a better solutions but only really works for iOS, where you need 4 image sizes.

    1. Will need 100′s of different picture sizes pre rendered
    2. More data in your web calls to be thrown around
    3. More data to be stored on your server
  3. Have one size image and let the device request the size it needs.

3. Is where I am going with this.

The idea is simple, you know were the orginal hi res image is. and you know what size you need to display to the user. Pass the source and size to the server and get a perfectly sized image back!

When I started writing this blog post this was just an idea, as of now this is a real service: http://nodesizer.jit.su/convert?size=300&source=http://api.moupp.com/media/Adiccion-bb499d58/Images/Original/165818_10150948206829360_266312854_n-bb499d58.jpg

In the above URL is the Size you want (we cleverly work out the smallest size, you can pass height in as well) the orginal image; then the server does the rest and return it to you!

300px
100px

 

Simple! Give it a try:  source and info

 


So we have a requirement, where sometimes your screen needs to be one orientation for a certain situation or screen size.. So that rules out using:

android:screenOrientation="sensorPortrait"

As this will stop your Activity from using all orientations in other sizes/views etc.

So, what do we do?

public void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState); setContentView(R.layout.main);
 //If normal do..
 setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
 //Else do something else
 setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);
 } 

Job done! You can change the orientation to your hearts content. Great for, forcing your user into full screen mode landscape when playing a video for example.


So you want to add a little flare between your custom selector states on Android? As of HoneyComb 3.0+ this is pretty easy.

Take home_tile_background_selector.xml here:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" 
 android:exitFadeDuration="@android:integer/config_mediumAnimTime">

  <item android:drawable="@drawable/home_tile_background_pressed" android:state_selected="true"/>
  <item android:drawable="@drawable/home_tile_background_pressed" android:state_pressed="true"/>
  <item android:drawable="@drawable/home_tile_background_pressed" android:state_focused="true"/>
  <item android:drawable="@drawable/home_tile_background_default"/>

</selector>

The code highlighted above in bold is the key line, this will enable those lovely fade away selectors. Android Provides a few time periods, so have play and enjoy :)


AllJoyn is a P2P networking development kit developed by Qualcomm.

The idea is simple, provide a singular communication bus that local devices can find and talk to each other on. But without the messy and slow handshaking over the internet via a server, whilst supporting many programming languages and platforms.

Meaning? Superfast, super streamlined user experience.

We had a talk with Mitch Williams from QuIC (Qualcomm Innovation Centre) at Droidcon London 2012 about the technology. He showed us some Android apps running a demo that worked flawlessly and seamlessly. We were impressed!

What makes the technology impressive is, you need no internet connection, no expensive backend servers and the platform does not matter. Phones can quite happily talk to each other via bluetooth, WiFi or Local network. As AllJoyn is fully open source and licensed under Apache 2.0, there would be nothing to stop you expanding/implementing your own connection methods.

AllJoyn are running a peer-to-peer mobile apps challenge! To find out more click here.

Via Mubaloo


This has been talked about all over the ineternet and raised in a few stack overflow questions.

But if you filtering screen sizes in your android manifest, you will need to add:


<!-- Special case for Nexus 7 -->
<screen android:screenSize="large" android:screenDensity="213" />

This enables the Nexus 7 screen for your apps, if you don’t filter your app by screen size; no need to worry, your app will work on all devices by default.


So I had a look around for a backwards compatible GridLayout for Android only to find that it’s hidden in the android sdk extras. (As of ACL v7 ADT17)

I’m wondering if it’s not been made public yet due to it not being tested, or maybe that it only works with eclair onwards (api 7).. But anyway.

It’s under your Android sdk path:

  Extras/android/compatibility/v7/gridlayout

You will need to import this as a library project as the readme suggests. Sorted.

Advantage of using this library is that ADT editor detects its included in your project and the layout editor will auto fill name space and reference the support lib.

Usage, worth looking at:
Sytling Android GridLayout
Android GridLayout API

 

Any questions feel free to ask.


So we had our poster fair today!

Oooo exciting day of projects, people, free lunch and guests!

I’m going to take this one out on a positive as I had a fairly good day.

Timetable:

1am-3:45am – BUG SQUASHING! That last minute panic, I will get my project presentable!

11am: Rise n shine

11:45: “Why arnt you dressed yet” – ‘Its 12:30 Batch, don’t worry!”

12:30: Free food – mmmm cheese – Free food – steal some cheese… and “Wait.. that’s a project?”

1:30: Mr Apple acount manager man! Yeah lets keep UoP in our pocket with a outdated slide show… boo mr apple boo.

2:00: *Grin* Shoulder to Shoulder, “Can we have your project for next year?”

3:00: “Oh so your a lecturer” – Mouth say hello to my foot!

3:20: Hi Saveen!

3:40: You didn’t win!

4:00: Go hom… *Gone*

Lets break this bad boy down!

Free Food

Students free food – always a winning combination – but sometimes needs must. In some cases *Cough* Ben/Russel *Cough* aquiring food to take home is allways a bonus. I comend you comitment to the cause you ledgends!

Mr Apple

Bored… oh there is more than “The App Store”. Sorry your loosing sales to Android and Ovi… Sore maybe… boring- definitely.

Hang on… thats a project?

Yes, I shall mention no names but I don’t consider a ‘ Torch App for Android’ a final year project… Please let me know if you do! (funnily enough not alot of people did)

Oh your a lecturer!

Well true foot in mouth moment, I was talking to a lecturer for a good 10 min’s who was very interested in the project. Upon asking what do you study here “I’m a new networking lecturer”. Ooooops! Well how was I meant to know? He should take it as a compliment… just saying he looks young.

We finish with 1 x don’t listen to Bob, “Use a high contrast posters, avoid large blocks of solid colour… what posters win? the ones with large blocks of solid colour! Note to self… Ignore Bob and do what you think looks awesome!

Anyway heres the poster for your amusement anyway!


So the basis of the Pepper Wiki Project.

I have more information to follow, but we will start off with what do we want to achieve, include and how to get that information accross to our community.

I shall write up a open document that people can feel free to comment and edit about how we should proceed with the interests of the charity and the community in the vision.

Stay tuned…