Skip to content

Commit c05c259

Browse files
committedJan 20, 2015
Added example module
1 parent e216f70 commit c05c259

File tree

20 files changed

+338
-2
lines changed

20 files changed

+338
-2
lines changed
 

‎.idea/gradle.xml

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.idea/modules.xml

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎example/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

‎example/build.gradle

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 21
5+
buildToolsVersion "21.1.2"
6+
7+
defaultConfig {
8+
applicationId "me.mattlogan.artiste"
9+
minSdkVersion 10
10+
targetSdkVersion 21
11+
versionCode 1
12+
versionName "1.0"
13+
}
14+
buildTypes {
15+
release {
16+
minifyEnabled false
17+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18+
}
19+
}
20+
}
21+
22+
dependencies {
23+
compile fileTree(dir: 'libs', include: ['*.jar'])
24+
compile 'com.android.support:appcompat-v7:21.0.3'
25+
compile project(':library')
26+
}

‎example/example.iml

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
3+
<component name="FacetManager">
4+
<facet type="android-gradle" name="Android-Gradle">
5+
<configuration>
6+
<option name="GRADLE_PROJECT_PATH" value=":example" />
7+
</configuration>
8+
</facet>
9+
<facet type="android" name="Android">
10+
<configuration>
11+
<option name="SELECTED_BUILD_VARIANT" value="debug" />
12+
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
13+
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
14+
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
15+
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
16+
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugTestSources" />
17+
<option name="ALLOW_USER_CONFIGURATION" value="false" />
18+
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
19+
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
20+
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
21+
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
22+
</configuration>
23+
</facet>
24+
</component>
25+
<component name="NewModuleRootManager" inherit-compiler-output="false">
26+
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
27+
<exclude-output />
28+
<content url="file://$MODULE_DIR$">
29+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
30+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
31+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
32+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
33+
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
34+
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/debug" type="java-resource" />
35+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/test/debug" isTestSource="true" generated="true" />
36+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/test/debug" isTestSource="true" generated="true" />
37+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/test/debug" isTestSource="true" generated="true" />
38+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/test/debug" isTestSource="true" generated="true" />
39+
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/test/debug" type="java-test-resource" />
40+
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/test/debug" type="java-test-resource" />
41+
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
42+
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
43+
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
44+
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
45+
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
46+
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
47+
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
48+
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
49+
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
50+
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
51+
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
52+
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
53+
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
54+
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
55+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
56+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
57+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
58+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
59+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
60+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
61+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
62+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
63+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
64+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
65+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
66+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
67+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
68+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
69+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
70+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
71+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
72+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
73+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
74+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
75+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
76+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
77+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
78+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
79+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
80+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
81+
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
82+
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
83+
</content>
84+
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
85+
<orderEntry type="sourceFolder" forTests="false" />
86+
<orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" />
87+
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
88+
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
89+
<orderEntry type="module" module-name="library" exported="" />
90+
</component>
91+
</module>
92+

