diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..39fb081 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures +.externalNativeBuild diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..7ac24c7 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ba7052b --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..0f26d76 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..478a742 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,31 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 26 + defaultConfig { + applicationId "com.example.rhenigan.stormy" + minSdkVersion 25 + targetSdkVersion 26 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'com.android.support:appcompat-v7:26.1.0' + implementation 'com.android.support.constraint:constraint-layout:1.0.2' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'com.android.support.test:runner:1.0.1' + androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' + compile 'com.squareup.okhttp3:okhttp:3.10.0' + compile 'com.jakewharton:butterknife:8.8.1' + annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1' +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/app/src/androidTest/java/com/example/rhenigan/stormy/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/example/rhenigan/stormy/ExampleInstrumentedTest.java new file mode 100644 index 0000000..908d7a8 --- /dev/null +++ b/app/src/androidTest/java/com/example/rhenigan/stormy/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.example.rhenigan.stormy; + +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.support.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() throws Exception { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("com.example.rhenigan.stormy", appContext.getPackageName()); + } +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..a6cbd3e --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/example/rhenigan/stormy/AlertDialogFragment.java b/app/src/main/java/com/example/rhenigan/stormy/AlertDialogFragment.java new file mode 100644 index 0000000..3c3ccae --- /dev/null +++ b/app/src/main/java/com/example/rhenigan/stormy/AlertDialogFragment.java @@ -0,0 +1,24 @@ +package com.example.rhenigan.stormy; + +import android.app.AlertDialog; +import android.app.Dialog; +import android.app.DialogFragment; +import android.content.Context; +import android.os.Bundle; + +/** + * Created by henig on 4/4/2018. + * ------------------------------ + */ + +public class AlertDialogFragment extends DialogFragment { + + @Override + public Dialog onCreateDialog(Bundle savedInstanceState) { + Context context = getActivity(); + AlertDialog.Builder builder = new AlertDialog.Builder(context); + builder.setTitle(context.getString(R.string.error_title)).setMessage(context.getString(R.string.error_message)).setPositiveButton(context.getString(R.string.error_button), null); + AlertDialog dialog = builder.create(); + return dialog; + } +} diff --git a/app/src/main/java/com/example/rhenigan/stormy/CurrentWeather.java b/app/src/main/java/com/example/rhenigan/stormy/CurrentWeather.java new file mode 100644 index 0000000..d88dab8 --- /dev/null +++ b/app/src/main/java/com/example/rhenigan/stormy/CurrentWeather.java @@ -0,0 +1,123 @@ +package com.example.rhenigan.stormy; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.TimeZone; + +/** + * Created by henig on 4/4/2018. + * ------------------------------ + */ + +public class CurrentWeather { + private String mIcon; + private Long mTime; + private double mTemp; + private double mHum; + private double mPrecip; + private String mSummary; + private String mTimeZone; + + public String getIcon() { + return mIcon; + } + + public void setIcon(String icon) { + mIcon = icon; + } + + public Long getTime() { + return mTime; + } + + public int getIconId() { + int iconId = R.drawable.clear_day; + + if (mIcon.equals("clear-day")) { + iconId = R.drawable.clear_day; + } + else if (mIcon.equals("clear-night")) { + iconId = R.drawable.clear_night; + } + else if (mIcon.equals("rain")) { + iconId = R.drawable.rain; + } + else if (mIcon.equals("snow")) { + iconId = R.drawable.snow; + } + else if (mIcon.equals("sleet")) { + iconId = R.drawable.sleet; + } + else if (mIcon.equals("wind")) { + iconId = R.drawable.wind; + } + else if (mIcon.equals("fog")) { + iconId = R.drawable.fog; + } + else if (mIcon.equals("cloudy")) { + iconId = R.drawable.cloudy; + } + else if (mIcon.equals("partly-cloudy-day")) { + iconId = R.drawable.partly_cloudy; + } + else if (mIcon.equals("partly-cloudy-night")) { + iconId = R.drawable.cloudy_night; + } + + return iconId; + } + + public void setTime(Long time) { + mTime = time; + } + + public int getTemp() { + return (int) Math.round(mTemp); + } + + public void setTemp(double temp) { + mTemp = temp; + } + + public double getHum() { + return mHum; + } + + public void setHum(double hum) { + mHum = hum; + } + + public int getPrecip() { + double precipPercent = 100*mPrecip; + return (int) Math.round(precipPercent); + } + + public void setPrecip(double precip) { + mPrecip = precip; + } + + public String getSummary() { + return mSummary; + } + + public void setSummary(String summary) { + mSummary = summary; + } + + public String getFormattedTime() { + SimpleDateFormat formatter = new SimpleDateFormat("h:mm a"); + formatter.setTimeZone(TimeZone.getTimeZone(mTimeZone)); + Date dateTime = new Date(getTime() * 1000); + String timeString = formatter.format(dateTime); + + return timeString; + } + + public String getTimeZone() { + return mTimeZone; + } + + public void setTimeZone(String timeZone) { + mTimeZone = timeZone; + } +} diff --git a/app/src/main/java/com/example/rhenigan/stormy/MainActivity.java b/app/src/main/java/com/example/rhenigan/stormy/MainActivity.java new file mode 100644 index 0000000..115ba35 --- /dev/null +++ b/app/src/main/java/com/example/rhenigan/stormy/MainActivity.java @@ -0,0 +1,183 @@ +package com.example.rhenigan.stormy; + +import android.content.Context; +import android.graphics.drawable.Drawable; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.util.Log; +import android.view.View; +import android.widget.ImageView; +import android.widget.ProgressBar; +import android.widget.TextView; +import android.widget.Toast; + +import org.json.JSONException; +import org.json.JSONObject; + +import java.io.IOException; + +import butterknife.BindView; +import butterknife.ButterKnife; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; + +public class MainActivity extends AppCompatActivity { + + public static final String TAG = "MAIN ACTIVITY"; + + private CurrentWeather mCurrentWeather; + + @BindView(R.id.timeLabel) TextView mTimeLabel; + @BindView(R.id.temperatureLabel) TextView mTemperatureLabel; + @BindView(R.id.humidityValue) TextView mHumidityValue; + @BindView(R.id.precipValue) TextView mPrecipValue; + @BindView(R.id.summaryLabel) TextView mSummaryLabel; + @BindView(R.id.iconImageView) ImageView mIconImageView; + @BindView(R.id.refreshImageView) ImageView mRefreshImageView; + @BindView(R.id.progressBar) ProgressBar mProgressBar; + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + ButterKnife.bind(this); + + mProgressBar.setVisibility(View.INVISIBLE); + + final double latitude = 37.8267; + final double longitude = -122.4233; + + mRefreshImageView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + getForecast(latitude, longitude); + } + }); + + getForecast(latitude, longitude); + + Log.d(TAG, "Main UI Code is running!"); + } + + private void getForecast(double latitude, double longitude) { + String apiKey = getString(R.string.apiKey); + String forecastURL = "https://api.darksky.net/forecast/" + apiKey + "/" + latitude + "," + longitude; + + if (isNetworkAvailable()) { + + toggleRefresh(); + + OkHttpClient client = new OkHttpClient(); + Request request = new Request.Builder().url(forecastURL).build(); + Call call = client.newCall(request); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + Log.e(TAG, "Exception Caught", e); + runOnUiThread(new Runnable() { + @Override + public void run() { + toggleRefresh(); + } + }); + alertUserAboutError(); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + runOnUiThread(new Runnable() { + @Override + public void run() { + toggleRefresh(); + } + }); + try { + String jsonData = response.body().string(); + if (response.isSuccessful()) { + mCurrentWeather = getCurrentDetails(jsonData); + runOnUiThread(new Runnable() { + @Override + public void run() { + updateDisplay(); + } + }); + } else { + alertUserAboutError(); + } + } catch (IOException e) { + Log.e(TAG, "Exception Caught", e); + } catch (JSONException e) { + Log.e(TAG, "Exception Caught", e); + } + + } + }); + } else { + Toast.makeText(this, R.string.network_unavailable_message, Toast.LENGTH_LONG).show(); + } + } + + private void toggleRefresh() { + if(mProgressBar.getVisibility() == View.INVISIBLE) { + mProgressBar.setVisibility(View.VISIBLE); + mRefreshImageView.setVisibility(View.INVISIBLE); + } else { + mProgressBar.setVisibility(View.INVISIBLE); + mRefreshImageView.setVisibility(View.VISIBLE); + } + + } + + private void updateDisplay() { + mTemperatureLabel.setText(mCurrentWeather.getTemp() + ""); + mTimeLabel.setText("At " + mCurrentWeather.getFormattedTime() + " it will be"); + mHumidityValue.setText(mCurrentWeather.getHum() + ""); + mPrecipValue.setText(mCurrentWeather.getPrecip() + "%"); + mSummaryLabel.setText(mCurrentWeather.getSummary() + ""); + Drawable drawable = getResources().getDrawable(mCurrentWeather.getIconId()); + mIconImageView.setImageDrawable(drawable); + } + + private CurrentWeather getCurrentDetails(String jsonData) throws JSONException { + JSONObject forecast = new JSONObject(jsonData); + String timezone = forecast.getString("timezone"); + Log.i(TAG, "From Json: " + timezone); + + JSONObject currently = forecast.getJSONObject("currently"); + + CurrentWeather currentWeather = new CurrentWeather(); + currentWeather.setHum(currently.getDouble("humidity")); + currentWeather.setTime(currently.getLong("time")); + currentWeather.setIcon(currently.getString("icon")); + currentWeather.setPrecip(currently.getDouble("precipProbability")); + currentWeather.setSummary(currently.getString("summary")); + currentWeather.setTemp(currently.getDouble("temperature")); + currentWeather.setTimeZone(timezone); + + Log.d(TAG, currentWeather.getFormattedTime()); + + return currentWeather; + } + + private boolean isNetworkAvailable() { + ConnectivityManager manager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); + NetworkInfo networkInfo = manager.getActiveNetworkInfo(); + boolean isAvailable = false; + if (networkInfo != null && networkInfo.isConnected()) { + isAvailable = true; + } + return isAvailable; + } + + private void alertUserAboutError() { + AlertDialogFragment dialog = new AlertDialogFragment(); + dialog.show(getFragmentManager(), "error_dialog"); + } +} diff --git a/app/src/main/res/drawable-hdpi/clear_day.png b/app/src/main/res/drawable-hdpi/clear_day.png new file mode 100644 index 0000000..30b865b Binary files /dev/null and b/app/src/main/res/drawable-hdpi/clear_day.png differ diff --git a/app/src/main/res/drawable-hdpi/clear_night.png b/app/src/main/res/drawable-hdpi/clear_night.png new file mode 100644 index 0000000..4a9b6a7 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/clear_night.png differ diff --git a/app/src/main/res/drawable-hdpi/cloudy.png b/app/src/main/res/drawable-hdpi/cloudy.png new file mode 100644 index 0000000..7316da4 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/cloudy.png differ diff --git a/app/src/main/res/drawable-hdpi/cloudy_night.png b/app/src/main/res/drawable-hdpi/cloudy_night.png new file mode 100644 index 0000000..76dce36 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/cloudy_night.png differ diff --git a/app/src/main/res/drawable-hdpi/degree.png b/app/src/main/res/drawable-hdpi/degree.png new file mode 100644 index 0000000..d1d9d5a Binary files /dev/null and b/app/src/main/res/drawable-hdpi/degree.png differ diff --git a/app/src/main/res/drawable-hdpi/fog.png b/app/src/main/res/drawable-hdpi/fog.png new file mode 100644 index 0000000..40dc052 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/fog.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_launcher.png b/app/src/main/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000..b857f9d Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/drawable-hdpi/partly_cloudy.png b/app/src/main/res/drawable-hdpi/partly_cloudy.png new file mode 100644 index 0000000..7f13ec7 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/partly_cloudy.png differ diff --git a/app/src/main/res/drawable-hdpi/rain.png b/app/src/main/res/drawable-hdpi/rain.png new file mode 100644 index 0000000..f74cc82 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/rain.png differ diff --git a/app/src/main/res/drawable-hdpi/refresh.png b/app/src/main/res/drawable-hdpi/refresh.png new file mode 100644 index 0000000..6544328 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/refresh.png differ diff --git a/app/src/main/res/drawable-hdpi/sleet.png b/app/src/main/res/drawable-hdpi/sleet.png new file mode 100644 index 0000000..4f29014 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/sleet.png differ diff --git a/app/src/main/res/drawable-hdpi/snow.png b/app/src/main/res/drawable-hdpi/snow.png new file mode 100644 index 0000000..90c2f0e Binary files /dev/null and b/app/src/main/res/drawable-hdpi/snow.png differ diff --git a/app/src/main/res/drawable-hdpi/sunny.png b/app/src/main/res/drawable-hdpi/sunny.png new file mode 100644 index 0000000..9cb6e00 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/sunny.png differ diff --git a/app/src/main/res/drawable-hdpi/wind.png b/app/src/main/res/drawable-hdpi/wind.png new file mode 100644 index 0000000..a852e23 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/wind.png differ diff --git a/app/src/main/res/drawable-mdpi/clear_day.png b/app/src/main/res/drawable-mdpi/clear_day.png new file mode 100644 index 0000000..89be5f1 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/clear_day.png differ diff --git a/app/src/main/res/drawable-mdpi/clear_night.png b/app/src/main/res/drawable-mdpi/clear_night.png new file mode 100644 index 0000000..1e9228d Binary files /dev/null and b/app/src/main/res/drawable-mdpi/clear_night.png differ diff --git a/app/src/main/res/drawable-mdpi/cloudy.png b/app/src/main/res/drawable-mdpi/cloudy.png new file mode 100644 index 0000000..d5853e2 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/cloudy.png differ diff --git a/app/src/main/res/drawable-mdpi/cloudy_night.png b/app/src/main/res/drawable-mdpi/cloudy_night.png new file mode 100644 index 0000000..8459772 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/cloudy_night.png differ diff --git a/app/src/main/res/drawable-mdpi/degree.png b/app/src/main/res/drawable-mdpi/degree.png new file mode 100644 index 0000000..d1d9d5a Binary files /dev/null and b/app/src/main/res/drawable-mdpi/degree.png differ diff --git a/app/src/main/res/drawable-mdpi/fog.png b/app/src/main/res/drawable-mdpi/fog.png new file mode 100644 index 0000000..f4ed98d Binary files /dev/null and b/app/src/main/res/drawable-mdpi/fog.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_launcher.png b/app/src/main/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000..ffa883a Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/drawable-mdpi/partly_cloudy.png b/app/src/main/res/drawable-mdpi/partly_cloudy.png new file mode 100644 index 0000000..92f1923 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/partly_cloudy.png differ diff --git a/app/src/main/res/drawable-mdpi/rain.png b/app/src/main/res/drawable-mdpi/rain.png new file mode 100644 index 0000000..95a3bdd Binary files /dev/null and b/app/src/main/res/drawable-mdpi/rain.png differ diff --git a/app/src/main/res/drawable-mdpi/refresh.png b/app/src/main/res/drawable-mdpi/refresh.png new file mode 100644 index 0000000..9e017c6 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/refresh.png differ diff --git a/app/src/main/res/drawable-mdpi/sleet.png b/app/src/main/res/drawable-mdpi/sleet.png new file mode 100644 index 0000000..773d800 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/sleet.png differ diff --git a/app/src/main/res/drawable-mdpi/snow.png b/app/src/main/res/drawable-mdpi/snow.png new file mode 100644 index 0000000..be347dd Binary files /dev/null and b/app/src/main/res/drawable-mdpi/snow.png differ diff --git a/app/src/main/res/drawable-mdpi/sunny.png b/app/src/main/res/drawable-mdpi/sunny.png new file mode 100644 index 0000000..5f5a86a Binary files /dev/null and b/app/src/main/res/drawable-mdpi/sunny.png differ diff --git a/app/src/main/res/drawable-mdpi/wind.png b/app/src/main/res/drawable-mdpi/wind.png new file mode 100644 index 0000000..f178129 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/wind.png differ diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..c7bd21d --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/app/src/main/res/drawable-xhdpi/clear_day.png b/app/src/main/res/drawable-xhdpi/clear_day.png new file mode 100644 index 0000000..8908f0a Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/clear_day.png differ diff --git a/app/src/main/res/drawable-xhdpi/clear_night.png b/app/src/main/res/drawable-xhdpi/clear_night.png new file mode 100644 index 0000000..e387408 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/clear_night.png differ diff --git a/app/src/main/res/drawable-xhdpi/cloudy.png b/app/src/main/res/drawable-xhdpi/cloudy.png new file mode 100644 index 0000000..472ac5c Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/cloudy.png differ diff --git a/app/src/main/res/drawable-xhdpi/cloudy_night.png b/app/src/main/res/drawable-xhdpi/cloudy_night.png new file mode 100644 index 0000000..4223df8 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/cloudy_night.png differ diff --git a/app/src/main/res/drawable-xhdpi/degree.png b/app/src/main/res/drawable-xhdpi/degree.png new file mode 100644 index 0000000..e439c55 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/degree.png differ diff --git a/app/src/main/res/drawable-xhdpi/fog.png b/app/src/main/res/drawable-xhdpi/fog.png new file mode 100644 index 0000000..c5fe7eb Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/fog.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_launcher.png b/app/src/main/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000..23f01b1 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/drawable-xhdpi/partly_cloudy.png b/app/src/main/res/drawable-xhdpi/partly_cloudy.png new file mode 100644 index 0000000..8fdb5d3 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/partly_cloudy.png differ diff --git a/app/src/main/res/drawable-xhdpi/rain.png b/app/src/main/res/drawable-xhdpi/rain.png new file mode 100644 index 0000000..6626261 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/rain.png differ diff --git a/app/src/main/res/drawable-xhdpi/refresh.png b/app/src/main/res/drawable-xhdpi/refresh.png new file mode 100644 index 0000000..220de16 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/refresh.png differ diff --git a/app/src/main/res/drawable-xhdpi/sleet.png b/app/src/main/res/drawable-xhdpi/sleet.png new file mode 100644 index 0000000..438eec5 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/sleet.png differ diff --git a/app/src/main/res/drawable-xhdpi/snow.png b/app/src/main/res/drawable-xhdpi/snow.png new file mode 100644 index 0000000..f318e19 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/snow.png differ diff --git a/app/src/main/res/drawable-xhdpi/sunny.png b/app/src/main/res/drawable-xhdpi/sunny.png new file mode 100644 index 0000000..83b28b1 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/sunny.png differ diff --git a/app/src/main/res/drawable-xhdpi/wind.png b/app/src/main/res/drawable-xhdpi/wind.png new file mode 100644 index 0000000..a6bcb35 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/wind.png differ diff --git a/app/src/main/res/drawable-xxhdpi/clear_day.png b/app/src/main/res/drawable-xxhdpi/clear_day.png new file mode 100644 index 0000000..a7c03dd Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/clear_day.png differ diff --git a/app/src/main/res/drawable-xxhdpi/clear_night.png b/app/src/main/res/drawable-xxhdpi/clear_night.png new file mode 100644 index 0000000..a340101 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/clear_night.png differ diff --git a/app/src/main/res/drawable-xxhdpi/cloudy.png b/app/src/main/res/drawable-xxhdpi/cloudy.png new file mode 100644 index 0000000..13bdbad Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/cloudy.png differ diff --git a/app/src/main/res/drawable-xxhdpi/cloudy_night.png b/app/src/main/res/drawable-xxhdpi/cloudy_night.png new file mode 100644 index 0000000..ac1ae3d Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/cloudy_night.png differ diff --git a/app/src/main/res/drawable-xxhdpi/degree.png b/app/src/main/res/drawable-xxhdpi/degree.png new file mode 100644 index 0000000..f239559 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/degree.png differ diff --git a/app/src/main/res/drawable-xxhdpi/fog.png b/app/src/main/res/drawable-xxhdpi/fog.png new file mode 100644 index 0000000..3e7510a Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/fog.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/app/src/main/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..3e105a9 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/drawable-xxhdpi/partly_cloudy.png b/app/src/main/res/drawable-xxhdpi/partly_cloudy.png new file mode 100644 index 0000000..172dd63 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/partly_cloudy.png differ diff --git a/app/src/main/res/drawable-xxhdpi/rain.png b/app/src/main/res/drawable-xxhdpi/rain.png new file mode 100644 index 0000000..296fa53 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/rain.png differ diff --git a/app/src/main/res/drawable-xxhdpi/refresh.png b/app/src/main/res/drawable-xxhdpi/refresh.png new file mode 100644 index 0000000..68f41c9 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/refresh.png differ diff --git a/app/src/main/res/drawable-xxhdpi/sleet.png b/app/src/main/res/drawable-xxhdpi/sleet.png new file mode 100644 index 0000000..e6bad74 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/sleet.png differ diff --git a/app/src/main/res/drawable-xxhdpi/snow.png b/app/src/main/res/drawable-xxhdpi/snow.png new file mode 100644 index 0000000..c4f6fd7 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/snow.png differ diff --git a/app/src/main/res/drawable-xxhdpi/sunny.png b/app/src/main/res/drawable-xxhdpi/sunny.png new file mode 100644 index 0000000..066ccf8 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/sunny.png differ diff --git a/app/src/main/res/drawable-xxhdpi/wind.png b/app/src/main/res/drawable-xxhdpi/wind.png new file mode 100644 index 0000000..c7f7491 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/wind.png differ diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..d5fccc5 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..1df9905 --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..a2f5908 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..1b52399 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..ff10afd Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..115a4c7 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..dcd3cd8 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..459ca60 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..8ca12fe Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..8e19b41 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..b824ebd Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..4c19a13 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..3ab3e9c --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,6 @@ + + + #3F51B5 + #303F9F + #FF4081 + diff --git a/app/src/main/res/values/dimen.xml b/app/src/main/res/values/dimen.xml new file mode 100644 index 0000000..b8f75f5 --- /dev/null +++ b/app/src/main/res/values/dimen.xml @@ -0,0 +1,5 @@ + + + 32dp + 16dp + diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..0eb88fe --- /dev/null +++ b/app/src/main/res/values/styles.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/app/src/test/java/com/example/rhenigan/stormy/ExampleUnitTest.java b/app/src/test/java/com/example/rhenigan/stormy/ExampleUnitTest.java new file mode 100644 index 0000000..9d78a67 --- /dev/null +++ b/app/src/test/java/com/example/rhenigan/stormy/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.example.rhenigan.stormy; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() throws Exception { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..e6b32bc --- /dev/null +++ b/build.gradle @@ -0,0 +1,27 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + + repositories { + google() + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:3.0.1' + + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + google() + jcenter() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..aac7c9b --- /dev/null +++ b/gradle.properties @@ -0,0 +1,17 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx1536m + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..13372ae Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..bb7206d --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Apr 04 19:07:40 EDT 2018 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..9d82f78 --- /dev/null +++ b/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..8a0b282 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..e7b4def --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +include ':app'