-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit 1fb7c1d
Showing
55 changed files
with
1,745 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,8 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea | ||
.DS_Store | ||
/build | ||
/captures | ||
/app/google-services.json |
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,67 @@ | ||
apply plugin: 'com.android.application' | ||
apply plugin: 'com.neenbedankt.android-apt' | ||
apply plugin: 'com.noveogroup.android.check' | ||
|
||
repositories { | ||
maven { url "https://jitpack.io" } | ||
} | ||
|
||
android { | ||
compileSdkVersion 25 | ||
buildToolsVersion "25.0.0" | ||
|
||
defaultConfig { | ||
applicationId "com.udacity.stockhawk" | ||
minSdkVersion 21 | ||
targetSdkVersion 25 | ||
versionCode 1 | ||
versionName "1.0" | ||
multiDexEnabled true | ||
} | ||
|
||
buildTypes { | ||
|
||
release { | ||
minifyEnabled false | ||
shrinkResources false | ||
proguardFile "proguard-butterknife-7.pro" | ||
proguardFile "proguard-google-play-services.pro" | ||
proguardFile "proguard-guava.pro" | ||
proguardFile "proguard-square-okhttp3.pro" | ||
proguardFile "proguard-square-okio.pro" | ||
proguardFile "proguard-support-v7-appcompat.pro" | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
|
||
lintOptions { | ||
warning 'InvalidPackage' | ||
} | ||
} | ||
|
||
check { | ||
checkstyle { config hard() } | ||
findbugs { config hard() } | ||
pmd { | ||
config hard() | ||
skip true | ||
} | ||
} | ||
|
||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
testCompile 'junit:junit:4.12' | ||
compile 'com.android.support:appcompat-v7:25.0.0' | ||
compile 'com.android.support:recyclerview-v7:25.0.0' | ||
compile 'com.android.support:design:25.0.0' | ||
compile 'com.jakewharton:butterknife:8.1.0' | ||
apt 'com.jakewharton:butterknife-compiler:8.1.0' | ||
compile 'com.google.guava:guava:19.0' | ||
compile 'com.squareup.okio:okio:1.8.0' | ||
compile 'com.squareup.okhttp3:okhttp:3.3.1' | ||
compile 'com.yahoofinance-api:YahooFinanceAPI:3.3.0' | ||
compile 'com.jakewharton.timber:timber:4.1.2' | ||
compile 'com.melnykov:floatingactionbutton:1.3.0' | ||
compile 'net.sf.opencsv:opencsv:2.3' | ||
compile 'com.github.PhilJay:MPAndroidChart:v2.2.5' | ||
} |
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,13 @@ | ||
# ButterKnife 7 | ||
|
||
-keep class butterknife.** { *; } | ||
-dontwarn butterknife.internal.** | ||
-keep class **$$ViewBinder { *; } | ||
|
||
-keepclasseswithmembernames class * { | ||
@butterknife.* <fields>; | ||
} | ||
|
||
-keepclasseswithmembernames class * { | ||
@butterknife.* <methods>; | ||
} |
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,19 @@ | ||
## Google Play Services 4.3.23 specific rules ## | ||
## https://developer.android.com/google/play-services/setup.html#Proguard ## | ||
|
||
-keep class * extends java.util.ListResourceBundle { | ||
protected Object[][] getContents(); | ||
} | ||
|
||
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable { | ||
public static final *** NULL; | ||
} | ||
|
||
-keepnames @com.google.android.gms.common.annotation.KeepName class * | ||
-keepclassmembernames class * { | ||
@com.google.android.gms.common.annotation.KeepName *; | ||
} | ||
|
||
-keepnames class * implements android.os.Parcelable { | ||
public static final ** CREATOR; | ||
} |
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 @@ | ||
# Configuration for Guava 18.0 | ||
# | ||
# disagrees with instructions provided by Guava project: https://code.google.com/p/guava-libraries/wiki/UsingProGuardWithGuava | ||
|
||
-keep class com.google.common.io.Resources { | ||
public static <methods>; | ||
} | ||
-keep class com.google.common.collect.Lists { | ||
public static ** reverse(**); | ||
} | ||
-keep class com.google.common.base.Charsets { | ||
public static <fields>; | ||
} | ||
|
||
-keep class com.google.common.base.Joiner { | ||
public static com.google.common.base.Joiner on(java.lang.String); | ||
public ** join(...); | ||
} | ||
|
||
-keep class com.google.common.collect.MapMakerInternalMap$ReferenceEntry | ||
-keep class com.google.common.cache.LocalCache$ReferenceEntry | ||
|
||
# http://stackoverflow.com/questions/9120338/proguard-configuration-for-guava-with-obfuscation-and-optimization | ||
-dontwarn javax.annotation.** | ||
-dontwarn javax.inject.** | ||
-dontwarn sun.misc.Unsafe | ||
|
||
# Guava 19.0 | ||
-dontwarn java.lang.ClassValue | ||
-dontwarn com.google.j2objc.annotations.Weak | ||
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement |
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 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in /Users/silver/Library/Android/sdk/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the proguardFiles | ||
# directive in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# 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 *; | ||
#} | ||
|
||
|
||
-assumenosideeffects class java.util.logging.Logger { | ||
public *** log(...); | ||
} | ||
|
||
-keep class com.github.mikephil.charting.** { *; } | ||
|
||
-dontwarn io.realm.** |
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,6 @@ | ||
# OkHttp | ||
-keepattributes Signature | ||
-keepattributes *Annotation* | ||
-keep class okhttp3.** { *; } | ||
-keep interface okhttp3.** { *; } | ||
-dontwarn okhttp3.** |
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,5 @@ | ||
# Okio | ||
-keep class sun.misc.Unsafe { *; } | ||
-dontwarn java.nio.file.* | ||
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement | ||
-dontwarn okio.** |
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,7 @@ | ||
-keep public class android.support.v7.widget.** { *; } | ||
-keep public class android.support.v7.internal.widget.** { *; } | ||
-keep public class android.support.v7.internal.view.menu.** { *; } | ||
|
||
-keep public class * extends android.support.v4.view.ActionProvider { | ||
public <init>(android.content.Context); | ||
} |
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,41 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
package="com.udacity.stockhawk"> | ||
|
||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<uses-permission android:name="android.Manifest.permission.RECEIVE_BOOT_COMPLETED" /> | ||
|
||
<application | ||
android:name=".StockHawkApp" | ||
android:allowBackup="false" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:theme="@style/AppTheme" | ||
tools:ignore="GoogleAppIndexingWarning"> | ||
<activity android:name=".ui.MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
<service | ||
android:name=".sync.QuoteIntentService" | ||
android:exported="false" /> | ||
|
||
<provider | ||
android:name=".data.StockProvider" | ||
android:authorities="com.udacity.stockhawk" | ||
android:exported="false" /> | ||
|
||
<service | ||
android:name=".sync.QuoteJobService" | ||
android:enabled="true" | ||
android:exported="true" | ||
android:permission="android.permission.BIND_JOB_SERVICE" /> | ||
</application> | ||
|
||
</manifest> |
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,18 @@ | ||
package com.udacity.stockhawk; | ||
|
||
import android.app.Application; | ||
|
||
import timber.log.Timber; | ||
|
||
public class StockHawkApp extends Application { | ||
|
||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
|
||
if (BuildConfig.DEBUG) { | ||
Timber.uprootAll(); | ||
Timber.plant(new Timber.DebugTree()); | ||
} | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
app/src/main/java/com/udacity/stockhawk/data/Contract.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,56 @@ | ||
package com.udacity.stockhawk.data; | ||
|
||
|
||
import android.net.Uri; | ||
import android.provider.BaseColumns; | ||
|
||
public class Contract { | ||
|
||
public static final String AUTHORITY = "com.udacity.stockhawk"; | ||
|
||
public static final Uri BASE_URI = Uri.parse("content://" + AUTHORITY); | ||
|
||
public static final String PATH_QUOTE = "quote"; | ||
public static final String PATH_QUOTE_WITH_SYMBOL = "quote/*"; | ||
|
||
public static final class Quote implements BaseColumns { | ||
|
||
public static final Uri uri = BASE_URI.buildUpon().appendPath(PATH_QUOTE).build(); | ||
|
||
public static final String TABLE_NAME = "quotes"; | ||
|
||
public static final String COLUMN_SYMBOL = "symbol"; | ||
public static final String COLUMN_PRICE = "price"; | ||
public static final String COLUMN_ABSOLUTE_CHANGE = "absolute_change"; | ||
public static final String COLUMN_PERCENTAGE_CHANGE = "percentage_change"; | ||
public static final String COLUMN_HISTORY = "history"; | ||
|
||
|
||
public static final int POSITION_ID = 0; | ||
public static final int POSITION_SYMBOL = 1; | ||
public static final int POSITION_PRICE = 2; | ||
public static final int POSITION_ABSOLUTE_CHANGE = 3; | ||
public static final int POSITION_PERCENTAGE_CHANGE = 4; | ||
public static final int POSITION_HISTORY = 5; | ||
|
||
public static final String[] QUOTE_COLUMNS = { | ||
_ID, | ||
COLUMN_SYMBOL, | ||
COLUMN_PRICE, | ||
COLUMN_ABSOLUTE_CHANGE, | ||
COLUMN_PERCENTAGE_CHANGE, | ||
COLUMN_HISTORY | ||
}; | ||
|
||
public static Uri makeUriForStock(String symbol) { | ||
return uri.buildUpon().appendPath(symbol).build(); | ||
} | ||
|
||
public static String getStockFromUri(Uri uri) { | ||
return uri.getLastPathSegment(); | ||
} | ||
|
||
|
||
} | ||
|
||
} |
43 changes: 43 additions & 0 deletions
43
app/src/main/java/com/udacity/stockhawk/data/DbHelper.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,43 @@ | ||
package com.udacity.stockhawk.data; | ||
|
||
import android.content.Context; | ||
import android.database.sqlite.SQLiteDatabase; | ||
import android.database.sqlite.SQLiteOpenHelper; | ||
|
||
import com.udacity.stockhawk.data.Contract.Quote; | ||
|
||
|
||
public class DbHelper extends SQLiteOpenHelper { | ||
|
||
|
||
static final String NAME = "StockHawk.db"; | ||
private static final int VERSION = 1; | ||
|
||
|
||
public DbHelper(Context context) { | ||
super(context, NAME, null, VERSION); | ||
} | ||
|
||
@Override | ||
public void onCreate(SQLiteDatabase db) { | ||
String builder = "CREATE TABLE " + Quote.TABLE_NAME + " (" + | ||
Quote._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + | ||
Quote.COLUMN_SYMBOL + " TEXT NOT NULL, " + | ||
Quote.COLUMN_PRICE + " REAL NOT NULL, " + | ||
Quote.COLUMN_ABSOLUTE_CHANGE + " REAL NOT NULL, " + | ||
Quote.COLUMN_PERCENTAGE_CHANGE + " REAL NOT NULL, " + | ||
Quote.COLUMN_HISTORY + " TEXT NOT NULL, " + | ||
"UNIQUE (" + Quote.COLUMN_SYMBOL + ") ON CONFLICT REPLACE);"; | ||
|
||
db.execSQL(builder); | ||
|
||
} | ||
|
||
@Override | ||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { | ||
|
||
db.execSQL(" DROP TABLE IF EXISTS " + Quote.TABLE_NAME); | ||
|
||
onCreate(db); | ||
} | ||
} |
Oops, something went wrong.