├── LemonSuperKit ├── .gitignore ├── .idea │ ├── compiler.xml │ ├── copyright │ │ └── profiles_settings.xml │ ├── gradle.xml │ ├── misc.xml │ ├── modules.xml │ ├── runConfigurations.xml │ └── vcs.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── lemonsuperkit-samples │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── net │ │ │ └── lemonsoft │ │ │ └── lemonkit │ │ │ └── samples │ │ │ └── ExampleInstrumentedTest.java │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── net │ │ │ │ └── lemonsoft │ │ │ │ └── lemonkit │ │ │ │ └── samples │ │ │ │ ├── LemonKitSampleApplication.java │ │ │ │ └── view_controller │ │ │ │ └── MainViewController.java │ │ └── res │ │ │ ├── layout │ │ │ └── activity_main.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 │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ └── test │ │ └── java │ │ └── net │ │ └── lemonsoft │ │ └── lemonkit │ │ └── samples │ │ └── ExampleUnitTest.java ├── lemonsuperkit │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── net │ │ │ └── lemonsoft │ │ │ └── lemonsuperkit │ │ │ └── ExampleInstrumentedTest.java │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── net │ │ │ │ └── lemonsoft │ │ │ │ └── lemonsuperkit │ │ │ │ ├── core │ │ │ │ ├── base │ │ │ │ │ ├── LemonKit.java │ │ │ │ │ └── LemonKitApp.java │ │ │ │ └── graphics │ │ │ │ │ ├── CGColorRef.java │ │ │ │ │ ├── CGPoint.java │ │ │ │ │ ├── CGRect.java │ │ │ │ │ └── CGSize.java │ │ │ │ ├── core_animation │ │ │ │ └── CALayer.java │ │ │ │ ├── native_ui │ │ │ │ ├── README.MD │ │ │ │ ├── extend │ │ │ │ │ ├── README.MD │ │ │ │ │ ├── adapter │ │ │ │ │ │ └── LKScrollViewDelegateAdapter.java │ │ │ │ │ ├── delegate │ │ │ │ │ │ └── LKScrollViewDelegate.java │ │ │ │ │ ├── drawable │ │ │ │ │ │ └── LKRoundCornerImageDrawable.java │ │ │ │ │ └── view │ │ │ │ │ │ ├── LKScrollView.java │ │ │ │ │ │ ├── LKTableView.java │ │ │ │ │ │ └── README.MD │ │ │ │ ├── model │ │ │ │ │ └── LKViewAppearanceModel.java │ │ │ │ └── tools │ │ │ │ │ ├── LKColorTool.java │ │ │ │ │ ├── LKDrawableTool.java │ │ │ │ │ ├── LKSizeTool.java │ │ │ │ │ └── LKViewAppearanceTool.java │ │ │ │ └── ui_kit │ │ │ │ ├── UIColor.java │ │ │ │ ├── UIFont.java │ │ │ │ ├── UIImage.java │ │ │ │ ├── adapter │ │ │ │ └── UIScrollViewDelegateAdapter.java │ │ │ │ ├── delegate │ │ │ │ ├── UIApplicationDelegate.java │ │ │ │ └── UIScrollViewDelegate.java │ │ │ │ ├── enums │ │ │ │ └── LKTextAlignment.java │ │ │ │ └── ui_responder │ │ │ │ ├── ui_view │ │ │ │ ├── UINavigationBar.java │ │ │ │ ├── UIScrollView.java │ │ │ │ ├── UIView.java │ │ │ │ └── ui_control │ │ │ │ │ ├── UIButton.java │ │ │ │ │ ├── UIControl.java │ │ │ │ │ └── UILabel.java │ │ │ │ └── ui_view_controller │ │ │ │ ├── UINavigationController.java │ │ │ │ └── UIViewController.java │ │ └── res │ │ │ └── values │ │ │ └── strings.xml │ │ └── test │ │ └── java │ │ └── net │ │ └── lemonsoft │ │ └── lemonsuperkit │ │ └── ExampleUnitTest.java └── settings.gradle └── README.md /LemonSuperKit/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /LemonSuperKit/.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 | -------------------------------------------------------------------------------- /LemonSuperKit/.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /LemonSuperKit/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /LemonSuperKit/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 19 | -------------------------------------------------------------------------------- /LemonSuperKit/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /LemonSuperKit/.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /LemonSuperKit/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /LemonSuperKit/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.2.3' 9 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' 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 | maven { url 'https://jitpack.io' } 19 | } 20 | } 21 | 22 | task clean(type: Delete) { 23 | delete rootProject.buildDir 24 | } 25 | -------------------------------------------------------------------------------- /LemonSuperKit/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 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /LemonSuperKit/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LemonITCN/LemonSuperKit4Android/e7e549327e5741fd54e28b213595a474fe1139b9/LemonSuperKit/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /LemonSuperKit/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.14.1-all.zip 7 | -------------------------------------------------------------------------------- /LemonSuperKit/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 | -------------------------------------------------------------------------------- /LemonSuperKit/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 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit-samples/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit-samples/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 24 5 | buildToolsVersion "24.0.3" 6 | defaultConfig { 7 | applicationId "net.lemonsoft.lemonkit.samples" 8 | minSdkVersion 15 9 | targetSdkVersion 24 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 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(include: ['*.jar'], dir: 'libs') 24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 25 | exclude group: 'com.android.support', module: 'support-annotations' 26 | }) 27 | testCompile 'junit:junit:4.12' 28 | compile 'com.github.1em0nsOft:LemonBubble4Android:1.0.9' 29 | compile 'com.github.1em0nsOft:LemonHello4Android:1.0.1' 30 | compile project(':lemonsuperkit') 31 | } 32 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit-samples/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/LiuRi/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 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit-samples/src/androidTest/java/net/lemonsoft/lemonkit/samples/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonkit.samples; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("net.lemonsoft.lemonkit.samples", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit-samples/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit-samples/src/main/java/net/lemonsoft/lemonkit/samples/LemonKitSampleApplication.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonkit.samples; 2 | 3 | import net.lemonsoft.lemonsuperkit.core.base.LemonKitApp; 4 | 5 | /** 6 | * Created by LiuRi on 2016/12/28. 7 | */ 8 | 9 | public class LemonKitSampleApplication extends LemonKitApp { 10 | } 11 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit-samples/src/main/java/net/lemonsoft/lemonkit/samples/view_controller/MainViewController.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonkit.samples.view_controller; 2 | 3 | import net.lemonsoft.lemonsuperkit.ui_kit.adapter.UIScrollViewDelegateAdapter; 4 | import net.lemonsoft.lemonsuperkit.core.graphics.CGRect; 5 | import net.lemonsoft.lemonsuperkit.core.graphics.CGSize; 6 | import net.lemonsoft.lemonsuperkit.native_ui.tools.LKSizeTool; 7 | import net.lemonsoft.lemonsuperkit.ui_kit.UIColor; 8 | import net.lemonsoft.lemonsuperkit.ui_kit.ui_responder.ui_view.UIScrollView; 9 | import net.lemonsoft.lemonsuperkit.ui_kit.ui_responder.ui_view.UIView; 10 | import net.lemonsoft.lemonsuperkit.ui_kit.ui_responder.ui_view_controller.UIViewController; 11 | 12 | public class MainViewController extends UIViewController { 13 | 14 | @Override 15 | public void viewDidLoad() { 16 | super.viewDidLoad(); 17 | // UILabel label = new UILabel(CGRect.make(50, 150, 200, 100)); 18 | // label.setText("Hello! LemonKit World."); 19 | // label.setBackgroundColor(UIColor.greenColor()); 20 | // this.view.addSubView(label); 21 | // label.setClipsToBounds(true); 22 | // label.layer.setBorderWidth(1); 23 | // label.layer.setCornerRadius(80); 24 | // label.layer.setBorderColor(UIColor.redColor().cgColor()); 25 | // this.view.setBackgroundColor(UIColor.colorWithRedGreenBlueAlpha(0.7f, 0.6f, 0.5f, 0.9f)); 26 | // 27 | // LemonBubble.showRight(this, "hello", 2000); 28 | 29 | this.view.setBackgroundColor(UIColor.blueColor()); 30 | 31 | // LemonHello.getSuccessHello("提交成功", "恭喜您,您所填写的数据已经全部提交成功,我们的客服人员将在24小时内进行审核,请耐心等待.") 32 | // .addAction(new LemonHelloAction("我知道啦", new LemonHelloActionDelegate() { 33 | // @Override 34 | // public void onClick(LemonHelloView helloView, LemonHelloInfo helloInfo, LemonHelloAction helloAction) { 35 | // helloView.hide(); 36 | // } 37 | // })) 38 | // .show(MainActivity.this); 39 | 40 | 41 | UIScrollView scrollView = new UIScrollView(LKSizeTool.getDefaultSizeTool().screenFrame()); 42 | scrollView.setContentSize(CGSize.make(0, 1000)); 43 | this.view.addSubView(scrollView); 44 | UIView view = new UIView(CGRect.make(0, 0, 100, 100)); 45 | view.setBackgroundColor(UIColor.hotpinkColor()); 46 | scrollView.addSubView(view); 47 | scrollView.setDelegate(new UIScrollViewDelegateAdapter() { 48 | @Override 49 | public void scrollViewDidScroll(UIScrollView scrollView) { 50 | super.scrollViewDidScroll(scrollView); 51 | System.out.println(scrollView.getContentOffset().y); 52 | } 53 | }); 54 | 55 | } 56 | 57 | 58 | } -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit-samples/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 17 | 18 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit-samples/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LemonITCN/LemonSuperKit4Android/e7e549327e5741fd54e28b213595a474fe1139b9/LemonSuperKit/lemonsuperkit-samples/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit-samples/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LemonITCN/LemonSuperKit4Android/e7e549327e5741fd54e28b213595a474fe1139b9/LemonSuperKit/lemonsuperkit-samples/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit-samples/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LemonITCN/LemonSuperKit4Android/e7e549327e5741fd54e28b213595a474fe1139b9/LemonSuperKit/lemonsuperkit-samples/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit-samples/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LemonITCN/LemonSuperKit4Android/e7e549327e5741fd54e28b213595a474fe1139b9/LemonSuperKit/lemonsuperkit-samples/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit-samples/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LemonITCN/LemonSuperKit4Android/e7e549327e5741fd54e28b213595a474fe1139b9/LemonSuperKit/lemonsuperkit-samples/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit-samples/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit-samples/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit-samples/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit-samples/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | LemonKit 3 | 4 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit-samples/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit-samples/src/test/java/net/lemonsoft/lemonkit/samples/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonkit.samples; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'com.github.dcendents.android-maven' 3 | group='com.github.1em0nsOft' 4 | 5 | android { 6 | compileSdkVersion 24 7 | buildToolsVersion "24.0.3" 8 | 9 | defaultConfig { 10 | minSdkVersion 15 11 | targetSdkVersion 24 12 | versionCode 1 13 | versionName "1.0" 14 | 15 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 16 | 17 | } 18 | buildTypes { 19 | release { 20 | minifyEnabled false 21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 22 | } 23 | } 24 | } 25 | 26 | dependencies { 27 | compile fileTree(dir: 'libs', include: ['*.jar']) 28 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 29 | exclude group: 'com.android.support', module: 'support-annotations' 30 | }) 31 | compile 'com.android.support:appcompat-v7:24.2.1' 32 | testCompile 'junit:junit:4.12' 33 | } 34 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/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/LiuRi/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 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/androidTest/java/net/lemonsoft/lemonsuperkit/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonsuperkit; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("net.lemonsoft.lemonkit.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/core/base/LemonKit.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonsuperkit.core.base; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | 6 | import net.lemonsoft.lemonsuperkit.native_ui.tools.LKSizeTool; 7 | 8 | /** 9 | * LemonKit核心类 10 | * Created by LiuRi on 2016/12/24. 11 | */ 12 | 13 | public class LemonKit { 14 | 15 | // 实例对象 16 | private static LemonKit _instance; 17 | // 应用程序对象 18 | private Application application; 19 | 20 | /** 21 | * 获取LemonKit的单例对象 22 | */ 23 | public static synchronized LemonKit instance() { 24 | if (_instance == null) 25 | _instance = new LemonKit(); 26 | return _instance; 27 | } 28 | 29 | /** 30 | * 隐藏构造方法 31 | */ 32 | private LemonKit() { 33 | } 34 | 35 | /** 36 | * 初始化方法 37 | * 需要在应用程序的onCreate方法中调用此方法来初始化LemonKit 38 | * 39 | * @param application 应用对象 40 | */ 41 | public void init(Application application) { 42 | System.out.println("KLKLK              LKLKLK      LKLKLK"); 43 | System.out.println("KLKLK              LKLKLK    LKLKLKLK"); 44 | System.out.println("KLKLK              LKLKLK  LKLKLKLK"); 45 | System.out.println("KLKLK              LKLKLK  LKLKLK"); 46 | System.out.println("KLKLK              LKLKLKLKLKLK"); 47 | System.out.println("KLKLK              LKLKLKLKLKLK"); 48 | System.out.println("KLKLK              LKLKLKLKLKLKLK"); 49 | System.out.println("KLKLK              LKLKLK  LKLKLK"); 50 | System.out.println("KLKLK              LKLKLK  LKLKLKLK"); 51 | System.out.println("KLKLK              LKLKLK    LKLKLK"); 52 | System.out.println("KLKLK              LKLKLK    LKLKLKLK"); 53 | System.out.println("KLKLKLKLKLKLKLKLKLKLKLK     LKLKLK     LKLKLKLK"); 54 | System.out.println("KLKLKLKLKLKLKLKLKLKLKLK    LKLKLKLK   LKLKLKLK"); 55 | this.application = application; 56 | // 初始化LemonKit尺寸工具类 57 | LKSizeTool.getDefaultSizeTool().setContext(this.getAppContext()); 58 | } 59 | 60 | /** 61 | * 获取整个应用程序的上下文对象 62 | * 63 | * @return 应用程序的上下文对象 64 | */ 65 | public Context getAppContext() { 66 | return this.application.getApplicationContext(); 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/core/base/LemonKitApp.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonsuperkit.core.base; 2 | 3 | import android.app.Application; 4 | 5 | /** 6 | * LemonKit - 应用程序 7 | * Created by LiuRi on 2016/12/28. 8 | */ 9 | 10 | public class LemonKitApp extends Application { 11 | 12 | @Override 13 | public void onCreate() { 14 | super.onCreate(); 15 | LemonKit.instance().init(this); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/core/graphics/CGColorRef.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonsuperkit.core.graphics; 2 | 3 | /** 4 | * LemonKit CoreGraphics 颜色信息描述对象 5 | * Created by LiuRi on 2016/12/30. 6 | */ 7 | 8 | public class CGColorRef { 9 | 10 | private int colorValue; 11 | 12 | public int getColorValue() { 13 | return colorValue; 14 | } 15 | 16 | public CGColorRef(int colorValue) { 17 | this.colorValue = colorValue; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/core/graphics/CGPoint.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonsuperkit.core.graphics; 2 | 3 | /** 4 | * Core Graphics 坐标点描述类 5 | * Created by LiuRi on 2016/12/28. 6 | */ 7 | 8 | public class CGPoint { 9 | 10 | /** 11 | * 描述一个坐标点的横坐标x 12 | */ 13 | public float x = 0f; 14 | /** 15 | * 描述一个坐标点的纵坐标y 16 | */ 17 | public float y = 0f; 18 | 19 | public CGPoint(float x, float y) { 20 | this.x = x; 21 | this.y = y; 22 | } 23 | 24 | public static CGPoint make(float x, float y) { 25 | return new CGPoint(x, y); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/core/graphics/CGRect.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonsuperkit.core.graphics; 2 | 3 | /** 4 | * Core Graphics 矩形信息描述类 5 | * Created by LiuRi on 2016/12/28. 6 | */ 7 | 8 | public class CGRect { 9 | 10 | /** 11 | * 矩形的起点,即左上角的坐标点 12 | */ 13 | public CGPoint origin; 14 | /** 15 | * 矩形的尺寸 16 | */ 17 | public CGSize size; 18 | 19 | public CGRect(CGPoint origin, CGSize size) { 20 | this.origin = origin; 21 | this.size = size; 22 | } 23 | 24 | public CGRect(float x, float y, float width, float height) { 25 | this.origin = new CGPoint(x, y); 26 | this.size = new CGSize(width, height); 27 | } 28 | 29 | public static CGRect make(CGPoint origin, CGSize size) { 30 | return new CGRect(origin, size); 31 | } 32 | 33 | public static CGRect make(float x, float y, float width, float height) { 34 | return new CGRect(x, y, width, height); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/core/graphics/CGSize.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonsuperkit.core.graphics; 2 | 3 | /** 4 | * Core Graphics 尺寸描述对象 5 | * Created by LiuRi on 2016/12/28. 6 | */ 7 | 8 | public class CGSize { 9 | 10 | /** 11 | * 描述一个尺寸的宽 12 | */ 13 | public float width = 0f; 14 | /** 15 | * 描述一个尺寸的高 16 | */ 17 | public float height = 0f; 18 | 19 | public CGSize(float width, float height) { 20 | this.width = width; 21 | this.height = height; 22 | } 23 | 24 | public static CGSize make(float width, float height) { 25 | return new CGSize(width, height); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/core_animation/CALayer.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonsuperkit.core_animation; 2 | 3 | import android.graphics.Canvas; 4 | import android.graphics.Path; 5 | import android.graphics.RectF; 6 | import android.graphics.Region; 7 | import android.os.Build; 8 | 9 | import net.lemonsoft.lemonsuperkit.core.graphics.CGColorRef; 10 | import net.lemonsoft.lemonsuperkit.native_ui.model.LKViewAppearanceModel; 11 | import net.lemonsoft.lemonsuperkit.native_ui.tools.LKColorTool; 12 | import net.lemonsoft.lemonsuperkit.native_ui.tools.LKSizeTool; 13 | import net.lemonsoft.lemonsuperkit.ui_kit.UIColor; 14 | import net.lemonsoft.lemonsuperkit.ui_kit.ui_responder.ui_view.UIView; 15 | 16 | /** 17 | * Core Animation layer 18 | * Created by LiuRi on 2016/12/30. 19 | */ 20 | 21 | public class CALayer { 22 | 23 | /** 24 | * 尺寸工具类 25 | */ 26 | protected LKSizeTool _ST = LKSizeTool.getDefaultSizeTool(); 27 | 28 | /** 29 | * 颜色工具类 30 | */ 31 | protected LKColorTool _CT = LKColorTool.getDefaultColorTool(); 32 | /** 33 | * 所归属的控件 34 | */ 35 | private UIView _v; 36 | /** 37 | * 外观样式,例如圆角、边框等 38 | */ 39 | private LKViewAppearanceModel _appearance; 40 | /** 41 | * 超过边界之外的内容是否隐藏 42 | */ 43 | private boolean masksToBounds = false; 44 | 45 | public CALayer(UIView view) { 46 | _v = view; 47 | _appearance = new LKViewAppearanceModel(); 48 | } 49 | 50 | public void setBackgroundColor(UIColor color) { 51 | _appearance.setBackgroundColor(color); 52 | applyAppearance(); 53 | } 54 | 55 | public UIColor getBackgroundColor() { 56 | return _appearance.getBackgroundColor(); 57 | } 58 | 59 | public void onDraw(Canvas canvas) { 60 | if (this.masksToBounds) { 61 | // 需要剪切应显示视图的其余部分 62 | Path path = new Path(); 63 | path.addRoundRect( 64 | new RectF(0, 0, _ST.DP( 65 | _v.getFrame().size.width), 66 | _ST.DP(_v.getFrame().size.height) 67 | ), 68 | _ST.DP(_appearance.getCornerRadius()), 69 | _ST.DP(_appearance.getCornerRadius()), 70 | Path.Direction.CW 71 | ); 72 | canvas.clipPath(path, Region.Op.REPLACE); 73 | } 74 | } 75 | 76 | /** 77 | * 设置控件的圆角半径 78 | * 79 | * @param radius 控件的圆角半径 80 | */ 81 | public void setCornerRadius(float radius) { 82 | _appearance.setCornerRadius(radius); 83 | applyAppearance();// 应用外观 84 | } 85 | 86 | /** 87 | * 设置控件的边框线的宽度 88 | * 89 | * @param width 控件的圆角半径 90 | */ 91 | public void setBorderWidth(float width) { 92 | _appearance.setBorderWidth(width); 93 | applyAppearance();// 应用外观 94 | } 95 | 96 | /** 97 | * 设置空间的边框线颜色 98 | * 99 | * @param color 控件的边框线的颜色 100 | */ 101 | public void setBorderColor(CGColorRef color) { 102 | _appearance.setBorderColor(color); 103 | applyAppearance(); 104 | } 105 | 106 | /** 107 | * 根据所有设置把设置的样式应用到控件之上 108 | */ 109 | private void applyAppearance() { 110 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { 111 | // 高版本SDK使用新的API 112 | _v.setBackground(_appearance.createDrawable()); 113 | if (_v.get_rView() != null) 114 | _v.get_rView().setBackground(_appearance.createDrawable()); 115 | } else { 116 | _v.setBackgroundDrawable(_appearance.createDrawable()); 117 | if (_v.get_rView() != null) 118 | _v.get_rView().setBackgroundDrawable(_appearance.createDrawable()); 119 | } 120 | } 121 | 122 | 123 | public boolean isMasksToBounds() { 124 | return masksToBounds; 125 | } 126 | 127 | public void setMasksToBounds(boolean masksToBounds) { 128 | this.masksToBounds = masksToBounds; 129 | _v.postInvalidate(); 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/native_ui/README.MD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LemonITCN/LemonSuperKit4Android/e7e549327e5741fd54e28b213595a474fe1139b9/LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/native_ui/README.MD -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/native_ui/extend/README.MD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LemonITCN/LemonSuperKit4Android/e7e549327e5741fd54e28b213595a474fe1139b9/LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/native_ui/extend/README.MD -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/native_ui/extend/adapter/LKScrollViewDelegateAdapter.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonsuperkit.native_ui.extend.adapter; 2 | 3 | import net.lemonsoft.lemonsuperkit.core.graphics.CGPoint; 4 | import net.lemonsoft.lemonsuperkit.native_ui.extend.delegate.LKScrollViewDelegate; 5 | import net.lemonsoft.lemonsuperkit.native_ui.extend.view.LKScrollView; 6 | 7 | /** 8 | * Created by LiuRi on 2017/1/9. 9 | */ 10 | 11 | public abstract class LKScrollViewDelegateAdapter implements LKScrollViewDelegate { 12 | 13 | @Override 14 | public void scrollViewDidScroll(LKScrollView scrollView) { 15 | 16 | } 17 | 18 | @Override 19 | public void scrollViewWillBeginDragging(LKScrollView scrollView) { 20 | 21 | } 22 | 23 | @Override 24 | public void scrollViewWillEndDragging(LKScrollView scrollView, CGPoint velocity, CGPoint targetContentOffset) { 25 | 26 | } 27 | 28 | @Override 29 | public void scrollViewDidEndDragging(LKScrollView scrollView, boolean decelerate) { 30 | 31 | } 32 | 33 | @Override 34 | public void scrollViewWillBeginDecelerating(LKScrollView scrollView) { 35 | 36 | } 37 | 38 | @Override 39 | public void scrollViewDidEndDecelerating(LKScrollView scrollView) { 40 | 41 | } 42 | 43 | @Override 44 | public void scrollViewDidEndScrollingAnimation(LKScrollView scrollView) { 45 | 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/native_ui/extend/delegate/LKScrollViewDelegate.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonsuperkit.native_ui.extend.delegate; 2 | 3 | import net.lemonsoft.lemonsuperkit.core.graphics.CGPoint; 4 | import net.lemonsoft.lemonsuperkit.native_ui.extend.view.LKScrollView; 5 | 6 | /** 7 | * LKScrollView的代理函数 8 | * Created by LiuRi on 2017/1/5. 9 | */ 10 | 11 | public interface LKScrollViewDelegate { 12 | 13 | /** 14 | * 只要ScrollView的内容偏移被改变,就会被回调 15 | */ 16 | void scrollViewDidScroll(LKScrollView scrollView); 17 | 18 | // TODO 19 | /** 20 | * 只要ScrollView在被缩放的时候就会被回调(iOS>=3.2时候可用) 21 | */ 22 | // void scrollViewDidZoom(LKScrollView scrollView); 23 | 24 | /** 25 | * 手指触摸ScrollView将要滑动时候被回调 26 | */ 27 | void scrollViewWillBeginDragging(LKScrollView scrollView); 28 | 29 | /** 30 | * 手指即将停止触摸的时候被回调 31 | * 32 | * @param velocity 当前scrollView滚动的速度 33 | * @param targetContentOffset 照此速度移动的话的最终点 34 | */ 35 | void scrollViewWillEndDragging(LKScrollView scrollView, CGPoint velocity, CGPoint targetContentOffset); 36 | 37 | /** 38 | * 当手指离开ScrollView时回调该方法 39 | * 40 | * @param decelerate 是否继续移动,如果继续移动,那么为true 41 | */ 42 | void scrollViewDidEndDragging(LKScrollView scrollView, boolean decelerate); 43 | 44 | /** 45 | * 当手指离开ScrollView,滚动开始减速的时候调用 46 | */ 47 | void scrollViewWillBeginDecelerating(LKScrollView scrollView); 48 | 49 | /** 50 | * 当手指离开ScrollView,滚动减速到停止后调用 51 | */ 52 | void scrollViewDidEndDecelerating(LKScrollView scrollView); 53 | 54 | /** 55 | * 当ScrollView执行完动画之后被调用,通常指的是执行下面两个函数后被调用 56 | * setContentOffset() 57 | * scrollRectToVisible() 58 | */ 59 | void scrollViewDidEndScrollingAnimation(LKScrollView scrollView); 60 | 61 | // TODO 62 | 63 | /** 64 | * 设置要缩放的 scrollView 上面的哪一个子视图 , 只能是子视图 , 不能是ScrollView本身 65 | * 66 | * @return 要缩放的子视图 67 | */ 68 | // View viewForZoomingInScrollView(LKScrollView scrollView); 69 | 70 | // TODO 71 | /** 72 | * 当开始缩放的时候被回调 73 | * 74 | * @param view 要缩放的子视图 75 | */ 76 | // void scrollViewWillBeginZooming(LKScrollView scrollView, View view); 77 | 78 | // TODO 79 | /** 80 | * 当已经缩放的时候回调该方法,缩放在预设最小值和最大值中间的时候才可用(在回弹动画之后被调用) 81 | * 82 | * @param view 缩放的子视图 83 | * @param scale 缩放的比例 84 | */ 85 | // void scrollViewDidEndZooming(LKScrollView scrollView, View view, float scale); 86 | 87 | // TODO 88 | 89 | /** 90 | * 当用户点击状态栏的时候,调用此方法 91 | * 当要滚到视图顶部的时候回调此函数询问用户是否能回到顶部,该方法当设置scrollsToTop=true的时候才会回调 92 | * 93 | * @return 是否允许回到顶部的布尔值 94 | */ 95 | // boolean scrollViewShouldScrollToTop(LKScrollView scrollView); 96 | 97 | // TODO 98 | 99 | /** 100 | * 当已经滚动到顶部之后回调的函数(动画执行完毕) 101 | */ 102 | // void scrollViewDidScrollToTop(LKScrollView scrollView); 103 | 104 | } 105 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/native_ui/extend/drawable/LKRoundCornerImageDrawable.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonsuperkit.native_ui.extend.drawable; 2 | 3 | import android.graphics.Bitmap; 4 | import android.graphics.BitmapShader; 5 | import android.graphics.Canvas; 6 | import android.graphics.ColorFilter; 7 | import android.graphics.Paint; 8 | import android.graphics.PixelFormat; 9 | import android.graphics.RectF; 10 | import android.graphics.Shader; 11 | import android.graphics.drawable.Drawable; 12 | 13 | import net.lemonsoft.lemonsuperkit.native_ui.tools.LKDrawableTool; 14 | 15 | /** 16 | * 圆角矩形图片Drawable 17 | * Created by LiuRi on 2016/12/30. 18 | */ 19 | 20 | public class LKRoundCornerImageDrawable extends Drawable { 21 | 22 | private Paint mPaint; 23 | private Bitmap mBitmap; 24 | 25 | private RectF rectF; 26 | 27 | public LKRoundCornerImageDrawable(Bitmap bitmap) { 28 | mBitmap = bitmap; 29 | BitmapShader bitmapShader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, 30 | Shader.TileMode.CLAMP); 31 | mPaint = new Paint(); 32 | mPaint.setAntiAlias(true); 33 | mPaint.setShader(bitmapShader); 34 | } 35 | 36 | public LKRoundCornerImageDrawable(Drawable drawable) { 37 | this(LKDrawableTool.getDefaultDrawableTool().drawableToBitmap(drawable)); 38 | } 39 | 40 | @Override 41 | public void setBounds(int left, int top, int right, int bottom) { 42 | super.setBounds(left, top, right, bottom); 43 | rectF = new RectF(left, top, right, bottom); 44 | } 45 | 46 | @Override 47 | public void draw(Canvas canvas) { 48 | canvas.drawRoundRect(rectF, 30, 30, mPaint); 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 void setAlpha(int alpha) { 63 | mPaint.setAlpha(alpha); 64 | } 65 | 66 | @Override 67 | public void setColorFilter(ColorFilter cf) { 68 | mPaint.setColorFilter(cf); 69 | } 70 | 71 | @Override 72 | public int getOpacity() { 73 | return PixelFormat.TRANSLUCENT; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/native_ui/extend/view/LKScrollView.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonsuperkit.native_ui.extend.view; 2 | 3 | import android.animation.Animator; 4 | import android.animation.AnimatorListenerAdapter; 5 | import android.animation.ValueAnimator; 6 | import android.content.Context; 7 | import android.graphics.Color; 8 | import android.view.MotionEvent; 9 | import android.view.VelocityTracker; 10 | import android.view.View; 11 | import android.widget.FrameLayout; 12 | import android.widget.RelativeLayout; 13 | import android.widget.Scroller; 14 | 15 | import net.lemonsoft.lemonsuperkit.core.graphics.CGPoint; 16 | import net.lemonsoft.lemonsuperkit.core.graphics.CGSize; 17 | import net.lemonsoft.lemonsuperkit.native_ui.extend.delegate.LKScrollViewDelegate; 18 | 19 | /** 20 | * LemonKit - 自定义高级ScrollView 21 | * 支持多向滑动,边缘拉抻回弹 22 | * Created by LiuRi on 2017/1/4. 23 | */ 24 | 25 | public class LKScrollView extends FrameLayout { 26 | 27 | /** 28 | * 如果某一轴的的尺寸为0,那么该方向轴无法回弹 29 | * 如,width为0,那么x轴的最左侧和最右侧两侧无拉动回弹效果 30 | */ 31 | private CGSize contentSize = CGSize.make(0, 0); 32 | /** 33 | * 弹簧回弹效果 34 | */ 35 | private boolean bounces = true; 36 | /** 37 | * LKScrollView的代理对象 38 | */ 39 | private LKScrollViewDelegate delegate = null; 40 | 41 | private RelativeLayout contentView; 42 | private VelocityTracker tracker; 43 | private ScrollRunnable scrollRunnable; 44 | 45 | public LKScrollView(Context context) { 46 | super(context); 47 | this.setBackgroundColor(Color.WHITE); 48 | this.contentView = new RelativeLayout(context); 49 | this.contentView.setLayoutParams(new FrameLayout.LayoutParams(0, 0)); 50 | super.addView(contentView); 51 | } 52 | 53 | private float startX = 0; 54 | private float startY = 0; 55 | private float moveX = 0; 56 | private float moveY = 0; 57 | private boolean isTouching = false; 58 | 59 | /** 60 | * 初始化触摸开始的横轴数值 61 | * 62 | * @param event 触摸事件对象 63 | */ 64 | private void initTouchStartX(MotionEvent event) { 65 | startX = contentView.getX(); 66 | moveX = event.getX(); 67 | } 68 | 69 | /** 70 | * 初始化触摸开始的纵轴数值 71 | * 72 | * @param event 触摸事件对象 73 | */ 74 | private void initTouchStartY(MotionEvent event) { 75 | startY = contentView.getY(); 76 | moveY = event.getY(); 77 | } 78 | 79 | @Override 80 | public boolean onTouchEvent(MotionEvent event) { 81 | switch (event.getAction()) { 82 | case MotionEvent.ACTION_DOWN: { 83 | isTouching = true; 84 | if (delegate != null)// 调用开始滑动的代理函数 85 | delegate.scrollViewWillBeginDragging(this); 86 | if (scrollRunnable != null) { 87 | scrollRunnable.endScroll(); 88 | scrollRunnable = null; 89 | } 90 | tracker = VelocityTracker.obtain(); 91 | if (tracker != null) 92 | tracker.addMovement(event); 93 | initTouchStartX(event); 94 | initTouchStartY(event); 95 | break; 96 | } 97 | 98 | case MotionEvent.ACTION_POINTER_DOWN: { 99 | System.out.println("点击了一根手指"); 100 | break; 101 | } 102 | case MotionEvent.ACTION_MOVE: { 103 | if (tracker != null) 104 | tracker.addMovement(event); 105 | float currentX = startX + event.getX() - moveX; 106 | if (currentX < 0 && currentX > -getMaxX())// 在中间横轴显示区域滑动 107 | setBasicX(currentX); 108 | else if (getXCanBounces())// 水平边缘,如果有回弹效果 109 | setDampedX(currentX); 110 | else initTouchStartX(event);// 防止横向无回弹时候仍然拉动的话再次回拉时候距离延迟 111 | float currentY = startY + event.getY() - moveY; 112 | if (currentY < 0 && currentY > -getMaxY())// 在中间纵轴显示区域滑动 113 | setBasicY(currentY); 114 | else if (getYCanBounces())// 垂直边缘,如果有回弹效果 115 | setDampedY(currentY); 116 | else initTouchStartY(event);// 防止纵向无回弹时候仍然拉动的话再次回拉时候距离延迟 117 | // System.out.println("current y :" + currentY); 118 | break; 119 | } 120 | case MotionEvent.ACTION_UP: { 121 | if (tracker != null) { 122 | //将当前事件添加到速度检测器中 123 | tracker.addMovement(event); 124 | //计算当前的速度 125 | tracker.computeCurrentVelocity(1000); 126 | //得到当前x方向速度 127 | final float vX = tracker.getXVelocity(); 128 | //得到当前y方向的速度 129 | final float vY = tracker.getYVelocity(); 130 | scrollRunnable = new ScrollRunnable(getContext()); 131 | scrollRunnable.startScroll((int) vX, (int) vY); 132 | // 执行惯性滑动runnable 133 | post(scrollRunnable); 134 | // 自动处理溢出边界 135 | autoDealOutOfBounds(); 136 | } 137 | isTouching = false; 138 | break; 139 | } 140 | case MotionEvent.ACTION_CANCEL: 141 | //置空速度检测器 142 | if (tracker != null) { 143 | tracker.recycle(); 144 | tracker = null; 145 | } 146 | break; 147 | } 148 | return true; 149 | } 150 | 151 | /** 152 | * 获取实际应该滚动范围的宽 153 | * 154 | * @return 宽度的数值 155 | */ 156 | private int getContentWidth() { 157 | return (int) Math.max(getMeasuredWidth(), contentSize.width); 158 | } 159 | 160 | /** 161 | * 获取实际应该滚动范围的高 162 | * 163 | * @return 高度的数值 164 | */ 165 | private int getContentHeight() { 166 | return (int) Math.max(getMeasuredHeight(), contentSize.height); 167 | } 168 | 169 | /** 170 | * 获取最大的x坐标 171 | * 172 | * @return x坐标值 173 | */ 174 | private int getMaxX() { 175 | return getContentWidth() - getMeasuredWidth(); 176 | } 177 | 178 | /** 179 | * 获取最大的y坐标 180 | * 181 | * @return y坐标值 182 | */ 183 | private int getMaxY() { 184 | return getContentHeight() - getMeasuredHeight(); 185 | } 186 | 187 | /** 188 | * 判断当前水平方向是否能有弹簧回弹效果 189 | * 190 | * @return 是否有回弹效果的布尔值 191 | */ 192 | private boolean getXCanBounces() { 193 | return contentSize.width != 0 && bounces; 194 | } 195 | 196 | /** 197 | * 判断当前垂直方向是否能有弹簧回弹效果 198 | * 199 | * @return 是否有回弹效果的布尔值 200 | */ 201 | private boolean getYCanBounces() { 202 | return contentSize.height != 0 && bounces; 203 | } 204 | 205 | /** 206 | * 自动处理溢出边界的问题 207 | */ 208 | private void autoDealOutOfBounds() { 209 | if (contentView.getX() > 0) 210 | scrollToX(0, true); 211 | if (contentView.getY() > 0) 212 | scrollToY(0, true); 213 | if (contentView.getX() < -getMaxX()) 214 | scrollToX(-getMaxX(), true); 215 | if (contentView.getY() < -getMaxY()) 216 | scrollToY(-getMaxY(), true); 217 | } 218 | 219 | /** 220 | * 动画滚动到指定的水平位置 221 | * 222 | * @param x 水平位置x坐标 223 | */ 224 | public void scrollToX(float x, boolean animated) { 225 | final ValueAnimator animator = ValueAnimator.ofFloat(contentView.getX(), x); 226 | animator.setDuration(animated ? 200 : 0); 227 | animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { 228 | @Override 229 | public void onAnimationUpdate(ValueAnimator animation) { 230 | if (!isTouching)// 有触摸的时候,不适用动画改变 231 | setBasicX((Float) animation.getAnimatedValue()); 232 | } 233 | }); 234 | animator.start(); 235 | } 236 | 237 | /** 238 | * 动画滚动到指定的纵坐标 239 | * 240 | * @param y 垂直位置y坐标 241 | */ 242 | public void scrollToY(float y, boolean animated) { 243 | ValueAnimator animator = ValueAnimator.ofFloat(contentView.getY(), y); 244 | animator.setDuration(animated ? 200 : 0); 245 | animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { 246 | @Override 247 | public void onAnimationUpdate(ValueAnimator animation) { 248 | if (!isTouching)// 有触摸的时候,不适用动画改变 249 | setBasicY((Float) animation.getAnimatedValue()); 250 | } 251 | }); 252 | animator.addListener(new AnimatorListenerAdapter() { 253 | @Override 254 | public void onAnimationEnd(Animator animation) { 255 | super.onAnimationEnd(animation); 256 | delegate.scrollViewDidEndScrollingAnimation(LKScrollView.this); 257 | } 258 | }); 259 | animator.start(); 260 | } 261 | 262 | /** 263 | * 滚动到指定的位置 264 | * 265 | * @param point 位置信息 266 | */ 267 | public void scrollTo(CGPoint point, boolean animated) { 268 | scrollToX(-point.x, true); 269 | scrollToY(-point.y, true); 270 | } 271 | 272 | /** 273 | * 一般情况下改变水平坐标的时候触发 274 | */ 275 | private synchronized void setBasicX(float x) { 276 | if (delegate != null)// 调用代理函数 277 | delegate.scrollViewDidScroll(this); 278 | contentView.setX(x); 279 | } 280 | 281 | /** 282 | * 一般情况下改变垂直坐标的时候触发 283 | */ 284 | private synchronized void setBasicY(float y) { 285 | if (delegate != null)// 调用代理函数 286 | delegate.scrollViewDidScroll(this); 287 | contentView.setY(y); 288 | } 289 | 290 | /** 291 | * 设置经过阻尼函数处理过的x坐标 292 | * 293 | * @param x 横坐标 294 | */ 295 | private void setDampedX(float x) { 296 | if (x > 0) 297 | setBasicX((float) Math.sqrt(x) * 10); 298 | else if (x < -getMaxY()) 299 | setBasicX((float) -(Math.sqrt(Math.abs(x) - getMaxX())) * 10 - getMaxX()); 300 | } 301 | 302 | /** 303 | * 设置经过阻尼函数处理过的y坐标 304 | * 305 | * @param y 纵坐标 306 | */ 307 | private void setDampedY(float y) { 308 | if (y > 0) 309 | // setBasicY((float) Math.sqrt(y) * 10); 310 | setBasicY(y / 3.0f); 311 | else if (y < -getMaxY()) 312 | setBasicY((float) -(Math.sqrt(Math.abs(y) - getMaxY())) * 10 - getMaxY()); 313 | } 314 | 315 | public CGPoint getContentOffset() { 316 | return new CGPoint(-contentView.getX(), -contentView.getY()); 317 | } 318 | 319 | /** 320 | * 设置内容偏移位置信息 321 | * 322 | * @param point 偏移到的点的位置 323 | * @param animated 是否使用动画 324 | */ 325 | public void setContentOffset(CGPoint point, boolean animated) { 326 | scrollTo(point, animated); 327 | } 328 | 329 | /** 330 | * 无动画直接定位到指定偏移坐标 331 | * 332 | * @param point 要偏移到的点 333 | */ 334 | public void setContentOffset(CGPoint point) { 335 | setContentOffset(point, false); 336 | } 337 | 338 | public CGSize getContentSize() { 339 | return contentSize; 340 | } 341 | 342 | public void setContentSize(CGSize contentSize) { 343 | this.contentSize = contentSize; 344 | this.contentView.setLayoutParams( 345 | new LayoutParams( 346 | (int) Math.max(contentSize.width, getLayoutParams().width), 347 | (int) Math.max(contentSize.height, getLayoutParams().height) 348 | ) 349 | ); 350 | } 351 | 352 | public boolean isBounces() { 353 | return bounces; 354 | } 355 | 356 | public void setBounces(boolean bounces) { 357 | this.bounces = bounces; 358 | } 359 | 360 | public LKScrollViewDelegate getDelegate() { 361 | return delegate; 362 | } 363 | 364 | public void setDelegate(LKScrollViewDelegate delegate) { 365 | this.delegate = delegate; 366 | } 367 | 368 | // add View override 369 | 370 | @Override 371 | public void addView(View child) { 372 | contentView.addView(child); 373 | } 374 | 375 | // @Override 376 | // public void addView(View child, int index) { 377 | // contentView.addView(child, index); 378 | // } 379 | // 380 | // @Override 381 | // public void addView(View child, int width, int height) { 382 | // contentView.addView(child, width, height); 383 | // } 384 | // 385 | // @Override 386 | // public void addView(View child, ViewGroup.LayoutParams params) { 387 | // contentView.addView(child, params); 388 | // } 389 | // 390 | // @Override 391 | // public void addView(View child, int index, ViewGroup.LayoutParams params) { 392 | // contentView.addView(child, index, params); 393 | // } 394 | 395 | // end override add view 396 | 397 | private class ScrollRunnable implements Runnable { 398 | 399 | private Scroller mScroller; 400 | 401 | 402 | @Override 403 | public void run() { 404 | if (mScroller.computeScrollOffset()) { 405 | if (contentView.getX() < 0) 406 | setBasicX(Math.min(0, mScroller.getCurrX())); 407 | if (contentView.getY() < 0) 408 | setBasicY(Math.min(0, mScroller.getCurrY())); 409 | postDelayed(this, 16); 410 | } else if (delegate != null) {// 调用滑动停止的代理函数 411 | delegate.scrollViewDidEndDecelerating(LKScrollView.this); 412 | } 413 | } 414 | 415 | public ScrollRunnable(Context context) { 416 | mScroller = new Scroller(context); 417 | } 418 | 419 | public void startScroll(int velocityX, int velocityY) { 420 | mScroller.fling((int) contentView.getX(), (int) contentView.getY(), velocityX, velocityY, -getMaxX(), 0, -getMaxY(), 0); 421 | if (delegate != null && mScroller.computeScrollOffset())// 调用即将停止drag的代理函数 422 | delegate.scrollViewWillEndDragging(LKScrollView.this, CGPoint.make(velocityX, velocityY), CGPoint.make(-mScroller.getFinalX(), -mScroller.getFinalY())); 423 | if (delegate != null) { // 调用停止drag的代理函数 424 | delegate.scrollViewDidEndDragging(LKScrollView.this, velocityX != 0 || velocityY != 0); 425 | delegate.scrollViewWillBeginDecelerating(LKScrollView.this); 426 | } 427 | } 428 | 429 | public void endScroll() { 430 | mScroller.forceFinished(true); 431 | } 432 | 433 | } 434 | 435 | } 436 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/native_ui/extend/view/LKTableView.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonsuperkit.native_ui.extend.view; 2 | 3 | /** 4 | * Created by LiuRi on 2017/1/11. 5 | */ 6 | 7 | public class LKTableView extends LKScrollView { 8 | } 9 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/native_ui/extend/view/README.MD: -------------------------------------------------------------------------------- 1 | 本报 -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/native_ui/model/LKViewAppearanceModel.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonsuperkit.native_ui.model; 2 | 3 | import android.content.Context; 4 | import android.graphics.Color; 5 | import android.graphics.drawable.ColorDrawable; 6 | import android.graphics.drawable.Drawable; 7 | import android.graphics.drawable.GradientDrawable; 8 | import android.graphics.drawable.LayerDrawable; 9 | 10 | import net.lemonsoft.lemonsuperkit.core.graphics.CGColorRef; 11 | import net.lemonsoft.lemonsuperkit.core.graphics.CGRect; 12 | import net.lemonsoft.lemonsuperkit.native_ui.tools.LKSizeTool; 13 | import net.lemonsoft.lemonsuperkit.ui_kit.UIColor; 14 | 15 | /** 16 | * LemonKit 视图外观信息模型类 17 | * Created by LiuRi on 2016/12/30. 18 | */ 19 | 20 | public class LKViewAppearanceModel { 21 | 22 | /** 23 | * 背景颜色 24 | */ 25 | private UIColor backgroundColor = UIColor.clearColor(); 26 | /** 27 | * 边框颜色 28 | */ 29 | private CGColorRef borderColor = new CGColorRef(Color.argb(0, 255, 255, 255)); 30 | /** 31 | * 边框宽度 32 | */ 33 | private float borderWidth = 0f; 34 | /** 35 | * 圆角半径 36 | */ 37 | private float cornerRadius = 0f; 38 | /** 39 | * 阴影颜色 40 | */ 41 | private CGColorRef shadowColor = new CGColorRef(Color.argb(0, 0, 0, 0)); 42 | /** 43 | * 阴影半径 44 | */ 45 | private float shadowRadius = 0f; 46 | /** 47 | * 阴影透明度0-1 48 | */ 49 | private float shadowOpacity = 1f; 50 | /** 51 | * 控件的矩形外观 52 | */ 53 | private CGRect frame = CGRect.make(0, 0, 0, 0); 54 | 55 | /** 56 | * 尺寸控件类 57 | */ 58 | protected final LKSizeTool _ST = LKSizeTool.getDefaultSizeTool(); 59 | 60 | public LKViewAppearanceModel() { 61 | 62 | } 63 | 64 | private Context context; 65 | 66 | /** 67 | * 通过context构造外观描述对象 68 | * 69 | * @param context 上下文对象 70 | */ 71 | public LKViewAppearanceModel(Context context) { 72 | this.context = context; 73 | } 74 | 75 | public UIColor getBackgroundColor() { 76 | return backgroundColor; 77 | } 78 | 79 | public void setBackgroundColor(UIColor backgroundColor) { 80 | this.backgroundColor = backgroundColor; 81 | } 82 | 83 | public CGColorRef getBorderColor() { 84 | return borderColor; 85 | } 86 | 87 | public void setBorderColor(CGColorRef borderColor) { 88 | this.borderColor = borderColor; 89 | } 90 | 91 | public float getBorderWidth() { 92 | return borderWidth; 93 | } 94 | 95 | public void setBorderWidth(float borderWidth) { 96 | this.borderWidth = borderWidth; 97 | } 98 | 99 | public float getCornerRadius() { 100 | return cornerRadius; 101 | } 102 | 103 | public void setCornerRadius(float cornerRadius) { 104 | this.cornerRadius = cornerRadius; 105 | } 106 | 107 | public CGColorRef getShadowColor() { 108 | return shadowColor; 109 | } 110 | 111 | public void setShadowColor(CGColorRef shadowColor) { 112 | this.shadowColor = shadowColor; 113 | } 114 | 115 | public float getShadowRadius() { 116 | return shadowRadius; 117 | } 118 | 119 | public void setShadowRadius(float shadowRadius) { 120 | this.shadowRadius = shadowRadius; 121 | } 122 | 123 | public float getShadowOpacity() { 124 | return shadowOpacity; 125 | } 126 | 127 | public void setShadowOpacity(float shadowOpacity) { 128 | this.shadowOpacity = shadowOpacity; 129 | } 130 | 131 | public Drawable createDrawable() { 132 | Drawable[] drawables = new Drawable[1]; 133 | if (backgroundColor.getDrawable() instanceof ColorDrawable) { 134 | // 纯背景颜色,UIColor是通过颜色创建的(后期支持通过图片创建背景颜色) 135 | int realRadius = _ST.DP(this.cornerRadius); 136 | int borderWidth = _ST.DP(this.borderWidth);// 加边框后会出现空心圆角矩形的效果,所以设置为0 137 | float[] outerRadius = new float[8]; 138 | float[] innerRadius = new float[8]; 139 | for (int i = 0; i < 8; i++) { 140 | outerRadius[i] = realRadius + borderWidth; 141 | innerRadius[i] = realRadius; 142 | } 143 | 144 | GradientDrawable backDrawable = new GradientDrawable(); 145 | backDrawable.setShape(GradientDrawable.RECTANGLE);// 圆角矩形 146 | backDrawable.setCornerRadius(_ST.DP(this.cornerRadius));// 圆角半径设置 147 | backDrawable.setColor(((ColorDrawable) backgroundColor.getDrawable()).getColor());// 背景颜色 148 | backDrawable.setStroke(_ST.DP(borderWidth), borderColor.getColorValue());// 设置边框宽度和颜色 149 | 150 | drawables[0] = backDrawable; 151 | } 152 | LayerDrawable layerDrawable = new LayerDrawable(drawables); 153 | return layerDrawable; 154 | } 155 | 156 | } 157 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/native_ui/tools/LKColorTool.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonsuperkit.native_ui.tools; 2 | 3 | import android.graphics.Color; 4 | import android.graphics.drawable.ColorDrawable; 5 | import android.graphics.drawable.Drawable; 6 | import android.graphics.drawable.ShapeDrawable; 7 | 8 | /** 9 | * LemonKit颜色工具类 10 | * Created by LiuRi on 2016/12/30. 11 | */ 12 | 13 | public class LKColorTool { 14 | 15 | private static LKColorTool _defaultColorTool; 16 | 17 | public static synchronized LKColorTool getDefaultColorTool() { 18 | if (_defaultColorTool == null) 19 | _defaultColorTool = new LKColorTool(); 20 | return _defaultColorTool; 21 | } 22 | 23 | /** 24 | * 通过设置RGBA每种颜色的比例来生成颜色,每种值范围为0-1之间的浮点数 25 | * 26 | * @param alpha 透明度数值 27 | * @param red 红色数值 28 | * @param green 绿色数值 29 | * @param blue 蓝色数值 30 | * @return 颜色描述信息 31 | */ 32 | public int colorWithARGBFloat(float alpha, float red, float green, float blue) { 33 | return Color.argb( 34 | (int) (Math.min(alpha, 1) * 255), 35 | (int) (Math.min(red, 1) * 255), 36 | (int) (Math.min(green, 1) * 255), 37 | (int) (Math.min(blue, 1) * 255) 38 | ); 39 | } 40 | 41 | /** 42 | * 获取Drawable的颜色 43 | * 44 | * @param drawable drawable对象 45 | * @return 颜色值 46 | */ 47 | public int colorWithDrawable(Drawable drawable) { 48 | int colorValue = Color.argb(0, 255, 255, 255); 49 | if (drawable instanceof ShapeDrawable) 50 | colorValue = ((ShapeDrawable) drawable).getPaint().getColor(); 51 | else if (drawable instanceof ColorDrawable) 52 | colorValue = ((ColorDrawable) drawable).getColor(); 53 | return colorValue; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/native_ui/tools/LKDrawableTool.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonsuperkit.native_ui.tools; 2 | 3 | import android.graphics.Bitmap; 4 | import android.graphics.Canvas; 5 | import android.graphics.PixelFormat; 6 | import android.graphics.drawable.Drawable; 7 | 8 | /** 9 | * LemonKit Drawable工具类 10 | * Created by LiuRi on 2016/12/30. 11 | */ 12 | 13 | public class LKDrawableTool { 14 | 15 | /** 16 | * 单例对象 17 | */ 18 | private static LKDrawableTool _defaultDrawableTool; 19 | 20 | /** 21 | * 单例方法,获取Drawable工具类 22 | */ 23 | public static LKDrawableTool getDefaultDrawableTool() { 24 | if (_defaultDrawableTool == null) 25 | _defaultDrawableTool = new LKDrawableTool(); 26 | return _defaultDrawableTool; 27 | } 28 | 29 | /** 30 | * 将drawable绘制成bitmap 31 | * 32 | * @param drawable 要绘制成bitmap的drawable 33 | * @return 绘制完毕的bitmap对象 34 | */ 35 | public Bitmap drawableToBitmap(Drawable drawable) { 36 | int w = drawable.getIntrinsicWidth(); 37 | int h = drawable.getIntrinsicHeight(); 38 | Bitmap.Config config = 39 | drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888 40 | : Bitmap.Config.RGB_565; 41 | Bitmap bitmap = Bitmap.createBitmap(w, h, config); 42 | //注意,下面三行代码要用到,否在在View或者SurfaceView里的canvas.drawBitmap会看不到图 43 | Canvas canvas = new Canvas(bitmap); 44 | drawable.setBounds(0, 0, w, h); 45 | drawable.draw(canvas); 46 | return bitmap; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/native_ui/tools/LKSizeTool.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonsuperkit.native_ui.tools; 2 | 3 | import android.content.Context; 4 | import android.util.DisplayMetrics; 5 | import android.view.WindowManager; 6 | 7 | import net.lemonsoft.lemonsuperkit.core.graphics.CGRect; 8 | 9 | /** 10 | * LemonKit工具类 - 尺寸相关工具 11 | * Created by LiuRi on 2016/12/23. 12 | */ 13 | 14 | public class LKSizeTool { 15 | 16 | private float _density; 17 | private DisplayMetrics _metrics; 18 | 19 | private static LKSizeTool _privateSizeTool; 20 | 21 | public static synchronized LKSizeTool getDefaultSizeTool() { 22 | if (_privateSizeTool == null) 23 | _privateSizeTool = new LKSizeTool(); 24 | return _privateSizeTool; 25 | } 26 | 27 | public void setContext(Context context) { 28 | _density = context.getResources().getDisplayMetrics().density; 29 | _metrics = new DisplayMetrics(); 30 | ((WindowManager) (context.getSystemService(Context.WINDOW_SERVICE))).getDefaultDisplay().getMetrics(_metrics); 31 | } 32 | 33 | /** 34 | * 换算dp到px 35 | * 36 | * @param dpValue dp的数值 37 | * @return 对应的px数值 38 | */ 39 | public int dpToPx(float dpValue) { 40 | return (int) (_density * dpValue + 0.5f); 41 | } 42 | 43 | /** 44 | * 换算px到dp 45 | * 46 | * @param pxValue px的数值 47 | * @return 对应的dp数值 48 | */ 49 | public int pxToDp(float pxValue) { 50 | return (int) (pxValue / _density + 0.5f); 51 | } 52 | 53 | /** 54 | * DP值,实际就是把数值当做DP来换算成PX返回 55 | * 56 | * @param dpValue DP的值 57 | * @return 58 | */ 59 | public int DP(float dpValue) { 60 | return dpToPx(dpValue); 61 | } 62 | 63 | /** 64 | * 获取屏幕的宽,单位dp 65 | * 66 | * @return 屏幕宽度dp值 67 | */ 68 | public int screenWidthDp() { 69 | return pxToDp(_metrics.widthPixels); 70 | } 71 | 72 | /** 73 | * 获取屏幕的高,单位dp 74 | * 75 | * @return 屏幕高度的dp值 76 | */ 77 | public int screenHeightDp() { 78 | return pxToDp(_metrics.heightPixels); 79 | } 80 | 81 | /** 82 | * 获取屏幕的矩形信息,单位DP 83 | * 84 | * @return 屏幕的矩形信息 85 | */ 86 | public CGRect screenFrame() { 87 | return CGRect.make(0, 0, screenWidthDp(), screenHeightDp()); 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/native_ui/tools/LKViewAppearanceTool.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonsuperkit.native_ui.tools; 2 | 3 | import android.view.View; 4 | import android.view.ViewGroup; 5 | 6 | import net.lemonsoft.lemonsuperkit.core.graphics.CGPoint; 7 | import net.lemonsoft.lemonsuperkit.core.graphics.CGRect; 8 | import net.lemonsoft.lemonsuperkit.core.graphics.CGSize; 9 | 10 | import java.lang.reflect.Constructor; 11 | 12 | /** 13 | * LemonKit 原生视图外观修改工具类 14 | * 本类中所有参数中设计的尺寸的单位都为DP 15 | * Created by LiuRi on 2016/12/28. 16 | */ 17 | 18 | public class LKViewAppearanceTool { 19 | 20 | /** 21 | * 尺寸工具 22 | */ 23 | private LKSizeTool _ST = LKSizeTool.getDefaultSizeTool(); 24 | 25 | /** 26 | * 单利对象存储变量 27 | */ 28 | private static LKViewAppearanceTool _viewAppearanceTool; 29 | 30 | /** 31 | * 单例方法 32 | * 33 | * @return 工具类的单例对象 34 | */ 35 | public static LKViewAppearanceTool getDefaultViewAppearanceTool() { 36 | if (_viewAppearanceTool == null) 37 | _viewAppearanceTool = new LKViewAppearanceTool(); 38 | return _viewAppearanceTool; 39 | } 40 | 41 | /** 42 | * 设置控件的X坐标,支持浮点数,单位DP 43 | * 44 | * @param view 要设置横坐标的控件 45 | * @param x 横坐标数值,单位DP 46 | */ 47 | public void setX(View view, float x) { 48 | view.setX(_ST.DP(x)); 49 | } 50 | 51 | /** 52 | * 设置控件的Y坐标,支持浮点数,单位DP 53 | * 54 | * @param view 要设置纵坐标的控件 55 | * @param y 纵坐标数值,单位DP 56 | */ 57 | public void setY(View view, float y) { 58 | view.setY(_ST.dpToPx(y)); 59 | } 60 | 61 | /** 62 | * 设置控件起始位置,即控件的左上角的点的位置,单位DP 63 | * 64 | * @param view 要设置起始位置的控件 65 | * @param x 控件的X坐标 66 | * @param y 控件的Y坐标 67 | */ 68 | public void setOrigin(View view, float x, float y) { 69 | setX(view, x); 70 | setY(view, y); 71 | } 72 | 73 | /** 74 | * 设置控件起始位置,即控件的左上角的点的位置,单位DP 75 | * 76 | * @param view 要设置起始位置的控件 77 | * @param origin 控件左上角点的描述对象 78 | */ 79 | public void setOrigin(View view, CGPoint origin) { 80 | setX(view, origin.x); 81 | setY(view, origin.y); 82 | } 83 | 84 | /** 85 | * 根据控件的父容器类型自动创建布局参数的实例对象 86 | * 87 | * @param view 要创建布局参数的实例对象的控件 88 | * @return 布局参数的实例对象 89 | * @throws Exception 创建时候产生的异常 90 | */ 91 | public ViewGroup.LayoutParams autoCreateLayoutParams(View view, int width, int height) { 92 | try { 93 | String containerClassName = view.getParent().getClass().getName(); 94 | if (containerClassName == null || containerClassName.equals("")) 95 | throw new Exception("无法找到这个控件的容器"); 96 | Class clazz = Class.forName(containerClassName + "$LayoutParams"); 97 | Constructor constructor = clazz.getConstructor(int.class, int.class); 98 | return constructor.newInstance(width, height); 99 | } catch (Exception e) { 100 | System.err.print("控件无父容器,设置布局参数对象为ViewGroup.LayoutParams"); 101 | return new ViewGroup.LayoutParams(width, height); 102 | } 103 | } 104 | 105 | /** 106 | * 设置指定控件的宽度 107 | * 108 | * @param view 要设置宽度的控件 109 | * @param width 控件的宽度要设置的值 110 | */ 111 | public void setWidth(View view, float width) { 112 | if (view.getLayoutParams() == null) 113 | view.setLayoutParams(autoCreateLayoutParams(view, _ST.DP(width), 0)); 114 | view.getLayoutParams().width = _ST.DP(width); 115 | } 116 | 117 | /** 118 | * 设置制定控件的高度 119 | * 120 | * @param view 要设置高度的控件 121 | * @param height 控件的高度要设置的值 122 | */ 123 | public void setHeight(View view, float height) { 124 | if (view.getLayoutParams() == null) 125 | view.setLayoutParams(autoCreateLayoutParams(view, 0, _ST.DP(height))); 126 | view.getLayoutParams().height = _ST.DP(height); 127 | } 128 | 129 | /** 130 | * 设置控件的尺寸,单位DP 131 | * 132 | * @param view 要设置尺寸的控件 133 | * @param width 控件的宽度,单位DP 134 | * @param height 控件的高度,单位DP 135 | */ 136 | public void setSize(View view, float width, float height) { 137 | setWidth(view, width); 138 | setHeight(view, height); 139 | } 140 | 141 | /** 142 | * 设置控件的尺寸,使用尺寸描述对象 143 | * 144 | * @param view 要设置尺寸的控件 145 | * @param size 控件的尺寸描述对象 146 | */ 147 | public void setSize(View view, CGSize size) { 148 | setWidth(view, size.width); 149 | setHeight(view, size.height); 150 | } 151 | 152 | /** 153 | * 设置控件的矩形信息,使用矩形信息描述对象 154 | * 155 | * @param view 要设置控件矩形的控件 156 | * @param frame 控件的矩形信息描述对象 157 | */ 158 | public void setFrame(View view, CGRect frame) { 159 | setSize(view, frame.size); 160 | setOrigin(view, frame.origin); 161 | } 162 | } -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/ui_kit/UIColor.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonsuperkit.ui_kit; 2 | 3 | import android.graphics.Color; 4 | import android.graphics.drawable.ColorDrawable; 5 | import android.graphics.drawable.Drawable; 6 | import android.graphics.drawable.ShapeDrawable; 7 | 8 | import net.lemonsoft.lemonsuperkit.core.graphics.CGColorRef; 9 | import net.lemonsoft.lemonsuperkit.native_ui.tools.LKColorTool; 10 | 11 | /** 12 | * LemonKit颜色描述对象 13 | * Created by LiuRi on 2016/12/29. 14 | */ 15 | 16 | public class UIColor { 17 | 18 | private Drawable drawable; 19 | 20 | public Drawable getDrawable() { 21 | return drawable; 22 | } 23 | 24 | public UIColor(float red, float green, float blue, float alpha) { 25 | this.drawable = new ColorDrawable( 26 | LKColorTool.getDefaultColorTool().colorWithARGBFloat(alpha, red, green, blue) 27 | ); 28 | } 29 | 30 | public UIColor(String hexColor) { 31 | this.drawable = new ColorDrawable(Color.parseColor(hexColor)); 32 | } 33 | 34 | /** 35 | * 获取CGColor颜色值描述对象 36 | * 37 | * @return CGColor颜色值描述对象 38 | */ 39 | public CGColorRef cgColor() { 40 | int colorValue = Color.argb(0, 255, 255, 255); 41 | if (drawable instanceof ColorDrawable) 42 | colorValue = ((ColorDrawable) drawable).getColor(); 43 | else if (drawable instanceof ShapeDrawable) 44 | colorValue = ((ShapeDrawable) drawable).getPaint().getColor(); 45 | return new CGColorRef(colorValue); 46 | } 47 | 48 | /** 49 | * 根据红绿蓝 50 | * 51 | * @param red 红色颜色值 52 | * @param green 绿色颜色值 53 | * @param blue 蓝色颜色值 54 | * @param alpha 透明度颜色值 55 | * @return 生成的UIColor对象 56 | */ 57 | public static UIColor colorWithRedGreenBlueAlpha(float red, float green, float blue, float alpha) { 58 | return new UIColor(alpha, red, green, blue); 59 | } 60 | 61 | /** 62 | * 透明颜色 63 | * #00ffffff 64 | * 0,255,255,255 65 | */ 66 | public static UIColor clearColor() { 67 | return new UIColor(1f, 1f, 1f, 0f); 68 | } 69 | 70 | /** 71 | * aliceblue 72 | * #f0f8ff 73 | * 240,248,255 74 | */ 75 | public static UIColor aliceblueColor() { 76 | return new UIColor("#f0f8ff"); 77 | } 78 | 79 | /** 80 | * antiquewhite 81 | * #faebd7 82 | * 250,235,215 83 | */ 84 | public static UIColor antiquewhiteColor() { 85 | return new UIColor("#faebd7"); 86 | } 87 | 88 | /** 89 | * aqua 90 | * #00ffff 91 | * 0,255,255 92 | */ 93 | public static UIColor aquaColor() { 94 | return new UIColor("#00ffff"); 95 | } 96 | 97 | /** 98 | * aquamarine 99 | * #7fffd4 100 | * 127,255,212 101 | */ 102 | public static UIColor aquamarineColor() { 103 | return new UIColor("#7fffd4"); 104 | } 105 | 106 | /** 107 | * azure 108 | * #f0ffff 109 | * 240,255,255 110 | */ 111 | public static UIColor azureColor() { 112 | return new UIColor("#f0ffff"); 113 | } 114 | 115 | /** 116 | * beige 117 | * #f5f5dc 118 | * 245,245,220 119 | */ 120 | public static UIColor beigeColor() { 121 | return new UIColor("#f5f5dc"); 122 | } 123 | 124 | /** 125 | * bisque 126 | * #ffe4c4 127 | * 255,228,196 128 | */ 129 | public static UIColor bisqueColor() { 130 | return new UIColor("#ffe4c4"); 131 | } 132 | 133 | /** 134 | * black 135 | * #000000 136 | * 0,0,0 137 | */ 138 | public static UIColor blackColor() { 139 | return new UIColor("#000000"); 140 | } 141 | 142 | /** 143 | * blanchedalmond 144 | * #ffebcd 145 | * 255,235,205 146 | */ 147 | public static UIColor blanchedalmondColor() { 148 | return new UIColor("#ffebcd"); 149 | } 150 | 151 | /** 152 | * blue 153 | * #0000ff 154 | * 0,0,255 155 | */ 156 | public static UIColor blueColor() { 157 | return new UIColor("#0000ff"); 158 | } 159 | 160 | /** 161 | * blueviolet 162 | * #8a2be2 163 | * 138,43,226 164 | */ 165 | public static UIColor bluevioletColor() { 166 | return new UIColor("#8a2be2"); 167 | } 168 | 169 | /** 170 | * brown 171 | * #a52a2a 172 | * 165,42,42 173 | */ 174 | public static UIColor brownColor() { 175 | return new UIColor("#a52a2a"); 176 | } 177 | 178 | /** 179 | * burlywood 180 | * #deb887 181 | * 222,184,135 182 | */ 183 | public static UIColor burlywoodColor() { 184 | return new UIColor("#deb887"); 185 | } 186 | 187 | /** 188 | * cadetblue 189 | * #5f9ea0 190 | * 95,158,160 191 | */ 192 | public static UIColor cadetblueColor() { 193 | return new UIColor("#5f9ea0"); 194 | } 195 | 196 | /** 197 | * chartruse 198 | * #7fff00 199 | * 127,255,0 200 | */ 201 | public static UIColor chartruseColor() { 202 | return new UIColor("#7fff00"); 203 | } 204 | 205 | /** 206 | * chocolate 207 | * #d2691e 208 | * 210,105,30 209 | */ 210 | public static UIColor chocolateColor() { 211 | return new UIColor("#d2691e"); 212 | } 213 | 214 | /** 215 | * coral 216 | * #ff7f50 217 | * 255,127,80 218 | */ 219 | public static UIColor coralColor() { 220 | return new UIColor("#ff7f50"); 221 | } 222 | 223 | /** 224 | * cornflowerblue 225 | * #6495ed 226 | * 100,149,237 227 | */ 228 | public static UIColor cornflowerblueColor() { 229 | return new UIColor("#6495ed"); 230 | } 231 | 232 | /** 233 | * cornsilk 234 | * #fff8dc 235 | * 255,248,220 236 | */ 237 | public static UIColor cornsilkColor() { 238 | return new UIColor("#fff8dc"); 239 | } 240 | 241 | /** 242 | * crimson 243 | * #dc143c 244 | * 220,20,60 245 | */ 246 | public static UIColor crimsonColor() { 247 | return new UIColor("#dc143c"); 248 | } 249 | 250 | /** 251 | * cyan 252 | * #00ffff 253 | * 0,255,255 254 | */ 255 | public static UIColor cyanColor() { 256 | return new UIColor("#00ffff"); 257 | } 258 | 259 | /** 260 | * darkblue 261 | * #00008b 262 | * 0,0,139 263 | */ 264 | public static UIColor darkblueColor() { 265 | return new UIColor("#00008b"); 266 | } 267 | 268 | /** 269 | * darkcyan 270 | * #008b8b 271 | * 0,139,139 272 | */ 273 | public static UIColor darkcyanColor() { 274 | return new UIColor("#008b8b"); 275 | } 276 | 277 | /** 278 | * darkgoldenrod 279 | * #b8860b 280 | * 184,134,11 281 | */ 282 | public static UIColor darkgoldenrodColor() { 283 | return new UIColor("#b8860b"); 284 | } 285 | 286 | /** 287 | * darkgray 288 | * #a9a9a9 289 | * 169,169,169 290 | */ 291 | public static UIColor darkgrayColor() { 292 | return new UIColor("#a9a9a9"); 293 | } 294 | 295 | /** 296 | * darkgreen 297 | * #006400 298 | * 0,100,0 299 | */ 300 | public static UIColor darkgreenColor() { 301 | return new UIColor("#006400"); 302 | } 303 | 304 | /** 305 | * darkkhaki 306 | * #bdb76b 307 | * 189,183,107 308 | */ 309 | public static UIColor darkkhakiColor() { 310 | return new UIColor("#bdb76b"); 311 | } 312 | 313 | /** 314 | * darkmagenta 315 | * #8b008b 316 | * 139,0,139 317 | */ 318 | public static UIColor darkmagentaColor() { 319 | return new UIColor("#8b008b"); 320 | } 321 | 322 | /** 323 | * darkolivegreen 324 | * #556b2f 325 | * 85,107,47 326 | */ 327 | public static UIColor darkolivegreenColor() { 328 | return new UIColor("#556b2f"); 329 | } 330 | 331 | /** 332 | * darkorange 333 | * #ff8c00 334 | * 255,140,0 335 | */ 336 | public static UIColor darkorangeColor() { 337 | return new UIColor("#ff8c00"); 338 | } 339 | 340 | /** 341 | * darkorchid 342 | * #9932cc 343 | * 153,50,204 344 | */ 345 | public static UIColor darkorchidColor() { 346 | return new UIColor("#9932cc"); 347 | } 348 | 349 | /** 350 | * darksalmon 351 | * #e9967a 352 | * 233,150,122 353 | */ 354 | public static UIColor darksalmonColor() { 355 | return new UIColor("#e9967a"); 356 | } 357 | 358 | /** 359 | * darkseagreen 360 | * #8fbc8f 361 | * 143,188,143 362 | */ 363 | public static UIColor darkseagreenColor() { 364 | return new UIColor("#8fbc8f"); 365 | } 366 | 367 | /** 368 | * darkslateblue 369 | * #483d8b 370 | * 72,61,139 371 | */ 372 | public static UIColor darkslateblueColor() { 373 | return new UIColor("#483d8b"); 374 | } 375 | 376 | /** 377 | * darkslategray 378 | * #2f4f4f 379 | * 47,79,79 380 | */ 381 | public static UIColor darkslategrayColor() { 382 | return new UIColor("#2f4f4f"); 383 | } 384 | 385 | /** 386 | * darkturquoise 387 | * #00ced1 388 | * 0,206,209 389 | */ 390 | public static UIColor darkturquoiseColor() { 391 | return new UIColor("#00ced1"); 392 | } 393 | 394 | /** 395 | * darkviolet 396 | * #9400d3 397 | * 148,0,211 398 | */ 399 | public static UIColor darkvioletColor() { 400 | return new UIColor("#9400d3"); 401 | } 402 | 403 | /** 404 | * deeppink 405 | * #ff1493 406 | * 255,20,147 407 | */ 408 | public static UIColor deeppinkColor() { 409 | return new UIColor("#ff1493"); 410 | } 411 | 412 | /** 413 | * deepskyblue 414 | * #00bfff 415 | * 0,191,255 416 | */ 417 | public static UIColor deepskyblueColor() { 418 | return new UIColor("#00bfff"); 419 | } 420 | 421 | /** 422 | * dimgray 423 | * #696969 424 | * 105,105,105 425 | */ 426 | public static UIColor dimgrayColor() { 427 | return new UIColor("#696969"); 428 | } 429 | 430 | /** 431 | * dodgerblue 432 | * #le90ff 433 | * 30,144,255 434 | */ 435 | public static UIColor dodgerblueColor() { 436 | return new UIColor("#le90ff"); 437 | } 438 | 439 | /** 440 | * firebrick 441 | * #b22222 442 | * 178,34,34 443 | */ 444 | public static UIColor firebrickColor() { 445 | return new UIColor("#b22222"); 446 | } 447 | 448 | /** 449 | * floralwhite 450 | * #fffaf0 451 | * 255,250,240 452 | */ 453 | public static UIColor floralwhiteColor() { 454 | return new UIColor("#fffaf0"); 455 | } 456 | 457 | /** 458 | * forestgreen 459 | * #228b22 460 | * 34,193,34 461 | */ 462 | public static UIColor forestgreenColor() { 463 | return new UIColor("#228b22"); 464 | } 465 | 466 | /** 467 | * fuchsia 468 | * #ff00ff 469 | * 255,0,255 470 | */ 471 | public static UIColor fuchsiaColor() { 472 | return new UIColor("#ff00ff"); 473 | } 474 | 475 | /** 476 | * gainsboro 477 | * #dcdcdc 478 | * 220,220,220 479 | */ 480 | public static UIColor gainsboroColor() { 481 | return new UIColor("#dcdcdc"); 482 | } 483 | 484 | /** 485 | * ghostwhite 486 | * #f8f8ff 487 | * 248,248,255 488 | */ 489 | public static UIColor ghostwhiteColor() { 490 | return new UIColor("#f8f8ff"); 491 | } 492 | 493 | /** 494 | * gold 495 | * #ffd700 496 | * 255,215,0 497 | */ 498 | public static UIColor goldColor() { 499 | return new UIColor("#ffd700"); 500 | } 501 | 502 | /** 503 | * goldenrod 504 | * #daa520 505 | * 218,165,32 506 | */ 507 | public static UIColor goldenrodColor() { 508 | return new UIColor("#daa520"); 509 | } 510 | 511 | /** 512 | * gray 513 | * #808080 514 | * 128,128,128 515 | */ 516 | public static UIColor grayColor() { 517 | return new UIColor("#808080"); 518 | } 519 | 520 | /** 521 | * green 522 | * #008000 523 | * 0,128,0 524 | */ 525 | public static UIColor greenColor() { 526 | return new UIColor("#008000"); 527 | } 528 | 529 | /** 530 | * greenyellow 531 | * #adff2f 532 | * 173,255,47 533 | */ 534 | public static UIColor greenyellowColor() { 535 | return new UIColor("#adff2f"); 536 | } 537 | 538 | /** 539 | * honeydew 540 | * #f0fff0 541 | * 240,255,240 542 | */ 543 | public static UIColor honeydewColor() { 544 | return new UIColor("#f0fff0"); 545 | } 546 | 547 | /** 548 | * hotpink 549 | * #ff69b4 550 | * 255,105,180 551 | */ 552 | public static UIColor hotpinkColor() { 553 | return new UIColor("#ff69b4"); 554 | } 555 | 556 | /** 557 | * indianred 558 | * #cd5c5c 559 | * 205,92,92 560 | */ 561 | public static UIColor indianredColor() { 562 | return new UIColor("#cd5c5c"); 563 | } 564 | 565 | /** 566 | * indigo 567 | * #4b0082 568 | * 75,0,130 569 | */ 570 | public static UIColor indigoColor() { 571 | return new UIColor("#4b0082"); 572 | } 573 | 574 | /** 575 | * ivory 576 | * #fffff0 577 | * 255,255,240 578 | */ 579 | public static UIColor ivoryColor() { 580 | return new UIColor("#fffff0"); 581 | } 582 | 583 | /** 584 | * khaki 585 | * #f0e68c 586 | * 240,230,140 587 | */ 588 | public static UIColor khakiColor() { 589 | return new UIColor("#f0e68c"); 590 | } 591 | 592 | /** 593 | * lavender 594 | * #e6e6fa 595 | * 230,230,250 596 | */ 597 | public static UIColor lavenderColor() { 598 | return new UIColor("#e6e6fa"); 599 | } 600 | 601 | /** 602 | * lavenderblush 603 | * #fff0f5 604 | * 255,240,245 605 | */ 606 | public static UIColor lavenderblushColor() { 607 | return new UIColor("#fff0f5"); 608 | } 609 | 610 | /** 611 | * lawngreen 612 | * #7cfc00 613 | * 124,252,0 614 | */ 615 | public static UIColor lawngreenColor() { 616 | return new UIColor("#7cfc00"); 617 | } 618 | 619 | /** 620 | * lemonchiffon 621 | * #fffacd 622 | * 255,250,205 623 | */ 624 | public static UIColor lemonchiffonColor() { 625 | return new UIColor("#fffacd"); 626 | } 627 | 628 | /** 629 | * lightblue 630 | * #add8e6 631 | * 173,216,230 632 | */ 633 | public static UIColor lightblueColor() { 634 | return new UIColor("#add8e6"); 635 | } 636 | 637 | /** 638 | * lightcoral 639 | * #f08080 640 | * 240,128,128 641 | */ 642 | public static UIColor lightcoralColor() { 643 | return new UIColor("#f08080"); 644 | } 645 | 646 | /** 647 | * lightcyan 648 | * #e0ffff 649 | * 224,255,255 650 | */ 651 | public static UIColor lightcyanColor() { 652 | return new UIColor("#e0ffff"); 653 | } 654 | 655 | /** 656 | * lightgoldenrodyellow 657 | * #fafad2 658 | * 250,250,210 659 | */ 660 | public static UIColor lightgoldenrodyellowColor() { 661 | return new UIColor("#fafad2"); 662 | } 663 | 664 | /** 665 | * lightgreen 666 | * #90ee90 667 | * 144,238,144 668 | */ 669 | public static UIColor lightgreenColor() { 670 | return new UIColor("#90ee90"); 671 | } 672 | 673 | /** 674 | * lightgrey 675 | * #d3d3d3 676 | * 211,211,211 677 | */ 678 | public static UIColor lightgreyColor() { 679 | return new UIColor("#d3d3d3"); 680 | } 681 | 682 | /** 683 | * lightpink 684 | * #ffb6c1 685 | * 255,182,193 686 | */ 687 | public static UIColor lightpinkColor() { 688 | return new UIColor("#ffb6c1"); 689 | } 690 | 691 | /** 692 | * lightsalmon 693 | * #ffa07a 694 | * 255,160,122 695 | */ 696 | public static UIColor lightsalmonColor() { 697 | return new UIColor("#ffa07a"); 698 | } 699 | 700 | /** 701 | * lightseagreen 702 | * #20b2aa 703 | * 32,178,170 704 | */ 705 | public static UIColor lightseagreenColor() { 706 | return new UIColor("#20b2aa"); 707 | } 708 | 709 | /** 710 | * lightskyblue 711 | * #87cefa 712 | * 135,206,250 713 | */ 714 | public static UIColor lightskyblueColor() { 715 | return new UIColor("#87cefa"); 716 | } 717 | 718 | /** 719 | * lightslategray 720 | * #778899 721 | * 119,136,153 722 | */ 723 | public static UIColor lightslategrayColor() { 724 | return new UIColor("#778899"); 725 | } 726 | 727 | /** 728 | * lightsteelblue 729 | * #b0c4de 730 | * 176,196,222 731 | */ 732 | public static UIColor lightsteelblueColor() { 733 | return new UIColor("#b0c4de"); 734 | } 735 | 736 | /** 737 | * lightyellow 738 | * #ffffe0 739 | * 255,255,224 740 | */ 741 | public static UIColor lightyellowColor() { 742 | return new UIColor("#ffffe0"); 743 | } 744 | 745 | /** 746 | * lime 747 | * #00ff00 748 | * 0,255,0 749 | */ 750 | public static UIColor limeColor() { 751 | return new UIColor("#00ff00"); 752 | } 753 | 754 | /** 755 | * limegreen 756 | * #32cd32 757 | * 50,205,50 758 | */ 759 | public static UIColor limegreenColor() { 760 | return new UIColor("#32cd32"); 761 | } 762 | 763 | /** 764 | * linen 765 | * #faf0e6 766 | * 250,240,230 767 | */ 768 | public static UIColor linenColor() { 769 | return new UIColor("#faf0e6"); 770 | } 771 | 772 | /** 773 | * magenta 774 | * #ff00ff 775 | * 255,0,255 776 | */ 777 | public static UIColor magentaColor() { 778 | return new UIColor("#ff00ff"); 779 | } 780 | 781 | /** 782 | * maroon 783 | * #800000 784 | * 128,0,0 785 | */ 786 | public static UIColor maroonColor() { 787 | return new UIColor("#800000"); 788 | } 789 | 790 | /** 791 | * mediumaquamarine 792 | * #66cdaa 793 | * 102,205,170 794 | */ 795 | public static UIColor mediumaquamarineColor() { 796 | return new UIColor("#66cdaa"); 797 | } 798 | 799 | /** 800 | * mediumblue 801 | * #0000cd 802 | * 0,0,205 803 | */ 804 | public static UIColor mediumblueColor() { 805 | return new UIColor("#0000cd"); 806 | } 807 | 808 | /** 809 | * mediumorchid 810 | * #ba55d3 811 | * 186,85,211 812 | */ 813 | public static UIColor mediumorchidColor() { 814 | return new UIColor("#ba55d3"); 815 | } 816 | 817 | /** 818 | * mediumpurple 819 | * #9370d6 820 | * 147,112,219 821 | */ 822 | public static UIColor mediumpurpleColor() { 823 | return new UIColor("#9370d6"); 824 | } 825 | 826 | /** 827 | * mediumseagreen 828 | * #3cb371 829 | * 60,179,113 830 | */ 831 | public static UIColor mediumseagreenColor() { 832 | return new UIColor("#3cb371"); 833 | } 834 | 835 | /** 836 | * mediumslateblue 837 | * #7b68ee 838 | * 123,104,238 839 | */ 840 | public static UIColor mediumslateblueColor() { 841 | return new UIColor("#7b68ee"); 842 | } 843 | 844 | /** 845 | * mediumspringgreen 846 | * #00fa9a 847 | * 0,250,154 848 | */ 849 | public static UIColor mediumspringgreenColor() { 850 | return new UIColor("#00fa9a"); 851 | } 852 | 853 | /** 854 | * mediumturquoise 855 | * #48d1cc 856 | * 72,209,204 857 | */ 858 | public static UIColor mediumturquoiseColor() { 859 | return new UIColor("#48d1cc"); 860 | } 861 | 862 | /** 863 | * mediumvioletred 864 | * #c71585 865 | * 199,21,133 866 | */ 867 | public static UIColor mediumvioletredColor() { 868 | return new UIColor("#c71585"); 869 | } 870 | 871 | /** 872 | * midnightblue 873 | * #191970 874 | * 25,25,112 875 | */ 876 | public static UIColor midnightblueColor() { 877 | return new UIColor("#191970"); 878 | } 879 | 880 | /** 881 | * mintcream 882 | * #f5fffa 883 | * 245,255,250 884 | */ 885 | public static UIColor mintcreamColor() { 886 | return new UIColor("#f5fffa"); 887 | } 888 | 889 | /** 890 | * mistyrose 891 | * #ffe4e1 892 | * 255,228,225 893 | */ 894 | public static UIColor mistyroseColor() { 895 | return new UIColor("#ffe4e1"); 896 | } 897 | 898 | /** 899 | * moccasin 900 | * #ffe4b5 901 | * 255,228,181 902 | */ 903 | public static UIColor moccasinColor() { 904 | return new UIColor("#ffe4b5"); 905 | } 906 | 907 | /** 908 | * navajowhite 909 | * #ffdead 910 | * 255,222,173 911 | */ 912 | public static UIColor navajowhiteColor() { 913 | return new UIColor("#ffdead"); 914 | } 915 | 916 | /** 917 | * navy 918 | * #000080 919 | * 0,0,128 920 | */ 921 | public static UIColor navyColor() { 922 | return new UIColor("#000080"); 923 | } 924 | 925 | /** 926 | * oldlace 927 | * #fdf5e6 928 | * 253,245,230 929 | */ 930 | public static UIColor oldlaceColor() { 931 | return new UIColor("#fdf5e6"); 932 | } 933 | 934 | /** 935 | * olive 936 | * #808000 937 | * 128,128,0 938 | */ 939 | public static UIColor oliveColor() { 940 | return new UIColor("#808000"); 941 | } 942 | 943 | /** 944 | * olivedrab 945 | * #6b8e23 946 | * 107,142,35 947 | */ 948 | public static UIColor olivedrabColor() { 949 | return new UIColor("#6b8e23"); 950 | } 951 | 952 | /** 953 | * orange 954 | * #ffa500 955 | * 255,165,0 956 | */ 957 | public static UIColor orangeColor() { 958 | return new UIColor("#ffa500"); 959 | } 960 | 961 | /** 962 | * orangered 963 | * #ff4500 964 | * 255,69,0 965 | */ 966 | public static UIColor orangeredColor() { 967 | return new UIColor("#ff4500"); 968 | } 969 | 970 | /** 971 | * orchid 972 | * #da70d6 973 | * 218,112,214 974 | */ 975 | public static UIColor orchidColor() { 976 | return new UIColor("#da70d6"); 977 | } 978 | 979 | /** 980 | * palegoldenrod 981 | * #eee8aa 982 | * 238,232,170 983 | */ 984 | public static UIColor palegoldenrodColor() { 985 | return new UIColor("#eee8aa"); 986 | } 987 | 988 | /** 989 | * palegreen 990 | * #98fb98 991 | * 152,251,152 992 | */ 993 | public static UIColor palegreenColor() { 994 | return new UIColor("#98fb98"); 995 | } 996 | 997 | /** 998 | * paleturquoise 999 | * #afeeee 1000 | * 175,238,238 1001 | */ 1002 | public static UIColor paleturquoiseColor() { 1003 | return new UIColor("#afeeee"); 1004 | } 1005 | 1006 | /** 1007 | * palevioletred 1008 | * #db7093 1009 | * 219,112,147 1010 | */ 1011 | public static UIColor palevioletredColor() { 1012 | return new UIColor("#db7093"); 1013 | } 1014 | 1015 | /** 1016 | * papayawhip 1017 | * #ffefd5 1018 | * 255,239,213 1019 | */ 1020 | public static UIColor papayawhipColor() { 1021 | return new UIColor("#ffefd5"); 1022 | } 1023 | 1024 | /** 1025 | * peachpuff 1026 | * #ffdab9 1027 | * 255,218,185 1028 | */ 1029 | public static UIColor peachpuffColor() { 1030 | return new UIColor("#ffdab9"); 1031 | } 1032 | 1033 | /** 1034 | * peru 1035 | * #cd853f 1036 | * 205,133,63 1037 | */ 1038 | public static UIColor peruColor() { 1039 | return new UIColor("#cd853f"); 1040 | } 1041 | 1042 | /** 1043 | * pink 1044 | * #ffc0cb 1045 | * 255,192,203 1046 | */ 1047 | public static UIColor pinkColor() { 1048 | return new UIColor("#ffc0cb"); 1049 | } 1050 | 1051 | /** 1052 | * plum 1053 | * #dda0dd 1054 | * 221,160,221 1055 | */ 1056 | public static UIColor plumColor() { 1057 | return new UIColor("#dda0dd"); 1058 | } 1059 | 1060 | /** 1061 | * powderblue 1062 | * #b0e0dd 1063 | * 176,224,230 1064 | */ 1065 | public static UIColor powderblueColor() { 1066 | return new UIColor("#b0e0dd"); 1067 | } 1068 | 1069 | /** 1070 | * purple 1071 | * #800080 1072 | * 128,0,128 1073 | */ 1074 | public static UIColor purpleColor() { 1075 | return new UIColor("#800080"); 1076 | } 1077 | 1078 | /** 1079 | * red 1080 | * #ff0000 1081 | * 255,0,0 1082 | */ 1083 | public static UIColor redColor() { 1084 | return new UIColor("#ff0000"); 1085 | } 1086 | 1087 | /** 1088 | * rosybrown 1089 | * #bc8f8f 1090 | * 188,0,143 1091 | */ 1092 | public static UIColor rosybrownColor() { 1093 | return new UIColor("#bc8f8f"); 1094 | } 1095 | 1096 | /** 1097 | * royalblue 1098 | * #41169e1 1099 | * 65,105,225 1100 | */ 1101 | public static UIColor royalblueColor() { 1102 | return new UIColor("#41169e1"); 1103 | } 1104 | 1105 | /** 1106 | * saddlebrown 1107 | * #8b4513 1108 | * 139,69,19 1109 | */ 1110 | public static UIColor saddlebrownColor() { 1111 | return new UIColor("#8b4513"); 1112 | } 1113 | 1114 | /** 1115 | * salmon 1116 | * #fa8072 1117 | * 250,128,114 1118 | */ 1119 | public static UIColor salmonColor() { 1120 | return new UIColor("#fa8072"); 1121 | } 1122 | 1123 | /** 1124 | * sandybrown 1125 | * #f4a460 1126 | * 244,164,96 1127 | */ 1128 | public static UIColor sandybrownColor() { 1129 | return new UIColor("#f4a460"); 1130 | } 1131 | 1132 | /** 1133 | * seagreen 1134 | * #2e8b57 1135 | * 46,139,87 1136 | */ 1137 | public static UIColor seagreenColor() { 1138 | return new UIColor("#2e8b57"); 1139 | } 1140 | 1141 | /** 1142 | * seashell 1143 | * #fff5ee 1144 | * 255,245,238 1145 | */ 1146 | public static UIColor seashellColor() { 1147 | return new UIColor("#fff5ee"); 1148 | } 1149 | 1150 | /** 1151 | * sienna 1152 | * #a0522d 1153 | * 160,82,45 1154 | */ 1155 | public static UIColor siennaColor() { 1156 | return new UIColor("#a0522d"); 1157 | } 1158 | 1159 | /** 1160 | * silver 1161 | * #c0c0c0 1162 | * 192,192,192 1163 | */ 1164 | public static UIColor silverColor() { 1165 | return new UIColor("#c0c0c0"); 1166 | } 1167 | 1168 | /** 1169 | * skyblue 1170 | * #87ceeb 1171 | * 135,206,235 1172 | */ 1173 | public static UIColor skyblueColor() { 1174 | return new UIColor("#87ceeb"); 1175 | } 1176 | 1177 | /** 1178 | * slateblue 1179 | * #6a5acd 1180 | * 106,90,205 1181 | */ 1182 | public static UIColor slateblueColor() { 1183 | return new UIColor("#6a5acd"); 1184 | } 1185 | 1186 | /** 1187 | * slategray 1188 | * #708090 1189 | * 112,128,144 1190 | */ 1191 | public static UIColor slategrayColor() { 1192 | return new UIColor("#708090"); 1193 | } 1194 | 1195 | /** 1196 | * snow 1197 | * #fffafa 1198 | * 255,250,250 1199 | */ 1200 | public static UIColor snowColor() { 1201 | return new UIColor("#fffafa"); 1202 | } 1203 | 1204 | /** 1205 | * springgreen 1206 | * #00ff7f 1207 | * 0,255,127 1208 | */ 1209 | public static UIColor springgreenColor() { 1210 | return new UIColor("#00ff7f"); 1211 | } 1212 | 1213 | /** 1214 | * steelblue 1215 | * #4682b4 1216 | * 70,130,180 1217 | */ 1218 | public static UIColor steelblueColor() { 1219 | return new UIColor("#4682b4"); 1220 | } 1221 | 1222 | /** 1223 | * tan 1224 | * #d2b48c 1225 | * 210,180,140 1226 | */ 1227 | public static UIColor tanColor() { 1228 | return new UIColor("#d2b48c"); 1229 | } 1230 | 1231 | /** 1232 | * teal 1233 | * #008080 1234 | * 0,128,128 1235 | */ 1236 | public static UIColor tealColor() { 1237 | return new UIColor("#008080"); 1238 | } 1239 | 1240 | /** 1241 | * thistle 1242 | * #d8bfd8 1243 | * 216,191,216 1244 | */ 1245 | public static UIColor thistleColor() { 1246 | return new UIColor("#d8bfd8"); 1247 | } 1248 | 1249 | /** 1250 | * tomato 1251 | * #ff6347 1252 | * 255,99,71 1253 | */ 1254 | public static UIColor tomatoColor() { 1255 | return new UIColor("#ff6347"); 1256 | } 1257 | 1258 | /** 1259 | * turquoise 1260 | * #40e0d0 1261 | * 64,224,208 1262 | */ 1263 | public static UIColor turquoiseColor() { 1264 | return new UIColor("#40e0d0"); 1265 | } 1266 | 1267 | /** 1268 | * violet 1269 | * #ee82ee 1270 | * 238,130,238 1271 | */ 1272 | public static UIColor violetColor() { 1273 | return new UIColor("#ee82ee"); 1274 | } 1275 | 1276 | /** 1277 | * wheat 1278 | * #f5deb3 1279 | * 245,223,179 1280 | */ 1281 | public static UIColor wheatColor() { 1282 | return new UIColor("#f5deb3"); 1283 | } 1284 | 1285 | /** 1286 | * white 1287 | * #ffffff 1288 | * 255,255,255 1289 | */ 1290 | public static UIColor whiteColor() { 1291 | return new UIColor("#ffffff"); 1292 | } 1293 | 1294 | /** 1295 | * whitesmoke 1296 | * #f5f5f5 1297 | * 245,245,245 1298 | */ 1299 | public static UIColor whitesmokeColor() { 1300 | return new UIColor("#f5f5f5"); 1301 | } 1302 | 1303 | /** 1304 | * yellow 1305 | * #ffff00 1306 | * 255,255,0 1307 | */ 1308 | public static UIColor yellowColor() { 1309 | return new UIColor("#ffff00"); 1310 | } 1311 | 1312 | /** 1313 | * yellowgreen 1314 | * #9acd32 1315 | * 154,205,50 1316 | */ 1317 | public static UIColor yellowgreenColor() { 1318 | return new UIColor("#9acd32"); 1319 | } 1320 | 1321 | 1322 | public Drawable getDRB() { 1323 | return drawable; 1324 | } 1325 | 1326 | } 1327 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/ui_kit/UIFont.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonsuperkit.ui_kit; 2 | 3 | /** 4 | * LemonKit 字体信息描述类 5 | * Created by lemonsoft on 2016/12/29. 6 | */ 7 | 8 | public class UIFont { 9 | } 10 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/ui_kit/UIImage.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonsuperkit.ui_kit; 2 | 3 | /** 4 | * LemonKit图片资源描述对象 5 | * Created by LiuRi on 2016/12/28. 6 | */ 7 | 8 | public class UIImage { 9 | } 10 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/ui_kit/adapter/UIScrollViewDelegateAdapter.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonsuperkit.ui_kit.adapter; 2 | 3 | import android.view.View; 4 | 5 | import net.lemonsoft.lemonsuperkit.ui_kit.delegate.UIScrollViewDelegate; 6 | import net.lemonsoft.lemonsuperkit.core.graphics.CGPoint; 7 | import net.lemonsoft.lemonsuperkit.ui_kit.ui_responder.ui_view.UIScrollView; 8 | 9 | /** 10 | * UIScrollView的代理对象适配器 11 | * Created by LiuRi on 2017/1/9. 12 | */ 13 | 14 | public abstract class UIScrollViewDelegateAdapter implements UIScrollViewDelegate { 15 | 16 | @Override 17 | public void scrollViewDidScroll(UIScrollView scrollView) { 18 | 19 | } 20 | 21 | @Override 22 | public void scrollViewWillBeginDragging(UIScrollView scrollView) { 23 | 24 | } 25 | 26 | @Override 27 | public void scrollViewWillEndDragging(UIScrollView scrollView, CGPoint velocity, CGPoint targetContentOffset) { 28 | 29 | } 30 | 31 | @Override 32 | public void scrollViewDidEndDragging(UIScrollView scrollView, boolean decelerate) { 33 | 34 | } 35 | 36 | @Override 37 | public void scrollViewWillBeginDecelerating(UIScrollView scrollView) { 38 | 39 | } 40 | 41 | @Override 42 | public void scrollViewDidEndDecelerating(UIScrollView scrollView) { 43 | 44 | } 45 | 46 | @Override 47 | public void scrollViewDidEndScrollingAnimation(UIScrollView scrollView) { 48 | 49 | } 50 | 51 | @Override 52 | public void scrollViewDidEndZooming(UIScrollView scrollView, View view, float scale) { 53 | 54 | } 55 | 56 | @Override 57 | public boolean scrollViewShouldScrollToTop(UIScrollView scrollView) { 58 | return false; 59 | } 60 | 61 | @Override 62 | public void scrollViewDidScrollToTop(UIScrollView scrollView) { 63 | 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/ui_kit/delegate/UIApplicationDelegate.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonsuperkit.ui_kit.delegate; 2 | 3 | /** 4 | * LemonKit - UIKit 应用程序代理 5 | * 当您使用UIKit中的控件作为自己控件的时候,建议您使用此代理,否则该代理可能无法给您带来什么 6 | *

7 | * Created by LiuRi on 2017/1/10. 8 | */ 9 | 10 | public class UIApplicationDelegate { 11 | 12 | 13 | } 14 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/ui_kit/delegate/UIScrollViewDelegate.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonsuperkit.ui_kit.delegate; 2 | 3 | import android.view.View; 4 | 5 | import net.lemonsoft.lemonsuperkit.core.graphics.CGPoint; 6 | import net.lemonsoft.lemonsuperkit.ui_kit.ui_responder.ui_view.UIScrollView; 7 | 8 | /** 9 | * Created by LiuRi on 2017/1/5. 10 | */ 11 | 12 | public interface UIScrollViewDelegate { 13 | 14 | /** 15 | * 只要ScrollView的内容偏移被改变,就会被回调 16 | */ 17 | void scrollViewDidScroll(UIScrollView scrollView); 18 | 19 | // TODO 20 | /** 21 | * 只要ScrollView在被缩放的时候就会被回调(iOS>=3.2时候可用) 22 | */ 23 | // void scrollViewDidZoom(UIScrollView scrollView); 24 | 25 | /** 26 | * 手指触摸ScrollView将要滑动时候被回调 27 | */ 28 | void scrollViewWillBeginDragging(UIScrollView scrollView); 29 | 30 | /** 31 | * 手指即将停止触摸的时候被回调 32 | * 33 | * @param velocity 当前scrollView滚动的速度 34 | * @param targetContentOffset 照此速度移动的话的最终点 35 | */ 36 | void scrollViewWillEndDragging(UIScrollView scrollView, CGPoint velocity, CGPoint targetContentOffset); 37 | 38 | /** 39 | * 当手指离开ScrollView时回调该方法 40 | * 41 | * @param decelerate 是否继续移动,如果继续移动,那么为true 42 | */ 43 | void scrollViewDidEndDragging(UIScrollView scrollView, boolean decelerate); 44 | 45 | /** 46 | * 当手指离开ScrollView,滚动开始减速的时候调用 47 | */ 48 | void scrollViewWillBeginDecelerating(UIScrollView scrollView); 49 | 50 | /** 51 | * 当手指离开ScrollView,滚动减速到停止后调用 52 | */ 53 | void scrollViewDidEndDecelerating(UIScrollView scrollView); 54 | 55 | /** 56 | * 当ScrollView执行完动画之后被调用,通常指的是执行下面两个函数后被调用 57 | * setContentOffset() 58 | * scrollRectToVisible() 59 | */ 60 | void scrollViewDidEndScrollingAnimation(UIScrollView scrollView); 61 | 62 | // TODO 63 | 64 | /** 65 | * 设置要缩放的 scrollView 上面的哪一个子视图 , 只能是子视图 , 不能是ScrollView 本身 66 | * 67 | * @return 要缩放的子视图 68 | */ 69 | // View viewForZoomingInScrollView(UIScrollView scrollView); 70 | 71 | // TODO 72 | /** 73 | * 当开始缩放的时候被回调 74 | * 75 | * @param view 要缩放的子视图 76 | */ 77 | // void scrollViewWillBeginZooming(UIScrollView scrollView, View view); 78 | 79 | /** 80 | * 当已经缩放的时候回调该方法,缩放在预设最小值和最大值中间的时候才可用(在回弹动画之后被调用) 81 | * 82 | * @param view 缩放的子视图 83 | * @param scale 缩放的比例 84 | */ 85 | void scrollViewDidEndZooming(UIScrollView scrollView, View view, float scale); 86 | 87 | /** 88 | * 当要滚到视图顶部的时候回调此函数询问用户是否能回到顶部,该方法当设置scrollsToTop=true的时候才会回调 89 | * 90 | * @return 是否允许回到顶部的布尔值 91 | */ 92 | boolean scrollViewShouldScrollToTop(UIScrollView scrollView); 93 | 94 | /** 95 | * 当已经滚动到顶部之后回调的函数(动画执行完毕) 96 | */ 97 | void scrollViewDidScrollToTop(UIScrollView scrollView); 98 | 99 | } 100 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/ui_kit/enums/LKTextAlignment.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonsuperkit.ui_kit.enums; 2 | 3 | /** 4 | * LemonKit - 文本对齐方式 5 | * Created by LiuRi on 2017/1/4. 6 | */ 7 | 8 | public enum LKTextAlignment { 9 | 10 | LEFT(0), 11 | CENTER(1), 12 | RIGHT(2), 13 | JUSTIFIED(3); 14 | 15 | private int code; 16 | 17 | LKTextAlignment(int code) { 18 | this.code = code; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/ui_kit/ui_responder/ui_view/UINavigationBar.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonsuperkit.ui_kit.ui_responder.ui_view; 2 | 3 | /** 4 | * LemonKit - 导航栏控件 5 | * Created by lemonsoft on 2017/1/1. 6 | */ 7 | 8 | public class UINavigationBar extends UIView { 9 | } 10 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/ui_kit/ui_responder/ui_view/UIScrollView.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonsuperkit.ui_kit.ui_responder.ui_view; 2 | 3 | import android.widget.RelativeLayout; 4 | 5 | import net.lemonsoft.lemonsuperkit.ui_kit.delegate.UIScrollViewDelegate; 6 | import net.lemonsoft.lemonsuperkit.core.graphics.CGPoint; 7 | import net.lemonsoft.lemonsuperkit.core.graphics.CGRect; 8 | import net.lemonsoft.lemonsuperkit.core.graphics.CGSize; 9 | import net.lemonsoft.lemonsuperkit.native_ui.extend.delegate.LKScrollViewDelegate; 10 | import net.lemonsoft.lemonsuperkit.native_ui.extend.view.LKScrollView; 11 | 12 | /** 13 | * UIScrollView 对 LKScrollView的封装 14 | * 让其和iOS的使用更相近,所有的单位都换成DP 15 | * Created by LiuRi on 2017/1/5. 16 | */ 17 | 18 | public class UIScrollView extends UIView implements LKScrollViewDelegate { 19 | 20 | private UIScrollViewDelegate delegate; 21 | 22 | public UIScrollView() { 23 | super(LKScrollView.class); 24 | } 25 | 26 | public UIScrollView(CGRect frame) { 27 | super(LKScrollView.class, frame); 28 | } 29 | 30 | /** 31 | * 动画滚动到指定的水平位置 32 | * 33 | * @param x 水平位置x坐标 34 | */ 35 | public void scrollToX(float x, boolean animated) { 36 | _gRV().scrollToX(_ST.DP(x), animated); 37 | } 38 | 39 | /** 40 | * 动画滚动到指定的纵坐标 41 | * 42 | * @param y 垂直位置y坐标 43 | */ 44 | public void scrollToY(float y, boolean animated) { 45 | _gRV().scrollToY(_ST.DP(y), animated); 46 | } 47 | 48 | /** 49 | * 滚动到指定的位置 50 | * 51 | * @param point 位置信息 52 | */ 53 | public void scrollTo(CGPoint point, boolean animated) { 54 | point.x = _ST.DP(point.x); 55 | point.y = _ST.DP(point.y); 56 | _gRV().scrollTo(point, animated); 57 | } 58 | 59 | public CGPoint getContentOffset() { 60 | return new CGPoint(_ST.pxToDp(_gRV().getContentOffset().x), 61 | _ST.pxToDp(_gRV().getContentOffset().y)); 62 | } 63 | 64 | /** 65 | * 设置内容偏移位置信息 66 | * 67 | * @param point 偏移到的点的位置 68 | * @param animated 是否使用动画 69 | */ 70 | public void setContentOffset(CGPoint point, boolean animated) { 71 | scrollTo(point, animated); 72 | } 73 | 74 | /** 75 | * 无动画直接定位到指定偏移坐标 76 | * 77 | * @param point 要偏移到的点 78 | */ 79 | public void setContentOffset(CGPoint point) { 80 | setContentOffset(point, false); 81 | } 82 | 83 | public CGSize getContentSize() { 84 | return CGSize.make(_ST.pxToDp(_gRV().getContentSize().width), _ST.pxToDp(_gRV().getContentSize().height)); 85 | } 86 | 87 | public void setContentSize(CGSize contentSize) { 88 | contentSize.width = _ST.DP(contentSize.width); 89 | contentSize.height = _ST.DP(contentSize.height); 90 | _gRV().setContentSize(contentSize); 91 | } 92 | 93 | public boolean isBounces() { 94 | return _gRV().isBounces(); 95 | } 96 | 97 | public void setBounces(boolean bounces) { 98 | _gRV().setBounces(bounces); 99 | } 100 | 101 | public UIScrollViewDelegate getDelegate() { 102 | return delegate; 103 | } 104 | 105 | public void setDelegate(UIScrollViewDelegate delegate) { 106 | this.delegate = delegate; 107 | _gRV().setDelegate(this); 108 | } 109 | 110 | public void addSubView(UIView view) { 111 | _gRV().addView(view); 112 | view.setLayoutParams(new RelativeLayout.LayoutParams(_ST.DP(view.frame.size.width), _ST.DP(view.frame.size.height))); 113 | } 114 | 115 | // 中转调用LKScrollViewDelegate 116 | 117 | 118 | @Override 119 | public void scrollViewDidScroll(LKScrollView scrollView) { 120 | if (delegate != null) 121 | delegate.scrollViewDidScroll(this); 122 | } 123 | 124 | @Override 125 | public void scrollViewWillBeginDragging(LKScrollView scrollView) { 126 | if (delegate != null) 127 | delegate.scrollViewWillBeginDecelerating(this); 128 | } 129 | 130 | @Override 131 | public void scrollViewWillEndDragging(LKScrollView scrollView, CGPoint velocity, CGPoint targetContentOffset) { 132 | if (delegate != null) 133 | delegate.scrollViewWillEndDragging(this, 134 | new CGPoint(_ST.pxToDp(velocity.x), _ST.pxToDp(velocity.y)), 135 | new CGPoint(_ST.pxToDp(targetContentOffset.x), _ST.pxToDp(targetContentOffset.y))); 136 | } 137 | 138 | @Override 139 | public void scrollViewDidEndDragging(LKScrollView scrollView, boolean decelerate) { 140 | if (delegate != null) 141 | delegate.scrollViewDidEndDragging(this, decelerate); 142 | } 143 | 144 | @Override 145 | public void scrollViewWillBeginDecelerating(LKScrollView scrollView) { 146 | if (delegate != null) 147 | delegate.scrollViewWillBeginDecelerating(this); 148 | } 149 | 150 | @Override 151 | public void scrollViewDidEndDecelerating(LKScrollView scrollView) { 152 | if (delegate != null) 153 | delegate.scrollViewDidEndDecelerating(this); 154 | } 155 | 156 | @Override 157 | public void scrollViewDidEndScrollingAnimation(LKScrollView scrollView) { 158 | if (delegate != null) 159 | delegate.scrollViewDidEndScrollingAnimation(this); 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/ui_kit/ui_responder/ui_view/UIView.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonsuperkit.ui_kit.ui_responder.ui_view; 2 | 3 | import android.content.Context; 4 | import android.graphics.Canvas; 5 | import android.view.View; 6 | import android.widget.RelativeLayout; 7 | 8 | import net.lemonsoft.lemonsuperkit.core_animation.CALayer; 9 | import net.lemonsoft.lemonsuperkit.core.base.LemonKit; 10 | import net.lemonsoft.lemonsuperkit.core.graphics.CGRect; 11 | import net.lemonsoft.lemonsuperkit.core.graphics.CGSize; 12 | import net.lemonsoft.lemonsuperkit.native_ui.tools.LKSizeTool; 13 | import net.lemonsoft.lemonsuperkit.native_ui.tools.LKViewAppearanceTool; 14 | import net.lemonsoft.lemonsuperkit.ui_kit.UIColor; 15 | 16 | import java.lang.reflect.Constructor; 17 | 18 | /** 19 | * 视图控件,LemonKit中所有视图控件的父类 20 | * Created by LiuRi on 2016/12/28. 21 | */ 22 | 23 | public class UIView extends RelativeLayout { 24 | 25 | /** 26 | * LemonKit核心对象 27 | */ 28 | protected LemonKit _LK = LemonKit.instance(); 29 | /** 30 | * 尺寸控件类 31 | */ 32 | protected LKSizeTool _ST = LKSizeTool.getDefaultSizeTool(); 33 | 34 | protected LKViewAppearanceTool _VAT = LKViewAppearanceTool.getDefaultViewAppearanceTool(); 35 | /** 36 | * 控件的矩形信息 37 | */ 38 | protected CGRect frame = new CGRect(0f, 0f, 0f, 0f); 39 | /** 40 | * 超过应显示区域的部分截断 41 | */ 42 | private boolean clipsToBounds = false; 43 | /** 44 | * 实际的内容控件 45 | */ 46 | protected View _rView; 47 | /** 48 | * 高级视图操作属性 49 | */ 50 | public CALayer layer = new CALayer(this); 51 | /** 52 | * 父层控件 53 | */ 54 | private UIView _superView; 55 | 56 | public UIView() { 57 | super(LemonKit.instance().getAppContext()); 58 | commonInit();// 调用公共初始化方法 59 | } 60 | 61 | /** 62 | * 通过初始化frame来构造对象 63 | * 64 | * @param frame 控件外观矩形信息描述对象 65 | */ 66 | public UIView(CGRect frame) { 67 | this(); 68 | this.frame = frame; 69 | } 70 | 71 | /** 72 | * 子类通过此构造方法把基础的AndroidView控件封装成LemonKit的UIView子控件 73 | * 74 | * @param viewClass androidView控件 75 | */ 76 | protected UIView(Class viewClass) { 77 | this(); 78 | try { 79 | Constructor constructor = viewClass.getConstructor(Context.class); 80 | this._rView = constructor.newInstance(getContext()); 81 | this.addView(_rView); 82 | } catch (Exception e) { 83 | e.printStackTrace(); 84 | } 85 | } 86 | 87 | /** 88 | * 子类通过此构造方法把基础的AndroidView控件封装成LemonKit的UIView子控件,并直接设置frame 89 | * 90 | * @param viewClass androidView控件 91 | * @param frame 控件的矩形信息 92 | */ 93 | protected UIView(Class viewClass, CGRect frame) { 94 | this(viewClass); 95 | setFrame(frame); 96 | } 97 | 98 | /** 99 | * 获取实际显示的控件 100 | * 101 | * @return 实际显示的控件View对象 102 | */ 103 | public View get_rView() { 104 | return _rView; 105 | } 106 | 107 | /** 108 | * 初始化,所有的构造方法都要调用此函数 109 | */ 110 | private void commonInit() { 111 | setBackgroundColor(new UIColor(0, 1, 1, 1)); 112 | } 113 | 114 | /** 115 | * 获取真实显示内容的控件,getRealView 116 | * 117 | * @return 真实显示内容的视图对象 118 | */ 119 | protected T _gRV() { 120 | return (T) _rView; 121 | } 122 | 123 | /** 124 | * 获取当前视图的矩形信息 125 | * 126 | * @return 矩形信息 127 | */ 128 | public CGRect getFrame() { 129 | return frame; 130 | } 131 | 132 | /** 133 | * 设置控件的X坐标,单位DP 134 | * 135 | * @param x 横坐标X,单位DP 136 | */ 137 | @Override 138 | public void setX(float x) { 139 | super.setX(_ST.DP(x)); 140 | this.frame.origin.x = x; 141 | refresh(); 142 | } 143 | 144 | /** 145 | * 设置控件的Y坐标,单位DP 146 | * 147 | * @param y 纵坐标Y,单位DP 148 | */ 149 | @Override 150 | public void setY(float y) { 151 | super.setY(_ST.DP(y)); 152 | this.frame.origin.y = y; 153 | refresh(); 154 | } 155 | 156 | /** 157 | * 设置控件的宽,单位DP 158 | * 159 | * @param width 控件的宽度,单位DP 160 | */ 161 | public void setWidth(float width) { 162 | this.frame.size.width = width; 163 | _VAT.setWidth(this, width); 164 | refresh(); 165 | } 166 | 167 | /** 168 | * 设置控件的高,单位DP 169 | * 170 | * @param height 控件的高度,单位DP 171 | */ 172 | public void setHeight(float height) { 173 | this.frame.size.height = height; 174 | _VAT.setHeight(this, height); 175 | refresh(); 176 | } 177 | 178 | /** 179 | * 设置控件的尺寸 180 | * 181 | * @param width 要设置的控件的宽 182 | * @param height 要设置的控件的高 183 | */ 184 | public void setSize(float width, float height) { 185 | this.frame.size.width = width; 186 | _VAT.setWidth(this, width); 187 | this.frame.size.height = height; 188 | _VAT.setHeight(this, height); 189 | refresh(); 190 | } 191 | 192 | @Override 193 | protected void onDraw(Canvas canvas) { 194 | super.onDraw(canvas); 195 | layer.onDraw(canvas); 196 | } 197 | 198 | /** 199 | * 设置控件的尺寸 200 | * 201 | * @param size 要设置的控件的尺寸描述对象 202 | */ 203 | public void setSize(CGSize size) { 204 | setSize(size.width, size.height); 205 | } 206 | 207 | /** 208 | * 设置控件的矩形信息 209 | * 210 | * @param frame 控件的举行信息 211 | */ 212 | public void setFrame(CGRect frame) { 213 | this.frame = frame; 214 | super.setX(_ST.DP(frame.origin.x)); 215 | super.setY(_ST.DP(frame.origin.y)); 216 | 217 | _VAT.setWidth(this, frame.size.width); 218 | _VAT.setHeight(this, frame.size.height); 219 | refresh(); 220 | } 221 | 222 | /** 223 | * 设置控件的尺寸,单位DP 224 | * 225 | * @param width 控件的宽度,单位DP 226 | * @param height 控件的高度,单位DP 227 | */ 228 | public void setSize(int width, int height) { 229 | _VAT.setSize(this, width, height); 230 | } 231 | 232 | /** 233 | * 设置背景颜色 234 | * 235 | * @param color LemonKit背景颜色对象 236 | */ 237 | public void setBackgroundColor(UIColor color) { 238 | this.layer.setBackgroundColor(color); 239 | } 240 | 241 | /** 242 | * 获取控件的背景颜色对象 243 | * 244 | * @return UIColor颜色描述对象 245 | */ 246 | public UIColor getBackgroundColor() { 247 | return this.layer.getBackgroundColor(); 248 | } 249 | 250 | /** 251 | * 刷新布局 252 | */ 253 | protected void refresh() { 254 | if (_rView != null) { 255 | _VAT.setOrigin(_rView, 0, 0);// 始终在左上角 256 | _VAT.setSize(_rView, this.frame.size);// 设置实际控件和容器控件的尺寸一致 257 | } 258 | } 259 | 260 | public void addSubView(UIView view) { 261 | this.addView(view); 262 | } 263 | 264 | // 无特殊要求的getter 、setter方法开始..... 265 | public UIView get_superView() { 266 | return _superView; 267 | } 268 | 269 | public void set_superView(UIView _superView) { 270 | this._superView = _superView; 271 | } 272 | 273 | public boolean isClipsToBounds() { 274 | return clipsToBounds; 275 | } 276 | 277 | public void setClipsToBounds(boolean clipsToBounds) { 278 | this.clipsToBounds = clipsToBounds; 279 | this.layer.setMasksToBounds(clipsToBounds); 280 | } 281 | 282 | // ......无特殊要求的getter 、setter方法结束 283 | } 284 | -------------------------------------------------------------------------------- /LemonSuperKit/lemonsuperkit/src/main/java/net/lemonsoft/lemonsuperkit/ui_kit/ui_responder/ui_view/ui_control/UIButton.java: -------------------------------------------------------------------------------- 1 | package net.lemonsoft.lemonsuperkit.ui_kit.ui_responder.ui_view.ui_control; 2 | 3 | import android.widget.Button; 4 | 5 | import net.lemonsoft.lemonsuperkit.core.graphics.CGRect; 6 | 7 | /** 8 | * 按钮控件 9 | * Created by LiuRi on 2016/12/28. 10 | */ 11 | 12 | public class UIButton extends UIControl