- Add location capabilities, using Google Play Services.

- Shift to using GlowPadBackport maven library
This commit is contained in:
Timothy Allen 2014-04-13 22:27:21 +02:00
parent ad051bc1c2
commit a0c2f37b07
48 changed files with 142 additions and 4516 deletions

View File

@ -0,0 +1,10 @@
<component name="libraryTable">
<library name="glowpadbackport-2.1.0">
<CLASSES>
<root url="file://$PROJECT_DIR$/HypoAlarm/build/exploded-aar/net.frakbot.glowpadbackport/glowpadbackport/2.1.0/res" />
<root url="jar://$PROJECT_DIR$/HypoAlarm/build/exploded-aar/net.frakbot.glowpadbackport/glowpadbackport/2.1.0/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

10
.idea/libraries/play_services_4_3_23.xml generated Normal file
View File

@ -0,0 +1,10 @@
<component name="libraryTable">
<library name="play-services-4.3.23">
<CLASSES>
<root url="file://$PROJECT_DIR$/HypoAlarm/build/exploded-aar/com.google.android.gms/play-services/4.3.23/res" />
<root url="jar://$PROJECT_DIR$/HypoAlarm/build/exploded-aar/com.google.android.gms/play-services/4.3.23/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

View File

@ -1 +0,0 @@
/build

View File

@ -6,72 +6,14 @@
<option name="GRADLE_PROJECT_PATH" value=":GlowPadBackport" /> <option name="GRADLE_PROJECT_PATH" value=":GlowPadBackport" />
</configuration> </configuration>
</facet> </facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugJava" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
<option name="LIBRARY_PROJECT" value="true" />
</configuration>
</facet>
</component> </component>
<component name="NewModuleRootManager" inherit-compiler-output="false"> <component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/classes/debug" /> <output url="file://$MODULE_DIR$/build/classes/main" />
<output-test url="file://$MODULE_DIR$/build/classes/test" />
<exclude-output /> <exclude-output />
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$" />
<sourceFolder url="file://$MODULE_DIR$/build/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/source/r/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/aidl/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/buildConfig/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/rs/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/res/rs/test/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/apk" />
<excludeFolder url="file://$MODULE_DIR$/build/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/libs" />
<excludeFolder url="file://$MODULE_DIR$/build/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/res" />
<excludeFolder url="file://$MODULE_DIR$/build/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 19 Platform" jdkType="Android SDK" /> <orderEntry type="jdk" jdkName="Android API 19 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="library-2.4.0" level="project" />
</component> </component>
</module> </module>

View File

