Android Open Source - MaterialDemo Data






From Project

Back to project page MaterialDemo.

License

The source code is released under:

Apache License

If you think the Android project MaterialDemo listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.epam.dziashko.aliaksei.materialdemo.data;
//  www . j  av a2s.  co m
import java.util.ArrayList;
import java.util.Random;

public class Data {

    private static final String URL_FORMAT = "http://robohash.org/terminator-%d.png";

    private static final String URL_FORMAT_CATS = "http://placekitten.com/%d0/%d0";

    public static String getImageUrl() {
        Random random = new Random();
        return String.format(URL_FORMAT, random.nextInt(50));
    }

    public static ArrayList<String> getImageList(int size) {
        ArrayList<String> list = new ArrayList<String>(size);
        for (int i = 0; i < size; i++) {
            list.add(getImageUrl());
        }
        return list;
    }

    public static ArrayList<String> getKittiesList(int size) {
        ArrayList<String> list = new ArrayList<String>(size);
        for (int i = 0; i < size; i++) {
            list.add(getRandomKittyUrl());
        }
        return list;
    }

    private static String getRandomKittyUrl() {
        Random random = new Random();
        return String.format(URL_FORMAT_CATS, random.nextInt((50 - 20) + 1) + 20, random.nextInt((50 - 20) + 1) + 20);
    }
}




Java Source Code List

com.epam.dziashko.aliaksei.materialdemo.ApplicationTest.java
com.epam.dziashko.aliaksei.materialdemo.DetailActivity.java
com.epam.dziashko.aliaksei.materialdemo.MainActivity.java
com.epam.dziashko.aliaksei.materialdemo.adapter.BaseArrayAdapter.java
com.epam.dziashko.aliaksei.materialdemo.adapter.Function.java
com.epam.dziashko.aliaksei.materialdemo.adapter.IBaseAdapter.java
com.epam.dziashko.aliaksei.materialdemo.data.Data.java
com.epam.dziashko.aliaksei.materialdemo.fragment.GridFragment.java
com.epam.dziashko.aliaksei.materialdemo.fragment.PagerFragment.java
com.epam.dziashko.aliaksei.materialdemo.fragment.RecyclerViewFragment.java
com.epam.dziashko.aliaksei.materialdemo.fragment.ToolbarFragment.java
com.epam.dziashko.aliaksei.materialdemo.view.SlidingTabLayout.java
com.epam.dziashko.aliaksei.materialdemo.view.SlidingTabStrip.java