Skip to content

Commit

Permalink
Add latest code
Browse files Browse the repository at this point in the history
  • Loading branch information
KishanViramgama committed Dec 11, 2019
1 parent 5e712c4 commit 09e4aa7
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 21 deletions.
1 change: 0 additions & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 38 additions & 4 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Add following dependency to your app module build.gradle file:

<pre>
dependencies {
implementation 'com.github.KishanViramgama:Drawing:0.1.2'
implementation 'com.github.KishanViramgama:Drawing:0.1.3'
}
</pre>

Expand Down
12 changes: 6 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 28
compileSdkVersion 29
defaultConfig {
applicationId "com.app.kids"
minSdkVersion 15
targetSdkVersion 28
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -20,10 +20,10 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation project(':library')
}
2 changes: 2 additions & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

<com.app.drawing.Util.CanvasView
android:id="@+id/canvas_drawing"
app:paintColor="@color/colorPrimary"
app:paintStork="10"
android:layout_width="match_parent"
android:layout_height="match_parent" />

Expand Down
2 changes: 0 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'


// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand Down
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Mon Sep 02 22:02:23 IST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
10 changes: 5 additions & 5 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 28
compileSdkVersion 29

defaultConfig {
minSdkVersion 15
targetSdkVersion 28
targetSdkVersion 29
versionCode 1
versionName "1.0"

Expand All @@ -25,8 +25,8 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
implementation 'androidx.appcompat:appcompat:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
13 changes: 13 additions & 0 deletions library/src/main/java/com/app/drawing/Util/CanvasView.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
Expand All @@ -11,7 +12,10 @@
import android.view.MotionEvent;
import android.view.View;

import com.app.kids.mylibrary.R;

public class CanvasView extends View {

private Bitmap bitmap;
private Canvas canvas;
private Path path;
Expand All @@ -21,6 +25,11 @@ public class CanvasView extends View {
public CanvasView(Context context, AttributeSet attrs) {
super(context, attrs);

TypedArray a = context.getTheme().obtainStyledAttributes(
attrs,
R.styleable.CanvasView,
0, 0);

path = new Path();
bitmapPaint = new Paint(Paint.DITHER_FLAG);

Expand All @@ -33,6 +42,9 @@ public CanvasView(Context context, AttributeSet attrs) {
paint.setStrokeCap(Paint.Cap.ROUND);
paint.setStrokeWidth(9);

paint.setColor(a.getColor(R.styleable.CanvasView_paintColor, 0));
paint.setStrokeWidth(a.getColor(R.styleable.CanvasView_paintStork, 0));

}

@Override
Expand Down Expand Up @@ -125,6 +137,7 @@ public void paintColor(int color) {
paint.setColor(color);
}

//stork size
public void paintStork(int width) {
paint.setStrokeWidth(width);
}
Expand Down
9 changes: 9 additions & 0 deletions library/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="CanvasView">

<attr name="paintColor" format="color" />
<attr name="paintStork" format="integer"/>

</declare-styleable>
</resources>

0 comments on commit 09e4aa7

Please sign in to comment.