@ -1,23 +0,0 @@
apply plugin: 'android-library'
android {
compileSdkVersion 19
buildToolsVersion "19.0.1"
defaultConfig {
minSdkVersion 8
targetSdkVersion 16
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.nineoldandroids:library:2.4.0'
}

View File

@ -1,17 +0,0 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /home/tim/sources/android-studio/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# 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 *;
#}

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.sebastianopoggi.ui.GlowPadBackport" >
<application />
</manifest>

View File

@ -1,134 +0,0 @@
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.sebastianopoggi.ui.GlowPadBackport;
import net.sebastianopoggi.ui.GlowPadBackport.util.TimeInterpolator;
class Ease {
private static final float DOMAIN = 1.0f;
private static final float DURATION = 1.0f;
private static final float START = 0.0f;
static class Linear {
public static final TimeInterpolator easeNone = new TimeInterpolator() {
public float getInterpolation(float input) {
return input;
}
};
}
static class Cubic {
public static final TimeInterpolator easeIn = new TimeInterpolator() {
public float getInterpolation(float input) {
return DOMAIN * (input /= DURATION) * input * input + START;
}
};
public static final TimeInterpolator easeOut = new TimeInterpolator() {
public float getInterpolation(float input) {
return DOMAIN * ((input = input / DURATION - 1) * input * input + 1) + START;
}
};
public static final TimeInterpolator easeInOut = new TimeInterpolator() {
public float getInterpolation(float input) {
return ((input /= DURATION / 2) < 1.0f) ?
(DOMAIN / 2 * input * input * input + START)
: (DOMAIN / 2 * ((input -= 2) * input * input + 2) + START);
}
};
}
static class Quad {
public static final TimeInterpolator easeIn = new TimeInterpolator() {
public float getInterpolation(float input) {
return DOMAIN * (input /= DURATION) * input + START;
}
};
public static final TimeInterpolator easeOut = new TimeInterpolator() {
public float getInterpolation(float input) {
return -DOMAIN * (input /= DURATION) * (input - 2) + START;
}
};
public static final TimeInterpolator easeInOut = new TimeInterpolator() {
public float getInterpolation(float input) {
return ((input /= DURATION / 2) < 1) ?
(DOMAIN / 2 * input * input + START)
: (-DOMAIN / 2 * ((--input) * (input - 2) - 1) + START);
}
};
}
static class Quart {
public static final TimeInterpolator easeIn = new TimeInterpolator() {
public float getInterpolation(float input) {
return DOMAIN * (input /= DURATION) * input * input * input + START;
}
};
public static final TimeInterpolator easeOut = new TimeInterpolator() {
public float getInterpolation(float input) {
return -DOMAIN * ((input = input / DURATION - 1) * input * input * input - 1) + START;
}
};
public static final TimeInterpolator easeInOut = new TimeInterpolator() {
public float getInterpolation(float input) {
return ((input /= DURATION / 2) < 1) ?
(DOMAIN / 2 * input * input * input * input + START)
:
(-DOMAIN / 2 * ((input -= 2) * input * input * input - 2) + START);
}
};
}
static class Quint {
public static final TimeInterpolator easeIn = new TimeInterpolator() {
public float getInterpolation(float input) {
return DOMAIN * (input /= DURATION) * input * input * input * input + START;
}
};
public static final TimeInterpolator easeOut = new TimeInterpolator() {
public float getInterpolation(float input) {
return DOMAIN * ((input = input / DURATION - 1) * input * input * input * input + 1) + START;
}
};
public static final TimeInterpolator easeInOut = new TimeInterpolator() {
public float getInterpolation(float input) {
return ((input /= DURATION / 2) < 1) ?
(DOMAIN / 2 * input * input * input * input * input + START)
:
(DOMAIN / 2 * ((input -= 2) * input * input * input * input + 2) + START);
}
};
}
static class Sine {
public static final TimeInterpolator easeIn = new TimeInterpolator() {
public float getInterpolation(float input) {
return -DOMAIN * (float) Math.cos(input / DURATION * (Math.PI / 2)) + DOMAIN + START;
}
};
public static final TimeInterpolator easeOut = new TimeInterpolator() {
public float getInterpolation(float input) {
return DOMAIN * (float) Math.sin(input / DURATION * (Math.PI / 2)) + START;
}
};
public static final TimeInterpolator easeInOut = new TimeInterpolator() {
public float getInterpolation(float input) {
return -DOMAIN / 2 * ((float) Math.cos(Math.PI * input / DURATION) - 1.0f) + START;
}
};
}
}

View File

@ -1,247 +0,0 @@
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.sebastianopoggi.ui.GlowPadBackport;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.util.FloatMath;
import android.util.Log;
import java.util.ArrayList;
public class PointCloud {
private static final float MIN_POINT_SIZE = 2.0f;
private static final float MAX_POINT_SIZE = 4.0f;
private static int INNER_POINTS = 8;
private static final String TAG = "PointCloud";
private ArrayList<Point> mPointCloud = new ArrayList<Point>();
private Drawable mDrawable;
private float mCenterX;
private float mCenterY;
private Paint mPaint;
private float mScale = 1.0f;
private static final float PI = (float) Math.PI;
// These allow us to have multiple concurrent animations.
WaveManager waveManager = new WaveManager();
GlowManager glowManager = new GlowManager();
private float mOuterRadius, mInnerRadius;
public class WaveManager {
private float radius = 50;
private float width = 200.0f; // TODO: Make configurable
private float alpha = 0.0f;
public void setRadius(float r) {
radius = r;
}
public float getRadius() {
return radius;
}
public void setAlpha(float a) {
alpha = a;
}
public float getAlpha() {
return alpha;
}
}
public class GlowManager {
private float x;
private float y;
private float radius = 0.0f;
private float alpha = 0.0f;
public void setX(float x1) {
x = x1;
}
public float getX() {
return x;
}
public void setY(float y1) {
y = y1;
}
public float getY() {
return y;
}
public void setAlpha(float a) {
alpha = a;
}
public float getAlpha() {
return alpha;
}
public void setRadius(float r) {
radius = r;
}
public float getRadius() {
return radius;
}
}
class Point {
float x;
float y;
float radius;
public Point(float x2, float y2, float r) {
x = x2;
y = y2;
radius = r;
}
}
public PointCloud(Drawable drawable) {
mPaint = new Paint();
mPaint.setFilterBitmap(true);
mPaint.setColor(Color.rgb(255, 255, 255)); // TODO: make configurable
mPaint.setAntiAlias(true);
mPaint.setDither(true);
mDrawable = drawable;
if (mDrawable != null) {
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
}
}
/*package*/ void setPointsMultiplier(int mult) {
INNER_POINTS = mult;
makePointCloud(mInnerRadius, mOuterRadius);
}
/*package*/ int getPointsMultiplier() {
return INNER_POINTS;
}
public void setCenter(float x, float y) {
mCenterX = x;
mCenterY = y;
}
public void makePointCloud(float innerRadius, float outerRadius) {
if (innerRadius == 0) {
Log.w(TAG, "Must specify an inner radius");
return;
}
mOuterRadius = outerRadius;
mInnerRadius = innerRadius;
mPointCloud.clear();
final float pointAreaRadius = (outerRadius - innerRadius);
final float ds = (2.0f * PI * innerRadius / INNER_POINTS);
final int bands = Math.round(pointAreaRadius / ds);
final float dr = pointAreaRadius / bands;
float r = innerRadius;
for (int b = 0; b <= bands; b++, r += dr) {
float circumference = 2.0f * PI * r;
final int pointsInBand = (int) (circumference / ds);
float eta = PI / 2.0f;
float dEta = 2.0f * PI / pointsInBand;
for (int i = 0; i < pointsInBand; i++) {
float x = r * FloatMath.cos(eta);
float y = r * FloatMath.sin(eta);
eta += dEta;
mPointCloud.add(new Point(x, y, r));
}
}
}
public void setScale(float scale) {
mScale = scale;
}
public float getScale() {
return mScale;
}
private static float hypot(float x, float y) {
return FloatMath.sqrt(x * x + y * y);
}
private static float max(float a, float b) {
return a > b ? a : b;
}
public int getAlphaForPoint(Point point) {
// Contribution from positional glow
float glowDistance = hypot(glowManager.x - point.x, glowManager.y - point.y);
float glowAlpha = 0.0f;
if (glowDistance < glowManager.radius) {
float cosf = FloatMath.cos(PI * 0.25f * glowDistance / glowManager.radius);
glowAlpha = glowManager.alpha * max(0.0f, (float) Math.pow(cosf, 10.0f));
}
// Compute contribution from Wave
float radius = hypot(point.x, point.y);
float distanceToWaveRing = (radius - waveManager.radius);
float waveAlpha = 0.0f;
if (distanceToWaveRing < waveManager.width * 0.5f && distanceToWaveRing < 0.0f) {
float cosf = FloatMath.cos(PI * 0.25f * distanceToWaveRing / waveManager.width);
waveAlpha = waveManager.alpha * max(0.0f, (float) Math.pow(cosf, 20.0f));
}
return (int) (max(glowAlpha, waveAlpha) * 255);
}
private float interp(float min, float max, float f) {
return min + (max - min) * f;
}
public void draw(Canvas canvas) {
ArrayList<Point> points = mPointCloud;
canvas.save(Canvas.MATRIX_SAVE_FLAG);
canvas.scale(mScale, mScale, mCenterX, mCenterY);
for (int i = 0; i < points.size(); i++) {
Point point = points.get(i);
final float pointSize = interp(MAX_POINT_SIZE, MIN_POINT_SIZE,
point.radius / mOuterRadius);
final float px = point.x + mCenterX;
final float py = point.y + mCenterY;
int alpha = getAlphaForPoint(point);
if (alpha == 0) continue;
if (mDrawable != null) {
canvas.save(Canvas.MATRIX_SAVE_FLAG);
final float cx = mDrawable.getIntrinsicWidth() * 0.5f;
final float cy = mDrawable.getIntrinsicHeight() * 0.5f;
final float s = pointSize / MAX_POINT_SIZE;
canvas.scale(s, s, px, py);
canvas.translate(px - cx, py - cy);
mDrawable.setAlpha(alpha);
mDrawable.draw(canvas);
canvas.restore();
}
else {
mPaint.setAlpha(alpha);
canvas.drawCircle(px, py, pointSize, mPaint);
}
}
canvas.restore();
}
}

View File

@ -1,341 +0,0 @@
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.sebastianopoggi.ui.GlowPadBackport;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import android.util.Log;
import java.lang.reflect.Method;
public class TargetDrawable {
private static final String TAG = "TargetDrawable";
private static final boolean DEBUG = false;
public static final int[] STATE_ACTIVE =
{android.R.attr.state_enabled, android.R.attr.state_active};
public static final int[] STATE_INACTIVE =
{android.R.attr.state_enabled, -android.R.attr.state_active};
public static final int[] STATE_FOCUSED =
{android.R.attr.state_enabled, -android.R.attr.state_active,
android.R.attr.state_focused};
// We're using Reflection to access these private APIs on older Android versions
static Method mGetStateDrawableIndex, mGetStateCount, mGetStateDrawable;
static {
// In this static block we initialize all reflected methods (so that we can work around
// the @hide annotations for those Android Framework methods). This is not ideal, but
// there's not much we can do about that either.
try {
mGetStateCount = StateListDrawable.class.getDeclaredMethod("getStateCount");
mGetStateCount.setAccessible(true);
}
catch (NoSuchMethodException e) {
Log.e(TAG, "Couldn't access the StateListDrawable#getStateCount() method. " +
"Some stuff might break!", e);
}
try {
mGetStateDrawable = StateListDrawable.class.getDeclaredMethod("getStateDrawable", int.class);
mGetStateDrawable.setAccessible(true);
}
catch (NoSuchMethodException e) {
Log.e(TAG, "Couldn't access the StateListDrawable#getStateDrawable(int) method. " +
"Some stuff might break!", e);
}
try {
mGetStateDrawableIndex = StateListDrawable.class.getDeclaredMethod("getStateDrawableIndex", int[].class);
mGetStateDrawableIndex.setAccessible(true);
}
catch (NoSuchMethodException e) {
Log.e(TAG, "Couldn't access the StateListDrawable#mGetStateDrawableIndex(int[]) method. " +
"Some stuff might break!", e);
}
}
private float mTranslationX = 0.0f;
private float mTranslationY = 0.0f;
private float mPositionX = 0.0f;
private float mPositionY = 0.0f;
private float mScaleX = 1.0f;
private float mScaleY = 1.0f;
private float mAlpha = 1.0f;
private Drawable mDrawable;
private boolean mEnabled = true;
private final int mResourceId;
/* package */ static class DrawableWithAlpha extends Drawable {
private float mAlpha = 1.0f;
private Drawable mRealDrawable;
public DrawableWithAlpha(Drawable realDrawable) {
mRealDrawable = realDrawable;
}
public void setAlphaFloat(float alpha) {
mAlpha = alpha;
}
public int getAlphaFloat() {
return (int) (mAlpha * 255);
}
public void draw(Canvas canvas) {
mRealDrawable.setAlpha(Math.round(mAlpha * 255f));
mRealDrawable.draw(canvas);
}
@Override
public void setAlpha(int alpha) {
mRealDrawable.setAlpha(alpha);
}
@Override
public int getAlpha() {
return mRealDrawable.getAlpha();
}
@Override
public void setColorFilter(ColorFilter cf) {
mRealDrawable.setColorFilter(cf);
}
@Override
public int getOpacity() {
return mRealDrawable.getOpacity();
}
}
public TargetDrawable(Resources res, int resId) {
mResourceId = resId;
setDrawable(res, resId);
}
public void setDrawable(Resources res, int resId) {
// Note we explicitly don't set mResourceId to resId since we allow the drawable to be
// swapped at runtime and want to re-use the existing resource id for identification.
Drawable drawable = resId == 0 ? null : res.getDrawable(resId);
// Mutate the drawable so we can animate shared drawable properties.
mDrawable = drawable != null ? drawable.mutate() : null;
resizeDrawables();
setState(STATE_INACTIVE);
}
public TargetDrawable(TargetDrawable other) {
mResourceId = other.mResourceId;
// Mutate the drawable so we can animate shared drawable properties.
mDrawable = other.mDrawable != null ? other.mDrawable.mutate() : null;
resizeDrawables();
setState(STATE_INACTIVE);
}
public void setState(int[] state) {
if (mDrawable instanceof StateListDrawable) {
StateListDrawable d = (StateListDrawable) mDrawable;
d.setState(state);
}
}
public boolean hasState(int[] state) {
if (mDrawable instanceof StateListDrawable) {
StateListDrawable d = (StateListDrawable) mDrawable;
// TODO: this doesn't seem to work
try {
return (Integer) mGetStateDrawableIndex.invoke(d, state) != -1;
}
catch (Exception e) {
Log.w(TAG, "StateListDrawable#getStateDrawableIndex(int[]) call failed!", e);
}
}
return false;
}
/**
* Returns true if the drawable is a StateListDrawable and is in the focused state.
*
* @return Returns true if the drawable is a StateListDrawable and is in the focused state
*/
public boolean isActive() {
if (mDrawable instanceof StateListDrawable) {
StateListDrawable d = (StateListDrawable) mDrawable;
int[] states = d.getState();
for (int i = 0; i < states.length; i++) {
if (states[i] == android.R.attr.state_focused) {
return true;
}
}
}
return false;
}
/**
* Returns true if this target is enabled. Typically an enabled target contains a valid
* drawable in a valid state. Currently all targets with valid drawables are valid.
*
* @return Returns true if the target is enabled, false otherwise
*/
public boolean isEnabled() {
return mDrawable != null && mEnabled;
}
/**
* Makes drawables in a StateListDrawable all the same dimensions.
* If not a StateListDrawable, then justs sets the bounds to the intrinsic size of the
* drawable.
*/
private void resizeDrawables() {
if (mDrawable instanceof StateListDrawable) {
StateListDrawable d = (StateListDrawable) mDrawable;
int maxWidth = 0;
int maxHeight = 0;
Integer stateCount = 0;
try {
stateCount = (Integer) mGetStateCount.invoke(d);
}
catch (Exception e) {
Log.w(TAG, "StateListDrawable#getStateCount() call failed!", e);
}
for (int i = 0; i < stateCount; i++) {
Drawable childDrawable;
try {
childDrawable = (Drawable) mGetStateDrawable.invoke(d, i);
}
catch (Exception e) {
Log.w(TAG, "StateListDrawable#getStateDrawable(int) call failed!", e);
continue;
}
maxWidth = Math.max(maxWidth, childDrawable.getIntrinsicWidth());
maxHeight = Math.max(maxHeight, childDrawable.getIntrinsicHeight());
}
if (DEBUG) {
Log.v(TAG, "union of childDrawable rects " + d + " to: "
+ maxWidth + "x" + maxHeight);
}
d.setBounds(0, 0, maxWidth, maxHeight);
for (int i = 0; i < stateCount; i++) {
Drawable childDrawable;
try {
childDrawable = (Drawable) mGetStateDrawable.invoke(d, i);
}
catch (Exception e) {
Log.w(TAG, "StateListDrawable#getStateDrawable(int) call failed!", e);
continue;
}
if (DEBUG) {
Log.v(TAG, "sizing drawable " + childDrawable + " to: "
+ maxWidth + "x" + maxHeight);
}
childDrawable.setBounds(0, 0, maxWidth, maxHeight);
}
}
else if (mDrawable != null) {
mDrawable.setBounds(0, 0,
mDrawable.getIntrinsicWidth(), mDrawable.getIntrinsicHeight());
}
}
public void setX(float x) {
mTranslationX = x;
}
public void setY(float y) {
mTranslationY = y;
}
public void setScaleX(float x) {
mScaleX = x;
}
public void setScaleY(float y) {
mScaleY = y;
}
public void setAlpha(float alpha) {
mAlpha = alpha;
}
public float getX() {
return mTranslationX;
}
public float getY() {
return mTranslationY;
}
public float getScaleX() {
return mScaleX;
}
public float getScaleY() {
return mScaleY;
}
public float getAlpha() {
return mAlpha;
}
public void setPositionX(float x) {
mPositionX = x;
}
public void setPositionY(float y) {
mPositionY = y;
}
public float getPositionX() {
return mPositionX;
}
public float getPositionY() {
return mPositionY;
}
public int getWidth() {
return mDrawable != null ? mDrawable.getIntrinsicWidth() : 0;
}
public int getHeight() {
return mDrawable != null ? mDrawable.getIntrinsicHeight() : 0;
}
public void draw(Canvas canvas) {
if (mDrawable == null || !mEnabled) {
return;
}
canvas.save(Canvas.MATRIX_SAVE_FLAG);
canvas.scale(mScaleX, mScaleY, mPositionX, mPositionY);
canvas.translate(mTranslationX + mPositionX, mTranslationY + mPositionY);
canvas.translate(-0.5f * getWidth(), -0.5f * getHeight());
mDrawable.setAlpha(Math.round(mAlpha * 255f));
mDrawable.draw(canvas);
canvas.restore();
}
public void setEnabled(boolean enabled) {
mEnabled = enabled;
}
public int getResourceId() {
return mResourceId;
}
}

View File

@ -1,190 +0,0 @@
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.sebastianopoggi.ui.GlowPadBackport;
import android.util.Log;
import com.nineoldandroids.animation.Animator;
import com.nineoldandroids.animation.Animator.AnimatorListener;
import com.nineoldandroids.animation.AnimatorListenerAdapter;
import com.nineoldandroids.animation.ObjectAnimator;
import com.nineoldandroids.animation.PropertyValuesHolder;
import com.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener;
import net.sebastianopoggi.ui.GlowPadBackport.util.TimeInterpolator;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
class Tweener {
private static final String TAG = "Tweener";
private static final boolean DEBUG = false;
ObjectAnimator animator;
private static HashMap<Object, Tweener> sTweens = new HashMap<Object, Tweener>();
public Tweener(ObjectAnimator anim) {
animator = anim;
}
private static void remove(Animator animator) {
Iterator<Entry<Object, Tweener>> iter = sTweens.entrySet().iterator();
while (iter.hasNext()) {
Entry<Object, Tweener> entry = iter.next();
if (entry.getValue().animator == animator) {
if (DEBUG) {
Log.v(TAG, "Removing tweener " + sTweens.get(entry.getKey())
+ " sTweens.size() = " + sTweens.size());
}
iter.remove();
break; // an animator can only be attached to one object
}
}
}
public static Tweener to(Object object, long duration, Object... vars) {
long delay = 0;
AnimatorUpdateListener updateListener = null;
AnimatorListener listener = null;
TimeInterpolator interpolator = null;
// Iterate through arguments and discover properties to animate
ArrayList<PropertyValuesHolder> props = new ArrayList<PropertyValuesHolder>(vars.length / 2);
for (int i = 0; i < vars.length; i += 2) {
if (!(vars[i] instanceof String)) {
throw new IllegalArgumentException("Key must be a string: " + vars[i]);
}
String key = (String) vars[i];
Object value = vars[i + 1];
if ("simultaneousTween".equals(key)) {
// TODO
}
else if ("ease".equals(key)) {
interpolator = (TimeInterpolator) value; // TODO: multiple interpolators?
}
else if ("onUpdate".equals(key) || "onUpdateListener".equals(key)) {
updateListener = (AnimatorUpdateListener) value;
}
else if ("onComplete".equals(key) || "onCompleteListener".equals(key)) {
listener = (AnimatorListener) value;
}
else if ("delay".equals(key)) {
delay = ((Number) value).longValue();
}
else if ("syncWith".equals(key)) {
// TODO
}
else if (value instanceof float[]) {
props.add(PropertyValuesHolder.ofFloat(key,
((float[]) value)[0], ((float[]) value)[1]));
}
else if (value instanceof int[]) {
props.add(PropertyValuesHolder.ofInt(key,
((int[]) value)[0], ((int[]) value)[1]));
}
else if (value instanceof Number) {
float floatValue = ((Number) value).floatValue();
props.add(PropertyValuesHolder.ofFloat(key, floatValue));
}
else {
throw new IllegalArgumentException(
"Bad argument for key \"" + key + "\" with value " + value.getClass());
}
}
// Re-use existing tween, if present
Tweener tween = sTweens.get(object);
ObjectAnimator anim;
if (tween == null) {
anim = ObjectAnimator.ofPropertyValuesHolder(object,
props.toArray(new PropertyValuesHolder[props.size()]));
tween = new Tweener(anim);
sTweens.put(object, tween);
if (DEBUG) Log.v(TAG, "Added new Tweener " + tween);
}
else {
anim = sTweens.get(object).animator;
replace(props, object); // Cancel all animators for given object
}
if (interpolator != null) {
anim.setInterpolator(interpolator);
}
// Update animation with properties discovered in loop above
anim.setStartDelay(delay);
anim.setDuration(duration);
if (updateListener != null) {
anim.removeAllUpdateListeners(); // There should be only one
anim.addUpdateListener(updateListener);
}
if (listener != null) {
anim.removeAllListeners(); // There should be only one.
anim.addListener(listener);
}
anim.addListener(mCleanupListener);
return tween;
}
Tweener from(Object object, long duration, Object... vars) {
// TODO: for v of vars
// toVars[v] = object[v]
// object[v] = vars[v]
return Tweener.to(object, duration, vars);
}
// Listener to watch for completed animations and remove them.
private static AnimatorListener mCleanupListener = new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
remove(animation);
}
@Override
public void onAnimationCancel(Animator animation) {
remove(animation);
}
};
public static void reset() {
if (DEBUG) {
Log.v(TAG, "Reset()");
if (sTweens.size() > 0) {
Log.v(TAG, "Cleaning up " + sTweens.size() + " animations");
}
}
sTweens.clear();
}
private static void replace(ArrayList<PropertyValuesHolder> props, Object... args) {
for (final Object killobject : args) {
Tweener tween = sTweens.get(killobject);
if (tween != null) {
tween.animator.cancel();
if (props != null) {
tween.animator.setValues(
props.toArray(new PropertyValuesHolder[props.size()]));
}
else {
sTweens.remove(tween);
}
}
}
}
}

