mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Merge pull request #40 from NativeScript/plamen5kov/standalone_widgets_project
migrated widgets project so it has nothing unnecessary
This commit is contained in:
8
android/.gitignore
vendored
Normal file
8
android/.gitignore
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
*.iml
|
||||||
|
.gradle
|
||||||
|
/local.properties
|
||||||
|
/.idea/workspace.xml
|
||||||
|
/.idea/libraries
|
||||||
|
.DS_Store
|
||||||
|
/build
|
||||||
|
/captures
|
||||||
1
android/app/.gitignore
vendored
1
android/app/.gitignore
vendored
@@ -1 +0,0 @@
|
|||||||
/build
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
apply plugin: 'com.android.application'
|
|
||||||
|
|
||||||
android {
|
|
||||||
compileSdkVersion 23
|
|
||||||
buildToolsVersion "23.0.2"
|
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
applicationId "org.nativescript.android_widgets_app"
|
|
||||||
minSdkVersion 17
|
|
||||||
targetSdkVersion 23
|
|
||||||
versionCode 1
|
|
||||||
versionName "1.0"
|
|
||||||
}
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
minifyEnabled false
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
|
||||||
testCompile 'junit:junit:4.12'
|
|
||||||
compile 'com.android.support:appcompat-v7:23.1.1'
|
|
||||||
}
|
|
||||||
17
android/app/proguard-rules.pro
vendored
17
android/app/proguard-rules.pro
vendored
@@ -1,17 +0,0 @@
|
|||||||
# Add project specific ProGuard rules here.
|
|
||||||
# By default, the flags in this file are appended to flags specified
|
|
||||||
# in d:\Android\sdk/tools/proguard/proguard-android.txt
|
|
||||||
# You can edit the include path and order by changing the proguardFiles
|
|
||||||
# directive in build.gradle.
|
|
||||||
#
|
|
||||||
# For more details, see
|
|
||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
||||||
|
|
||||||
# Add any project specific keep options here:
|
|
||||||
|
|
||||||
# If your project uses WebView with JS, uncomment the following
|
|
||||||
# and specify the fully qualified class name to the JavaScript interface
|
|
||||||
# class:
|
|
||||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
|
||||||
# public *;
|
|
||||||
#}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package org.nativescript.android_widgets_app;
|
|
||||||
|
|
||||||
import android.app.Application;
|
|
||||||
import android.test.ApplicationTestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
|
|
||||||
*/
|
|
||||||
public class ApplicationTest extends ApplicationTestCase<Application> {
|
|
||||||
public ApplicationTest() {
|
|
||||||
super(Application.class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
package="org.nativescript.android_widgets_app">
|
|
||||||
|
|
||||||
<application
|
|
||||||
android:allowBackup="true"
|
|
||||||
android:icon="@mipmap/ic_launcher"
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:supportsRtl="true"
|
|
||||||
android:theme="@style/AppTheme">
|
|
||||||
|
|
||||||
</application>
|
|
||||||
|
|
||||||
</manifest>
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.3 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 4.7 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 7.5 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 10 KiB |
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<color name="colorPrimary">#3F51B5</color>
|
|
||||||
<color name="colorPrimaryDark">#303F9F</color>
|
|
||||||
<color name="colorAccent">#FF4081</color>
|
|
||||||
</resources>
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
<resources>
|
|
||||||
<string name="app_name">android-widgets-app</string>
|
|
||||||
</resources>
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<resources>
|
|
||||||
|
|
||||||
<!-- Base application theme. -->
|
|
||||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
|
||||||
<!-- Customize your theme here. -->
|
|
||||||
<item name="colorPrimary">@color/colorPrimary</item>
|
|
||||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
|
||||||
<item name="colorAccent">@color/colorAccent</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</resources>
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
package org.nativescript.android_widgets_app;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* To work on unit tests, switch the Test Artifact in the Build Variants view.
|
|
||||||
*/
|
|
||||||
public class ExampleUnitTest {
|
|
||||||
@Test
|
|
||||||
public void addition_isCorrect() throws Exception {
|
|
||||||
assertEquals(4, 2 + 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -5,8 +5,7 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
// classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
|
classpath 'com.android.tools.build:gradle:2.1.2'
|
||||||
classpath 'com.android.tools.build:gradle:1.5.0'
|
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
|||||||
BIN
android/gradle/wrapper/gradle-wrapper.jar
vendored
BIN
android/gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
@@ -1,6 +1,6 @@
|
|||||||
#Wed Jun 29 19:27:15 EEST 2016
|
#Mon Dec 28 10:00:20 PST 2015
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
|
||||||
|
|||||||
46
android/gradlew
vendored
46
android/gradlew
vendored
@@ -6,30 +6,12 @@
|
|||||||
##
|
##
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
# Resolve links: $0 may be a link
|
DEFAULT_JVM_OPTS=""
|
||||||
PRG="$0"
|
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
|
||||||
ls=`ls -ld "$PRG"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
PRG="$link"
|
|
||||||
else
|
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >/dev/null
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
APP_NAME="Gradle"
|
||||||
APP_BASE_NAME=`basename "$0"`
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
||||||
DEFAULT_JVM_OPTS=""
|
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD="maximum"
|
MAX_FD="maximum"
|
||||||
|
|
||||||
@@ -48,7 +30,6 @@ die ( ) {
|
|||||||
cygwin=false
|
cygwin=false
|
||||||
msys=false
|
msys=false
|
||||||
darwin=false
|
darwin=false
|
||||||
nonstop=false
|
|
||||||
case "`uname`" in
|
case "`uname`" in
|
||||||
CYGWIN* )
|
CYGWIN* )
|
||||||
cygwin=true
|
cygwin=true
|
||||||
@@ -59,11 +40,26 @@ case "`uname`" in
|
|||||||
MINGW* )
|
MINGW* )
|
||||||
msys=true
|
msys=true
|
||||||
;;
|
;;
|
||||||
NONSTOP* )
|
|
||||||
nonstop=true
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
@@ -89,7 +85,7 @@ location of your Java installation."
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
if [ $? -eq 0 ] ; then
|
if [ $? -eq 0 ] ; then
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
|||||||
8
android/gradlew.bat
vendored
Executable file → Normal file
8
android/gradlew.bat
vendored
Executable file → Normal file
@@ -8,14 +8,14 @@
|
|||||||
@rem Set local scope for the variables with windows NT shell
|
@rem Set local scope for the variables with windows NT shell
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS=
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
||||||
set DEFAULT_JVM_OPTS=
|
|
||||||
|
|
||||||
@rem Find java.exe
|
@rem Find java.exe
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ echo location of your Java installation.
|
|||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
:init
|
:init
|
||||||
@rem Get command-line arguments, handling Windows variants
|
@rem Get command-line arguments, handling Windowz variants
|
||||||
|
|
||||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
include ':app', ':widgets'
|
include ':widgets'
|
||||||
|
|||||||
40
android/widgets/.gitignore
vendored
40
android/widgets/.gitignore
vendored
@@ -1,41 +1 @@
|
|||||||
/build
|
/build
|
||||||
/dist
|
|
||||||
|
|
||||||
*.iml
|
|
||||||
|
|
||||||
# Proguard folder generated by Eclipse
|
|
||||||
proguard/
|
|
||||||
|
|
||||||
# Log Files
|
|
||||||
*.log
|
|
||||||
|
|
||||||
# Android Studio Navigation editor temp files
|
|
||||||
.navigation/
|
|
||||||
|
|
||||||
# Android Studio captures folder
|
|
||||||
captures/
|
|
||||||
|
|
||||||
# Built application files
|
|
||||||
/*/build/
|
|
||||||
|
|
||||||
## File-based project format:
|
|
||||||
*.ipr
|
|
||||||
*.iws
|
|
||||||
|
|
||||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
|
||||||
com_crashlytics_export_strings.xml
|
|
||||||
crashlytics.properties
|
|
||||||
crashlytics-build.properties
|
|
||||||
fabric.properties
|
|
||||||
|
|
||||||
## Directory-based project format:
|
|
||||||
.idea/
|
|
||||||
|
|
||||||
# Local configuration file (sdk path, etc)
|
|
||||||
local.properties
|
|
||||||
|
|
||||||
# Gradle generated files
|
|
||||||
.gradle/
|
|
||||||
|
|
||||||
# Signing files
|
|
||||||
.signing/
|
|
||||||
@@ -53,7 +53,6 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile fileTree(include: ['*.jar'], dir: 'libs')
|
compile fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
testCompile 'junit:junit:4.12'
|
|
||||||
compile 'com.android.support:support-v4:+'
|
compile 'com.android.support:support-v4:+'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
BIN
android/widgets/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
android/widgets/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
android/widgets/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
android/widgets/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#Mon Dec 28 10:00:20 PST 2015
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
|
||||||
2
android/widgets/proguard-rules.pro
vendored
2
android/widgets/proguard-rules.pro
vendored
@@ -1,6 +1,6 @@
|
|||||||
# Add project specific ProGuard rules here.
|
# Add project specific ProGuard rules here.
|
||||||
# By default, the flags in this file are appended to flags specified
|
# By default, the flags in this file are appended to flags specified
|
||||||
# in d:\Android\sdk/tools/proguard/proguard-android.txt
|
# in /home/plamen5kov/tools/android-sdk-linux/tools/proguard/proguard-android.txt
|
||||||
# You can edit the include path and order by changing the proguardFiles
|
# You can edit the include path and order by changing the proguardFiles
|
||||||
# directive in build.gradle.
|
# directive in build.gradle.
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
package org.nativescript.widgets;
|
|
||||||
|
|
||||||
import android.app.Application;
|
|
||||||
import android.test.ApplicationTestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
|
|
||||||
*/
|
|
||||||
public class ApplicationTest extends ApplicationTestCase<Application> {
|
|
||||||
public ApplicationTest() {
|
|
||||||
super(Application.class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -88,7 +88,7 @@ public class Async
|
|||||||
OutputStream outStream = connection.getOutputStream();
|
OutputStream outStream = connection.getOutputStream();
|
||||||
openedStreams.push(outStream);
|
openedStreams.push(outStream);
|
||||||
|
|
||||||
OutputStreamWriter writer = new java.io.OutputStreamWriter(outStream);
|
OutputStreamWriter writer = new OutputStreamWriter(outStream);
|
||||||
openedStreams.push(writer);
|
openedStreams.push(writer);
|
||||||
|
|
||||||
writer.write((String) this.content);
|
writer.write((String) this.content);
|
||||||
@@ -97,7 +97,7 @@ public class Async
|
|||||||
|
|
||||||
public static class RequestResult
|
public static class RequestResult
|
||||||
{
|
{
|
||||||
public static final class ByteArrayOutputStream2 extends java.io.ByteArrayOutputStream
|
public static final class ByteArrayOutputStream2 extends ByteArrayOutputStream
|
||||||
{
|
{
|
||||||
public ByteArrayOutputStream2()
|
public ByteArrayOutputStream2()
|
||||||
{
|
{
|
||||||
@@ -171,7 +171,7 @@ public class Async
|
|||||||
|
|
||||||
openedStreams.push(inStream);
|
openedStreams.push(inStream);
|
||||||
|
|
||||||
BufferedInputStream buffer = new java.io.BufferedInputStream(inStream, 4096);
|
BufferedInputStream buffer = new BufferedInputStream(inStream, 4096);
|
||||||
openedStreams.push(buffer);
|
openedStreams.push(buffer);
|
||||||
|
|
||||||
ByteArrayOutputStream2 responseStream = contentLength != -1 ? new ByteArrayOutputStream2(contentLength) : new ByteArrayOutputStream2();
|
ByteArrayOutputStream2 responseStream = contentLength != -1 ? new ByteArrayOutputStream2(contentLength) : new ByteArrayOutputStream2();
|
||||||
@@ -363,7 +363,7 @@ public class Async
|
|||||||
InputStream stream = null;
|
InputStream stream = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
stream = new java.net.URL(params[0]).openStream();
|
stream = new URL(params[0]).openStream();
|
||||||
Bitmap bmp = BitmapFactory.decodeStream(stream);
|
Bitmap bmp = BitmapFactory.decodeStream(stream);
|
||||||
return bmp;
|
return bmp;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,9 +159,9 @@ public class BorderDrawable extends ColorDrawable {
|
|||||||
if (supportsPathOp) {
|
if (supportsPathOp) {
|
||||||
// Path.Op can be used in API level 19+ to achieve the perfect geometry.
|
// Path.Op can be used in API level 19+ to achieve the perfect geometry.
|
||||||
Path backgroundPath = new Path();
|
Path backgroundPath = new Path();
|
||||||
backgroundPath.addRoundRect(backgroundBoundsF, outerRadius, outerRadius, android.graphics.Path.Direction.CCW);
|
backgroundPath.addRoundRect(backgroundBoundsF, outerRadius, outerRadius, Path.Direction.CCW);
|
||||||
Path backgroundNoRepeatPath = new Path();
|
Path backgroundNoRepeatPath = new Path();
|
||||||
backgroundNoRepeatPath.addRect(params.posX, params.posY, params.posX + imageWidth, params.posY + imageHeight, android.graphics.Path.Direction.CCW);
|
backgroundNoRepeatPath.addRect(params.posX, params.posY, params.posX + imageWidth, params.posY + imageHeight, Path.Direction.CCW);
|
||||||
intersect(backgroundPath, backgroundNoRepeatPath);
|
intersect(backgroundPath, backgroundNoRepeatPath);
|
||||||
canvas.drawPath(backgroundPath, backgroundImagePaint);
|
canvas.drawPath(backgroundPath, backgroundImagePaint);
|
||||||
} else {
|
} else {
|
||||||
@@ -182,26 +182,26 @@ public class BorderDrawable extends ColorDrawable {
|
|||||||
borderPaint.setAntiAlias(true);
|
borderPaint.setAntiAlias(true);
|
||||||
|
|
||||||
if (this.clipPath != null && !this.clipPath.isEmpty()) {
|
if (this.clipPath != null && !this.clipPath.isEmpty()) {
|
||||||
borderPaint.setStyle(android.graphics.Paint.Style.STROKE);
|
borderPaint.setStyle(Paint.Style.STROKE);
|
||||||
borderPaint.setStrokeWidth(borderWidth);
|
borderPaint.setStrokeWidth(borderWidth);
|
||||||
drawClipPath(this.clipPath, canvas, borderPaint, backgroundBoundsF, density);
|
drawClipPath(this.clipPath, canvas, borderPaint, backgroundBoundsF, density);
|
||||||
} else {
|
} else {
|
||||||
if (outerRadius <= 0) {
|
if (outerRadius <= 0) {
|
||||||
borderPaint.setStyle(android.graphics.Paint.Style.STROKE);
|
borderPaint.setStyle(Paint.Style.STROKE);
|
||||||
borderPaint.setStrokeWidth(borderWidth);
|
borderPaint.setStrokeWidth(borderWidth);
|
||||||
canvas.drawRect(middleBoundsF, borderPaint);
|
canvas.drawRect(middleBoundsF, borderPaint);
|
||||||
} else if (outerRadius >= borderWidth) {
|
} else if (outerRadius >= borderWidth) {
|
||||||
borderPaint.setStyle(android.graphics.Paint.Style.STROKE);
|
borderPaint.setStyle(Paint.Style.STROKE);
|
||||||
borderPaint.setStrokeWidth(borderWidth);
|
borderPaint.setStrokeWidth(borderWidth);
|
||||||
float middleRadius = Math.max(0, outerRadius - halfBorderWidth);
|
float middleRadius = Math.max(0, outerRadius - halfBorderWidth);
|
||||||
canvas.drawRoundRect(middleBoundsF, middleRadius, middleRadius, borderPaint);
|
canvas.drawRoundRect(middleBoundsF, middleRadius, middleRadius, borderPaint);
|
||||||
} else {
|
} else {
|
||||||
Path borderPath = new Path();
|
Path borderPath = new Path();
|
||||||
RectF borderOuterBoundsF = new RectF(bounds.left, bounds.top, bounds.right, bounds.bottom);
|
RectF borderOuterBoundsF = new RectF(bounds.left, bounds.top, bounds.right, bounds.bottom);
|
||||||
borderPath.addRoundRect(borderOuterBoundsF, outerRadius, outerRadius, android.graphics.Path.Direction.CCW);
|
borderPath.addRoundRect(borderOuterBoundsF, outerRadius, outerRadius, Path.Direction.CCW);
|
||||||
RectF borderInnerBoundsF = new RectF(bounds.left + borderWidth, bounds.top + borderWidth, bounds.right - borderWidth, bounds.bottom - borderWidth);
|
RectF borderInnerBoundsF = new RectF(bounds.left + borderWidth, bounds.top + borderWidth, bounds.right - borderWidth, bounds.bottom - borderWidth);
|
||||||
borderPath.addRect(borderInnerBoundsF, android.graphics.Path.Direction.CW);
|
borderPath.addRect(borderInnerBoundsF, Path.Direction.CW);
|
||||||
borderPaint.setStyle(android.graphics.Paint.Style.FILL);
|
borderPaint.setStyle(Paint.Style.FILL);
|
||||||
canvas.drawPath(borderPath, borderPaint);
|
canvas.drawPath(borderPath, borderPaint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -247,7 +247,7 @@ public class BorderDrawable extends ColorDrawable {
|
|||||||
top = cY - rY;
|
top = cY - rY;
|
||||||
right = (rX * 2) + left;
|
right = (rX * 2) + left;
|
||||||
bottom = (rY * 2) + top;
|
bottom = (rY * 2) + top;
|
||||||
canvas.drawOval(new android.graphics.RectF(left, top, right, bottom), paint);
|
canvas.drawOval(new RectF(left, top, right, bottom), paint);
|
||||||
break;
|
break;
|
||||||
case "polygon":
|
case "polygon":
|
||||||
Path path = new Path();
|
Path path = new Path();
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
package org.nativescript.widgets;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* To work on unit tests, switch the Test Artifact in the Build Variants view.
|
|
||||||
*/
|
|
||||||
public class ExampleUnitTest {
|
|
||||||
@Test
|
|
||||||
public void addition_isCorrect() throws Exception {
|
|
||||||
assertEquals(4, 2 + 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user