-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,9 @@ | ||
# Built application files | ||
*.apk | ||
*.ap_ | ||
|
||
# Files for the ART/Dalvik VM | ||
*.dex | ||
|
||
# Java class files | ||
*.class | ||
|
||
# Generated files | ||
bin/ | ||
gen/ | ||
out/ | ||
|
||
# Gradle files | ||
.gradle/ | ||
build/ | ||
|
||
# Local configuration file (sdk path, etc) | ||
local.properties | ||
|
||
# Proguard folder generated by Eclipse | ||
proguard/ | ||
|
||
# Log Files | ||
*.log | ||
|
||
# Android Studio Navigation editor temp files | ||
.navigation/ | ||
|
||
# Android Studio captures folder | ||
captures/ | ||
|
||
# Intellij | ||
*.iml | ||
.idea/workspace.xml | ||
|
||
# Keystore files | ||
*.jks | ||
*.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.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 24 | ||
buildToolsVersion "25.0.0" | ||
defaultConfig { | ||
applicationId "com.example.daniel.butterbot" | ||
minSdkVersion 21 | ||
targetSdkVersion 24 | ||
versionCode 1 | ||
versionName "1.0" | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
sourceSets { | ||
main { | ||
assets.srcDirs = ['src/main/assets', 'src/main/assets/'] | ||
res.srcDirs = ['src/main/res', 'src/main/res/anim'] | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { | ||
exclude group: 'com.android.support', module: 'support-annotations' | ||
}) | ||
compile 'com.android.support:appcompat-v7:24.2.1' | ||
compile 'com.android.support:support-v4:24.2.1' | ||
compile 'com.wang.avi:library:2.1.3' | ||
compile 'com.github.romainguy:ViewServer:017c01cd512cac3ec054d9eee05fc48c5a9d2de' | ||
testCompile 'junit:junit:4.12' | ||
compile 'com.google.android.gms:play-services-appindexing:8.4.0' | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in C:\Users\Daniel\AppData\Local\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 *; | ||
#} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.example.daniel.butterbot; | ||
|
||
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.*; | ||
|
||
/** | ||
* Instrumentation 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.daniel.butterbot", appContext.getPackageName()); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.example.daniel.butterbot"> | ||
|
||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | ||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> | ||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<uses-permission android:name="android.permission.VIBRATE"/> | ||
<uses-feature android:name="android.hardware.sensor.accelerometer" android:required="true" /> | ||
<uses-feature android:name="android.hardware.sensor.magnetic_field" android:required="true" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/bb_launcher" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity | ||
android:name=".SplashActivity" | ||
android:screenOrientation="portrait" | ||
android:configChanges="orientation|keyboardHidden|screenSize" | ||
android:label="@string/app_name" | ||
android:theme="@style/Theme.AppCompat.NoActionBar"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity><!-- ATTENTION: This was auto-generated to add Google Play services to your project for | ||
App Indexing. See https://g.co/AppIndexing/AndroidStudio for more information. --> | ||
<meta-data | ||
android:name="com.google.android.gms.version" | ||
android:value="@integer/google_play_services_version" /> | ||
</application> | ||
|
||
</manifest> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package android.widget; | ||
|
||
import android.content.Context; | ||
import android.graphics.Canvas; | ||
import android.os.Vibrator; | ||
import android.support.v4.content.ContextCompat; | ||
import android.util.AttributeSet; | ||
import android.view.MotionEvent; | ||
|
||
import com.example.daniel.butterbot.R; | ||
import com.example.daniel.butterbot.SplashActivity; | ||
|
||
import static android.content.Context.VIBRATOR_SERVICE; | ||
|
||
public class VerticalSeekBar extends SeekBar { | ||
private Context context; | ||
private Vibrator vib; | ||
public VerticalSeekBar(Context context) { | ||
super(context); | ||
this.context = context; | ||
vib = (Vibrator)context.getSystemService(VIBRATOR_SERVICE); | ||
|
||
} | ||
|
||
public VerticalSeekBar(Context context, AttributeSet attrs, int defStyle) { | ||
super(context, attrs, defStyle); | ||
this.context = context; | ||
vib = (Vibrator)context.getSystemService(VIBRATOR_SERVICE); | ||
|
||
} | ||
|
||
public VerticalSeekBar(Context context, AttributeSet attrs) { | ||
super(context, attrs); | ||
this.context = context; | ||
vib = (Vibrator)context.getSystemService(VIBRATOR_SERVICE); | ||
} | ||
|
||
protected void onSizeChanged(int w, int h, int oldw, int oldh) { | ||
super.onSizeChanged(h, w, oldh, oldw); | ||
} | ||
|
||
@Override | ||
protected synchronized void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { | ||
super.onMeasure(heightMeasureSpec, widthMeasureSpec); | ||
setMeasuredDimension(getMeasuredHeight(), getMeasuredWidth()); | ||
} | ||
|
||
protected void onDraw(Canvas c) { | ||
c.rotate(-90); | ||
c.translate(-getHeight(), 0); | ||
|
||
super.onDraw(c); | ||
} | ||
|
||
@Override | ||
public boolean onTouchEvent(MotionEvent event) { | ||
if (!isEnabled()) { | ||
return false; | ||
} | ||
switch (event.getAction()) { | ||
case MotionEvent.ACTION_DOWN: | ||
vib.vibrate(20); | ||
|
||
setThumb(ContextCompat.getDrawable(context, R.drawable.thumb_down)); | ||
setProgress(getMax() - (int) (getMax() * event.getY() / getHeight())); | ||
onSizeChanged(getWidth(), getHeight(), 0, 0); | ||
break; | ||
|
||
case MotionEvent.ACTION_MOVE: | ||
setProgress(getMax() - (int) (getMax() * event.getY() / getHeight())); | ||
onSizeChanged(getWidth(), getHeight(), 0, 0); | ||
break; | ||
case MotionEvent.ACTION_UP: | ||
setThumb(ContextCompat.getDrawable(context, R.drawable.thumb_up)); | ||
setProgress(getMax() - (int) (getMax() * event.getY() / getHeight())); | ||
onSizeChanged(getWidth(), getHeight(), 0, 0); | ||
break; | ||
|
||
case MotionEvent.ACTION_CANCEL: | ||
break; | ||
} | ||
return true; | ||
} | ||
} |