View File

@ -1,22 +0,0 @@
package net.sebastianopoggi.ui.GlowPadBackport.util;
import android.os.Build;
/**
* Class
* <p/>
* Author: Sebastiano Poggi
* Created on: 1/28/13 Time: 3:57 PM
* File version: 1.0
* <p/>
* Changelog:
* Version 1.0
* * Initial revision
*/
public class Const {
public static final boolean IS_ECLAIR = Build.VERSION.SDK_INT >= Build.VERSION_CODES.ECLAIR;
public static final boolean IS_FROYO = Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO;
public static final boolean IS_ICS = Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH;
public static final boolean IS_JB = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
public static final boolean IS_JB_MR1 = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1;
}

View File

@ -1,40 +0,0 @@
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.sebastianopoggi.ui.GlowPadBackport.util;
import android.view.animation.Interpolator;
/**
* A time interpolator defines the rate of change of an animation. This allows animations
* to have non-linear motion, such as acceleration and deceleration.
*/
public interface TimeInterpolator extends Interpolator {
/**
* Maps a value representing the elapsed fraction of an animation to a value that represents
* the interpolated fraction. This interpolated value is then multiplied by the change in
* value of an animation to derive the animated value at the current elapsed animation time.
*
* @param input A value between 0 and 1.0 indicating our current point
* in the animation where 0 represents the start and 1.0 represents
* the end
* @return The interpolation value. This value can be more than 1.0 for
* interpolators which overshoot their targets, or less than 0 for
* interpolators that undershoot their targets.
*/
float getInterpolation(float input);
}

View File

@ -1,100 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="LinearLayout">
<attr name="gravity" />
</declare-styleable>
<!-- =============================== -->
<!-- GlowPadView class attributes -->
<!-- =============================== -->
<eat-comment />
<declare-styleable name="GlowPadView">
<!-- Reference to an array resource that be shown as targets around a circle. -->
<attr name="targetDrawables" format="reference"/>
<!-- Reference to an array resource that be used as description for the targets around the circle. -->
<attr name="targetDescriptions" format="reference"/>
<!-- Reference to an array resource that be used to announce the directions with targets around the circle. -->
<attr name="directionDescriptions" format="reference"/>
<!-- Sets a drawable as the center. -->
<attr name="handleDrawable" format="reference"/>
<!-- Drawable to use for wave ripple animation. -->
<attr name="outerRingDrawable" format="reference"/>
<!-- Drawble used for drawing points -->
<attr name="pointDrawable" format="reference" />
<!-- Inner radius of glow area. -->
<attr name="innerRadius" format="dimension"/>
<!-- Outer radius of glow area. Target icons will be drawn on this circle. -->
<attr name="outerRadius" format="dimension"/>
<!-- Radius of glow under finger. -->
<attr name="glowRadius" format="dimension" />
<!-- Tactile feedback duration for actions. Set to '0' for no vibration. -->
<attr name="vibrationDuration" format="integer"/>
<!-- How close we need to be before snapping to a target. -->
<attr name="snapMargin" format="dimension"/>
<!-- Number of waves/chevrons to show in animation. -->
<attr name="feedbackCount" format="integer"/>
<!-- Used when the handle shouldn't wait to be hit before following the finger -->
<attr name="alwaysTrackFinger" format="boolean"/>
<!-- Location along the circle of the first item, in degrees.-->
<attr name="firstItemOffset" format="float" />
<!-- Causes targets to snap to the finger location on activation. -->
<attr name="magneticTargets" format="boolean" />
<attr name="gravity"/>
<!-- Determine whether the glow pad is allowed to scale to fit the bounds indicated
by its parent. If this is set to false, no scaling will occur. If this is set to true
scaling will occur to fit for any axis in which gravity is set to center. -->
<attr name="allowScaling" format="boolean" />
</declare-styleable>
<!-- Specifies how to place the content of an object, both
on the x and y axis, within the object itself. -->
<attr name="gravity">
<!-- Push object to the top of its container, not changing its size. -->
<flag name="top" value="0x30" />
<!-- Push object to the bottom of its container, not changing its size. -->
<flag name="bottom" value="0x50" />
<!-- Push object to the left of its container, not changing its size. -->
<flag name="left" value="0x03" />
<!-- Push object to the right of its container, not changing its size. -->
<flag name="right" value="0x05" />
<!-- Place object in the vertical center of its container, not changing its size. -->
<flag name="center_vertical" value="0x10" />
<!-- Grow the vertical size of the object if needed so it completely fills its container. -->
<flag name="fill_vertical" value="0x70" />
<!-- Place object in the horizontal center of its container, not changing its size. -->
<flag name="center_horizontal" value="0x01" />
<!-- Grow the horizontal size of the object if needed so it completely fills its container. -->
<flag name="fill_horizontal" value="0x07" />
<!-- Place the object in the center of its container in both the vertical and horizontal axis, not changing its size. -->
<flag name="center" value="0x11" />
<!-- Grow the horizontal and vertical size of the object if needed so it completely fills its container. -->
<flag name="fill" value="0x77" />
<!-- Additional option that can be set to have the top and/or bottom edges of
the child clipped to its container's bounds.
The clip will be based on the vertical gravity: a top gravity will clip the bottom
edge, a bottom gravity will clip the top edge, and neither will clip both edges. -->
<flag name="clip_vertical" value="0x80" />
<!-- Additional option that can be set to have the left and/or right edges of
the child clipped to its container's bounds.
The clip will be based on the horizontal gravity: a left gravity will clip the right
edge, a right gravity will clip the left edge, and neither will clip both edges. -->
<flag name="clip_horizontal" value="0x08" />
</attr>
</resources>

