├── .gitignore
├── .idea
├── .name
├── compiler.xml
├── copyright
│ ├── apache2_0_license.xml
│ └── profiles_settings.xml
├── dictionaries
│ └── pddstudio.xml
├── gradle.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── .travis.yml
├── README.md
├── app-debug.apk
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── pddstudio
│ │ └── earthviewdemo
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── pddstudio
│ │ │ └── earthviewdemo
│ │ │ ├── EarthViewAdapter.java
│ │ │ └── MainActivity.java
│ └── res
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ ├── content_main.xml
│ │ └── earth_view_item.xml
│ │ ├── menu
│ │ └── menu_main.xml
│ │ ├── 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-v21
│ │ └── styles.xml
│ │ ├── values-w820dp
│ │ └── dimens.xml
│ │ └── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── pddstudio
│ └── earthviewdemo
│ └── ExampleUnitTest.java
├── build.gradle
├── earthview-android
├── .gitignore
├── build.gradle
├── gradle.properties
├── libs
│ └── commons-io-2.4.jar
├── maven-push.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── pddstudio
│ │ └── earthview
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── pddstudio
│ │ │ └── earthview
│ │ │ ├── EarthView.java
│ │ │ ├── EarthViewCallback.java
│ │ │ ├── EarthWallpaper.java
│ │ │ ├── SingleEarthViewCallback.java
│ │ │ ├── sync
│ │ │ └── SynchronizedTask.java
│ │ │ └── utils
│ │ │ ├── ApiUtils.java
│ │ │ ├── AsyncLoader.java
│ │ │ ├── EarthViewUtils.java
│ │ │ ├── IdUtils.java
│ │ │ └── SingleLoader.java
│ └── res
│ │ └── values
│ │ ├── info_strings.xml
│ │ └── strings.xml
│ └── test
│ └── java
│ └── com
│ └── pddstudio
│ └── earthview
│ └── ExampleUnitTest.java
├── gfx
├── hdpi
│ └── ic_launcher.png
├── mdpi
│ └── ic_launcher.png
├── playstore
│ ├── earthviewer-min.png
│ ├── ic_banner.png
│ └── ic_launcher.png
├── xhdpi
│ └── ic_launcher.png
├── xxhdpi
│ └── ic_launcher.png
└── xxxhdpi
│ └── ic_launcher.png
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── preview
├── en-play-badge.png
├── ps
│ ├── screener_20151213(21:52:46).png
│ ├── screener_20151213(21:52:56).png
│ ├── screener_20151213(21:53:28).png
│ ├── screener_20151213(21:53:42).png
│ └── screener_20151213(21:53:51).png
└── screenshot.png
├── ps-app
├── build.gradle
├── fabric.properties
├── proguard-rules.pro
├── ps-app-release.apk
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── pddstudio
│ │ └── wallpaperrecyclerdemo
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── assets
│ │ └── fonts
│ │ │ ├── OpenSans-Regular.ttf
│ │ │ ├── Roboto-Regular.ttf
│ │ │ ├── RobotoMono-Regular.ttf
│ │ │ └── RobotoSlab-Regular.ttf
│ ├── java
│ │ └── com
│ │ │ └── pddstudio
│ │ │ └── earthviewer
│ │ │ ├── AboutActivity.java
│ │ │ ├── DemoActivity.java
│ │ │ ├── EarthViewAdapter.java
│ │ │ ├── FavoritesActivity.java
│ │ │ ├── FavoritesActivityPre.java
│ │ │ ├── SettingsActivity.java
│ │ │ ├── SettingsActivityPre.java
│ │ │ ├── WallpaperActivity.java
│ │ │ ├── WallpaperActivityPre.java
│ │ │ ├── muzei
│ │ │ ├── EarthViewerSource.java
│ │ │ ├── MuzeiPreferences.java
│ │ │ └── MuzeiSettingsActivity.java
│ │ │ ├── utils
│ │ │ ├── DownloadHighResImage.java
│ │ │ ├── DownloadWallpaperTask.java
│ │ │ ├── Favorites.java
│ │ │ ├── Preferences.java
│ │ │ └── preferences
│ │ │ │ ├── ClearCachePreference.java
│ │ │ │ ├── ClearDirectoryPreference.java
│ │ │ │ ├── InfoPreferenceItem.java
│ │ │ │ └── SaveDirectoryPreference.java
│ │ │ └── views
│ │ │ ├── AboutDialog.java
│ │ │ ├── BaseDialog.java
│ │ │ ├── EarthViewScrollListener.java
│ │ │ ├── SquaredImageView.java
│ │ │ ├── about
│ │ │ ├── AboutFragment.java
│ │ │ ├── AboutFragmentCompat.java
│ │ │ └── CustomLibs.java
│ │ │ └── utils
│ │ │ ├── CustomFabBehavior.java
│ │ │ └── ScrollFabBehavior.java
│ └── res
│ │ ├── drawable-hdpi
│ │ ├── ic_info_black_24dp.png
│ │ ├── ic_notifications_black_24dp.png
│ │ └── ic_sync_black_24dp.png
│ │ ├── drawable-mdpi
│ │ ├── ic_info_black_24dp.png
│ │ ├── ic_notifications_black_24dp.png
│ │ └── ic_sync_black_24dp.png
│ │ ├── drawable-v21
│ │ ├── ic_info_black_24dp.xml
│ │ ├── ic_notifications_black_24dp.xml
│ │ └── ic_sync_black_24dp.xml
│ │ ├── drawable-xhdpi
│ │ ├── ic_info_black_24dp.png
│ │ ├── ic_notifications_black_24dp.png
│ │ └── ic_sync_black_24dp.png
│ │ ├── drawable-xxhdpi
│ │ ├── ic_info_black_24dp.png
│ │ ├── ic_notifications_black_24dp.png
│ │ └── ic_sync_black_24dp.png
│ │ ├── drawable-xxxhdpi
│ │ ├── ic_info_black_24dp.png
│ │ ├── ic_notifications_black_24dp.png
│ │ └── ic_sync_black_24dp.png
│ │ ├── drawable
│ │ ├── earthviewicon.png
│ │ └── rounded_shape.xml
│ │ ├── layout
│ │ ├── activity_about.xml
│ │ ├── activity_demo.xml
│ │ ├── activity_demo_pre.xml
│ │ ├── activity_favorites.xml
│ │ ├── activity_favorites_activity_pre.xml
│ │ ├── activity_muzei_settings.xml
│ │ ├── activity_preferences.xml
│ │ ├── activity_settings_activity_pre.xml
│ │ ├── activity_wallpaper.xml
│ │ ├── activity_wallpaper_activity_pre.xml
│ │ ├── content_about.xml
│ │ ├── content_demo.xml
│ │ ├── content_demo_pre.xml
│ │ ├── content_wallpaper.xml
│ │ ├── drawer_header.xml
│ │ ├── earthview_item.xml
│ │ └── muzei_dialog_layout.xml
│ │ ├── menu
│ │ └── wall_prev_menu.xml
│ │ ├── mipmap-hdpi
│ │ ├── earthviewicon.png
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ ├── earthviewicon.png
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ ├── earthviewicon.png
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ ├── earthviewicon.png
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── earthviewicon.png
│ │ └── ic_launcher.png
│ │ ├── transition
│ │ ├── change_image_transform.xml
│ │ └── fade_activity.xml
│ │ ├── values-v21
│ │ └── styles.xml
│ │ ├── values-w820dp
│ │ └── dimens.xml
│ │ ├── values
│ │ ├── about.xml
│ │ ├── arrays.xml
│ │ ├── attrs.xml
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── other_lib_strings.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ │ └── xml
│ │ ├── preferences.xml
│ │ └── providers.xml
│ └── test
│ └── java
│ └── com
│ └── pddstudio
│ └── wallpaperrecyclerdemo
│ └── ExampleUnitTest.java
├── settings.gradle
└── wheelview-test
├── build.gradle
└── library-release.aar
/.gitignore:
--------------------------------------------------------------------------------
1 | /ps-non-git
2 | *.iml
3 | .gradle
4 | /local.properties
5 | /.idea/workspace.xml
6 | /.idea/libraries
7 | .DS_Store
8 | .navigation
9 | /build
10 | /captures
11 | /ps-app/*.apk
12 | /ps-app/build
13 |
--------------------------------------------------------------------------------
/.idea/.name:
--------------------------------------------------------------------------------
1 | EarthViewDemo
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/copyright/apache2_0_license.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/dictionaries/pddstudio.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.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-support
9 | - extra-android-m2repository
10 | - extra-google-m2repository
11 |
12 | # Additional components
13 | #- extra-google-google_play_services
14 | #- addon-google_apis-google-19
15 |
16 | # Specify at least one system image, if you need to run emulator(s) during your tests
17 | #- sys-img-armeabi-v7a-android-19
18 | #- sys-img-x86-android-17
19 | script:
20 | - ./gradlew build
21 | licenses:
22 | - '.+'
23 |
--------------------------------------------------------------------------------
/app-debug.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/app-debug.apk
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - app
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: 'com.android.application'
18 |
19 | android {
20 | compileSdkVersion 23
21 | buildToolsVersion "23.0.2"
22 |
23 | defaultConfig {
24 | applicationId "com.pddstudio.earthviewdemo.simple"
25 | minSdkVersion 17
26 | targetSdkVersion 23
27 | versionCode 1
28 | versionName "1.0"
29 | }
30 | buildTypes {
31 | release {
32 | minifyEnabled false
33 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
34 | }
35 | }
36 | lintOptions {
37 | abortOnError false
38 | }
39 | }
40 |
41 | dependencies {
42 | compile fileTree(include: ['*.jar'], dir: 'libs')
43 | testCompile 'junit:junit:4.12'
44 | compile 'com.android.support:appcompat-v7:23.1.1'
45 | compile 'com.android.support:design:23.1.1'
46 | compile project(':earthview-android')
47 | //for showcasing the usage with picasso
48 | compile 'com.squareup.picasso:picasso:2.5.2'
49 | }
50 |
--------------------------------------------------------------------------------
/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 /home/pddstudio/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/androidTest/java/com/pddstudio/earthviewdemo/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.earthviewdemo;
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/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
20 |
21 |
22 |
23 |
29 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/app/src/main/java/com/pddstudio/earthviewdemo/EarthViewAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - app
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 | package com.pddstudio.earthviewdemo;
18 |
19 | import android.content.Context;
20 | import android.support.annotation.Nullable;
21 | import android.support.v7.widget.RecyclerView;
22 | import android.util.Log;
23 | import android.view.LayoutInflater;
24 | import android.view.View;
25 | import android.view.ViewGroup;
26 | import android.widget.ImageView;
27 | import android.widget.TextView;
28 |
29 | import com.pddstudio.earthview.EarthWallpaper;
30 | import com.squareup.picasso.Picasso;
31 |
32 | import java.util.ArrayList;
33 | import java.util.Collection;
34 | import java.util.List;
35 |
36 | /**
37 | * This Class was created by Patrick J
38 | * on 10.12.15. For more Details and Licensing
39 | * have a look at the README.md
40 | */
41 | public class EarthViewAdapter extends RecyclerView.Adapter {
42 |
43 | private List itemData;
44 | private final Context context;
45 | OnItemClickListener onItemClickListener = null;
46 |
47 | public interface OnItemClickListener {
48 | void onItemClick(View view, int position);
49 | }
50 |
51 | public EarthViewAdapter(@Nullable Collection data, Context context) {
52 | if(data == null) {
53 | this.itemData = new ArrayList<>();
54 | } else {
55 | Log.d("EarthViewAdapter", "Adapter initialized with data count: " + data.size());
56 | this.itemData = new ArrayList<>(data);
57 | }
58 | this.context = context;
59 | }
60 |
61 | @Override
62 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
63 | View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.earth_view_item, parent, false);
64 | ViewHolder viewHolder = new ViewHolder(view, onItemClickListener);
65 | return viewHolder;
66 | }
67 |
68 | @Override
69 | public void onBindViewHolder(ViewHolder holder, int position) {
70 | EarthWallpaper earthWallpaper = itemData.get(position);
71 | holder.textView.setText(earthWallpaper.getFormattedWallpaperTitle());
72 |
73 | Picasso.with(context).load(earthWallpaper.getWallThumbUrl()).into(holder.imageView);
74 | }
75 |
76 | public void addItem(EarthWallpaper wallpaper) {
77 | if(itemData != null) this.itemData.add(wallpaper);
78 | }
79 |
80 | public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
81 | this.onItemClickListener = onItemClickListener;
82 | }
83 |
84 | public boolean hasOnItemClickListener() {
85 | return this.onItemClickListener != null;
86 | }
87 |
88 | public EarthWallpaper getItemAtPosition(int position) {
89 | if(position < 0 || position >= itemData.size()) {
90 | return null;
91 | } else {
92 | return itemData.get(position);
93 | }
94 | }
95 |
96 | @Override
97 | public int getItemCount() {
98 | return itemData.size();
99 | }
100 |
101 | public static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
102 |
103 | public ImageView imageView;
104 | public TextView textView;
105 | public OnItemClickListener onItemClickListener;
106 |
107 | public ViewHolder(View itemView, OnItemClickListener onItemClickListener) {
108 | super(itemView);
109 | itemView.setClickable(true);
110 | itemView.setOnClickListener(this);
111 | imageView = (ImageView) itemView.findViewById(R.id.wall);
112 | textView = (TextView) itemView.findViewById(R.id.name);
113 | this.onItemClickListener = onItemClickListener;
114 | }
115 |
116 | @Override
117 | public void onClick(View v) {
118 | if(onItemClickListener != null) onItemClickListener.onItemClick(v, getAdapterPosition());
119 | }
120 | }
121 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
26 |
27 |
31 |
32 |
38 |
39 |
40 |
41 |
42 |
43 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
30 |
31 |
37 |
38 |
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/earth_view_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
25 |
26 |
33 |
34 |
48 |
49 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 | >
18 |
19 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
21 | 64dp
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 | #3F51B5
20 | #303F9F
21 | #FF4081
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 | 16dp
20 | 16dp
21 | 16dp
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 | EarthViewDemo
19 | Settings
20 | Click to load EarthView Images
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
26 |
27 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/test/java/com/pddstudio/earthviewdemo/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.earthviewdemo;
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 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - EarthViewDemo
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 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
18 |
19 | buildscript {
20 | repositories {
21 | jcenter()
22 | }
23 | dependencies {
24 | classpath 'com.android.tools.build:gradle:1.5.0'
25 |
26 | // NOTE: Do not place your application dependencies here; they belong
27 | // in the individual module build.gradle files
28 | }
29 | }
30 |
31 | allprojects {
32 | repositories {
33 | jcenter()
34 | maven { url "https://jitpack.io" }
35 | //maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
36 | }
37 | }
38 |
39 | task clean(type: Delete) {
40 | delete rootProject.buildDir
41 | }
42 |
--------------------------------------------------------------------------------
/earthview-android/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/earthview-android/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - earthview-android
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: 'com.android.library'
18 | apply from: 'maven-push.gradle'
19 |
20 | android {
21 | compileSdkVersion 23
22 | buildToolsVersion "23.0.2"
23 |
24 | defaultConfig {
25 | minSdkVersion 17
26 | targetSdkVersion 23
27 | versionCode 4
28 | versionName "1.2.0"
29 | }
30 | buildTypes {
31 | release {
32 | minifyEnabled false
33 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
34 | }
35 | }
36 | lintOptions {
37 | abortOnError false
38 | }
39 | }
40 |
41 | dependencies {
42 | compile fileTree(dir: 'libs', include: ['*.jar'])
43 | testCompile 'junit:junit:4.12'
44 | compile 'com.android.support:appcompat-v7:23.1.1'
45 | //gson for json parsing
46 | compile 'com.google.code.gson:gson:2.5'
47 | //for wallpapers
48 | compile 'com.squareup.okhttp:okhttp:2.6.0'
49 | compile 'com.squareup.okhttp:okhttp-urlconnection:2.6.0'
50 | }
51 |
--------------------------------------------------------------------------------
/earthview-android/gradle.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2015 - Patrick J - earthview-android
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 | POM_NAME=EarthView Android
18 | POM_ARTIFACT_ID=earthview-android
19 | POM_PACKAGING=aar
--------------------------------------------------------------------------------
/earthview-android/libs/commons-io-2.4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/earthview-android/libs/commons-io-2.4.jar
--------------------------------------------------------------------------------
/earthview-android/maven-push.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - earthview-android
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.allJava
97 | //}
98 |
99 | //task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
100 | //classifier = 'javadoc'
101 | //from androidJavadocs.destinationDir
102 | //}
103 |
104 | task androidSourcesJar(type: Jar) {
105 | classifier = 'sources'
106 | from android.sourceSets.main.java.sourceFiles
107 | }
108 |
109 | artifacts {
110 | archives androidSourcesJar
111 | }
112 | }
--------------------------------------------------------------------------------
/earthview-android/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 /home/pddstudio/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 |
--------------------------------------------------------------------------------
/earthview-android/src/androidTest/java/com/pddstudio/earthview/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.earthview;
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 | }
--------------------------------------------------------------------------------
/earthview-android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/earthview-android/src/main/java/com/pddstudio/earthview/EarthViewCallback.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - earthview-android
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 | package com.pddstudio.earthview;
18 |
19 | import java.util.Collection;
20 |
21 | /**
22 | * This Class was created by Patrick J
23 | * on 10.12.15. For more Details and Licensing
24 | * have a look at the README.md
25 | */
26 | public interface EarthViewCallback {
27 | void onStartedLoading(int totalItemSize);
28 | void onItemLoaded(EarthWallpaper earthWallpaper);
29 | void onFinishedLoading(Collection earthWallpapers);
30 | void onCancelledLoading(Collection earthWallpapers);
31 | }
32 |
--------------------------------------------------------------------------------
/earthview-android/src/main/java/com/pddstudio/earthview/SingleEarthViewCallback.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - earthview-android
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 | package com.pddstudio.earthview;
18 |
19 | import android.support.annotation.Nullable;
20 |
21 | /**
22 | * This Class was created by Patrick J
23 | * on 10.12.15. For more Details and Licensing
24 | * have a look at the README.md
25 | */
26 | public interface SingleEarthViewCallback {
27 | void onStartedLoading();
28 | void onFinishedLoading(@Nullable EarthWallpaper earthWallpaper);
29 | void onCancelledLoading();
30 | }
31 |
--------------------------------------------------------------------------------
/earthview-android/src/main/java/com/pddstudio/earthview/sync/SynchronizedTask.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - earthview-android
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 | package com.pddstudio.earthview.sync;
18 |
19 | import android.util.Log;
20 |
21 | import com.google.gson.Gson;
22 | import com.pddstudio.earthview.EarthView;
23 | import com.pddstudio.earthview.EarthWallpaper;
24 | import com.pddstudio.earthview.utils.ApiUtils;
25 | import com.pddstudio.earthview.utils.IdUtils;
26 | import com.squareup.okhttp.OkHttpClient;
27 | import com.squareup.okhttp.Request;
28 | import com.squareup.okhttp.Response;
29 |
30 | import java.io.IOException;
31 |
32 | /**
33 | * This Class was created by Patrick J
34 | * on 16.12.15. For more Details and Licensing
35 | * have a look at the README.md
36 | */
37 | public class SynchronizedTask {
38 |
39 | private final OkHttpClient okHttpClient = new OkHttpClient();
40 | private final Gson gson = new Gson();
41 |
42 | private final EarthWallpaper[] results;
43 | private final boolean multipleRequests;
44 | private final boolean randomRequests;
45 | private final int earthWallpaperCount;
46 | private final String[] earthWallIds;
47 |
48 | private SynchronizedTask(EarthView.SynchronizedBuilder synchronizedBuilder) {
49 | //for debugging only
50 | Log.d("SynchornizedTask", "Builder pattern values: ");
51 | Log.d("SynchornizedTask", "earthWallpaperCount: " + synchronizedBuilder.earthWallpaperCount);
52 | Log.d("SynchornizedTask", "multiple results: " + synchronizedBuilder.multipleResults);
53 | Log.d("SynchornizedTask", "random request: " + synchronizedBuilder.randomRequest);
54 | if(synchronizedBuilder.earthWallIds != null) {
55 | if(synchronizedBuilder.earthWallIds.length == 0) {
56 | Log.d("SynchornizedTask", "earthwallid size is 0");
57 | } else if(synchronizedBuilder.earthWallIds.length == 1) {
58 | Log.d("SynchornizedTask", "earthwallid: " + synchronizedBuilder.earthWallIds[0]);
59 | } else {
60 | Log.d("SynchornizedTask", "earthwallid(s) : ");
61 | for(int i = 0; i < synchronizedBuilder.earthWallIds.length; i++) {
62 | Log.d("SynchronizedTask", "Wall ID: " + synchronizedBuilder.earthWallIds[i]);
63 | }
64 | }
65 | } else {
66 | Log.d("SynchzronizedTask", "No earth wall ids found.");
67 | }
68 | this.multipleRequests = synchronizedBuilder.multipleResults;
69 | this.earthWallpaperCount = synchronizedBuilder.earthWallpaperCount;
70 | this.results = new EarthWallpaper[synchronizedBuilder.earthWallpaperCount];
71 | this.randomRequests = synchronizedBuilder.randomRequest;
72 | if(synchronizedBuilder.earthWallIds != null) this.earthWallIds = synchronizedBuilder.earthWallIds;
73 | else this.earthWallIds = new String[0];
74 |
75 | }
76 |
77 | public static SynchronizedTask forBuilder(EarthView.SynchronizedBuilder synchronizedBuilder) {
78 | return new SynchronizedTask(synchronizedBuilder);
79 | }
80 |
81 | public final EarthWallpaper[] execute() {
82 |
83 | for(int i = 0; i < earthWallpaperCount; i++) {
84 |
85 | String requestUrl = ApiUtils.getApiUrl(randomRequests ? IdUtils.getRandomId() : earthWallIds[i]) ;
86 | try {
87 | Request request = new Request.Builder().url(requestUrl).build();
88 | Response response = okHttpClient.newCall(request).execute();
89 | if(!response.isSuccessful()) {
90 | results[i] = null;
91 | continue;
92 | }
93 | EarthWallpaper wallpaper = gson.fromJson(response.body().charStream(), EarthWallpaper.class);
94 | results[i] = wallpaper;
95 | } catch (IOException io) {/* Ignore the exception which is thrown by OkHttp */}
96 |
97 | }
98 |
99 | return results;
100 | }
101 |
102 | }
103 |
--------------------------------------------------------------------------------
/earthview-android/src/main/java/com/pddstudio/earthview/utils/ApiUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - earthview-android
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 | package com.pddstudio.earthview.utils;
18 |
19 | /**
20 | * This Class was created by Patrick J
21 | * on 10.12.15. For more Details and Licensing
22 | * have a look at the README.md
23 | */
24 | public final class ApiUtils {
25 |
26 | private static final String BASE_API_URL = "https://earthview.withgoogle.com/_api/";
27 | private static final String JSON_EXT = ".json";
28 |
29 | public static final String getApiUrl(String forId) {
30 | return BASE_API_URL + forId + JSON_EXT;
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/earthview-android/src/main/java/com/pddstudio/earthview/utils/AsyncLoader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - earthview-android
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 | package com.pddstudio.earthview.utils;
18 |
19 | import android.os.AsyncTask;
20 |
21 | import com.google.gson.Gson;
22 | import com.pddstudio.earthview.EarthViewCallback;
23 | import com.pddstudio.earthview.EarthWallpaper;
24 | import com.squareup.okhttp.OkHttpClient;
25 | import com.squareup.okhttp.Request;
26 | import com.squareup.okhttp.Response;
27 |
28 | import java.io.IOException;
29 | import java.util.Collection;
30 | import java.util.Collections;
31 | import java.util.LinkedList;
32 |
33 | /**
34 | * This Class was created by Patrick J
35 | * on 10.12.15. For more Details and Licensing
36 | * have a look at the README.md
37 | */
38 | public class AsyncLoader extends AsyncTask {
39 |
40 | private final String[] wallIds;
41 | private final EarthViewCallback earthViewCallback;
42 | private final Collection earthWallpapers;
43 | private final OkHttpClient okHttpClient = new OkHttpClient();
44 |
45 | public AsyncLoader(EarthViewCallback earthViewCallback, String... earthViewIds) {
46 | this.wallIds = earthViewIds;
47 | this.earthViewCallback = earthViewCallback;
48 | this.earthWallpapers = Collections.synchronizedList(new LinkedList());
49 | }
50 |
51 | @Override
52 | public void onPreExecute() {
53 | //invoke the callback that we're starting now loading the requests
54 | earthViewCallback.onStartedLoading(wallIds.length);
55 | }
56 |
57 | @Override
58 | protected Void doInBackground(Void... params) {
59 |
60 | Gson gson = new Gson();
61 |
62 | earthWallpapers.clear();
63 |
64 | synchronized (wallIds) {
65 | for(String singleId : wallIds) {
66 | String requestUrl = ApiUtils.getApiUrl(singleId);
67 | try {
68 | Request request = new Request.Builder().url(requestUrl).build();
69 | Response response = okHttpClient.newCall(request).execute();
70 | if(!response.isSuccessful()) continue;
71 | EarthWallpaper wallpaper = gson.fromJson(response.body().charStream(), EarthWallpaper.class);
72 | if(wallpaper != null) publishProgress(wallpaper);
73 | } catch (IOException io) {/* Ignore the exception which is thrown by OkHttp */}
74 | if(this.isCancelled()) {
75 | okHttpClient.cancel(null);
76 | break;
77 | }
78 | }
79 | }
80 |
81 | return null;
82 | }
83 |
84 | @Override
85 | protected void onProgressUpdate(EarthWallpaper... earthWallpapers) {
86 | //adding the item to the collection and invoke the callback that a new item has been added
87 | this.earthWallpapers.add(earthWallpapers[0]);
88 | earthViewCallback.onItemLoaded(earthWallpapers[0]);
89 | }
90 |
91 | @Override
92 | protected void onCancelled() {
93 | //invoke the callback when the task has been cancelled
94 | earthViewCallback.onCancelledLoading(earthWallpapers);
95 | }
96 |
97 | @Override
98 | public void onPostExecute(Void v) {
99 | //invoke the callback when loading finished
100 | earthViewCallback.onFinishedLoading(earthWallpapers);
101 | }
102 |
103 | }
104 |
--------------------------------------------------------------------------------
/earthview-android/src/main/java/com/pddstudio/earthview/utils/EarthViewUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - earthview-android
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 | package com.pddstudio.earthview.utils;
18 |
19 | /**
20 | * This Class was created by Patrick J
21 | * on 13.12.15. For more Details and Licensing
22 | * have a look at the README.md
23 | */
24 | public final class EarthViewUtils {
25 |
26 | private static String[] earthIds = IdUtils.getIdList();
27 |
28 | public static String[] getAllEarthViewIds() {
29 | return earthIds;
30 | }
31 |
32 | public static int[] getAllEarthViewIntIds() {
33 | int[] wallIds = new int[earthIds.length];
34 | for(int i = 0; i < earthIds.length; i++) {
35 | wallIds[i] = Integer.parseInt(earthIds[i]);
36 | }
37 | return wallIds;
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/earthview-android/src/main/java/com/pddstudio/earthview/utils/SingleLoader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - earthview-android
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 | package com.pddstudio.earthview.utils;
18 |
19 | import android.os.AsyncTask;
20 | import android.util.Log;
21 |
22 | import com.google.gson.Gson;
23 | import com.pddstudio.earthview.EarthWallpaper;
24 | import com.pddstudio.earthview.SingleEarthViewCallback;
25 | import com.squareup.okhttp.OkHttpClient;
26 | import com.squareup.okhttp.Request;
27 | import com.squareup.okhttp.Response;
28 |
29 | import java.io.IOException;
30 |
31 | /**
32 | * This Class was created by Patrick J
33 | * on 10.12.15. For more Details and Licensing
34 | * have a look at the README.md
35 | */
36 | public class SingleLoader extends AsyncTask {
37 |
38 | private final SingleEarthViewCallback singleEarthViewCallback;
39 | private String useWallId = null;
40 |
41 | public SingleLoader(SingleEarthViewCallback singleEarthViewCallback) {
42 | this.singleEarthViewCallback = singleEarthViewCallback;
43 | }
44 |
45 | public SingleLoader loadEarthViewById(String id) {
46 | this.useWallId = id;
47 | return this;
48 | }
49 |
50 | public SingleLoader loadRandomEarthWallpaper() {
51 | this.useWallId = null;
52 | return this;
53 | }
54 |
55 | @Override
56 | public void onPreExecute() {
57 | singleEarthViewCallback.onStartedLoading();
58 | }
59 |
60 | @Override
61 | protected EarthWallpaper doInBackground(Void... params) {
62 | Gson gson = new Gson();
63 | OkHttpClient okHttpClient = new OkHttpClient();
64 | String id;
65 | String requestUrl;
66 | if(useWallId == null) {
67 | id = IdUtils.getRandomId();
68 | } else {
69 | id = useWallId;
70 | }
71 |
72 | requestUrl = ApiUtils.getApiUrl(id);
73 |
74 | try {
75 | Request request = new Request.Builder().url(requestUrl).build();
76 | Response response = okHttpClient.newCall(request).execute();
77 | if(!response.isSuccessful()) return null;
78 | EarthWallpaper wallpaper = gson.fromJson(response.body().charStream(), EarthWallpaper.class);
79 | if(wallpaper != null && wallpaper.getWallpaperId().equals(id)) return wallpaper;
80 | } catch (IOException io) {
81 | Log.d("AsyncLoader", "IOError: " + io.getLocalizedMessage());
82 | }
83 |
84 | return null;
85 | }
86 |
87 | @Override
88 | public void onPostExecute(EarthWallpaper earthWallpaper) {
89 | singleEarthViewCallback.onFinishedLoading(earthWallpaper);
90 | }
91 |
92 | }
93 |
--------------------------------------------------------------------------------
/earthview-android/src/main/res/values/info_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 | Patrick J
21 | http://pddstudio.com/
22 | EarthView for Android
23 | A simple and easy to use API to integrate EarthView with Google into your android application.
24 | 1.0.0
25 | https://github.com/pddstudio/earthview-android/
26 | apache_2_0
27 | true
28 | https://github.com/pddstudio/earthview-android/
29 |
--------------------------------------------------------------------------------
/earthview-android/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 | earthview-android
19 |
20 |
--------------------------------------------------------------------------------
/earthview-android/src/test/java/com/pddstudio/earthview/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.earthview;
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 | }
--------------------------------------------------------------------------------
/gfx/hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/gfx/hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/gfx/mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/gfx/mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/gfx/playstore/earthviewer-min.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/gfx/playstore/earthviewer-min.png
--------------------------------------------------------------------------------
/gfx/playstore/ic_banner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/gfx/playstore/ic_banner.png
--------------------------------------------------------------------------------
/gfx/playstore/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/gfx/playstore/ic_launcher.png
--------------------------------------------------------------------------------
/gfx/xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/gfx/xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/gfx/xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/gfx/xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/gfx/xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/gfx/xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2015 - Patrick J - EarthViewDemo
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 | # Project-wide Gradle settings.
18 |
19 | # IDE (e.g. Android Studio) users:
20 | # Gradle settings configured through the IDE *will override*
21 | # any settings specified in this file.
22 |
23 | # For more details on how to configure your build environment visit
24 | # http://www.gradle.org/docs/current/userguide/build_environment.html
25 |
26 | # Specifies the JVM arguments used for the daemon process.
27 | # The setting is particularly useful for tweaking memory settings.
28 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
29 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
30 |
31 | # When configured, Gradle will run in incubating parallel mode.
32 | # This option should only be used with decoupled projects. More details, visit
33 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
34 | # org.gradle.parallel=true
35 | VERSION_NAME=1.2.0
36 | VERSION_CODE=4
37 | GROUP=com.pddstudio
38 |
39 | POM_DESCRIPTION=EarthView Library to integrate EarthView by Google into your android application
40 | POM_URL=https://github.com/pddstudio/earthview-android
41 | POM_SCM_URL=https://github.com/pddstudio/earthview-android
42 | POM_SCM_CONNECTION=scm:git@github.com:pddstudio/earthview-android.git
43 | POM_SCM_DEV_CONNECTION=scm:git@github.com:pddstudio/earthview-android.git
44 | POM_LICENCE_NAME=The Apache Software License, Version 2.0
45 | POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
46 | POM_LICENCE_DIST=repo
47 | POM_DEVELOPER_ID=pddstudio
48 | POM_DEVELOPER_NAME=Patrick J
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2015 - Patrick J - EarthViewDemo
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 | #Wed Oct 21 11:34:03 PDT 2015
18 | distributionBase=GRADLE_USER_HOME
19 | distributionPath=wrapper/dists
20 | zipStoreBase=GRADLE_USER_HOME
21 | zipStorePath=wrapper/dists
22 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
23 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/preview/en-play-badge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/preview/en-play-badge.png
--------------------------------------------------------------------------------
/preview/ps/screener_20151213(21:52:46).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/preview/ps/screener_20151213(21:52:46).png
--------------------------------------------------------------------------------
/preview/ps/screener_20151213(21:52:56).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/preview/ps/screener_20151213(21:52:56).png
--------------------------------------------------------------------------------
/preview/ps/screener_20151213(21:53:28).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/preview/ps/screener_20151213(21:53:28).png
--------------------------------------------------------------------------------
/preview/ps/screener_20151213(21:53:42).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/preview/ps/screener_20151213(21:53:42).png
--------------------------------------------------------------------------------
/preview/ps/screener_20151213(21:53:51).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/preview/ps/screener_20151213(21:53:51).png
--------------------------------------------------------------------------------
/preview/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/preview/screenshot.png
--------------------------------------------------------------------------------
/ps-app/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | maven { url 'https://maven.fabric.io/public' }
4 | }
5 |
6 | dependencies {
7 | classpath 'io.fabric.tools:gradle:1.+'
8 | }
9 | }
10 | /*
11 | * Copyright 2015 - Patrick J - ps-app
12 | *
13 | * Licensed under the Apache License, Version 2.0 (the "License");
14 | * you may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at
16 | *
17 | * http://www.apache.org/licenses/LICENSE-2.0
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | */
25 |
26 | apply plugin: 'com.android.application'
27 | apply plugin: 'io.fabric'
28 |
29 | repositories {
30 | maven { url 'https://maven.fabric.io/public' }
31 | }
32 |
33 |
34 | android {
35 | compileSdkVersion 23
36 | buildToolsVersion "23.0.2"
37 |
38 | defaultConfig {
39 | applicationId "com.pddstudio.earthviewer"
40 | minSdkVersion 17
41 | targetSdkVersion 23
42 | versionCode 11
43 | versionName "0.6.1-BETA"
44 | }
45 | buildTypes {
46 | release {
47 | minifyEnabled false
48 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
49 | }
50 | debug {
51 | minifyEnabled false
52 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
53 | }
54 | }
55 | lintOptions {
56 | abortOnError false
57 | }
58 | packagingOptions {
59 | exclude 'META-INF/DEPENDENCIES.txt'
60 | exclude 'META-INF/LICENSE.txt'
61 | exclude 'META-INF/NOTICE.txt'
62 | exclude 'META-INF/NOTICE'
63 | exclude 'META-INF/LICENSE'
64 | exclude 'META-INF/DEPENDENCIES'
65 | exclude 'META-INF/notice.txt'
66 | exclude 'META-INF/license.txt'
67 | exclude 'META-INF/dependencies.txt'
68 | exclude 'META-INF/LGPL2.1'
69 | }
70 | }
71 |
72 | dependencies {
73 | compile fileTree(include: ['*.jar'], dir: 'libs')
74 | testCompile 'junit:junit:4.12'
75 | //android libs
76 | compile 'com.android.support:appcompat-v7:23.1.1'
77 | compile 'com.android.support:cardview-v7:23.1.1'
78 | compile 'com.android.support:design:23.1.1'
79 | compile 'com.android.support:support-v4:23.1.1'
80 | //for wallpapers
81 | compile project(':earthview-android')
82 | //other libs
83 | compile('com.github.afollestad.material-dialogs:core:0.8.5.2@aar') {
84 | transitive = true
85 | }
86 | compile('com.github.afollestad.material-dialogs:commons:0.8.5.2@aar') {
87 | transitive = true
88 | }
89 | compile('com.mikepenz:materialdrawer:4.5.6@aar') {
90 | transitive = true
91 | }
92 | compile('com.mikepenz:aboutlibraries:5.3.4@aar') {
93 | transitive = true
94 | }
95 | compile 'com.squareup.picasso:picasso:2.5.2'
96 | compile 'com.squareup.okhttp:okhttp:2.6.0'
97 | compile 'com.squareup.okhttp:okhttp-urlconnection:2.6.0'
98 | compile 'com.mikepenz:iconics-core:2.5.0@aar'
99 | compile 'com.mikepenz:google-material-typeface:2.2.0.1@aar'
100 | compile 'com.mikepenz:community-material-typeface:1.3.41.1@aar'
101 | compile 'com.mikepenz:fontawesome-typeface:4.5.0.1@aar'
102 | compile 'com.github.clans:fab:1.6.2'
103 | compile 'io.paperdb:paperdb:1.1'
104 | compile 'com.github.lawloretienne:quickreturn:0.0.3'
105 | compile 'com.google.android.apps.muzei:muzei-api:2.0'
106 | //compile 'com.lantouzi.wheelview:library:1.0.1'
107 | compile project(':wheelview-test')
108 | compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
109 | transitive = true;
110 | }
111 |
112 | }
113 |
--------------------------------------------------------------------------------
/ps-app/fabric.properties:
--------------------------------------------------------------------------------
1 | #Contains API Secret used to validate your application. Commit to internal source control; avoid making secret public.
2 | #Wed Jan 20 23:17:06 CET 2016
3 | apiSecret=accf46a6e1c94040208ea1ae165ed357a9cd56e5f60d7b8514d204f967e57890
4 |
--------------------------------------------------------------------------------
/ps-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 /home/pddstudio/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 | -keep class .R
19 | -keep class **.R$* {
20 | ;
21 | }
--------------------------------------------------------------------------------
/ps-app/ps-app-release.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/ps-app-release.apk
--------------------------------------------------------------------------------
/ps-app/src/androidTest/java/com/pddstudio/wallpaperrecyclerdemo/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.wallpaperrecyclerdemo;
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 | }
--------------------------------------------------------------------------------
/ps-app/src/main/assets/fonts/OpenSans-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/src/main/assets/fonts/OpenSans-Regular.ttf
--------------------------------------------------------------------------------
/ps-app/src/main/assets/fonts/Roboto-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/src/main/assets/fonts/Roboto-Regular.ttf
--------------------------------------------------------------------------------
/ps-app/src/main/assets/fonts/RobotoMono-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/src/main/assets/fonts/RobotoMono-Regular.ttf
--------------------------------------------------------------------------------
/ps-app/src/main/assets/fonts/RobotoSlab-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/src/main/assets/fonts/RobotoSlab-Regular.ttf
--------------------------------------------------------------------------------
/ps-app/src/main/java/com/pddstudio/earthviewer/AboutActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - ps-app
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 | package com.pddstudio.earthviewer;
18 |
19 | import android.os.Bundle;
20 | import android.support.v7.app.AppCompatActivity;
21 | import android.support.v7.widget.Toolbar;
22 |
23 | import com.mikepenz.aboutlibraries.Libs;
24 | import com.mikepenz.aboutlibraries.ui.LibsFragment;
25 | import com.pddstudio.earthviewer.views.about.AboutFragment;
26 | import com.pddstudio.earthviewer.views.about.CustomLibs;
27 |
28 | public class AboutActivity extends AppCompatActivity {
29 |
30 | @Override
31 | protected void onCreate(Bundle savedInstanceState) {
32 | super.onCreate(savedInstanceState);
33 | setContentView(R.layout.activity_about);
34 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
35 | setSupportActionBar(toolbar);
36 |
37 | LibsFragment libsFragment = new CustomLibs()
38 | .withSlideInAnimation(true)
39 | .withAutoDetect(true)
40 | .withActivityTitle(this.getResources().getString(R.string.about_activity_title))
41 | .withActivityStyle(Libs.ActivityStyle.LIGHT_DARK_TOOLBAR)
42 | .withFields(R.string.class.getFields())
43 | .fragment();
44 |
45 | AboutFragment aboutFragment = (AboutFragment) libsFragment;
46 |
47 | getFragmentManager().beginTransaction().replace(R.id.about_content, aboutFragment).commit();
48 |
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/ps-app/src/main/java/com/pddstudio/earthviewer/EarthViewAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - ps-app
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 | package com.pddstudio.earthviewer;
18 |
19 | import android.content.Context;
20 | import android.os.Build;
21 | import android.support.annotation.Nullable;
22 | import android.support.v7.widget.RecyclerView;
23 | import android.util.Log;
24 | import android.view.LayoutInflater;
25 | import android.view.View;
26 | import android.view.ViewGroup;
27 | import android.widget.TextView;
28 |
29 | import com.pddstudio.earthview.EarthWallpaper;
30 | import com.pddstudio.earthviewer.utils.Preferences;
31 | import com.pddstudio.earthviewer.views.SquaredImageView;
32 | import com.squareup.picasso.Picasso;
33 |
34 | import java.util.ArrayList;
35 | import java.util.Collection;
36 | import java.util.List;
37 |
38 | /**
39 | * This Class was created by Patrick J
40 | * on 06.12.15. For more Details and Licensing
41 | * have a look at the README.md
42 | */
43 | public class EarthViewAdapter extends RecyclerView.Adapter {
44 |
45 | private List itemData;
46 | private final Context context;
47 | OnItemClickListener onItemClickListener = null;
48 |
49 | public interface OnItemClickListener {
50 | void onItemClick(View view, int position);
51 | }
52 |
53 | public EarthViewAdapter(@Nullable Collection data, Context context) {
54 | if(data == null) {
55 | this.itemData = new ArrayList<>();
56 | } else {
57 | Log.d("EarthViewAdapter", "Adapter initialized with data count: " + data.size());
58 | this.itemData = new ArrayList<>(data);
59 | }
60 | this.context = context;
61 | }
62 |
63 | @Override
64 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
65 | View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.earthview_item, parent, false);
66 | ViewHolder viewHolder = new ViewHolder(view, onItemClickListener);
67 | return viewHolder;
68 | }
69 |
70 | @Override
71 | public void onBindViewHolder(ViewHolder holder, int position) {
72 | EarthWallpaper earthWallpaper = itemData.get(position);
73 | holder.textView.setText(earthWallpaper.getFormattedWallpaperTitle());
74 | holder.textView.setTypeface(Preferences.getInstance().getTypeface());
75 | if(Preferences.getInstance().getGridColumnCount() >= 4) holder.textView.setVisibility(View.GONE);
76 |
77 | if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
78 | holder.textView.setTransitionName(holder.textView.getTransitionName() + "_" + position);
79 | holder.squaredImageView.setTransitionName(holder.squaredImageView.getTransitionName() + "_" + position);
80 | }
81 |
82 | Picasso.with(context).load(earthWallpaper.getWallThumbUrl()).into(holder.squaredImageView);
83 | }
84 |
85 | public void addItem(EarthWallpaper wallpaper) {
86 | if(itemData != null) this.itemData.add(wallpaper);
87 | }
88 |
89 | public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
90 | this.onItemClickListener = onItemClickListener;
91 | }
92 |
93 | public void cleanDataSet() {
94 | this.itemData = new ArrayList<>();
95 | this.notifyDataSetChanged();
96 | }
97 |
98 | public boolean hasOnItemClickListener() {
99 | return this.onItemClickListener != null;
100 | }
101 |
102 | public EarthWallpaper getItemAtPosition(int position) {
103 | if(position < 0 || position >= itemData.size()) {
104 | return null;
105 | } else {
106 | return itemData.get(position);
107 | }
108 | }
109 |
110 | @Override
111 | public int getItemCount() {
112 | return itemData.size();
113 | }
114 |
115 | public static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
116 |
117 | public SquaredImageView squaredImageView;
118 | public TextView textView;
119 | public OnItemClickListener onItemClickListener;
120 |
121 | public ViewHolder(View itemView, OnItemClickListener onItemClickListener) {
122 | super(itemView);
123 | itemView.setClickable(true);
124 | itemView.setOnClickListener(this);
125 | squaredImageView = (SquaredImageView) itemView.findViewById(R.id.wall);
126 | textView = (TextView) itemView.findViewById(R.id.name);
127 | this.onItemClickListener = onItemClickListener;
128 | }
129 |
130 | @Override
131 | public void onClick(View v) {
132 | if(onItemClickListener != null) onItemClickListener.onItemClick(v, getAdapterPosition());
133 | }
134 | }
135 | }
136 |
--------------------------------------------------------------------------------
/ps-app/src/main/java/com/pddstudio/earthviewer/SettingsActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - ps-app
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 | package com.pddstudio.earthviewer;
18 |
19 |
20 | import android.graphics.Color;
21 | import android.os.Build;
22 | import android.os.Bundle;
23 | import android.preference.Preference;
24 | import android.preference.PreferenceFragment;
25 | import android.support.v7.app.AppCompatActivity;
26 | import android.support.v7.widget.Toolbar;
27 | import android.util.Log;
28 | import android.view.MenuItem;
29 |
30 | import com.afollestad.materialdialogs.folderselector.FolderChooserDialog;
31 | import com.pddstudio.earthviewer.utils.Preferences;
32 |
33 | import java.io.File;
34 |
35 | public class SettingsActivity extends AppCompatActivity implements FolderChooserDialog.FolderCallback{
36 |
37 | private SettingsItem settingsItem = null;
38 |
39 | @Override
40 | protected void onCreate(Bundle savedInstanceState) {
41 | super.onCreate(savedInstanceState);
42 | setContentView(R.layout.activity_preferences);
43 | Toolbar toolbar = (Toolbar) findViewById(R.id.pref_toolbar);
44 | setSupportActionBar(toolbar);
45 | if(getSupportActionBar() != null) getSupportActionBar().setDisplayHomeAsUpEnabled(true);
46 |
47 | if(getFragmentManager().findFragmentById(R.id.pref_content) == null)
48 | getFragmentManager().beginTransaction().replace(R.id.pref_content, new SettingsFragment()).commit();
49 |
50 | //tint the navigation bar if set
51 | if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
52 | if(Preferences.getInstance().getTintNavigationBar()) {
53 | getWindow().setNavigationBarColor(getResources().getColor(R.color.colorPrimaryDark));
54 | } else {
55 | getWindow().setNavigationBarColor(Color.BLACK);
56 | }
57 | }
58 |
59 | Preferences.getInstance().setTempPrefActivity(this);
60 |
61 | }
62 |
63 | @Override
64 | public boolean onOptionsItemSelected(MenuItem item) {
65 | switch (item.getItemId()) {
66 | case android.R.id.home:
67 | onBackPressed();
68 | return true;
69 | }
70 | return super.onOptionsItemSelected(item);
71 | }
72 |
73 | @Override
74 | protected void onResume() {
75 | super.onResume();
76 | if(Preferences.exists()) {
77 | Preferences.getInstance().registerPreferenceListener();
78 | }
79 | }
80 |
81 | @Override
82 | protected void onPause() {
83 | super.onPause();
84 | if(Preferences.exists()) {
85 | Preferences.getInstance().unregisterPreferenceListener();
86 | }
87 | }
88 |
89 | @Override
90 | public void onFolderSelection(File file) {
91 | if(file.exists() && file.isDirectory() && file.canWrite()) {
92 | Log.d("Settings", "Download path changed to " + file.getAbsolutePath());
93 | Preferences.getInstance().setWallpaperDownloadDirectory(file.getAbsolutePath());
94 | if(settingsItem != null) settingsItem.onStorageChanged(file.getAbsolutePath());
95 | }
96 | }
97 |
98 | public void showDirectoryChooserDialog(SettingsItem settingsItemCallback) {
99 | this.settingsItem = settingsItemCallback;
100 | new FolderChooserDialog.Builder(this)
101 | .chooseButton(R.string.preferences_item_wall_folder_select)
102 | .cancelButton(R.string.preferences_item_wall_folder_cancel)
103 | .show();
104 | }
105 |
106 | //using the PreferenceFragment for the Settings
107 | public static class SettingsFragment extends PreferenceFragment {
108 |
109 | @Override
110 | public void onCreate(Bundle savedInstanceState) {
111 | super.onCreate(savedInstanceState);
112 | addPreferencesFromResource(R.xml.preferences);
113 | Preference buildPref = findPreference("build_info_pref");
114 | buildPref.setSummary(Preferences.getInstance().getSettingsBuildNumber());
115 | }
116 |
117 | }
118 |
119 | public interface SettingsItem {
120 | void onStorageChanged(String newPath);
121 | }
122 |
123 | }
--------------------------------------------------------------------------------
/ps-app/src/main/java/com/pddstudio/earthviewer/SettingsActivityPre.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - ps-app
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 | package com.pddstudio.earthviewer;
18 |
19 |
20 | import android.os.Build;
21 | import android.os.Bundle;
22 | import android.preference.Preference;
23 | import android.preference.PreferenceFragment;
24 | import android.support.v7.app.AppCompatActivity;
25 | import android.support.v7.widget.Toolbar;
26 | import android.util.Log;
27 | import android.view.MenuItem;
28 |
29 | import com.afollestad.materialdialogs.folderselector.FolderChooserDialog;
30 | import com.pddstudio.earthviewer.utils.Preferences;
31 |
32 | import java.io.File;
33 |
34 | public class SettingsActivityPre extends AppCompatActivity implements FolderChooserDialog.FolderCallback{
35 |
36 | private SettingsItem settingsItem = null;
37 |
38 | @Override
39 | protected void onCreate(Bundle savedInstanceState) {
40 | super.onCreate(savedInstanceState);
41 | setContentView(R.layout.activity_preferences);
42 | Toolbar toolbar = (Toolbar) findViewById(R.id.pref_toolbar);
43 | setSupportActionBar(toolbar);
44 | if(getSupportActionBar() != null) getSupportActionBar().setDisplayHomeAsUpEnabled(true);
45 |
46 | if(getFragmentManager().findFragmentById(R.id.pref_content) == null)
47 | getFragmentManager().beginTransaction().replace(R.id.pref_content, new SettingsFragment()).commit();
48 |
49 | }
50 |
51 | @Override
52 | public boolean onOptionsItemSelected(MenuItem item) {
53 | switch (item.getItemId()) {
54 | case android.R.id.home:
55 | onBackPressed();
56 | return true;
57 | }
58 | return super.onOptionsItemSelected(item);
59 | }
60 |
61 | @Override
62 | protected void onResume() {
63 | super.onResume();
64 | if(Preferences.exists()) {
65 | Preferences.getInstance().registerPreferenceListener();
66 | }
67 | }
68 |
69 | @Override
70 | protected void onPause() {
71 | super.onPause();
72 | if(Preferences.exists()) {
73 | Preferences.getInstance().unregisterPreferenceListener();
74 | }
75 | }
76 |
77 | @Override
78 | public void onFolderSelection(File file) {
79 | if(file.exists() && file.isDirectory() && file.canWrite()) {
80 | Log.d("Settings", "Download path changed to " + file.getAbsolutePath());
81 | Preferences.getInstance().setWallpaperDownloadDirectory(file.getAbsolutePath());
82 | if(settingsItem != null) settingsItem.onStorageChanged(file.getAbsolutePath());
83 | }
84 | }
85 |
86 | public void showDirectoryChooserDialog(SettingsItem settingsItemCallback) {
87 | this.settingsItem = settingsItemCallback;
88 | new FolderChooserDialog.Builder(this)
89 | .chooseButton(R.string.preferences_item_wall_folder_select)
90 | .cancelButton(R.string.preferences_item_wall_folder_cancel)
91 | .show();
92 | }
93 |
94 | //using the PreferenceFragment for the Settings
95 | public static class SettingsFragment extends PreferenceFragment {
96 |
97 | @Override
98 | public void onCreate(Bundle savedInstanceState) {
99 | super.onCreate(savedInstanceState);
100 | addPreferencesFromResource(R.xml.preferences);
101 | Preference buildPref = findPreference("build_info_pref");
102 | buildPref.setSummary(Preferences.getInstance().getSettingsBuildNumber());
103 | }
104 |
105 | }
106 |
107 | public interface SettingsItem {
108 | void onStorageChanged(String newPath);
109 | }
110 |
111 | }
--------------------------------------------------------------------------------
/ps-app/src/main/java/com/pddstudio/earthviewer/muzei/EarthViewerSource.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - ps-app
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 | package com.pddstudio.earthviewer.muzei;
18 |
19 | import android.content.Intent;
20 | import android.net.Uri;
21 | import android.text.TextUtils;
22 | import android.util.Log;
23 |
24 | import com.google.android.apps.muzei.api.Artwork;
25 | import com.google.android.apps.muzei.api.RemoteMuzeiArtSource;
26 | import com.google.android.apps.muzei.api.UserCommand;
27 | import com.pddstudio.earthview.EarthView;
28 | import com.pddstudio.earthview.EarthWallpaper;
29 |
30 | /**
31 | * This Class was created by Patrick J
32 | * on 16.12.15. For more Details and Licensing
33 | * have a look at the README.md
34 | */
35 | public class EarthViewerSource extends RemoteMuzeiArtSource {
36 |
37 | private static final String SOURCE = "EarthViewerSource";
38 |
39 | private MuzeiPreferences muzeiPreferences;
40 |
41 | public EarthViewerSource() {
42 | super(SOURCE);
43 | }
44 |
45 | @Override
46 | public void onCreate() {
47 | super.onCreate();
48 |
49 | this.muzeiPreferences = new MuzeiPreferences(EarthViewerSource.this);
50 | UserCommand command = new UserCommand(BUILTIN_COMMAND_ID_NEXT_ARTWORK);
51 | setUserCommands(command);
52 |
53 | }
54 |
55 | @Override
56 | public int onStartCommand(final Intent intent, final int flags, final int startId) {
57 | new Thread(new Runnable() {
58 | @Override
59 | public void run() {
60 | String commandString = intent.getExtras().getString("service");
61 | if(commandString != null) {
62 | try {
63 | onTryUpdate(UPDATE_REASON_USER_NEXT);
64 | } catch (RetryException retry) { Log.w("EarthViewer", retry.getMessage()); }
65 | }
66 | }
67 | }).start();
68 | return super.onStartCommand(intent, flags, startId);
69 | }
70 |
71 | @Override
72 | protected void onTryUpdate(int reason) throws RetryException {
73 | //receive the current ID to be sure we don't show the same image twice (even if it's almost 0 chance :P)
74 | String currentId = (getCurrentArtwork() != null) ? getCurrentArtwork().getToken() : null;
75 |
76 | EarthWallpaper earthWallpaper = EarthView.withGoogle().getSynchronizedBuilder().getRandomWallpaper().executeWithResult();
77 | if(earthWallpaper == null) throw new RetryException();
78 | if(currentId != null && TextUtils.equals(currentId, earthWallpaper.getWallpaperId())) throw new RetryException();
79 |
80 | Artwork artwork = new Artwork.Builder()
81 | .imageUri(Uri.parse(earthWallpaper.getWallPhotoUrl()))
82 | .title(earthWallpaper.getFormattedWallpaperTitle())
83 | .byline(earthWallpaper.getShareUrl())
84 | .token(earthWallpaper.getWallpaperId())
85 | .viewIntent(new Intent(Intent.ACTION_VIEW, Uri.parse(earthWallpaper.getShareUrl())))
86 | .build();
87 |
88 | publishArtwork(artwork);
89 | scheduleUpdate(System.currentTimeMillis() + muzeiPreferences.getRotateTimeMilis());
90 | //TODO: update via activity
91 | }
92 |
93 | }
94 |
--------------------------------------------------------------------------------
/ps-app/src/main/java/com/pddstudio/earthviewer/muzei/MuzeiPreferences.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - ps-app
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 | package com.pddstudio.earthviewer.muzei;
18 |
19 | import android.content.Context;
20 | import android.content.SharedPreferences;
21 |
22 | /**
23 | * This Class was created by Patrick J
24 | * on 16.12.15. For more Details and Licensing
25 | * have a look at the README.md
26 | */
27 | public class MuzeiPreferences {
28 |
29 | //name of the preference file in the system
30 | private static final String MUZEI_PREFS = "com.pddstudio.earthviewer.muzei";
31 |
32 | //preference identifiers
33 | private static final String USE_HOURS = "use_hrs";
34 | private static final String WHEEL_VAL = "int_val";
35 |
36 | private final SharedPreferences sharedPreferences;
37 |
38 | public MuzeiPreferences(Context context) {
39 | this.sharedPreferences = context.getSharedPreferences(MUZEI_PREFS, Context.MODE_PRIVATE);
40 | }
41 |
42 | public int getRotateTimeMilis() {
43 | return calculateFromPreferences();
44 | }
45 |
46 | public boolean getUseHours() {
47 | return sharedPreferences.getBoolean(USE_HOURS, false);
48 | }
49 |
50 | public void setUseHours(boolean useHours) {
51 | this.sharedPreferences.edit().putBoolean(USE_HOURS, useHours).apply();
52 | }
53 |
54 | public void setWheelValue(int value) {
55 | this.sharedPreferences.edit().putInt(WHEEL_VAL, value).apply();
56 | }
57 |
58 | public int getWheelValue() {
59 | return sharedPreferences.getInt(WHEEL_VAL, 1);
60 | }
61 |
62 | private int calculateFromPreferences() {
63 | int value = getWheelValue();
64 | if(getUseHours()) {
65 | value = value * 60 * 60 * 1000;
66 | } else {
67 | value = value * 60 * 1000;
68 | }
69 | return value;
70 | }
71 |
72 |
73 | }
74 |
--------------------------------------------------------------------------------
/ps-app/src/main/java/com/pddstudio/earthviewer/utils/DownloadHighResImage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - ps-app
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 | package com.pddstudio.earthviewer.utils;
18 |
19 | import android.content.Context;
20 | import android.os.AsyncTask;
21 | import android.util.Log;
22 |
23 | import com.pddstudio.earthview.EarthWallpaper;
24 | import com.squareup.okhttp.OkHttpClient;
25 | import com.squareup.okhttp.Request;
26 | import com.squareup.okhttp.Response;
27 |
28 | import org.apache.commons.io.IOUtils;
29 |
30 | import java.io.File;
31 | import java.io.FileOutputStream;
32 | import java.io.IOException;
33 | import java.io.InputStream;
34 |
35 | /**
36 | * This Class was created by Patrick J
37 | * on 11.12.15. For more Details and Licensing
38 | * have a look at the README.md
39 | */
40 | public class DownloadHighResImage extends AsyncTask {
41 |
42 | public interface ImageCachingCallback {
43 | void onCachingFinished(boolean success, File location);
44 | }
45 |
46 | private final EarthWallpaper earthWallpaper;
47 | private final Context context;
48 | private final ImageCachingCallback imageCachingCallback;
49 |
50 | public DownloadHighResImage(Context context, EarthWallpaper earthWallpaper, ImageCachingCallback imageCachingCallback) {
51 | this.context = context;
52 | this.earthWallpaper = earthWallpaper;
53 | this.imageCachingCallback = imageCachingCallback;
54 | }
55 |
56 | @Override
57 | protected File doInBackground(Void... params) {
58 | final File cachedImage = new File(context.getCacheDir(), earthWallpaper.getFormattedFileName(true, true));
59 | try {
60 |
61 | OkHttpClient okHttpClient = new OkHttpClient();
62 | final Request request = new Request.Builder().url(earthWallpaper.getWallDownloadUrl()).build();
63 | Response response = okHttpClient.newCall(request).execute();
64 | if(!response.isSuccessful()) {
65 | Log.d("CacheError", "Unable to cache image! " + response);
66 | return null;
67 | }
68 | InputStream inputStream = response.body().byteStream();
69 | FileOutputStream fileOutputStream = new FileOutputStream(cachedImage);
70 | IOUtils.copy(inputStream, fileOutputStream);
71 | inputStream.close();
72 | fileOutputStream.close();
73 |
74 | Log.d("ImageCache", "Finished caching image!");
75 | return cachedImage;
76 |
77 | } catch (IOException e) {
78 | e.printStackTrace();
79 | }
80 | return null;
81 | }
82 |
83 | @Override
84 | public void onPostExecute(File cachedImage) {
85 | if(cachedImage != null) imageCachingCallback.onCachingFinished(cachedImage.exists(), cachedImage);
86 | else imageCachingCallback.onCachingFinished(false, null);
87 | }
88 |
89 | }
90 |
--------------------------------------------------------------------------------
/ps-app/src/main/java/com/pddstudio/earthviewer/utils/DownloadWallpaperTask.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - ps-app
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 | package com.pddstudio.earthviewer.utils;
18 |
19 | import android.os.AsyncTask;
20 | import android.util.Log;
21 |
22 | import com.pddstudio.earthview.EarthWallpaper;
23 | import com.squareup.okhttp.OkHttpClient;
24 | import com.squareup.okhttp.Request;
25 | import com.squareup.okhttp.Response;
26 |
27 | import org.apache.commons.io.IOUtils;
28 |
29 | import java.io.File;
30 | import java.io.FileOutputStream;
31 | import java.io.IOException;
32 | import java.io.InputStream;
33 |
34 | /**
35 | * This Class was created by Patrick J
36 | * on 11.12.15. For more Details and Licensing
37 | * have a look at the README.md
38 | */
39 | public class DownloadWallpaperTask extends AsyncTask {
40 |
41 | public interface DownloadCallback {
42 | void onDownloadStarted();
43 | void onDownloadFinished(boolean success, File file);
44 | }
45 |
46 | private final File saveDirLocation;
47 | private final DownloadCallback downloadCallback;
48 | private final EarthWallpaper earthWallpaper;
49 |
50 | public DownloadWallpaperTask(DownloadCallback downloadCallback, File saveDirLocation, EarthWallpaper earthWallpaper) {
51 | this.downloadCallback = downloadCallback;
52 | this.saveDirLocation = saveDirLocation;
53 | this.earthWallpaper = earthWallpaper;
54 | }
55 |
56 | @Override
57 | public void onPreExecute() {
58 | downloadCallback.onDownloadStarted();
59 | }
60 |
61 | @Override
62 | protected File doInBackground(Boolean... params) {
63 | final File savedImage = new File(saveDirLocation, earthWallpaper.getFormattedFileName(true, true));
64 | try {
65 |
66 | OkHttpClient okHttpClient = new OkHttpClient();
67 | final Request request = new Request.Builder().url(params[0] ? earthWallpaper.getWallPhotoUrl() : earthWallpaper.getWallDownloadUrl()).build();
68 | Response response = okHttpClient.newCall(request).execute();
69 | if(!response.isSuccessful()) {
70 | Log.d("DownloadError", "Unable to download image! " + response);
71 | return null;
72 | }
73 | InputStream inputStream = response.body().byteStream();
74 | FileOutputStream fileOutputStream = new FileOutputStream(savedImage);
75 | IOUtils.copy(inputStream, fileOutputStream);
76 | inputStream.close();
77 | fileOutputStream.close();
78 |
79 | Log.d("ImageDownload", "Finished caching image!");
80 | return savedImage;
81 |
82 | } catch (IOException e) {
83 | e.printStackTrace();
84 | }
85 |
86 | return null;
87 | }
88 |
89 | @Override
90 | public void onPostExecute(File downloadedFile) {
91 | if(downloadedFile != null) downloadCallback.onDownloadFinished(downloadedFile.exists(), downloadedFile);
92 | else downloadCallback.onDownloadFinished(false, null);
93 | }
94 |
95 | }
96 |
--------------------------------------------------------------------------------
/ps-app/src/main/java/com/pddstudio/earthviewer/utils/Favorites.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 - Patrick J - ps-app
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 | package com.pddstudio.earthviewer.utils;
18 |
19 | import android.content.Context;
20 |
21 | import com.pddstudio.earthview.EarthWallpaper;
22 |
23 | import java.util.LinkedList;
24 | import java.util.List;
25 |
26 | import io.paperdb.Paper;
27 |
28 | /**
29 | * This Class was created by Patrick J
30 | * on 18.01.16. For more Details and Licensing
31 | * have a look at the README.md
32 | */
33 | public class Favorites {
34 |
35 | private static Favorites favorites;
36 | private static final String FAVORITES_LIST = "favListItems";
37 |
38 | final Context context;
39 | List favoritesList;
40 | private Favorites(Context context) {
41 | this.context = context;
42 | this.favoritesList = Paper.book().read(FAVORITES_LIST, new LinkedList());
43 | }
44 |
45 | public static Favorites getFavorites(Context context) {
46 | if(favorites == null) favorites = new Favorites(context);
47 | return favorites;
48 | }
49 |
50 | private void reloadFavorites() {
51 | this.favoritesList = Paper.book().read(FAVORITES_LIST, new LinkedList());
52 | }
53 |
54 | private void saveFavorites() {
55 | Paper.book().write(FAVORITES_LIST, favoritesList);
56 | }
57 |
58 | public boolean hasFavorites() {
59 | return !favoritesList.isEmpty();
60 | }
61 |
62 | public boolean isFavorite(EarthWallpaper earthWallpaper) {
63 | for(EarthWallpaper wallpaper : favoritesList) {
64 | if(earthWallpaper.getWallpaperId().equals(wallpaper.getWallpaperId())) return true;
65 | }
66 | return false;
67 | }
68 |
69 | public void addFavorite(EarthWallpaper earthWallpaper) {
70 | favoritesList.add(earthWallpaper);
71 | saveFavorites();
72 | reloadFavorites();
73 | }
74 |
75 | public void removeFavorite(EarthWallpaper earthWallpaper) {
76 | for(int i = 0; i < favoritesList.size(); i++) {
77 | if(favoritesList.get(i).getWallpaperId().equals(earthWallpaper.getWallpaperId())) {
78 | favoritesList.remove(i);
79 | }
80 | }
81 | saveFavorites();
82 | reloadFavorites();
83 | }
84 |
85 | public List getFavoritesList() {
86 | return favoritesList;
87 | }
88 |
89 |
90 |
91 | }
92 |
--------------------------------------------------------------------------------
/ps-app/src/main/java/com/pddstudio/earthviewer/utils/preferences/ClearCachePreference.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - ps-app
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 | package com.pddstudio.earthviewer.utils.preferences;
18 |
19 | import android.annotation.TargetApi;
20 | import android.content.Context;
21 | import android.os.Build;
22 | import android.preference.Preference;
23 | import android.util.AttributeSet;
24 | import android.util.Log;
25 |
26 | import com.pddstudio.earthviewer.R;
27 |
28 | import org.apache.commons.io.FileUtils;
29 |
30 | import java.io.File;
31 | import java.io.IOException;
32 |
33 | /**
34 | * This Class was created by Patrick J
35 | * on 08.12.15. For more Details and Licensing
36 | * have a look at the README.md
37 | */
38 | public class ClearCachePreference extends Preference {
39 |
40 | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
41 | public ClearCachePreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
42 | super(context, attrs, defStyleAttr, defStyleRes);
43 | checkSize();
44 | }
45 |
46 | public ClearCachePreference(Context context, AttributeSet attrs, int defStyleAttr) {
47 | super(context, attrs, defStyleAttr);
48 | checkSize();
49 | }
50 |
51 | public ClearCachePreference(Context context, AttributeSet attrs) {
52 | super(context, attrs);
53 | checkSize();
54 | }
55 |
56 | public ClearCachePreference(Context context) {
57 | super(context);
58 | checkSize();
59 | }
60 |
61 | private void checkSize() {
62 | long sizeMb = getCacheDirectorySize();
63 | setSummary(getSummary().toString().replace("%s", sizeMb + " Mb"));
64 | }
65 |
66 | private void clearCache() {
67 | File cacheDir = getContext().getCacheDir();
68 | try {
69 | FileUtils.cleanDirectory(cacheDir);
70 | } catch (IOException io) {
71 | io.printStackTrace();
72 | } finally {
73 | String sizeString = getContext().getResources().getString(R.string.preferences_item_clear_cache_summary);
74 | sizeString = sizeString.replace("%s", getCacheDirectorySize() + " Mb");
75 | setSummary(sizeString);
76 | }
77 | }
78 |
79 | private long getCacheDirectorySize() {
80 | File cacheDir = getContext().getCacheDir();
81 | long size = FileUtils.sizeOfDirectory(cacheDir);
82 | long sizeKb = size / 1024;
83 | return sizeKb / 1024;
84 | }
85 |
86 | @Override
87 | public void onClick() {
88 | Log.d("ClearCachePreference", "clearing cache!");
89 | clearCache();
90 | }
91 |
92 | }
93 |
--------------------------------------------------------------------------------
/ps-app/src/main/java/com/pddstudio/earthviewer/utils/preferences/ClearDirectoryPreference.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - ps-app
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 | package com.pddstudio.earthviewer.utils.preferences;
18 |
19 | import android.annotation.TargetApi;
20 | import android.content.Context;
21 | import android.os.Build;
22 | import android.preference.Preference;
23 | import android.util.AttributeSet;
24 | import android.util.Log;
25 |
26 | import com.pddstudio.earthviewer.R;
27 |
28 | import org.apache.commons.io.FileUtils;
29 |
30 | import java.io.File;
31 | import java.io.IOException;
32 |
33 | /**
34 | * This Class was created by Patrick J
35 | * on 08.12.15. For more Details and Licensing
36 | * have a look at the README.md
37 | */
38 | public class ClearDirectoryPreference extends Preference {
39 |
40 | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
41 | public ClearDirectoryPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
42 | super(context, attrs, defStyleAttr, defStyleRes);
43 | checkSize();
44 | }
45 |
46 | public ClearDirectoryPreference(Context context, AttributeSet attrs, int defStyleAttr) {
47 | super(context, attrs, defStyleAttr);
48 | checkSize();
49 | }
50 |
51 | public ClearDirectoryPreference(Context context, AttributeSet attrs) {
52 | super(context, attrs);
53 | checkSize();
54 | }
55 |
56 | public ClearDirectoryPreference(Context context) {
57 | super(context);
58 | checkSize();
59 | }
60 |
61 | private void checkSize() {
62 | setSummary(getSummary().toString().replace("%s", getFileDirectorySize() + " Mb"));
63 | }
64 |
65 | private void clearDirectory() {
66 | File cacheDir = getContext().getCacheDir();
67 | try {
68 | FileUtils.cleanDirectory(cacheDir);
69 | } catch (IOException io) {
70 | io.printStackTrace();
71 | } finally {
72 | String sizeString = getContext().getResources().getString(R.string.preferences_item_clear_internal_summary);
73 | sizeString = sizeString.replace("%s", getFileDirectorySize() + " Mb");
74 | setSummary(sizeString);
75 | }
76 | }
77 |
78 | private long getFileDirectorySize() {
79 | File cacheDir = getContext().getFilesDir();
80 | long size = FileUtils.sizeOfDirectory(cacheDir);
81 | long sizeKb = size / 1024;
82 | return sizeKb / 1024;
83 | }
84 |
85 | @Override
86 | public void onClick() {
87 | Log.d("ClearInternalDir", "clearing the internal directory!");
88 | clearDirectory();
89 | }
90 |
91 | }
92 |
--------------------------------------------------------------------------------
/ps-app/src/main/java/com/pddstudio/earthviewer/utils/preferences/InfoPreferenceItem.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - ps-app
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 | package com.pddstudio.earthviewer.utils.preferences;
18 |
19 | import android.annotation.TargetApi;
20 | import android.content.Context;
21 | import android.os.Build;
22 | import android.preference.Preference;
23 | import android.util.AttributeSet;
24 | import android.widget.Toast;
25 |
26 | /**
27 | * This Class was created by Patrick J
28 | * on 08.12.15. For more Details and Licensing
29 | * have a look at the README.md
30 | */
31 | public class InfoPreferenceItem extends Preference {
32 |
33 | int click = 0;
34 | Toast teaseToast;
35 |
36 | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
37 | public InfoPreferenceItem(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
38 | super(context, attrs, defStyleAttr, defStyleRes);
39 | }
40 |
41 | public InfoPreferenceItem(Context context, AttributeSet attrs, int defStyleAttr) {
42 | super(context, attrs, defStyleAttr);
43 | }
44 |
45 | public InfoPreferenceItem(Context context, AttributeSet attrs) {
46 | super(context, attrs);
47 | }
48 |
49 | public InfoPreferenceItem(Context context) {
50 | super(context);
51 | }
52 |
53 | private void showEasterEgg() {
54 | if(teaseToast != null) teaseToast.cancel();
55 | teaseToast = Toast.makeText(getContext(), "No, you're still not a developer!", Toast.LENGTH_SHORT);
56 | teaseToast.show();
57 | }
58 |
59 | private void showTeaser(int ammoh) {
60 | if(teaseToast != null) teaseToast.cancel();
61 | teaseToast = Toast.makeText(getContext(), "Only " + ammoh + " steps away!", Toast.LENGTH_SHORT);
62 | teaseToast.show();
63 | }
64 |
65 | @Override
66 | public void onClick() {
67 | if (click == 5) {
68 | showEasterEgg();
69 | } else if (click == 4) {
70 | showTeaser(1);
71 | } else if (click == 3) {
72 | showTeaser(2);
73 | } else if (click == 2) {
74 | showTeaser(3);
75 | }
76 | click++;
77 | }
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/ps-app/src/main/java/com/pddstudio/earthviewer/utils/preferences/SaveDirectoryPreference.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - ps-app
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 | package com.pddstudio.earthviewer.utils.preferences;
18 |
19 | import android.annotation.TargetApi;
20 | import android.content.Context;
21 | import android.os.Build;
22 | import android.preference.Preference;
23 | import android.util.AttributeSet;
24 |
25 | import com.pddstudio.earthviewer.SettingsActivity;
26 | import com.pddstudio.earthviewer.utils.Preferences;
27 |
28 | /**
29 | * This Class was created by Patrick J
30 | * on 08.12.15. For more Details and Licensing
31 | * have a look at the README.md
32 | */
33 | public class SaveDirectoryPreference extends Preference implements SettingsActivity.SettingsItem {
34 |
35 | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
36 | public SaveDirectoryPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
37 | super(context, attrs, defStyleAttr, defStyleRes);
38 | checkSaveLocation();
39 | }
40 |
41 | public SaveDirectoryPreference(Context context, AttributeSet attrs, int defStyleAttr) {
42 | super(context, attrs, defStyleAttr);
43 | checkSaveLocation();
44 | }
45 |
46 | public SaveDirectoryPreference(Context context, AttributeSet attrs) {
47 | super(context, attrs);
48 | checkSaveLocation();
49 | }
50 |
51 | public SaveDirectoryPreference(Context context) {
52 | super(context);
53 | checkSaveLocation();
54 | }
55 |
56 | private void checkSaveLocation() {
57 | String location;
58 | if(Preferences.exists() && Preferences.getInstance().canWriteExternalStorage()) {
59 | location = Preferences.getInstance().getWallpaperDownloadDirectory();
60 | } else {
61 | location = "???";
62 | }
63 | setSummary(getSummary().toString().replace("%wall%", location));
64 | }
65 |
66 | private void showDirectoryChooser() {
67 | ((SettingsActivity) getContext()).showDirectoryChooserDialog(this);
68 | }
69 |
70 | @Override
71 | public void onClick() {
72 | showDirectoryChooser();
73 | }
74 |
75 | @Override
76 | public void onStorageChanged(String newPath) {
77 | setSummary(newPath);
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/ps-app/src/main/java/com/pddstudio/earthviewer/views/AboutDialog.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - ps-app
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 | package com.pddstudio.earthviewer.views;
18 |
19 | import android.content.Context;
20 |
21 | import com.afollestad.materialdialogs.MaterialDialog;
22 |
23 | /**
24 | * This Class was created by Patrick J
25 | * on 09.12.15. For more Details and Licensing
26 | * have a look at the README.md
27 | */
28 | public final class AboutDialog {
29 |
30 | private static AboutDialog aboutDialog;
31 |
32 | private MaterialDialog dialog;
33 |
34 | private AboutDialog(Context context) {
35 | dialog = new MaterialDialog.Builder(context).build();
36 | }
37 |
38 | public static void show(Context context) {
39 | aboutDialog = new AboutDialog(context);
40 | aboutDialog.dialog.show();
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/ps-app/src/main/java/com/pddstudio/earthviewer/views/EarthViewScrollListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - ps-app
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 | package com.pddstudio.earthviewer.views;
18 |
19 | import android.support.v7.widget.GridLayoutManager;
20 | import android.support.v7.widget.RecyclerView;
21 |
22 | /**
23 | * This Class was created by Patrick J
24 | * on 09.12.15. For more Details and Licensing
25 | * have a look at the README.md
26 | */
27 | public abstract class EarthViewScrollListener extends RecyclerView.OnScrollListener {
28 |
29 | // The minimum amount of items to have below your current scroll position
30 | // before loading more.
31 | private int visibleThreshold = 5;
32 | // The current offset index of data you have loaded
33 | private int currentPage = 0;
34 | // The total number of items in the dataset after the last load
35 | private int previousTotalItemCount = 0;
36 | // True if we are still waiting for the last set of data to load.
37 | private boolean loading = true;
38 | // Sets the starting page index
39 | private int startingPageIndex = 0;
40 |
41 | private RecyclerView.LayoutManager layoutManager;
42 |
43 | public EarthViewScrollListener(RecyclerView.LayoutManager layoutManager) {
44 | this.layoutManager = layoutManager;
45 | }
46 |
47 | // This happens many times a second during a scroll, so be wary of the code you place here.
48 | // We are given a few useful parameters to help us work out if we need to load some more data,
49 | // but first we check if we are waiting for the previous load to finish.
50 | @Override
51 | public void onScrolled(RecyclerView view, int dx, int dy) {
52 | int firstVisibleItem = ((GridLayoutManager) layoutManager).findFirstVisibleItemPosition();
53 | int visibleItemCount = view.getChildCount();
54 | int totalItemCount = layoutManager.getItemCount();
55 |
56 | // If the total item count is zero and the previous isn't, assume the
57 | // list is invalidated and should be reset back to initial state
58 | if (totalItemCount < previousTotalItemCount) {
59 | this.currentPage = this.startingPageIndex;
60 | this.previousTotalItemCount = totalItemCount;
61 | if (totalItemCount == 0) {
62 | this.loading = true;
63 | }
64 | }
65 | // If it’s still loading, we check to see if the dataset count has
66 | // changed, if so we conclude it has finished loading and update the current page
67 | // number and total item count.
68 | if (loading && (totalItemCount > previousTotalItemCount)) {
69 | loading = false;
70 | previousTotalItemCount = totalItemCount;
71 | }
72 |
73 | // If it isn’t currently loading, we check to see if we have breached
74 | // the visibleThreshold and need to reload more data.
75 | // If we do need to reload some more data, we execute onLoadMore to fetch the data.
76 | if (!loading && (totalItemCount - visibleItemCount) <= (firstVisibleItem + visibleThreshold)) {
77 | currentPage++;
78 | onLoadMore(currentPage, totalItemCount);
79 | loading = true;
80 | }
81 | }
82 |
83 | // Defines the process for actually loading more data based on page
84 | public abstract void onLoadMore(int page, int totalItemsCount);
85 |
86 | }
87 |
--------------------------------------------------------------------------------
/ps-app/src/main/java/com/pddstudio/earthviewer/views/SquaredImageView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - ps-app
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 | package com.pddstudio.earthviewer.views;
18 |
19 | import android.annotation.TargetApi;
20 | import android.content.Context;
21 | import android.os.Build;
22 | import android.util.AttributeSet;
23 | import android.widget.ImageView;
24 |
25 | /**
26 | * @author Aidan Follestad (afollestad)
27 | */
28 | public class SquaredImageView extends ImageView {
29 |
30 | public SquaredImageView(Context context) {
31 | super(context);
32 | }
33 |
34 | public SquaredImageView(Context context, AttributeSet attrs) {
35 | super(context, attrs);
36 | }
37 |
38 | public SquaredImageView(Context context, AttributeSet attrs, int defStyleAttr) {
39 | super(context, attrs, defStyleAttr);
40 | }
41 |
42 | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
43 | public SquaredImageView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
44 | super(context, attrs, defStyleAttr, defStyleRes);
45 | }
46 |
47 | @Override
48 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
49 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
50 | //noinspection SuspiciousNameCombination
51 | setMeasuredDimension(widthMeasureSpec, widthMeasureSpec);
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/ps-app/src/main/java/com/pddstudio/earthviewer/views/about/AboutFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - ps-app
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 | package com.pddstudio.earthviewer.views.about;
18 |
19 | import android.os.Bundle;
20 | import android.support.annotation.Nullable;
21 | import android.view.LayoutInflater;
22 | import android.view.View;
23 | import android.view.ViewGroup;
24 |
25 | import com.mikepenz.aboutlibraries.ui.LibsFragment;
26 |
27 | /**
28 | * This Class was created by Patrick J
29 | * on 13.12.15. For more Details and Licensing
30 | * have a look at the README.md
31 | */
32 | public class AboutFragment extends LibsFragment {
33 |
34 | private AboutFragmentCompat libsFragmentCompat = new AboutFragmentCompat();
35 |
36 | public AboutFragment() {
37 | super();
38 | }
39 |
40 | @Nullable
41 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
42 | return this.libsFragmentCompat.onCreateView(container.getContext(), inflater, container, savedInstanceState, this.getArguments());
43 | }
44 |
45 | public void onViewCreated(View view, Bundle savedInstanceState) {
46 | super.onViewCreated(view, savedInstanceState);
47 | this.libsFragmentCompat.onViewCreated(view, savedInstanceState);
48 | }
49 |
50 | public void onDestroyView() {
51 | this.libsFragmentCompat.onDestroyView();
52 | super.onDestroyView();
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/ps-app/src/main/java/com/pddstudio/earthviewer/views/about/AboutFragmentCompat.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - ps-app
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 | package com.pddstudio.earthviewer.views.about;
18 |
19 | import android.os.AsyncTask;
20 |
21 | import com.mikepenz.aboutlibraries.LibsFragmentCompat;
22 |
23 | /**
24 | * This Class was created by Patrick J
25 | * on 13.12.15. For more Details and Licensing
26 | * have a look at the README.md
27 | */
28 | public class AboutFragmentCompat extends LibsFragmentCompat {
29 |
30 | public AboutFragmentCompat() {
31 | super();
32 | }
33 |
34 | @Override
35 | protected void executeLibTask(LibsFragmentCompat.LibraryTask libraryTask) {
36 | if(libraryTask != null) {
37 | libraryTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
38 | }
39 |
40 | }
41 |
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/ps-app/src/main/java/com/pddstudio/earthviewer/views/about/CustomLibs.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - ps-app
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 | package com.pddstudio.earthviewer.views.about;
18 |
19 | import android.content.Context;
20 | import android.os.Bundle;
21 |
22 | import com.mikepenz.aboutlibraries.LibsBuilder;
23 |
24 | /**
25 | * This Class was created by Patrick J
26 | * on 13.12.15. For more Details and Licensing
27 | * have a look at the README.md
28 | */
29 | public class CustomLibs extends LibsBuilder {
30 |
31 | public CustomLibs() {
32 | super();
33 | }
34 |
35 | public AboutFragment getFragment() {
36 | Bundle bundle = new Bundle();
37 | bundle.putSerializable("data", this);
38 | AboutFragment aboutFragment = new AboutFragment();
39 | aboutFragment.setArguments(bundle);
40 | return aboutFragment;
41 | }
42 |
43 | @Override
44 | public void activity(Context ctx) {
45 | this.start(ctx);
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/ps-app/src/main/java/com/pddstudio/earthviewer/views/utils/CustomFabBehavior.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - ps-app
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 | package com.pddstudio.earthviewer.views.utils;
18 |
19 | import android.content.Context;
20 | import android.support.design.widget.CoordinatorLayout;
21 | import android.support.design.widget.Snackbar.SnackbarLayout;
22 | import android.util.AttributeSet;
23 | import android.view.View;
24 |
25 | import com.github.clans.fab.FloatingActionMenu;
26 |
27 | /**
28 | * This Class was created by Patrick J
29 | * on 27.08.15. For more Details and Licensing
30 | * have a look at the README.md
31 | */
32 | public class CustomFabBehavior extends CoordinatorLayout.Behavior {
33 |
34 | public CustomFabBehavior (Context context, AttributeSet attributeSet) {}
35 |
36 | @Override
37 | public boolean layoutDependsOn(CoordinatorLayout parent, FloatingActionMenu child, View dependency) {
38 | return dependency instanceof SnackbarLayout;
39 | }
40 |
41 | @Override
42 | public boolean onDependentViewChanged(CoordinatorLayout parent, FloatingActionMenu child, View dependency) {
43 | float translationY = Math.min(0, dependency.getTranslationY() - dependency.getHeight());
44 | child.setTranslationY(translationY);
45 | return true;
46 | }
47 |
48 | }
--------------------------------------------------------------------------------
/ps-app/src/main/java/com/pddstudio/earthviewer/views/utils/ScrollFabBehavior.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - ps-app
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 | package com.pddstudio.earthviewer.views.utils;
18 |
19 | import android.content.Context;
20 | import android.support.design.widget.AppBarLayout;
21 | import android.support.design.widget.CoordinatorLayout;
22 | import android.support.v4.view.ViewCompat;
23 | import android.support.v7.widget.Toolbar;
24 | import android.util.AttributeSet;
25 | import android.view.View;
26 |
27 | import com.github.clans.fab.FloatingActionMenu;
28 | import com.pddstudio.earthviewer.R;
29 |
30 | /**
31 | * This Class was created by Patrick J
32 | * on 10.10.15. For more Details and Licensing
33 | * have a look at the README.md
34 | */
35 | public class ScrollFabBehavior extends CoordinatorLayout.Behavior {
36 |
37 | public ScrollFabBehavior(Context context, AttributeSet attributeSet) {}
38 |
39 | @Override
40 | public boolean layoutDependsOn(CoordinatorLayout parent, FloatingActionMenu child, View dependency) {
41 | return dependency instanceof AppBarLayout;
42 | }
43 |
44 | @Override
45 | public boolean onDependentViewChanged(CoordinatorLayout parent, FloatingActionMenu child, View dependency) {
46 | Toolbar toolbar = (Toolbar) parent.findViewById(R.id.toolbar_details_view);
47 | int tHeight = 0;
48 | int depHeight = dependency.getHeight();
49 | int depMeasHeight = dependency.getMeasuredHeight();
50 | int depMinHeight = dependency.getMinimumHeight();
51 |
52 |
53 | tHeight = toolbar.getHeight();
54 |
55 | /*Log.i("BEHAVIOR", "tHeight: " + tHeight
56 | + " depHeight: " + depHeight
57 | + " depMeasured: " + depMeasHeight
58 | + " depMinHeight: " + depMinHeight);
59 |
60 | Log.i("FAB", "transY: " + child.getTranslationY() + " y: " + child.getY() + " x: " + child.getX());*/
61 |
62 | int hideCorn = tHeight + ((tHeight/100) * 95);
63 | if(child.getY() < hideCorn) {
64 | if(!child.isMenuButtonHidden()) child.hideMenuButton(true);
65 | } else if (child.getY() > hideCorn) {
66 | if(child.isMenuButtonHidden()) child.showMenuButton(true);
67 | }
68 |
69 | /*AppBarLayout dep = (AppBarLayout) dependency;
70 | if(dep.getHeight() < (tHeight + 50)) {
71 | child.hide(true);
72 | } else {
73 | child.show(true);
74 | }*/
75 |
76 | return true;
77 | }
78 |
79 | @Override
80 | public boolean onStartNestedScroll(final CoordinatorLayout coordinatorLayout,
81 | final FloatingActionMenu child,
82 | final View directTargetChild,
83 | final View target,
84 | final int nestedScrollAxes) {
85 | // Ensure we react to vertical scrolling
86 | return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL
87 | || super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target, nestedScrollAxes);
88 | }
89 |
90 | @Override
91 | public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionMenu child,
92 | View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
93 | super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed,
94 | dyUnconsumed);
95 |
96 | if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) {
97 | child.hideMenuButton(true);
98 | } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
99 | child.showMenuButton(true);
100 | }
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/drawable-hdpi/ic_info_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/src/main/res/drawable-hdpi/ic_info_black_24dp.png
--------------------------------------------------------------------------------
/ps-app/src/main/res/drawable-hdpi/ic_notifications_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/src/main/res/drawable-hdpi/ic_notifications_black_24dp.png
--------------------------------------------------------------------------------
/ps-app/src/main/res/drawable-hdpi/ic_sync_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/src/main/res/drawable-hdpi/ic_sync_black_24dp.png
--------------------------------------------------------------------------------
/ps-app/src/main/res/drawable-mdpi/ic_info_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/src/main/res/drawable-mdpi/ic_info_black_24dp.png
--------------------------------------------------------------------------------
/ps-app/src/main/res/drawable-mdpi/ic_notifications_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/src/main/res/drawable-mdpi/ic_notifications_black_24dp.png
--------------------------------------------------------------------------------
/ps-app/src/main/res/drawable-mdpi/ic_sync_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/src/main/res/drawable-mdpi/ic_sync_black_24dp.png
--------------------------------------------------------------------------------
/ps-app/src/main/res/drawable-v21/ic_info_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
22 |
25 |
26 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/drawable-v21/ic_notifications_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
22 |
25 |
26 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/drawable-v21/ic_sync_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
22 |
25 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/drawable-xhdpi/ic_info_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/src/main/res/drawable-xhdpi/ic_info_black_24dp.png
--------------------------------------------------------------------------------
/ps-app/src/main/res/drawable-xhdpi/ic_notifications_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/src/main/res/drawable-xhdpi/ic_notifications_black_24dp.png
--------------------------------------------------------------------------------
/ps-app/src/main/res/drawable-xhdpi/ic_sync_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/src/main/res/drawable-xhdpi/ic_sync_black_24dp.png
--------------------------------------------------------------------------------
/ps-app/src/main/res/drawable-xxhdpi/ic_info_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/src/main/res/drawable-xxhdpi/ic_info_black_24dp.png
--------------------------------------------------------------------------------
/ps-app/src/main/res/drawable-xxhdpi/ic_notifications_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/src/main/res/drawable-xxhdpi/ic_notifications_black_24dp.png
--------------------------------------------------------------------------------
/ps-app/src/main/res/drawable-xxhdpi/ic_sync_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/src/main/res/drawable-xxhdpi/ic_sync_black_24dp.png
--------------------------------------------------------------------------------
/ps-app/src/main/res/drawable-xxxhdpi/ic_info_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/src/main/res/drawable-xxxhdpi/ic_info_black_24dp.png
--------------------------------------------------------------------------------
/ps-app/src/main/res/drawable-xxxhdpi/ic_notifications_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/src/main/res/drawable-xxxhdpi/ic_notifications_black_24dp.png
--------------------------------------------------------------------------------
/ps-app/src/main/res/drawable-xxxhdpi/ic_sync_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/src/main/res/drawable-xxxhdpi/ic_sync_black_24dp.png
--------------------------------------------------------------------------------
/ps-app/src/main/res/drawable/earthviewicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/src/main/res/drawable/earthviewicon.png
--------------------------------------------------------------------------------
/ps-app/src/main/res/drawable/rounded_shape.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/layout/activity_about.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
25 |
26 |
30 |
31 |
37 |
38 |
39 |
40 |
41 |
42 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/layout/activity_demo.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
27 |
28 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/layout/activity_demo_pre.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
27 |
28 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/layout/activity_favorites.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
25 |
26 |
31 |
32 |
38 |
39 |
40 |
41 |
48 |
49 |
56 |
57 |
58 |
59 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/layout/activity_favorites_activity_pre.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/layout/activity_muzei_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/layout/activity_preferences.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
24 |
25 |
32 |
33 |
38 |
39 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/layout/activity_settings_activity_pre.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/layout/activity_wallpaper_activity_pre.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/layout/content_about.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/layout/content_demo_pre.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
27 |
28 |
37 |
38 |
47 |
48 |
61 |
62 |
70 |
71 |
78 |
79 |
80 |
81 |
87 |
88 |
89 |
99 |
100 |
109 |
110 |
119 |
120 |
121 |
122 |
123 |
124 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/layout/drawer_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
23 |
24 |
33 |
34 |
44 |
45 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/layout/earthview_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
25 |
26 |
33 |
34 |
48 |
49 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/layout/muzei_dialog_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
29 |
30 |
35 |
36 |
45 |
46 |
53 |
54 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/menu/wall_prev_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/mipmap-hdpi/earthviewicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/src/main/res/mipmap-hdpi/earthviewicon.png
--------------------------------------------------------------------------------
/ps-app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ps-app/src/main/res/mipmap-mdpi/earthviewicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/src/main/res/mipmap-mdpi/earthviewicon.png
--------------------------------------------------------------------------------
/ps-app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ps-app/src/main/res/mipmap-xhdpi/earthviewicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/src/main/res/mipmap-xhdpi/earthviewicon.png
--------------------------------------------------------------------------------
/ps-app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ps-app/src/main/res/mipmap-xxhdpi/earthviewicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/src/main/res/mipmap-xxhdpi/earthviewicon.png
--------------------------------------------------------------------------------
/ps-app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ps-app/src/main/res/mipmap-xxxhdpi/earthviewicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/src/main/res/mipmap-xxxhdpi/earthviewicon.png
--------------------------------------------------------------------------------
/ps-app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/ps-app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ps-app/src/main/res/transition/change_image_transform.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/transition/fade_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
21 | 64dp
22 |
23 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/values/about.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 | true
21 | true
22 |
23 | free and open-source Application.
Created by Patrick J
Licensed under the Apache 2.0 License]]>
24 |
25 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/values/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 | - Temporary (per Session only)
21 | - Permanent (save on device)
22 |
23 |
24 |
25 | - Use built in List
26 | - Use the web-api\'s List (recommended)
27 |
28 |
29 |
30 | - 1
31 | - 2
32 | - 3
33 | - 4
34 | - 5
35 |
36 |
37 |
38 | - 1 Column(s)
39 | - 2 Column(s)
40 | - 3 Column(s)
41 | - 4 Column(s)
42 | - 5 Column(s)
43 |
44 |
45 |
46 | - 1
47 | - 2
48 | - 3
49 | - 4
50 |
51 |
52 |
53 | - Roboto (Default)
54 | - Roboto Mono
55 | - Roboto Slab
56 | - Open Sans
57 |
58 |
59 |
60 | - Only cache Thumbnails
61 | - Cache entire Wallpaper
62 |
63 |
64 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 | #4499f6
20 | #1976D2
21 | #84C142
22 | #FAFAFA
23 | #FFFFFF
24 |
25 | #32000000
26 | #DE000000
27 | #54000000
28 | #38000000
29 |
30 | @color/colorAccent
31 | @color/colorAccent
32 | @color/colorAccent
33 |
34 | #B3FFFFFF
35 | #F44336
36 | #54000000
37 |
38 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 | 16dp
20 | 16dp
21 | 16dp
22 | 16dp
23 | 24dp
24 |
25 | 72dp
26 | 16sp
27 | 14sp
28 |
29 |
30 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/values/other_lib_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
23 |
24 |
25 |
26 | Dmytro Tarianyk
27 | https://github.com/Clans
28 | FloatingActionButton
29 | Yet another implementation of Floating Action Button for Android with lots of features.
30 | 1.6.2
31 | https://github.com/Clans/FloatingActionButton
32 | apache_2_0
33 | true
34 | https://github.com/Clans/FloatingActionButton
35 |
36 |
37 |
38 | Arlib
39 | https://github.com/arimorty
40 | Floating Search View
41 | An implementation of a floating search box with search suggestions.
42 | 1.1.2
43 | https://github.com/arimorty/floatingsearchview
44 | apache_2_0
45 | true
46 | https://github.com/arimorty/floatingsearchview
47 |
48 |
49 |
50 | Aleksey Masny
51 | https://github.com/pilgr
52 | Paper
53 | Paper is a fast NoSQL data storage for Android that lets you save/restore Java objects by using efficient Kryo serialization and handling data structure changes automatically.
54 | 1.1
55 | https://github.com/pilgr/Paper
56 | apache_2_0
57 | true
58 | https://github.com/pilgr/Paper
59 |
60 |
61 |
62 | Etienne Lawlor
63 | https://medium.com/@etiennelawlor
64 | QuickReturn
65 | QuickReturn is a library which showcases the QuickReturn UI Pattern. The QuickReturn UI Pattern reveals or hides a header or footer as content is scrolled up or down.
66 | 0.0.3
67 | https://github.com/lawloretienne/QuickReturn
68 | apache_2_0
69 | true
70 | https://github.com/lawloretienne/QuickReturn
71 |
72 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
26 |
27 |
31 |
32 |
33 |
34 |
35 |
36 |
44 |
45 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/xml/preferences.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
22 |
24 |
32 |
33 |
38 |
39 |
44 |
45 |
50 |
51 |
55 |
56 |
57 |
58 |
60 |
61 |
68 |
69 |
76 |
77 |
82 |
83 |
84 |
85 |
87 |
88 |
91 |
92 |
95 |
96 |
97 |
98 |
100 |
101 |
105 |
106 |
107 |
108 |
--------------------------------------------------------------------------------
/ps-app/src/main/res/xml/providers.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/ps-app/src/test/java/com/pddstudio/wallpaperrecyclerdemo/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.wallpaperrecyclerdemo;
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 | }
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 - Patrick J - EarthViewDemo
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 | include ':app', ':earthview-android', ':ps-app', ':wheelview-test'
--------------------------------------------------------------------------------
/wheelview-test/build.gradle:
--------------------------------------------------------------------------------
1 | configurations.create("default")
2 | artifacts.add("default", file('library-release.aar'))
--------------------------------------------------------------------------------
/wheelview-test/library-release.aar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/earthview-android/03c9a2458c070875c8541c229161f4b4b594f39e/wheelview-test/library-release.aar
--------------------------------------------------------------------------------