├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ ├── colors.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ └── styles.xml
│ │ │ ├── values-w820dp
│ │ │ │ └── dimens.xml
│ │ │ ├── values-v21
│ │ │ │ └── styles.xml
│ │ │ ├── menu
│ │ │ │ └── menu_main.xml
│ │ │ └── layout
│ │ │ │ ├── content_main.xml
│ │ │ │ └── activity_main.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── streetview
│ │ │ └── io
│ │ │ └── MainActivity.java
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── streetview
│ │ │ └── io
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── streetview
│ │ └── io
│ │ └── ApplicationTest.java
├── proguard-rules.pro
└── build.gradle
├── library
├── .gitignore
├── gradle.properties
├── src
│ ├── main
│ │ ├── res
│ │ │ └── values
│ │ │ │ └── strings.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── io
│ │ │ └── bal
│ │ │ └── ihsan
│ │ │ └── streetapi
│ │ │ └── api
│ │ │ ├── base
│ │ │ ├── CallBack.java
│ │ │ └── StreetView.java
│ │ │ └── StreetApi.java
│ └── androidTest
│ │ └── java
│ │ └── io
│ │ └── bal
│ │ └── ihsan
│ │ └── streetapi
│ │ └── ApplicationTest.java
├── proguard-rules.pro
├── build.gradle
└── gradle-maven-push.gradle
├── settings.gradle
├── .gitignore
├── images
└── device-istanbul_view.png
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .travis.yml
├── gradle.properties
├── README.md
└── LICENSE
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/library/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':library'
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | /local.properties
3 | /.idea/workspace.xml
4 | /.idea/libraries
5 | .DS_Store
6 | /build
--------------------------------------------------------------------------------
/images/device-istanbul_view.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ihsanbal/StreetView/HEAD/images/device-istanbul_view.png
--------------------------------------------------------------------------------
/library/gradle.properties:
--------------------------------------------------------------------------------
1 | POM_NAME=Google Street View API Library
2 | POM_ARTIFACT_ID=library
3 | POM_PACKAGING=aar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ihsanbal/StreetView/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/library/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Library
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ihsanbal/StreetView/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ihsanbal/StreetView/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ihsanbal/StreetView/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ihsanbal/StreetView/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ihsanbal/StreetView/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | SampleApp
3 | Settings
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Oct 21 11:34:03 PDT 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 16dp
6 |
7 |
--------------------------------------------------------------------------------
/library/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/test/java/com/streetview/io/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.streetview.io;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/streetview/io/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.streetview.io;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/library/src/androidTest/java/io/bal/ihsan/streetapi/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package io.bal.ihsan.streetapi;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/library/src/main/java/io/bal/ihsan/streetapi/api/base/CallBack.java:
--------------------------------------------------------------------------------
1 | package io.bal.ihsan.streetapi.api.base;
2 |
3 | import android.graphics.Bitmap;
4 |
5 | import com.squareup.okhttp.ResponseBody;
6 |
7 | import retrofit.Response;
8 | import retrofit.Retrofit;
9 |
10 | /**
11 | * Created by Admin on 31/12/15.
12 | */
13 | public interface CallBack {
14 | void onResponse(Response response, Retrofit retrofit, Bitmap bitmapStreetView);
15 |
16 | void onFailure(Throwable t);
17 | }
18 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: android
2 | android:
3 | components:
4 | - tools
5 | - platform-tools
6 | - build-tools-23.0.2
7 | - android-23
8 | - extra-android-m2repository
9 | - extra-android-support
10 |
11 | licenses:
12 | - 'android-sdk-license.*'
13 |
14 | jdk:
15 | - openjdk7
16 | - oraclejdk7
17 |
18 | sudo: false
19 |
20 | script: 'travis_retry ./gradlew build --parallel'
21 |
22 | after_success:
23 | - scripts/travis-sonatype-publish.sh
24 | - ./gradlew jacocoTestReport coveralls
25 |
26 | cache:
27 | directories:
28 | - $HOME/.gradle/caches
--------------------------------------------------------------------------------
/library/src/main/java/io/bal/ihsan/streetapi/api/StreetApi.java:
--------------------------------------------------------------------------------
1 | package io.bal.ihsan.streetapi.api;
2 |
3 | import com.squareup.okhttp.ResponseBody;
4 |
5 | import retrofit.Call;
6 | import retrofit.http.GET;
7 | import retrofit.http.Query;
8 | import retrofit.http.Streaming;
9 |
10 | /**
11 | * Created by Admin on 31/12/15.
12 | */
13 | public interface StreetApi {
14 | @GET("/maps/api/streetview?")
15 | @Streaming
16 | Call getStreetView(@Query("size") String size, @Query("location") String location,
17 | @Query("heading") String heading, @Query("pitch") String pitch,
18 | @Query("fov") String fov, @Query("key") String key);
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/Admin/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/library/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/Admin/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
20 |
21 |
--------------------------------------------------------------------------------
/library/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion rootProject.ext.compileSdkVersion as Integer
5 | buildToolsVersion rootProject.ext.buildToolsVersion as String
6 |
7 | lintOptions {
8 | abortOnError false
9 | }
10 |
11 | defaultConfig {
12 | minSdkVersion rootProject.ext.minSdkVersion as Integer
13 | targetSdkVersion rootProject.ext.targetSdkVersion as Integer
14 | versionCode rootProject.ext.versionCode as Integer
15 | versionName rootProject.ext.versionName as String
16 | }
17 | compileOptions {
18 | sourceCompatibility JavaVersion.VERSION_1_7
19 | targetCompatibility JavaVersion.VERSION_1_7
20 | }
21 | }
22 |
23 | dependencies {
24 | compile "com.squareup.retrofit:retrofit:${rootProject.retrofitLastLibVersion}"
25 | }
26 |
27 | apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'
28 |
29 | afterEvaluate {
30 | androidJavadocs.classpath += project.android.libraryVariants.toList().first().javaCompile.classpath
31 | }
32 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion rootProject.ext.compileSdkVersion as Integer
5 | buildToolsVersion rootProject.ext.buildToolsVersion as String
6 |
7 | lintOptions {
8 | abortOnError false
9 | }
10 |
11 | defaultConfig {
12 | applicationId "io.ihsan.bal.streetapi"
13 | minSdkVersion rootProject.ext.minSdkVersion as Integer
14 | targetSdkVersion rootProject.ext.targetSdkVersion as Integer
15 | versionCode rootProject.ext.versionCode as Integer
16 | versionName rootProject.ext.versionName as String
17 | }
18 | compileOptions {
19 | sourceCompatibility JavaVersion.VERSION_1_7
20 | targetCompatibility JavaVersion.VERSION_1_7
21 | }
22 | }
23 |
24 | repositories {
25 | maven { url "https://jitpack.io" }
26 | }
27 |
28 | dependencies {
29 | compile fileTree(dir: 'libs', include: ['*.jar'])
30 | testCompile 'junit:junit:4.12'
31 | compile 'com.android.support:appcompat-v7:23.1.0'
32 | compile 'com.android.support:design:23.1.0'
33 | compile 'com.github.ihsanbal:StreetView:2.0.0'
34 | //compile project(':library')
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
15 |
16 |
22 |
23 |
24 |
25 |
26 |
27 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 |
20 | VERSION_NAME=1.0.0
21 | VERSION_CODE=1
22 | GROUP=io.bal.ihsan.streetapi
23 |
24 | NEXUS_USERNAME=chrisbanes
25 | NEXUS_PASSWORD=g00dtry
26 |
27 | signing.keyId=ABCDEF12
28 | signing.password=n1c3try
29 | signing.secretKeyRingFile=~/.gnupg/secring.gpg
30 |
31 | POM_DESCRIPTION=Google Street View API Library
32 | POM_URL=https://github.com/ihsanbal/StreetView
33 | POM_SCM_URL=https://github.com/ihsanbal/StreetView
34 | POM_SCM_CONNECTION=scm:git@github.com:ihsanbal/StreetView.git
35 | POM_SCM_DEV_CONNECTION=scm:git@github.com:ihsanbal/StreetView.git
36 | POM_LICENCE_NAME=The Apache Software License, Version 2.0
37 | POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
38 | POM_LICENCE_DIST=repo
39 | POM_DEVELOPER_ID=ihsanbal
40 | POM_DEVELOPER_NAME=Ihsan BAL
41 |
42 | ANDROID_BUILD_TARGET_SDK_VERSION=23
43 | ANDROID_BUILD_TOOLS_VERSION=23.0.2
44 | ANDROID_BUILD_SDK_VERSION=23
--------------------------------------------------------------------------------
/app/src/main/java/com/streetview/io/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.streetview.io;
2 |
3 | import android.graphics.Bitmap;
4 | import android.os.Bundle;
5 | import android.support.design.widget.FloatingActionButton;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.support.v7.widget.Toolbar;
8 | import android.view.Menu;
9 | import android.view.MenuItem;
10 | import android.view.View;
11 | import android.widget.ImageView;
12 |
13 | import com.squareup.okhttp.ResponseBody;
14 |
15 | import io.bal.ihsan.streetapi.api.base.CallBack;
16 | import io.bal.ihsan.streetapi.api.base.StreetView;
17 | import retrofit.Response;
18 | import retrofit.Retrofit;
19 |
20 |
21 | public class MainActivity extends AppCompatActivity {
22 |
23 | ImageView streetViewContainer;
24 |
25 | @Override
26 | protected void onCreate(Bundle savedInstanceState) {
27 | super.onCreate(savedInstanceState);
28 | setContentView(R.layout.activity_main);
29 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
30 | setSupportActionBar(toolbar);
31 |
32 | streetViewContainer = (ImageView) findViewById(R.id.streetImageContainer);
33 |
34 | FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
35 | fab.setOnClickListener(new View.OnClickListener() {
36 | @Override
37 | public void onClick(View view) {
38 | StreetView streetView = new StreetView.Builder("ApiKey")
39 | .pitch("-0.76")
40 | .heading("80.0")
41 | .size("600x450")
42 | .fov("90")
43 | .build();
44 |
45 | streetView.getStreetView(41.0421119, 29.0379787, new CallBack() {
46 | @Override
47 | public void onResponse(Response response, Retrofit retrofit, Bitmap bitmapStreetView) {
48 | streetViewContainer.setImageBitmap(bitmapStreetView);
49 | }
50 |
51 | @Override
52 | public void onFailure(Throwable t) {
53 | t.printStackTrace();
54 | }
55 | });
56 | }
57 | });
58 | }
59 |
60 | @Override
61 | public boolean onCreateOptionsMenu(Menu menu) {
62 | // Inflate the menu; this adds items to the action bar if it is present.
63 | getMenuInflater().inflate(R.menu.menu_main, menu);
64 | return true;
65 | }
66 |
67 | @Override
68 | public boolean onOptionsItemSelected(MenuItem item) {
69 | // Handle action bar item clicks here. The action bar will
70 | // automatically handle clicks on the Home/Up button, so long
71 | // as you specify a parent activity in AndroidManifest.xml.
72 | int id = item.getItemId();
73 |
74 | //noinspection SimplifiableIfStatement
75 | if (id == R.id.action_settings) {
76 | return true;
77 | }
78 |
79 | return super.onOptionsItemSelected(item);
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/library/gradle-maven-push.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Chris Banes
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | apply plugin: 'maven'
18 | apply plugin: 'signing'
19 |
20 | def isReleaseBuild() {
21 | return VERSION_NAME.contains("SNAPSHOT") == false
22 | }
23 |
24 | def getReleaseRepositoryUrl() {
25 | return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
26 | : "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
27 | }
28 |
29 | def getSnapshotRepositoryUrl() {
30 | return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
31 | : "https://oss.sonatype.org/content/repositories/snapshots/"
32 | }
33 |
34 | def getRepositoryUsername() {
35 | return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
36 | }
37 |
38 | def getRepositoryPassword() {
39 | return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
40 | }
41 |
42 | afterEvaluate { project ->
43 | uploadArchives {
44 | repositories {
45 | mavenDeployer {
46 | beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
47 |
48 | pom.groupId = GROUP
49 | pom.artifactId = POM_ARTIFACT_ID
50 | pom.version = VERSION_NAME
51 |
52 | repository(url: getReleaseRepositoryUrl()) {
53 | authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
54 | }
55 | snapshotRepository(url: getSnapshotRepositoryUrl()) {
56 | authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
57 | }
58 |
59 | pom.project {
60 | name POM_NAME
61 | packaging POM_PACKAGING
62 | description POM_DESCRIPTION
63 | url POM_URL
64 |
65 | scm {
66 | url POM_SCM_URL
67 | connection POM_SCM_CONNECTION
68 | developerConnection POM_SCM_DEV_CONNECTION
69 | }
70 |
71 | licenses {
72 | license {
73 | name POM_LICENCE_NAME
74 | url POM_LICENCE_URL
75 | distribution POM_LICENCE_DIST
76 | }
77 | }
78 |
79 | developers {
80 | developer {
81 | id POM_DEVELOPER_ID
82 | name POM_DEVELOPER_NAME
83 | }
84 | }
85 | }
86 | }
87 | }
88 | }
89 |
90 | signing {
91 | required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
92 | sign configurations.archives
93 | }
94 |
95 | task androidJavadocs(type: Javadoc) {
96 | source = android.sourceSets.main.java.srcDirs
97 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
98 | }
99 |
100 | task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
101 | classifier = 'javadoc'
102 | from androidJavadocs.destinationDir
103 | }
104 |
105 | task androidSourcesJar(type: Jar) {
106 | classifier = 'sources'
107 | from android.sourceSets.main.java.sourceFiles
108 | }
109 |
110 | artifacts {
111 | archives androidSourcesJar
112 | archives androidJavadocsJar
113 | }
114 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | StreetView
2 | =======
3 | Google Street View Image API Android Library -
4 | StreetView use the [Retrofit](https://github.com/square/retrofit)
5 |
6 |
7 |
8 |
9 |
10 | [](https://github.com/ihsanbal/StreetView/blob/master/LICENSE)
11 | [](http://android-arsenal.com/details/1/2972)
12 | [](https://android-arsenal.com/api?level=9)
13 | [](https://github.com/ihsanbal/StreetView/releases/tag/2.0.0)
14 | [](https://jitpack.io/#ihsanbal/StreetView)
15 |
16 | Usage
17 | --------
18 |
19 | ```java
20 |
21 | StreetView streetView = new StreetView.Builder("ApiKey")
22 | .pitch("-0.76")
23 | .heading("80.0")
24 | .size("600x400")
25 | .fov("90")
26 | .build();
27 |
28 | streetView.getStreetView(41.0421119, 29.0379787, new CallBack() {
29 | @Override
30 | public void onResponse(Response response, Retrofit retrofit, Bitmap bitmapStreetView) {
31 | //TODO : Stream image from response or use bitmapStreetView bitmap
32 | }
33 |
34 | @Override
35 | public void onFailure(Throwable t) {
36 | t.printStackTrace();
37 | }
38 | });
39 |
40 | ```
41 |
42 | Update app build.gradle with
43 | ```
44 | ext {
45 | retrofitLastLibVersion = "2.0.0-beta2" //Retrofit last version
46 | }
47 | ```
48 |
49 | Download
50 | --------
51 |
52 | Download [the latest AAR][2] or grab via Gradle:
53 | ```groovy
54 | repositories {
55 | maven {
56 | url "https://jitpack.io"
57 | }
58 | }
59 |
60 | dependencies {
61 | compile 'com.github.ihsanbal:StreetView:2.0.0'
62 | }
63 | ```
64 | or Maven:
65 | ```xml
66 |
67 | jitpack.io
68 | https://jitpack.io
69 |
70 |
71 |
72 | com.github.ihsanbal
73 | StreetView
74 | 2.0.0
75 |
76 | ```
77 |
78 | ##[Screenshot](https://github.com/ihsanbal/StreetView/blob/master/images/device-istanbul_view.png)
79 |
80 | Pic form [istanbul](https://www.google.com.tr/maps/place/%C4%B0stanbul/@41.02881,28.946502,3a,75y,90t/data=!3m8!1e2!3m6!1s87258476!2e1!3e10!6s%2F%2Flh6.googleusercontent.com%2Fproxy%2FJOnyZ62VmmGhlqtu5FwscwAxSc9rCB0ptWdxKyF47Cs9wpPRZ6U8rfLgweSv3eU8sZsKK-9SOGISndy3eyX44SbQwBSC-w%3Dw139-h86!7i4704!8i2900!4m2!3m1!1s0x14caa7040068086b:0xe1ccfe98bc01b0d0!6m1!1e1?hl=tr)
81 |
82 |
83 |
84 |
85 |
86 | Know More About Street View Image API
87 | -------------------------------------
88 | >* [Developer's Guide](https://developers.google.com/maps/documentation/streetview/intro)
89 |
90 | >* [Get A Key And Signature](https://developers.google.com/maps/documentation/streetview/intro)
91 |
92 | >* [Usage Limits](https://developers.google.com/maps/documentation/streetview/usage-limits)
93 |
94 |
95 | Licence
96 | --------------
97 | Copyright [2015]() [İHSAN BAL](https://github.com/ihsanbal)
98 |
99 | Licensed under the Apache License, Version 2.0 (the "License");
100 | you may not use this file except in compliance with the License.
101 | You may obtain a copy of the License at
102 |
103 | http://www.apache.org/licenses/LICENSE-2.0
104 |
105 | Unless required by applicable law or agreed to in writing, software
106 | distributed under the License is distributed on an "AS IS" BASIS,
107 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
108 | See the License for the specific language governing permissions and
109 | limitations under the License.
110 |
111 | Author
112 | --------------
113 | [İHSAN BAL](https://github.com/ihsanbal)
114 |
--------------------------------------------------------------------------------
/library/src/main/java/io/bal/ihsan/streetapi/api/base/StreetView.java:
--------------------------------------------------------------------------------
1 | package io.bal.ihsan.streetapi.api.base;
2 |
3 | /**
4 | * Google Street View Image API
5 | *
6 | * Introduction
7 | *
8 | * The Google Street View Image API lets you embed a static (non-interactive) Street View panorama or
9 | * thumbnail into your web page, without the use of JavaScript. The viewport is defined with URL parameters
10 | * sent through a standard HTTP request, and is returned as a static image.
11 | *
12 | *
13 | *
14 | * https://maps.googleapis.com/maps/api/streetview?size=400x400&location=40.720032,-73.988354
15 | * &fov=90&heading=235&pitch=10
16 | * &key=YOUR_API_KEY
17 | * URL Parameters
18 | *
19 | * A Street View Image request is an HTTP URL of the following form:
20 | *
21 | * https://maps.googleapis.com/maps/api/streetview?parameters
22 | * The image is specified using request parameters. As is standard in URLs, all parameters are
23 | * separated using the ampersand (&) character. Allowed parameters and their possible values are listed below.
24 | *
25 | * Required parameters
26 | *
27 | * Either:
28 | *
29 | * location can be either a text string (such as Chagrin Falls, OH) or a lat/lng value (40.457375,-80.009353).
30 | * The Google Street View Image API will snap to the panorama photographed closest to this location. Because Street View
31 | * imagery is periodically refreshed, and photographs may be taken from slightly different
32 | * positions each time, it's possible that your location may snap to a different panorama when imagery is updated.
33 | * Or:
34 | *
35 | * pano is a specific panorama ID. These are generally stable.
36 | */
37 |
38 | import android.graphics.Bitmap;
39 | import android.graphics.BitmapFactory;
40 |
41 | import com.squareup.okhttp.ResponseBody;
42 |
43 | import java.io.BufferedInputStream;
44 | import java.io.IOException;
45 | import java.io.InputStream;
46 |
47 | import io.bal.ihsan.streetapi.api.StreetApi;
48 | import retrofit.Callback;
49 | import retrofit.Response;
50 | import retrofit.Retrofit;
51 |
52 | /**
53 | * Created by Admin on 31/12/15.
54 | */
55 | public class StreetView {
56 | //Default values
57 | private String pitch = "-0.76";
58 | private String heading = "180.0";
59 | private String size = "600x300";
60 | private String fov = "90";
61 | private String apiKey;
62 |
63 | public StreetView(Builder builder) {
64 | if (builder.pitch != null && !builder.pitch.equalsIgnoreCase(""))
65 | pitch = builder.pitch;
66 | if (builder.pitch != null && !builder.pitch.equalsIgnoreCase(""))
67 | heading = builder.heading;
68 | if (builder.pitch != null && !builder.pitch.equalsIgnoreCase(""))
69 | size = builder.size;
70 | if (builder.fov != null && !builder.fov.equalsIgnoreCase(""))
71 | fov = builder.fov;
72 | if (apiKey == null || apiKey.equalsIgnoreCase("") || apiKey.length() < 10)
73 | new RuntimeException("api key will not be null or wrong please check your api key and length");
74 | else
75 | apiKey = builder.apiKey;
76 | }
77 |
78 | public static class Builder {
79 | //Optional
80 | private String pitch = "0";
81 | private String heading = "151.78";
82 | private String size = "600x400";
83 | private String fov;
84 |
85 | //Required
86 | private final String apiKey;
87 |
88 | /**
89 | * @param apiKey key allows you to monitor your application's API usage in the [!Google Developers Console](https://developers.google.com/console/help/new/);
90 | * enables per-key instead of per-IP-address quota limits; and ensures that Google can
91 | * contact you about your application if necessary. For more information, see
92 | * Get a Key and Signature.
93 | */
94 | public Builder(String apiKey) {
95 | this.apiKey = apiKey;
96 | }
97 |
98 | /**
99 | * @param value pitch (default is 0) specifies the up or down angle of the camera relative to the Street
100 | * View vehicle. This is often, but not always, flat horizontal. Positive values angle the
101 | * camera up (with 90 degrees indicating straight up); negative values angle the camera down
102 | * (with -90 indicating straight down).
103 | */
104 | public Builder pitch(String value) {
105 | pitch = value;
106 | return this;
107 | }
108 |
109 | /**
110 | * @param value heading (default is 180.0) indicates the compass heading of the camera. Accepted values are from 0 to 360
111 | * (both values indicating North, with 90 indicating East, and 180 South). If no heading
112 | * is specified, a value will be calculated that directs the camera towards the specified
113 | * location, from the point at which the closest photograph was taken.
114 | */
115 | public Builder heading(String value) {
116 | heading = value;
117 | return this;
118 | }
119 |
120 | /**
121 | * @param value size (default is 600x400) specifies the output size of the image in pixels. Size is specified as
122 | * {width}x{height} - for example, size=600x400 returns an image 600 pixels wide, and 400 high.
123 | */
124 | public Builder size(String value) {
125 | size = value;
126 | return this;
127 | }
128 |
129 | /**
130 | * @param value fov (default is 90) determines the horizontal field of view of the image. The field of
131 | * view is expressed in degrees, with a maximum allowed value of 120. When dealing with a
132 | * fixed-size viewport, as with a Street View image of a set size, field of view in essence
133 | * represents zoom, with smaller numbers indicating a higher level of zoom.
134 | */
135 | public Builder fov(String value) {
136 | fov = value;
137 | return this;
138 | }
139 |
140 | public StreetView build() {
141 | return new StreetView(this);
142 | }
143 |
144 | }
145 |
146 | public void getStreetView(double lat, double lng, final CallBack callBack) {
147 | Retrofit retrofit = new Retrofit.Builder()
148 | .baseUrl("https://maps.googleapis.com")
149 | .build();
150 | StreetApi api = retrofit.create(StreetApi.class);
151 | api.getStreetView(size, lat + "," + lng, heading, pitch, fov, apiKey).enqueue(new Callback() {
152 | @Override
153 | public void onResponse(Response response, Retrofit retrofit) {
154 | InputStream inputStream = null;
155 | try {
156 | inputStream = response.body().byteStream();
157 | } catch (IOException e) {
158 | e.printStackTrace();
159 | callBack.onFailure(e);
160 | } finally {
161 | BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream);
162 | final Bitmap bmp = BitmapFactory.decodeStream(bufferedInputStream);
163 | callBack.onResponse(response, retrofit, bmp);
164 | }
165 | }
166 |
167 | @Override
168 | public void onFailure(Throwable t) {
169 | callBack.onFailure(t);
170 | }
171 | });
172 | }
173 |
174 | }
175 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
--------------------------------------------------------------------------------