MCPcopy Index your code
hub / github.com/PDDStudio/earthview-android

github.com/PDDStudio/earthview-android @v1.1.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.1.0 ↗ · + Follow
100 symbols 166 edges 15 files 43 documented · 43%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

EarthView Android Library

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

Showcase

Screenshot

Demo Application

You can find a simple demo application in the app/ folder which you can also download here. This is not the final sample application yet, but it should be enough to show you how to integrate and use this Library.

Getting Started

Include the library into your project by adding the following line to your build.gradle: compile 'com.pddstudio:earthview-android:1.0.0'

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 (Demo Application)

About & Contact

  • In case you've a question feel free to hit me up via E-Mail (patrick.pddstudio@googlemail.com)
  • or Google+

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.

Extension points exported contracts — how you extend this code

EarthViewCallback (Interface)
This Class was created by Patrick J on 10.12.15. For more Details and Licensing have a look at the README.md [1 implementers]
earthview-android/src/main/java/com/pddstudio/earthview/EarthViewCallback.java
OnItemClickListener (Interface)
(no doc) [1 implementers]
app/src/main/java/com/pddstudio/earthviewdemo/EarthViewAdapter.java
SingleEarthViewCallback (Interface)
This Class was created by Patrick J on 10.12.15. For more Details and Licensing have a look at the README.md
earthview-android/src/main/java/com/pddstudio/earthview/SingleEarthViewCallback.java

Core symbols most depended-on inside this repo

cancelEarthViewLoadingTask
called by 2
earthview-android/src/main/java/com/pddstudio/earthview/EarthView.java
onStartedLoading
called by 2
earthview-android/src/main/java/com/pddstudio/earthview/EarthViewCallback.java
onFinishedLoading
called by 2
earthview-android/src/main/java/com/pddstudio/earthview/EarthViewCallback.java
getIdList
called by 2
earthview-android/src/main/java/com/pddstudio/earthview/utils/IdUtils.java
getApiUrl
called by 2
earthview-android/src/main/java/com/pddstudio/earthview/utils/ApiUtils.java
onItemClick
called by 1
app/src/main/java/com/pddstudio/earthviewdemo/EarthViewAdapter.java
addItem
called by 1
app/src/main/java/com/pddstudio/earthviewdemo/EarthViewAdapter.java
setOnItemClickListener
called by 1
app/src/main/java/com/pddstudio/earthviewdemo/EarthViewAdapter.java

Shape

Method 83
Class 14
Interface 3

Languages

Java100%

Modules by API surface

earthview-android/src/main/java/com/pddstudio/earthview/EarthWallpaper.java24 symbols
app/src/main/java/com/pddstudio/earthviewdemo/EarthViewAdapter.java14 symbols
earthview-android/src/main/java/com/pddstudio/earthview/EarthView.java11 symbols
app/src/main/java/com/pddstudio/earthviewdemo/MainActivity.java9 symbols
earthview-android/src/main/java/com/pddstudio/earthview/utils/SingleLoader.java7 symbols
earthview-android/src/main/java/com/pddstudio/earthview/utils/AsyncLoader.java7 symbols
earthview-android/src/main/java/com/pddstudio/earthview/utils/IdUtils.java6 symbols
earthview-android/src/main/java/com/pddstudio/earthview/EarthViewCallback.java5 symbols
earthview-android/src/main/java/com/pddstudio/earthview/SingleEarthViewCallback.java4 symbols
earthview-android/src/main/java/com/pddstudio/earthview/utils/EarthViewUtils.java3 symbols
earthview-android/src/test/java/com/pddstudio/earthview/ExampleUnitTest.java2 symbols
earthview-android/src/main/java/com/pddstudio/earthview/utils/ApiUtils.java2 symbols

For agents

$ claude mcp add earthview-android \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact