├── .gitignore
├── LICENSE
├── README.md
├── app
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── im4j
│ │ └── picturebeautify
│ │ └── demo
│ │ ├── FileUtils.java
│ │ └── MainActivity.java
│ └── res
│ ├── layout
│ └── activity_main.xml
│ ├── mipmap-xhdpi
│ └── ic_launcher.png
│ └── values
│ ├── colors.xml
│ ├── strings.xml
│ └── styles.xml
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── library
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── assets
│ ├── fonts
│ │ ├── GothamNarrow-Light.ttf
│ │ ├── Roboto-Black.ttf
│ │ ├── Roboto-BlackItalic.ttf
│ │ ├── Roboto-Bold.ttf
│ │ ├── Roboto-BoldCondensed.ttf
│ │ ├── Roboto-BoldCondensedItalic.ttf
│ │ ├── Roboto-BoldItalic.ttf
│ │ ├── Roboto-Condensed.ttf
│ │ ├── Roboto-CondensedItalic.ttf
│ │ ├── Roboto-Italic.ttf
│ │ ├── Roboto-Light.ttf
│ │ ├── Roboto-LightItalic.ttf
│ │ ├── Roboto-Medium.ttf
│ │ ├── Roboto-MediumItalic.ttf
│ │ ├── Roboto-Regular.ttf
│ │ ├── Roboto-Thin.ttf
│ │ └── Roboto-ThinItalic.ttf
│ └── stickers
│ │ ├── biankuang
│ │ ├── bianjiao1.png
│ │ ├── bianjiao2.png
│ │ ├── bianjiao3.png
│ │ └── bianjiao4.png
│ │ ├── chunjie
│ │ ├── xinnian1.png
│ │ ├── xinnian2.png
│ │ ├── xinnian3.png
│ │ ├── xinnian4.png
│ │ ├── xinnian5.png
│ │ ├── xinnian6.png
│ │ ├── xinnian7.png
│ │ ├── xinnian8.png
│ │ └── xinnian9.png
│ │ ├── cos
│ │ ├── cos1.png.svntmp
│ │ ├── cos10.png
│ │ ├── cos11.png
│ │ ├── cos12.png
│ │ ├── cos13.png
│ │ ├── cos14.png
│ │ ├── cos15.png
│ │ ├── cos16.png
│ │ ├── cos2.png
│ │ ├── cos3.png
│ │ ├── cos4.png
│ │ ├── cos5.png
│ │ ├── cos6.png
│ │ ├── cos7.png
│ │ ├── cos8.png
│ │ └── cos9.png
│ │ ├── dongwu
│ │ ├── 1dongwu1.png.svntmp
│ │ ├── 1dongwu10.png
│ │ ├── 1dongwu2.png
│ │ ├── 1dongwu3.png
│ │ ├── 1dongwu4.png
│ │ ├── 1dongwu5.png
│ │ ├── 1dongwu6.png
│ │ ├── 1dongwu7.png
│ │ ├── 1dongwu8.png
│ │ └── 1dongwu9.png
│ │ ├── fuhao
│ │ ├── fuhao1.png
│ │ ├── fuhao10.png
│ │ ├── fuhao2.png
│ │ ├── fuhao3.png
│ │ ├── fuhao4.png
│ │ ├── fuhao5.png
│ │ ├── fuhao6.png
│ │ ├── fuhao7.png
│ │ ├── fuhao8.png
│ │ └── fuhao9.png
│ │ ├── shipin
│ │ ├── shipin1.png
│ │ ├── shipin10.png
│ │ ├── shipin2.png
│ │ ├── shipin3.png
│ │ ├── shipin4.png
│ │ ├── shipin5.png
│ │ ├── shipin6.png
│ │ ├── shipin7.png
│ │ ├── shipin8.png
│ │ └── shipin9.png
│ │ ├── shuzi
│ │ ├── shuzi1.png
│ │ ├── shuzi10.png
│ │ ├── shuzi11.png
│ │ ├── shuzi12.png
│ │ ├── shuzi13.png
│ │ ├── shuzi14.png
│ │ ├── shuzi15.png
│ │ ├── shuzi2.png
│ │ ├── shuzi3.png
│ │ ├── shuzi4.png
│ │ ├── shuzi5.png
│ │ ├── shuzi6.png
│ │ ├── shuzi7.png
│ │ ├── shuzi8.png
│ │ └── shuzi9.png
│ │ ├── wenzi
│ │ ├── wenzi1.png
│ │ ├── wenzi10.png
│ │ ├── wenzi11.png
│ │ ├── wenzi12.png
│ │ ├── wenzi13.png
│ │ ├── wenzi14.png
│ │ ├── wenzi15.png
│ │ ├── wenzi16.png
│ │ ├── wenzi17.png
│ │ ├── wenzi18.png
│ │ ├── wenzi19.png
│ │ ├── wenzi2.png
│ │ ├── wenzi20.png
│ │ ├── wenzi3.png
│ │ ├── wenzi4.png
│ │ ├── wenzi5.png
│ │ ├── wenzi6.png
│ │ ├── wenzi7.png
│ │ ├── wenzi8.png
│ │ └── wenzi9.png
│ │ ├── xinqing
│ │ ├── 2xinqing1.png
│ │ ├── 2xinqing10.png
│ │ ├── 2xinqing11.png
│ │ ├── 2xinqing12.png
│ │ ├── 2xinqing13.png
│ │ ├── 2xinqing14.png
│ │ ├── 2xinqing15.png
│ │ ├── 2xinqing16.png
│ │ ├── 2xinqing17.png
│ │ ├── 2xinqing18.png
│ │ ├── 2xinqing19.png
│ │ ├── 2xinqing2.png
│ │ ├── 2xinqing20.png
│ │ ├── 2xinqing3.png
│ │ ├── 2xinqing4.png
│ │ ├── 2xinqing5.png
│ │ ├── 2xinqing6.png
│ │ ├── 2xinqing7.png
│ │ ├── 2xinqing8.png
│ │ └── 2xinqing9.png
│ │ └── zhiye
│ │ ├── zhiye1.png
│ │ ├── zhiye10.png
│ │ ├── zhiye2.png
│ │ ├── zhiye3.png
│ │ ├── zhiye4.png
│ │ ├── zhiye5.png
│ │ ├── zhiye6.png
│ │ ├── zhiye7.png
│ │ ├── zhiye8.png
│ │ └── zhiye9.png
│ ├── java
│ └── com
│ │ └── im4j
│ │ └── picturebeautify
│ │ ├── BaseActivity.java
│ │ ├── editimage
│ │ ├── EditImageActivity.java
│ │ ├── adapter
│ │ │ ├── FontTypeAdapter.java
│ │ │ ├── StickerAdapter.java
│ │ │ └── StickerTypeAdapter.java
│ │ ├── fragment
│ │ │ ├── CropFragment.java
│ │ │ ├── FliterListFragment.java
│ │ │ ├── MainMenuFragment.java
│ │ │ ├── RotateFragment.java
│ │ │ ├── StirckerFragment.java
│ │ │ └── TextFragment.java
│ │ ├── model
│ │ │ └── RatioItem.java
│ │ ├── utils
│ │ │ ├── BitmapUtils.java
│ │ │ ├── DimensionUtils.java
│ │ │ ├── Matrix3.java
│ │ │ ├── MatrixUtils.java
│ │ │ ├── PaintUtil.java
│ │ │ ├── PhotoUtils.java
│ │ │ └── PointUtils.java
│ │ └── view
│ │ │ ├── CropImageView.java
│ │ │ ├── CustomViewPager.java
│ │ │ ├── LabelTextView.java
│ │ │ ├── RotateImageView.java
│ │ │ ├── StickerItem.java
│ │ │ ├── StickerView.java
│ │ │ ├── TextItem.java
│ │ │ └── imagezoom
│ │ │ ├── ImageViewTouch.java
│ │ │ ├── ImageViewTouchBase.java
│ │ │ ├── easing
│ │ │ ├── Cubic.java
│ │ │ ├── Easing.java
│ │ │ └── Elastic.java
│ │ │ └── graphic
│ │ │ ├── FastBitmapDrawable.java
│ │ │ └── IBitmapDrawable.java
│ │ └── picchooser
│ │ ├── BucketItem.java
│ │ ├── BucketsFragment.java
│ │ ├── GalleryAdapter.java
│ │ ├── GridItem.java
│ │ ├── ImagesFragment.java
│ │ ├── SelectPictureActivity.java
│ │ └── SquareImageView.java
│ └── res
│ ├── anim
│ ├── in_bottom_to_top.xml
│ └── out_bottom_to_top.xml
│ ├── drawable-hdpi
│ ├── button_back_default.png
│ ├── button_back_pressed.png
│ ├── crop_normal.png
│ ├── crop_pressed.png
│ ├── fliters_normal.png
│ ├── fliters_pressed.png
│ ├── font_normal.png
│ ├── font_pressed.png
│ ├── ic_menu_gallery.png
│ ├── image_edit_back.png
│ ├── sticker_delete.png
│ ├── sticker_normal.png
│ ├── sticker_pressed.png
│ ├── sticker_rotate.png
│ ├── stickers_type_animal.png
│ ├── stickers_type_cos.png
│ ├── stickers_type_decoration.png
│ ├── stickers_type_frame.png
│ ├── stickers_type_mark.png
│ ├── stickers_type_motion.png
│ ├── stickers_type_number.png
│ ├── stickers_type_profession.png
│ ├── stickers_type_spring.png
│ ├── stickers_type_text.png
│ ├── texture_normal.png
│ ├── texture_pressed.png
│ └── yd_image_tx.png
│ ├── drawable
│ ├── btn_back_selector.xml
│ ├── image_edit_icon_crop.xml
│ ├── image_edit_icon_filter.xml
│ ├── image_edit_icon_rotate.xml
│ ├── image_edit_icon_sticker.xml
│ ├── image_edit_icon_text.xml
│ └── shape_rect.xml
│ ├── layout
│ ├── activity_image_edit.xml
│ ├── activity_main.xml
│ ├── bucketitem.xml
│ ├── dialog_input.xml
│ ├── fragment_edit_image_crop.xml
│ ├── fragment_edit_image_fliter.xml
│ ├── fragment_edit_image_main_menu.xml
│ ├── fragment_edit_image_rotate.xml
│ ├── fragment_edit_image_sticker_type.xml
│ ├── fragment_edit_image_text.xml
│ ├── gallery.xml
│ ├── imageitem.xml
│ ├── view_font_item.xml
│ ├── view_sticker_item.xml
│ └── view_sticker_type_item.xml
│ └── values
│ ├── dimens.xml
│ └── strings.xml
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 |
5 | # Files for the Dalvik VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # Generated files
12 | bin/
13 | gen/
14 |
15 | # Gradle files
16 | .gradle/
17 | build/
18 |
19 | # Local configuration file (sdk path, etc)
20 | local.properties
21 |
22 | # Proguard folder generated by Eclipse
23 | proguard/
24 |
25 | # Log Files
26 | *.log
27 |
28 | # Android Studio Navigation editor temp files
29 | .navigation/
30 |
31 | # Android Studio captures folder
32 | captures/
33 |
34 | *.iml
35 | /.idea
36 | .DS_Store
37 |
38 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # AndroidImageEditor
2 |
3 | AndroidImageEditor 安卓设备上图形编辑开源控件,支持自定义贴图 图片滤镜 图片旋转 以及图片剪裁操作
4 |
5 | For edit image,supply stickers filter rotate crop
6 |
7 | 动态效果图
8 |
9 |
10 |
11 |
12 |
13 |
14 | 效果图
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | 使用方法:见DEMO示例
29 |
30 |
31 | usage:see the demo project
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.2"
6 |
7 | defaultConfig {
8 | applicationId "com.im4j.picturebeautify.demo"
9 | minSdkVersion 11
10 | targetSdkVersion 23
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:23.1.1'
25 | compile project(':library')
26 | }
27 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/king/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
13 |
14 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
28 |
29 |
30 |
31 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/java/com/im4j/picturebeautify/demo/FileUtils.java:
--------------------------------------------------------------------------------
1 | package com.im4j.picturebeautify.demo;
2 |
3 | import java.io.File;
4 | import java.io.FileOutputStream;
5 | import java.io.IOException;
6 |
7 | import android.content.Context;
8 | import android.graphics.Bitmap;
9 | import android.net.ConnectivityManager;
10 | import android.net.NetworkInfo;
11 | import android.os.Environment;
12 |
13 | /**
14 | * 文件相关辅助类
15 | *
16 | * @author panyi
17 | *
18 | */
19 | public class FileUtils {
20 | public static final String FOLDER_NAME = "xinlanedit";
21 |
22 | /**
23 | * 获取存贮文件的文件夹路径
24 | *
25 | * @return
26 | */
27 | public static File createFolders() {
28 | File baseDir;
29 | if (android.os.Build.VERSION.SDK_INT < 8) {
30 | baseDir = Environment.getExternalStorageDirectory();
31 | } else {
32 | baseDir = Environment
33 | .getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
34 | }
35 | if (baseDir == null)
36 | return Environment.getExternalStorageDirectory();
37 | File aviaryFolder = new File(baseDir, FOLDER_NAME);
38 | if (aviaryFolder.exists())
39 | return aviaryFolder;
40 | if (aviaryFolder.isFile())
41 | aviaryFolder.delete();
42 | if (aviaryFolder.mkdirs())
43 | return aviaryFolder;
44 | return Environment.getExternalStorageDirectory();
45 | }
46 |
47 | public static File getEmptyFile(String name) {
48 | File folder = FileUtils.createFolders();
49 | if (folder != null) {
50 | if (folder.exists()) {
51 | File file = new File(folder, name);
52 | return file;
53 | }
54 | }
55 | return null;
56 | }
57 |
58 | }// end
59 |
--------------------------------------------------------------------------------
/app/src/main/java/com/im4j/picturebeautify/demo/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.im4j.picturebeautify.demo;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.Intent;
5 | import android.graphics.Bitmap;
6 | import android.graphics.BitmapFactory;
7 | import android.os.AsyncTask;
8 | import android.os.Build;
9 | import android.os.Bundle;
10 | import android.support.v7.app.AppCompatActivity;
11 | import android.text.TextUtils;
12 | import android.util.DisplayMetrics;
13 | import android.view.View;
14 | import android.widget.ImageView;
15 | import android.widget.Toast;
16 |
17 | import com.im4j.picturebeautify.editimage.EditImageActivity;
18 | import com.im4j.picturebeautify.picchooser.SelectPictureActivity;
19 |
20 | import java.io.File;
21 |
22 | public class MainActivity extends AppCompatActivity {
23 | public static final int SELECT_GALLERY_IMAGE_CODE = 7;
24 | public static final int ACTION_REQUEST_EDITIMAGE = 9;
25 | private ImageView imgView;
26 | private Bitmap mainBitmap;
27 | private int imageWidth, imageHeight;//
28 | private String path;
29 |
30 | @Override
31 | public void onCreate(Bundle savedInstanceState) {
32 | super.onCreate(savedInstanceState);
33 | setContentView(R.layout.activity_main);
34 | initView();
35 | }
36 |
37 | private void initView() {
38 | DisplayMetrics metrics = getResources().getDisplayMetrics();
39 | imageWidth = (int) ((float) metrics.widthPixels / 1.5);
40 | imageHeight = (int) ((float) metrics.heightPixels / 1.5);
41 |
42 | imgView = (ImageView) findViewById(R.id.img);
43 |
44 | findViewById(R.id.select_ablum).setOnClickListener(new SelectClick());
45 | findViewById(R.id.edit_image).setOnClickListener(new EditImageClick());
46 | }
47 |
48 | /**
49 | * 编辑选择的图片
50 | *
51 | * @author panyi
52 | */
53 | private final class EditImageClick implements View.OnClickListener {
54 | @Override
55 | public void onClick(View v) {
56 | if (TextUtils.isEmpty(path)) {
57 | Toast.makeText(MainActivity.this, R.string.no_choose, Toast.LENGTH_SHORT).show();
58 | return;
59 | }
60 |
61 | Intent it = new Intent(MainActivity.this, EditImageActivity.class);
62 | it.putExtra(EditImageActivity.FILE_PATH, path);
63 | File outputFile = FileUtils.getEmptyFile("tietu"
64 | + System.currentTimeMillis() + ".jpg");
65 | it.putExtra(EditImageActivity.EXTRA_OUTPUT,
66 | outputFile.getAbsolutePath());
67 | MainActivity.this.startActivityForResult(it,
68 | ACTION_REQUEST_EDITIMAGE);
69 | }
70 | }// end inner class
71 |
72 | private final class SelectClick implements View.OnClickListener {
73 | @Override
74 | public void onClick(View v) {
75 | MainActivity.this.startActivityForResult(new Intent(
76 | MainActivity.this, SelectPictureActivity.class),
77 | SELECT_GALLERY_IMAGE_CODE);
78 | }
79 | }// end inner class
80 |
81 | @Override
82 | protected void onActivityResult(int requestCode, int resultCode, Intent data) {
83 | super.onActivityResult(requestCode, resultCode, data);
84 | if (resultCode == RESULT_OK) {
85 | switch (requestCode) {
86 | case SELECT_GALLERY_IMAGE_CODE://
87 | handleSelectFromAblum(data);
88 | break;
89 | case ACTION_REQUEST_EDITIMAGE://
90 | handleEditorImage(data);
91 | break;
92 | }
93 | }
94 | }
95 |
96 | private void handleEditorImage(Intent data) {
97 | String newFilePath = data.getStringExtra("save_file_path");
98 | Toast.makeText(this, "new image path: " + newFilePath, Toast.LENGTH_LONG).show();
99 | LoadImageTask loadTask = new LoadImageTask();
100 | loadTask.execute(newFilePath);
101 | }
102 |
103 | private void handleSelectFromAblum(Intent data) {
104 | path = data.getStringExtra("imgPath");
105 | LoadImageTask task = new LoadImageTask();
106 | task.execute(path);
107 | }
108 |
109 |
110 | private final class LoadImageTask extends AsyncTask {
111 | @Override
112 | protected Bitmap doInBackground(String... params) {
113 | return getSampledBitmap(params[0], imageWidth, imageHeight);
114 | }
115 |
116 | @Override
117 | protected void onCancelled() {
118 | super.onCancelled();
119 | }
120 |
121 | @TargetApi(Build.VERSION_CODES.HONEYCOMB)
122 | @Override
123 | protected void onCancelled(Bitmap result) {
124 | super.onCancelled(result);
125 | }
126 |
127 | @Override
128 | protected void onPreExecute() {
129 | super.onPreExecute();
130 | }
131 |
132 | @Override
133 | protected void onPostExecute(Bitmap result) {
134 | super.onPostExecute(result);
135 | if (mainBitmap != null) {
136 | mainBitmap.recycle();
137 | mainBitmap = null;
138 | System.gc();
139 | }
140 | mainBitmap = result;
141 | imgView.setImageBitmap(mainBitmap);
142 | }
143 | }// end inner class
144 |
145 | public static Bitmap getSampledBitmap(String filePath, int reqWidth,
146 | int reqHeight) {
147 | BitmapFactory.Options options = new BitmapFactory.Options();
148 | options.inJustDecodeBounds = true;
149 |
150 | BitmapFactory.decodeFile(filePath, options);
151 |
152 | // Raw height and width of image
153 | final int height = options.outHeight;
154 | final int width = options.outWidth;
155 | int inSampleSize = 1;
156 |
157 | if (height > reqHeight || width > reqWidth) {
158 | if (width > height) {
159 | inSampleSize = (int) Math.floor(((float) height / reqHeight) + 0.5f); // Math.round((float)height
160 | // /
161 | // (float)reqHeight);
162 | } else {
163 | inSampleSize = (int) Math.floor(((float) width / reqWidth) + 0.5f); // Math.round((float)width
164 | // /
165 | // (float)reqWidth);
166 | }
167 | }
168 | // System.out.println("inSampleSize--->"+inSampleSize);
169 |
170 | options.inSampleSize = inSampleSize;
171 | options.inJustDecodeBounds = false;
172 |
173 | return BitmapFactory.decodeFile(filePath, options);
174 | }
175 | }//end class
176 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
10 |
11 |
17 |
18 |
23 |
24 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | 图片美化Demo
3 |
4 | please choose a image for edit
5 | choose a image for edit
6 | edit image
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.0.0-beta6'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Mar 01 22:44:48 CST 2016
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/library/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.2"
6 |
7 | defaultConfig {
8 | minSdkVersion 11
9 | targetSdkVersion 23
10 | versionCode 1
11 | versionName "1.0"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | compile fileTree(dir: 'libs', include: ['*.jar'])
23 | compile 'com.android.support:appcompat-v7:23.1.1'
24 | compile 'com.android.support:recyclerview-v7:23.1.1'
25 | compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
26 | compile 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.3.0'
27 | }
28 |
--------------------------------------------------------------------------------
/library/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/king/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/library/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/library/src/main/assets/fonts/GothamNarrow-Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/fonts/GothamNarrow-Light.ttf
--------------------------------------------------------------------------------
/library/src/main/assets/fonts/Roboto-Black.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/fonts/Roboto-Black.ttf
--------------------------------------------------------------------------------
/library/src/main/assets/fonts/Roboto-BlackItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/fonts/Roboto-BlackItalic.ttf
--------------------------------------------------------------------------------
/library/src/main/assets/fonts/Roboto-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/fonts/Roboto-Bold.ttf
--------------------------------------------------------------------------------
/library/src/main/assets/fonts/Roboto-BoldCondensed.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/fonts/Roboto-BoldCondensed.ttf
--------------------------------------------------------------------------------
/library/src/main/assets/fonts/Roboto-BoldCondensedItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/fonts/Roboto-BoldCondensedItalic.ttf
--------------------------------------------------------------------------------
/library/src/main/assets/fonts/Roboto-BoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/fonts/Roboto-BoldItalic.ttf
--------------------------------------------------------------------------------
/library/src/main/assets/fonts/Roboto-Condensed.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/fonts/Roboto-Condensed.ttf
--------------------------------------------------------------------------------
/library/src/main/assets/fonts/Roboto-CondensedItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/fonts/Roboto-CondensedItalic.ttf
--------------------------------------------------------------------------------
/library/src/main/assets/fonts/Roboto-Italic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/fonts/Roboto-Italic.ttf
--------------------------------------------------------------------------------
/library/src/main/assets/fonts/Roboto-Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/fonts/Roboto-Light.ttf
--------------------------------------------------------------------------------
/library/src/main/assets/fonts/Roboto-LightItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/fonts/Roboto-LightItalic.ttf
--------------------------------------------------------------------------------
/library/src/main/assets/fonts/Roboto-Medium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/fonts/Roboto-Medium.ttf
--------------------------------------------------------------------------------
/library/src/main/assets/fonts/Roboto-MediumItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/fonts/Roboto-MediumItalic.ttf
--------------------------------------------------------------------------------
/library/src/main/assets/fonts/Roboto-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/fonts/Roboto-Regular.ttf
--------------------------------------------------------------------------------
/library/src/main/assets/fonts/Roboto-Thin.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/fonts/Roboto-Thin.ttf
--------------------------------------------------------------------------------
/library/src/main/assets/fonts/Roboto-ThinItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/fonts/Roboto-ThinItalic.ttf
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/biankuang/bianjiao1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/biankuang/bianjiao1.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/biankuang/bianjiao2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/biankuang/bianjiao2.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/biankuang/bianjiao3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/biankuang/bianjiao3.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/biankuang/bianjiao4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/biankuang/bianjiao4.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/chunjie/xinnian1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/chunjie/xinnian1.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/chunjie/xinnian2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/chunjie/xinnian2.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/chunjie/xinnian3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/chunjie/xinnian3.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/chunjie/xinnian4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/chunjie/xinnian4.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/chunjie/xinnian5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/chunjie/xinnian5.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/chunjie/xinnian6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/chunjie/xinnian6.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/chunjie/xinnian7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/chunjie/xinnian7.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/chunjie/xinnian8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/chunjie/xinnian8.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/chunjie/xinnian9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/chunjie/xinnian9.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/cos/cos1.png.svntmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/cos/cos1.png.svntmp
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/cos/cos10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/cos/cos10.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/cos/cos11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/cos/cos11.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/cos/cos12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/cos/cos12.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/cos/cos13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/cos/cos13.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/cos/cos14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/cos/cos14.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/cos/cos15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/cos/cos15.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/cos/cos16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/cos/cos16.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/cos/cos2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/cos/cos2.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/cos/cos3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/cos/cos3.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/cos/cos4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/cos/cos4.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/cos/cos5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/cos/cos5.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/cos/cos6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/cos/cos6.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/cos/cos7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/cos/cos7.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/cos/cos8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/cos/cos8.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/cos/cos9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/cos/cos9.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/dongwu/1dongwu1.png.svntmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/dongwu/1dongwu1.png.svntmp
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/dongwu/1dongwu10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/dongwu/1dongwu10.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/dongwu/1dongwu2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/dongwu/1dongwu2.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/dongwu/1dongwu3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/dongwu/1dongwu3.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/dongwu/1dongwu4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/dongwu/1dongwu4.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/dongwu/1dongwu5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/dongwu/1dongwu5.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/dongwu/1dongwu6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/dongwu/1dongwu6.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/dongwu/1dongwu7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/dongwu/1dongwu7.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/dongwu/1dongwu8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/dongwu/1dongwu8.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/dongwu/1dongwu9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/dongwu/1dongwu9.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/fuhao/fuhao1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/fuhao/fuhao1.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/fuhao/fuhao10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/fuhao/fuhao10.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/fuhao/fuhao2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/fuhao/fuhao2.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/fuhao/fuhao3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/fuhao/fuhao3.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/fuhao/fuhao4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/fuhao/fuhao4.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/fuhao/fuhao5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/fuhao/fuhao5.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/fuhao/fuhao6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/fuhao/fuhao6.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/fuhao/fuhao7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/fuhao/fuhao7.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/fuhao/fuhao8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/fuhao/fuhao8.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/fuhao/fuhao9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/fuhao/fuhao9.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/shipin/shipin1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/shipin/shipin1.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/shipin/shipin10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/shipin/shipin10.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/shipin/shipin2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/shipin/shipin2.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/shipin/shipin3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/shipin/shipin3.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/shipin/shipin4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/shipin/shipin4.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/shipin/shipin5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/shipin/shipin5.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/shipin/shipin6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/shipin/shipin6.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/shipin/shipin7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/shipin/shipin7.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/shipin/shipin8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/shipin/shipin8.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/shipin/shipin9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/shipin/shipin9.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/shuzi/shuzi1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/shuzi/shuzi1.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/shuzi/shuzi10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/shuzi/shuzi10.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/shuzi/shuzi11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/shuzi/shuzi11.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/shuzi/shuzi12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/shuzi/shuzi12.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/shuzi/shuzi13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/shuzi/shuzi13.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/shuzi/shuzi14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/shuzi/shuzi14.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/shuzi/shuzi15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/shuzi/shuzi15.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/shuzi/shuzi2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/shuzi/shuzi2.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/shuzi/shuzi3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/shuzi/shuzi3.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/shuzi/shuzi4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/shuzi/shuzi4.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/shuzi/shuzi5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/shuzi/shuzi5.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/shuzi/shuzi6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/shuzi/shuzi6.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/shuzi/shuzi7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/shuzi/shuzi7.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/shuzi/shuzi8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/shuzi/shuzi8.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/shuzi/shuzi9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/shuzi/shuzi9.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/wenzi/wenzi1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/wenzi/wenzi1.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/wenzi/wenzi10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/wenzi/wenzi10.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/wenzi/wenzi11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/wenzi/wenzi11.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/wenzi/wenzi12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/wenzi/wenzi12.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/wenzi/wenzi13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/wenzi/wenzi13.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/wenzi/wenzi14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/wenzi/wenzi14.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/wenzi/wenzi15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/wenzi/wenzi15.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/wenzi/wenzi16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/wenzi/wenzi16.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/wenzi/wenzi17.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/wenzi/wenzi17.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/wenzi/wenzi18.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/wenzi/wenzi18.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/wenzi/wenzi19.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/wenzi/wenzi19.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/wenzi/wenzi2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/wenzi/wenzi2.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/wenzi/wenzi20.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/wenzi/wenzi20.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/wenzi/wenzi3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/wenzi/wenzi3.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/wenzi/wenzi4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/wenzi/wenzi4.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/wenzi/wenzi5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/wenzi/wenzi5.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/wenzi/wenzi6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/wenzi/wenzi6.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/wenzi/wenzi7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/wenzi/wenzi7.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/wenzi/wenzi8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/wenzi/wenzi8.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/wenzi/wenzi9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/wenzi/wenzi9.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/xinqing/2xinqing1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/xinqing/2xinqing1.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/xinqing/2xinqing10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/xinqing/2xinqing10.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/xinqing/2xinqing11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/xinqing/2xinqing11.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/xinqing/2xinqing12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/xinqing/2xinqing12.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/xinqing/2xinqing13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/xinqing/2xinqing13.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/xinqing/2xinqing14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/xinqing/2xinqing14.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/xinqing/2xinqing15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/xinqing/2xinqing15.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/xinqing/2xinqing16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/xinqing/2xinqing16.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/xinqing/2xinqing17.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/xinqing/2xinqing17.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/xinqing/2xinqing18.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/xinqing/2xinqing18.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/xinqing/2xinqing19.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/xinqing/2xinqing19.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/xinqing/2xinqing2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/xinqing/2xinqing2.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/xinqing/2xinqing20.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/xinqing/2xinqing20.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/xinqing/2xinqing3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/xinqing/2xinqing3.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/xinqing/2xinqing4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/xinqing/2xinqing4.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/xinqing/2xinqing5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/xinqing/2xinqing5.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/xinqing/2xinqing6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/xinqing/2xinqing6.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/xinqing/2xinqing7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/xinqing/2xinqing7.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/xinqing/2xinqing8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/xinqing/2xinqing8.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/xinqing/2xinqing9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/xinqing/2xinqing9.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/zhiye/zhiye1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/zhiye/zhiye1.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/zhiye/zhiye10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/zhiye/zhiye10.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/zhiye/zhiye2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/zhiye/zhiye2.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/zhiye/zhiye3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/zhiye/zhiye3.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/zhiye/zhiye4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/zhiye/zhiye4.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/zhiye/zhiye5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/zhiye/zhiye5.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/zhiye/zhiye6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/zhiye/zhiye6.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/zhiye/zhiye7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/zhiye/zhiye7.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/zhiye/zhiye8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/zhiye/zhiye8.png
--------------------------------------------------------------------------------
/library/src/main/assets/stickers/zhiye/zhiye9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/assets/stickers/zhiye/zhiye9.png
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/BaseActivity.java:
--------------------------------------------------------------------------------
1 | package com.im4j.picturebeautify;
2 |
3 | import android.app.Dialog;
4 | import android.app.ProgressDialog;
5 | import android.content.Context;
6 | import android.support.v7.app.AppCompatActivity;
7 |
8 | import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache;
9 | import com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator;
10 | import com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache;
11 | import com.nostra13.universalimageloader.core.DisplayImageOptions;
12 | import com.nostra13.universalimageloader.core.ImageLoader;
13 | import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
14 | import com.nostra13.universalimageloader.core.assist.QueueProcessingType;
15 | import com.nostra13.universalimageloader.core.decode.BaseImageDecoder;
16 | import com.nostra13.universalimageloader.core.download.BaseImageDownloader;
17 | import com.nostra13.universalimageloader.utils.StorageUtils;
18 |
19 | import java.io.File;
20 |
21 | public class BaseActivity extends AppCompatActivity {
22 |
23 | /**
24 | * 检测图片载入框架是否导入 若没有 则导入并初始化
25 | */
26 | protected void checkInitImageLoader() {
27 | if (!ImageLoader.getInstance().isInited()) {
28 | initImageLoader();
29 | }//end if
30 | }
31 |
32 | /**
33 | * 初始化图片载入框架
34 | */
35 | private void initImageLoader() {
36 | File cacheDir = StorageUtils.getCacheDirectory(this);
37 | int MAXMEMONRY = (int) (Runtime.getRuntime().maxMemory());
38 | // System.out.println("dsa-->"+MAXMEMONRY+" "+(MAXMEMONRY/5));//.memoryCache(new
39 | // LruMemoryCache(50 * 1024 * 1024))
40 | DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
41 | .cacheInMemory(true)
42 | .cacheOnDisk(true)
43 | .build();
44 | ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
45 | this).memoryCacheExtraOptions(480, 800).defaultDisplayImageOptions(defaultOptions)
46 | .diskCacheExtraOptions(480, 800, null).threadPoolSize(3)
47 | .threadPriority(Thread.NORM_PRIORITY - 2)
48 | .tasksProcessingOrder(QueueProcessingType.FIFO)
49 | .denyCacheImageMultipleSizesInMemory()
50 | .memoryCache(new LruMemoryCache(MAXMEMONRY / 5))
51 | .diskCache(new UnlimitedDiskCache(cacheDir))
52 | .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
53 | .imageDownloader(new BaseImageDownloader(this)) // default
54 | .imageDecoder(new BaseImageDecoder(false)) // default
55 | .defaultDisplayImageOptions(DisplayImageOptions.createSimple()).build();
56 |
57 | ImageLoader.getInstance().init(config);
58 | }
59 |
60 |
61 | public static Dialog getLoadingDialog(Context context, String title,
62 | boolean canCancel) {
63 | ProgressDialog dialog = new ProgressDialog(context);
64 | dialog.setCancelable(canCancel);
65 | dialog.setMessage(title);
66 | return dialog;
67 | }
68 | }//end class
69 |
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/editimage/adapter/FontTypeAdapter.java:
--------------------------------------------------------------------------------
1 | package com.im4j.picturebeautify.editimage.adapter;
2 |
3 | import android.content.res.AssetManager;
4 | import android.graphics.Typeface;
5 | import android.support.v7.widget.RecyclerView;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.TextView;
10 |
11 | import com.im4j.picturebeautify.R;
12 |
13 | import java.util.List;
14 |
15 | /**
16 | * Created by fostion on 2/23/16.
17 | */
18 | public class FontTypeAdapter extends RecyclerView.Adapter {
19 |
20 | private AssetManager assetManager;
21 | private List fontTypes;
22 | private OnItemClickListener onItemClickListener;
23 |
24 | public FontTypeAdapter(AssetManager _assetManager,List _fontTypes){
25 | this.assetManager = _assetManager;
26 | this.fontTypes = _fontTypes;
27 | }
28 |
29 | @Override
30 | public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
31 | View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_font_item, parent,false);
32 | return new FontHolder(view) ;
33 | }
34 |
35 | @Override
36 | public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
37 | if(holder instanceof FontHolder){
38 | ((FontHolder) holder).setData(position);
39 | }
40 |
41 | }
42 |
43 | @Override
44 | public int getItemCount() {
45 | return fontTypes.size();
46 | }
47 |
48 | public class FontHolder extends RecyclerView.ViewHolder {
49 | public TextView text;
50 |
51 | public FontHolder(View itemView) {
52 | super(itemView);
53 | this.text = (TextView) itemView.findViewById(R.id.text);
54 |
55 | }
56 |
57 | public void setData(final int position){
58 | final Typeface typeface = Typeface.createFromAsset(assetManager,fontTypes.get(position));
59 | text.setTypeface(typeface);
60 | itemView.setOnClickListener(new View.OnClickListener() {
61 | @Override
62 | public void onClick(View v) {
63 | if(onItemClickListener != null){
64 | onItemClickListener.onItemClick(typeface);
65 | }
66 | }
67 | });
68 | }
69 |
70 | }// end inner class
71 |
72 | public OnItemClickListener getOnItemClickListener() {
73 | return onItemClickListener;
74 | }
75 |
76 | public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
77 | this.onItemClickListener = onItemClickListener;
78 | }
79 |
80 | public interface OnItemClickListener{
81 | void onItemClick(Typeface typeface);
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/editimage/adapter/StickerAdapter.java:
--------------------------------------------------------------------------------
1 | package com.im4j.picturebeautify.editimage.adapter;
2 |
3 | import java.io.File;
4 | import java.io.IOException;
5 | import java.util.ArrayList;
6 | import java.util.List;
7 |
8 | import android.support.v7.widget.RecyclerView;
9 | import android.support.v7.widget.RecyclerView.ViewHolder;
10 | import android.view.LayoutInflater;
11 | import android.view.View;
12 | import android.view.View.OnClickListener;
13 | import android.view.ViewGroup;
14 | import android.widget.ImageView;
15 |
16 | import com.im4j.picturebeautify.R;
17 | import com.nostra13.universalimageloader.core.DisplayImageOptions;
18 | import com.nostra13.universalimageloader.core.ImageLoader;
19 | import com.im4j.picturebeautify.editimage.fragment.StirckerFragment;
20 |
21 |
22 | /**
23 | * 贴图分类列表Adapter
24 | *
25 | * @author panyi
26 | *
27 | */
28 | public class StickerAdapter extends RecyclerView.Adapter {
29 | public DisplayImageOptions imageOption = new DisplayImageOptions.Builder()
30 | .cacheInMemory(true).showImageOnLoading(R.drawable.yd_image_tx)
31 | .build();// 下载图片显示
32 |
33 | private StirckerFragment mStirckerFragment;
34 | private ImageClick mImageClick = new ImageClick();
35 | private List pathList = new ArrayList();// 图片路径列表
36 |
37 | public StickerAdapter(StirckerFragment fragment) {
38 | super();
39 | this.mStirckerFragment = fragment;
40 | }
41 |
42 | public class ImageHolder extends ViewHolder {
43 | public ImageView image;
44 |
45 | public ImageHolder(View itemView) {
46 | super(itemView);
47 | this.image = (ImageView) itemView.findViewById(R.id.img);
48 | }
49 | }// end inner class
50 |
51 | @Override
52 | public int getItemCount() {
53 | return pathList.size();
54 | }
55 |
56 | @Override
57 | public int getItemViewType(int position) {
58 | return 1;
59 | }
60 |
61 | @Override
62 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewtype) {
63 | View v = null;
64 | v = LayoutInflater.from(parent.getContext()).inflate(
65 | R.layout.view_sticker_item, null);
66 | ImageHolder holer = new ImageHolder(v);
67 | return holer;
68 | }
69 |
70 | @Override
71 | public void onBindViewHolder(ViewHolder holder, int position) {
72 | ImageHolder imageHoler = (ImageHolder) holder;
73 | String path = pathList.get(position);
74 | System.out.println(path);
75 | ImageLoader.getInstance().displayImage("assets://" + path,
76 | imageHoler.image, imageOption);
77 | imageHoler.image.setTag(path);
78 | imageHoler.image.setOnClickListener(mImageClick);
79 | }
80 |
81 | public void addStickerImages(String folderPath) {
82 | pathList.clear();
83 | try {
84 | String[] files = mStirckerFragment.getActivity().getAssets()
85 | .list(folderPath);
86 | for (String name : files) {
87 | pathList.add(folderPath + File.separator + name);
88 | }
89 | } catch (IOException e) {
90 | e.printStackTrace();
91 | }
92 | this.notifyDataSetChanged();
93 | }
94 |
95 | /**
96 | * 选择贴图
97 | *
98 | * @author panyi
99 | *
100 | */
101 | private final class ImageClick implements OnClickListener {
102 | @Override
103 | public void onClick(View v) {
104 | String data = (String) v.getTag();
105 | //System.out.println("data---->" + data);
106 | mStirckerFragment.selectedStickerItem(data);
107 | }
108 | }// end inner class
109 |
110 | }// end class
111 |
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/editimage/adapter/StickerTypeAdapter.java:
--------------------------------------------------------------------------------
1 | package com.im4j.picturebeautify.editimage.adapter;
2 |
3 | import android.support.v7.widget.RecyclerView;
4 | import android.support.v7.widget.RecyclerView.ViewHolder;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.View.OnClickListener;
8 | import android.view.ViewGroup;
9 | import android.widget.ImageView;
10 | import android.widget.TextView;
11 |
12 | import com.im4j.picturebeautify.R;
13 | import com.im4j.picturebeautify.editimage.fragment.StirckerFragment;
14 |
15 |
16 | /**
17 | * 贴图分类列表Adapter
18 | *
19 | * @author panyi
20 | */
21 | public class StickerTypeAdapter extends RecyclerView.Adapter {
22 | public static final int[] typeIcon = {R.drawable.stickers_type_animal,
23 | R.drawable.stickers_type_motion, R.drawable.stickers_type_cos,
24 | R.drawable.stickers_type_mark, R.drawable.stickers_type_decoration,
25 | R.drawable.stickers_type_spring, R.drawable.stickers_type_text,
26 | R.drawable.stickers_type_number, R.drawable.stickers_type_frame,
27 | R.drawable.stickers_type_profession};
28 | public static final String[] stickerPath = {"stickers/dongwu",
29 | "stickers/xinqing", "stickers/cos", "stickers/fuhao",
30 | "stickers/shipin", "stickers/chunjie", "stickers/wenzi",
31 | "stickers/shuzi", "stickers/biankuang", "stickers/zhiye"};
32 | public static final String[] stickerPathName = {"动物", "心情", "cos", "符号",
33 | "饰品", "春节", "文字", "数字", "边框", "职业"};
34 | private StirckerFragment mStirckerFragment;
35 | private ImageClick mImageClick = new ImageClick();
36 |
37 | public StickerTypeAdapter(StirckerFragment fragment) {
38 | super();
39 | this.mStirckerFragment = fragment;
40 | }
41 |
42 | public class ImageHolder extends ViewHolder {
43 | public ImageView icon;
44 | public TextView text;
45 |
46 | public ImageHolder(View itemView) {
47 | super(itemView);
48 | this.icon = (ImageView) itemView.findViewById(R.id.icon);
49 | this.text = (TextView) itemView.findViewById(R.id.text);
50 | }
51 | }// end inner class
52 |
53 | @Override
54 | public int getItemCount() {
55 | return stickerPathName.length;
56 | }
57 |
58 | @Override
59 | public int getItemViewType(int position) {
60 | return 1;
61 | }
62 |
63 | @Override
64 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewtype) {
65 | View v = null;
66 | v = LayoutInflater.from(parent.getContext()).inflate(
67 | R.layout.view_sticker_type_item, null);
68 | ImageHolder holer = new ImageHolder(v);
69 | return holer;
70 | }
71 |
72 | /**
73 | */
74 | @Override
75 | public void onBindViewHolder(ViewHolder holder, int position) {
76 | ImageHolder imageHoler = (ImageHolder) holder;
77 | // imageHoler.icon.setImageResource(R.drawable.ic_launcher);
78 | String name = stickerPathName[position];
79 | imageHoler.text.setText(name);
80 | // TODO
81 | imageHoler.icon.setImageResource(typeIcon[position]);
82 | imageHoler.icon.setTag(stickerPath[position]);
83 | imageHoler.icon.setOnClickListener(mImageClick);
84 | }
85 |
86 | /**
87 | * 选择贴图类型
88 | *
89 | * @author panyi
90 | */
91 | private final class ImageClick implements OnClickListener {
92 | @Override
93 | public void onClick(View v) {
94 | String data = (String) v.getTag();
95 | // System.out.println("data---->" + data);
96 | mStirckerFragment.swipToStickerDetails(data);
97 | }
98 | }// end inner class
99 | }// end class
100 |
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/editimage/fragment/CropFragment.java:
--------------------------------------------------------------------------------
1 | package com.im4j.picturebeautify.editimage.fragment;
2 |
3 | import java.io.File;
4 | import java.io.FileNotFoundException;
5 | import java.io.FileOutputStream;
6 | import java.io.IOException;
7 | import java.util.ArrayList;
8 | import java.util.List;
9 |
10 | import android.annotation.TargetApi;
11 | import android.app.Dialog;
12 | import android.graphics.Bitmap;
13 | import android.graphics.Color;
14 | import android.graphics.Matrix;
15 | import android.graphics.RectF;
16 | import android.os.AsyncTask;
17 | import android.os.Build;
18 | import android.os.Bundle;
19 | import android.support.v4.app.Fragment;
20 | import android.view.Gravity;
21 | import android.view.LayoutInflater;
22 | import android.view.View;
23 | import android.view.View.OnClickListener;
24 | import android.view.ViewGroup;
25 | import android.widget.LinearLayout;
26 | import android.widget.TextView;
27 |
28 | import com.im4j.picturebeautify.BaseActivity;
29 | import com.im4j.picturebeautify.R;
30 | import com.im4j.picturebeautify.editimage.EditImageActivity;
31 | import com.im4j.picturebeautify.editimage.model.RatioItem;
32 | import com.im4j.picturebeautify.editimage.utils.Matrix3;
33 | import com.im4j.picturebeautify.editimage.view.CropImageView;
34 | import com.im4j.picturebeautify.editimage.view.imagezoom.ImageViewTouchBase;
35 |
36 |
37 | /**
38 | * 图片剪裁Fragment
39 | *
40 | * @author panyi
41 | *
42 | */
43 | public class CropFragment extends Fragment {
44 | private View mainView;
45 | private EditImageActivity activity;
46 | private View backToMenu;// 返回主菜单
47 | public CropImageView mCropPanel;// 剪裁操作面板
48 | private LinearLayout ratioList;
49 | private static List dataList = new ArrayList();
50 | static {
51 | // init data
52 | dataList.add(new RatioItem("任意", -1f));
53 | dataList.add(new RatioItem("1:1", 1f));
54 | dataList.add(new RatioItem("1:2", 1 / 2f));
55 | dataList.add(new RatioItem("1:3", 1 / 3f));
56 | dataList.add(new RatioItem("2:3", 2 / 3f));
57 | dataList.add(new RatioItem("3:4", 3 / 4f));
58 | dataList.add(new RatioItem("2:1", 2f));
59 | dataList.add(new RatioItem("3:1", 3f));
60 | dataList.add(new RatioItem("3:2", 3 / 2f));
61 | dataList.add(new RatioItem("4:3", 4 / 3f));
62 | }
63 | private List textViewList = new ArrayList();
64 |
65 | public static int SELECTED_COLOR = Color.YELLOW;
66 | public static int UNSELECTED_COLOR = Color.WHITE;
67 | private CropRationClick mCropRationClick = new CropRationClick();
68 | public TextView selctedTextView;
69 |
70 | public static CropFragment newInstance(EditImageActivity activity) {
71 | CropFragment fragment = new CropFragment();
72 | fragment.activity = activity;
73 | fragment.mCropPanel = activity.mCropPanel;
74 | return fragment;
75 | }
76 |
77 | @Override
78 | public void onCreate(Bundle savedInstanceState) {
79 | super.onCreate(savedInstanceState);
80 | }
81 |
82 | @Override
83 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
84 | Bundle savedInstanceState) {
85 | mainView = inflater.inflate(R.layout.fragment_edit_image_crop, null);
86 | backToMenu = mainView.findViewById(R.id.back_to_main);
87 | ratioList = (LinearLayout) mainView.findViewById(R.id.ratio_list_group);
88 | setUpRatioList();
89 | return mainView;
90 | }
91 |
92 | private void setUpRatioList() {
93 | // init UI
94 | ratioList.removeAllViews();
95 | LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
96 | LinearLayout.LayoutParams.WRAP_CONTENT,
97 | LinearLayout.LayoutParams.WRAP_CONTENT);
98 | params.gravity = Gravity.CENTER_VERTICAL;
99 | params.leftMargin = 20;
100 | params.rightMargin = 20;
101 | for (int i = 0, len = dataList.size(); i < len; i++) {
102 | TextView text = new TextView(activity);
103 | text.setTextColor(UNSELECTED_COLOR);
104 | text.setTextSize(20);
105 | text.setText(dataList.get(i).getText());
106 | textViewList.add(text);
107 | ratioList.addView(text, params);
108 | text.setTag(i);
109 | if (i == 0) {
110 | selctedTextView = text;
111 | }
112 | dataList.get(i).setIndex(i);
113 | text.setTag(dataList.get(i));
114 | text.setOnClickListener(mCropRationClick);
115 | }// end for i
116 | selctedTextView.setTextColor(SELECTED_COLOR);
117 | }
118 |
119 | /**
120 | * 选择剪裁比率
121 | *
122 | * @author
123 | *
124 | */
125 | private final class CropRationClick implements OnClickListener {
126 | @Override
127 | public void onClick(View v) {
128 | TextView curTextView = (TextView) v;
129 | selctedTextView.setTextColor(UNSELECTED_COLOR);
130 | RatioItem dataItem = (RatioItem) v.getTag();
131 | selctedTextView = curTextView;
132 | selctedTextView.setTextColor(SELECTED_COLOR);
133 |
134 | mCropPanel.setRatioCropRect(activity.mainImage.getBitmapRect(),
135 | dataItem.getRatio());
136 | // System.out.println("dataItem " + dataItem.getText());
137 | }
138 | }// end inner class
139 |
140 | @Override
141 | public void onActivityCreated(Bundle savedInstanceState) {
142 | super.onActivityCreated(savedInstanceState);
143 | backToMenu.setOnClickListener(new BackToMenuClick());// 返回主菜单
144 | }
145 |
146 | /**
147 | * 返回按钮逻辑
148 | *
149 | * @author panyi
150 | *
151 | */
152 | private final class BackToMenuClick implements OnClickListener {
153 | @Override
154 | public void onClick(View v) {
155 | backToMain();
156 | }
157 | }// end class
158 |
159 | /**
160 | * 返回主菜单
161 | */
162 | public void backToMain() {
163 | activity.mode = EditImageActivity.MODE_NONE;
164 | mCropPanel.setVisibility(View.GONE);
165 | activity.mainImage.setScaleEnabled(true);// 恢复缩放功能
166 | activity.bottomGallery.setCurrentItem(0);
167 | if (selctedTextView != null) {
168 | selctedTextView.setTextColor(UNSELECTED_COLOR);
169 | }
170 | mCropPanel.setRatioCropRect(activity.mainImage.getBitmapRect(), -1);
171 | activity.bannerFlipper.showPrevious();
172 | }
173 |
174 | /**
175 | * 保存剪切图片
176 | */
177 | public void saveCropImage() {
178 | // System.out.println("保存剪切图片");
179 | CropImageTask task = new CropImageTask();
180 | task.execute(activity.mainBitmap);
181 | }
182 |
183 | /**
184 | * 图片剪裁生成 异步任务
185 | *
186 | * @author panyi
187 | *
188 | */
189 | private final class CropImageTask extends AsyncTask {
190 | private Dialog dialog;
191 |
192 | @Override
193 | protected void onCancelled() {
194 | super.onCancelled();
195 | dialog.dismiss();
196 | }
197 |
198 | @TargetApi(Build.VERSION_CODES.HONEYCOMB)
199 | @Override
200 | protected void onCancelled(Bitmap result) {
201 | super.onCancelled(result);
202 | dialog.dismiss();
203 | }
204 |
205 | @Override
206 | protected void onPreExecute() {
207 | super.onPreExecute();
208 | dialog = BaseActivity.getLoadingDialog(getActivity(), "图片生成中...",
209 | false);
210 | dialog.show();
211 | }
212 |
213 | @Override
214 | protected Bitmap doInBackground(Bitmap... params) {
215 | RectF cropRect = mCropPanel.getCropRect();// 剪切区域矩形
216 | Matrix touchMatrix = activity.mainImage.getImageViewMatrix();
217 | // Canvas canvas = new Canvas(resultBit);
218 | float[] data = new float[9];
219 | touchMatrix.getValues(data);// 底部图片变化记录矩阵原始数据
220 | Matrix3 cal = new Matrix3(data);// 辅助矩阵计算类
221 | Matrix3 inverseMatrix = cal.inverseMatrix();// 计算逆矩阵
222 | Matrix m = new Matrix();
223 | m.setValues(inverseMatrix.getValues());
224 | m.mapRect(cropRect);// 变化剪切矩形
225 |
226 | // Paint paint = new Paint();
227 | // paint.setColor(Color.RED);
228 | // paint.setStrokeWidth(10);
229 | // canvas.drawRect(cropRect, paint);
230 | // Bitmap resultBit = Bitmap.createBitmap(params[0]).copy(
231 | // Bitmap.Config.ARGB_8888, true);
232 | Bitmap resultBit = Bitmap.createBitmap(params[0],
233 | (int) cropRect.left, (int) cropRect.top,
234 | (int) cropRect.width(), (int) cropRect.height());
235 |
236 | saveBitmap(resultBit, activity.saveFilePath);
237 | return resultBit;
238 | }
239 |
240 | @Override
241 | protected void onPostExecute(Bitmap result) {
242 | super.onPostExecute(result);
243 | dialog.dismiss();
244 | if (result == null)
245 | return;
246 |
247 | if (activity.mainBitmap != null
248 | && !activity.mainBitmap.isRecycled()) {
249 | activity.mainBitmap.recycle();
250 | }
251 | activity.mainBitmap = result;
252 | activity.mainImage.setImageBitmap(activity.mainBitmap);
253 | activity.mainImage.setDisplayType(ImageViewTouchBase.DisplayType.FIT_TO_SCREEN);
254 | activity.mCropPanel.setCropRect(activity.mainImage.getBitmapRect());
255 | backToMain();
256 | }
257 | }// end inner class
258 |
259 | /**
260 | * 保存Bitmap图片到指定文件
261 | */
262 | public static void saveBitmap(Bitmap bm, String filePath) {
263 | File f = new File(filePath);
264 | if (f.exists()) {
265 | f.delete();
266 | }
267 | try {
268 | FileOutputStream out = new FileOutputStream(f);
269 | bm.compress(Bitmap.CompressFormat.PNG, 90, out);
270 | out.flush();
271 | out.close();
272 | } catch (FileNotFoundException e) {
273 | // TODO Auto-generated catch block
274 | e.printStackTrace();
275 | } catch (IOException e) {
276 | // TODO Auto-generated catch block
277 | e.printStackTrace();
278 | }
279 | // System.out.println("保存文件--->" + f.getAbsolutePath());
280 | }
281 | }// end class
282 |
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/editimage/fragment/FliterListFragment.java:
--------------------------------------------------------------------------------
1 | package com.im4j.picturebeautify.editimage.fragment;
2 |
3 | import java.io.File;
4 | import java.io.FileNotFoundException;
5 | import java.io.FileOutputStream;
6 | import java.io.IOException;
7 |
8 | import android.annotation.TargetApi;
9 | import android.app.Dialog;
10 | import android.graphics.Bitmap;
11 | import android.graphics.Color;
12 | import android.os.AsyncTask;
13 | import android.os.Build;
14 | import android.os.Bundle;
15 | import android.support.v4.app.Fragment;
16 | import android.view.Gravity;
17 | import android.view.LayoutInflater;
18 | import android.view.View;
19 | import android.view.View.OnClickListener;
20 | import android.view.ViewGroup;
21 | import android.widget.LinearLayout;
22 | import android.widget.TextView;
23 |
24 | import com.im4j.picturebeautify.BaseActivity;
25 | import com.im4j.picturebeautify.R;
26 | import com.im4j.picturebeautify.editimage.EditImageActivity;
27 | import com.im4j.picturebeautify.editimage.utils.PhotoUtils;
28 |
29 |
30 | /**
31 | * 滤镜列表fragment
32 | *
33 | * @author panyi
34 | *
35 | */
36 | public class FliterListFragment extends Fragment {
37 | private View mainView;
38 | private View backBtn;// 返回主菜单按钮
39 |
40 | private Bitmap fliterBit;// 滤镜处理后的bitmap
41 | private EditImageActivity activity;
42 |
43 | private LinearLayout mFilterGroup;// 滤镜列表
44 | private Bitmap currentBitmap;// 标记变量
45 |
46 | public static FliterListFragment newInstance(EditImageActivity activity) {
47 | FliterListFragment fragment = new FliterListFragment();
48 | fragment.activity = activity;
49 | return fragment;
50 | }
51 |
52 | @Override
53 | public void onCreate(Bundle savedInstanceState) {
54 | super.onCreate(savedInstanceState);
55 | }
56 |
57 | @Override
58 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
59 | Bundle savedInstanceState) {
60 | mainView = inflater.inflate(R.layout.fragment_edit_image_fliter, null);
61 | backBtn = mainView.findViewById(R.id.back_to_main);
62 | mFilterGroup = (LinearLayout) mainView.findViewById(R.id.fliter_group);
63 | return mainView;
64 | }
65 |
66 | @Override
67 | public void onActivityCreated(Bundle savedInstanceState) {
68 | super.onActivityCreated(savedInstanceState);
69 | backBtn.setOnClickListener(new OnClickListener() {
70 | @Override
71 | public void onClick(View v) {
72 | backToMain();
73 | }
74 | });
75 | setUpFliters();
76 | }
77 |
78 | /**
79 | * 返回主菜单
80 | */
81 | public void backToMain() {
82 | currentBitmap = activity.mainBitmap;
83 | fliterBit = null;
84 | activity.mainImage.setImageBitmap(activity.mainBitmap);// 返回原图
85 | activity.mode = EditImageActivity.MODE_NONE;
86 | activity.bottomGallery.setCurrentItem(0);
87 | activity.mainImage.setScaleEnabled(true);
88 | activity.bannerFlipper.showPrevious();
89 | }
90 |
91 | /**
92 | * 保存滤镜处理后的图片
93 | */
94 | public void saveFilterImage() {
95 | // System.out.println("保存滤镜处理后的图片");
96 | if (currentBitmap == activity.mainBitmap) {// 原始图片
97 | // System.out.println("原始图片");
98 | backToMain();
99 | return;
100 | } else {// 经滤镜处理后的图片
101 | // System.out.println("滤镜图片");
102 | SaveImageTask saveTask = new SaveImageTask();
103 | saveTask.execute(fliterBit);
104 | }// end if
105 | }
106 |
107 | /**
108 | * 保存滤镜处理图片任务
109 | *
110 | * @author panyi
111 | *
112 | */
113 | private final class SaveImageTask extends AsyncTask {
114 | private Dialog dialog;
115 |
116 | @Override
117 | protected Boolean doInBackground(Bitmap... params) {
118 | return saveBitmap(params[0], activity.saveFilePath);
119 | }
120 |
121 | @Override
122 | protected void onCancelled() {
123 | super.onCancelled();
124 | dialog.dismiss();
125 | }
126 |
127 | @Override
128 | protected void onCancelled(Boolean result) {
129 | super.onCancelled(result);
130 | dialog.dismiss();
131 | }
132 |
133 | @Override
134 | protected void onPostExecute(Boolean result) {
135 | super.onPostExecute(result);
136 | dialog.dismiss();
137 | if (result) {// 保存图片成功
138 | if (activity.mainBitmap != null
139 | && !activity.mainBitmap.isRecycled()) {
140 | activity.mainBitmap.recycle();
141 | }
142 | activity.mainBitmap = fliterBit;
143 | backToMain();
144 | }// end if
145 | }
146 |
147 | @Override
148 | protected void onPreExecute() {
149 | super.onPreExecute();
150 | dialog = EditImageActivity.getLoadingDialog(getActivity(),
151 | "图片保存中...", false);
152 | dialog.show();
153 | }
154 | }// end inner class
155 |
156 | /**
157 | * 保存Bitmap图片到指定文件
158 | *
159 | * @param bm
160 | */
161 | public static boolean saveBitmap(Bitmap bm, String filePath) {
162 | File f = new File(filePath);
163 | if (f.exists()) {
164 | f.delete();
165 | }
166 | try {
167 | FileOutputStream out = new FileOutputStream(f);
168 | bm.compress(Bitmap.CompressFormat.PNG, 90, out);
169 | out.flush();
170 | out.close();
171 | return true;
172 | } catch (FileNotFoundException e) {
173 | e.printStackTrace();
174 | return false;
175 | } catch (IOException e) {
176 | e.printStackTrace();
177 | return false;
178 | }
179 | // System.out.println("保存文件--->" + f.getAbsolutePath());
180 | }
181 |
182 | /**
183 | * 装载滤镜
184 | */
185 | private void setUpFliters() {
186 | LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
187 | LinearLayout.LayoutParams.WRAP_CONTENT,
188 | LinearLayout.LayoutParams.WRAP_CONTENT);
189 | params.gravity = Gravity.CENTER_VERTICAL;
190 | params.leftMargin = 20;
191 | params.rightMargin = 20;
192 | mFilterGroup.removeAllViews();
193 |
194 | for (String key : PhotoUtils.FILTERS.keySet()) {
195 | TextView text = new TextView(activity);
196 | text.setTextColor(Color.WHITE);
197 | text.setTextSize(20);
198 | text.setText(key);
199 | mFilterGroup.addView(text, params);
200 | text.setTag(key);
201 | text.setOnClickListener(new FliterClick());
202 | }// end for i
203 | }
204 |
205 | @Override
206 | public void onDestroy() {
207 | if (fliterBit != null && (!fliterBit.isRecycled())) {
208 | fliterBit.recycle();
209 | }
210 | super.onDestroy();
211 | }
212 |
213 | /**
214 | * 选择滤镜效果
215 | */
216 | private final class FliterClick implements OnClickListener {
217 | @Override
218 | public void onClick(View v) {
219 | String key = String.valueOf(v.getTag());
220 | // 滤镜处理
221 | ProcessingImage task = new ProcessingImage();
222 | task.execute(key);
223 | }
224 | }// end inner class
225 |
226 | /**
227 | * 图片滤镜处理任务
228 | *
229 | * @author panyi
230 | *
231 | */
232 | private final class ProcessingImage extends
233 | AsyncTask {
234 | private Dialog dialog;
235 | private Bitmap srcBitmap;
236 |
237 | @Override
238 | protected Bitmap doInBackground(String... params) {
239 | String key = params[0];
240 | if (srcBitmap != null && !srcBitmap.isRecycled()) {
241 | srcBitmap.recycle();
242 | }
243 | srcBitmap = Bitmap.createBitmap(activity.mainBitmap.copy(
244 | Bitmap.Config.RGB_565, true));
245 | return PhotoUtils.filterPhoto(getContext(), srcBitmap, key);
246 | }
247 |
248 | @Override
249 | protected void onCancelled() {
250 | super.onCancelled();
251 | dialog.dismiss();
252 | }
253 |
254 | @TargetApi(Build.VERSION_CODES.HONEYCOMB)
255 | @Override
256 | protected void onCancelled(Bitmap result) {
257 | super.onCancelled(result);
258 | dialog.dismiss();
259 | }
260 |
261 | @Override
262 | protected void onPostExecute(Bitmap result) {
263 | super.onPostExecute(result);
264 | dialog.dismiss();
265 | if (result == null)
266 | return;
267 | if (fliterBit != null && (!fliterBit.isRecycled())) {
268 | fliterBit.recycle();
269 | }
270 | fliterBit = result;
271 | activity.mainImage.setImageBitmap(fliterBit);
272 | currentBitmap = fliterBit;
273 | }
274 |
275 | @Override
276 | protected void onPreExecute() {
277 | super.onPreExecute();
278 | dialog = BaseActivity.getLoadingDialog(getActivity(), "图片处理中...",
279 | false);
280 | dialog.show();
281 | }
282 |
283 | }
284 |
285 | public void setCurrentBitmap(Bitmap currentBitmap) {
286 | this.currentBitmap = currentBitmap;
287 | }
288 |
289 | }// end class
290 |
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/editimage/fragment/MainMenuFragment.java:
--------------------------------------------------------------------------------
1 | package com.im4j.picturebeautify.editimage.fragment;
2 |
3 | import android.graphics.RectF;
4 | import android.os.Bundle;
5 | import android.support.v4.app.Fragment;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.View.OnClickListener;
9 | import android.view.ViewGroup;
10 |
11 | import com.im4j.picturebeautify.R;
12 | import com.im4j.picturebeautify.editimage.EditImageActivity;
13 | import com.im4j.picturebeautify.editimage.view.imagezoom.ImageViewTouchBase;
14 |
15 |
16 | /**
17 | * 工具栏主菜单
18 | *
19 | * @author panyi
20 | *
21 | */
22 | public class MainMenuFragment extends Fragment {
23 | public static final String TAG = MainMenuFragment.class.getName();
24 | private View mainView;
25 | private EditImageActivity activity;
26 |
27 | private View stickerBtn;// 贴图按钮
28 | private View fliterBtn;// 滤镜按钮
29 | private View cropBtn;// 剪裁按钮
30 | private View rotateBtn;// 旋转按钮
31 | private View textBtn;// 贴文字按钮
32 |
33 | public static MainMenuFragment newInstance(EditImageActivity activity) {
34 | MainMenuFragment fragment = new MainMenuFragment();
35 | fragment.activity = activity;
36 | return fragment;
37 | }
38 |
39 | @Override
40 | public void onCreate(Bundle savedInstanceState) {
41 | super.onCreate(savedInstanceState);
42 | }
43 |
44 | @Override
45 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
46 | Bundle savedInstanceState) {
47 | mainView = inflater.inflate(R.layout.fragment_edit_image_main_menu,
48 | null);
49 | stickerBtn = mainView.findViewById(R.id.btn_stickers);
50 | fliterBtn = mainView.findViewById(R.id.btn_fliter);
51 | cropBtn = mainView.findViewById(R.id.btn_crop);
52 | rotateBtn = mainView.findViewById(R.id.btn_rotate);
53 | textBtn = mainView.findViewById(R.id.btn_text);
54 | return mainView;
55 | }
56 |
57 | @Override
58 | public void onActivityCreated(Bundle savedInstanceState) {
59 | super.onActivityCreated(savedInstanceState);
60 |
61 | stickerBtn.setOnClickListener(new StickerClick());
62 | fliterBtn.setOnClickListener(new FliterClick());
63 | cropBtn.setOnClickListener(new CropClick());
64 | rotateBtn.setOnClickListener(new RotateClick());
65 | textBtn.setOnClickListener(new TextClick());
66 | }
67 |
68 | /**
69 | * 贴图模式
70 | *
71 | * @author panyi
72 | *
73 | */
74 | private final class StickerClick implements OnClickListener {
75 | @Override
76 | public void onClick(View v) {
77 | activity.mode = EditImageActivity.MODE_STICKERS;
78 | activity.mStirckerFragment.getmStickerView().setVisibility(
79 | View.VISIBLE);
80 | activity.bottomGallery.setCurrentItem(1);
81 | activity.bannerFlipper.showNext();
82 | }
83 | }// end inner class
84 |
85 | /**
86 | * 滤镜模式
87 | *
88 | * @author panyi
89 | *
90 | */
91 | private final class FliterClick implements OnClickListener {
92 | @Override
93 | public void onClick(View v) {
94 | activity.mode = EditImageActivity.MODE_FILTER;
95 | activity.mFliterListFragment.setCurrentBitmap(activity.mainBitmap);
96 | activity.mainImage.setImageBitmap(activity.mainBitmap);
97 | activity.mainImage.setDisplayType(ImageViewTouchBase.DisplayType.FIT_TO_SCREEN);
98 | activity.mainImage.setScaleEnabled(false);
99 | activity.bottomGallery.setCurrentItem(2);
100 | activity.bannerFlipper.showNext();
101 | }
102 | }// end inner class
103 |
104 | /**
105 | * 裁剪模式
106 | *
107 | * @author panyi
108 | *
109 | */
110 | private final class CropClick implements OnClickListener {
111 | @Override
112 | public void onClick(View v) {
113 | activity.mode = EditImageActivity.MODE_CROP;
114 | activity.mCropPanel.setVisibility(View.VISIBLE);
115 | activity.mainImage.setImageBitmap(activity.mainBitmap);
116 | activity.mainImage.setDisplayType(ImageViewTouchBase.DisplayType.FIT_TO_SCREEN);
117 | activity.bottomGallery.setCurrentItem(3);
118 | activity.mainImage.setScaleEnabled(false);// 禁用缩放
119 | //
120 | RectF r = activity.mainImage.getBitmapRect();
121 | activity.mCropPanel.setCropRect(r);
122 | // System.out.println(r.left + " " + r.top);
123 | activity.bannerFlipper.showNext();
124 | }
125 | }// end inner class
126 |
127 | /**
128 | * 图片旋转模式
129 | *
130 | * @author panyi
131 | *
132 | */
133 | private final class RotateClick implements OnClickListener {
134 | @Override
135 | public void onClick(View v) {
136 | activity.mode = EditImageActivity.MODE_ROTATE;
137 | activity.bottomGallery.setCurrentItem(4);
138 | activity.mainImage.setImageBitmap(activity.mainBitmap);
139 | activity.mainImage.setDisplayType(ImageViewTouchBase.DisplayType.FIT_TO_SCREEN);
140 | activity.mainImage.setVisibility(View.GONE);
141 |
142 | activity.mRotatePanel.addBit(activity.mainBitmap,
143 | activity.mainImage.getBitmapRect());
144 | activity.mRotateFragment.mSeekBar.setProgress(0);
145 | activity.mRotatePanel.reset();
146 | activity.mRotatePanel.setVisibility(View.VISIBLE);
147 | activity.bannerFlipper.showNext();
148 | }
149 | }// end inner class
150 |
151 | /**
152 | * 贴文字模式
153 | * @author alafighting
154 | *
155 | */
156 | private final class TextClick implements OnClickListener {
157 | @Override
158 | public void onClick(View v) {
159 | activity.mode = EditImageActivity.MODE_TEXT;
160 | activity.mTextFragment.getLableTextView().setVisibility(View.VISIBLE);
161 | activity.bottomGallery.setCurrentItem(5);
162 | activity.bannerFlipper.showNext();
163 | }
164 | }// end inner class
165 |
166 | }// end class
167 |
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/editimage/fragment/RotateFragment.java:
--------------------------------------------------------------------------------
1 | package com.im4j.picturebeautify.editimage.fragment;
2 |
3 | import java.io.File;
4 | import java.io.FileNotFoundException;
5 | import java.io.FileOutputStream;
6 | import java.io.IOException;
7 |
8 | import android.app.Dialog;
9 | import android.graphics.Bitmap;
10 | import android.graphics.Canvas;
11 | import android.graphics.Rect;
12 | import android.graphics.RectF;
13 | import android.os.AsyncTask;
14 | import android.os.Bundle;
15 | import android.support.v4.app.Fragment;
16 | import android.view.LayoutInflater;
17 | import android.view.View;
18 | import android.view.View.OnClickListener;
19 | import android.view.ViewGroup;
20 | import android.widget.SeekBar;
21 | import android.widget.SeekBar.OnSeekBarChangeListener;
22 |
23 | import com.im4j.picturebeautify.BaseActivity;
24 | import com.im4j.picturebeautify.R;
25 | import com.im4j.picturebeautify.editimage.EditImageActivity;
26 | import com.im4j.picturebeautify.editimage.view.RotateImageView;
27 | import com.im4j.picturebeautify.editimage.view.imagezoom.ImageViewTouchBase;
28 |
29 |
30 | /**
31 | * 图片旋转Fragment
32 | *
33 | * @author 潘易
34 | *
35 | */
36 | public class RotateFragment extends Fragment {
37 | public static final String TAG = RotateFragment.class.getName();
38 | private View mainView;
39 | private EditImageActivity activity;
40 | private View backToMenu;// 返回主菜单
41 | public SeekBar mSeekBar;// 角度设定
42 | private RotateImageView mRotatePanel;// 旋转效果展示控件
43 |
44 | public static RotateFragment newInstance(EditImageActivity activity) {
45 | RotateFragment fragment = new RotateFragment();
46 | fragment.activity = activity;
47 | fragment.mRotatePanel = activity.mRotatePanel;
48 | return fragment;
49 | }
50 |
51 | @Override
52 | public void onCreate(Bundle savedInstanceState) {
53 | super.onCreate(savedInstanceState);
54 | }
55 |
56 | @Override
57 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
58 | Bundle savedInstanceState) {
59 | mainView = inflater.inflate(R.layout.fragment_edit_image_rotate, null);
60 | backToMenu = mainView.findViewById(R.id.back_to_main);
61 | mSeekBar = (SeekBar) mainView.findViewById(R.id.rotate_bar);
62 | mSeekBar.setProgress(0);
63 | return mainView;
64 | }
65 |
66 | @Override
67 | public void onActivityCreated(Bundle savedInstanceState) {
68 | super.onActivityCreated(savedInstanceState);
69 | backToMenu.setOnClickListener(new BackToMenuClick());// 返回主菜单
70 |
71 | mSeekBar.setOnSeekBarChangeListener(new RotateAngleChange());
72 | }
73 |
74 | /**
75 | * 角度改变监听
76 | *
77 | * @author panyi
78 | *
79 | */
80 | private final class RotateAngleChange implements OnSeekBarChangeListener {
81 | @Override
82 | public void onProgressChanged(SeekBar seekBar, int angle,
83 | boolean fromUser) {
84 | // System.out.println("progress--->" + progress);
85 | mRotatePanel.rotateImage(angle);
86 | }
87 |
88 | @Override
89 | public void onStartTrackingTouch(SeekBar seekBar) {
90 |
91 | }
92 |
93 | @Override
94 | public void onStopTrackingTouch(SeekBar seekBar) {
95 |
96 | }
97 | }// end inner class
98 |
99 | /**
100 | * 返回按钮逻辑
101 | *
102 | * @author panyi
103 | *
104 | */
105 | private final class BackToMenuClick implements OnClickListener {
106 | @Override
107 | public void onClick(View v) {
108 | backToMain();
109 | }
110 | }// end class
111 |
112 | /**
113 | * 返回主菜单
114 | */
115 | public void backToMain() {
116 | activity.mode = EditImageActivity.MODE_NONE;
117 | activity.bottomGallery.setCurrentItem(0);
118 | activity.mainImage.setVisibility(View.VISIBLE);
119 | this.mRotatePanel.setVisibility(View.GONE);
120 | activity.bannerFlipper.showPrevious();
121 | }
122 |
123 | /**
124 | * 保存旋转图片
125 | */
126 | public void saveRotateImage() {
127 | // System.out.println("保存旋转图片");
128 | if (mSeekBar.getProgress() == 0 || mSeekBar.getProgress() == 360) {// 没有做旋转
129 | backToMain();
130 | return;
131 | } else {// 保存图片
132 | SaveRotateImageTask task = new SaveRotateImageTask();
133 | task.execute(activity.mainBitmap);
134 | }// end if
135 | }
136 |
137 | /**
138 | * 保存图片线程
139 | *
140 | * @author panyi
141 | *
142 | */
143 | private final class SaveRotateImageTask extends
144 | AsyncTask {
145 | private Dialog dialog;
146 |
147 | @Override
148 | protected void onCancelled() {
149 | super.onCancelled();
150 | dialog.dismiss();
151 | }
152 |
153 | @Override
154 | protected void onCancelled(Bitmap result) {
155 | super.onCancelled(result);
156 | dialog.dismiss();
157 | }
158 |
159 | @Override
160 | protected void onPreExecute() {
161 | super.onPreExecute();
162 | dialog = BaseActivity.getLoadingDialog(getActivity(), "图片保存中...",
163 | false);
164 | dialog.show();
165 | }
166 |
167 | @Override
168 | protected Bitmap doInBackground(Bitmap... params) {
169 | RectF imageRect = mRotatePanel.getImageNewRect();
170 | Bitmap originBit = params[0];
171 | Bitmap result = Bitmap.createBitmap((int) imageRect.width(),
172 | (int) imageRect.height(), Bitmap.Config.ARGB_4444);
173 | Canvas canvas = new Canvas(result);
174 | int w = originBit.getWidth() >> 1;
175 | int h = originBit.getHeight() >> 1;
176 | float centerX = imageRect.width() / 2;
177 | float centerY = imageRect.height() / 2;
178 |
179 | float left = centerX - w;
180 | float top = centerY - h;
181 |
182 | RectF dst = new RectF(left, top, left + originBit.getWidth(), top
183 | + originBit.getHeight());
184 | canvas.save();
185 | canvas.scale(mRotatePanel.getScale(), mRotatePanel.getScale(),
186 | imageRect.width() / 2, imageRect.height() / 2);
187 | canvas.rotate(mRotatePanel.getRotateAngle(), imageRect.width() / 2,
188 | imageRect.height() / 2);
189 |
190 | canvas.drawBitmap(originBit, new Rect(0, 0, originBit.getWidth(),
191 | originBit.getHeight()), dst, null);
192 | canvas.restore();
193 |
194 | saveBitmap(result, activity.saveFilePath);// 保存图片
195 | return result;
196 | }
197 |
198 | @Override
199 | protected void onPostExecute(Bitmap result) {
200 | super.onPostExecute(result);
201 | dialog.dismiss();
202 | if (result == null)
203 | return;
204 |
205 | // 切换新底图
206 | if (activity.mainBitmap != null
207 | && !activity.mainBitmap.isRecycled()) {
208 | activity.mainBitmap.recycle();
209 | }
210 | activity.mainBitmap = result;
211 | activity.mainImage.setImageBitmap(activity.mainBitmap);
212 | activity.mainImage.setDisplayType(ImageViewTouchBase.DisplayType.FIT_TO_SCREEN);
213 | backToMain();
214 | }
215 | }// end inner class
216 |
217 | /**
218 | * 保存Bitmap图片到指定文件
219 | *
220 | * @param bm
221 | * @param name
222 | */
223 | public static void saveBitmap(Bitmap bm, String filePath) {
224 | File f = new File(filePath);
225 | if (f.exists()) {
226 | f.delete();
227 | }
228 | try {
229 | FileOutputStream out = new FileOutputStream(f);
230 | bm.compress(Bitmap.CompressFormat.PNG, 90, out);
231 | out.flush();
232 | out.close();
233 | } catch (FileNotFoundException e) {
234 | // TODO Auto-generated catch block
235 | e.printStackTrace();
236 | } catch (IOException e) {
237 | // TODO Auto-generated catch block
238 | e.printStackTrace();
239 | }
240 | // System.out.println("保存文件--->" + f.getAbsolutePath());
241 | }
242 | }// end class
243 |
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/editimage/model/RatioItem.java:
--------------------------------------------------------------------------------
1 | package com.im4j.picturebeautify.editimage.model;
2 |
3 | public class RatioItem {
4 | private String text;
5 | private Float ratio;
6 | private int index;
7 |
8 | public RatioItem(String text, Float ratio) {
9 | super();
10 | this.text = text;
11 | this.ratio = ratio;
12 | }
13 |
14 | public String getText() {
15 | return text;
16 | }
17 |
18 | public void setText(String text) {
19 | this.text = text;
20 | }
21 |
22 | public Float getRatio() {
23 | return ratio;
24 | }
25 |
26 | public void setRatio(Float ratio) {
27 | this.ratio = ratio;
28 | }
29 |
30 |
31 | public int getIndex() {
32 | return index;
33 | }
34 |
35 | public void setIndex(int index) {
36 | this.index = index;
37 | }
38 |
39 | }// end class
40 |
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/editimage/utils/BitmapUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 Lightbox
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.im4j.picturebeautify.editimage.utils;
18 |
19 | import android.graphics.Bitmap;
20 | import android.graphics.Bitmap.CompressFormat;
21 | import android.graphics.BitmapFactory;
22 | import android.graphics.BitmapFactory.Options;
23 | import android.graphics.Matrix;
24 |
25 | import java.io.ByteArrayInputStream;
26 | import java.io.ByteArrayOutputStream;
27 | import java.io.File;
28 |
29 | /**
30 | * BitmapUtils
31 | *
32 | * @author panyi
33 | */
34 | public class BitmapUtils {
35 | /** Used to tag logs */
36 | @SuppressWarnings("unused")
37 | private static final String TAG = "BitmapUtils";
38 |
39 | public static final long MAX_SZIE = 1024 * 512;// 500KB
40 |
41 | public static Bitmap loadImageByPath(final String imagePath, int reqWidth,
42 | int reqHeight) {
43 | File file = new File(imagePath);
44 | if (file.length() < MAX_SZIE) {
45 | return getSampledBitmap(imagePath, reqWidth, reqHeight);
46 | } else {// 压缩图片
47 | return getImageCompress(imagePath);
48 | }
49 | }
50 |
51 | public static Bitmap getSampledBitmap(String filePath, int reqWidth,
52 | int reqHeight) {
53 | Options options = new Options();
54 | options.inJustDecodeBounds = true;
55 |
56 | BitmapFactory.decodeFile(filePath, options);
57 |
58 | // Raw height and width of image
59 | final int height = options.outHeight;
60 | final int width = options.outWidth;
61 | int inSampleSize = 1;
62 |
63 | if (height > reqHeight || width > reqWidth) {
64 | if (width > height) {
65 | inSampleSize = (int) Math.floor(((float) height / reqHeight) + 0.5f); // Math.round((float)height
66 | // /
67 | // (float)reqHeight);
68 | } else {
69 | inSampleSize = (int) Math.floor(((float) width / reqWidth) + 0.5f); // Math.round((float)width
70 | // /
71 | // (float)reqWidth);
72 | }
73 | }
74 | // System.out.println("inSampleSize--->"+inSampleSize);
75 |
76 | options.inSampleSize = inSampleSize;
77 | options.inJustDecodeBounds = false;
78 |
79 | return BitmapFactory.decodeFile(filePath, options);
80 | }
81 |
82 | // 按大小缩放
83 | public static Bitmap getImageCompress(final String srcPath) {
84 | Options newOpts = new Options();
85 | // 开始读入图片,此时把options.inJustDecodeBounds 设回true了
86 | newOpts.inJustDecodeBounds = true;
87 | Bitmap bitmap = BitmapFactory.decodeFile(srcPath, newOpts);// 此时返回bm为空
88 |
89 | newOpts.inJustDecodeBounds = false;
90 | int w = newOpts.outWidth;
91 | int h = newOpts.outHeight;
92 | // 现在主流手机比较多是800*480分辨率,所以高和宽我们设置为
93 | float hh = 800f;// 这里设置高度为800f
94 | float ww = 480f;// 这里设置宽度为480f
95 | // 缩放比。由于是固定比例缩放,只用高或者宽其中一个数据进行计算即可
96 | int be = 1;// be=1表示不缩放
97 | if (w > h && w > ww) {// 如果宽度大的话根据宽度固定大小缩放
98 | be = (int) (newOpts.outWidth / ww);
99 | } else if (w < h && h > hh) {// 如果高度高的话根据宽度固定大小缩放
100 | be = (int) (newOpts.outHeight / hh);
101 | }
102 | if (be <= 0)
103 | be = 1;
104 | newOpts.inSampleSize = be;// 设置缩放比例
105 | // 重新读入图片,注意此时已经把options.inJustDecodeBounds 设回false了
106 | bitmap = BitmapFactory.decodeFile(srcPath, newOpts);
107 | return compressImage(bitmap);// 压缩好比例大小后再进行质量压缩
108 | }
109 | // 图片质量压缩
110 | private static Bitmap compressImage(Bitmap image) {
111 | ByteArrayOutputStream baos = new ByteArrayOutputStream();
112 | image.compress(CompressFormat.JPEG, 100, baos);// 质量压缩方法,这里100表示不压缩,把压缩后的数据存放到baos中
113 | int options = 100;
114 |
115 | while (baos.toByteArray().length / 1024 > 100) { // 循环判断如果压缩后图片是否大于100kb,大于继续压缩
116 | baos.reset();// 重置baos即清空baos
117 | image.compress(CompressFormat.JPEG, options, baos);// 这里压缩options%,把压缩后的数据存放到baos中
118 | options -= 10;// 每次都减少10
119 | // System.out.println("options--->" + options + " "
120 | // + (baos.toByteArray().length / 1024));
121 | }
122 | ByteArrayInputStream isBm = new ByteArrayInputStream(baos.toByteArray());// 把压缩后的数据baos存放到ByteArrayInputStream中
123 | Bitmap bitmap = BitmapFactory.decodeStream(isBm, null, null);// 把ByteArrayInputStream数据生成图片
124 | return bitmap;
125 | }
126 |
127 | /**
128 | * Resize a bitmap object to fit the passed width and height
129 | *
130 | * @param input
131 | * The bitmap to be resized
132 | * @param destWidth
133 | * Desired maximum width of the result bitmap
134 | * @param destHeight
135 | * Desired maximum height of the result bitmap
136 | * @return A new resized bitmap
137 | * @throws OutOfMemoryError
138 | * if the operation exceeds the available vm memory
139 | */
140 | public static Bitmap resizeBitmap( final Bitmap input, int destWidth, int destHeight, int rotation ) throws OutOfMemoryError {
141 |
142 | int dstWidth = destWidth;
143 | int dstHeight = destHeight;
144 | final int srcWidth = input.getWidth();
145 | final int srcHeight = input.getHeight();
146 |
147 | if ( rotation == 90 || rotation == 270 ) {
148 | dstWidth = destHeight;
149 | dstHeight = destWidth;
150 | }
151 |
152 | boolean needsResize = false;
153 | float p;
154 | if ( ( srcWidth > dstWidth ) || ( srcHeight > dstHeight ) ) {
155 | needsResize = true;
156 | if ( ( srcWidth > srcHeight ) && ( srcWidth > dstWidth ) ) {
157 | p = (float) dstWidth / (float) srcWidth;
158 | dstHeight = (int) ( srcHeight * p );
159 | } else {
160 | p = (float) dstHeight / (float) srcHeight;
161 | dstWidth = (int) ( srcWidth * p );
162 | }
163 | } else {
164 | dstWidth = srcWidth;
165 | dstHeight = srcHeight;
166 | }
167 |
168 | if ( needsResize || rotation != 0 ) {
169 | Bitmap output;
170 |
171 | if ( rotation == 0 ) {
172 | output = Bitmap.createScaledBitmap( input, dstWidth, dstHeight, true );
173 | } else {
174 | Matrix matrix = new Matrix();
175 | matrix.postScale( (float) dstWidth / srcWidth, (float) dstHeight / srcHeight );
176 | matrix.postRotate( rotation );
177 | output = Bitmap.createBitmap( input, 0, 0, srcWidth, srcHeight, matrix, true );
178 | }
179 | return output;
180 | } else
181 | return input;
182 | }
183 |
184 |
185 | }
186 |
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/editimage/utils/DimensionUtils.java:
--------------------------------------------------------------------------------
1 | package com.im4j.picturebeautify.editimage.utils;
2 |
3 | import android.content.Context;
4 |
5 | /**
6 | * @author alafighting 2016-02
7 | */
8 | public class DimensionUtils {
9 |
10 | /**
11 | * 转换dip为px
12 | */
13 | public static int dip2px(Context context, int dip) {
14 | float scale = context.getResources().getDisplayMetrics().density;
15 | return (int) (dip * scale + 0.5f * (dip >= 0 ? 1 : -1));
16 | }
17 |
18 | /**
19 | * 转换px为dip
20 | */
21 | public static int px2dip(Context context, int px) {
22 | float scale = context.getResources().getDisplayMetrics().density;
23 | return (int) (px / scale + 0.5f * (px >= 0 ? 1 : -1));
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/editimage/utils/Matrix3.java:
--------------------------------------------------------------------------------
1 | package com.im4j.picturebeautify.editimage.utils;
2 |
3 | /**
4 | * 3x3
5 | *
6 | * @author panyi
7 | *
8 | */
9 | public class Matrix3 {
10 | private float[] data;
11 |
12 | public Matrix3() {
13 | data = new float[9];
14 | }
15 |
16 | public Matrix3(float[] values) {
17 | this();
18 | setValues(values);
19 | }
20 |
21 | public void setValues(float[] values) {
22 | for (int i = 0, len = values.length; i < len; i++) {
23 | data[i] = values[i];
24 | }// end for i
25 | }
26 |
27 | public float[] getValues() {
28 | float[] retValues = new float[9];
29 | System.arraycopy(data, 0, retValues, 0, 9);
30 | return retValues;
31 | }
32 |
33 | public Matrix3 copy() {
34 | return new Matrix3(getValues());
35 | }
36 |
37 | /**
38 | * 两矩阵相�?
39 | *
40 | * @param m
41 | */
42 | public void multiply(Matrix3 m) {
43 | float[] ma = this.copy().getValues();
44 | float[] mb = m.copy().getValues();
45 |
46 | data[0] = ma[0] * mb[0] + ma[1] * mb[3] + ma[2] * mb[6];
47 | data[1] = ma[0] * mb[1] + ma[1] * mb[4] + ma[2] * mb[7];
48 | data[2] = ma[0] * mb[2] + ma[1] * mb[5] + ma[2] * mb[8];
49 |
50 | data[3] = ma[3] * mb[0] + ma[4] * mb[3] + ma[5] * mb[6];
51 | data[4] = ma[3] * mb[1] + ma[4] * mb[4] + ma[5] * mb[7];
52 | data[5] = ma[3] * mb[2] + ma[4] * mb[5] + ma[5] * mb[8];
53 |
54 | data[6] = ma[6] * mb[0] + ma[7] * mb[3] + ma[8] * mb[6];
55 | data[7] = ma[6] * mb[1] + ma[7] * mb[4] + ma[8] * mb[7];
56 | data[8] = ma[6] * mb[2] + ma[7] * mb[5] + ma[8] * mb[8];
57 | }
58 |
59 | /**
60 | * 当前矩阵求�?矩阵 快�?求�?矩阵的方�?
61 | *
62 | *
63 | * @return
64 | */
65 | public Matrix3 inverseMatrix() {
66 | float[] m = this.copy().getValues();
67 | float sx = m[0];
68 | float sy = m[4];
69 | m[0] = 1 / sx;
70 | m[1] = 0;
71 | m[2] = (-1) * (data[2] / sx);
72 | m[3] = 0;
73 | m[4] = 1 / sy;
74 | m[5] = (-1) * (data[5] / sy);
75 | m[6] = 0;
76 | m[7] = 0;
77 | m[8] = 1;
78 | return new Matrix3(m);
79 | }
80 |
81 | public void println() {
82 | System.out.println("data--->" + data[0] + " " + data[1] + " "
83 | + data[2]);
84 | System.out.println(" " + data[3] + " " + data[4] + " "
85 | + data[5]);
86 | System.out.println(" " + data[6] + " " + data[7] + " "
87 | + data[8]);
88 | }
89 | }// end class
90 |
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/editimage/utils/MatrixUtils.java:
--------------------------------------------------------------------------------
1 | package com.im4j.picturebeautify.editimage.utils;
2 |
3 | import android.graphics.Matrix;
4 | import android.util.Log;
5 |
6 | /**
7 | * @author alafighting 2016-03
8 | */
9 | public class MatrixUtils {
10 |
11 | public static float getValue(Matrix matrix, int whichValue) {
12 | float[] mMatrixValues = new float[9];
13 | matrix.getValues(mMatrixValues);
14 | return mMatrixValues[whichValue];
15 | }
16 |
17 |
18 | public static void print(Matrix matrix) {
19 | float scale = getValue(matrix, Matrix.MSCALE_X);
20 |
21 | float moveX = getValue(matrix, Matrix.MTRANS_X);
22 | float moveY = getValue(matrix, Matrix.MTRANS_Y);
23 |
24 | Log.e("[MatrixUtils]", "matrix: { moveX: " + moveX + ", moveY: " + moveY + ", scale: " + scale +" }");
25 | }
26 |
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/editimage/utils/PaintUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013, Edmodo, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License.
5 | * You may obtain a copy of the License in the LICENSE file, or at:
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS"
10 | * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
11 | * governing permissions and limitations under the License.
12 | */
13 |
14 | package com.im4j.picturebeautify.editimage.utils;
15 |
16 | import android.content.Context;
17 | import android.graphics.Color;
18 | import android.graphics.Paint;
19 |
20 | /**
21 | * Utility class for handling all of the Paint used to draw the CropOverlayView.
22 | */
23 | public class PaintUtil {
24 |
25 | // Private Constants ///////////////////////////////////////////////////////
26 |
27 | private static final int DEFAULT_CORNER_COLOR = Color.WHITE;
28 | private static final String SEMI_TRANSPARENT = "#AAFFFFFF";
29 | private static final String DEFAULT_BACKGROUND_COLOR_ID = "#B0000000";
30 | private static final float DEFAULT_LINE_THICKNESS_DP = 3;
31 | private static final float DEFAULT_CORNER_THICKNESS_DP = 5;
32 |
33 | /**
34 | * Creates the Paint object for drawing the crop window guidelines.
35 | *
36 | * @return the new Paint object
37 | */
38 | public static Paint newRotateBottomImagePaint() {
39 |
40 | final Paint paint = new Paint();
41 | paint.setColor(Color.WHITE);
42 | paint.setStrokeWidth(3);
43 |
44 | return paint;
45 | }
46 |
47 | /**
48 | * Creates the Paint object for drawing the translucent overlay outside the
49 | * crop window.
50 | *
51 | * @param context
52 | * the Context
53 | * @return the new Paint object
54 | */
55 | public static Paint newBackgroundPaint(Context context) {
56 |
57 | final Paint paint = new Paint();
58 | paint.setColor(Color.parseColor(DEFAULT_BACKGROUND_COLOR_ID));
59 |
60 | return paint;
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/editimage/utils/PointUtils.java:
--------------------------------------------------------------------------------
1 | package com.im4j.picturebeautify.editimage.utils;
2 |
3 | import android.graphics.Point;
4 | import android.graphics.PointF;
5 |
6 | /**
7 | * @author alafighting 2016-03
8 | */
9 | public class PointUtils {
10 |
11 | /**
12 | * 绕指定点旋转
13 | *
14 | * @param point
15 | * @param centerPoint
16 | * @param rotate
17 | * @return
18 | */
19 | public static PointF rotatePoint(PointF point, PointF centerPoint, float rotate) {
20 | float x = point.x;
21 | float y = point.y;
22 | float sinA = (float) Math.sin(Math.toRadians(rotate));
23 | float cosA = (float) Math.cos(Math.toRadians(rotate));
24 | float newX = centerPoint.x + (x - centerPoint.x) * cosA - (y - centerPoint.y) * sinA;
25 | float newY = centerPoint.y + (y - centerPoint.y) * cosA + (x - centerPoint.x) * sinA;
26 | return new PointF(newX, newY);
27 | }
28 |
29 | /**
30 | * 绕指定点旋转
31 | *
32 | * @param point
33 | * @param centerPoint
34 | * @param rotate
35 | * @return
36 | */
37 | public static Point rotatePoint(Point point, Point centerPoint, float rotate) {
38 | float x = point.x;
39 | float y = point.y;
40 | float sinA = (float) Math.sin(Math.toRadians(rotate));
41 | float cosA = (float) Math.cos(Math.toRadians(rotate));
42 | float newX = centerPoint.x + (x - centerPoint.x) * cosA - (y - centerPoint.y) * sinA;
43 | float newY = centerPoint.y + (y - centerPoint.y) * cosA + (x - centerPoint.x) * sinA;
44 | return new Point((int)newX, (int)newY);
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/editimage/view/CustomViewPager.java:
--------------------------------------------------------------------------------
1 | package com.im4j.picturebeautify.editimage.view;
2 |
3 | import android.content.Context;
4 | import android.support.v4.view.ViewPager;
5 | import android.util.AttributeSet;
6 |
7 | /**
8 | * 禁用ViewPager滑动事件
9 | *
10 | * @author panyi
11 | *
12 | */
13 | public class CustomViewPager extends ViewPager {
14 | private boolean isCanScroll = false;
15 |
16 | public CustomViewPager(Context context) {
17 | super(context);
18 | }
19 |
20 | @Override
21 | public void setCurrentItem(int item, boolean smoothScroll) {
22 | isCanScroll = true;
23 | super.setCurrentItem(item, smoothScroll);
24 | isCanScroll = false;
25 | }
26 |
27 | @Override
28 | public void setCurrentItem(int item) {
29 | setCurrentItem(item, false);
30 | }
31 |
32 | public CustomViewPager(Context context, AttributeSet attrs) {
33 | super(context, attrs);
34 | }
35 |
36 | public void setScanScroll(boolean isCanScroll) {
37 | this.isCanScroll = isCanScroll;
38 | }
39 |
40 | @Override
41 | public void scrollTo(int x, int y) {
42 | if (isCanScroll) {
43 | super.scrollTo(x, y);
44 | }
45 | }
46 | }// end class
47 |
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/editimage/view/LabelTextView.java:
--------------------------------------------------------------------------------
1 | package com.im4j.picturebeautify.editimage.view;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.graphics.PointF;
6 | import android.graphics.Typeface;
7 | import android.util.AttributeSet;
8 | import android.view.MotionEvent;
9 | import android.widget.TextView;
10 |
11 | import com.im4j.picturebeautify.editimage.utils.PointUtils;
12 |
13 | import java.util.LinkedHashMap;
14 |
15 | /**
16 | * 标签操作控件
17 | * @author panyi
18 | */
19 | public class LabelTextView extends TextView {
20 | private static int STATUS_IDLE = 0;
21 | private static int STATUS_MOVE = 1;// 移动状态
22 | private static int STATUS_DELETE = 2;// 删除状态
23 | private static int STATUS_ROTATE = 3;// 图片旋转状态
24 |
25 | private int imageCount;// 已加入照片的数量
26 | private int currentStatus;// 当前状态
27 | private TextItem currentItem;// 当前操作的贴图数据
28 | private float oldx, oldy;
29 |
30 |
31 | private LinkedHashMap bank = new LinkedHashMap<>();// 存贮每层贴图数据
32 |
33 | public LabelTextView(Context context) {
34 | super(context);
35 | init(context);
36 | }
37 |
38 | public LabelTextView(Context context, AttributeSet attrs) {
39 | super(context, attrs);
40 | init(context);
41 | }
42 |
43 | public LabelTextView(Context context, AttributeSet attrs, int defStyleAttr) {
44 | super(context, attrs, defStyleAttr);
45 | init(context);
46 | }
47 |
48 | private void init(Context context) {
49 | currentStatus = STATUS_IDLE;
50 | }
51 |
52 | public void addText(Typeface typeface, String text) {
53 | TextItem item = new TextItem(this.getContext());
54 | item.init(text, typeface, this);
55 | if (currentItem != null) {
56 | currentItem.isDrawHelpTool = false;
57 | }
58 | bank.put(++imageCount, item);
59 | this.invalidate();// 重绘视图
60 | }
61 |
62 | /**
63 | * 绘制客户页面
64 | */
65 | @Override
66 | protected void onDraw(Canvas canvas) {
67 | super.onDraw(canvas);
68 | // System.out.println("on draw!!~");
69 | for (Integer id : bank.keySet()) {
70 | TextItem item = bank.get(id);
71 | item.draw(canvas);
72 | }// end for each
73 | }
74 |
75 | @Override
76 | protected void onSizeChanged(int w, int h, int oldw, int oldh) {
77 | super.onSizeChanged(w, h, oldw, oldh);
78 | // System.out.println(w + " " + h + " " + oldw + " " + oldh);
79 | }
80 |
81 | @Override
82 | public boolean onTouchEvent(MotionEvent event) {
83 | boolean ret = super.onTouchEvent(event);// 是否向下传递事件标志 true为消耗
84 |
85 | int action = event.getAction();
86 | float x = event.getX();
87 | float y = event.getY();
88 | switch (action & MotionEvent.ACTION_MASK) {
89 | case MotionEvent.ACTION_DOWN:
90 |
91 | int deleteId = -1;
92 | for (Integer id : bank.keySet()) {
93 | TextItem item = bank.get(id);
94 | // 矫正触摸位置,适应旋转后的文字
95 | PointF point = new PointF(x, y);
96 | point = PointUtils.rotatePoint(point, new PointF(item.targetRect.centerX, item.targetRect.centerY), -item.targetRect.rotate);
97 | if (item.generateDeleteRect().contains(point.x, point.y)) { // 删除模式
98 | // ret = true;
99 | deleteId = id;
100 | currentStatus = STATUS_DELETE;
101 | } else if (item.generateRotateRect().contains(point.x, point.y)) {// 点击了旋转按钮
102 | ret = true;
103 | if (currentItem != null) {
104 | currentItem.isDrawHelpTool = false;
105 | }
106 | currentItem = item;
107 | currentItem.isDrawHelpTool = true;
108 | currentStatus = STATUS_ROTATE;
109 | oldx = x;
110 | oldy = y;
111 | } else if (item.targetRect.contains(point.x, point.y)) {// 移动模式
112 | // 被选中一张贴图
113 | ret = true;
114 | if (currentItem != null) {
115 | currentItem.isDrawHelpTool = false;
116 | }
117 | currentItem = item;
118 | currentItem.isDrawHelpTool = true;
119 | currentStatus = STATUS_MOVE;
120 | oldx = x;
121 | oldy = y;
122 | }// end if
123 | }// end for each
124 |
125 | if (!ret && currentItem != null && currentStatus == STATUS_IDLE) {// 没有贴图被选择
126 | currentItem.isDrawHelpTool = false;
127 | currentItem = null;
128 | invalidate();
129 | }
130 |
131 | if (deleteId > 0 && currentStatus == STATUS_DELETE) {// 删除选定贴图
132 | bank.remove(deleteId);
133 | currentStatus = STATUS_IDLE;// 返回空闲状态
134 | invalidate();
135 | }// end if
136 |
137 | break;
138 | case MotionEvent.ACTION_MOVE:
139 | ret = true;
140 | if (currentStatus == STATUS_MOVE) {// 移动贴图
141 | float dx = x - oldx;
142 | float dy = y - oldy;
143 | if (currentItem != null) {
144 | currentItem.updatePos(dx, dy);
145 | invalidate();
146 | }// end if
147 | oldx = x;
148 | oldy = y;
149 | } else if (currentStatus == STATUS_ROTATE) {// 旋转 缩放图片操作
150 | // System.out.println("旋转");
151 | float dx = x - oldx;
152 | float dy = y - oldy;
153 | if (currentItem != null) {
154 | currentItem.updateRotateAndScale(dx, dy);// 旋转
155 | invalidate();
156 | }// end if
157 | oldx = x;
158 | oldy = y;
159 | }
160 | break;
161 | case MotionEvent.ACTION_CANCEL:
162 | case MotionEvent.ACTION_UP:
163 | ret = false;
164 | currentStatus = STATUS_IDLE;
165 | break;
166 | }// end switch
167 | return ret;
168 | }
169 |
170 | public LinkedHashMap getBank() {
171 | return bank;
172 | }
173 |
174 | public void clear() {
175 | bank.clear();
176 | this.invalidate();
177 | }
178 | }// end class
179 |
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/editimage/view/RotateImageView.java:
--------------------------------------------------------------------------------
1 | package com.im4j.picturebeautify.editimage.view;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.graphics.Canvas;
6 | import android.graphics.Matrix;
7 | import android.graphics.Paint;
8 | import android.graphics.Rect;
9 | import android.graphics.RectF;
10 | import android.util.AttributeSet;
11 | import android.view.View;
12 |
13 | import com.im4j.picturebeautify.editimage.utils.PaintUtil;
14 |
15 | /**
16 | * 旋转图片
17 | *
18 | * @author 潘易
19 | *
20 | */
21 | public class RotateImageView extends View {
22 | private Rect srcRect;
23 | private RectF dstRect;
24 | private Rect maxRect;// 最大限制矩形框
25 |
26 | private Bitmap bitmap;
27 | private Matrix matrix = new Matrix();// 辅助计算矩形
28 |
29 | private float scale;// 缩放比率
30 | private int rotateAngle;
31 |
32 | private RectF wrapRect = new RectF();// 图片包围矩形
33 | private Paint bottomPaint;
34 | private RectF originImageRect;
35 |
36 | public RotateImageView(Context context) {
37 | super(context);
38 | init(context);
39 | }
40 |
41 | public RotateImageView(Context context, AttributeSet attrs) {
42 | super(context, attrs);
43 | init(context);
44 | }
45 |
46 | public RotateImageView(Context context, AttributeSet attrs, int defStyleAttr) {
47 | super(context, attrs, defStyleAttr);
48 | init(context);
49 | }
50 |
51 | private void init(Context context) {
52 | srcRect = new Rect();
53 | dstRect = new RectF();
54 | maxRect = new Rect();
55 | bottomPaint = PaintUtil.newRotateBottomImagePaint();
56 | originImageRect = new RectF();
57 | }
58 |
59 | public void addBit(Bitmap bit, RectF imageRect) {
60 | bitmap = bit;
61 | srcRect.set(0, 0, bitmap.getWidth(), bitmap.getHeight());
62 | dstRect = imageRect;
63 |
64 | originImageRect.set(0, 0, bit.getWidth(), bit.getHeight());
65 | this.invalidate();
66 | }
67 |
68 | public void rotateImage(int angle) {
69 | rotateAngle = angle;
70 | this.invalidate();
71 | }
72 |
73 | public void reset() {
74 | rotateAngle = 0;
75 | scale = 1;
76 | invalidate();
77 | }
78 |
79 | @Override
80 | public void draw(Canvas canvas) {
81 | super.draw(canvas);
82 | if (bitmap == null)
83 | return;
84 | maxRect.set(0, 0, getWidth(), getHeight());// 最大边界矩形
85 |
86 | calculateWrapBox();
87 | scale = 1;
88 | if (wrapRect.width() > getWidth()) {
89 | scale = getWidth() / wrapRect.width();
90 | }
91 |
92 | // 绘制图形
93 | canvas.save();
94 | canvas.scale(scale, scale, canvas.getWidth() >> 1,
95 | canvas.getHeight() >> 1);
96 | canvas.drawRect(wrapRect, bottomPaint);
97 | canvas.rotate(rotateAngle, canvas.getWidth() >> 1,
98 | canvas.getHeight() >> 1);
99 | canvas.drawBitmap(bitmap, srcRect, dstRect, null);
100 | canvas.restore();
101 | }
102 |
103 | /**
104 | * 计算出矩形包围盒
105 | */
106 | private void calculateWrapBox() {
107 | wrapRect.set(dstRect);
108 | matrix.reset();// 重置矩阵为单位矩阵
109 | int centerX = getWidth() >> 1;
110 | int centerY = getHeight() >> 1;
111 | matrix.postRotate(rotateAngle, centerX, centerY);// 旋转后的角度
112 | // System.out.println("旋转之前-->" + wrapRect.left + " " + wrapRect.top
113 | // + " " + wrapRect.right + " " + wrapRect.bottom);
114 | matrix.mapRect(wrapRect);
115 | // System.out.println("旋转之后-->" + wrapRect.left + " " + wrapRect.top
116 | // + " " + wrapRect.right + " " + wrapRect.bottom);
117 | }
118 |
119 | /**
120 | * 取得旋转后新图片的大小
121 | *
122 | * @return
123 | */
124 | public RectF getImageNewRect() {
125 | Matrix m = new Matrix();
126 | m.postRotate(this.rotateAngle, originImageRect.centerX(),
127 | originImageRect.centerY());
128 | m.mapRect(originImageRect);
129 | return originImageRect;
130 | }
131 |
132 | /**
133 | * 缩放比率
134 | * @return
135 | */
136 | public synchronized float getScale() {
137 | return scale;
138 | }
139 |
140 | /**
141 | * 旋转角度
142 | * @return
143 | */
144 | public synchronized int getRotateAngle() {
145 | return rotateAngle;
146 | }
147 | }// end class
148 |
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/editimage/view/StickerView.java:
--------------------------------------------------------------------------------
1 | package com.im4j.picturebeautify.editimage.view;
2 |
3 |
4 | import java.util.LinkedHashMap;
5 |
6 | import android.content.Context;
7 | import android.graphics.Bitmap;
8 | import android.graphics.Canvas;
9 | import android.graphics.Color;
10 | import android.graphics.Paint;
11 | import android.util.AttributeSet;
12 | import android.view.MotionEvent;
13 | import android.view.View;
14 |
15 | /**
16 | * 贴图操作控件
17 | *
18 | * @author panyi
19 | *
20 | */
21 | public class StickerView extends View {
22 | private static int STATUS_IDLE = 0;
23 | private static int STATUS_MOVE = 1;// 移动状态
24 | private static int STATUS_DELETE = 2;// 删除状态
25 | private static int STATUS_ROTATE = 3;// 图片旋转状态
26 |
27 | private int imageCount;// 已加入照片的数量
28 | private int currentStatus;// 当前状态
29 | private StickerItem currentItem;// 当前操作的贴图数据
30 | private float oldx, oldy;
31 |
32 | private Paint rectPaint = new Paint();
33 |
34 | private LinkedHashMap bank = new LinkedHashMap();// 存贮每层贴图数据
35 |
36 | public StickerView(Context context) {
37 | super(context);
38 | init(context);
39 | }
40 |
41 | public StickerView(Context context, AttributeSet attrs) {
42 | super(context, attrs);
43 | init(context);
44 | }
45 |
46 | public StickerView(Context context, AttributeSet attrs, int defStyleAttr) {
47 | super(context, attrs, defStyleAttr);
48 | init(context);
49 | }
50 |
51 | private void init(Context context) {
52 | currentStatus = STATUS_IDLE;
53 |
54 | rectPaint.setColor(Color.RED);
55 | rectPaint.setAlpha(100);
56 |
57 | }
58 |
59 | public void addBitImage(final Bitmap addBit) {
60 | StickerItem item = new StickerItem(this.getContext());
61 | item.init(addBit, this);
62 | if (currentItem != null) {
63 | currentItem.isDrawHelpTool = false;
64 | }
65 | bank.put(++imageCount, item);
66 | this.invalidate();// 重绘视图
67 | }
68 |
69 | /**
70 | * 绘制客户页面
71 | */
72 | @Override
73 | protected void onDraw(Canvas canvas) {
74 | super.onDraw(canvas);
75 | // System.out.println("on draw!!~");
76 | for (Integer id : bank.keySet()) {
77 | StickerItem item = bank.get(id);
78 | item.draw(canvas);
79 | }// end for each
80 | }
81 |
82 | @Override
83 | protected void onSizeChanged(int w, int h, int oldw, int oldh) {
84 | super.onSizeChanged(w, h, oldw, oldh);
85 | // System.out.println(w + " " + h + " " + oldw + " " + oldh);
86 | }
87 |
88 | @Override
89 | public boolean onTouchEvent(MotionEvent event) {
90 | boolean ret = super.onTouchEvent(event);// 是否向下传递事件标志 true为消耗
91 |
92 | int action = event.getAction();
93 | float x = event.getX();
94 | float y = event.getY();
95 | switch (action & MotionEvent.ACTION_MASK) {
96 | case MotionEvent.ACTION_DOWN:
97 |
98 | int deleteId = -1;
99 | for (Integer id : bank.keySet()) {
100 | StickerItem item = bank.get(id);
101 | if (item.detectDeleteRect.contains(x, y)) {// 删除模式
102 | // ret = true;
103 | deleteId = id;
104 | currentStatus = STATUS_DELETE;
105 | } else if (item.detectRotateRect.contains(x, y)) {// 点击了旋转按钮
106 | ret = true;
107 | if (currentItem != null) {
108 | currentItem.isDrawHelpTool = false;
109 | }
110 | currentItem = item;
111 | currentItem.isDrawHelpTool = true;
112 | currentStatus = STATUS_ROTATE;
113 | oldx = x;
114 | oldy = y;
115 | } else if (item.dstRect.contains(x, y)) {// 移动模式
116 | // 被选中一张贴图
117 | ret = true;
118 | if (currentItem != null) {
119 | currentItem.isDrawHelpTool = false;
120 | }
121 | currentItem = item;
122 | currentItem.isDrawHelpTool = true;
123 | currentStatus = STATUS_MOVE;
124 | oldx = x;
125 | oldy = y;
126 | }// end if
127 | }// end for each
128 |
129 | if (!ret && currentItem != null && currentStatus == STATUS_IDLE) {// 没有贴图被选择
130 | currentItem.isDrawHelpTool = false;
131 | currentItem = null;
132 | invalidate();
133 | }
134 |
135 | if (deleteId > 0 && currentStatus == STATUS_DELETE) {// 删除选定贴图
136 | bank.remove(deleteId);
137 | currentStatus = STATUS_IDLE;// 返回空闲状态
138 | invalidate();
139 | }// end if
140 |
141 | break;
142 | case MotionEvent.ACTION_MOVE:
143 | ret = true;
144 | if (currentStatus == STATUS_MOVE) {// 移动贴图
145 | float dx = x - oldx;
146 | float dy = y - oldy;
147 | if (currentItem != null) {
148 | currentItem.updatePos(dx, dy);
149 | invalidate();
150 | }// end if
151 | oldx = x;
152 | oldy = y;
153 | } else if (currentStatus == STATUS_ROTATE) {// 旋转 缩放图片操作
154 | // System.out.println("旋转");
155 | float dx = x - oldx;
156 | float dy = y - oldy;
157 | if (currentItem != null) {
158 | currentItem.updateRotateAndScale(oldx, oldy, dx, dy);// 旋转
159 | invalidate();
160 | }// end if
161 | oldx = x;
162 | oldy = y;
163 | }
164 | break;
165 | case MotionEvent.ACTION_CANCEL:
166 | case MotionEvent.ACTION_UP:
167 | ret = false;
168 | currentStatus = STATUS_IDLE;
169 | break;
170 | }// end switch
171 | return ret;
172 | }
173 |
174 | public LinkedHashMap getBank() {
175 | return bank;
176 | }
177 |
178 | public void clear() {
179 | bank.clear();
180 | this.invalidate();
181 | }
182 | }// end class
183 |
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/editimage/view/imagezoom/ImageViewTouch.java:
--------------------------------------------------------------------------------
1 | package com.im4j.picturebeautify.editimage.view.imagezoom;
2 |
3 | import android.content.Context;
4 | import android.graphics.Matrix;
5 | import android.graphics.Rect;
6 | import android.graphics.RectF;
7 | import android.graphics.drawable.Drawable;
8 | import android.util.AttributeSet;
9 | import android.util.Log;
10 | import android.view.GestureDetector;
11 | import android.view.GestureDetector.OnGestureListener;
12 | import android.view.MotionEvent;
13 | import android.view.ScaleGestureDetector;
14 | import android.view.ScaleGestureDetector.OnScaleGestureListener;
15 | import android.view.ViewConfiguration;
16 |
17 | public class ImageViewTouch extends ImageViewTouchBase{
18 | static final float SCROLL_DELTA_THRESHOLD = 1.0f;
19 | protected ScaleGestureDetector mScaleDetector;
20 | protected GestureDetector mGestureDetector;
21 | protected int mTouchSlop;
22 | protected float mScaleFactor;
23 | protected int mDoubleTapDirection;
24 | protected OnGestureListener mGestureListener;
25 | protected OnScaleGestureListener mScaleListener;
26 | protected boolean mDoubleTapEnabled = true;
27 | protected boolean mScaleEnabled = true;
28 | protected boolean mScrollEnabled = true;
29 | private OnImageViewTouchDoubleTapListener mDoubleTapListener;
30 | private OnImageViewTouchSingleTapListener mSingleTapListener;
31 |
32 | public ImageViewTouch(Context context, AttributeSet attrs) {
33 | super(context, attrs);
34 | }
35 |
36 | @Override
37 | protected void init() {
38 | super.init();
39 | mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
40 | mGestureListener = getGestureListener();
41 | mScaleListener = getScaleListener();
42 | mScaleDetector = new ScaleGestureDetector(getContext(), mScaleListener);
43 | mGestureDetector = new GestureDetector(getContext(), mGestureListener,
44 | null, true);
45 |
46 | mDoubleTapDirection = 1;
47 | }
48 |
49 | public void setDoubleTapListener(OnImageViewTouchDoubleTapListener listener) {
50 | mDoubleTapListener = listener;
51 | }
52 |
53 | public void setSingleTapListener(OnImageViewTouchSingleTapListener listener) {
54 | mSingleTapListener = listener;
55 | }
56 |
57 | public void setDoubleTapEnabled(boolean value) {
58 | mDoubleTapEnabled = value;
59 | }
60 |
61 | public void setScaleEnabled(boolean value) {
62 | mScaleEnabled = value;
63 | setDoubleTapEnabled(value);
64 | }
65 |
66 | public void setScrollEnabled(boolean value) {
67 | mScrollEnabled = value;
68 | }
69 |
70 | public boolean getDoubleTapEnabled() {
71 | return mDoubleTapEnabled;
72 | }
73 |
74 | protected OnGestureListener getGestureListener() {
75 | return new GestureListener();
76 | }
77 |
78 | protected OnScaleGestureListener getScaleListener() {
79 | return new ScaleListener();
80 | }
81 |
82 | @Override
83 | protected void _setImageDrawable(final Drawable drawable,
84 | final Matrix initial_matrix, float min_zoom, float max_zoom) {
85 | super._setImageDrawable(drawable, initial_matrix, min_zoom, max_zoom);
86 | mScaleFactor = getMaxScale() / 3;
87 | }
88 |
89 | @Override
90 | public boolean onTouchEvent(MotionEvent event) {
91 | mScaleDetector.onTouchEvent(event);
92 |
93 | if (!mScaleDetector.isInProgress()) {
94 | mGestureDetector.onTouchEvent(event);
95 | }
96 |
97 | int action = event.getAction();
98 | switch (action & MotionEvent.ACTION_MASK) {
99 | case MotionEvent.ACTION_UP:
100 | if (getScale() < getMinScale()) {
101 | zoomTo(getMinScale(), 500);
102 | }
103 | break;
104 | }
105 | return true;
106 | }
107 |
108 | @Override
109 | protected void onZoomAnimationCompleted(float scale) {
110 |
111 | if (LOG_ENABLED) {
112 | Log.d(LOG_TAG, "onZoomAnimationCompleted. scale: " + scale
113 | + ", minZoom: " + getMinScale());
114 | }
115 |
116 | if (scale < getMinScale()) {
117 | zoomTo(getMinScale(), 50);
118 | }
119 | }
120 |
121 | protected float onDoubleTapPost(float scale, float maxZoom) {
122 | if (mDoubleTapDirection == 1) {
123 | if ((scale + (mScaleFactor * 2)) <= maxZoom) {
124 | return scale + mScaleFactor;
125 | } else {
126 | mDoubleTapDirection = -1;
127 | return maxZoom;
128 | }
129 | } else {
130 | mDoubleTapDirection = 1;
131 | return 1f;
132 | }
133 | }
134 |
135 | public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX,
136 | float distanceY) {
137 | if (!mScrollEnabled)
138 | return false;
139 |
140 | if (e1 == null || e2 == null)
141 | return false;
142 | if (e1.getPointerCount() > 1 || e2.getPointerCount() > 1)
143 | return false;
144 | if (mScaleDetector.isInProgress())
145 | return false;
146 | if (getScale() == 1f)
147 | return false;
148 |
149 | mUserScaled = true;
150 | // scrollBy(distanceX, distanceY);
151 | scrollBy(-distanceX, -distanceY);
152 | // RectF r = getBitmapRect();
153 | // System.out.println(r.left + " " + r.top + " " + r.right + " "
154 | // + r.bottom);
155 | invalidate();
156 | return true;
157 | }
158 |
159 | /**
160 | * ���ٻ���
161 | *
162 | * @param e1
163 | * @param e2
164 | * @param velocityX
165 | * @param velocityY
166 | * @return
167 | */
168 | public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
169 | float velocityY) {
170 | if (!mScrollEnabled)
171 | return false;
172 |
173 | if (e1.getPointerCount() > 1 || e2.getPointerCount() > 1)
174 | return false;
175 | if (mScaleDetector.isInProgress())
176 | return false;
177 | if (getScale() == 1f)
178 | return false;
179 |
180 | float diffX = e2.getX() - e1.getX();
181 | float diffY = e2.getY() - e1.getY();
182 | if (Math.abs(velocityX) > 800 || Math.abs(velocityY) > 800) {
183 | mUserScaled = true;
184 | // System.out.println("on fling scroll");
185 | scrollBy(diffX / 2, diffY / 2, 300);
186 | invalidate();
187 | return true;
188 | }
189 | return false;
190 | }
191 |
192 | /**
193 | * Determines whether this ImageViewTouch can be scrolled.
194 | *
195 | * @param direction
196 | * - positive direction value means scroll from right to left,
197 | * negative value means scroll from left to right
198 | *
199 | * @return true if there is some more place to scroll, false - otherwise.
200 | */
201 | public boolean canScroll(int direction) {
202 | RectF bitmapRect = getBitmapRect();
203 | updateRect(bitmapRect, mScrollRect);
204 | Rect imageViewRect = new Rect();
205 | getGlobalVisibleRect(imageViewRect);
206 |
207 | if (null == bitmapRect) {
208 | return false;
209 | }
210 |
211 | if (bitmapRect.right >= imageViewRect.right) {
212 | if (direction < 0) {
213 | return Math.abs(bitmapRect.right - imageViewRect.right) > SCROLL_DELTA_THRESHOLD;
214 | }
215 | }
216 |
217 | double bitmapScrollRectDelta = Math.abs(bitmapRect.left
218 | - mScrollRect.left);
219 | return bitmapScrollRectDelta > SCROLL_DELTA_THRESHOLD;
220 | }
221 |
222 | public class GestureListener extends
223 | GestureDetector.SimpleOnGestureListener {
224 |
225 | @Override
226 | public boolean onSingleTapConfirmed(MotionEvent e) {
227 |
228 | if (null != mSingleTapListener) {
229 | mSingleTapListener.onSingleTapConfirmed();
230 | }
231 |
232 | return super.onSingleTapConfirmed(e);
233 | }
234 |
235 | @Override
236 | public boolean onDoubleTap(MotionEvent e) {
237 | Log.i(LOG_TAG, "onDoubleTap. double tap enabled? "
238 | + mDoubleTapEnabled);
239 | if (mDoubleTapEnabled) {
240 | mUserScaled = true;
241 | float scale = getScale();
242 | float targetScale = scale;
243 | targetScale = onDoubleTapPost(scale, getMaxScale());
244 | targetScale = Math.min(getMaxScale(),
245 | Math.max(targetScale, getMinScale()));
246 | zoomTo(targetScale, e.getX(), e.getY(),
247 | DEFAULT_ANIMATION_DURATION);
248 | invalidate();
249 | }
250 |
251 | if (null != mDoubleTapListener) {
252 | mDoubleTapListener.onDoubleTap();
253 | }
254 |
255 | return super.onDoubleTap(e);
256 | }
257 |
258 | @Override
259 | public void onLongPress(MotionEvent e) {
260 | if (isLongClickable()) {
261 | if (!mScaleDetector.isInProgress()) {
262 | setPressed(true);
263 | performLongClick();
264 | }
265 | }
266 | }
267 |
268 | @Override
269 | public boolean onScroll(MotionEvent e1, MotionEvent e2,
270 | float distanceX, float distanceY) {
271 | return ImageViewTouch.this.onScroll(e1, e2, distanceX, distanceY);
272 | }
273 |
274 | @Override
275 | public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
276 | float velocityY) {
277 | return ImageViewTouch.this.onFling(e1, e2, velocityX, velocityY);
278 | }
279 | }// end inner class
280 |
281 | public class ScaleListener extends
282 | ScaleGestureDetector.SimpleOnScaleGestureListener {
283 | protected boolean mScaled = false;
284 |
285 | @Override
286 | public boolean onScale(ScaleGestureDetector detector) {
287 | float span = detector.getCurrentSpan() - detector.getPreviousSpan();
288 | float targetScale = getScale() * detector.getScaleFactor();
289 | // System.out.println("span--->" + span);
290 | if (mScaleEnabled) {
291 | if (mScaled && span != 0) {
292 | mUserScaled = true;
293 | targetScale = Math.min(getMaxScale(),
294 | Math.max(targetScale, getMinScale() - 0.1f));
295 | zoomTo(targetScale, detector.getFocusX(),
296 | detector.getFocusY());
297 | mDoubleTapDirection = 1;
298 | invalidate();
299 | return true;
300 | }
301 |
302 | // This is to prevent a glitch the first time
303 | // image is scaled.
304 | if (!mScaled)
305 | mScaled = true;
306 | }
307 | return true;
308 | }
309 | }// end inner class
310 |
311 | public void resetImage() {
312 | float scale = getScale();
313 | float targetScale = scale;
314 | targetScale = Math.min(getMaxScale(),
315 | Math.max(targetScale, getMinScale()));
316 | zoomTo(targetScale, 0, 0, DEFAULT_ANIMATION_DURATION);
317 | invalidate();
318 | }
319 |
320 | public interface OnImageViewTouchDoubleTapListener {
321 |
322 | void onDoubleTap();
323 | }
324 |
325 | public interface OnImageViewTouchSingleTapListener {
326 |
327 | void onSingleTapConfirmed();
328 | }
329 |
330 | }
331 |
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/editimage/view/imagezoom/easing/Cubic.java:
--------------------------------------------------------------------------------
1 | package com.im4j.picturebeautify.editimage.view.imagezoom.easing;
2 |
3 | public class Cubic implements Easing {
4 |
5 | @Override
6 | public double easeOut( double time, double start, double end, double duration ) {
7 | return end * ( ( time = time / duration - 1.0 ) * time * time + 1.0 ) + start;
8 | }
9 |
10 | @Override
11 | public double easeIn( double time, double start, double end, double duration ) {
12 | return end * ( time /= duration ) * time * time + start;
13 | }
14 |
15 | @Override
16 | public double easeInOut( double time, double start, double end, double duration ) {
17 | if ( ( time /= duration / 2.0 ) < 1.0 ) return end / 2.0 * time * time * time + start;
18 | return end / 2.0 * ( ( time -= 2.0 ) * time * time + 2.0 ) + start;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/editimage/view/imagezoom/easing/Easing.java:
--------------------------------------------------------------------------------
1 | package com.im4j.picturebeautify.editimage.view.imagezoom.easing;
2 |
3 | public interface Easing {
4 |
5 | double easeOut(double time, double start, double end, double duration);
6 |
7 | double easeIn(double time, double start, double end, double duration);
8 |
9 | double easeInOut(double time, double start, double end, double duration);
10 | }
11 |
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/editimage/view/imagezoom/easing/Elastic.java:
--------------------------------------------------------------------------------
1 | package com.im4j.picturebeautify.editimage.view.imagezoom.easing;
2 |
3 | public class Elastic implements Easing {
4 |
5 | @Override
6 | public double easeIn( double time, double start, double end, double duration ) {
7 | return easeIn( time, start, end, duration, start + end, duration );
8 | }
9 |
10 | public double easeIn( double t, double b, double c, double d, double a, double p ) {
11 | double s;
12 | if ( t == 0 ) return b;
13 | if ( ( t /= d ) == 1 ) return b + c;
14 | if ( !( p > 0 ) ) p = d * .3;
15 | if ( !( a > 0 ) || a < Math.abs( c ) ) {
16 | a = c;
17 | s = p / 4;
18 | } else
19 | s = p / ( 2 * Math.PI ) * Math.asin( c / a );
20 | return -( a * Math.pow( 2, 10 * ( t -= 1 ) ) * Math.sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) ) + b;
21 | }
22 |
23 | @Override
24 | public double easeOut( double time, double start, double end, double duration ) {
25 | return easeOut( time, start, end, duration, start + end, duration );
26 | }
27 |
28 | public double easeOut( double t, double b, double c, double d, double a, double p ) {
29 | double s;
30 | if ( t == 0 ) return b;
31 | if ( ( t /= d ) == 1 ) return b + c;
32 | if ( !( p > 0 ) ) p = d * .3;
33 | if ( !( a > 0 ) || a < Math.abs( c ) ) {
34 | a = c;
35 | s = p / 4;
36 | } else
37 | s = p / ( 2 * Math.PI ) * Math.asin( c / a );
38 | return ( a * Math.pow( 2, -10 * t ) * Math.sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) + c + b );
39 | }
40 |
41 | @Override
42 | public double easeInOut( double t, double b, double c, double d ) {
43 | return easeInOut( t, b, c, d, b + c, d );
44 | }
45 |
46 | public double easeInOut( double t, double b, double c, double d, double a, double p ) {
47 | double s;
48 |
49 | if ( t == 0 ) return b;
50 | if ( ( t /= d / 2 ) == 2 ) return b + c;
51 | if ( !( p > 0 ) ) p = d * ( .3 * 1.5 );
52 | if ( !( a > 0 ) || a < Math.abs( c ) ) {
53 | a = c;
54 | s = p / 4;
55 | } else
56 | s = p / ( 2 * Math.PI ) * Math.asin( c / a );
57 | if ( t < 1 ) return -.5 * ( a * Math.pow( 2, 10 * ( t -= 1 ) ) * Math.sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) ) + b;
58 | return a * Math.pow( 2, -10 * ( t -= 1 ) ) * Math.sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) * .5 + c + b;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/editimage/view/imagezoom/graphic/FastBitmapDrawable.java:
--------------------------------------------------------------------------------
1 | package com.im4j.picturebeautify.editimage.view.imagezoom.graphic;
2 |
3 | import java.io.InputStream;
4 | import android.content.res.Resources;
5 | import android.graphics.Bitmap;
6 | import android.graphics.BitmapFactory;
7 | import android.graphics.Canvas;
8 | import android.graphics.ColorFilter;
9 | import android.graphics.Paint;
10 | import android.graphics.PixelFormat;
11 | import android.graphics.drawable.Drawable;
12 |
13 | /**
14 | * Fast bitmap drawable. Does not support states. it only
15 | * support alpha and colormatrix
16 | * @author alessandro
17 | *
18 | */
19 | public class FastBitmapDrawable extends Drawable implements IBitmapDrawable {
20 |
21 | protected Bitmap mBitmap;
22 | protected Paint mPaint;
23 |
24 | public FastBitmapDrawable( Bitmap b ) {
25 | mBitmap = b;
26 | mPaint = new Paint();
27 | mPaint.setDither( true );
28 | mPaint.setFilterBitmap( true );
29 | }
30 |
31 | @Override
32 | public void draw( Canvas canvas ) {
33 | canvas.drawBitmap( mBitmap, 0.0f, 0.0f, mPaint );
34 | }
35 |
36 | @Override
37 | public int getOpacity() {
38 | return PixelFormat.TRANSLUCENT;
39 | }
40 |
41 | @Override
42 | public void setAlpha( int alpha ) {
43 | mPaint.setAlpha( alpha );
44 | }
45 |
46 | @Override
47 | public void setColorFilter( ColorFilter cf ) {
48 | mPaint.setColorFilter( cf );
49 | }
50 |
51 | @Override
52 | public int getIntrinsicWidth() {
53 | return mBitmap.getWidth();
54 | }
55 |
56 | @Override
57 | public int getIntrinsicHeight() {
58 | return mBitmap.getHeight();
59 | }
60 |
61 | @Override
62 | public int getMinimumWidth() {
63 | return mBitmap.getWidth();
64 | }
65 |
66 | @Override
67 | public int getMinimumHeight() {
68 | return mBitmap.getHeight();
69 | }
70 |
71 | public void setAntiAlias( boolean value ){
72 | mPaint.setAntiAlias( value );
73 | invalidateSelf();
74 | }
75 |
76 | @Override
77 | public Bitmap getBitmap() {
78 | return mBitmap;
79 | }
80 | }
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/editimage/view/imagezoom/graphic/IBitmapDrawable.java:
--------------------------------------------------------------------------------
1 | package com.im4j.picturebeautify.editimage.view.imagezoom.graphic;
2 |
3 | import android.graphics.Bitmap;
4 |
5 |
6 | /**
7 | * Base interface used in the {@link ImageViewTouchBase} view
8 | * @author alessandro
9 | *
10 | */
11 | public interface IBitmapDrawable {
12 |
13 | Bitmap getBitmap();
14 | }
15 |
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/picchooser/BucketItem.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Thomas Hoffmann
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.im4j.picturebeautify.picchooser;
17 |
18 | class BucketItem extends GridItem {
19 |
20 | final int id;
21 | int images = 1;
22 |
23 | /**
24 | * Creates a new BucketItem
25 | *
26 | * @param n the name of the bucket
27 | * @param p the absolute path to the bucket
28 | * @param i the bucket ID
29 | */
30 | public BucketItem(final String n, final String p,final String taken, int i) {
31 | super(n, p,taken,0);
32 | id = i;
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/picchooser/BucketsFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Thomas Hoffmann
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.im4j.picturebeautify.picchooser;
17 |
18 | import java.util.ArrayList;
19 | import java.util.List;
20 |
21 | import android.database.Cursor;
22 | import android.os.Bundle;
23 | import android.provider.MediaStore;
24 | import android.support.v4.app.Fragment;
25 | import android.view.LayoutInflater;
26 | import android.view.View;
27 | import android.view.ViewGroup;
28 | import android.widget.AdapterView;
29 | import android.widget.AdapterView.OnItemClickListener;
30 | import android.widget.GridView;
31 | import android.widget.Toast;
32 |
33 | import com.im4j.picturebeautify.R;
34 |
35 | public class BucketsFragment extends Fragment {
36 |
37 | @Override
38 | public View onCreateView(final LayoutInflater inflater,
39 | final ViewGroup container, final Bundle savedInstanceState) {
40 | View v = inflater.inflate(R.layout.gallery, null);
41 |
42 | String[] projection = new String[] { MediaStore.Images.Media.DATA,
43 | MediaStore.Images.Media.BUCKET_DISPLAY_NAME,
44 | MediaStore.Images.Media.BUCKET_ID };
45 |
46 | Cursor cur = getActivity().getContentResolver().query(
47 | MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
48 | projection,
49 | null,
50 | null,
51 | MediaStore.Images.Media.BUCKET_DISPLAY_NAME + " ASC, "
52 | + MediaStore.Images.Media.DATE_MODIFIED + " DESC");
53 |
54 | final List buckets = new ArrayList();
55 | BucketItem lastBucket = null;
56 |
57 | if (cur != null) {
58 | if (cur.moveToFirst()) {
59 | while (!cur.isAfterLast()) {
60 | if (lastBucket == null
61 | || !lastBucket.name.equals(cur.getString(1))) {
62 | lastBucket = new BucketItem(cur.getString(1),
63 | cur.getString(0), "", cur.getInt(2));
64 | buckets.add(lastBucket);
65 | } else {
66 | lastBucket.images++;
67 | }
68 | cur.moveToNext();
69 | }
70 | }
71 | cur.close();
72 | }
73 |
74 | if (buckets.isEmpty()) {
75 | Toast.makeText(getActivity(), R.string.no_images,
76 | Toast.LENGTH_SHORT).show();
77 | getActivity().finish();
78 | } else {
79 | GridView grid = (GridView) v.findViewById(R.id.grid);
80 | grid.setAdapter(new GalleryAdapter(getActivity(), buckets));
81 | grid.setOnItemClickListener(new OnItemClickListener() {
82 | @Override
83 | public void onItemClick(AdapterView> parent, View view,
84 | int position, long id) {
85 | ((SelectPictureActivity) getActivity())
86 | .showBucket(((BucketItem) buckets.get(position)).id);
87 | }
88 | });
89 | }
90 | return v;
91 | }
92 |
93 | }
94 |
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/picchooser/GalleryAdapter.java:
--------------------------------------------------------------------------------
1 | package com.im4j.picturebeautify.picchooser;
2 |
3 | import java.util.List;
4 | import android.content.Context;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.BaseAdapter;
9 | import android.widget.ImageView;
10 | import android.widget.TextView;
11 |
12 | import com.im4j.picturebeautify.R;
13 | import com.nostra13.universalimageloader.core.ImageLoader;
14 |
15 |
16 | class GalleryAdapter extends BaseAdapter {
17 |
18 | private final Context context;
19 | private final List items;
20 | private final LayoutInflater mInflater;
21 |
22 | public GalleryAdapter(final Context context, final List buckets) {
23 | this.items = buckets;
24 | this.context = context;
25 | this.mInflater = LayoutInflater.from(context);
26 | }
27 |
28 | @Override
29 | public int getCount() {
30 | return items.size();
31 | }
32 |
33 | @Override
34 | public Object getItem(int position) {
35 | return items.get(position);
36 | }
37 |
38 | @Override
39 | public long getItemId(int position) {
40 | return items.get(position).hashCode();
41 | }
42 |
43 | @Override
44 | public View getView(int position, View convertView, final ViewGroup parent) {
45 | if (items.get(0) instanceof BucketItem) { // show buckets
46 | ViewHolder holder;
47 | if (convertView == null) {
48 | convertView = mInflater.inflate(R.layout.bucketitem, null);
49 | holder = new ViewHolder();
50 | holder.icon = (ImageView) convertView.findViewById(R.id.icon);
51 | holder.text = (TextView) convertView.findViewById(R.id.text);
52 | convertView.setTag(holder);
53 | } else {
54 | holder = (ViewHolder) convertView.getTag();
55 | }
56 | BucketItem bi = (BucketItem) items.get(position);
57 | holder.text.setText(bi.images > 1 ?
58 | bi.name + " - " + context.getString(R.string.images, bi.images) :
59 | bi.name);
60 | ImageLoader.getInstance().displayImage("file://" + bi.path, holder.icon);
61 |
62 | return convertView;
63 | } else { // show images in a bucket
64 | ImageView imageView;
65 | if (convertView == null) { // if it's not recycled, initialize some attributes
66 | imageView = (ImageView) mInflater.inflate(R.layout.imageitem, null);
67 | } else {
68 | imageView = (ImageView) convertView;
69 | }
70 | ImageLoader.getInstance().displayImage("file://" + items.get(position).path, imageView);
71 | return imageView;
72 | }
73 | }
74 |
75 | private static class ViewHolder {
76 | private ImageView icon;
77 | private TextView text;
78 | }
79 |
80 | }
81 |
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/picchooser/GridItem.java:
--------------------------------------------------------------------------------
1 | package com.im4j.picturebeautify.picchooser;
2 |
3 | class GridItem {
4 | final String name;
5 | final String path;
6 | final String imageTaken;
7 | final long imageSize;
8 | public GridItem(final String n, final String p,final String imageTaken,final long imageSize) {
9 | name = n;
10 | path = p;
11 | this.imageTaken = imageTaken;
12 | this.imageSize = imageSize;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/picchooser/ImagesFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Thomas Hoffmann
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.im4j.picturebeautify.picchooser;
17 |
18 | import java.util.ArrayList;
19 | import java.util.List;
20 |
21 | import android.database.Cursor;
22 | import android.os.Bundle;
23 | import android.provider.MediaStore;
24 | import android.support.v4.app.Fragment;
25 | import android.view.LayoutInflater;
26 | import android.view.View;
27 | import android.view.ViewGroup;
28 | import android.widget.AdapterView;
29 | import android.widget.AdapterView.OnItemClickListener;
30 | import android.widget.GridView;
31 |
32 | import com.im4j.picturebeautify.R;
33 |
34 | public class ImagesFragment extends Fragment {
35 |
36 | @Override
37 | public View onCreateView(final LayoutInflater inflater,
38 | final ViewGroup container, final Bundle savedInstanceState) {
39 | View v = inflater.inflate(R.layout.gallery, null);
40 |
41 | Cursor cur = getActivity().getContentResolver()
42 | .query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
43 | new String[] { MediaStore.Images.Media.DATA,
44 | MediaStore.Images.Media.DISPLAY_NAME,
45 | MediaStore.Images.Media.DATE_TAKEN,MediaStore.Images.Media.SIZE },
46 | MediaStore.Images.Media.BUCKET_ID + " = ?",
47 | new String[] { String.valueOf(getArguments().getInt(
48 | "bucket")) },
49 | MediaStore.Images.Media.DATE_MODIFIED + " ASC");
50 |
51 | final List images = new ArrayList(cur.getCount());
52 |
53 | if (cur != null) {
54 | if (cur.moveToFirst()) {
55 | while (!cur.isAfterLast()) {
56 | images.add(new GridItem(cur.getString(1), cur.getString(0),cur.getString(2),cur.getLong(3)));
57 | cur.moveToNext();
58 | }
59 | }
60 | cur.close();
61 | }
62 |
63 | GridView grid = (GridView) v.findViewById(R.id.grid);
64 | grid.setAdapter(new GalleryAdapter(getActivity(), images));
65 | grid.setOnItemClickListener(new OnItemClickListener() {
66 | @Override
67 | public void onItemClick(AdapterView> parent, View view,
68 | int position, long id) {
69 | ((SelectPictureActivity) getActivity()).imageSelected(images
70 | .get(position).path,images
71 | .get(position).imageTaken,images
72 | .get(position).imageSize);
73 | }
74 | });
75 | return v;
76 | }
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/picchooser/SelectPictureActivity.java:
--------------------------------------------------------------------------------
1 |
2 | package com.im4j.picturebeautify.picchooser;
3 |
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.support.v4.app.Fragment;
7 | import android.support.v4.app.FragmentTransaction;
8 | import com.im4j.picturebeautify.BaseActivity;
9 |
10 | public class SelectPictureActivity extends BaseActivity {
11 | @Override
12 | protected void onCreate(final Bundle b) {
13 | super.onCreate(b);
14 | checkInitImageLoader();
15 | setResult(RESULT_CANCELED);
16 |
17 | // Create new fragment and transaction
18 | Fragment newFragment = new BucketsFragment();
19 | FragmentTransaction transaction = getSupportFragmentManager()
20 | .beginTransaction();
21 |
22 | // Replace whatever is in the fragment_container view with this
23 | // fragment,
24 | // and add the transaction to the back stack
25 | transaction.replace(android.R.id.content, newFragment);
26 |
27 | // Commit the transaction
28 | transaction.commit();
29 | }
30 |
31 | void showBucket(final int bucketId) {
32 | Bundle b = new Bundle();
33 | b.putInt("bucket", bucketId);
34 | Fragment f = new ImagesFragment();
35 | f.setArguments(b);
36 | getSupportFragmentManager().beginTransaction()
37 | .replace(android.R.id.content, f).addToBackStack(null).commit();
38 | }
39 |
40 | void imageSelected(final String imgPath, final String imgTaken, final long imageSize) {
41 | returnResult(imgPath, imgTaken, imageSize);
42 | }
43 |
44 | private void returnResult(final String imgPath, final String imageTaken, final long imageSize) {
45 | Intent result = new Intent();
46 | result.putExtra("imgPath", imgPath);
47 | result.putExtra("dateTaken", imageTaken);
48 | result.putExtra("imageSize", imageSize);
49 | setResult(RESULT_OK, result);
50 | finish();
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/library/src/main/java/com/im4j/picturebeautify/picchooser/SquareImageView.java:
--------------------------------------------------------------------------------
1 | package com.im4j.picturebeautify.picchooser;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.widget.ImageView;
6 |
7 | /**
8 | * 正方形的ImageView 强制 宽度 = 高度
9 | *
10 | */
11 | public class SquareImageView extends ImageView {
12 |
13 | public SquareImageView(final Context context, final AttributeSet attrs) {
14 | super(context, attrs);
15 | }
16 |
17 | @Override
18 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
19 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
20 | setMeasuredDimension(getMeasuredWidth(), getMeasuredWidth());
21 | }
22 | }//end class
23 |
--------------------------------------------------------------------------------
/library/src/main/res/anim/in_bottom_to_top.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
--------------------------------------------------------------------------------
/library/src/main/res/anim/out_bottom_to_top.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/button_back_default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/res/drawable-hdpi/button_back_default.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/button_back_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/res/drawable-hdpi/button_back_pressed.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/crop_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/res/drawable-hdpi/crop_normal.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/crop_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/res/drawable-hdpi/crop_pressed.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/fliters_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/res/drawable-hdpi/fliters_normal.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/fliters_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/res/drawable-hdpi/fliters_pressed.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/font_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/res/drawable-hdpi/font_normal.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/font_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/res/drawable-hdpi/font_pressed.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/ic_menu_gallery.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/res/drawable-hdpi/ic_menu_gallery.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/image_edit_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/res/drawable-hdpi/image_edit_back.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/sticker_delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/res/drawable-hdpi/sticker_delete.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/sticker_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/res/drawable-hdpi/sticker_normal.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/sticker_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/res/drawable-hdpi/sticker_pressed.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/sticker_rotate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/res/drawable-hdpi/sticker_rotate.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/stickers_type_animal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/res/drawable-hdpi/stickers_type_animal.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/stickers_type_cos.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/res/drawable-hdpi/stickers_type_cos.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/stickers_type_decoration.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/res/drawable-hdpi/stickers_type_decoration.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/stickers_type_frame.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/res/drawable-hdpi/stickers_type_frame.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/stickers_type_mark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/res/drawable-hdpi/stickers_type_mark.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/stickers_type_motion.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/res/drawable-hdpi/stickers_type_motion.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/stickers_type_number.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/res/drawable-hdpi/stickers_type_number.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/stickers_type_profession.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/res/drawable-hdpi/stickers_type_profession.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/stickers_type_spring.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/res/drawable-hdpi/stickers_type_spring.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/stickers_type_text.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/res/drawable-hdpi/stickers_type_text.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/texture_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/res/drawable-hdpi/texture_normal.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/texture_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/res/drawable-hdpi/texture_pressed.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable-hdpi/yd_image_tx.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imkarl/PictureBeautify/a233e11b2e5e87f9677974516bb676c48b0e8657/library/src/main/res/drawable-hdpi/yd_image_tx.png
--------------------------------------------------------------------------------
/library/src/main/res/drawable/btn_back_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/library/src/main/res/drawable/image_edit_icon_crop.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/library/src/main/res/drawable/image_edit_icon_filter.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/library/src/main/res/drawable/image_edit_icon_rotate.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/library/src/main/res/drawable/image_edit_icon_sticker.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/library/src/main/res/drawable/image_edit_icon_text.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/library/src/main/res/drawable/shape_rect.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/activity_image_edit.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
13 |
14 |
21 |
22 |
31 |
32 |
40 |
41 |
49 |
50 |
58 |
59 |
60 |
61 |
67 |
68 |
75 |
76 |
81 |
82 |
88 |
89 |
95 |
96 |
102 |
103 |
109 |
110 |
111 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/bucketitem.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
19 |
20 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/dialog_input.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
12 |
19 |
20 |
31 |
32 |
40 |
41 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/fragment_edit_image_crop.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
13 |
14 |
18 |
19 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/fragment_edit_image_fliter.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
13 |
14 |
18 |
19 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/fragment_edit_image_main_menu.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
20 |
21 |
33 |
34 |
46 |
47 |
59 |
60 |
72 |
73 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/fragment_edit_image_rotate.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
13 |
14 |
22 |
23 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/fragment_edit_image_sticker_type.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
12 |
13 |
19 |
20 |
26 |
27 |
28 |
32 |
33 |
39 |
40 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/fragment_edit_image_text.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
12 |
13 |
19 |
20 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/gallery.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/imageitem.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/view_font_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/view_sticker_item.xml:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/view_sticker_type_item.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
17 |
18 |
26 |
27 |
--------------------------------------------------------------------------------
/library/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 16sp
6 | 7dp
7 |
8 |
--------------------------------------------------------------------------------
/library/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | library
3 |
4 | no found the image
5 | %d images
6 | save
7 | apply
8 |
9 | stickers
10 | fliter
11 | crop
12 | rotate
13 | text
14 |
15 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':library'
2 |
--------------------------------------------------------------------------------