Random image selection

This commit is contained in:
mandlm 2015-12-16 12:59:30 +01:00
parent b3bcaa77bd
commit 0099fcbe51
3 changed files with 10 additions and 1 deletions

View File

@ -1,5 +1,9 @@
package net.molez.mandlm.fotostream.server; package net.molez.mandlm.fotostream.server;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import com.google.gwt.user.server.rpc.RemoteServiceServlet; import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import net.molez.mandlm.fotostream.client.CurrentImageURLService; import net.molez.mandlm.fotostream.client.CurrentImageURLService;
@ -9,6 +13,11 @@ public class CurrentImageURLServiceImpl extends RemoteServiceServlet implements
{ {
public String getCurrentImageURL() public String getCurrentImageURL()
{ {
return "img/dummy.jpg"; List<String> fileList = new ArrayList<String>();
fileList.add("img/dummy_1.jpg");
fileList.add("img/dummy_2.jpg");
return fileList.get(new Random().nextInt(fileList.size()));
} }
} }

View File

Before

Width:  |  Height:  |  Size: 733 KiB

After

Width:  |  Height:  |  Size: 733 KiB

BIN
war/img/dummy_2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB