Back to project page RoboBinding-album-sample.
The source code is released under:
Apache License
If you think the Android project RoboBinding-album-sample listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.robobinding.albumsampletest; //from w ww . ja va2 s . c o m import java.util.Random; import org.robobinding.albumsample.model.Album; /** * * @since 1.0 * @version $Revision: 1.0 $ * @author Cheng Wei */ public class AlbumTestData { public static Album createAlbum() { boolean classical = new Random().nextBoolean(); if (classical) { return createClassicalAlbum(); } else { return createNonClassicalAlbum(); } } public static Album createClassicalAlbum() { int index = nextUniqueIndex(); Album.Builder albumBuilder = newAlbumBuilder(index); albumBuilder.setClassical(true); albumBuilder.setComposer("Composer " + index); return albumBuilder.create(); } public static Album createNonClassicalAlbum() { int index = nextUniqueIndex(); Album.Builder albumBuilder = newAlbumBuilder(index); return albumBuilder.create(); } private static Album.Builder newAlbumBuilder(int index) { Album.Builder albumBuilder = new Album.Builder(); albumBuilder.setArtist("Artist " + index); albumBuilder.setTitle("Album " + index); return albumBuilder; } private static int uniqueIndex = 1; private static int nextUniqueIndex() { return uniqueIndex++; } }