Skip to content

Commit

Permalink
重命名Graffiti->Doodle
Browse files Browse the repository at this point in the history
  • Loading branch information
huangziwei committed Jul 19, 2018
1 parent d7f5046 commit bcb8d2a
Show file tree
Hide file tree
Showing 92 changed files with 939 additions and 940 deletions.
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,25 @@

### 界面

![IMG](https://raw.githubusercontent.com/1993hzw/common/master/Graffiti/01.png)
![IMG](https://raw.githubusercontent.com/1993hzw/common/master/Graffiti/02.png)
![IMG](https://raw.githubusercontent.com/1993hzw/common/master/Graffiti/03.png)
![IMG](https://raw.githubusercontent.com/1993hzw/common/master/Doodle/01.png)
![IMG](https://raw.githubusercontent.com/1993hzw/common/master/Doodle/02.png)
![IMG](https://raw.githubusercontent.com/1993hzw/common/master/Doodle/03.png)


### 使用
```groovy
compile 'com.hzw.graffiti:graffiti:4.3.1'
compile 'com.hzw.doodle:doodle:4.3.1'
```

```java
// 涂鸦参数
GraffitiParams params = new GraffitiParams();
DoodleParams params = new DoodleParams();
// 图片路径
params.mImagePath = list.get(0);
// 初始画笔大小
params.mPaintSize = 20;
// 启动涂鸦页面
GraffitiActivity.startActivityForResult(MainActivity.this, params, REQ_CODE_GRAFFITI);
DoodleActivity.startActivityForResult(MainActivity.this, params, REQ_CODE_DOODLE);

```

Expand All @@ -60,33 +60,33 @@ dependencies {

```java
/**
* 涂鸦界面,根据GraffitiView的接口,提供页面交互
* 涂鸦界面,根据DoodleView的接口,提供页面交互
*
*/
public class GraffitiActivity extends Activity {
public class DoodleActivity extends Activity {
/**
* 启动涂鸦界面
*
* @param activity
* @param params 涂鸦参数
* @param requestCode startActivityForResult的请求码
*/
public static void startActivityForResult(Activity activity, GraffitiParams params, int requestCode) {
Intent intent = new Intent(activity, GraffitiActivity.class);
intent.putExtra(GraffitiActivity.KEY_PARAMS, params);
public static void startActivityForResult(Activity activity, DoodleParams params, int requestCode) {
Intent intent = new Intent(activity, DoodleActivity.class);
intent.putExtra(DoodleActivity.KEY_PARAMS, params);
activity.startActivityForResult(intent, requestCode);
}
}
```

```java
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQ_CODE_GRAFFITI) {
if (resultCode == GraffitiActivity.RESULT_OK) {
if (requestCode == REQ_CODE_DOODLE) {
if (resultCode == DoodleActivity.RESULT_OK) {
// 获取涂鸦后的图片
String path = data.getStringExtra(GraffitiActivity.KEY_IMAGE_PATH);
String path = data.getStringExtra(DoodleActivity.KEY_IMAGE_PATH);
...
} else if (resultCode == GraffitiActivity.RESULT_ERROR) {
} else if (resultCode == DoodleActivity.RESULT_ERROR) {
...
}
}
Expand All @@ -97,13 +97,13 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
/**
* 涂鸦参数
*/
public static class GraffitiParams implements Parcelable {
public static class DoodleParams implements Parcelable {
/**
* 图片路径
*/
public String mImagePath;
/**
*  保存路径,如果为null,则图片保存在根目录下/DCIM/Graffiti/
*  保存路径,如果为null,则图片保存在根目录下/DCIM/Doodle/
*/
public String mSavePath;
/**
Expand Down
5 changes: 2 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ android {
compileSdkVersion COMPILE_SDK_VERSION as int

defaultConfig {
applicationId "cn.hzw.graffitidemo"
applicationId "cn.hzw.doodledemo"
minSdkVersion MIN_SDK_VERSION as int
targetSdkVersion TARGET_SDK_VERSION as int
versionCode 1
Expand All @@ -21,7 +21,6 @@ android {

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':graffiti')
// compile project(':ImageSelctorLib-release')
compile project(':doodle')
compile 'cn.hzw.imageselector:library:1.0'
}
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cn.hzw.graffitidemo">
package="cn.hzw.doodledemo">

<application
android:allowBackup="true"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cn.hzw.graffitidemo;
package cn.hzw.doodledemo;

import android.app.Activity;
import android.content.Intent;
Expand All @@ -11,16 +11,16 @@
import java.util.ArrayList;

import cn.forward.androids.utils.LogUtil;
import cn.hzw.graffiti.GraffitiActivity;
import cn.hzw.graffiti.GraffitiParams;
import cn.hzw.graffiti.GraffitiView;
import cn.hzw.doodle.DoodleActivity;
import cn.hzw.doodle.DoodleParams;
import cn.hzw.doodle.DoodleView;
import cn.hzw.imageselector.ImageLoader;
import cn.hzw.imageselector.ImageSelectorActivity;

public class MainActivity extends Activity {

public static final int REQ_CODE_SELECT_IMAGE = 100;
public static final int REQ_CODE_GRAFFITI = 101;
public static final int REQ_CODE_DOODLE = 101;
private TextView mPath;

@Override
Expand All @@ -46,31 +46,31 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
}
ArrayList<String> list = data.getStringArrayListExtra(ImageSelectorActivity.KEY_PATH_LIST);
if (list != null && list.size() > 0) {
LogUtil.d("Graffiti", list.get(0));
LogUtil.d("Doodle", list.get(0));

// 涂鸦参数
GraffitiParams params = new GraffitiParams();
DoodleParams params = new DoodleParams();
params.mIsFullScreen = true;
// 图片路径
params.mImagePath = list.get(0);
// 初始画笔大小
params.mPaintUnitSize = GraffitiView.DEFAULT_SIZE;
params.mPaintUnitSize = DoodleView.DEFAULT_SIZE;
params.mAmplifierScale = 0;
// 启动涂鸦页面
GraffitiActivity.startActivityForResult(MainActivity.this, params, REQ_CODE_GRAFFITI);
DoodleActivity.startActivityForResult(MainActivity.this, params, REQ_CODE_DOODLE);
}
} else if (requestCode == REQ_CODE_GRAFFITI) {
} else if (requestCode == REQ_CODE_DOODLE) {
if (data == null) {
return;
}
if (resultCode == GraffitiActivity.RESULT_OK) {
String path = data.getStringExtra(GraffitiActivity.KEY_IMAGE_PATH);
if (resultCode == DoodleActivity.RESULT_OK) {
String path = data.getStringExtra(DoodleActivity.KEY_IMAGE_PATH);
if (TextUtils.isEmpty(path)) {
return;
}
ImageLoader.getInstance(this).display(findViewById(R.id.img), path);
mPath.setText(path);
} else if (resultCode == GraffitiActivity.RESULT_ERROR) {
} else if (resultCode == DoodleActivity.RESULT_ERROR) {
Toast.makeText(getApplicationContext(), "error", Toast.LENGTH_SHORT).show();
}
}
Expand Down
Binary file modified app/src/main/res/drawable-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="cn.hzw.graffitidemo.MainActivity">
tools:context="cn.hzw.doodledemo.MainActivity">

<Button
android:id="@+id/btn_select_image"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<resources>
<string name="app_name">Graffiti</string>
<string name="app_name">Doodle</string>
</resources>
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cn.hzw.graffiti">
package="cn.hzw.doodle">

<!-- 在SDCard中创建与删除文件权限 -->
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
<!-- 往SDCard写入数据权限 -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
>
<activity android:name=".GraffitiActivity"
<activity android:name=".DoodleActivity"
android:configChanges="screenSize|orientation|keyboardHidden|navigation|keyboard"
/>
</application>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package cn.hzw.graffiti;
package cn.hzw.doodle;

import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PointF;

import static cn.hzw.graffiti.util.DrawUtil.drawCircle;
import static cn.hzw.doodle.util.DrawUtil.drawCircle;

/**
* 仿制的定位器
Expand Down
Loading

0 comments on commit bcb8d2a

Please sign in to comment.