-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Robert Henigan
committed
Apr 5, 2018
0 parents
commit e9fd75b
Showing
95 changed files
with
1,219 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/workspace.xml | ||
/.idea/libraries | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
26 changes: 26 additions & 0 deletions
26
app/src/androidTest/java/com/example/rhenigan/stormy/ExampleInstrumentedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
*/ | ||
@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()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.example.rhenigan.stormy"> | ||
|
||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
<uses-permission android:name="android.permission.INTERNET"/> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity android:name=".MainActivity" | ||
android:screenOrientation="portrait"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
24 changes: 24 additions & 0 deletions
24
app/src/main/java/com/example/rhenigan/stormy/AlertDialogFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
123 changes: 123 additions & 0 deletions
123
app/src/main/java/com/example/rhenigan/stormy/CurrentWeather.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
Oops, something went wrong.