‎example/src/main/AndroidManifest.xml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="me.mattlogan.artiste.example" >
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@drawable/ic_launcher"
8+
android:label="@string/app_name"
9+
android:theme="@style/AppTheme" >
10+
<activity
11+
android:name=".MainActivity"
12+
android:label="@string/app_name" >
13+
<intent-filter>
14+
<action android:name="android.intent.action.MAIN" />
15+
16+
<category android:name="android.intent.category.LAUNCHER" />
17+
</intent-filter>
18+
</activity>
19+
</application>
20+
21+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package me.mattlogan.artiste.example;
2+
3+
import me.mattlogan.artiste.RegularStarPolygon;
4+
5+
public class Decagram extends RegularStarPolygon {
6+
@Override
7+
public int getNumberOfPoints() {
8+
return 10;
9+
}
10+
11+
@Override
12+
public int getDensity() {
13+
return 3;
14+
}
15+
16+
@Override
17+
public boolean isOutlined() {
18+
return true;
19+
}
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package me.mattlogan.artiste.example;
2+
3+
import android.support.v7.app.ActionBarActivity;
4+
import android.os.Bundle;
5+
6+
public class MainActivity extends ActionBarActivity {
7+
8+
@Override
9+
protected void onCreate(Bundle savedInstanceState) {
10+
super.onCreate(savedInstanceState);
11+
setContentView(R.layout.activity_main);
12+
}
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package me.mattlogan.artiste.example;
2+
3+
import me.mattlogan.artiste.RegularStarPolygon;
4+
5+
public class Octagram extends RegularStarPolygon {
6+
7+
@Override
8+
public int getNumberOfPoints() {
9+
return 8;
10+
}
11+
12+
@Override
13+
public int getDensity() {
14+
return 3;
15+
}
16+
17+
@Override
18+
public boolean isOutlined() {
19+
return false;
20+
}
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
package me.mattlogan.artiste.example;
2+
3+
import android.content.Context;
4+
import android.graphics.Canvas;
5+
import android.graphics.Paint;
6+
import android.graphics.Rect;
7+
import android.util.AttributeSet;
8+
import android.view.View;
9+
10+
import me.mattlogan.artiste.Shapes;
11+
12+
public class ShapeView extends View {
13+
14+
Shapes.Hexagon hexagon;
15+
Shapes.FivePointedStar fivePointedStar;
16+
Decagram decagram;
17+
Shapes.Circle circle;
18+
Octagram octagram;
19+
Shapes.Pentagon pentagon;
20+
21+
Paint hexagonPaint;
22+
Paint fivePointedStarPaint;
23+
Paint decagramPaint;
24+
Paint circlePaint;
25+
Paint octagramPaint;
26+
Paint pentagonPaint;
27+
28+
public ShapeView(Context context) {
29+
super(context);
30+
init();
31+
}
32+
33+
public ShapeView(Context context, AttributeSet attrs) {
34+
super(context, attrs);
35+
init();
36+
}
37+
38+
public ShapeView(Context context, AttributeSet attrs, int defStyleAttr) {
39+
super(context, attrs, defStyleAttr);
40+
init();
41+
}
42+
43+
void init() {
44+
hexagon = new Shapes.Hexagon();
45+
fivePointedStar = new Shapes.FivePointedStar();
46+
decagram = new Decagram();
47+
circle = new Shapes.Circle();
48+
octagram = new Octagram();
49+
pentagon = new Shapes.Pentagon();
50+
51+
hexagonPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
52+
hexagonPaint.setColor(0xFF0263ED);
53+
hexagonPaint.setStrokeWidth(3);
54+
hexagonPaint.setStyle(Paint.Style.STROKE);
55+
56+
fivePointedStarPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
57+
fivePointedStarPaint.setColor(0xFFD73F22);
58+
fivePointedStarPaint.setStrokeWidth(4);
59+
fivePointedStarPaint.setStyle(Paint.Style.STROKE);
60+
61+
decagramPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
62+
decagramPaint.setColor(0xFFFFB900);
63+
decagramPaint.setStyle(Paint.Style.FILL);
64+
65+
circlePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
66+
circlePaint.setColor(0xFF0263ED);
67+
circlePaint.setStyle(Paint.Style.FILL);
68+
69+
octagramPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
70+
octagramPaint.setColor(0xFF009C55);
71+
octagramPaint.setStyle(Paint.Style.STROKE);
72+
octagramPaint.setStrokeWidth(4);
73+
74+
pentagonPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
75+
pentagonPaint.setColor(0xFFD73F22);
76+
pentagonPaint.setStyle(Paint.Style.FILL);
77+
}
78+
79+
@Override
80+
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
81+
super.onSizeChanged(w, h, oldw, oldh);
82+
hexagon.calculatePath(new Rect(0, 0, h, h), 25);
83+
fivePointedStar.calculatePath(new Rect(h, 0, 2 * h, h), 12);
84+
decagram.calculatePath(new Rect(2 * h, 0, 3 * h, h), 18);
85+
circle.calculatePath(new Rect(3 * h, 0, 4 * h, h), 0);
86+
octagram.calculatePath(new Rect(4 * h, 0, 5 * h, h), 22.5f);
87+
pentagon.calculatePath(new Rect(5 * h, 0, 6 * h, h), 50);
88+
}
89+
90+
@Override
91+
protected void onDraw(Canvas canvas) {
92+
super.onDraw(canvas);
93+
canvas.drawPath(hexagon.getPath(), hexagonPaint);
94+
canvas.drawPath(fivePointedStar.getPath(), fivePointedStarPaint);
95+
canvas.drawPath(decagram.getPath(), decagramPaint);
96+
canvas.drawPath(circle.getPath(), circlePaint);
97+
canvas.drawPath(octagram.getPath(), octagramPaint);
98+
canvas.drawPath(pentagon.getPath(), pentagonPaint);
99+
}
100+
}
Loading
Loading
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:paddingBottom="@dimen/activity_vertical_margin"
6+
android:paddingLeft="@dimen/activity_horizontal_margin"
7+
android:paddingRight="@dimen/activity_horizontal_margin"
8+
android:background="#fff"
9+
android:paddingTop="@dimen/activity_vertical_margin"
10+
tools:context=".MainActivity">
11+
12+
<me.mattlogan.artiste.example.ShapeView
13+
android:layout_width="300dp"
14+
android:layout_height="50dp"
15+
android:layout_centerInParent="true"/>
16+
17+
</RelativeLayout>
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<resources>
2+
<!-- Default screen margins, per the Android Design guidelines. -->
3+
<dimen name="activity_horizontal_margin">16dp</dimen>
4+
<dimen name="activity_vertical_margin">16dp</dimen>
5+
</resources>
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
4+
<string name="app_name">Artiste</string>
5+
</resources>
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<resources>
2+
3+
<!-- Base application theme. -->
4+
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
5+
<!-- Customize your theme here. -->
6+
</style>
7+
8+
</resources>

‎library/library.iml

+6-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<option name="ALLOW_USER_CONFIGURATION" value="false" />
1818
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
1919
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
20-
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
20+
<option name="RES_FOLDERS_RELATIVE_PATH" value="" />
2121
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
2222
<option name="LIBRARY_PROJECT" value="true" />
2323
</configuration>
@@ -60,6 +60,7 @@
6060
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
6161
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
6262
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
63+
<excludeFolder url="file://$MODULE_DIR$/build/docs" />
6364
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
6465
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
6566
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
@@ -79,7 +80,11 @@
7980
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
8081
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
8182
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
83+
<excludeFolder url="file://$MODULE_DIR$/build/libs" />
84+
<excludeFolder url="file://$MODULE_DIR$/build/me" />
8285
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
86+
<excludeFolder url="file://$MODULE_DIR$/build/poms" />
87+
<excludeFolder url="file://$MODULE_DIR$/build/release" />
8388
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
8489
</content>
8590
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />

‎settings.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include ':library'
1+
include ':library', ':example'

0 commit comments

Comments
 (0)
Please sign in to comment.