├── .idea ├── .name ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── vcs.xml ├── modules.xml ├── runConfigurations.xml ├── compiler.xml ├── gradle.xml └── misc.xml ├── demo ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── dimens.xml │ │ │ │ └── styles.xml │ │ │ ├── drawable │ │ │ │ ├── earth.png │ │ │ │ ├── stars.png │ │ │ │ ├── basketball.png │ │ │ │ ├── img_font_frame.9.png │ │ │ │ ├── btn_sticker_turn_n.png │ │ │ │ ├── btn_sticker_cancel_n.png │ │ │ │ ├── btn_sticker_word_turn_n.png │ │ │ │ └── shape_text_stroke.xml │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ └── layout │ │ │ │ ├── activity_text_vertical.xml │ │ │ │ └── activity_main.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── addword │ │ │ └── demo │ │ │ ├── MyApplication.java │ │ │ └── MainActivity.java │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── addword │ │ │ └── demo │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── addword │ │ └── demo │ │ └── ApplicationTest.java ├── proguard-rules.pro └── build.gradle ├── AddwordLib ├── .gitignore ├── matrix.gif ├── src │ └── main │ │ ├── res │ │ ├── values │ │ │ ├── strings.xml │ │ │ ├── dimens.xml │ │ │ ├── colors.xml │ │ │ └── styles.xml │ │ ├── drawable │ │ │ ├── earth.png │ │ │ ├── stars.png │ │ │ ├── basketball.png │ │ │ └── shape_text_stroke.xml │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xhdpi │ │ │ ├── img_font_frame.9.png │ │ │ ├── btn_sticker_turn_n.png │ │ │ ├── btn_sticker_cancel_n.png │ │ │ └── btn_sticker_word_turn_n.png │ │ └── values-w820dp │ │ │ └── dimens.xml │ │ ├── java │ │ └── com │ │ │ ├── funny │ │ │ └── addworddemo │ │ │ │ ├── AppConst.java │ │ │ │ ├── util │ │ │ │ ├── StringUtils.java │ │ │ │ ├── StatusBarHeightUtil.java │ │ │ │ ├── BitmapUtils.java │ │ │ │ ├── DeviceInfoUtils.java │ │ │ │ └── LogUtils.java │ │ │ │ └── view │ │ │ │ ├── AddFrameHolder.java │ │ │ │ ├── AddWordFrameState.java │ │ │ │ ├── AddWordTextView.java │ │ │ │ ├── AddWordInsideLinearlayout.java │ │ │ │ ├── AddWordFrame.java │ │ │ │ └── AddWordOutsideLinearLayout.java │ │ │ └── almeros │ │ │ └── android │ │ │ └── multitouch │ │ │ ├── BaseGestureDetector.java │ │ │ ├── RotateGestureDetector.java │ │ │ ├── TwoFingerGestureDetector.java │ │ │ ├── MoveGestureDetector.java │ │ │ └── ShoveGestureDetector.java │ │ └── AndroidManifest.xml ├── screenshots │ └── textview横竖.gif ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── apk └── demo.apk ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── README_CN.md ├── gradle.properties ├── gradlew.bat ├── gradlew └── README.md /.idea/.name: -------------------------------------------------------------------------------- 1 | AddwordDemo -------------------------------------------------------------------------------- /demo/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /AddwordLib/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':addwordLib', ':demo' 2 | -------------------------------------------------------------------------------- /apk/demo.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinguangyue/AddwordLib/HEAD/apk/demo.apk -------------------------------------------------------------------------------- /AddwordLib/matrix.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinguangyue/AddwordLib/HEAD/AddwordLib/matrix.gif -------------------------------------------------------------------------------- /demo/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Demo 3 | 4 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /AddwordLib/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | AddWordDemo 3 | 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinguangyue/AddwordLib/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /AddwordLib/screenshots/textview横竖.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinguangyue/AddwordLib/HEAD/AddwordLib/screenshots/textview横竖.gif -------------------------------------------------------------------------------- /demo/src/main/res/drawable/earth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinguangyue/AddwordLib/HEAD/demo/src/main/res/drawable/earth.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable/stars.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinguangyue/AddwordLib/HEAD/demo/src/main/res/drawable/stars.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /AddwordLib/src/main/res/drawable/earth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinguangyue/AddwordLib/HEAD/AddwordLib/src/main/res/drawable/earth.png -------------------------------------------------------------------------------- /AddwordLib/src/main/res/drawable/stars.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinguangyue/AddwordLib/HEAD/AddwordLib/src/main/res/drawable/stars.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable/basketball.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinguangyue/AddwordLib/HEAD/demo/src/main/res/drawable/basketball.png -------------------------------------------------------------------------------- /demo/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinguangyue/AddwordLib/HEAD/demo/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinguangyue/AddwordLib/HEAD/demo/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /AddwordLib/src/main/res/drawable/basketball.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinguangyue/AddwordLib/HEAD/AddwordLib/src/main/res/drawable/basketball.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable/img_font_frame.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinguangyue/AddwordLib/HEAD/demo/src/main/res/drawable/img_font_frame.9.png -------------------------------------------------------------------------------- /demo/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinguangyue/AddwordLib/HEAD/demo/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinguangyue/AddwordLib/HEAD/demo/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable/btn_sticker_turn_n.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinguangyue/AddwordLib/HEAD/demo/src/main/res/drawable/btn_sticker_turn_n.png -------------------------------------------------------------------------------- /demo/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinguangyue/AddwordLib/HEAD/demo/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /AddwordLib/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinguangyue/AddwordLib/HEAD/AddwordLib/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /AddwordLib/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinguangyue/AddwordLib/HEAD/AddwordLib/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /AddwordLib/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinguangyue/AddwordLib/HEAD/AddwordLib/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable/btn_sticker_cancel_n.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinguangyue/AddwordLib/HEAD/demo/src/main/res/drawable/btn_sticker_cancel_n.png -------------------------------------------------------------------------------- /AddwordLib/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinguangyue/AddwordLib/HEAD/AddwordLib/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /AddwordLib/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinguangyue/AddwordLib/HEAD/AddwordLib/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable/btn_sticker_word_turn_n.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinguangyue/AddwordLib/HEAD/demo/src/main/res/drawable/btn_sticker_word_turn_n.png -------------------------------------------------------------------------------- /AddwordLib/src/main/res/drawable-xhdpi/img_font_frame.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinguangyue/AddwordLib/HEAD/AddwordLib/src/main/res/drawable-xhdpi/img_font_frame.9.png -------------------------------------------------------------------------------- /AddwordLib/src/main/res/drawable-xhdpi/btn_sticker_turn_n.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinguangyue/AddwordLib/HEAD/AddwordLib/src/main/res/drawable-xhdpi/btn_sticker_turn_n.png -------------------------------------------------------------------------------- /AddwordLib/src/main/res/drawable-xhdpi/btn_sticker_cancel_n.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinguangyue/AddwordLib/HEAD/AddwordLib/src/main/res/drawable-xhdpi/btn_sticker_cancel_n.png -------------------------------------------------------------------------------- /AddwordLib/src/main/res/drawable-xhdpi/btn_sticker_word_turn_n.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jinguangyue/AddwordLib/HEAD/AddwordLib/src/main/res/drawable-xhdpi/btn_sticker_word_turn_n.png -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /AddwordLib/src/main/java/com/funny/addworddemo/AppConst.java: -------------------------------------------------------------------------------- 1 | package com.funny.addworddemo; 2 | 3 | /** 4 | * Created by yue on 2016/5/12. 5 | */ 6 | public class AppConst { 7 | public static int textHeight = 0; 8 | } 9 | -------------------------------------------------------------------------------- /demo/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /demo/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /AddwordLib/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Dec 28 10:00:20 PST 2015 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 | -------------------------------------------------------------------------------- /AddwordLib/src/main/java/com/funny/addworddemo/util/StringUtils.java: -------------------------------------------------------------------------------- 1 | package com.funny.addworddemo.util; 2 | 3 | /** 4 | * Created by yue on 2016/4/14. 5 | */ 6 | public class StringUtils { 7 | public static boolean isEnglish(String charaString) { 8 | return charaString.matches("^[a-zA-Z]*"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /AddwordLib/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | #ffffff 7 | #000000 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /AddwordLib/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /demo/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /AddwordLib/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /demo/src/test/java/com/addword/demo/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.addword.demo; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /demo/src/androidTest/java/com/addword/demo/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.addword.demo; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /demo/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /demo/src/main/res/drawable/shape_text_stroke.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /AddwordLib/src/main/res/drawable/shape_text_stroke.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /AddwordLib/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /AddwordLib/src/main/java/com/funny/addworddemo/util/StatusBarHeightUtil.java: -------------------------------------------------------------------------------- 1 | package com.funny.addworddemo.util; 2 | 3 | import android.content.Context; 4 | 5 | /** 6 | * Created by yue on 2016/1/5. 7 | */ 8 | public class StatusBarHeightUtil { 9 | 10 | public static int getStatusBarHeight(Context context) { 11 | int result = 0; 12 | int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android"); 13 | if (resourceId > 0) { 14 | result = context.getResources().getDimensionPixelSize(resourceId); 15 | } 16 | return result; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /AddwordLib/src/main/java/com/funny/addworddemo/view/AddFrameHolder.java: -------------------------------------------------------------------------------- 1 | package com.funny.addworddemo.view; 2 | 3 | public class AddFrameHolder { 4 | 5 | private AddWordFrame addWordFrame; 6 | private AddWordFrameState state; 7 | 8 | public AddWordFrame getAddWordFrame() { 9 | return addWordFrame; 10 | } 11 | 12 | public void setAddWordFrame(AddWordFrame addWordFrame) { 13 | this.addWordFrame = addWordFrame; 14 | } 15 | 16 | public AddWordFrameState getState() { 17 | return state; 18 | } 19 | 20 | public void setState(AddWordFrameState state) { 21 | this.state = state; 22 | } 23 | } -------------------------------------------------------------------------------- /AddwordLib/src/main/java/com/funny/addworddemo/util/BitmapUtils.java: -------------------------------------------------------------------------------- 1 | package com.funny.addworddemo.util; 2 | 3 | import android.graphics.Bitmap; 4 | import android.view.View; 5 | 6 | public class BitmapUtils { 7 | 8 | /** 9 | * @param view 10 | * @return 11 | */ 12 | public static Bitmap convertViewToBitmap(View view) { 13 | view.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)); 14 | view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight()); 15 | view.buildDrawingCache(); 16 | Bitmap bitmap = view.getDrawingCache(); 17 | return bitmap; 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /demo/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 D:\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 | -------------------------------------------------------------------------------- /AddwordLib/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 D:\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 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /demo/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /demo/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.addword.demo" 9 | minSdkVersion 16 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 | testCompile 'junit:junit:4.12' 25 | compile 'com.android.support:appcompat-v7:23.3.0' 26 | compile project(':addwordLib') 27 | // compile 'com.jinguangyue.addwordlib:addwordLib:1.0.0' 28 | } 29 | -------------------------------------------------------------------------------- /AddwordLib/src/main/java/com/funny/addworddemo/util/DeviceInfoUtils.java: -------------------------------------------------------------------------------- 1 | package com.funny.addworddemo.util; 2 | 3 | import android.content.Context; 4 | import android.util.DisplayMetrics; 5 | 6 | /** 7 | * Created by yue on 15/10/29. 8 | */ 9 | @SuppressWarnings("deprecation") 10 | public class DeviceInfoUtils { 11 | /** 12 | * @param context 13 | * @return int 14 | */ 15 | public static int getScreenHeight(Context context) { 16 | DisplayMetrics dm = context.getResources().getDisplayMetrics(); 17 | return dm.heightPixels; 18 | } 19 | 20 | /** 21 | * @param context 22 | * @return int 23 | */ 24 | public static int getScreenWidth(Context context) { 25 | DisplayMetrics dm = context.getResources().getDisplayMetrics(); 26 | return dm.widthPixels; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /README_CN.md: -------------------------------------------------------------------------------- 1 | # AddwordDemo 2 | TextView加文字横竖排切换(字体方向不变) 3 | 4 | 一个普通的Textview如果旋转的话字体方向肯定变了,这里我自定义了一个view来实现这个功能。 5 | 6 | #实现的主要功能 7 | * 文字横竖排切换, 并且切换成竖排是文字方向不变 8 | * 单指移动, 缩放 9 | * 双指缩放旋转 10 | * 可以添加多个 11 | * 支持文字居左居中居右 12 | * 当你编辑文字时自动适应边框 13 | 14 | # 你可以在Android studio里面这样引入 15 | ``` 16 | dependencies { 17 | compile 'com.jinguangyue.addwordlib:addwordLib:1.0.0' 18 | } 19 | ``` 20 | 21 | **具体的代码可以查看Demo下面的MainActivity** 22 | 23 | # 效果图 24 | ![](https://github.com/jinguangyue/AddwordLib/blob/master/AddwordLib/screenshots/textview%E6%A8%AA%E7%AB%96.gif) 25 | 26 | 具体讲解可以点击我的博客: 27 | http://blog.csdn.net/coderyue/article/details/51149936 28 |
29 | 30 | 31 | ## 关注我的 Google Play 独立开发公众号 32 | ## 通过从零到一在 Google Play 开发出下载量 300万 APP 的经历,我将把很多精彩的故事分享到公众号,扫描下方二维码和我一起开发 APP 赚美元吧! 33 | 34 | -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 24 | 25 | -------------------------------------------------------------------------------- /AddwordLib/src/main/java/com/funny/addworddemo/view/AddWordFrameState.java: -------------------------------------------------------------------------------- 1 | package com.funny.addworddemo.view; 2 | 3 | public class AddWordFrameState { 4 | private float left; 5 | private float top; 6 | private float right; 7 | private float bottom; 8 | 9 | @Override 10 | public String toString() { 11 | return "[" + left + "," + top + "," + right + "," + bottom + "] (" + (right - left) + "," 12 | + (bottom - top) + ")";// super.toString(); 13 | } 14 | 15 | public float getLeft() { 16 | return left; 17 | } 18 | 19 | public void setLeft(float left) { 20 | this.left = left; 21 | } 22 | 23 | public float getTop() { 24 | return top; 25 | } 26 | 27 | public void setTop(float top) { 28 | this.top = top; 29 | } 30 | 31 | public float getRight() { 32 | return right; 33 | } 34 | 35 | public void setRight(float right) { 36 | this.right = right; 37 | } 38 | 39 | public float getBottom() { 40 | return bottom; 41 | } 42 | 43 | public void setBottom(float bottom) { 44 | this.bottom = bottom; 45 | } 46 | 47 | } -------------------------------------------------------------------------------- /demo/src/main/java/com/addword/demo/MyApplication.java: -------------------------------------------------------------------------------- 1 | package com.addword.demo; 2 | 3 | import android.app.Application; 4 | 5 | import com.funny.addworddemo.AppConst; 6 | import com.funny.addworddemo.util.DeviceInfoUtils; 7 | 8 | /** 9 | * Created by yue on 2016/4/18. 10 | */ 11 | public class MyApplication extends Application { 12 | 13 | private static MyApplication instance; 14 | private int textHeight; 15 | private int screenWidth; 16 | private int screenHeight; 17 | 18 | public static MyApplication getInstance() { 19 | return instance; 20 | } 21 | 22 | @Override 23 | public void onCreate() { 24 | super.onCreate(); 25 | instance = this; 26 | screenWidth = DeviceInfoUtils.getScreenWidth(this);//获取屏幕宽度 27 | screenHeight = DeviceInfoUtils.getScreenHeight(this);//获取屏幕高度 28 | } 29 | 30 | public int getTextHeight() { 31 | if(textHeight == 0){ 32 | textHeight = AppConst.textHeight; 33 | } 34 | return textHeight; 35 | } 36 | 37 | public void setTextHeight(int textHeight) { 38 | this.textHeight = textHeight; 39 | } 40 | 41 | public int getScreenWidth() { 42 | return screenWidth; 43 | } 44 | 45 | public int getScreenHeight() { 46 | return screenHeight; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /AddwordLib/src/main/java/com/funny/addworddemo/view/AddWordTextView.java: -------------------------------------------------------------------------------- 1 | package com.funny.addworddemo.view; 2 | 3 | import android.content.Context; 4 | import android.graphics.Canvas; 5 | import android.graphics.Color; 6 | import android.graphics.Paint; 7 | import android.text.TextPaint; 8 | import android.util.AttributeSet; 9 | import android.widget.TextView; 10 | 11 | /** 12 | * Created by yue on 2016/4/28. 13 | */ 14 | public class AddWordTextView extends TextView { 15 | private int borderColor = Color.TRANSPARENT; 16 | private int textColor = Color.WHITE; 17 | private boolean isStroke = false; 18 | 19 | public AddWordTextView(Context context) { 20 | super(context); 21 | } 22 | 23 | public AddWordTextView(Context context, AttributeSet attrs) { 24 | super(context, attrs); 25 | } 26 | 27 | public AddWordTextView(Context context, AttributeSet attrs, int defStyleAttr) { 28 | super(context, attrs, defStyleAttr); 29 | } 30 | 31 | public boolean isStroke() { 32 | return isStroke; 33 | } 34 | 35 | public void setStroke(boolean stroke) { 36 | isStroke = stroke; 37 | } 38 | 39 | public void setBorderColor(int borderColor, int textColor, boolean isStroke) { 40 | this.borderColor = borderColor; 41 | this.textColor = textColor; 42 | this.isStroke = isStroke; 43 | invalidate(); 44 | } 45 | 46 | public int getBorderColor() { 47 | return borderColor; 48 | } 49 | 50 | @Override 51 | protected void onDraw(Canvas canvas) { 52 | if(isStroke){ 53 | this.setTextColor(borderColor); 54 | TextPaint tp = this.getPaint(); 55 | tp.setFakeBoldText(true); 56 | tp.setStrokeWidth(5); 57 | tp.setStyle(Paint.Style.STROKE); 58 | tp.setColor(borderColor); 59 | super.onDraw(canvas); 60 | 61 | tp.setColor(textColor); 62 | tp.setStyle(Paint.Style.STROKE); 63 | this.setTextColor(textColor); 64 | super.onDraw(canvas); 65 | }else{ 66 | this.setTextColor(textColor); 67 | TextPaint tp = this.getPaint(); 68 | tp.setFakeBoldText(false); 69 | tp.setStrokeWidth(0); 70 | super.onDraw(canvas); 71 | } 72 | 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /demo/src/main/res/layout/activity_text_vertical.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 13 | 14 | 19 | 20 | 25 | 26 |