├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── values-v21
│ │ │ │ └── styles.xml
│ │ │ ├── ic_launcher.png
│ │ │ ├── drawable
│ │ │ │ ├── back1.png
│ │ │ │ ├── back2.png
│ │ │ │ ├── instagram.png
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── person_blue.png
│ │ │ │ ├── side_nav_bar.xml
│ │ │ │ ├── rounded_corners.xml
│ │ │ │ ├── ic_add_black_24dp.xml
│ │ │ │ ├── ic_check_black_24dp.xml
│ │ │ │ ├── ic_delete_black_24dp.xml
│ │ │ │ ├── ic_star_black_24dp.xml
│ │ │ │ ├── ic_person_black_24dp.xml
│ │ │ │ ├── ic_feedback_black_24dp.xml
│ │ │ │ ├── ic_person_add_black_24dp.xml
│ │ │ │ ├── ic_info_outline_black_24dp.xml
│ │ │ │ ├── ic_error_outline_black_24dp.xml
│ │ │ │ ├── ic_more_vert_black_24dp.xml
│ │ │ │ ├── ic_access_time_black_24dp.xml
│ │ │ │ ├── ic_library_music_black_24dp.xml
│ │ │ │ ├── ic_history_black_24dp.xml
│ │ │ │ ├── ic_assignment_black_24dp.xml
│ │ │ │ ├── ic_wallpaper_black_24dp.xml
│ │ │ │ ├── ic_help_black_24dp.xml
│ │ │ │ ├── ic_people_black_24dp.xml
│ │ │ │ ├── ic_share_black_24dp.xml
│ │ │ │ ├── ic_settings_black_24dp.xml
│ │ │ │ └── ic_launcher_background.xml
│ │ │ ├── drawable-v21
│ │ │ │ ├── heart_icon.png
│ │ │ │ ├── ic_menu_send.xml
│ │ │ │ ├── ic_menu_slideshow.xml
│ │ │ │ ├── ic_menu_gallery.xml
│ │ │ │ ├── ic_menu_manage.xml
│ │ │ │ ├── ic_menu_camera.xml
│ │ │ │ └── ic_menu_share.xml
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ ├── ic_launcher_foreground.png
│ │ │ │ └── ic_launcher_round_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ ├── ic_launcher_foreground.png
│ │ │ │ └── ic_launcher_round_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ ├── ic_launcher_foreground.png
│ │ │ │ └── ic_launcher_round_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ ├── ic_launcher_foreground.png
│ │ │ │ └── ic_launcher_round_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ ├── ic_launcher_foreground.png
│ │ │ │ └── ic_launcher_round_round.png
│ │ │ ├── menu
│ │ │ │ ├── menu_blocked_item.xml
│ │ │ │ ├── activity_main.xml
│ │ │ │ ├── menu_request_item.xml
│ │ │ │ ├── menu_friend_item.xml
│ │ │ │ ├── menu_about.xml
│ │ │ │ ├── menu_history_activity.xml
│ │ │ │ └── activity_main_drawer.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ ├── ic_launcher_round.xml
│ │ │ │ └── ic_launcher_round_round.xml
│ │ │ ├── layout
│ │ │ │ ├── dialog_terms_of_usage.xml
│ │ │ │ ├── block_switch.xml
│ │ │ │ ├── activity_main.xml
│ │ │ │ ├── fragment_requests.xml
│ │ │ │ ├── fragment_friends.xml
│ │ │ │ ├── add_friend_dialog_custom_view.xml
│ │ │ │ ├── activity_login_signup.xml
│ │ │ │ ├── fragment_block_list.xml
│ │ │ │ ├── nav_header_activity_main.xml
│ │ │ │ ├── activity_set_as_wallapaper.xml
│ │ │ │ ├── item_history_else_changed.xml
│ │ │ │ ├── activity_history.xml
│ │ │ │ ├── item_blocked_contact.xml
│ │ │ │ ├── item_friend_request.xml
│ │ │ │ ├── item_history_changd_self.xml
│ │ │ │ ├── item_added_friend.xml
│ │ │ │ ├── app_bar_activity_main.xml
│ │ │ │ ├── fragment_profile.xml
│ │ │ │ ├── fragment_login.xml
│ │ │ │ ├── activity_about_us.xml
│ │ │ │ ├── fragment_signup.xml
│ │ │ │ └── activity_faq.xml
│ │ │ ├── values
│ │ │ │ ├── drawables.xml
│ │ │ │ ├── colors.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ └── styles.xml
│ │ │ └── drawable-v24
│ │ │ │ └── ic_launcher_foreground.xml
│ │ ├── assets
│ │ │ └── fonts
│ │ │ │ └── asap.ttf
│ │ ├── ic_launcher_round-web.png
│ │ ├── java
│ │ │ └── in
│ │ │ │ └── thetechguru
│ │ │ │ └── walle
│ │ │ │ └── remote
│ │ │ │ └── abremotewallpaperchanger
│ │ │ │ ├── history
│ │ │ │ ├── HistoryDB.java
│ │ │ │ ├── HistoryDAO.java
│ │ │ │ ├── HistoryItem.java
│ │ │ │ └── HistoryRepo.java
│ │ │ │ ├── model
│ │ │ │ ├── Constants.java
│ │ │ │ ├── User.java
│ │ │ │ └── HttpsRequestPayload.java
│ │ │ │ ├── preferences
│ │ │ │ └── Preferences.java
│ │ │ │ ├── helpers
│ │ │ │ ├── ViewPagerAdapter.java
│ │ │ │ ├── UtilityFun.java
│ │ │ │ └── FirebaseUtil.java
│ │ │ │ ├── fcm
│ │ │ │ └── MyFirebaseInstanceIdService.java
│ │ │ │ ├── MyApp.java
│ │ │ │ ├── activity_fragments
│ │ │ │ ├── ActivityFAQ.java
│ │ │ │ ├── ActivityLoginSignup.java
│ │ │ │ ├── ActivityAbout.java
│ │ │ │ ├── ActivityPermissionSeek.java
│ │ │ │ └── FragmentLogin.java
│ │ │ │ └── tasks
│ │ │ │ ├── SendHttpsRequest.java
│ │ │ │ └── SetWallpaper.java
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── in
│ │ │ └── thetechguru
│ │ │ └── walle
│ │ │ └── remote
│ │ │ └── abremotewallpaperchanger
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── in
│ │ └── thetechguru
│ │ └── walle
│ │ └── remote
│ │ └── abremotewallpaperchanger
│ │ └── ExampleInstrumentedTest.java
├── release
│ ├── app-release.apk
│ └── output.json
├── google-services.json
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .idea
├── vcs.xml
├── runConfigurations.xml
├── gradle.xml
└── misc.xml
├── .gitignore
├── gradle.properties
├── README.md
├── gradlew.bat
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/app/release/app-release.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/app/release/app-release.apk
--------------------------------------------------------------------------------
/app/src/main/res/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/app/src/main/res/ic_launcher.png
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/assets/fonts/asap.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/app/src/main/assets/fonts/asap.ttf
--------------------------------------------------------------------------------
/app/src/main/res/drawable/back1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/app/src/main/res/drawable/back1.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/back2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/app/src/main/res/drawable/back2.png
--------------------------------------------------------------------------------
/app/src/main/ic_launcher_round-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/app/src/main/ic_launcher_round-web.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/instagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/app/src/main/res/drawable/instagram.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/app/src/main/res/drawable/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/person_blue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/app/src/main/res/drawable/person_blue.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/heart_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/app/src/main/res/drawable-v21/heart_icon.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amit-bhandari/AB-Remote-Wallpaper-Changer/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round_round.png
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/release/output.json:
--------------------------------------------------------------------------------
1 | [{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":16,"versionName":"1.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_blocked_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue May 15 19:44:15 IST 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
7 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 | /.idea/*
11 | .idea/*
12 | Google Play Android Developer-a57c9e5eeb49.p12
13 | keystore.properties
14 | reemote_walle.jks
15 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/side_nav_bar.xml:
--------------------------------------------------------------------------------
1 |
3 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/rounded_corners.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_send.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/dialog_terms_of_usage.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_add_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_check_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_delete_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_star_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_person_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_feedback_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_request_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_slideshow.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_gallery.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_manage.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_person_add_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_info_outline_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_error_outline_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_more_vert_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_access_time_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_friend_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/test/java/in/thetechguru/walle/remote/abremotewallpaperchanger/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package in.thetechguru.walle.remote.abremotewallpaperchanger;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_library_music_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_history_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_assignment_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_wallpaper_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values/drawables.xml:
--------------------------------------------------------------------------------
1 |
2 | - @android:drawable/ic_menu_camera
3 | - @android:drawable/ic_menu_gallery
4 | - @android:drawable/ic_menu_slideshow
5 | - @android:drawable/ic_menu_manage
6 | - @android:drawable/ic_menu_share
7 | - @android:drawable/ic_menu_send
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/block_switch.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_camera.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_about.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_help_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_history_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_people_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_share.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_share_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 | #ffffff
8 | #00000000
9 | #292929
10 | #70000000
11 |
12 | #457c4dff
13 |
14 | #515151
15 |
16 | #00a40207
17 | #a0010015
18 |
19 | #aeadad
20 |
21 | #50060606
22 | #e60101
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 8dp
6 | 176dp
7 | 16dp
8 |
9 |
10 | 24sp
11 | 5dp
12 | 80dp
13 | 14sp
14 | 5dp
15 | 16sp
16 | 5dp
17 | 16sp
18 | 5dp
19 | 30dp
20 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/in/thetechguru/walle/remote/abremotewallpaperchanger/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package in.thetechguru.walle.remote.abremotewallpaperchanger;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("in.thetechguru.walle.remote.abremotewallpaperchanger", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/java/in/thetechguru/walle/remote/abremotewallpaperchanger/history/HistoryDB.java:
--------------------------------------------------------------------------------
1 | package in.thetechguru.walle.remote.abremotewallpaperchanger.history;
2 |
3 | import android.arch.persistence.room.Database;
4 | import android.arch.persistence.room.RoomDatabase;
5 |
6 | /**
7 | Copyright 2017 Amit Bhandari AB
8 | Licensed under the Apache License, Version 2.0 (the "License");
9 | you may not use this file except in compliance with the License.
10 | You may obtain a copy of the License at
11 | http://www.apache.org/licenses/LICENSE-2.0
12 | Unless required by applicable law or agreed to in writing, software
13 | distributed under the License is distributed on an "AS IS" BASIS,
14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | See the License for the specific language governing permissions and
16 | limitations under the License.
17 | */
18 |
19 | @Database(entities = {HistoryItem.class}, version = 2, exportSchema = false)
20 | public abstract class HistoryDB extends RoomDatabase {
21 |
22 | public abstract HistoryDAO historyDAO();
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/java/in/thetechguru/walle/remote/abremotewallpaperchanger/model/Constants.java:
--------------------------------------------------------------------------------
1 | package in.thetechguru.walle.remote.abremotewallpaperchanger.model;
2 |
3 | /**
4 | Copyright 2017 Amit Bhandari AB
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 | http://www.apache.org/licenses/LICENSE-2.0
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 | */
15 |
16 | public class Constants {
17 |
18 | public static final String CHANNEL_ID = "my_channel";
19 |
20 | public interface ACTIONS{
21 | String REFRESH_FRIEND_LIST = "refresh.friends.list";
22 | String REFRESH_BLOCK_LIST = "refresh.block.list";
23 | String REFRESH_REQUESTS = "refresh.requests.list";
24 | }
25 |
26 |
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # AB-Remote-Wallpaper-Changer
2 | Unique Android App built using Firebase to change wallpaper of device remotely.
3 |
4 | Hobby project, you may find it useful. Using this simple android app, you can change wallapper of someone who has same app installed in his/her phone. You need to him/her as a friend before being able to change the wallpaper though.
5 |
6 | Try it out here
7 |
8 |
9 |
11 |
12 |
13 | Here are some screenshots
14 |
15 | 
16 |
17 | 
18 |
19 | 
20 |
21 | 
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_settings_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/java/in/thetechguru/walle/remote/abremotewallpaperchanger/model/User.java:
--------------------------------------------------------------------------------
1 | package in.thetechguru.walle.remote.abremotewallpaperchanger.model;
2 |
3 | /**
4 | Copyright 2017 Amit Bhandari AB
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 | http://www.apache.org/licenses/LICENSE-2.0
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 | */
15 |
16 | public class User {
17 | public String username;
18 | public String pic_url;
19 | public String display_name;
20 |
21 | public boolean block_status = false;
22 |
23 | public User(String display_name,String username, String pic_url){
24 | this.display_name = display_name;
25 | this.username = username;
26 | this.pic_url = pic_url;
27 | }
28 |
29 | public User(String username, String pic_url){
30 | this.display_name = "";
31 | this.username = username;
32 | this.pic_url = pic_url;
33 | }
34 |
35 | public User(){}
36 | }
37 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
18 |
19 |
24 |
25 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/java/in/thetechguru/walle/remote/abremotewallpaperchanger/preferences/Preferences.java:
--------------------------------------------------------------------------------
1 | package in.thetechguru.walle.remote.abremotewallpaperchanger.preferences;
2 |
3 | import android.content.Context;
4 | import android.preference.PreferenceManager;
5 |
6 | public class Preferences {
7 |
8 | public static boolean isAdsRemoved(Context context){
9 | return get(context, "is_ad_removed",false);
10 | }
11 |
12 | public static void setAdsRemoved(Context context, boolean value){
13 | set(context, "is_ad_removed",value);
14 | }
15 |
16 | private static String get(Context context, String key, String defaultValue) {
17 | return PreferenceManager.getDefaultSharedPreferences(context)
18 | .getString(key, defaultValue);
19 | }
20 |
21 | private static boolean get(Context context, String key, boolean defaultValue) {
22 | return PreferenceManager.getDefaultSharedPreferences(context)
23 | .getBoolean(key, defaultValue);
24 | }
25 |
26 | private static void set(Context context, String key, String value) {
27 | PreferenceManager.getDefaultSharedPreferences(context)
28 | .edit()
29 | .putString(key, value)
30 | .apply();
31 | }
32 |
33 | private static void set(Context context, String key, boolean value) {
34 | PreferenceManager.getDefaultSharedPreferences(context)
35 | .edit()
36 | .putBoolean(key, value)
37 | .apply();
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/java/in/thetechguru/walle/remote/abremotewallpaperchanger/model/HttpsRequestPayload.java:
--------------------------------------------------------------------------------
1 | package in.thetechguru.walle.remote.abremotewallpaperchanger.model;
2 |
3 | /**
4 | Copyright 2017 Amit Bhandari AB
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 | http://www.apache.org/licenses/LICENSE-2.0
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 | */
15 |
16 | public class HttpsRequestPayload {
17 | public String toUserName;
18 | public String fromUserName;
19 | public String statusCode;
20 |
21 | //can be null
22 | public String wallpaperUrl;
23 |
24 | public HttpsRequestPayload(String toUserName, String fromUserName, String statusCode, String wallpaperUrl){
25 | this.toUserName = toUserName;
26 | this.fromUserName = fromUserName;
27 | this.statusCode = statusCode;
28 | this.wallpaperUrl = wallpaperUrl;
29 | }
30 |
31 | public interface STATUS_CODE {
32 | String FRIEND_REQUEST = "0";
33 | String FRIEND_ADDED = "1";
34 | String CHANGE_WALLPAPER = "2";
35 | String WALLPAPER_CHANGED = "3";
36 | String WALLPAPER_CHANGE_FAILED = "4";
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/app/src/main/java/in/thetechguru/walle/remote/abremotewallpaperchanger/history/HistoryDAO.java:
--------------------------------------------------------------------------------
1 | package in.thetechguru.walle.remote.abremotewallpaperchanger.history;
2 |
3 | import android.arch.persistence.room.Dao;
4 | import android.arch.persistence.room.Delete;
5 | import android.arch.persistence.room.Insert;
6 | import android.arch.persistence.room.Query;
7 | import android.arch.persistence.room.Update;
8 |
9 | import java.util.List;
10 |
11 | import static android.arch.persistence.room.OnConflictStrategy.REPLACE;
12 |
13 | /**
14 | Copyright 2017 Amit Bhandari AB
15 | Licensed under the Apache License, Version 2.0 (the "License");
16 | you may not use this file except in compliance with the License.
17 | You may obtain a copy of the License at
18 | http://www.apache.org/licenses/LICENSE-2.0
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 | @Dao
27 | public interface HistoryDAO {
28 |
29 | @Query("SELECT * FROM historyitem ORDER BY timestamp DESC")
30 | List getHistoryItems();
31 |
32 | @Insert(onConflict = REPLACE)
33 | void putHistoryItem(HistoryItem historyItem);
34 |
35 | @Query("UPDATE historyitem SET status = :status WHERE historyId = :historyId")
36 | void updateStatus(String historyId, int status);
37 |
38 | @Query("DELETE FROM historyitem")
39 | void nukeTable();
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_requests.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
9 |
10 |
18 |
19 |
20 |
31 |
32 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
16 |
17 |
21 |
22 |
23 |
24 |
25 |
26 |
34 |
35 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_friends.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
11 |
12 |
19 |
20 |
31 |
32 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/add_friend_dialog_custom_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
19 |
20 |
33 |
34 |
44 |
--------------------------------------------------------------------------------
/app/src/main/java/in/thetechguru/walle/remote/abremotewallpaperchanger/helpers/ViewPagerAdapter.java:
--------------------------------------------------------------------------------
1 | package in.thetechguru.walle.remote.abremotewallpaperchanger.helpers;
2 |
3 | import android.support.v4.app.Fragment;
4 | import android.support.v4.app.FragmentManager;
5 | import android.support.v4.app.FragmentPagerAdapter;
6 |
7 | import java.util.ArrayList;
8 | import java.util.List;
9 |
10 | /**
11 | Copyright 2017 Amit Bhandari AB
12 | Licensed under the Apache License, Version 2.0 (the "License");
13 | you may not use this file except in compliance with the License.
14 | You may obtain a copy of the License at
15 | http://www.apache.org/licenses/LICENSE-2.0
16 | Unless required by applicable law or agreed to in writing, software
17 | distributed under the License is distributed on an "AS IS" BASIS,
18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 | See the License for the specific language governing permissions and
20 | limitations under the License.
21 | */
22 |
23 | public class ViewPagerAdapter extends FragmentPagerAdapter {
24 | private final List mFragmentList = new ArrayList<>();
25 | private final List mFragmentTitleList = new ArrayList<>();
26 |
27 | public ViewPagerAdapter(FragmentManager manager) {
28 | super(manager);
29 | }
30 |
31 | @Override
32 | public Fragment getItem(int position) {
33 | return mFragmentList.get(position);
34 | }
35 |
36 | @Override
37 | public int getCount() {
38 | return mFragmentList.size();
39 | }
40 |
41 | public void addFragment(Fragment fragment, String title) {
42 | mFragmentList.add(fragment);
43 | mFragmentTitleList.add(title);
44 | }
45 |
46 | public Fragment get(int position){
47 | return mFragmentList.get(position);
48 | }
49 |
50 | @Override
51 | public CharSequence getPageTitle(int position) {
52 | return mFragmentTitleList.get(position);
53 | }
54 | }
--------------------------------------------------------------------------------
/app/src/main/java/in/thetechguru/walle/remote/abremotewallpaperchanger/history/HistoryItem.java:
--------------------------------------------------------------------------------
1 | package in.thetechguru.walle.remote.abremotewallpaperchanger.history;
2 |
3 | import android.arch.persistence.room.Entity;
4 | import android.arch.persistence.room.Ignore;
5 | import android.arch.persistence.room.PrimaryKey;
6 | import android.support.annotation.NonNull;
7 |
8 | /**
9 | Copyright 2017 Amit Bhandari AB
10 | Licensed under the Apache License, Version 2.0 (the "License");
11 | you may not use this file except in compliance with the License.
12 | You may obtain a copy of the License at
13 | http://www.apache.org/licenses/LICENSE-2.0
14 | Unless required by applicable law or agreed to in writing, software
15 | distributed under the License is distributed on an "AS IS" BASIS,
16 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | See the License for the specific language governing permissions and
18 | limitations under the License.
19 | */
20 |
21 | @Entity
22 | public class HistoryItem {
23 |
24 | public interface STATUS{
25 | int SUCCESS = 0;
26 | int WAITING = 1;
27 | int FAILURE = 2;
28 | }
29 |
30 | HistoryItem(){}
31 |
32 | @Ignore
33 | public HistoryItem(String historyId, String changedBy, String changedOf, long timestamp, String path){
34 | this.historyId = historyId;
35 | this.changedBy = changedBy;
36 | this.changedOf = changedOf;
37 | this.timestamp = timestamp;
38 | this.path = path;
39 | }
40 |
41 | public int status = STATUS.WAITING;
42 |
43 | @PrimaryKey
44 | @NonNull
45 | public String historyId = "";
46 |
47 | //username of person who changed wallpaper
48 | public String changedBy;
49 |
50 | //username whose wallpaper got changed
51 | public String changedOf;
52 |
53 | //time of changing
54 | public long timestamp;
55 |
56 | //path of image for thumbnail purpose
57 | public String path;
58 | }
59 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/activity_main_drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
61 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_login_signup.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
25 |
26 |
33 |
34 |
35 |
36 |
37 |
38 |
45 |
46 |
52 |
53 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_block_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
11 |
12 |
19 |
20 |
21 |
28 |
29 |
30 |
41 |
42 |
43 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/app/src/main/java/in/thetechguru/walle/remote/abremotewallpaperchanger/fcm/MyFirebaseInstanceIdService.java:
--------------------------------------------------------------------------------
1 | package in.thetechguru.walle.remote.abremotewallpaperchanger.fcm;
2 |
3 | import android.util.Log;
4 |
5 | import com.google.firebase.iid.FirebaseInstanceId;
6 | import com.google.firebase.iid.FirebaseInstanceIdService;
7 |
8 | import in.thetechguru.walle.remote.abremotewallpaperchanger.MyApp;
9 | import in.thetechguru.walle.remote.abremotewallpaperchanger.R;
10 | import in.thetechguru.walle.remote.abremotewallpaperchanger.helpers.FirebaseUtil;
11 |
12 | /**
13 | Copyright 2017 Amit Bhandari AB
14 | Licensed under the Apache License, Version 2.0 (the "License");
15 | you may not use this file except in compliance with the License.
16 | You may obtain a copy of the License at
17 | http://www.apache.org/licenses/LICENSE-2.0
18 | Unless required by applicable law or agreed to in writing, software
19 | distributed under the License is distributed on an "AS IS" BASIS,
20 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 | See the License for the specific language governing permissions and
22 | limitations under the License.
23 | */
24 | public class MyFirebaseInstanceIdService extends FirebaseInstanceIdService {
25 | @Override
26 | public void onTokenRefresh() {
27 | // Get updated InstanceID token.
28 | String refreshedToken = FirebaseInstanceId.getInstance().getToken();
29 | Log.d("MyFirebaseInstanceId", "onTokenRefresh: Refreshed token :" + refreshedToken);
30 | // If you want to send messages to this application instance or
31 | // manage this apps subscriptions on the server side, send the
32 | // Instance ID token to your app server.
33 | sendRegistrationToServer(refreshedToken);
34 | }
35 |
36 | private void sendRegistrationToServer(String token){
37 | MyApp.getPref().edit().putString(getString(R.string.notification_token),token).apply();
38 | if(MyApp.getUser()!=null) {
39 | String userId = MyApp.getUser().username;
40 | if (userId == null || userId.equals("")) return;
41 | FirebaseUtil.getNotificationTokenRef().child(userId).setValue(token);
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/nav_header_activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
28 |
29 |
36 |
37 |
38 |
39 |
40 |
41 |
49 |
50 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_set_as_wallapaper.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
17 |
18 |
25 |
26 |
32 |
33 |
38 |
39 |
44 |
45 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/app/src/main/java/in/thetechguru/walle/remote/abremotewallpaperchanger/MyApp.java:
--------------------------------------------------------------------------------
1 | package in.thetechguru.walle.remote.abremotewallpaperchanger;
2 |
3 | import android.app.Application;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.content.SharedPreferences;
7 | import android.os.StrictMode;
8 | import android.preference.PreferenceManager;
9 |
10 | import com.squareup.leakcanary.LeakCanary;
11 |
12 | import in.thetechguru.walle.remote.abremotewallpaperchanger.model.User;
13 | import uk.co.chrisjenx.calligraphy.CalligraphyConfig;
14 |
15 | /**
16 | Copyright 2017 Amit Bhandari AB
17 | Licensed under the Apache License, Version 2.0 (the "License");
18 | you may not use this file except in compliance with the License.
19 | You may obtain a copy of the License at
20 | http://www.apache.org/licenses/LICENSE-2.0
21 | Unless required by applicable law or agreed to in writing, software
22 | distributed under the License is distributed on an "AS IS" BASIS,
23 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24 | See the License for the specific language governing permissions and
25 | limitations under the License.
26 | */
27 |
28 | public class MyApp extends Application {
29 | private static MyApp instance;
30 | private static SharedPreferences pref;
31 | private static User user;
32 |
33 | @Override
34 | public void onCreate() {
35 | instance = this;
36 | pref = PreferenceManager.getDefaultSharedPreferences(this);
37 |
38 | StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
39 | StrictMode.setVmPolicy(builder.build());
40 |
41 | if (LeakCanary.isInAnalyzerProcess(this)) {
42 | return;
43 | }
44 | LeakCanary.install(this);
45 |
46 | CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
47 | .setDefaultFontPath("fonts/asap.ttf")
48 | .setFontAttrId(R.attr.fontPath)
49 | .build());
50 |
51 | super.onCreate();
52 | }
53 |
54 | public static Context getContext(){
55 | return instance;
56 | }
57 |
58 | public static SharedPreferences getPref(){
59 | return pref;
60 | }
61 |
62 | public static User getUser() {
63 | return user;
64 | }
65 |
66 | public static void setUser(User user) {
67 | MyApp.user = user;
68 | }
69 |
70 | }
--------------------------------------------------------------------------------
/app/google-services.json:
--------------------------------------------------------------------------------
1 | {
2 | "project_info": {
3 | "project_number": "1081857249823",
4 | "firebase_url": "https://walle-73480.firebaseio.com",
5 | "project_id": "walle-73480",
6 | "storage_bucket": "walle-73480.appspot.com"
7 | },
8 | "client": [
9 | {
10 | "client_info": {
11 | "mobilesdk_app_id": "1:1081857249823:android:7982aee320acbdee",
12 | "android_client_info": {
13 | "package_name": "in.thetechguru.walle.remote.abremotewallpaperchanger"
14 | }
15 | },
16 | "oauth_client": [
17 | {
18 | "client_id": "1081857249823-us2ukg45qkk0al9g68lknbpgpgr19bdm.apps.googleusercontent.com",
19 | "client_type": 1,
20 | "android_info": {
21 | "package_name": "in.thetechguru.walle.remote.abremotewallpaperchanger",
22 | "certificate_hash": "3cff6a01da6c6195cd934342a9e3c1128a571e07"
23 | }
24 | },
25 | {
26 | "client_id": "1081857249823-3okn8119u2rpr1m4c2e3ttnvl0l462m2.apps.googleusercontent.com",
27 | "client_type": 1,
28 | "android_info": {
29 | "package_name": "in.thetechguru.walle.remote.abremotewallpaperchanger",
30 | "certificate_hash": "836ef2fd9d0a96e5853886f80308bbf0716400f5"
31 | }
32 | },
33 | {
34 | "client_id": "1081857249823-8pof0u3a6e0g1g5cm6jq2u6njn7vh2ou.apps.googleusercontent.com",
35 | "client_type": 1,
36 | "android_info": {
37 | "package_name": "in.thetechguru.walle.remote.abremotewallpaperchanger",
38 | "certificate_hash": "fd651b484e7d065ed42809ae58e9dc854a214d0b"
39 | }
40 | },
41 | {
42 | "client_id": "1081857249823-a1pkiib4p7i3g1jr02irm8asgtggsavc.apps.googleusercontent.com",
43 | "client_type": 3
44 | }
45 | ],
46 | "api_key": [
47 | {
48 | "current_key": "AIzaSyBRHoi2RANO3Biu7RsSsdkHE3ZtVr-75lc"
49 | }
50 | ],
51 | "services": {
52 | "analytics_service": {
53 | "status": 1
54 | },
55 | "appinvite_service": {
56 | "status": 2,
57 | "other_platform_oauth_client": [
58 | {
59 | "client_id": "1081857249823-a1pkiib4p7i3g1jr02irm8asgtggsavc.apps.googleusercontent.com",
60 | "client_type": 3
61 | }
62 | ]
63 | },
64 | "ads_service": {
65 | "status": 2
66 | }
67 | }
68 | }
69 | ],
70 | "configuration_version": "1"
71 | }
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_history_else_changed.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
23 |
24 |
32 |
33 |
34 |
35 |
42 |
43 |
54 |
55 |
56 |
66 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/app/src/main/java/in/thetechguru/walle/remote/abremotewallpaperchanger/helpers/UtilityFun.java:
--------------------------------------------------------------------------------
1 | package in.thetechguru.walle.remote.abremotewallpaperchanger.helpers;
2 |
3 | import android.content.Context;
4 | import android.net.ConnectivityManager;
5 | import android.net.NetworkInfo;
6 |
7 | import java.util.Map;
8 | import java.util.NavigableMap;
9 | import java.util.TreeMap;
10 |
11 | import in.thetechguru.walle.remote.abremotewallpaperchanger.MyApp;
12 |
13 | /**
14 | Copyright 2017 Amit Bhandari AB
15 | Licensed under the Apache License, Version 2.0 (the "License");
16 | you may not use this file except in compliance with the License.
17 | You may obtain a copy of the License at
18 | http://www.apache.org/licenses/LICENSE-2.0
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 | public class UtilityFun {
27 |
28 | private static final NavigableMap suffixes = new TreeMap<>();
29 | static {
30 | suffixes.put(1_000L, "k");
31 | suffixes.put(1_000_000L, "M");
32 | suffixes.put(1_000_000_000L, "G");
33 | suffixes.put(1_000_000_000_000L, "T");
34 | suffixes.put(1_000_000_000_000_000L, "P");
35 | suffixes.put(1_000_000_000_000_000_000L, "E");
36 | }
37 |
38 | public static String format(long value) {
39 | //Long.MIN_VALUE == -Long.MIN_VALUE so we need an adjustment here
40 | if (value == Long.MIN_VALUE) return format(Long.MIN_VALUE + 1);
41 | if (value < 0) return "-" + format(-value);
42 | if (value < 1000) return Long.toString(value); //deal with easy case
43 |
44 | Map.Entry e = suffixes.floorEntry(value);
45 | Long divideBy = e.getKey();
46 | String suffix = e.getValue();
47 |
48 | long truncated = value / (divideBy / 10); //the number part of the output times 10
49 | boolean hasDecimal = truncated < 100 && (truncated / 10d) != (truncated / 10);
50 | return hasDecimal ? (truncated / 10d) + suffix : (truncated / 10) + suffix;
51 | }
52 |
53 | public static boolean isConnectedToInternet(){
54 | ConnectivityManager
55 | cm = (ConnectivityManager) MyApp.getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
56 | NetworkInfo activeNetwork = null;
57 | if (cm != null) {
58 | activeNetwork = cm.getActiveNetworkInfo();
59 | }
60 | return activeNetwork != null
61 | && activeNetwork.isConnectedOrConnecting();
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_history.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
19 |
20 |
27 |
28 |
35 |
36 |
47 |
48 |
55 |
56 |
57 |
58 |
59 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/app/src/main/java/in/thetechguru/walle/remote/abremotewallpaperchanger/history/HistoryRepo.java:
--------------------------------------------------------------------------------
1 | package in.thetechguru.walle.remote.abremotewallpaperchanger.history;
2 |
3 | import android.arch.persistence.db.SupportSQLiteDatabase;
4 | import android.arch.persistence.room.Room;
5 | import android.arch.persistence.room.migration.Migration;
6 | import android.support.annotation.NonNull;
7 |
8 | import java.util.List;
9 | import java.util.concurrent.Executor;
10 | import java.util.concurrent.Executors;
11 |
12 | import in.thetechguru.walle.remote.abremotewallpaperchanger.MyApp;
13 |
14 | /**
15 | Copyright 2017 Amit Bhandari AB
16 | Licensed under the Apache License, Version 2.0 (the "License");
17 | you may not use this file except in compliance with the License.
18 | You may obtain a copy of the License at
19 | http://www.apache.org/licenses/LICENSE-2.0
20 | Unless required by applicable law or agreed to in writing, software
21 | distributed under the License is distributed on an "AS IS" BASIS,
22 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 | See the License for the specific language governing permissions and
24 | limitations under the License.
25 | */
26 |
27 | public class HistoryRepo {
28 |
29 | private HistoryDAO historyDAO;
30 | private Executor executor;
31 | private static HistoryRepo historyRepo;
32 |
33 | public static HistoryRepo getInstance(){
34 | if(historyRepo==null){
35 | historyRepo = new HistoryRepo();
36 | }
37 | return historyRepo;
38 | }
39 |
40 | private HistoryRepo(){
41 | executor = Executors.newSingleThreadExecutor();
42 | //get the room db object, and thus DAO
43 | HistoryDB db = Room.databaseBuilder(MyApp.getContext(),
44 | HistoryDB.class, "database-name")
45 | .addMigrations(MIGRATION_1_2)
46 | .build();
47 | historyDAO=db.historyDAO();
48 | }
49 |
50 | private static final Migration MIGRATION_1_2 = new Migration(1, 2) {
51 | @Override
52 | public void migrate(@NonNull SupportSQLiteDatabase database) {
53 | // Since we didn't alter the table, there's nothing else to do here.
54 | }
55 | };
56 |
57 | public List getHistory(){
58 | return historyDAO.getHistoryItems();
59 | }
60 |
61 | public void putHistoryItem(final HistoryItem historyItem){
62 | executor.execute(new Runnable() {
63 | @Override
64 | public void run() {
65 | historyDAO.putHistoryItem(historyItem);
66 | }
67 | });
68 | }
69 |
70 | public void updateHistoryItem(final String historyId, final int status){
71 | executor.execute(new Runnable() {
72 | @Override
73 | public void run() {
74 | historyDAO.updateStatus(historyId, status);
75 | }
76 | });
77 | }
78 |
79 | public void nukeHistory(){
80 | executor.execute(new Runnable() {
81 | @Override
82 | public void run() {
83 | historyDAO.nukeTable();
84 | }
85 | });
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_blocked_contact.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
17 |
18 |
32 |
33 |
41 |
42 |
43 |
44 |
58 |
59 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_friend_request.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
16 |
17 |
20 |
21 |
35 |
36 |
44 |
45 |
46 |
47 |
61 |
62 |
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_history_changd_self.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
22 |
23 |
31 |
32 |
33 |
34 |
42 |
43 |
44 |
55 |
56 |
61 |
62 |
72 |
73 |
74 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/app/src/main/java/in/thetechguru/walle/remote/abremotewallpaperchanger/activity_fragments/ActivityFAQ.java:
--------------------------------------------------------------------------------
1 | package in.thetechguru.walle.remote.abremotewallpaperchanger.activity_fragments;
2 |
3 | import android.content.ActivityNotFoundException;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.net.Uri;
7 | import android.os.Bundle;
8 | import android.support.annotation.Nullable;
9 | import android.support.v7.app.AppCompatActivity;
10 | import android.support.v7.widget.Toolbar;
11 | import android.view.MenuItem;
12 | import android.widget.Toast;
13 |
14 | import com.afollestad.materialdialogs.MaterialDialog;
15 | import com.mikepenz.aboutlibraries.Libs;
16 | import com.mikepenz.aboutlibraries.LibsBuilder;
17 |
18 | import butterknife.ButterKnife;
19 | import butterknife.OnClick;
20 | import in.thetechguru.walle.remote.abremotewallpaperchanger.R;
21 | import uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper;
22 |
23 | public class ActivityFAQ extends AppCompatActivity {
24 |
25 | final static String INSTA_WEBSITE = "https://www.instagram.com/_amit_bhandari/?hl=en";
26 | final static String GITHUB_WEBSITE = "https://github.com/amit-bhandari/AB-Remote-Wallpaper-Changer";
27 |
28 | @Override
29 | protected void onCreate(@Nullable Bundle savedInstanceState) {
30 | super.onCreate(savedInstanceState);
31 | setContentView(R.layout.activity_faq);
32 | ButterKnife.bind(this);
33 |
34 | Toolbar toolbar = findViewById(R.id.toolbar_);
35 | setSupportActionBar(toolbar);
36 |
37 | if (getSupportActionBar() != null){
38 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
39 | getSupportActionBar().setDisplayShowHomeEnabled(true);
40 | }
41 |
42 | setTitle(getString(R.string.title_faq));
43 | }
44 |
45 | @Override
46 | public boolean onOptionsItemSelected(MenuItem item) {
47 | switch (item.getItemId()){
48 | case android.R.id.home:
49 | overridePendingTransition(android.R.anim.slide_in_left,android.R.anim.slide_out_right);
50 | finish();
51 | break;
52 | }
53 | return super.onOptionsItemSelected(item);
54 | }
55 |
56 | @Override
57 | protected void attachBaseContext(Context newBase) {
58 | super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
59 | }
60 |
61 | @OnClick(R.id.button_contact)
62 | void onContact(){
63 | openUrl(Uri.parse(INSTA_WEBSITE));
64 | }
65 |
66 | @OnClick(R.id.button_github)
67 | void onGithub(){
68 | openUrl(Uri.parse(GITHUB_WEBSITE));
69 | }
70 | @OnClick(R.id.button_rate)
71 | void onRate(){
72 | final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object
73 | try {
74 | startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
75 | } catch (ActivityNotFoundException anfe) {
76 | startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
77 | }
78 | }
79 |
80 | private void openUrl(Uri parse) {
81 | try {
82 | Intent browserIntent = new Intent(Intent.ACTION_VIEW, parse);
83 | startActivity(browserIntent);
84 | } catch (Exception e) {
85 | Toast.makeText(this, "Error opening browser", Toast.LENGTH_SHORT).show();
86 | }
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_added_friend.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
15 |
16 |
20 |
21 |
35 |
36 |
44 |
45 |
46 |
47 |
61 |
62 |
72 |
73 |
86 |
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/app/src/main/java/in/thetechguru/walle/remote/abremotewallpaperchanger/activity_fragments/ActivityLoginSignup.java:
--------------------------------------------------------------------------------
1 | package in.thetechguru.walle.remote.abremotewallpaperchanger.activity_fragments;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.os.Build;
6 | import android.os.Bundle;
7 | import android.support.annotation.Nullable;
8 | import android.support.design.widget.TabLayout;
9 | import android.support.v4.view.ViewPager;
10 | import android.support.v7.app.AppCompatActivity;
11 | import android.support.v7.widget.Toolbar;
12 | import android.view.View;
13 | import android.view.Window;
14 | import android.view.WindowManager;
15 | import android.widget.ImageView;
16 | import android.widget.TextView;
17 |
18 | import com.bumptech.glide.Glide;
19 |
20 | import butterknife.BindView;
21 | import butterknife.ButterKnife;
22 | import in.thetechguru.walle.remote.abremotewallpaperchanger.R;
23 | import in.thetechguru.walle.remote.abremotewallpaperchanger.helpers.ViewPagerAdapter;
24 | import uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper;
25 |
26 | /**
27 | Copyright 2017 Amit Bhandari AB
28 | Licensed under the Apache License, Version 2.0 (the "License");
29 | you may not use this file except in compliance with the License.
30 | You may obtain a copy of the License at
31 | http://www.apache.org/licenses/LICENSE-2.0
32 | Unless required by applicable law or agreed to in writing, software
33 | distributed under the License is distributed on an "AS IS" BASIS,
34 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35 | See the License for the specific language governing permissions and
36 | limitations under the License.
37 | */
38 | public class ActivityLoginSignup extends AppCompatActivity {
39 |
40 | @BindView(R.id.toolbar) Toolbar toolbar;
41 | @BindView(R.id.viewpager) ViewPager viewPager;
42 | @BindView(R.id.tabs) TabLayout tabLayout;
43 | @BindView(R.id.toolbar_title) TextView title;
44 |
45 |
46 | @Override
47 | protected void onCreate(@Nullable Bundle savedInstanceState) {
48 | super.onCreate(savedInstanceState);
49 | setContentView(R.layout.activity_login_signup);
50 | ButterKnife.bind(this);
51 |
52 | setSupportActionBar(toolbar);
53 |
54 | if(getSupportActionBar()!=null) {
55 | getSupportActionBar().setDisplayShowTitleEnabled(false);
56 | }
57 |
58 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
59 | Window window = getWindow();
60 | window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
61 | window.setStatusBarColor(getResources().getColor(R.color.transparent));
62 | window.getDecorView().setSystemUiVisibility(
63 | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
64 | | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
65 | }
66 |
67 | getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
68 |
69 | setupViewPager(viewPager);
70 | tabLayout.setupWithViewPager(viewPager);
71 |
72 | title.setText(getString(R.string.app_name));
73 | }
74 |
75 | @Override
76 | protected void attachBaseContext(Context newBase) {
77 | super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
78 | }
79 |
80 | private void setupViewPager(ViewPager viewPager) {
81 | ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
82 | adapter.addFragment(new FragmentLogin(), "Login");
83 | adapter.addFragment(new FragmentSignup(), "Sign Up");
84 | viewPager.setAdapter(adapter);
85 | }
86 |
87 | @Override
88 | public void onBackPressed() {
89 | Intent startMain = new Intent(Intent.ACTION_MAIN);
90 | startMain.addCategory(Intent.CATEGORY_HOME);
91 | startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
92 | startActivity(startMain);
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/app/src/main/java/in/thetechguru/walle/remote/abremotewallpaperchanger/tasks/SendHttpsRequest.java:
--------------------------------------------------------------------------------
1 | package in.thetechguru.walle.remote.abremotewallpaperchanger.tasks;
2 |
3 | import android.util.Log;
4 |
5 | import com.android.volley.AuthFailureError;
6 | import com.android.volley.Request;
7 | import com.android.volley.RequestQueue;
8 | import com.android.volley.Response;
9 | import com.android.volley.VolleyError;
10 | import com.android.volley.VolleyLog;
11 | import com.android.volley.toolbox.StringRequest;
12 | import com.android.volley.toolbox.Volley;
13 |
14 | import java.util.HashMap;
15 | import java.util.Map;
16 |
17 | import in.thetechguru.walle.remote.abremotewallpaperchanger.MyApp;
18 | import in.thetechguru.walle.remote.abremotewallpaperchanger.helpers.FirebaseUtil;
19 | import in.thetechguru.walle.remote.abremotewallpaperchanger.model.HttpsRequestPayload;
20 |
21 | /**
22 | Copyright 2017 Amit Bhandari AB
23 | Licensed under the Apache License, Version 2.0 (the "License");
24 | you may not use this file except in compliance with the License.
25 | You may obtain a copy of the License at
26 | http://www.apache.org/licenses/LICENSE-2.0
27 | Unless required by applicable law or agreed to in writing, software
28 | distributed under the License is distributed on an "AS IS" BASIS,
29 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 | See the License for the specific language governing permissions and
31 | limitations under the License.
32 | */
33 |
34 | public class SendHttpsRequest extends Thread {
35 |
36 | private static String baseUrl = "https://us-central1-walle-73480.cloudfunctions.net/notifyRequest";
37 |
38 | public SendHttpsRequest(HttpsRequestPayload payload){
39 | super(getRunnable(payload));
40 | }
41 |
42 | private static Runnable getRunnable(final HttpsRequestPayload payload){
43 | return new Runnable() {
44 | @Override
45 | public void run() {
46 |
47 | RequestQueue queue = Volley.newRequestQueue(MyApp.getContext());
48 |
49 | Response.Listener listener = new Response.Listener() {
50 | @Override
51 | public void onResponse(String response) {
52 | Log.d("volley", "onResponse: "+ response);
53 | }
54 | };
55 |
56 | Response.ErrorListener errorListener = new Response.ErrorListener() {
57 | @Override
58 | public void onErrorResponse(VolleyError error) {
59 | VolleyLog.d("volley", "Error: " + error.getMessage());
60 | }
61 | };
62 |
63 | StringRequest jsonObjRequest = new StringRequest(Request.Method.POST,
64 | baseUrl,listener, errorListener) {
65 | @Override
66 | public String getBodyContentType() {
67 | return "application/x-www-form-urlencoded; charset=UTF-8";
68 | }
69 |
70 | @Override
71 | protected Map getParams() throws AuthFailureError {
72 | Map params = new HashMap();
73 |
74 | params.put("from", payload.fromUserName);
75 | params.put("to", payload.toUserName);
76 | params.put("status", payload.statusCode);
77 | if(payload.wallpaperUrl!=null){
78 | params.put("id", payload.wallpaperUrl);
79 | }
80 | return params;
81 | }
82 | };
83 |
84 | queue.add(jsonObjRequest);
85 | }
86 | };
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/app_bar_activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
19 |
20 |
23 |
24 |
35 |
36 |
43 |
44 |
49 |
50 |
59 |
60 |
67 |
68 |
69 |
70 |
80 |
81 |
82 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
17 |
21 |
22 |
23 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
62 |
63 |
66 |
67 |
69 |
70 |
72 |
73 |
75 |
76 |
79 |
80 |
81 |
82 |
83 |
84 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_profile.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
14 |
15 |
16 |
28 |
29 |
37 |
38 |
44 |
45 |
46 |
47 |
55 |
56 |
64 |
65 |
75 |
76 |
87 |
88 |
89 |
99 |
100 |
101 |
102 |
--------------------------------------------------------------------------------
/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/amit/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 |
19 | -keep public class * implements com.bumptech.glide.module.GlideModule
20 | -keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
21 | **[] $VALUES;
22 | public *;
23 | }
24 |
25 | ## Google Play Services 4.3.23 specific rules ##
26 | ## https://developer.android.com/google/play-services/setup.html#Proguard ##
27 | -keep class * extends java.util.ListResourceBundle {
28 | protected Object[][] getContents();
29 | }
30 |
31 | -keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
32 | public static final *** NULL;
33 | }
34 |
35 | -keepnames @com.google.android.gms.common.annotation.KeepName class *
36 | -keepclassmembernames class * {
37 | @com.google.android.gms.common.annotation.KeepName *;
38 | }
39 |
40 | -keepnames class * implements android.os.Parcelable {
41 | public static final ** CREATOR;
42 | }
43 |
44 | ## GSON 2.2.4 specific rules ##
45 |
46 | # Gson uses generic type information stored in a class file when working with fields. Proguard
47 | # removes such information by default, so configure it to keep all of it.
48 | -keepattributes Signature
49 |
50 | # For using GSON @Expose annotation
51 | -keepattributes *Annotation*
52 |
53 | -keepattributes EnclosingMethod
54 |
55 | # Gson specific classes
56 | -keep class sun.misc.Unsafe { *; }
57 | -keep class com.google.gson.stream.** { *; }
58 |
59 | -keeppackagenames org.jsoup.nodes
60 |
61 | # OkHttp
62 | -keepattributes Signature
63 | -keepattributes *Annotation*
64 | -keep class com.squareup.okhttp.** { *; }
65 | -keep interface com.squareup.okhttp.** { *; }
66 | -dontwarn com.squareup.okhttp.**
67 | # OkHttp
68 | -keepattributes Signature
69 | -keepattributes *Annotation*
70 | -keep class okhttp3.** { *; }
71 | -keep interface okhttp3.** { *; }
72 | -dontwarn okhttp3.**
73 |
74 | # Okio
75 | -keep class sun.misc.Unsafe { *; }
76 | -dontwarn java.nio.file.*
77 | -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
78 | -dontwarn okio.**
79 |
80 | -keep public class android.support.v7.widget.** { *; }
81 | -keep public class android.support.v7.internal.widget.** { *; }
82 | -keep public class android.support.v7.internal.view.menu.** { *; }
83 |
84 | -keep public class * extends android.support.v4.view.ActionProvider {
85 | public (android.content.Context);
86 | }
87 |
88 | # http://stackoverflow.com/questions/29679177/cardview-shadow-not-appearing-in-lollipop-after-obfuscate-with-proguard/29698051
89 | -keep class android.support.v7.widget.RoundRectDrawable { *; }
90 |
91 | -dontwarn retrofit.**
92 |
93 | -keep public class com.wang.avi.** {
94 | public *;
95 | }
96 |
97 | -dontwarn jp.wasabeef.glide.transformations.**
98 | -dontwarn com.birbit.android.jobqueue.**
99 |
100 | -keep class * extends android.app.Activity
101 | -assumenosideeffects class android.util.Log {
102 | public static *** d(...);
103 | public static *** v(...);
104 | }
105 |
106 | -keepattributes *Annotation*,SourceFile,LineNumberTable
107 |
108 | -keep class in.thetechguru.walle.remote.abremotewallpaperchanger.** {
109 | public protected private *;
110 | }
111 |
112 | -keep class com.google.firebase.** { *; }
113 | -keep class com.google.firebase.** { *; }
114 | -keep class org.apache.** { *; }
115 | -keepnames class com.fasterxml.jackson.** { *; }
116 | -keepnames class javax.servlet.** { *; }
117 | -keepnames class org.ietf.jgss.** { *; }
118 | -dontwarn org.w3c.dom.**
119 | -dontwarn org.joda.time.**
120 | -dontwarn org.shaded.apache.**
121 | -dontwarn org.ietf.jgss.**
122 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_login.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
15 |
16 |
17 |
33 |
34 |
48 |
49 |
63 |
64 |
77 |
78 |
91 |
92 |
103 |
104 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | //apk publish automation
4 | buildscript {
5 |
6 | repositories {
7 | jcenter()
8 | }
9 |
10 | dependencies {
11 | classpath 'com.github.triplet.gradle:play-publisher:1.2.2'
12 | }
13 | }
14 |
15 | apply plugin: 'com.github.triplet.play'
16 |
17 | // Load keystore
18 | def keystorePropertiesFile = rootProject.file("/home/amit/studioprojects/remote-ab/keystore.properties")
19 | def keystoreProperties = new Properties()
20 | keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
21 |
22 |
23 | play {
24 | track = 'alpha'
25 | serviceAccountEmail = 'ab-amit@api-9064146907984057788-54989.iam.gserviceaccount.com'
26 | pk12File = file(keystoreProperties['p12keyFile'])
27 | }
28 |
29 | android {
30 | compileSdkVersion 28
31 | defaultConfig {
32 | applicationId "in.thetechguru.walle.remote.abremotewallpaperchanger"
33 | minSdkVersion 21
34 | targetSdkVersion 28
35 | versionCode 16
36 | versionName "1.0"
37 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
38 | vectorDrawables.useSupportLibrary = true
39 | multiDexEnabled true
40 | }
41 |
42 | signingConfigs{
43 | release {
44 | storeFile file(keystoreProperties['storeFile'])
45 | storePassword keystoreProperties['storePassword']
46 | keyAlias keystoreProperties['keyAlias']
47 | keyPassword keystoreProperties['keyPassword']
48 | }
49 | }
50 |
51 | buildTypes {
52 | release {
53 | signingConfig signingConfigs.release
54 | minifyEnabled true
55 | shrinkResources true
56 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
57 | }
58 | }
59 |
60 | compileOptions {
61 | targetCompatibility 1.8
62 | sourceCompatibility 1.8
63 | }
64 | }
65 |
66 | dependencies {
67 | implementation fileTree(dir: 'libs', include: ['*.jar'])
68 |
69 | //noinspection GradleCompatible
70 | implementation 'com.android.support:appcompat-v7:27.1.1'
71 | //noinspection GradleCompatible
72 | implementation 'com.android.support:customtabs:27.1.1'
73 | //noinspection GradleCompatible
74 | implementation 'com.android.support:design:27.1.1'
75 |
76 | implementation 'com.android.support.constraint:constraint-layout:1.1.2'
77 | //noinspection GradleCompatible
78 | compile 'com.android.support:cardview-v7:27.1.1'
79 |
80 | testImplementation 'junit:junit:4.12'
81 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
82 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
83 |
84 | //glide
85 | //noinspection GradleDependency
86 | implementation 'com.github.bumptech.glide:glide:3.7.0'
87 | annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
88 |
89 | //volley
90 | compile 'com.android.volley:volley:1.1.0'
91 |
92 | //butter knife
93 | compile 'com.jakewharton:butterknife:8.8.1'
94 | annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
95 |
96 | //firebase real time db and auth
97 | implementation 'com.google.firebase:firebase-database:15.0.1'
98 | compile 'com.google.firebase:firebase-auth:15.1.0'
99 | compile 'com.google.firebase:firebase-core:15.0.2'
100 | compile 'com.google.android.gms:play-services-auth:15.0.1'
101 | implementation 'com.google.firebase:firebase-messaging:15.0.2'
102 | implementation 'com.google.firebase:firebase-storage:15.0.2'
103 | compile 'com.google.firebase:firebase-crash:15.0.2'
104 | compile 'com.google.firebase:firebase-ads:15.0.1'
105 |
106 | //material dialogs
107 | compile 'com.afollestad.material-dialogs:core:0.9.6.0'
108 |
109 | //loading button
110 | compile 'br.com.simplepass:loading-button-android:1.12.1'
111 |
112 | //leak canary
113 | debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.4'
114 | releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
115 |
116 | compile 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
117 |
118 | // Room
119 | implementation "android.arch.persistence.room:runtime:1.1.1"
120 | annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
121 |
122 | //gson
123 | compile 'com.google.code.gson:gson:2.8.2'
124 |
125 | //open source lib information
126 | implementation "com.mikepenz:aboutlibraries:6.0.8"
127 |
128 | //job queue for downloading wallpaper from storage
129 | compile 'com.birbit:android-priority-jobqueue:2.0.1'
130 |
131 | //font
132 | implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
133 | }
134 |
135 | repositories {
136 | maven {
137 | url 'https://maven.google.com'
138 | }
139 | }
140 |
141 |
142 | apply plugin: 'com.google.gms.google-services'
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
10 |
12 |
14 |
16 |
18 |
20 |
22 |
24 |
26 |
28 |
30 |
32 |
34 |
36 |
38 |
40 |
42 |
44 |
46 |
48 |
50 |
52 |
54 |
56 |
58 |
60 |
62 |
64 |
66 |
68 |
70 |
72 |
74 |
75 |
--------------------------------------------------------------------------------
/app/src/main/java/in/thetechguru/walle/remote/abremotewallpaperchanger/activity_fragments/ActivityAbout.java:
--------------------------------------------------------------------------------
1 | package in.thetechguru.walle.remote.abremotewallpaperchanger.activity_fragments;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.net.Uri;
6 | import android.os.Bundle;
7 | import android.support.annotation.NonNull;
8 | import android.support.annotation.Nullable;
9 | import android.support.v7.app.AppCompatActivity;
10 | import android.support.v7.widget.Toolbar;
11 | import android.view.Menu;
12 | import android.view.MenuItem;
13 | import android.widget.Toast;
14 |
15 | import com.afollestad.materialdialogs.DialogAction;
16 | import com.afollestad.materialdialogs.MaterialDialog;
17 | import com.mikepenz.aboutlibraries.Libs;
18 | import com.mikepenz.aboutlibraries.LibsBuilder;
19 |
20 | import in.thetechguru.walle.remote.abremotewallpaperchanger.MyApp;
21 | import in.thetechguru.walle.remote.abremotewallpaperchanger.R;
22 | import uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper;
23 |
24 | /**
25 | Copyright 2017 Amit Bhandari AB
26 | Licensed under the Apache License, Version 2.0 (the "License");
27 | you may not use this file except in compliance with the License.
28 | You may obtain a copy of the License at
29 | http://www.apache.org/licenses/LICENSE-2.0
30 | Unless required by applicable law or agreed to in writing, software
31 | distributed under the License is distributed on an "AS IS" BASIS,
32 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33 | See the License for the specific language governing permissions and
34 | limitations under the License.
35 | */
36 |
37 | public class ActivityAbout extends AppCompatActivity {
38 |
39 | @Override
40 | protected void onCreate(@Nullable Bundle savedInstanceState) {
41 | super.onCreate(savedInstanceState);
42 | setContentView(R.layout.activity_about_us);
43 |
44 | Toolbar toolbar = findViewById(R.id.toolbar_);
45 | setSupportActionBar(toolbar);
46 |
47 | if (getSupportActionBar() != null){
48 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
49 | getSupportActionBar().setDisplayShowHomeEnabled(true);
50 | }
51 | }
52 |
53 | @Override
54 | public boolean onCreateOptionsMenu(Menu menu) {
55 | getMenuInflater().inflate(R.menu.menu_about, menu);
56 | return true;
57 | }
58 |
59 | @Override
60 | public boolean onOptionsItemSelected(MenuItem item) {
61 | switch (item.getItemId()){
62 | case R.id.action_privacy_policy:
63 | new MaterialDialog.Builder(this)
64 | .title(R.string.title_privacy_policy)
65 | .content(R.string.dialog_privacy_policy_content)
66 | .positiveText(R.string.dialog_privacy_policy_pos)
67 | .show();
68 | break;
69 |
70 | case R.id.action_terms_of_usage:
71 | openUrl(Uri.parse(ActivityMain.TERMS_USAGE__WEBSITE));
72 | break;
73 |
74 | case R.id.action_how_does_it_work:
75 | howItWorks();
76 | break;
77 |
78 | case R.id.action_lib:
79 | new LibsBuilder()
80 | .withActivityStyle(Libs.ActivityStyle.LIGHT_DARK_TOOLBAR)
81 | .withActivityTitle("Libraries")
82 | .start(this);
83 | break;
84 |
85 | case android.R.id.home:
86 | overridePendingTransition(android.R.anim.slide_in_left,android.R.anim.slide_out_right);
87 | finish();
88 | break;
89 | }
90 | return super.onOptionsItemSelected(item);
91 | }
92 |
93 | @Override
94 | protected void attachBaseContext(Context newBase) {
95 | super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
96 | }
97 |
98 | private void howItWorks(){
99 | String userName = "";
100 | if(MyApp.getUser()!=null) userName = MyApp.getUser().username;
101 | new MaterialDialog.Builder(this)
102 | .title(R.string.how_it_works_title)
103 | .content(R.string.how_it_works_content, userName)
104 | .positiveText(R.string.how_it_works_pos)
105 | .autoDismiss(false)
106 | .cancelable(false)
107 | .onPositive(new MaterialDialog.SingleButtonCallback() {
108 | @Override
109 | public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
110 | dialog.dismiss();
111 | }
112 | })
113 | .show();
114 | }
115 |
116 | private void openUrl(Uri parse) {
117 | try {
118 | Intent browserIntent = new Intent(Intent.ACTION_VIEW, parse);
119 | startActivity(browserIntent);
120 | } catch (Exception e) {
121 | Toast.makeText(this, "Error opening browser", Toast.LENGTH_SHORT).show();
122 | }
123 | }
124 | }
125 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_about_us.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
20 |
21 |
28 |
29 |
33 |
34 |
50 |
51 |
52 |
59 |
60 |
71 |
72 |
82 |
83 |
84 |
85 |
86 |
91 |
92 |
102 |
103 |
107 |
108 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
--------------------------------------------------------------------------------
/app/src/main/java/in/thetechguru/walle/remote/abremotewallpaperchanger/activity_fragments/ActivityPermissionSeek.java:
--------------------------------------------------------------------------------
1 | package in.thetechguru.walle.remote.abremotewallpaperchanger.activity_fragments;
2 |
3 | import android.Manifest;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.content.pm.PackageManager;
7 | import android.os.Build;
8 | import android.os.Bundle;
9 | import android.support.annotation.NonNull;
10 | import android.support.annotation.Nullable;
11 | import android.support.v4.app.ActivityCompat;
12 | import android.support.v7.app.AppCompatActivity;
13 | import android.widget.Toast;
14 |
15 | import com.afollestad.materialdialogs.DialogAction;
16 | import com.afollestad.materialdialogs.MaterialDialog;
17 |
18 | import in.thetechguru.walle.remote.abremotewallpaperchanger.BuildConfig;
19 | import in.thetechguru.walle.remote.abremotewallpaperchanger.R;
20 | import in.thetechguru.walle.remote.abremotewallpaperchanger.preferences.Preferences;
21 | import uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper;
22 |
23 | /**
24 | Copyright 2017 Amit Bhandari AB
25 | Licensed under the Apache License, Version 2.0 (the "License");
26 | you may not use this file except in compliance with the License.
27 | You may obtain a copy of the License at
28 | http://www.apache.org/licenses/LICENSE-2.0
29 | Unless required by applicable law or agreed to in writing, software
30 | distributed under the License is distributed on an "AS IS" BASIS,
31 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
32 | See the License for the specific language governing permissions and
33 | limitations under the License.
34 | */
35 |
36 | public class ActivityPermissionSeek extends AppCompatActivity {
37 | final private int MY_PERMISSIONS_REQUEST = 0;
38 | private static String[] PERMISSIONS = {Manifest.permission.WRITE_EXTERNAL_STORAGE};
39 |
40 | @Override
41 | protected void onCreate(@Nullable Bundle savedInstanceState) {
42 | super.onCreate(savedInstanceState);
43 |
44 | if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) {
45 | finish();
46 | return;
47 | }
48 |
49 | if(!hasPermissions(this, PERMISSIONS)) {
50 | try {
51 | permissionDetailsDialog();
52 | }catch (Exception e){
53 | RequestPermission();
54 | }
55 | }else {
56 | startActivity(new Intent(this, ActivityMain.class));
57 | finish();
58 | }
59 |
60 | if(BuildConfig.DEBUG){
61 | Preferences.setAdsRemoved(this, true);
62 | }
63 | }
64 |
65 | private void permissionDetailsDialog(){
66 | new MaterialDialog.Builder(this)
67 | .title(R.string.permission_grant_title)
68 | .content(R.string.permission_grant_content)
69 | .positiveText(R.string.permission_grant_pos)
70 | .negativeText(getString(R.string.cancel))
71 | .cancelable(false)
72 | .onPositive(new MaterialDialog.SingleButtonCallback() {
73 | @Override
74 | public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
75 | RequestPermission();
76 | }
77 | })
78 | .onNegative(new MaterialDialog.SingleButtonCallback() {
79 | @Override
80 | public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
81 | Toast.makeText(ActivityPermissionSeek.this, "Sorry, but app needs storage permission to work properly!", Toast.LENGTH_SHORT).show();
82 | finish();
83 | }
84 | })
85 | .show();
86 | }
87 |
88 | private void RequestPermission(){
89 | // Here, thisActivity is the current activity
90 | ActivityCompat.requestPermissions(this,
91 | PERMISSIONS,
92 | MY_PERMISSIONS_REQUEST);
93 |
94 | }
95 |
96 | public static boolean hasPermissions(Context context, String... permissions) {
97 | if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && context != null && permissions != null) {
98 | for (String permission : permissions) {
99 | if (ActivityCompat.checkSelfPermission(context, permission) != PackageManager.PERMISSION_GRANTED) {
100 | return false;
101 | }
102 | }
103 | }
104 | return true;
105 | }
106 |
107 | @Override
108 | public void onRequestPermissionsResult(int requestCode,
109 | @NonNull String permissions[], @NonNull int[] grantResults) {
110 | switch (requestCode) {
111 | case MY_PERMISSIONS_REQUEST: {
112 |
113 | if(grantResults.length==0){
114 | return;
115 | }
116 | // If request is cancelled, the result arrays are empty.
117 | if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
118 | //finish();
119 | startActivity(new Intent(this, ActivityMain.class));
120 | }
121 | }
122 | break;
123 | }
124 | }
125 |
126 | @Override
127 | protected void attachBaseContext(Context newBase) {
128 | super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
129 | }
130 | }
131 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a selfUser-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_signup.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
13 |
14 |
30 |
31 |
32 |
46 |
47 |
61 |
62 |
76 |
77 |
93 |
94 |
110 |
111 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
--------------------------------------------------------------------------------
/app/src/main/java/in/thetechguru/walle/remote/abremotewallpaperchanger/helpers/FirebaseUtil.java:
--------------------------------------------------------------------------------
1 | package in.thetechguru.walle.remote.abremotewallpaperchanger.helpers;
2 |
3 | import com.google.firebase.auth.FirebaseAuth;
4 | import com.google.firebase.auth.FirebaseUser;
5 | import com.google.firebase.database.DatabaseReference;
6 | import com.google.firebase.database.FirebaseDatabase;
7 | import com.google.firebase.storage.FirebaseStorage;
8 | import com.google.firebase.storage.StorageReference;
9 |
10 | import in.thetechguru.walle.remote.abremotewallpaperchanger.MyApp;
11 |
12 | /**
13 | Copyright 2017 Amit Bhandari AB
14 | Licensed under the Apache License, Version 2.0 (the "License");
15 | you may not use this file except in compliance with the License.
16 | You may obtain a copy of the License at
17 | http://www.apache.org/licenses/LICENSE-2.0
18 | Unless required by applicable law or agreed to in writing, software
19 | distributed under the License is distributed on an "AS IS" BASIS,
20 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 | See the License for the specific language governing permissions and
22 | limitations under the License.
23 | */
24 |
25 | /**
26 | * Created by abami on 1/18/2018.
27 | * Firebase data structure
28 | *
29 | * usernames ---> { username1 --> firebase_userid1 }
30 | * ---> { username2 --> firebase_userid2}
31 | *
32 | * users ---> { firebase_userid1 --> username1
33 | * --> email1 }
34 | * ---> { firebase_userid2 --> username2
35 | * --> email2 }
36 | *
37 | * tokens ---> username1 ---> requests ---> { List of user names who sent requests }
38 | * ---> confirmed ---> { List of user names who are friends }
39 | * ---> blocked ---> { List of user names blocked by you }
40 | *
41 | * ---> username2 ---> requests ---> { List of user names who sent requests }
42 | * ---> confirmed ---> { List of user names who are friends }
43 | * ---> blocked ---> { List of user names blocked by you }
44 | */
45 |
46 |
47 | public class FirebaseUtil {
48 |
49 | private static FirebaseDatabase firebaseDatabase;
50 |
51 | public static FirebaseDatabase getDatabase(){
52 | if(firebaseDatabase==null){
53 | firebaseDatabase = FirebaseDatabase.getInstance();
54 | //firebaseDatabase.setPersistenceEnabled(true);
55 | }
56 | return firebaseDatabase;
57 | }
58 |
59 | public static StorageReference getStorage(){
60 | return FirebaseStorage.getInstance().getReference();
61 | }
62 |
63 | public static FirebaseUser getCurrentUser(){
64 | return getAuth().getCurrentUser();
65 | }
66 |
67 | //Global Reference getters
68 |
69 | //get global token reference
70 | public static DatabaseReference getTokenReference(){
71 | return getDatabase().getReference().child("tokens");
72 | }
73 |
74 | //get global user names reference
75 | public static DatabaseReference getUsernamesReference(){
76 | return getDatabase().getReference().child("usernames");
77 | }
78 |
79 | //get global users reference
80 | public static DatabaseReference getUsersReference(){
81 | return getDatabase().getReference().child("users");
82 | }
83 |
84 | public static DatabaseReference getNotificationTokenRef(){
85 | return getDatabase().getReference().child("notificationTokens");
86 | }
87 |
88 |
89 | //Specific reference getters
90 |
91 | //get root -> users -> self --> reference
92 | public static DatabaseReference getSelfUserReference(){
93 | if(getCurrentUser()!=null) {
94 | return getDatabase().getReference().child("users").child(getCurrentUser().getUid());
95 | }else {
96 | return null;
97 | }
98 | }
99 |
100 | //get particular username reference from firebase user id
101 | public static DatabaseReference getUsernameRef(String uId){
102 | return getDatabase().getReference().child("users").child(uId).child("username");
103 | }
104 |
105 | //get particular username reference from firebase user id
106 | public static DatabaseReference getBlockStatusRef(String uId){
107 | return getDatabase().getReference().child("users").child(uId).child("block_status");
108 | }
109 |
110 | //get particular email reference from firebase user id
111 | public static DatabaseReference getEmailRef(String uId){
112 | return getDatabase().getReference().child("users").child(uId).child("email");
113 | }
114 |
115 | //get particular display name reference from firebase user id
116 | public static DatabaseReference getDisplayNameRef(String uId){
117 | return getDatabase().getReference().child("users").child(uId).child("display_name");
118 | }
119 |
120 | //get particular photo path reference from firebase user id
121 | public static DatabaseReference getPhotoUrlRef(String uId){
122 | return getDatabase().getReference().child("users").child(uId).child("pic_url");
123 | }
124 |
125 | //get requests pref for self
126 | public static DatabaseReference getRequestsRef(){
127 | return getTokenReference().child(MyApp.getUser().username).child("requests");
128 | }
129 |
130 | //get confirmed pref for self
131 | public static DatabaseReference getConfirmedRef(){
132 | return getTokenReference().child(MyApp.getUser().username).child("confirmed");
133 | }
134 |
135 | //get blocked pref for self
136 | public static DatabaseReference getBlockedRef(){
137 | return getTokenReference().child(MyApp.getUser().username).child("blocked");
138 | }
139 |
140 | //get pending pref for self
141 | public static DatabaseReference getPendingRef(){
142 | return getTokenReference().child(MyApp.getUser().username).child("pending");
143 | }
144 |
145 | //get requests pref for particular username
146 | public static DatabaseReference getRequestsRef(String user_name){
147 | return getTokenReference().child(user_name).child("requests");
148 | }
149 |
150 | //get confirmed pref for particular username
151 | public static DatabaseReference getConfirmedRef(String user_name){
152 | return getTokenReference().child(user_name).child("confirmed");
153 | }
154 |
155 | //get blocked pref for particular username
156 | public static DatabaseReference getBlockedRef(String user_name){
157 | return getTokenReference().child(user_name).child("blocked");
158 | }
159 |
160 | //get pending pref for particular username
161 | public static DatabaseReference getPendingRef(String user_name){
162 | return getTokenReference().child(user_name).child("pending");
163 | }
164 |
165 | public static DatabaseReference getOverallChangeCountRef(){
166 | return getDatabase().getReference().child("stats").child("wallpaper_change_requests");
167 | }
168 |
169 | //get auth instance
170 | public static FirebaseAuth getAuth(){
171 | return FirebaseAuth.getInstance();
172 | }
173 |
174 | //get profile photo storage refrence
175 | public static StorageReference getProfilePhotoRef(){
176 | return getStorage().child("profile_photos");
177 | }
178 |
179 | }
180 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_faq.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
17 |
18 |
19 |
26 |
27 |
33 |
34 |
42 |
43 |
50 |
51 |
60 |
61 |
68 |
69 |
78 |
79 |
86 |
87 |
96 |
97 |
104 |
105 |
114 |
115 |
122 |
123 |
132 |
133 |
140 |
141 |
150 |
151 |
152 |
153 |
154 |
155 |
161 |
162 |
171 |
172 |
181 |
182 |
191 |
192 |
193 |
194 |
--------------------------------------------------------------------------------
/app/src/main/java/in/thetechguru/walle/remote/abremotewallpaperchanger/tasks/SetWallpaper.java:
--------------------------------------------------------------------------------
1 | package in.thetechguru.walle.remote.abremotewallpaperchanger.tasks;
2 |
3 | import android.app.WallpaperManager;
4 | import android.graphics.Bitmap;
5 | import android.graphics.BitmapFactory;
6 | import android.net.Uri;
7 | import android.os.Environment;
8 | import android.os.Handler;
9 | import android.support.annotation.NonNull;
10 | import android.support.annotation.Nullable;
11 | import android.util.Log;
12 |
13 | import com.birbit.android.jobqueue.Job;
14 | import com.birbit.android.jobqueue.Params;
15 | import com.birbit.android.jobqueue.RetryConstraint;
16 | import com.google.android.gms.tasks.OnCompleteListener;
17 | import com.google.android.gms.tasks.OnFailureListener;
18 | import com.google.android.gms.tasks.OnSuccessListener;
19 | import com.google.android.gms.tasks.Task;
20 | import com.google.firebase.crash.FirebaseCrash;
21 | import com.google.firebase.storage.FileDownloadTask;
22 | import com.google.firebase.storage.OnProgressListener;
23 | import com.google.firebase.storage.StorageReference;
24 | import com.google.gson.Gson;
25 |
26 | import java.io.File;
27 |
28 | import in.thetechguru.walle.remote.abremotewallpaperchanger.MyApp;
29 | import in.thetechguru.walle.remote.abremotewallpaperchanger.R;
30 | import in.thetechguru.walle.remote.abremotewallpaperchanger.helpers.FirebaseUtil;
31 | import in.thetechguru.walle.remote.abremotewallpaperchanger.history.HistoryItem;
32 | import in.thetechguru.walle.remote.abremotewallpaperchanger.history.HistoryRepo;
33 | import in.thetechguru.walle.remote.abremotewallpaperchanger.model.HttpsRequestPayload;
34 | import in.thetechguru.walle.remote.abremotewallpaperchanger.model.User;
35 |
36 | /**
37 | Copyright 2017 Amit Bhandari AB
38 | Licensed under the Apache License, Version 2.0 (the "License");
39 | you may not use this file except in compliance with the License.
40 | You may obtain a copy of the License at
41 | http://www.apache.org/licenses/LICENSE-2.0
42 | Unless required by applicable law or agreed to in writing, software
43 | distributed under the License is distributed on an "AS IS" BASIS,
44 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
45 | See the License for the specific language governing permissions and
46 | limitations under the License.
47 | */
48 |
49 | public class SetWallpaper extends Job {
50 |
51 | private static final int PRIORITY = 1;
52 | private String id;
53 | private String fromUser;
54 |
55 | private int RETRY_LIMIT = 5;
56 |
57 | enum JOB_STATUS{
58 | RUNNING, SUCCESS, FAILURE
59 | }
60 |
61 | private JOB_STATUS status = JOB_STATUS.RUNNING;
62 |
63 | public SetWallpaper(String id, String fromUser) {
64 | super(new Params(PRIORITY).requireNetwork().persist());
65 | this.id = id;
66 | this.fromUser = fromUser;
67 | }
68 |
69 | @Override
70 | protected int getRetryLimit() {
71 | return RETRY_LIMIT;
72 | }
73 |
74 | @Override
75 | public void onAdded() {
76 | Log.d("SetWallpaper", "onAdded: Job added to queue for changing wallpaper");
77 | }
78 |
79 | @Override
80 | public void onRun() throws Throwable {
81 | Log.d("SetWallpaper", "onRun: starting again");
82 |
83 | status = JOB_STATUS.RUNNING;
84 |
85 | final StorageReference uploadedFile = FirebaseUtil.getStorage().child(id);
86 | File localFile;
87 | try {
88 |
89 | String directory_path = Environment.getExternalStorageDirectory().getAbsolutePath() + "/AB_Wall/";
90 | String file_name = fromUser + "_" + id + ".jpg";
91 | //create directory if not present
92 | File file = new File(directory_path);
93 | if(!file.exists() && !file.mkdir()){
94 | localFile = File.createTempFile("photo", "jpg");
95 | }else {
96 | localFile = new File(directory_path + file_name);
97 | }
98 | Log.d("SetWallpaper", "save path: " + localFile.getAbsolutePath());
99 | } catch (Exception e) {
100 | Log.d("SetWallpaper", "Error : ");
101 | status = JOB_STATUS.FAILURE;
102 | e.printStackTrace();
103 | FirebaseCrash.report(e);
104 | return;
105 | }
106 |
107 | final File finalLocalFile = localFile;
108 | uploadedFile.getFile(localFile).addOnSuccessListener(taskSnapshot -> {
109 | // Local temp file has been created
110 | Log.d("SetWallpaper", "onSuccess: downloaded file in local : " + taskSnapshot.toString());
111 | setWallpaper(finalLocalFile);
112 | }).addOnFailureListener(exception -> {
113 | // Handle any errors
114 | FirebaseCrash.report(exception);
115 | Log.d("SetWallpaper", "onFailure: Error downloading photo from firebase storage : " + exception.getMessage());
116 | status = JOB_STATUS.FAILURE;
117 | }).addOnProgressListener(taskSnapshot -> {
118 | double progress = (100.0 * taskSnapshot.getBytesTransferred()) / taskSnapshot.getTotalByteCount();
119 | System.out.println("Download is " + progress + "% done");
120 | }).addOnCompleteListener(task -> {
121 | uploadedFile.delete();
122 | status = JOB_STATUS.SUCCESS;
123 | });
124 |
125 | //while running, keep on checking status after every 1 second (because firebase don't give synchronous download option. Why would they do that.
126 | //if status fail, throw exception
127 | //is this ugly? Please tell me some alternative for this
128 | while (status==JOB_STATUS.RUNNING) {
129 | Thread.sleep(1000);
130 |
131 | Log.d("SetWallpaper", "polling status: " + status);
132 |
133 | if(status==JOB_STATUS.FAILURE) {
134 | throw new RuntimeException("Fail");
135 | }
136 |
137 | if(status==JOB_STATUS.SUCCESS) {
138 | break;
139 | }
140 | }
141 |
142 | }
143 |
144 | private void setWallpaper(File localFile){
145 | Bitmap photo = getBitmapFromFile(localFile);
146 | WallpaperManager myWallpaperManager
147 | = WallpaperManager.getInstance(MyApp.getContext());
148 |
149 | if(myWallpaperManager!=null){
150 | try {
151 | myWallpaperManager.setBitmap(photo);
152 | } catch (Exception e){
153 | e.printStackTrace();
154 | FirebaseCrash.report(e);
155 | return;
156 | }
157 |
158 | //changed successfully
159 | HistoryItem item = new HistoryItem(id, fromUser, "self",System.currentTimeMillis(), Uri.fromFile(localFile).toString());
160 | HistoryRepo.getInstance().putHistoryItem(item);
161 |
162 | User user = MyApp.getUser();
163 | if(user==null){
164 | user = new Gson().fromJson(MyApp.getPref().getString(MyApp.getContext().getString(R.string.pref_user_obj),""), User.class);
165 | }
166 |
167 | if(user==null) return;
168 |
169 | //notify firebase function for sending fcm to userName
170 | HttpsRequestPayload payload = new HttpsRequestPayload(fromUser
171 | , user.username
172 | , HttpsRequestPayload.STATUS_CODE.WALLPAPER_CHANGED
173 | , id);
174 | new SendHttpsRequest(payload).start();
175 |
176 | Log.d("SetWallpaper", "setWallpaper: successfully changed wallpaper");
177 | }
178 | }
179 |
180 | private Bitmap getBitmapFromFile(File photo){
181 | BitmapFactory.Options options = new BitmapFactory.Options();
182 | options.inPreferredConfig = Bitmap.Config.ARGB_8888;
183 | Bitmap bitmap = BitmapFactory.decodeFile(photo.getAbsolutePath(), options);
184 |
185 | if(bitmap==null){
186 | Log.d("SetWallpaper", "getBitmapFromFile: failed to create bitmap from file : " + photo.getAbsolutePath());
187 | }
188 |
189 | return bitmap;
190 | }
191 |
192 | @Override
193 | protected void onCancel(int cancelReason, @Nullable Throwable throwable) {
194 | Log.d("SetWallpaper", "onCancel: ");
195 | //notify firebase function for sending fcm to userName
196 | HttpsRequestPayload payload = new HttpsRequestPayload(fromUser
197 | , MyApp.getUser().username
198 | , HttpsRequestPayload.STATUS_CODE.WALLPAPER_CHANGE_FAILED
199 | , id);
200 | new SendHttpsRequest(payload).start();
201 | }
202 |
203 | @Override
204 | protected RetryConstraint shouldReRunOnThrowable(@NonNull Throwable throwable, int runCount, int maxRunCount) {
205 | Log.d("SetWallpaper", "shouldReRunOnThrowable: " + runCount);
206 | return RetryConstraint.createExponentialBackoff(runCount, 1000);
207 | }
208 | }
209 |
--------------------------------------------------------------------------------
/app/src/main/java/in/thetechguru/walle/remote/abremotewallpaperchanger/activity_fragments/FragmentLogin.java:
--------------------------------------------------------------------------------
1 | package in.thetechguru.walle.remote.abremotewallpaperchanger.activity_fragments;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.annotation.NonNull;
6 | import android.support.design.widget.Snackbar;
7 | import android.support.v4.app.Fragment;
8 | import android.text.InputType;
9 | import android.util.Log;
10 | import android.util.Patterns;
11 | import android.view.LayoutInflater;
12 | import android.view.View;
13 | import android.view.ViewGroup;
14 | import android.widget.EditText;
15 | import android.widget.TextView;
16 |
17 | import com.afollestad.materialdialogs.MaterialDialog;
18 | import com.google.android.gms.tasks.OnCompleteListener;
19 | import com.google.android.gms.tasks.Task;
20 | import com.google.firebase.FirebaseNetworkException;
21 | import com.google.firebase.auth.AuthResult;
22 | import com.google.firebase.auth.FirebaseAuthInvalidCredentialsException;
23 | import com.google.firebase.auth.FirebaseAuthInvalidUserException;
24 | import com.google.firebase.auth.FirebaseUser;
25 | import com.google.firebase.database.DataSnapshot;
26 | import com.google.firebase.database.DatabaseError;
27 | import com.google.firebase.database.DatabaseReference;
28 | import com.google.firebase.database.ValueEventListener;
29 | import com.google.gson.Gson;
30 |
31 | import br.com.simplepass.loading_button_lib.customViews.CircularProgressButton;
32 | import butterknife.BindView;
33 | import butterknife.ButterKnife;
34 | import butterknife.OnClick;
35 | import in.thetechguru.walle.remote.abremotewallpaperchanger.MyApp;
36 | import in.thetechguru.walle.remote.abremotewallpaperchanger.R;
37 | import in.thetechguru.walle.remote.abremotewallpaperchanger.helpers.FirebaseUtil;
38 | import in.thetechguru.walle.remote.abremotewallpaperchanger.helpers.UtilityFun;
39 | import in.thetechguru.walle.remote.abremotewallpaperchanger.model.User;
40 |
41 | /**
42 | Copyright 2017 Amit Bhandari AB
43 | Licensed under the Apache License, Version 2.0 (the "License");
44 | you may not use this file except in compliance with the License.
45 | You may obtain a copy of the License at
46 | http://www.apache.org/licenses/LICENSE-2.0
47 | Unless required by applicable law or agreed to in writing, software
48 | distributed under the License is distributed on an "AS IS" BASIS,
49 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
50 | See the License for the specific language governing permissions and
51 | limitations under the License.
52 | */
53 |
54 | public class FragmentLogin extends Fragment {
55 |
56 | private final String TAG = getClass().getSimpleName();
57 | @BindView(R.id.root_view_login) View rootView;
58 | @BindView(R.id.email_id_input) EditText email_input;
59 | @BindView(R.id.password_input) EditText password_input;
60 | @BindView(R.id.login_button) CircularProgressButton login_button;
61 | @BindView(R.id.forgot_password_textview) TextView forgotPassword;
62 |
63 |
64 | public FragmentLogin() {
65 | }
66 |
67 | @Override
68 | public void onCreate(Bundle savedInstanceState) {
69 | super.onCreate(savedInstanceState);
70 | }
71 |
72 | @Override
73 | public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
74 | Bundle savedInstanceState) {
75 | // Inflate the layout for this fragment
76 | View layout = inflater.inflate(R.layout.fragment_login, container, false);
77 | ButterKnife.bind(this, layout);
78 | return layout;
79 | }
80 |
81 | @Override
82 | public void onDestroy() {
83 | super.onDestroy();
84 | login_button.dispose();
85 | }
86 |
87 | @OnClick(R.id.forgot_password_textview)
88 | void forgotPassword(){
89 | if(!UtilityFun.isConnectedToInternet()){
90 | Snackbar.make(rootView, R.string.no_network_error, Snackbar.LENGTH_SHORT).show();
91 | return;
92 | }
93 | if(isAdded() && getActivity()!=null) {
94 | new MaterialDialog.Builder(getActivity())
95 | .title(R.string.password_reset_title)
96 | .content(R.string.password_reset_content)
97 | .inputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS)
98 | .autoDismiss(false)
99 | .input(getString(R.string.email_id_hint), "", new MaterialDialog.InputCallback() {
100 | @SuppressWarnings("ConstantConditions")
101 | @Override
102 | public void onInput(@NonNull final MaterialDialog dialog, CharSequence input) {
103 |
104 | String email = input.toString().trim();
105 | if(email.isEmpty() || !Patterns.EMAIL_ADDRESS.matcher(email).matches()){
106 | dialog.getInputEditText().setError(getString(R.string.invalid_email_id_error));
107 | return;
108 | }
109 |
110 | // Do something
111 | FirebaseUtil.getAuth().sendPasswordResetEmail(email)
112 | .addOnCompleteListener(new OnCompleteListener() {
113 | @Override
114 | public void onComplete(@NonNull Task task) {
115 | if (task.isSuccessful()) {
116 | Log.d(TAG, "Check your email for password reset instruction.");
117 | Snackbar.make(rootView, R.string.password_reset_email_sent, Snackbar.LENGTH_SHORT).show();
118 | dialog.dismiss();
119 | }else {
120 | try {
121 | throw task.getException();
122 | } catch (FirebaseAuthInvalidUserException e){
123 | dialog.getInputEditText().setError(getString(R.string.invalid_user_error));
124 | } catch (FirebaseNetworkException e){
125 | dialog.getInputEditText().setError(getString(R.string.no_network_error));
126 | } catch (Exception e) {
127 | dialog.getInputEditText().setError(getString(R.string.unknown_error));
128 | }
129 | }
130 | }
131 | });
132 | }
133 | }).show();
134 | }
135 | }
136 |
137 | @OnClick(R.id.login_button)
138 | void login(){
139 | String email = email_input.getText().toString().trim();
140 |
141 | if(email.isEmpty() || !Patterns.EMAIL_ADDRESS.matcher(email).matches()){
142 | email_input.setError(getString(R.string.invalid_email_id_error));
143 | return;
144 | }
145 |
146 | final String password = password_input.getText().toString().trim();
147 |
148 | if(password.isEmpty()){
149 | password_input.setError(getString(R.string.empty_password_error));
150 | return;
151 | }
152 |
153 | login_button.startAnimation();
154 |
155 | if(isAdded() && getActivity()!=null) {
156 | FirebaseUtil.getAuth().signInWithEmailAndPassword(email, password)
157 | .addOnCompleteListener(getActivity(), new OnCompleteListener() {
158 | @SuppressWarnings("ConstantConditions")
159 | @Override
160 | public void onComplete(@NonNull Task task) {
161 | if (task.isSuccessful()) {
162 | Log.d(TAG, "signInWithEmail:success");
163 | FirebaseUser firebaseUser = task.getResult().getUser();
164 | //get username
165 | if(firebaseUser!=null) {
166 | DatabaseReference db = FirebaseUtil.getUsersReference().child(firebaseUser.getUid());
167 | db.addListenerForSingleValueEvent(new ValueEventListener() {
168 | @Override
169 | public void onDataChange(DataSnapshot dataSnapshot) {
170 | User user = dataSnapshot.getValue(User.class);
171 | MyApp.getPref().edit().putString(getString(R.string.pref_user_obj), new Gson().toJson(user)).apply();
172 |
173 | //send token to server
174 | String token = MyApp.getPref().getString(getString(R.string.notification_token),"");
175 | if(user.username==null || user.username.equals("") || token.equals("")) return;
176 | FirebaseUtil.getNotificationTokenRef().child(user.username).setValue(token);
177 |
178 | startActivity(new Intent(getActivity(), ActivityMain.class));
179 | getActivity().finish();
180 | }
181 |
182 | @Override
183 | public void onCancelled(DatabaseError databaseError) {
184 | login_button.revertAnimation();
185 | Snackbar.make(rootView, R.string.unknown_login_error, Snackbar.LENGTH_SHORT).show();
186 | }
187 | });
188 | }
189 |
190 | } else {
191 | // If sign in fails, display a message to the user.
192 | login_button.revertAnimation();
193 | Log.w(TAG, "signInWithEmail:failure", task.getException());
194 | Snackbar.make(rootView, R.string.login_failed_error, Snackbar.LENGTH_SHORT).show();
195 | try {
196 | throw task.getException();
197 | } catch(FirebaseAuthInvalidUserException e) {
198 | email_input.setError(getString(R.string.invalid_user_error));
199 | } catch (FirebaseAuthInvalidCredentialsException e) {
200 | password_input.setError(getString(R.string.invalid_password_error));
201 | } catch (FirebaseNetworkException e){
202 | Snackbar.make(rootView, R.string.no_network_error, Snackbar.LENGTH_SHORT).show();
203 | } catch (Exception e) {
204 | Snackbar.make(rootView, R.string.unknown_login_error, Snackbar.LENGTH_SHORT).show();
205 | e.printStackTrace();
206 | }
207 | }
208 | }
209 | });
210 | }
211 | }
212 | }
213 |
--------------------------------------------------------------------------------