View File

@ -71,10 +71,10 @@
<orderEntry type="jdk" jdkName="Android API 19 Platform" jdkType="Android SDK" /> <orderEntry type="jdk" jdkName="Android API 19 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="appcompat-v7-19.0.1" level="project" /> <orderEntry type="library" exported="" name="appcompat-v7-19.0.1" level="project" />
<orderEntry type="library" exported="" name="play-services-4.3.23" level="project" />
<orderEntry type="library" exported="" name="glowpadbackport-2.1.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-19.0.1" level="project" /> <orderEntry type="library" exported="" name="support-v4-19.0.1" level="project" />
<orderEntry type="library" exported="" name="library-2.4.0" level="project" /> <orderEntry type="library" exported="" name="library-2.4.0" level="project" />
<orderEntry type="module" module-name="SeekArc" exported="" />
<orderEntry type="module" module-name="GlowPadBackport" exported="" />
</component> </component>
</module> </module>

View File

@ -25,8 +25,16 @@ repositories {
dependencies { dependencies {
compile 'com.android.support:support-v4:19.0.1' compile 'com.android.support:support-v4:19.0.1'
compile 'com.android.support:appcompat-v7:19.0.1' compile 'com.android.support:appcompat-v7:19.0.1'
compile fileTree(dir: 'libs', include: ['*.aar'])
compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.google.android.gms:play-services:+'
compile project(':GlowPadBackport') //compile 'com.google.android.gms:play-services:4.2.42'
compile project(':SeekArc')
compile 'net.frakbot.glowpadbackport:glowpadbackport:+'
//compile 'net.frakbot.glowpadbackport:glowpadbackport:2.1.0'
//compile project(':GlowPadBackport')
//compile project(':SeekArc')
//compile fileTree(dir: 'libs', include: ['*.aar'])
//compile fileTree(dir: 'libs', include: ['*.jar'])
} }

View File

@ -8,56 +8,59 @@
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/AppTheme" > android:theme="@style/AppTheme" >
<activity <activity
android:name=".MainActivity" android:name="za.org.treehouse.hypoalarm.MainActivity"
android:label="@string/app_name" > android:label="@string/app_name" >
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
android:name=".AlarmAlertActivity" android:name="za.org.treehouse.hypoalarm.AlarmAlertActivity"
android:label="@string/alarm_alert" android:label="@string/alarm_alert"
android:launchMode="singleInstance" android:launchMode="singleInstance"
android:noHistory="true"> android:noHistory="true" >
</activity> </activity>
<receiver android:name=".PreAlarmReceiver"/>
<receiver android:name=".CancelAlarmReceiver"/>
<receiver android:name=".AlarmReceiver"/>
<receiver android:name=".GraceReceiver"/>
<receiver android:name=".CancelGraceReceiver"/>
<receiver android:name=".BootReceiver" <receiver android:name="za.org.treehouse.hypoalarm.PreAlarmReceiver" />
<receiver android:name="za.org.treehouse.hypoalarm.CancelAlarmReceiver" />
<receiver android:name="za.org.treehouse.hypoalarm.AlarmReceiver" />
<receiver android:name="za.org.treehouse.hypoalarm.GraceReceiver" />
<receiver android:name="za.org.treehouse.hypoalarm.CancelGraceReceiver" />
<receiver
android:name="za.org.treehouse.hypoalarm.BootReceiver"
android:enabled="false" > android:enabled="false" >
<intent-filter> <intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/> <action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter> </intent-filter>
</receiver> </receiver>
<service <service
android:name=".AlarmNotify" android:name="za.org.treehouse.hypoalarm.AlarmNotify"
android:label="@string/alarm_notification" > android:label="@string/alarm_notification" />
</service>
<service <service
android:name=".PreAlarmNotify" android:name="za.org.treehouse.hypoalarm.PreAlarmNotify"
android:label="@string/alarm_notification" > android:label="@string/pre_alarm_notification" />
</service>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application> </application>
<!-- permission required to read contacts --> <!-- permission required to read contacts -->
<uses-permission android:name="android.permission.READ_CONTACTS"/> <uses-permission android:name="android.permission.READ_CONTACTS" />
<!-- permission required to set an alarm --> <!-- permission required to set an alarm -->
<uses-permission android:name="com.android.alarm.permission.SET_ALARM"/> <uses-permission android:name="com.android.alarm.permission.SET_ALARM" />
<!-- permission required to Send SMS --> <!-- permission required to Send SMS -->
<uses-permission android:name="android.permission.SEND_SMS"/> <uses-permission android:name="android.permission.SEND_SMS" />
<!-- permission required to message the user's location --> <!-- permission required to message the user's location -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- permission to restart the alarm on device boot --> <!-- permission to restart the alarm on device boot -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<!-- permission required to vibrate --> <!-- permission required to vibrate -->
<uses-permission android:name="android.permission.VIBRATE"/> <uses-permission android:name="android.permission.VIBRATE" />
<!-- permission required to wake the device --> <!-- permission required to wake the device -->
<!--uses-permission android:name="android.permission.WAKE_LOCK"/--> <!-- uses-permission android:name="android.permission.WAKE_LOCK"/ -->
</manifest> </manifest>

View File

@ -8,13 +8,9 @@ import android.util.Log;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.Button;
import com.triggertrap.seekarc.SeekArc; //import com.triggertrap.seekarc.SeekArc;
import net.frakbot.glowpadbackport.GlowPadView;
import net.sebastianopoggi.ui.GlowPadBackport.GlowPadView;
// TODO See GlowPad.
public class AlarmAlertActivity extends Activity { public class AlarmAlertActivity extends Activity {
private static Intent notifyIntent; private static Intent notifyIntent;
@ -56,15 +52,6 @@ public class AlarmAlertActivity extends Activity {
public void onStart() { public void onStart() {
super.onStart(); super.onStart();
/* CANCEL BUTTON
final Button cancelButton = (Button) findViewById(R.id.cancel_dialog_button);
cancelButton.setOnClickListener (new View.OnClickListener() {
@Override
public void onClick(View view) {
cancelGraceAlarm();
}
});
*/
/* CANCEL SEEKARC /* CANCEL SEEKARC
final SeekArc cancelArc = (SeekArc) findViewById(R.id.cancel_dialog_seekArc); final SeekArc cancelArc = (SeekArc) findViewById(R.id.cancel_dialog_seekArc);
cancelArc.setOnSeekArcChangeListener(new SeekArc.OnSeekArcChangeListener() { cancelArc.setOnSeekArcChangeListener(new SeekArc.OnSeekArcChangeListener() {

View File

@ -106,12 +106,13 @@ public class AlarmNotify extends Service {
// Multiply each int by 1000 for greater progress resolution // Multiply each int by 1000 for greater progress resolution
progress = ((gracePeriodMilliSeconds - milliSecondsLeft) * max) / gracePeriodMilliSeconds; progress = ((gracePeriodMilliSeconds - milliSecondsLeft) * max) / gracePeriodMilliSeconds;
//Log.d("AlarmNotify", "milliSecondsLeft is " + milliSecondsLeft + " and progress is " + progress + " (gracePeriodMilliSeconds is " + gracePeriodMilliSeconds + ")"); //Log.d("AlarmNotify", "milliSecondsLeft is " + milliSecondsLeft + " and progress is " + progress + " (gracePeriodMilliSeconds is " + gracePeriodMilliSeconds + ")");
//Log.d("AlarmNotify", "progress is " + progress + "; max is " + max);
// Sleep until we need to update again // Sleep until we need to update again
try { try {
Thread.sleep(UPDATE_INTERVAL); Thread.sleep(UPDATE_INTERVAL);
} catch (InterruptedException e) { } catch (InterruptedException e) {
Log.d("AlarmNotify", "sleep failure"); Log.d("AlarmNotify", "sleep failure: " + e.toString());
} }
} }
stopSelf(); // stop notification service stopSelf(); // stop notification service

View File

@ -17,14 +17,11 @@ import java.util.Calendar;
/** /**
* TODO change alarm state if a phone call comes in * TODO change alarm state if a phone call comes in
*
* TODO display notification if alarm is about to go off (and allow user to cancel it before alarm goes off)
*
*/ */
public class AlarmReceiver extends BroadcastReceiver { public class AlarmReceiver extends BroadcastReceiver {
private static final int SNOOZE_TIME = 0; //1000*60*5; // Snooze for 5 minutes if need be private static final int SNOOZE_TIME = 1000*60; //1000*60*5; // Snooze for 5 minutes if need be
private static final int ALERT_LIFE = 1000*10; //TODO 1000*60*2; // 2 minutes private static final int ALERT_LIFE = 1000*10; //TODO 1000*60*2; // 2 minutes
private static SharedPreferences sharedPref; private static SharedPreferences sharedPref;
private static AlarmManager alarmManager, graceManager; private static AlarmManager alarmManager, graceManager;
private static PendingIntent alarmPendingIntent, gracePendingIntent; private static PendingIntent alarmPendingIntent, gracePendingIntent;

View File

@ -5,63 +5,77 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.location.Location; import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle; import android.os.Bundle;
import android.os.PowerManager;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.telephony.SmsManager; import android.telephony.SmsManager;
import android.util.Log; import android.util.Log;
import android.widget.Toast; import android.widget.Toast;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesClient;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.location.LocationClient;
/*
* TODO: translate geographic coordinates into an address?
* import android.location.Address;
* import android.location.Geocoder;
*/
public class GraceReceiver extends BroadcastReceiver { public class GraceReceiver extends BroadcastReceiver {
private static SharedPreferences sharedPref; private static LocationClient locationClient;
private static String uri; private static String phoneNumber;
private static String message;
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(final Context context, Intent intent) {
sharedPref = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(context);
Boolean alarmActive = sharedPref.getBoolean(context.getString(R.string.AlarmActivePref), true); Boolean alarmActive = sharedPref.getBoolean(context.getString(R.string.AlarmActivePref), true);
phoneNumber = sharedPref.getString(context.getString(R.string.PhoneNumberPref), null);
message = sharedPref.getString(context.getString(R.string.MessagePref), context.getString(R.string.defaultMessage));
if (alarmActive) { if (alarmActive) {
String phoneNumber = sharedPref.getString(context.getString(R.string.PhoneNumberPref), null); if (GooglePlayServicesUtil.isGooglePlayServicesAvailable(context) == ConnectionResult.SUCCESS) {
String message = sharedPref.getString(context.getString(R.string.MessagePref), null); locationClient = new LocationClient(context,
new GooglePlayServicesClient.ConnectionCallbacks() {
@Override
public void onConnected(Bundle bundle) {
Location location = locationClient.getLastLocation();
if (location != null) {
String uri = " http://maps.google.com?q=" + location.getLatitude() + "," + location.getLongitude();
message += uri;
sendText(context);
locationClient.disconnect();
} else {
Log.e("GraceReceiver", "No location data available. Sending text message anyway.");
sendText(context);
}
}
// TODO get location of phone and send in the message @Override
LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); public void onDisconnected() {
LocationListener locationListener = new LocationListener() { }
public void onLocationChanged(Location location) { },
// Called when a new location is found by the network location provider. new GooglePlayServicesClient.OnConnectionFailedListener() {
if (location != null) { @Override
double latitude = location.getLatitude(); public void onConnectionFailed(ConnectionResult connectionResult) {
double longitude = location.getLongitude(); Log.e("GraceReceiver", "Failed connection to location manager " + connectionResult.toString() + ". Sending text message anyway.");
sendText(context);
uri = " http://maps.google.com?q=" + location.getLatitude() + "," + location.getLongitude(); }
} }
} );
public void onStatusChanged(String provider, int status, Bundle extras) { locationClient.connect();
} } else {
public void onProviderEnabled(String provider) { Log.e("GraceReceiver", "No Google Play Services. Sending text message anyway.");
} sendText(context);
public void onProviderDisabled(String provider) {
}
};
if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);
} else if (locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);
} }
message += uri;
SmsManager sms = SmsManager.getDefault();
// TODO uncomment this:
//sms.sendTextMessage(phoneNumber, null, message, null, null);
Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
Log.d("GraceReceiver", "Sending sms to " + phoneNumber);
} }
} }
private void sendText(Context context) {
SmsManager sms = SmsManager.getDefault();
// TODO uncomment sendTextMessage
//sms.sendTextMessage(phoneNumber, null, message, null, null);
Toast.makeText(context, message, Toast.LENGTH_LONG).show();
Log.d("GraceReceiver", "Sending sms to " + phoneNumber + " with message: " + message);
}
} }

View File

@ -57,7 +57,6 @@ import java.util.regex.Pattern;
// Alerts via Whatsapp and other protocols? // Alerts via Whatsapp and other protocols?
// TODO: klaxon // TODO: klaxon
// TODO: glowpad dismissal (or circular seekbar)
public class MainActivity extends ActionBarActivity { public class MainActivity extends ActionBarActivity {
public static int ALARM_REQUEST = 1; public static int ALARM_REQUEST = 1;

View File

@ -79,7 +79,8 @@
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginTop="60dp" /> android:layout_marginTop="60dp" />
<net.sebastianopoggi.ui.GlowPadBackport.GlowPadView <!--net.sebastianopoggi.ui.GlowPadBackport.GlowPadView-->
<net.frakbot.glowpadbackport.GlowPadView
android:id="@+id/cancel_glowpad" android:id="@+id/cancel_glowpad"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"

View File

@ -7,6 +7,10 @@
<string name="alarm_notification">Text message pending</string> <string name="alarm_notification">Text message pending</string>
<string name="pre_alarm_notification">Upcoming alarm</string>
<string name="text_message_service">Text message sending</string>
<string-array name="grace_period_array"> <string-array name="grace_period_array">
<item>10 minutes</item> <item>10 minutes</item>
<item>15 minutes</item> <item>15 minutes</item>
@ -49,7 +53,8 @@
<string name="alarmCancelToast">HypoAlarm text message cancelled</string> <string name="alarmCancelToast">HypoAlarm text message cancelled</string>
<string name="defaultMessage">Hi, I haven\'t responded to my alarm today. Please contact me to make sure I\'m awake.</string> <!-- defaultMessage must end in a space, for potential location data -->
<string name="defaultMessage">Hi, I haven\'t responded to my alarm today. Please contact me to make sure I\'m awake. </string>
<string name="notificationText">A text message will be sent in %1$s</string> <string name="notificationText">A text message will be sent in %1$s</string>

View File

@ -5,7 +5,7 @@
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
</style> </style>
<!--
<style name="SeekArc"> <style name="SeekArc">
<item name="arcColor">@color/progress_gray_dark</item> <item name="arcColor">@color/progress_gray_dark</item>
</style> </style>
@ -13,5 +13,5 @@
<style name="SeekArcLight"> <style name="SeekArcLight">
<item name="arcColor">@color/progress_gray</item> <item name="arcColor">@color/progress_gray</item>
</style> </style>
-->
</resources> </resources>

View File

@ -1,76 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="HypoAlarm" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":SeekArc" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugJava" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
<option name="LIBRARY_PROJECT" value="true" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/classes/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/source/r/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/aidl/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/buildConfig/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/rs/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/res/rs/test/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/apk" />
<excludeFolder url="file://$MODULE_DIR$/build/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/libs" />
<excludeFolder url="file://$MODULE_DIR$/build/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/res" />
<excludeFolder url="file://$MODULE_DIR$/build/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 19 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -1,19 +0,0 @@
apply plugin: 'android-library'
android {
compileSdkVersion 19
buildToolsVersion "19.0.1"
defaultConfig {
minSdkVersion 8
targetSdkVersion 17
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}

View File

@ -1,13 +0,0 @@
/**
* Automatically generated file. DO NOT MODIFY
*/
package com.triggertrap.seekarc;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String PACKAGE_NAME = "com.triggertrap.seekarc";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "1.0";
}

View File

@ -1,13 +0,0 @@
/**
* Automatically generated file. DO NOT MODIFY
*/
package com.triggertrap.seekarc;
public final class BuildConfig {
public static final boolean DEBUG = false;
public static final String PACKAGE_NAME = "com.triggertrap.seekarc";
public static final String BUILD_TYPE = "release";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "1.0";
}

View File

@ -1,418 +0,0 @@
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.triggertrap.seekarc;
public final class R {
public static final class attr {
/** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int arcColor=0x7f010009;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int arcWidth=0x7f010004;
/** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int clockwise=0x7f01000d;
/** <p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int max=0x7f010002;
/** <p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int progress=0x7f010005;
/** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int progressColor=0x7f01000a;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int progressWidth=0x7f010003;
/** <p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int rotation=0x7f010006;
/** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int roundEdges=0x7f01000b;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int seekArcStyle=0x7f01000e;
/** <p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int startAngle=0x7f010007;
/** <p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int sweepAngle=0x7f010008;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int thumb=0x7f010000;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int thumbOffset=0x7f010001;
/** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int touchInside=0x7f01000c;
}
public static final class color {
public static int progress_gray=0x7f030000;
public static int progress_gray_dark=0x7f030001;
}
public static final class drawable {
public static int scrubber_control_disabled_holo=0x7f020000;
public static int scrubber_control_focused_holo=0x7f020001;
public static int scrubber_control_normal_holo=0x7f020002;
public static int scrubber_control_pressed_holo=0x7f020003;
public static int seek_arc_control_selector=0x7f020004;
}
public static final class string {
public static int app_name=0x7f040000;
}
public static final class style {
public static int SeekArc=0x7f050000;
public static int SeekArcLight=0x7f050001;
}
public static final class styleable {
/** Attributes that can be used with a SeekArc.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #SeekArc_arcColor com.triggertrap.seekarc:arcColor}</code></td><td></td></tr>
<tr><td><code>{@link #SeekArc_arcWidth com.triggertrap.seekarc:arcWidth}</code></td><td></td></tr>
<tr><td><code>{@link #SeekArc_clockwise com.triggertrap.seekarc:clockwise}</code></td><td></td></tr>
<tr><td><code>{@link #SeekArc_max com.triggertrap.seekarc:max}</code></td><td></td></tr>
<tr><td><code>{@link #SeekArc_progress com.triggertrap.seekarc:progress}</code></td><td></td></tr>
<tr><td><code>{@link #SeekArc_progressColor com.triggertrap.seekarc:progressColor}</code></td><td></td></tr>
<tr><td><code>{@link #SeekArc_progressWidth com.triggertrap.seekarc:progressWidth}</code></td><td></td></tr>
<tr><td><code>{@link #SeekArc_rotation com.triggertrap.seekarc:rotation}</code></td><td></td></tr>
<tr><td><code>{@link #SeekArc_roundEdges com.triggertrap.seekarc:roundEdges}</code></td><td></td></tr>
<tr><td><code>{@link #SeekArc_startAngle com.triggertrap.seekarc:startAngle}</code></td><td></td></tr>
<tr><td><code>{@link #SeekArc_sweepAngle com.triggertrap.seekarc:sweepAngle}</code></td><td></td></tr>
<tr><td><code>{@link #SeekArc_thumb com.triggertrap.seekarc:thumb}</code></td><td></td></tr>
<tr><td><code>{@link #SeekArc_thumbOffset com.triggertrap.seekarc:thumbOffset}</code></td><td></td></tr>
<tr><td><code>{@link #SeekArc_touchInside com.triggertrap.seekarc:touchInside}</code></td><td></td></tr>
</table>
@see #SeekArc_arcColor
@see #SeekArc_arcWidth
@see #SeekArc_clockwise
@see #SeekArc_max
@see #SeekArc_progress
@see #SeekArc_progressColor
@see #SeekArc_progressWidth
@see #SeekArc_rotation
@see #SeekArc_roundEdges
@see #SeekArc_startAngle
@see #SeekArc_sweepAngle
@see #SeekArc_thumb
@see #SeekArc_thumbOffset
@see #SeekArc_touchInside
*/
public static final int[] SeekArc = {
0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003,
0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007,
0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b,
0x7f01000c, 0x7f01000d
};
/**
<p>This symbol is the offset where the {@link com.triggertrap.seekarc.R.attr#arcColor}
attribute's value can be found in the {@link #SeekArc} array.
<p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.triggertrap.seekarc:arcColor
*/
public static final int SeekArc_arcColor = 9;
/**
<p>This symbol is the offset where the {@link com.triggertrap.seekarc.R.attr#arcWidth}
attribute's value can be found in the {@link #SeekArc} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.triggertrap.seekarc:arcWidth
*/
public static final int SeekArc_arcWidth = 4;
/**
<p>This symbol is the offset where the {@link com.triggertrap.seekarc.R.attr#clockwise}
attribute's value can be found in the {@link #SeekArc} array.
<p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.triggertrap.seekarc:clockwise
*/
public static final int SeekArc_clockwise = 13;
/**
<p>This symbol is the offset where the {@link com.triggertrap.seekarc.R.attr#max}
attribute's value can be found in the {@link #SeekArc} array.
<p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.triggertrap.seekarc:max
*/
public static final int SeekArc_max = 2;
/**
<p>This symbol is the offset where the {@link com.triggertrap.seekarc.R.attr#progress}
attribute's value can be found in the {@link #SeekArc} array.
<p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.triggertrap.seekarc:progress
*/
public static final int SeekArc_progress = 5;
/**
<p>This symbol is the offset where the {@link com.triggertrap.seekarc.R.attr#progressColor}
attribute's value can be found in the {@link #SeekArc} array.
<p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.triggertrap.seekarc:progressColor
*/
public static final int SeekArc_progressColor = 10;
/**
<p>This symbol is the offset where the {@link com.triggertrap.seekarc.R.attr#progressWidth}
attribute's value can be found in the {@link #SeekArc} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.triggertrap.seekarc:progressWidth
*/
public static final int SeekArc_progressWidth = 3;
/**
<p>This symbol is the offset where the {@link com.triggertrap.seekarc.R.attr#rotation}
attribute's value can be found in the {@link #SeekArc} array.
<p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.triggertrap.seekarc:rotation
*/
public static final int SeekArc_rotation = 6;
/**
<p>This symbol is the offset where the {@link com.triggertrap.seekarc.R.attr#roundEdges}
attribute's value can be found in the {@link #SeekArc} array.
<p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.triggertrap.seekarc:roundEdges
*/
public static final int SeekArc_roundEdges = 11;
/**
<p>This symbol is the offset where the {@link com.triggertrap.seekarc.R.attr#startAngle}
attribute's value can be found in the {@link #SeekArc} array.
<p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.triggertrap.seekarc:startAngle
*/
public static final int SeekArc_startAngle = 7;
/**
<p>This symbol is the offset where the {@link com.triggertrap.seekarc.R.attr#sweepAngle}
attribute's value can be found in the {@link #SeekArc} array.
<p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.triggertrap.seekarc:sweepAngle
*/
public static final int SeekArc_sweepAngle = 8;
/**
<p>This symbol is the offset where the {@link com.triggertrap.seekarc.R.attr#thumb}
attribute's value can be found in the {@link #SeekArc} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.triggertrap.seekarc:thumb
*/
public static final int SeekArc_thumb = 0;
/**
<p>This symbol is the offset where the {@link com.triggertrap.seekarc.R.attr#thumbOffset}
attribute's value can be found in the {@link #SeekArc} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.triggertrap.seekarc:thumbOffset
*/
public static final int SeekArc_thumbOffset = 1;
/**
<p>This symbol is the offset where the {@link com.triggertrap.seekarc.R.attr#touchInside}
attribute's value can be found in the {@link #SeekArc} array.
<p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.triggertrap.seekarc:touchInside
*/
public static final int SeekArc_touchInside = 12;
/** Attributes that can be used with a SeekArcTheme.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #SeekArcTheme_seekArcStyle com.triggertrap.seekarc:seekArcStyle}</code></td><td></td></tr>
</table>
@see #SeekArcTheme_seekArcStyle
*/
public static final int[] SeekArcTheme = {
0x7f01000e
};
/**
<p>This symbol is the offset where the {@link com.triggertrap.seekarc.R.attr#seekArcStyle}
attribute's value can be found in the {@link #SeekArcTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.triggertrap.seekarc:seekArcStyle
*/
public static final int SeekArcTheme_seekArcStyle = 0;
};
}

View File

@ -1,418 +0,0 @@
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.triggertrap.seekarc;
public final class R {
public static final class attr {
/** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int arcColor=0x7f010009;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int arcWidth=0x7f010004;
/** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int clockwise=0x7f01000d;
/** <p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int max=0x7f010002;
/** <p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int progress=0x7f010005;
/** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int progressColor=0x7f01000a;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int progressWidth=0x7f010003;
/** <p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int rotation=0x7f010006;
/** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int roundEdges=0x7f01000b;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int seekArcStyle=0x7f01000e;
/** <p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int startAngle=0x7f010007;
/** <p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int sweepAngle=0x7f010008;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int thumb=0x7f010000;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int thumbOffset=0x7f010001;
/** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int touchInside=0x7f01000c;
}
public static final class color {
public static int progress_gray=0x7f030000;
public static int progress_gray_dark=0x7f030001;
}
public static final class drawable {
public static int scrubber_control_disabled_holo=0x7f020000;
public static int scrubber_control_focused_holo=0x7f020001;
public static int scrubber_control_normal_holo=0x7f020002;
public static int scrubber_control_pressed_holo=0x7f020003;
public static int seek_arc_control_selector=0x7f020004;
}
public static final class string {
public static int app_name=0x7f040000;
}
public static final class style {
public static int SeekArc=0x7f050000;
public static int SeekArcLight=0x7f050001;
}
public static final class styleable {
/** Attributes that can be used with a SeekArc.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #SeekArc_arcColor com.triggertrap.seekarc:arcColor}</code></td><td></td></tr>
<tr><td><code>{@link #SeekArc_arcWidth com.triggertrap.seekarc:arcWidth}</code></td><td></td></tr>
<tr><td><code>{@link #SeekArc_clockwise com.triggertrap.seekarc:clockwise}</code></td><td></td></tr>
<tr><td><code>{@link #SeekArc_max com.triggertrap.seekarc:max}</code></td><td></td></tr>
<tr><td><code>{@link #SeekArc_progress com.triggertrap.seekarc:progress}</code></td><td></td></tr>
<tr><td><code>{@link #SeekArc_progressColor com.triggertrap.seekarc:progressColor}</code></td><td></td></tr>
<tr><td><code>{@link #SeekArc_progressWidth com.triggertrap.seekarc:progressWidth}</code></td><td></td></tr>
<tr><td><code>{@link #SeekArc_rotation com.triggertrap.seekarc:rotation}</code></td><td></td></tr>
<tr><td><code>{@link #SeekArc_roundEdges com.triggertrap.seekarc:roundEdges}</code></td><td></td></tr>
<tr><td><code>{@link #SeekArc_startAngle com.triggertrap.seekarc:startAngle}</code></td><td></td></tr>
<tr><td><code>{@link #SeekArc_sweepAngle com.triggertrap.seekarc:sweepAngle}</code></td><td></td></tr>
<tr><td><code>{@link #SeekArc_thumb com.triggertrap.seekarc:thumb}</code></td><td></td></tr>
<tr><td><code>{@link #SeekArc_thumbOffset com.triggertrap.seekarc:thumbOffset}</code></td><td></td></tr>
<tr><td><code>{@link #SeekArc_touchInside com.triggertrap.seekarc:touchInside}</code></td><td></td></tr>
</table>
@see #SeekArc_arcColor
@see #SeekArc_arcWidth
@see #SeekArc_clockwise
@see #SeekArc_max
@see #SeekArc_progress
@see #SeekArc_progressColor
@see #SeekArc_progressWidth
@see #SeekArc_rotation
@see #SeekArc_roundEdges
@see #SeekArc_startAngle
@see #SeekArc_sweepAngle
@see #SeekArc_thumb
@see #SeekArc_thumbOffset
@see #SeekArc_touchInside
*/
public static final int[] SeekArc = {
0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003,
0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007,
0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b,
0x7f01000c, 0x7f01000d
};
/**
<p>This symbol is the offset where the {@link com.triggertrap.seekarc.R.attr#arcColor}
attribute's value can be found in the {@link #SeekArc} array.
<p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.triggertrap.seekarc:arcColor
*/
public static final int SeekArc_arcColor = 9;
/**
<p>This symbol is the offset where the {@link com.triggertrap.seekarc.R.attr#arcWidth}
attribute's value can be found in the {@link #SeekArc} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.triggertrap.seekarc:arcWidth
*/
public static final int SeekArc_arcWidth = 4;
/**
<p>This symbol is the offset where the {@link com.triggertrap.seekarc.R.attr#clockwise}
attribute's value can be found in the {@link #SeekArc} array.
<p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.triggertrap.seekarc:clockwise
*/
public static final int SeekArc_clockwise = 13;
/**
<p>This symbol is the offset where the {@link com.triggertrap.seekarc.R.attr#max}
attribute's value can be found in the {@link #SeekArc} array.
<p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.triggertrap.seekarc:max
*/
public static final int SeekArc_max = 2;
/**
<p>This symbol is the offset where the {@link com.triggertrap.seekarc.R.attr#progress}
attribute's value can be found in the {@link #SeekArc} array.
<p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.triggertrap.seekarc:progress
*/
public static final int SeekArc_progress = 5;
/**
<p>This symbol is the offset where the {@link com.triggertrap.seekarc.R.attr#progressColor}
attribute's value can be found in the {@link #SeekArc} array.
<p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.triggertrap.seekarc:progressColor
*/
public static final int SeekArc_progressColor = 10;
/**
<p>This symbol is the offset where the {@link com.triggertrap.seekarc.R.attr#progressWidth}
attribute's value can be found in the {@link #SeekArc} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.triggertrap.seekarc:progressWidth
*/
public static final int SeekArc_progressWidth = 3;
/**
<p>This symbol is the offset where the {@link com.triggertrap.seekarc.R.attr#rotation}
attribute's value can be found in the {@link #SeekArc} array.
<p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.triggertrap.seekarc:rotation
*/
public static final int SeekArc_rotation = 6;
/**
<p>This symbol is the offset where the {@link com.triggertrap.seekarc.R.attr#roundEdges}
attribute's value can be found in the {@link #SeekArc} array.
<p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.triggertrap.seekarc:roundEdges
*/
public static final int SeekArc_roundEdges = 11;
/**
<p>This symbol is the offset where the {@link com.triggertrap.seekarc.R.attr#startAngle}
attribute's value can be found in the {@link #SeekArc} array.
<p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.triggertrap.seekarc:startAngle
*/
public static final int SeekArc_startAngle = 7;
/**
<p>This symbol is the offset where the {@link com.triggertrap.seekarc.R.attr#sweepAngle}
attribute's value can be found in the {@link #SeekArc} array.
<p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.triggertrap.seekarc:sweepAngle
*/
public static final int SeekArc_sweepAngle = 8;
/**
<p>This symbol is the offset where the {@link com.triggertrap.seekarc.R.attr#thumb}
attribute's value can be found in the {@link #SeekArc} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.triggertrap.seekarc:thumb
*/
public static final int SeekArc_thumb = 0;
/**
<p>This symbol is the offset where the {@link com.triggertrap.seekarc.R.attr#thumbOffset}
attribute's value can be found in the {@link #SeekArc} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.triggertrap.seekarc:thumbOffset
*/
public static final int SeekArc_thumbOffset = 1;
/**
<p>This symbol is the offset where the {@link com.triggertrap.seekarc.R.attr#touchInside}
attribute's value can be found in the {@link #SeekArc} array.
<p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.triggertrap.seekarc:touchInside
*/
public static final int SeekArc_touchInside = 12;
/** Attributes that can be used with a SeekArcTheme.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #SeekArcTheme_seekArcStyle com.triggertrap.seekarc:seekArcStyle}</code></td><td></td></tr>
</table>
@see #SeekArcTheme_seekArcStyle
*/
public static final int[] SeekArcTheme = {
0x7f01000e
};
/**
<p>This symbol is the offset where the {@link com.triggertrap.seekarc.R.attr#seekArcStyle}
attribute's value can be found in the {@link #SeekArcTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.triggertrap.seekarc:seekArcStyle
*/
public static final int SeekArcTheme_seekArcStyle = 0;
};
}

Binary file not shown.

View File

@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (c) 2013 Triggertrap Ltd
Author Neil Davies
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,20 +0,0 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# 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 *;
#}

View File

@ -1,15 +0,0 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-17
android.library=true

View File

@ -1,39 +0,0 @@
<!--
The MIT License (MIT)
Copyright (c) 2013 Triggertrap Ltd
Author Neil Davies
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.triggertrap.seekarc"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:label="@string/app_name"
>
</application>
</manifest>

View File

@ -1,528 +0,0 @@
/*******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2013 Triggertrap Ltd
* Author Neil Davies
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
******************************************************************************/
package com.triggertrap.seekarc;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
/**
*
* SeekArc.java
*
* This is a class that functions much like a SeekBar but
* follows a circle path instead of a straight line.
*
* @author Neil Davies
*
*/
public class SeekArc extends View {
private static final String TAG = SeekArc.class.getSimpleName();
private static int INVALID_PROGRESS_VALUE = -1;
// The initial rotational offset -90 means we start at 12 o'clock
private final int mAngleOffset = -90;
/**
* The Drawable for the seek arc thumbnail
*/
private Drawable mThumb;
/**
* The Maximum value that this SeekArc can be set to
*/
private int mMax = 100;
/**
* The Current value that the SeekArc is set to
*/
private int mProgress = 0;
/**
* The width of the progress line for this SeekArc
*/
private int mProgressWidth = 4;
/**
* The Width of the background arc for the SeekArc
*/
private int mArcWidth = 2;
/**
* The Angle to start drawing this Arc from
*/
private int mStartAngle = 0;
/**
* The Angle through which to draw the arc (Max is 360)
*/
private int mSweepAngle = 360;
/**
* The rotation of the SeekArc- 0 is twelve o'clock
*/
private int mRotation = 0;
/**
* Give the SeekArc rounded edges
*/
private boolean mRoundedEdges = false;
/**
* Enable touch inside the SeekArc
*/
private boolean mTouchInside = true;
/**
* Will the progress increase clockwise or anti-clockwise
*/
private boolean mClockwise = true;
// Internal variables
private int mArcRadius = 0;
private float mProgressSweep = 0;
private RectF mArcRect = new RectF();
private Paint mArcPaint;
private Paint mProgressPaint;
private int mTranslateX;
private int mTranslateY;
private int mThumbXPos;
private int mThumbYPos;
private double mTouchAngle;
private float mTouchIgnoreRadius;
private OnSeekArcChangeListener mOnSeekArcChangeListener;
public interface OnSeekArcChangeListener {
/**
* Notification that the progress level has changed. Clients can use the
* fromUser parameter to distinguish user-initiated changes from those
* that occurred programmatically.
*
* @param seekArc
* The SeekArc whose progress has changed
* @param progress
* The current progress level. This will be in the range
* 0..max where max was set by
* {@link ProgressArc#setMax(int)}. (The default value for
* max is 100.)
* @param fromUser
* True if the progress change was initiated by the user.
*/
void onProgressChanged(SeekArc seekArc, int progress, boolean fromUser);
/**
* Notification that the user has started a touch gesture. Clients may
* want to use this to disable advancing the seekbar.
*
* @param seekArc
* The SeekArc in which the touch gesture began
*/
void onStartTrackingTouch(SeekArc seekArc);
/**
* Notification that the user has finished a touch gesture. Clients may
* want to use this to re-enable advancing the seekarc.
*
* @param seekArc
* The SeekArc in which the touch gesture began
*/
void onStopTrackingTouch(SeekArc seekArc);
}
public SeekArc(Context context) {
super(context);
init(context, null, 0);
}
public SeekArc(Context context, AttributeSet attrs) {
super(context, attrs);
init(context, attrs, R.attr.seekArcStyle);
}
public SeekArc(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init(context, attrs, defStyle);
}
private void init(Context context, AttributeSet attrs, int defStyle) {
Log.d(TAG, "Initialising SeekArc");
final Resources res = getResources();
float density = context.getResources().getDisplayMetrics().density;
// Defaults, may need to link this into theme settings
int arcColor = res.getColor(R.color.progress_gray);
int progressColor = res.getColor(android.R.color.holo_blue_light);
int thumbHalfheight = 0;
int thumbHalfWidth = 0;
mThumb = res.getDrawable(R.drawable.seek_arc_control_selector);
// Convert progress width to pixels for current density
mProgressWidth = (int) (mProgressWidth * density);
if (attrs != null) {
// Attribute initialization
final TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.SeekArc, defStyle, 0);
Drawable thumb = a.getDrawable(R.styleable.SeekArc_thumb);
if (thumb != null) {
mThumb = thumb;
}
thumbHalfheight = (int) mThumb.getIntrinsicHeight() / 2;
thumbHalfWidth = (int) mThumb.getIntrinsicWidth() / 2;
mThumb.setBounds(-thumbHalfWidth, -thumbHalfheight, thumbHalfWidth,
thumbHalfheight);
mMax = a.getInteger(R.styleable.SeekArc_max, mMax);
mProgress = a.getInteger(R.styleable.SeekArc_progress, mProgress);
mProgressWidth = (int) a.getDimension(
R.styleable.SeekArc_progressWidth, mProgressWidth);
mArcWidth = (int) a.getDimension(R.styleable.SeekArc_arcWidth,
mArcWidth);
mStartAngle = a.getInt(R.styleable.SeekArc_startAngle, mStartAngle);
mSweepAngle = a.getInt(R.styleable.SeekArc_sweepAngle, mSweepAngle);
mRotation = a.getInt(R.styleable.SeekArc_rotation, mRotation);
mRoundedEdges = a.getBoolean(R.styleable.SeekArc_roundEdges,
mRoundedEdges);
mTouchInside = a.getBoolean(R.styleable.SeekArc_touchInside,
mTouchInside);
mClockwise = a.getBoolean(R.styleable.SeekArc_clockwise,
mClockwise);
arcColor = a.getColor(R.styleable.SeekArc_arcColor, arcColor);
progressColor = a.getColor(R.styleable.SeekArc_progressColor,
progressColor);
a.recycle();
}
mProgress = (mProgress > mMax) ? mMax : mProgress;
mProgress = (mProgress < 0) ? 0 : mProgress;
mSweepAngle = (mSweepAngle > 360) ? 360 : mSweepAngle;
mSweepAngle = (mSweepAngle < 0) ? 0 : mSweepAngle;
mStartAngle = (mStartAngle > 360) ? 0 : mStartAngle;
mStartAngle = (mStartAngle < 0) ? 0 : mStartAngle;
mArcPaint = new Paint();
mArcPaint.setColor(arcColor);
mArcPaint.setAntiAlias(true);
mArcPaint.setStyle(Paint.Style.STROKE);
mArcPaint.setStrokeWidth(mArcWidth);
//mArcPaint.setAlpha(45);
mProgressPaint = new Paint();
mProgressPaint.setColor(progressColor);
mProgressPaint.setAntiAlias(true);
mProgressPaint.setStyle(Paint.Style.STROKE);
mProgressPaint.setStrokeWidth(mProgressWidth);
if (mRoundedEdges) {
mArcPaint.setStrokeCap(Paint.Cap.ROUND);
mProgressPaint.setStrokeCap(Paint.Cap.ROUND);
}
}
@Override
protected void onDraw(Canvas canvas) {
if(!mClockwise) {
canvas.scale(-1, 1, mArcRect.centerX(), mArcRect.centerY() );
}
// Draw the arcs
final int arcStart = mStartAngle + mAngleOffset + mRotation;
final int arcSweep = mSweepAngle;
canvas.drawArc(mArcRect, arcStart, arcSweep, false, mArcPaint);
canvas.drawArc(mArcRect, arcStart, mProgressSweep, false,
mProgressPaint);
// Draw the thumb nail
canvas.translate(mTranslateX -mThumbXPos, mTranslateY -mThumbYPos);
mThumb.draw(canvas);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
final int height = getDefaultSize(getSuggestedMinimumHeight(),
heightMeasureSpec);
final int width = getDefaultSize(getSuggestedMinimumWidth(),
widthMeasureSpec);
final int min = Math.min(width, height);
float top = 0;
float left = 0;
int arcDiameter = 0;
mTranslateX = (int) (width * 0.5f);
mTranslateY = (int) (height * 0.5f);
arcDiameter = min - getPaddingLeft();
mArcRadius = arcDiameter / 2;
top = height / 2 - (arcDiameter / 2);
left = width / 2 - (arcDiameter / 2);
mArcRect.set(left, top, left + arcDiameter, top + arcDiameter);
int arcStart = (int)mProgressSweep + mStartAngle + mRotation + 90;
mThumbXPos = (int) (mArcRadius * Math.cos(Math.toRadians(arcStart)));
mThumbYPos = (int) (mArcRadius * Math.sin(Math.toRadians(arcStart)));
setTouchInSide(mTouchInside);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
onStartTrackingTouch();
updateOnTouch(event);
break;
case MotionEvent.ACTION_MOVE:
updateOnTouch(event);
break;
case MotionEvent.ACTION_UP:
onStopTrackingTouch();
setPressed(false);
break;
case MotionEvent.ACTION_CANCEL:
onStopTrackingTouch();
setPressed(false);
break;
}
return true;
}
@Override
protected void drawableStateChanged() {
super.drawableStateChanged();
if (mThumb != null && mThumb.isStateful()) {
int[] state = getDrawableState();
mThumb.setState(state);
}
invalidate();
}
private void onStartTrackingTouch() {
if (mOnSeekArcChangeListener != null) {
mOnSeekArcChangeListener.onStartTrackingTouch(this);
}
}
private void onStopTrackingTouch() {
if (mOnSeekArcChangeListener != null) {
mOnSeekArcChangeListener.onStopTrackingTouch(this);
}
}
private void updateOnTouch(MotionEvent event) {
boolean ignoreTouch = ignoreTouch(event.getX(), event.getY());
if (ignoreTouch) {
return;
}
setPressed(true);
mTouchAngle = getTouchDegrees(event.getX(), event.getY());
int progress = getProgressForAngle(mTouchAngle);
onProgressRefresh(progress, true);
}
private boolean ignoreTouch(float xPos, float yPos) {
boolean ignore = false;
float x = xPos - mTranslateX;
float y = yPos - mTranslateY;
float touchRadius = (float) Math.sqrt(((x * x) + (y * y)));
if (touchRadius < mTouchIgnoreRadius) {
ignore = true;
}
return ignore;
}
private double getTouchDegrees(float xPos, float yPos) {
float x = xPos - mTranslateX;
float y = yPos - mTranslateY;
//invert the x-coord if we are rotating anti-clockwise
x= (mClockwise) ? x:-x;
// convert to arc Angle
double angle = Math.toDegrees(Math.atan2(y, x) + (Math.PI / 2)
- Math.toRadians(mRotation));
if (angle < 0) {
angle = 360 + angle;
}
angle -= mStartAngle;
return angle;
}
private int getProgressForAngle(double angle) {
int touchProgress = (int) Math.round(valuePerDegree() * angle);
touchProgress = (touchProgress < 0) ? INVALID_PROGRESS_VALUE
: touchProgress;
touchProgress = (touchProgress > mMax) ? INVALID_PROGRESS_VALUE
: touchProgress;
return touchProgress;
}
private float valuePerDegree() {
return (float) mMax / mSweepAngle;
}
private void onProgressRefresh(int progress, boolean fromUser) {
updateProgress(progress, fromUser);
}
private void updateThumbPosition() {
int thumbAngle = (int) (mStartAngle + mProgressSweep + mRotation + 90);
mThumbXPos = (int) (mArcRadius * Math.cos(Math.toRadians(thumbAngle)));
mThumbYPos = (int) (mArcRadius * Math.sin(Math.toRadians(thumbAngle)));
}
private void updateProgress(int progress, boolean fromUser) {
if (progress == INVALID_PROGRESS_VALUE) {
return;
}
if (mOnSeekArcChangeListener != null) {
mOnSeekArcChangeListener
.onProgressChanged(this, progress, fromUser);
}
progress = (progress > mMax) ? mMax : progress;
progress = (mProgress < 0) ? 0 : progress;
mProgress = progress;
mProgressSweep = (float) progress / mMax * mSweepAngle;
updateThumbPosition();
invalidate();
}
/**
* Sets a listener to receive notifications of changes to the SeekArc's
* progress level. Also provides notifications of when the user starts and
* stops a touch gesture within the SeekArc.
*
* @param l
* The seek bar notification listener
*
* @see SeekArc.OnSeekBarChangeListener
*/
public void setOnSeekArcChangeListener(OnSeekArcChangeListener l) {
mOnSeekArcChangeListener = l;
}
public void setProgress(int progress) {
updateProgress(progress, false);
}
public int getProgressWidth() {
return mProgressWidth;
}
public void setProgressWidth(int mProgressWidth) {
this.mProgressWidth = mProgressWidth;
mProgressPaint.setStrokeWidth(mProgressWidth);
}
public int getArcWidth() {
return mArcWidth;
}
public void setArcWidth(int mArcWidth) {
this.mArcWidth = mArcWidth;
mArcPaint.setStrokeWidth(mArcWidth);
}
public int getArcRotation() {
return mRotation;
}
public void setArcRotation(int mRotation) {
this.mRotation = mRotation;
updateThumbPosition();
}
public int getStartAngle() {
return mStartAngle;
}
public void setStartAngle(int mStartAngle) {
this.mStartAngle = mStartAngle;
updateThumbPosition();
}
public int getSweepAngle() {
return mSweepAngle;
}
public void setSweepAngle(int mSweepAngle) {
this.mSweepAngle = mSweepAngle;
updateThumbPosition();
}
public void setRoundedEdges(boolean isEnabled) {
mRoundedEdges = isEnabled;
if (mRoundedEdges) {
mArcPaint.setStrokeCap(Paint.Cap.ROUND);
mProgressPaint.setStrokeCap(Paint.Cap.ROUND);
} else {
mArcPaint.setStrokeCap(Paint.Cap.SQUARE);
mProgressPaint.setStrokeCap(Paint.Cap.SQUARE);
}
}
public void setTouchInSide(boolean isEnabled) {
int thumbHalfheight = (int) mThumb.getIntrinsicHeight() / 2;
int thumbHalfWidth = (int) mThumb.getIntrinsicWidth() / 2;
mTouchInside = isEnabled;
if (mTouchInside) {
mTouchIgnoreRadius = (float) mArcRadius / 4;
} else {
// Don't use the exact radius makes interaction too tricky
mTouchIgnoreRadius = mArcRadius
- Math.min(thumbHalfWidth, thumbHalfheight);
}
}
public void setClockwise(boolean isClockwise) {
mClockwise = isClockwise;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -1,31 +0,0 @@
<!--
The MIT License (MIT)
Copyright (c) 2013 Triggertrap Ltd
Author Neil Davies
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/scrubber_control_disabled_holo" android:state_enabled="false"/>
<item android:drawable="@drawable/scrubber_control_pressed_holo" android:state_pressed="true"/>
<item android:drawable="@drawable/scrubber_control_focused_holo" android:state_selected="true"/>
<item android:drawable="@drawable/scrubber_control_normal_holo"/>
</selector>

View File

@ -1,47 +0,0 @@
<!--
The MIT License (MIT)
Copyright (c) 2013 Triggertrap Ltd
Author Neil Davies
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->
<resources>
<declare-styleable name="SeekArc">
<attr name="thumb" format="reference" />
<attr name="thumbOffset" format="dimension" />
<attr name="max" format="integer" />
<attr name="progressWidth" format="dimension" />
<attr name="arcWidth" format="dimension" />
<attr name="progress" format="integer" />
<attr name="rotation" format="integer" />
<attr name="startAngle" format="integer" />
<attr name="sweepAngle" format="integer" />
<attr name="arcColor" format="color" />
<attr name="progressColor" format="color" />
<attr name="roundEdges" format="boolean" />
<attr name="touchInside" format="boolean" />
<attr name="clockwise" format="boolean" />
</declare-styleable>
<declare-styleable name="SeekArcTheme">
<attr name="seekArcStyle" format="reference"></attr>
</declare-styleable>
</resources>

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
The MIT License (MIT)
Copyright (c) 2013 Triggertrap Ltd
Author Neil Davies
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->
<resources>
<color name="progress_gray">#FFD8D8D8</color>
<color name="progress_gray_dark">#FF383838</color>
</resources>

View File

@ -1,28 +0,0 @@
<!--
The MIT License (MIT)
Copyright (c) 2013 Triggertrap Ltd
Author Neil Davies
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->
<resources>
<string name="app_name">Seekarc_library</string>
</resources>

View File

@ -1,34 +0,0 @@
<!--
The MIT License (MIT)
Copyright (c) 2013 Triggertrap Ltd
Author Neil Davies
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->
<resources>
<style name="SeekArc">
<item name="arcColor">@color/progress_gray_dark</item>
</style>
<style name="SeekArcLight">
<item name="arcColor">@color/progress_gray</item>
</style>
</resources>

View File

@ -1 +1,2 @@
include ':HypoAlarm', ':GlowPadBackport', ':SeekArc' //include ':HypoAlarm', ':GlowPadBackport', ':SeekArc'
include ':HypoAlarm', ':GlowPadBackport'