diff --git a/README.md b/README.md index f2e132b..e3f52ab 100644 --- a/README.md +++ b/README.md @@ -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); ``` @@ -60,10 +60,10 @@ dependencies { ```java /** - * 涂鸦界面,根据GraffitiView的接口,提供页面交互 + * 涂鸦界面,根据DoodleView的接口,提供页面交互 * */ -public class GraffitiActivity extends Activity { +public class DoodleActivity extends Activity { /** * 启动涂鸦界面 * @@ -71,9 +71,9 @@ public class GraffitiActivity extends 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); } } @@ -81,12 +81,12 @@ public class GraffitiActivity extends Activity { ```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) { ... } } @@ -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; /** diff --git a/app/build.gradle b/app/build.gradle index ba715db..5c84acf 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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 @@ -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' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 6121e5b..6d182e2 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,6 +1,6 @@ + package="cn.hzw.doodledemo"> 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(); } } diff --git a/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/app/src/main/res/drawable-xxhdpi/ic_launcher.png index 324e72c..bc261a2 100644 Binary files a/app/src/main/res/drawable-xxhdpi/ic_launcher.png and b/app/src/main/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/drawable/ic_launcher.png b/app/src/main/res/drawable/ic_launcher.png index cde69bc..ef07251 100644 Binary files a/app/src/main/res/drawable/ic_launcher.png and b/app/src/main/res/drawable/ic_launcher.png differ diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 6a65e5b..db4b621 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -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">