Permalink
Browse files

ReadME update

  • Loading branch information...
1 parent 9b4010c commit 34acbd8c238f419ecd2b964a8e765f3e77fd1a16 @siwangqishiq committed Jun 16, 2016
View
@@ -3,24 +3,9 @@
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
- <option name="distributionType" value="LOCAL" />
+ <option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
- <option name="gradleHome" value="D:\androidstudio20\gradle\gradle-2.10" />
- <option name="gradleJvm" value="1.7" />
- <option name="modules">
- <set>
- <option value="$PROJECT_DIR$" />
- <option value="$PROJECT_DIR$/demo" />
- <option value="$PROJECT_DIR$/imageeditlibrary" />
- </set>
- </option>
- <option name="myModules">
- <set>
- <option value="$PROJECT_DIR$" />
- <option value="$PROJECT_DIR$/demo" />
- <option value="$PROJECT_DIR$/imageeditlibrary" />
- </set>
- </option>
+ <option name="gradleHome" value="D:/androidstudio20/gradle/gradle-2.10" />
</GradleProjectSettings>
</option>
</component>
View
@@ -6,7 +6,7 @@
>###v_1.0:
> base function,edit image,supply stickers filter rotate crop
>###v_2.0:
-> add the textimage
+> add the textimage(in developing...)
### 动态效果图
View
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.0.0'
+ classpath 'com.android.tools.build:gradle:2.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
View
@@ -47,34 +47,39 @@
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
- <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
- <sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
- <sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
- <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
- <sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
- <sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
@@ -92,6 +97,7 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/restart-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
@@ -48,34 +48,39 @@
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
@@ -86,10 +91,12 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/22.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
@@ -4,6 +4,9 @@
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.Fragment;
+import android.text.Editable;
+import android.text.TextUtils;
+import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
@@ -26,7 +29,7 @@
*
* @author 潘易
*/
-public class AddTextFragment extends Fragment {
+public class AddTextFragment extends Fragment implements TextWatcher{
public static final int INDEX = 5;
public static final String TAG = AddTextFragment.class.getName();
@@ -41,6 +44,7 @@
private ColorPicker mColorPicker;
private int mTextColor = Color.WHITE;
+ private InputMethodManager imm;
public static AddTextFragment newInstance(EditImageActivity activity) {
AddTextFragment fragment = new AddTextFragment();
@@ -57,6 +61,7 @@ public void onCreate(Bundle savedInstanceState) {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
+ imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
mainView = inflater.inflate(R.layout.fragment_edit_image_add_text, null);
backToMenu = mainView.findViewById(R.id.back_to_main);
mInputText = (EditText) mainView.findViewById(R.id.text_input);
@@ -68,26 +73,33 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
backToMenu.setOnClickListener(new BackToMenuClick());// 返回主菜单
-
- mTextStickerView.setOnTouchListener(new View.OnTouchListener() {
- @Override
- public boolean onTouch(View v, MotionEvent event) {
- if (event.getAction() == MotionEvent.ACTION_DOWN) {
- hideInput();
- return true;
- }
- return false;
- }
- });
-
mColorPicker = new ColorPicker(getActivity(), 255, 255, 255);
mTextColorSelector.setOnClickListener(new SelectColorBtnClick());
+
+ mInputText.addTextChangedListener(this);
+ }
+
+ @Override
+ public void afterTextChanged(Editable s) {
+ //mTextStickerView change
+ String text = s.toString().trim();
+ mTextStickerView.setText(text);
+ }
+
+ @Override
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+
+ }
+
+ @Override
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
+
}
/**
* 颜色选择 按钮点击
*/
- private final class SelectColorBtnClick implements View.OnClickListener{
+ private final class SelectColorBtnClick implements View.OnClickListener {
@Override
public void onClick(View v) {
mColorPicker.show();
@@ -113,9 +125,14 @@ private void changeTextColor(int newColor) {
}
public void hideInput() {
- InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
- imm.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(),
- InputMethodManager.HIDE_NOT_ALWAYS);
+ if (getActivity().getCurrentFocus() != null && isInputMethodShow()) {
+ imm.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(),
+ InputMethodManager.HIDE_NOT_ALWAYS);
+ }
+ }
+
+ public boolean isInputMethodShow() {
+ return imm.isActive();
}
/**
@@ -134,6 +151,7 @@ public void onClick(View v) {
* 返回主菜单
*/
public void backToMain() {
+ hideInput();
activity.mode = EditImageActivity.MODE_NONE;
activity.bottomGallery.setCurrentItem(MainMenuFragment.INDEX);
activity.mainImage.setVisibility(View.VISIBLE);
@@ -145,7 +163,6 @@ public void onShow() {
activity.mode = EditImageActivity.MODE_TEXT;
activity.bottomGallery.setCurrentItem(AddTextFragment.INDEX);
activity.mainImage.setImageBitmap(activity.mainBitmap);
- activity.mainImage.setDisplayType(ImageViewTouchBase.DisplayType.FIT_TO_SCREEN);
activity.bannerFlipper.showNext();
mTextStickerView.setVisibility(View.VISIBLE);
@@ -276,8 +276,7 @@ protected Bitmap doInBackground(Bitmap... params) {
Matrix m = new Matrix();
m.setValues(inverseMatrix.getValues());
- LinkedHashMap<Integer, StickerItem> addItems = mStickerView
- .getBank();
+ LinkedHashMap<Integer, StickerItem> addItems = mStickerView.getBank();
for (Integer id : addItems.keySet()) {
StickerItem item = addItems.get(id);
item.matrix.postConcat(m);// 乘以底部图片变化矩阵
@@ -1,23 +1,60 @@
package com.xinlan.imageeditlibrary.editimage.view;
import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.text.TextUtils;
import android.util.AttributeSet;
/**
* 文本贴图处理控件
* Created by panyi on 2016/6/9.
*/
-public class TextStickerView extends StickerView{
+public class TextStickerView extends StickerView {
+ private String mText;
+ private Paint mPaint = new Paint();
public TextStickerView(Context context) {
super(context);
+ initView();
}
public TextStickerView(Context context, AttributeSet attrs) {
super(context, attrs);
+ initView();
}
public TextStickerView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
+ initView();
+ }
+
+ private void initView() {
+ mPaint.setColor(Color.WHITE);
+ mPaint.setTextAlign(Paint.Align.CENTER);
+ mPaint.setTextSize(45);
+ }
+
+ public void setText(String text) {
+ this.mText = text;
+ invalidate();
+ }
+
+ public void setTextColor(int newColor) {
+ mPaint.setColor(newColor);
+ invalidate();
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+
+ if (TextUtils.isEmpty(mText))
+ return;
+
+ int x = getWidth() >> 1;
+ int y = getHeight() >> 1;
+ canvas.drawText(mText, x, y, mPaint);
}
}//end class

0 comments on commit 34acbd8

Please sign in to comment.