5 |
6 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | We as members, contributors, and leaders pledge to make participation in our
6 | community a harassment-free experience for everyone, regardless of age, body
7 | size, visible or invisible disability, ethnicity, sex characteristics, gender
8 | identity and expression, level of experience, education, socio-economic status,
9 | nationality, personal appearance, race, religion, or sexual identity
10 | and orientation.
11 |
12 | We pledge to act and interact in ways that contribute to an open, welcoming,
13 | diverse, inclusive, and healthy community.
14 |
15 | ## Our Standards
16 |
17 | Examples of behavior that contributes to a positive environment for our
18 | community include:
19 |
20 | * Demonstrating empathy and kindness toward other people
21 | * Being respectful of differing opinions, viewpoints, and experiences
22 | * Giving and gracefully accepting constructive feedback
23 | * Accepting responsibility and apologizing to those affected by our mistakes,
24 | and learning from the experience
25 | * Focusing on what is best not just for us as individuals, but for the
26 | overall community
27 |
28 | Examples of unacceptable behavior include:
29 |
30 | * The use of sexualized language or imagery, and sexual attention or
31 | advances of any kind
32 | * Trolling, insulting or derogatory comments, and personal or political attacks
33 | * Public or private harassment
34 | * Publishing others' private information, such as a physical or email
35 | address, without their explicit permission
36 | * Other conduct which could reasonably be considered inappropriate in a
37 | professional setting
38 |
39 | ## Enforcement Responsibilities
40 |
41 | Community leaders are responsible for clarifying and enforcing our standards of
42 | acceptable behavior and will take appropriate and fair corrective action in
43 | response to any behavior that they deem inappropriate, threatening, offensive,
44 | or harmful.
45 |
46 | Community leaders have the right and responsibility to remove, edit, or reject
47 | comments, commits, code, wiki edits, issues, and other contributions that are
48 | not aligned to this Code of Conduct, and will communicate reasons for moderation
49 | decisions when appropriate.
50 |
51 | ## Scope
52 |
53 | This Code of Conduct applies within all community spaces, and also applies when
54 | an individual is officially representing the community in public spaces.
55 | Examples of representing our community include using an official e-mail address,
56 | posting via an official social media account, or acting as an appointed
57 | representative at an online or offline event.
58 |
59 | ## Enforcement
60 |
61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
62 | reported to the community leaders responsible for enforcement at
63 | .
64 | All complaints will be reviewed and investigated promptly and fairly.
65 |
66 | All community leaders are obligated to respect the privacy and security of the
67 | reporter of any incident.
68 |
69 | ## Enforcement Guidelines
70 |
71 | Community leaders will follow these Community Impact Guidelines in determining
72 | the consequences for any action they deem in violation of this Code of Conduct:
73 |
74 | ### 1. Correction
75 |
76 | **Community Impact**: Use of inappropriate language or other behavior deemed
77 | unprofessional or unwelcome in the community.
78 |
79 | **Consequence**: A private, written warning from community leaders, providing
80 | clarity around the nature of the violation and an explanation of why the
81 | behavior was inappropriate. A public apology may be requested.
82 |
83 | ### 2. Warning
84 |
85 | **Community Impact**: A violation through a single incident or series
86 | of actions.
87 |
88 | **Consequence**: A warning with consequences for continued behavior. No
89 | interaction with the people involved, including unsolicited interaction with
90 | those enforcing the Code of Conduct, for a specified period of time. This
91 | includes avoiding interactions in community spaces as well as external channels
92 | like social media. Violating these terms may lead to a temporary or
93 | permanent ban.
94 |
95 | ### 3. Temporary Ban
96 |
97 | **Community Impact**: A serious violation of community standards, including
98 | sustained inappropriate behavior.
99 |
100 | **Consequence**: A temporary ban from any sort of interaction or public
101 | communication with the community for a specified period of time. No public or
102 | private interaction with the people involved, including unsolicited interaction
103 | with those enforcing the Code of Conduct, is allowed during this period.
104 | Violating these terms may lead to a permanent ban.
105 |
106 | ### 4. Permanent Ban
107 |
108 | **Community Impact**: Demonstrating a pattern of violation of community
109 | standards, including sustained inappropriate behavior, harassment of an
110 | individual, or aggression toward or disparagement of classes of individuals.
111 |
112 | **Consequence**: A permanent ban from any sort of public interaction within
113 | the community.
114 |
115 | ## Attribution
116 |
117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118 | version 2.0, available at
119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120 |
121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct
122 | enforcement ladder](https://github.com/mozilla/diversity).
123 |
124 | [homepage]: https://www.contributor-covenant.org
125 |
126 | For answers to common questions about this code of conduct, see the FAQ at
127 | https://www.contributor-covenant.org/faq. Translations are available at
128 | https://www.contributor-covenant.org/translations.
129 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | #### STEPS :
2 | > **1. Create New Branch**
3 | > **2. Add ScreenShots**
4 | > **3. Add Description in more than 100 words, and explain why you make changes in it.**
5 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Weather App 🌧️🌧️💙💙
2 |
3 | 
4 | 
5 |
6 | ## Preview
7 |
8 |
9 |
10 | ## Screenshots
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | #### Simple and Beautiful Weather App using Java.
19 |
20 | I am using **https://openweathermap.org/** to get all the data using JSON file.
21 |
22 | ### Steps :
23 |
24 | > First, you have to create a account on it.
25 |
26 | > Then, generate a a unique API key to get all the data from the JSON file.
27 |
28 | > Paste you **API KEY** in **_LocationCord.java_** file as
29 |
30 | ```
31 | public final static String API_KEY = "81a26c8f0de407b94623e9f43e825679";
32 | ```
33 |
34 |
35 |
36 | #### API key calling from this website : **https://openweathermap.org/api/one-call-3**
37 |
38 | #### The One Call API provides the following weather data for any geographical coordinates:
39 |
40 | - Current weather
41 | - Minute forecast for 1 hour
42 | - Hourly forecast for 48 hours
43 | - Daily forecast for 8 days
44 | - National weather alerts
45 | - Historical weather data for 40+ years back (since January 1, 1979)
46 |
47 | ##### Note :
48 |
49 | > Single API key on have
50 |
51 | ## Contributing
52 |
53 | Please fork this repository and contribute back. Any contributions, large or small, major or minor features, bug fixes, are welcomed and appreciated but will be thoroughly reviewed.
54 |
55 | ## Support
56 |
57 | [](https://www.buymeacoffee.com/aniketjain)
58 |
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 | # Security Policy
2 |
3 | ## Supported Versions
4 |
5 | Use this section to tell people about which versions of your project are
6 | currently being supported with security updates.
7 |
8 | | Version | Supported |
9 | | ------- | ------------------ |
10 | | 5.1.x | :white_check_mark: |
11 | | 5.0.x | :x: |
12 | | 4.0.x | :white_check_mark: |
13 | | < 4.0 | :x: |
14 |
15 | ## Reporting a Vulnerability
16 |
17 | Use this section to tell people how to report a vulnerability.
18 |
19 | Tell them where to go, how often they can expect to get an update on a
20 | reported vulnerability, what to expect if the vulnerability is accepted or
21 | declined, etc.
22 |
--------------------------------------------------------------------------------
/SS/gif1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/SS/gif1.gif
--------------------------------------------------------------------------------
/SS/image1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/SS/image1.jpg
--------------------------------------------------------------------------------
/SS/image2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/SS/image2.jpg
--------------------------------------------------------------------------------
/apk/app-debug.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/apk/app-debug.apk
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.application'
3 | }
4 |
5 | android {
6 | compileSdk 33
7 |
8 | defaultConfig {
9 | applicationId "com.aniketjain.weatherapp"
10 | minSdk 19
11 | targetSdk 33
12 | versionCode 5
13 | versionName "1.0.5"
14 | multiDexEnabled true
15 |
16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled true
22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 | buildFeatures { viewBinding true }
26 | compileOptions {
27 | sourceCompatibility JavaVersion.VERSION_1_8
28 | targetCompatibility JavaVersion.VERSION_1_8
29 | }
30 | }
31 |
32 | dependencies {
33 | implementation 'androidx.appcompat:appcompat:1.6.1'
34 | implementation 'com.google.android.material:material:1.9.0'
35 | implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
36 | testImplementation 'junit:junit:4.13.2'
37 | androidTestImplementation 'androidx.test.ext:junit:1.1.5'
38 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
39 |
40 | //for getting json data
41 | implementation 'com.android.volley:volley:1.2.1'
42 | //location - lat, lon
43 | implementation 'com.google.android.gms:play-services-location:21.0.1'
44 | //custom toast
45 | implementation 'com.github.dev-aniketj:roasted-toast:1.0.2'
46 | //custom progress
47 | implementation 'com.github.ybq:Android-SpinKit:1.4.0'
48 | //swipe refresh
49 | implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
50 | //App Auto Update Feature
51 | implementation 'com.google.android.play:core:1.10.3'
52 | //For Responsive screen size
53 | implementation 'com.intuit.sdp:sdp-android:1.1.0'
54 | //Lotti files
55 | implementation 'com.airbnb.android:lottie:5.2.0'
56 | // Multi Dex Enable
57 | implementation 'androidx.multidex:multidex:2.0.1'
58 | }
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/app/release/app-release.aab:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/release/app-release.aab
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/aniketjain/weatherapp/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.aniketjain.weatherapp;
2 |
3 | import android.content.Context;
4 |
5 | import androidx.test.platform.app.InstrumentationRegistry;
6 | import androidx.test.ext.junit.runners.AndroidJUnit4;
7 |
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 |
11 | import static org.junit.Assert.*;
12 |
13 | /**
14 | * Instrumented test, which will execute on an Android device.
15 | *
16 | * @see Testing documentation
17 | */
18 | @RunWith(AndroidJUnit4.class)
19 | public class ExampleInstrumentedTest {
20 | @Test
21 | public void useAppContext() {
22 | // Context of the app under test.
23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24 | assertEquals("com.aniketjain.weatherapp", appContext.getPackageName());
25 | }
26 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
19 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/ic_launcher-playstore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/ic_launcher-playstore.png
--------------------------------------------------------------------------------
/app/src/main/ic_main-playstore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/ic_main-playstore.png
--------------------------------------------------------------------------------
/app/src/main/java/com/aniketjain/weatherapp/HomeActivity.java:
--------------------------------------------------------------------------------
1 | package com.aniketjain.weatherapp;
2 |
3 | import static com.aniketjain.weatherapp.location.CityFinder.getCityNameUsingNetwork;
4 | import static com.aniketjain.weatherapp.location.CityFinder.setLongitudeLatitude;
5 | import static com.aniketjain.weatherapp.network.InternetConnectivity.isInternetConnected;
6 |
7 | import android.Manifest;
8 | import android.annotation.SuppressLint;
9 | import android.app.Activity;
10 | import android.content.Intent;
11 | import android.content.IntentSender;
12 | import android.content.pm.PackageManager;
13 | import android.os.Build;
14 | import android.os.Bundle;
15 | import android.speech.RecognizerIntent;
16 | import android.util.Log;
17 | import android.view.View;
18 | import android.view.inputmethod.EditorInfo;
19 | import android.view.inputmethod.InputMethodManager;
20 |
21 | import androidx.annotation.NonNull;
22 | import androidx.annotation.Nullable;
23 | import androidx.appcompat.app.AppCompatActivity;
24 | import androidx.core.app.ActivityCompat;
25 | import androidx.recyclerview.widget.LinearLayoutManager;
26 |
27 | import com.android.volley.Request;
28 | import com.android.volley.RequestQueue;
29 | import com.android.volley.toolbox.JsonObjectRequest;
30 | import com.android.volley.toolbox.Volley;
31 | import com.aniketjain.weatherapp.adapter.DaysAdapter;
32 | import com.aniketjain.weatherapp.databinding.ActivityHomeBinding;
33 | import com.aniketjain.weatherapp.location.LocationCord;
34 | import com.aniketjain.weatherapp.toast.Toaster;
35 | import com.aniketjain.weatherapp.update.UpdateUI;
36 | import com.aniketjain.weatherapp.url.URL;
37 | import com.google.android.gms.location.FusedLocationProviderClient;
38 | import com.google.android.gms.location.LocationServices;
39 | import com.google.android.play.core.appupdate.AppUpdateInfo;
40 | import com.google.android.play.core.appupdate.AppUpdateManager;
41 | import com.google.android.play.core.appupdate.AppUpdateManagerFactory;
42 | import com.google.android.play.core.install.model.AppUpdateType;
43 | import com.google.android.play.core.install.model.UpdateAvailability;
44 | import com.google.android.play.core.tasks.Task;
45 |
46 | import org.json.JSONException;
47 |
48 | import java.text.SimpleDateFormat;
49 | import java.util.ArrayList;
50 | import java.util.Date;
51 | import java.util.Locale;
52 | import java.util.Objects;
53 |
54 | public class HomeActivity extends AppCompatActivity {
55 |
56 | private final int WEATHER_FORECAST_APP_UPDATE_REQ_CODE = 101; // for app update
57 | private static final int PERMISSION_CODE = 1; // for user location permission
58 | private String name, updated_at, description, temperature, min_temperature, max_temperature, pressure, wind_speed, humidity;
59 | private int condition;
60 | private long update_time, sunset, sunrise;
61 | private String city = "";
62 | private final int REQUEST_CODE_EXTRA_INPUT = 101;
63 | private ActivityHomeBinding binding;
64 |
65 | @Override
66 | protected void onCreate(Bundle savedInstanceState) {
67 | super.onCreate(savedInstanceState);
68 |
69 | // binding
70 | binding = ActivityHomeBinding.inflate(getLayoutInflater());
71 | View view = binding.getRoot();
72 | setContentView(view);
73 |
74 | // set navigation bar color
75 | setNavigationBarColor();
76 |
77 | //check for new app update
78 | checkUpdate();
79 |
80 | // set refresh color schemes
81 | setRefreshLayoutColor();
82 |
83 | // when user do search and refresh
84 | listeners();
85 |
86 | // getting data using internet connection
87 | getDataUsingNetwork();
88 |
89 | }
90 |
91 |
92 | @Override
93 | protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
94 | super.onActivityResult(requestCode, resultCode, data);
95 | if (requestCode == REQUEST_CODE_EXTRA_INPUT) {
96 | if (resultCode == RESULT_OK && data != null) {
97 | ArrayList arrayList = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
98 | binding.layout.cityEt.setText(Objects.requireNonNull(arrayList).get(0).toUpperCase());
99 | searchCity(binding.layout.cityEt.getText().toString());
100 | }
101 | }
102 | }
103 |
104 |
105 | private void setNavigationBarColor() {
106 | if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
107 | getWindow().setNavigationBarColor(getResources().getColor(R.color.navBarColor));
108 | }
109 | }
110 |
111 | private void setUpDaysRecyclerView() {
112 | DaysAdapter daysAdapter = new DaysAdapter(this);
113 | binding.dayRv.setLayoutManager(
114 | new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false)
115 | );
116 | binding.dayRv.setAdapter(daysAdapter);
117 | }
118 |
119 | @SuppressLint("ClickableViewAccessibility")
120 | private void listeners() {
121 | binding.layout.mainLayout.setOnTouchListener((view, motionEvent) -> {
122 | hideKeyboard(view);
123 | return false;
124 | });
125 | binding.layout.searchBarIv.setOnClickListener(view -> searchCity(binding.layout.cityEt.getText().toString()));
126 | binding.layout.searchBarIv.setOnTouchListener((view, motionEvent) -> {
127 | hideKeyboard(view);
128 | return false;
129 | });
130 | binding.layout.cityEt.setOnEditorActionListener((textView, i, keyEvent) -> {
131 | if (i == EditorInfo.IME_ACTION_GO) {
132 | searchCity(binding.layout.cityEt.getText().toString());
133 | hideKeyboard(textView);
134 | return true;
135 | }
136 | return false;
137 | });
138 | binding.layout.cityEt.setOnFocusChangeListener((view, b) -> {
139 | if (!b) {
140 | hideKeyboard(view);
141 | }
142 | });
143 | binding.mainRefreshLayout.setOnRefreshListener(() -> {
144 | checkConnection();
145 | Log.i("refresh", "Refresh Done.");
146 | binding.mainRefreshLayout.setRefreshing(false); //for the next time
147 | });
148 | //Mic Search
149 | binding.layout.micSearchId.setOnClickListener(view -> {
150 | Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
151 | intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
152 | intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, Locale.getDefault());
153 | intent.putExtra(RecognizerIntent.EXTRA_PROMPT, REQUEST_CODE_EXTRA_INPUT);
154 | try {
155 | //it was deprecated but still work
156 | startActivityForResult(intent, REQUEST_CODE_EXTRA_INPUT);
157 | } catch (Exception e) {
158 | Log.d("Error Voice", "Mic Error: " + e);
159 | }
160 | });
161 | }
162 |
163 | private void setRefreshLayoutColor() {
164 | binding.mainRefreshLayout.setProgressBackgroundColorSchemeColor(
165 | getResources().getColor(R.color.textColor)
166 | );
167 | binding.mainRefreshLayout.setColorSchemeColors(
168 | getResources().getColor(R.color.navBarColor)
169 | );
170 | }
171 |
172 | private void searchCity(String cityName) {
173 | if (cityName == null || cityName.isEmpty()) {
174 | Toaster.errorToast(this, "Please enter the city name");
175 | } else {
176 | setLatitudeLongitudeUsingCity(cityName);
177 | }
178 | }
179 |
180 | private void getDataUsingNetwork() {
181 | FusedLocationProviderClient client = LocationServices.getFusedLocationProviderClient(this);
182 | //check permission
183 | if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this,
184 | Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
185 | ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}, PERMISSION_CODE);
186 | } else {
187 | client.getLastLocation().addOnSuccessListener(location -> {
188 | setLongitudeLatitude(location);
189 | city = getCityNameUsingNetwork(this, location);
190 | getTodayWeatherInfo(city);
191 | });
192 | }
193 | }
194 |
195 | private void setLatitudeLongitudeUsingCity(String cityName) {
196 | URL.setCity_url(cityName);
197 | RequestQueue requestQueue = Volley.newRequestQueue(HomeActivity.this);
198 | JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, URL.getCity_url(), null, response -> {
199 | try {
200 | LocationCord.lat = response.getJSONObject("coord").getString("lat");
201 | LocationCord.lon = response.getJSONObject("coord").getString("lon");
202 | getTodayWeatherInfo(cityName);
203 | // After the successfully city search the cityEt(editText) is Empty.
204 | binding.layout.cityEt.setText("");
205 | } catch (JSONException e) {
206 | e.printStackTrace();
207 | }
208 | }, error -> Toaster.errorToast(this, "Please enter the correct city name"));
209 | requestQueue.add(jsonObjectRequest);
210 | }
211 |
212 | @SuppressLint("DefaultLocale")
213 | private void getTodayWeatherInfo(String name) {
214 | URL url = new URL();
215 | RequestQueue requestQueue = Volley.newRequestQueue(this);
216 | JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, url.getLink(), null, response -> {
217 | try {
218 | this.name = name;
219 | update_time = response.getJSONObject("current").getLong("dt");
220 | updated_at = new SimpleDateFormat("EEEE hh:mm a", Locale.ENGLISH).format(new Date(update_time * 1000));
221 |
222 | condition = response.getJSONArray("daily").getJSONObject(0).getJSONArray("weather").getJSONObject(0).getInt("id");
223 | sunrise = response.getJSONArray("daily").getJSONObject(0).getLong("sunrise");
224 | sunset = response.getJSONArray("daily").getJSONObject(0).getLong("sunset");
225 | description = response.getJSONObject("current").getJSONArray("weather").getJSONObject(0).getString("main");
226 |
227 | temperature = String.valueOf(Math.round(response.getJSONObject("current").getDouble("temp") - 273.15));
228 | min_temperature = String.format("%.0f", response.getJSONArray("daily").getJSONObject(0).getJSONObject("temp").getDouble("min") - 273.15);
229 | max_temperature = String.format("%.0f", response.getJSONArray("daily").getJSONObject(0).getJSONObject("temp").getDouble("max") - 273.15);
230 | pressure = response.getJSONArray("daily").getJSONObject(0).getString("pressure");
231 | wind_speed = response.getJSONArray("daily").getJSONObject(0).getString("wind_speed");
232 | humidity = response.getJSONArray("daily").getJSONObject(0).getString("humidity");
233 |
234 | updateUI();
235 | hideProgressBar();
236 | setUpDaysRecyclerView();
237 | } catch (JSONException e) {
238 | e.printStackTrace();
239 | }
240 | }, null);
241 | requestQueue.add(jsonObjectRequest);
242 | Log.i("json_req", "Day 0");
243 | }
244 |
245 | @SuppressLint("SetTextI18n")
246 | private void updateUI() {
247 | binding.layout.nameTv.setText(name);
248 | updated_at = translate(updated_at);
249 | binding.layout.updatedAtTv.setText(updated_at);
250 | binding.layout.conditionIv.setImageResource(
251 | getResources().getIdentifier(
252 | UpdateUI.getIconID(condition, update_time, sunrise, sunset),
253 | "drawable",
254 | getPackageName()
255 | ));
256 | binding.layout.conditionDescTv.setText(description);
257 | binding.layout.tempTv.setText(temperature + "°C");
258 | binding.layout.minTempTv.setText(min_temperature + "°C");
259 | binding.layout.maxTempTv.setText(max_temperature + "°C");
260 | binding.layout.pressureTv.setText(pressure + " mb");
261 | binding.layout.windTv.setText(wind_speed + " km/h");
262 | binding.layout.humidityTv.setText(humidity + "%");
263 | }
264 |
265 | private String translate(String dayToTranslate) {
266 | String[] dayToTranslateSplit = dayToTranslate.split(" ");
267 | dayToTranslateSplit[0] = UpdateUI.TranslateDay(dayToTranslateSplit[0].trim(), getApplicationContext());
268 | return dayToTranslateSplit[0].concat(" " + dayToTranslateSplit[1]);
269 | }
270 |
271 | private void hideProgressBar() {
272 | binding.progress.setVisibility(View.GONE);
273 | binding.layout.mainLayout.setVisibility(View.VISIBLE);
274 | }
275 |
276 | private void hideMainLayout() {
277 | binding.progress.setVisibility(View.VISIBLE);
278 | binding.layout.mainLayout.setVisibility(View.GONE);
279 | }
280 |
281 | private void hideKeyboard(View view) {
282 | InputMethodManager inputMethodManager = (InputMethodManager) view.getContext().getSystemService(Activity.INPUT_METHOD_SERVICE);
283 | inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
284 | }
285 |
286 | private void checkConnection() {
287 | if (!isInternetConnected(this)) {
288 | hideMainLayout();
289 | Toaster.errorToast(this, "Please check your internet connection");
290 | } else {
291 | hideProgressBar();
292 | getDataUsingNetwork();
293 | }
294 | }
295 |
296 | @Override
297 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
298 | super.onRequestPermissionsResult(requestCode, permissions, grantResults);
299 | if (requestCode == PERMISSION_CODE) {
300 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
301 | Toaster.successToast(this, "Permission Granted");
302 | getDataUsingNetwork();
303 | } else {
304 | Toaster.errorToast(this, "Permission Denied");
305 | finish();
306 | }
307 | }
308 | }
309 |
310 | @Override
311 | protected void onResume() {
312 | super.onResume();
313 | checkConnection();
314 | }
315 |
316 | private void checkUpdate() {
317 | AppUpdateManager appUpdateManager = AppUpdateManagerFactory.create(HomeActivity.this);
318 | Task appUpdateInfoTask = appUpdateManager.getAppUpdateInfo();
319 | appUpdateInfoTask.addOnSuccessListener(appUpdateInfo -> {
320 | if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE
321 | && appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.IMMEDIATE)) {
322 | try {
323 | appUpdateManager.startUpdateFlowForResult(appUpdateInfo, AppUpdateType.IMMEDIATE, HomeActivity.this, WEATHER_FORECAST_APP_UPDATE_REQ_CODE);
324 | } catch (IntentSender.SendIntentException exception) {
325 | Toaster.errorToast(this, "Update Failed");
326 | }
327 | }
328 | });
329 | }
330 |
331 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/aniketjain/weatherapp/SplashScreen.java:
--------------------------------------------------------------------------------
1 | package com.aniketjain.weatherapp;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.os.Handler;
7 | import android.view.WindowManager;
8 |
9 | import androidx.appcompat.app.AppCompatActivity;
10 |
11 | import com.aniketjain.weatherapp.databinding.ActivitySplashScreenBinding;
12 |
13 | @SuppressLint("CustomSplashScreen")
14 | public class SplashScreen extends AppCompatActivity {
15 |
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | ActivitySplashScreenBinding binding = ActivitySplashScreenBinding.inflate(getLayoutInflater());
20 | setContentView(binding.getRoot());
21 | //Removing status bar
22 | getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
23 | //Setting Splash
24 | splashScreen();
25 | }
26 |
27 | private void splashScreen() {
28 | int SPLASH_TIME = 4000;
29 | new Handler().postDelayed(() -> {
30 | Intent intent = new Intent(getApplicationContext(), HomeActivity.class);
31 | startActivity(intent);
32 | finish();
33 | }, SPLASH_TIME);
34 | }
35 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/aniketjain/weatherapp/adapter/DaysAdapter.java:
--------------------------------------------------------------------------------
1 | package com.aniketjain.weatherapp.adapter;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.content.Context;
5 | import android.util.Log;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.ImageView;
10 | import android.widget.RelativeLayout;
11 | import android.widget.TextView;
12 |
13 | import androidx.annotation.NonNull;
14 | import androidx.recyclerview.widget.RecyclerView;
15 |
16 | import com.android.volley.Request;
17 | import com.android.volley.RequestQueue;
18 | import com.android.volley.toolbox.JsonObjectRequest;
19 | import com.android.volley.toolbox.Volley;
20 | import com.aniketjain.weatherapp.R;
21 | import com.aniketjain.weatherapp.update.UpdateUI;
22 | import com.aniketjain.weatherapp.url.URL;
23 | import com.github.ybq.android.spinkit.SpinKitView;
24 |
25 | import org.json.JSONException;
26 |
27 | import java.text.SimpleDateFormat;
28 | import java.util.Date;
29 | import java.util.Locale;
30 |
31 | public class DaysAdapter extends RecyclerView.Adapter {
32 | private final Context context;
33 |
34 | public DaysAdapter(Context context) {
35 | this.context = context;
36 | }
37 |
38 | private String updated_at, min, max, pressure, wind_speed, humidity;
39 | private int condition;
40 | private long update_time, sunset, sunrise;
41 |
42 | @NonNull
43 | @Override
44 | public DayViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
45 | View view = LayoutInflater.from(context).inflate(R.layout.day_item_layout, parent, false);
46 | return new DayViewHolder(view);
47 | }
48 |
49 | @Override
50 | public void onBindViewHolder(@NonNull DayViewHolder holder, int position) {
51 | getDailyWeatherInfo(position + 1, holder);
52 | }
53 |
54 | @Override
55 | public int getItemCount() {
56 | return 6;
57 | }
58 |
59 | @SuppressLint("DefaultLocale")
60 | private void getDailyWeatherInfo(int i, DayViewHolder holder) {
61 | URL url = new URL();
62 | RequestQueue requestQueue = Volley.newRequestQueue(context);
63 | JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, url.getLink(), null, response -> {
64 | try {
65 | update_time = response.getJSONObject("current").getLong("dt");
66 | updated_at = new SimpleDateFormat("EEEE", Locale.ENGLISH).format(new Date((update_time * 1000) + (i * 864_000_00L))); // i=0
67 |
68 | condition = response.getJSONArray("daily").getJSONObject(i).getJSONArray("weather").getJSONObject(0).getInt("id");
69 | sunrise = response.getJSONArray("daily").getJSONObject(i).getLong("sunrise");
70 | sunset = response.getJSONArray("daily").getJSONObject(i).getLong("sunset");
71 |
72 | min = String.format("%.0f", response.getJSONArray("daily").getJSONObject(i).getJSONObject("temp").getDouble("min") - 273.15);
73 | max = String.format("%.0f", response.getJSONArray("daily").getJSONObject(i).getJSONObject("temp").getDouble("max") - 273.15);
74 | pressure = response.getJSONArray("daily").getJSONObject(i).getString("pressure");
75 | wind_speed = response.getJSONArray("daily").getJSONObject(i).getString("wind_speed");
76 | humidity = response.getJSONArray("daily").getJSONObject(i).getString("humidity");
77 |
78 | updateUI(holder);
79 | hideProgressBar(holder);
80 | } catch (JSONException e) {
81 | e.printStackTrace();
82 | }
83 | }, null);
84 | requestQueue.add(jsonObjectRequest);
85 | Log.i("json_req", "Day " + i);
86 | }
87 |
88 | @SuppressLint("SetTextI18n")
89 | private void updateUI(DayViewHolder holder) {
90 | String day = UpdateUI.TranslateDay(updated_at, context);
91 | holder.dTime.setText(day);
92 | holder.temp_min.setText(min + "°C");
93 | holder.temp_max.setText(max + "°C");
94 | holder.pressure.setText(pressure + " mb");
95 | holder.wind.setText(wind_speed + " km/h");
96 | holder.humidity.setText(humidity + "%");
97 | holder.icon.setImageResource(
98 | context.getResources().getIdentifier(
99 | UpdateUI.getIconID(condition, update_time, sunrise, sunset),
100 | "drawable",
101 | context.getPackageName()
102 | ));
103 | }
104 |
105 | private void hideProgressBar(DayViewHolder holder) {
106 | holder.progress.setVisibility(View.GONE);
107 | holder.layout.setVisibility(View.VISIBLE);
108 | }
109 |
110 | static class DayViewHolder extends RecyclerView.ViewHolder {
111 | SpinKitView progress;
112 | RelativeLayout layout;
113 | TextView dTime, temp_min, temp_max, pressure, wind, humidity;
114 | ImageView icon;
115 |
116 | public DayViewHolder(@NonNull View itemView) {
117 | super(itemView);
118 | progress = itemView.findViewById(R.id.day_progress_bar);
119 | layout = itemView.findViewById(R.id.day_relative_layout);
120 | dTime = itemView.findViewById(R.id.day_time);
121 | temp_min = itemView.findViewById(R.id.day_min_temp);
122 | temp_max = itemView.findViewById(R.id.day_max_temp);
123 | pressure = itemView.findViewById(R.id.day_pressure);
124 | wind = itemView.findViewById(R.id.day_wind);
125 | humidity = itemView.findViewById(R.id.day_humidity);
126 | icon = itemView.findViewById(R.id.day_icon);
127 | }
128 | }
129 | }
130 |
--------------------------------------------------------------------------------
/app/src/main/java/com/aniketjain/weatherapp/location/CityFinder.java:
--------------------------------------------------------------------------------
1 | package com.aniketjain.weatherapp.location;
2 |
3 | import android.content.Context;
4 | import android.location.Address;
5 | import android.location.Geocoder;
6 | import android.location.Location;
7 | import android.util.Log;
8 |
9 | import java.util.List;
10 | import java.util.Locale;
11 |
12 | public class CityFinder {
13 |
14 | public static void setLongitudeLatitude(Location location) {
15 | try {
16 | LocationCord.lat = String.valueOf(location.getLatitude());
17 | LocationCord.lon = String.valueOf(location.getLongitude());
18 | Log.d("location_lat", LocationCord.lat);
19 | Log.d("location_lon", LocationCord.lon);
20 | } catch (NullPointerException e) {
21 | e.printStackTrace();
22 | }
23 | }
24 |
25 | public static String getCityNameUsingNetwork(Context context, Location location) {
26 | String city = "";
27 | try {
28 | Geocoder geocoder = new Geocoder(context, Locale.getDefault());
29 | List addresses = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), 1);
30 | city = addresses.get(0).getLocality();
31 | Log.d("city", city);
32 | } catch (Exception e) {
33 | Log.d("city", "Error to find the city.");
34 | }
35 | return city;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/app/src/main/java/com/aniketjain/weatherapp/location/LocationCord.java:
--------------------------------------------------------------------------------
1 | package com.aniketjain.weatherapp.location;
2 |
3 | public class LocationCord {
4 | public static String lat = "";
5 | public static String lon = "";
6 | public final static String API_KEY = "0bc14881636d2234e8c17736a470535f";
7 | // public final static String API_KEY = "eeb8b40367eee691683e5a079e2fa695";
8 | }
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/java/com/aniketjain/weatherapp/network/InternetConnectivity.java:
--------------------------------------------------------------------------------
1 | package com.aniketjain.weatherapp.network;
2 |
3 | import android.content.Context;
4 | import android.net.ConnectivityManager;
5 | import android.net.NetworkInfo;
6 |
7 | public class InternetConnectivity {
8 | public static boolean isInternetConnected(Context context) {
9 | ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
10 | return connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState() == NetworkInfo.State.CONNECTED ||
11 | connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo.State.CONNECTED;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/app/src/main/java/com/aniketjain/weatherapp/toast/Toaster.java:
--------------------------------------------------------------------------------
1 | package com.aniketjain.weatherapp.toast;
2 |
3 | import android.content.Context;
4 |
5 | import com.aniketjain.roastedtoast.Toasty;
6 | import com.aniketjain.weatherapp.R;
7 |
8 | public class Toaster {
9 | public static void successToast(Context context, String msg) {
10 | Toasty.custom(
11 | context,
12 | msg,
13 | R.drawable.ic_baseline_check_24,
14 | "#454B54",
15 | 14,
16 | "#EEEEEE");
17 | }
18 |
19 | public static void errorToast(Context context, String msg) {
20 | Toasty.custom(
21 | context,
22 | msg,
23 | R.drawable.ic_baseline_error_outline_24,
24 | "#454B54",
25 | 14,
26 | "#EEEEEE");
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/java/com/aniketjain/weatherapp/update/UpdateUI.java:
--------------------------------------------------------------------------------
1 | package com.aniketjain.weatherapp.update;
2 |
3 | import android.content.Context;
4 |
5 | import com.aniketjain.weatherapp.R;
6 |
7 | public class UpdateUI {
8 |
9 | public static String getIconID(int condition, long update_time, long sunrise, long sunset) {
10 | if (condition >= 200 && condition <= 232)
11 | return "thunderstorm";
12 | else if (condition >= 300 && condition <= 321)
13 | return "drizzle";
14 | else if (condition >= 500 && condition <= 531)
15 | return "rain";
16 | else if (condition >= 600 && condition <= 622)
17 | return "snow";
18 | else if (condition >= 701 && condition <= 781)
19 | return "wind";
20 | else if (condition == 800) {
21 | if (update_time >= sunrise && update_time <= sunset)
22 | return "clear_day";
23 | else
24 | return "clear_night";
25 | } else if (condition == 801) {
26 | if (update_time >= sunrise && update_time <= sunset)
27 | return "few_clouds_day";
28 | else
29 | return "few_clouds_night";
30 | } else if (condition == 802)
31 | return "scattered_clouds";
32 | else if (condition == 803 || condition == 804)
33 | return "broken_clouds";
34 | return null;
35 | }
36 |
37 | public static String TranslateDay(String dayToBeTranslated, Context context) {
38 | switch (dayToBeTranslated.trim()) {
39 | case "Monday":
40 | return context.getResources().getString(R.string.monday);
41 | case "Tuesday":
42 | return context.getResources().getString(R.string.tuesday);
43 | case "Wednesday":
44 | return context.getResources().getString(R.string.wednesday);
45 | case "Thursday":
46 | return context.getResources().getString(R.string.thursday);
47 | case "Friday":
48 | return context.getResources().getString(R.string.friday);
49 | case "Saturday":
50 | return context.getResources().getString(R.string.saturday);
51 | case "Sunday":
52 | return context.getResources().getString(R.string.sunday);
53 | }
54 | return dayToBeTranslated;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/app/src/main/java/com/aniketjain/weatherapp/url/URL.java:
--------------------------------------------------------------------------------
1 | package com.aniketjain.weatherapp.url;
2 |
3 | import com.aniketjain.weatherapp.location.LocationCord;
4 |
5 | public class URL {
6 | private String link;
7 | private static String city_url;
8 |
9 | public URL() {
10 | link = "https://api.openweathermap.org/data/2.5/onecall?exclude=minutely&lat="
11 | + LocationCord.lat + "&lon=" + LocationCord.lon + "&appid=" + LocationCord.API_KEY;
12 | }
13 |
14 | public String getLink() {
15 | return link;
16 | }
17 |
18 |
19 | public static void setCity_url(String cityName) {
20 | city_url = "https://api.openweathermap.org/data/2.5/weather?&q=" + cityName + "&appid=" + LocationCord.API_KEY;
21 | }
22 |
23 | public static String getCity_url() {
24 | return city_url;
25 | }
26 |
27 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable/broken_clouds.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/drawable/broken_clouds.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/center_block_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/drawable/center_block_bg.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/clear_day.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/drawable/clear_day.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/clear_night.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/drawable/clear_night.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/day_block_bg.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/drawable/day_block_bg.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/drizzle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/drawable/drizzle.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/edittext_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/drawable/edittext_bg.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/few_clouds_day.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/drawable/few_clouds_day.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/few_clouds_night.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/drawable/few_clouds_night.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/humidity_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/drawable/humidity_icon.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_baseline_check_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_baseline_error_outline_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_main_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/res/drawable/max_temp_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/drawable/max_temp_icon.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/min_temp_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/drawable/min_temp_icon.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/nion_mic_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/drawable/nion_mic_icon.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/pressure_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/drawable/pressure_icon.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/rain.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/drawable/rain.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/scattered_clouds.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/drawable/scattered_clouds.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/search_bar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/drawable/search_bar.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/snow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/drawable/snow.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/thunderstorm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/drawable/thunderstorm.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/wind.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/drawable/wind.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/wind_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/drawable/wind_icon.png
--------------------------------------------------------------------------------
/app/src/main/res/font/koho_regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/font/koho_regular.ttf
--------------------------------------------------------------------------------
/app/src/main/res/img.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/img.png
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_home.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
22 |
23 |
31 |
32 |
33 |
45 |
46 |
49 |
50 |
51 |
52 |
59 |
60 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_splash_screen.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/day_item_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
24 |
25 |
30 |
31 |
40 |
41 |
51 |
52 |
53 |
59 |
60 |
71 |
72 |
78 |
79 |
90 |
91 |
92 |
97 |
98 |
104 |
105 |
112 |
113 |
120 |
121 |
128 |
129 |
130 |
136 |
137 |
145 |
146 |
154 |
155 |
163 |
164 |
165 |
166 |
167 |
168 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/main_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
20 |
21 |
28 |
29 |
40 |
41 |
65 |
66 |
75 |
76 |
77 |
78 |
79 |
84 |
85 |
90 |
91 |
100 |
101 |
107 |
108 |
116 |
117 |
129 |
130 |
131 |
132 |
133 |
134 |
139 |
140 |
147 |
148 |
152 |
153 |
164 |
165 |
166 |
167 |
173 |
174 |
178 |
179 |
188 |
189 |
196 |
197 |
202 |
203 |
207 |
208 |
217 |
218 |
219 |
225 |
226 |
230 |
231 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
254 |
255 |
261 |
262 |
266 |
267 |
274 |
275 |
283 |
284 |
285 |
291 |
292 |
296 |
297 |
304 |
305 |
313 |
314 |
315 |
321 |
322 |
326 |
327 |
334 |
335 |
343 |
344 |
345 |
346 |
--------------------------------------------------------------------------------
/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_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_main_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/mipmap-hdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_main.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/mipmap-hdpi/ic_main.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_main_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/mipmap-hdpi/ic_main_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_main_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/mipmap-hdpi/ic_main_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/mipmap-mdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_main.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/mipmap-mdpi/ic_main.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_main_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/mipmap-mdpi/ic_main_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_main_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/mipmap-mdpi/ic_main_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_main.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/mipmap-xhdpi/ic_main.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_main_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/mipmap-xhdpi/ic_main_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_main_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/mipmap-xhdpi/ic_main_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_main.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/mipmap-xxhdpi/ic_main.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_main_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/mipmap-xxhdpi/ic_main_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_main_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/mipmap-xxhdpi/ic_main_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_main.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/mipmap-xxxhdpi/ic_main.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_main_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/mipmap-xxxhdpi/ic_main_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_main_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/app/src/main/res/mipmap-xxxhdpi/ic_main_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values-de/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Wettervorhersage
4 | FEUCHTIGKEIT
5 | WIND
6 | DRUCK
7 | TAG
8 | NAMEN DER STADT EINGEBEN
9 | AKTUALISIERT AM
10 | Montag
11 | Dienstag
12 | Der Mittwoch
13 | Donnerstag
14 | Freitag
15 | Samstag
16 | Sonntag
17 |
--------------------------------------------------------------------------------
/app/src/main/res/values-es/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Pronóstico del tiempo
4 | HUMEDAD
5 | VIENTO
6 | PRESIÓN
7 | DÍA
8 | INGRESE EL NOMBRE DE LA CIUDAD
9 | ACTUALIZADO EN
10 | Lunes
11 | Martes
12 | Miércoles
13 | Jueves
14 | Viernes
15 | Sábado
16 | Domingo
17 |
--------------------------------------------------------------------------------
/app/src/main/res/values-fr/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Prévisions météorologiques
4 | HUMIDITÉ
5 | VENT
6 | PRESSION
7 | JOURNÉE
8 | ENTRER LE NOM DE LA VILLE
9 | MISE À JOUR À
10 | Lundi
11 | Mardi
12 | Mercredi
13 | Jeudi
14 | Vendredi
15 | Samedi
16 | Dimanche
17 |
--------------------------------------------------------------------------------
/app/src/main/res/values-night/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | day
4 | PRESSURE
5 | WIND
6 | HUMIDITY
7 | ENTER CITY NAME
8 | UPDATED AT
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #80f9ff
4 | #00dae6
5 | #00ADB5
6 | #FF03DAC5
7 | #FF018786
8 | #FF000000
9 | #FFFFFFFF
10 |
11 |
12 | #00ADB5
13 | #222831
14 | #454B54
15 | #EEEEEE
16 | #80EEEEEE
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Weather Forecast
3 | mic for search
4 | day
5 | PRESSURE
6 | WIND
7 | HUMIDITY
8 | ENTER CITY NAME
9 | UPDATED AT
10 | Monday
11 | Tuesday
12 | Wednesday
13 | Thursday
14 | Friday
15 | Saturday
16 | Sunday
17 |
--------------------------------------------------------------------------------
/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
--------------------------------------------------------------------------------
/app/src/test/java/com/aniketjain/weatherapp/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.aniketjain.weatherapp;
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() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | plugins {
3 | id 'com.android.application' version '7.4.2' apply false
4 | id 'com.android.library' version '7.4.2' apply false
5 | }
6 |
7 | task clean(type: Delete) {
8 | delete rootProject.buildDir
9 | }
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app"s APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Enables namespacing of each library's R class so that its R class includes only the
19 | # resources declared in the library itself and none from the library's dependencies,
20 | # thereby reducing the size of the R class for that library
21 | android.nonTransitiveRClass=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-aniketj/WeatherApp-Android/d55885929f62a2dafca06e75ac54b0c67618e387/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Jul 08 02:25:06 IST 2023
2 | distributionBase=GRADLE_USER_HOME
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
4 | distributionPath=wrapper/dists
5 | zipStorePath=wrapper/dists
6 | zipStoreBase=GRADLE_USER_HOME
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
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 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
186 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Weather App Android
4 |
5 |
6 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | repositories {
3 | gradlePluginPortal()
4 | google()
5 | mavenCentral()
6 | maven { url "https://jitpack.io" }
7 | }
8 | }
9 | dependencyResolutionManagement {
10 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
11 | repositories {
12 | google()
13 | mavenCentral()
14 | maven { url "https://jitpack.io" }
15 | }
16 | }
17 | rootProject.name = "Weather App"
18 | include ':app'
19 |
--------------------------------------------------------------------------------