• Stars
    star
    139
  • Rank 262,954 (Top 6 %)
  • Language
    Java
  • Created almost 9 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A library to include 'EarthView with Google' into your application with ease.

EarthView Android Library

A simple and easy to use API to integrate EarthView with Google into your android application.

Android Arsenal Maven Central

Showcase

Advanced Demo Application (Beta)

To showcase the different possibilities of this library I've created a demo 'Wallpaper Application'. You can find the source for this application in the ps-app/ folder. In case you want to install the Application, feel free to do so! It's on Google Playβ„’

!! Translators needed !!

You can help translating EarthViewer into your native language via OneSkyApp: Contribute to EarthViewer

Advanced Demo Screenshot

Simple Demo Application

You can find a simple demo application in the app/ folder which you can also download here.

Getting Started

Include the library into your project by adding the following line to your build.gradle: compile 'com.pddstudio:earthview-android:[VERSION]' Note: To make sure you're using the latest version, take a look at the maven badge above

Usage

  • Implement either SingleEarthViewCallback (for a single EarthView) or EarthViewCallback (for multiple EarthViews) into your Activity, Adapter or any other class where you want to load the EarthView's.
  • Get an instance of the EarthView by calling:
EarthView.withGoogle()
  • Fire the event which fit's your needs, you'll get the results through the callback interface you provide in your project.

Fetching a single EarthView

A quick sample to fetch a single EarthView

public class MainActivity extends AppCompatActivity implements SingleEarthViewCallback {

    Button loadBtn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        loadBtn = (Button) findViewById(R.id.load_wall_btn);
        loadBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
	        //in case you want to get a random wallpaper
            EarthView.withGoogle().getRandomEarthWallpaper(MainActivity.this);
	        //in case you want to get a specific EarthWallpaper
		    EarthView.withGoogle().getEarthWallpaper(earthWallpaperIdentifier, this);
            }
        });
    }
    @Override
    public void onStartedLoading() {
        //in case you want to show a loading dialog or anything else
    }

    @Override
    public void onFinishedLoading(EarthWallpaper earthWallpaper) {
        //check whether the result is null or not
        if(earthWallpaper != null) {
            //do whatever you want to do with the EarthWallpaper object
        }
    }


}

Fetching multiple EarthViews

A quick sample to load multiple EarthViews:

public class MainActivity extends AppCompatActivity implements EarthViewCallback {

    Button loadBtn;
   
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        loadBtn = (Button) findViewById(R.id.load_wall_btn);
        loadBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                EarthView.withGoogle().getAllEarthWallpapers(MainActivity.this);
            }
        });
    }

    @Override
    public void onStartedLoading() {
		//in case you want to show a loading dialog or something else you can do this here
    }

    @Override
    public void onItemLoaded(EarthWallpaper earthWallpaper) {
        //just to be sure the result isn't null
        if(earthWallpaper != null) {
		//here you can handle what you want to do with the new item - this event get's fired every time the library has loaded a new EarthView object
        }
    }

    @Override
    public void onFinishedLoading(Collection<EarthWallpaper> earthWallpapers) {
		//here you can stop showing the loading dialog
		//in case you don't want to handle each item seperately the complete Collection of EarthWallpapers is provided here, too 
    }
}

The EarthWallpaper reference sheet

Once you received an EarthWallpaper object through the callback you can get the following information out of it:

  • The EarthView's ID (identifier - similar to the original one)
  • The EarthView's Slug
  • The EarthView's Url (Link to the official Site for this EarthView)
  • The EarthView's Title (Official Title for this EarthView)
  • The EarthView's Latitude
  • The EarthView's Longitude
  • The EarthView's Photo Url (In case you want to load it into an ImageView or save it to your storage)
  • The EarthView's Thumbnail Url (Recommended when fetching a lot of EarthViews - to reduce bandwith)
  • The EarthView's Download Url (The official Url to download this EarthView)
  • The EarthView's Region (Region where this EarthView was taken)
  • The EarthView's Country (The Country this EarthView was taken)
  • The EarthView's Attribution (Copyright information)
  • The EarthView's GoogleMaps Url (To show the direct position of this EarthView)
  • The EarthView's GoogleMaps Title (Can be used for wrapping around the GoogleMaps Url e.g)

All information can be fetched via their get-Methods. You can find more information in the EarthView JavaDoc.

Dependencies (Library)

Dependencies (Simple Demo Application)

Note: Dependencies for the Advanced Demo can be found inside the application

About & Contact

Contributors

A special thanks goes to everyone who contributed to this project!

License

Copyright 2015 Patrick J

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

More Repositories

1

EncryptedPreferences

AES-256 encrypted SharedPreferences for Android.
Java
536
star
2

highlightjs-android

A view for source code syntax highlighting on Android
CSS
310
star
3

Talk

Voice integration for Android with a fluent and easy to use interface
Java
94
star
4

StarView

A space-like animated Layout for Android inspired by StarWars
Java
87
star
5

GoogleUrlShortener

An easy to use Google URL Shortener Library
Java
69
star
6

OTGSubs

Android Application to create, edit and build Substratum Themes on your Phone
Java
38
star
7

OpenPocket

[WIP] OpenSource Android Money-Management App
Java
34
star
8

NetworkUtils

A library for various network utils on Android
Java
31
star
9

tinyIFTTT

A tiny, lightweight, easy to use and customize IFTTT (if this, then that) server and (Android) client. The ideal thing for hackers and home-automation freaks.
Java
31
star
10

phrase-java

Simple & Tiny String Template Library for Android/Java
Java
15
star
11

mdl-lightdm

A Material Design LightDM Theme
CSS
14
star
12

O-Rly-Android

An Android App to generate parody O RLY Book Covers
Java
10
star
13

SimpleThemeEngine

[DEPRECATED] Simple ThemeEngine for Android, allowing you to change your Application's theme during runtime with ease.
Java
9
star
14

hyper-nord

A Nord color scheme theme for Hyper
JavaScript
7
star
15

easyflashlight

An easy to use Flashlight library using Android's Camera2 API
Java
7
star
16

themer-android

An Android colors theme generator for themer.
JavaScript
5
star
17

android-butler

[Concept] Android Library for serving different content types with ease, Sir!
Java
4
star
18

OTGSubs-Domination

A sample for OTGSubs integration based on Domination Substratum Theme by @daveyannihilation
Java
4
star
19

iw4x-docker

Experimenting with IW4X and Docker. 🐳
Shell
3
star
20

vscode-steam-vgui

Steam's VGUI Language Support & Code Snippets for Visual Studio Code
3
star
21

get-csgo-inventory

A simple npm package to query a user's CSGO inventory
TypeScript
2
star
22

ZooperUtils

Android Library for Zooper Dashboards.
Java
2
star
23

shelljs-plugin-bash-exec

A ShellJS plugin to execute commands using bash.
JavaScript
1
star
24

Share

[WIP] Android library to implement content-sharing possibility into your application with ease
Java
1
star
25

brbox-android

[WIP] Android App to communicate with the BrBox (Raspberry-Image)
Java
1
star
26

simple-request-parser

Simple version to parse the requests generated from the iconmanager library
Java
1
star
27

timefmt

πŸ•“ A tiny command line utility for time conversion
JavaScript
1
star