mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
migrated widgets project so it has nothing unnecessary
project can now be build with android studio or by running the command gradlew build
This commit is contained in:
40
android/widgets/.gitignore
vendored
40
android/widgets/.gitignore
vendored
@@ -1,41 +1 @@
|
||||
/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/
|
||||
@@ -7,67 +7,66 @@ def isWinOs = System.properties['os.name'].toLowerCase().contains('windows')
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
def computeCompuleSdkVersion () {
|
||||
if(project.hasProperty("compileSdk")) {
|
||||
return compileSdk
|
||||
}
|
||||
else {
|
||||
return 23
|
||||
}
|
||||
if(project.hasProperty("compileSdk")) {
|
||||
return compileSdk
|
||||
}
|
||||
else {
|
||||
return 23
|
||||
}
|
||||
}
|
||||
|
||||
def computeBuildToolsVersion() {
|
||||
if(project.hasProperty("buildToolsVersion")) {
|
||||
return buildToolsVersion
|
||||
}
|
||||
else {
|
||||
return "22.0.1"
|
||||
}
|
||||
if(project.hasProperty("buildToolsVersion")) {
|
||||
return buildToolsVersion
|
||||
}
|
||||
else {
|
||||
return "22.0.1"
|
||||
}
|
||||
}
|
||||
|
||||
def computeTargetSdkVersion() {
|
||||
if(project.hasProperty("targetSdk")) {
|
||||
return targetSdk
|
||||
}
|
||||
else {
|
||||
return 23
|
||||
}
|
||||
if(project.hasProperty("targetSdk")) {
|
||||
return targetSdk
|
||||
}
|
||||
else {
|
||||
return 23
|
||||
}
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion computeCompuleSdkVersion()
|
||||
buildToolsVersion computeBuildToolsVersion()
|
||||
compileSdkVersion computeCompuleSdkVersion()
|
||||
buildToolsVersion computeBuildToolsVersion()
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 17
|
||||
targetSdkVersion computeTargetSdkVersion()
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
defaultConfig {
|
||||
minSdkVersion 17
|
||||
targetSdkVersion computeTargetSdkVersion()
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile fileTree(include: ['*.jar'], dir: 'libs')
|
||||
testCompile 'junit:junit:4.12'
|
||||
compile 'com.android.support:support-v4:+'
|
||||
compile fileTree(include: ['*.jar'], dir: 'libs')
|
||||
compile 'com.android.support:support-v4:+'
|
||||
}
|
||||
|
||||
task cleanBuildDir (type: Delete) {
|
||||
delete "../build/"
|
||||
delete "../build/"
|
||||
}
|
||||
|
||||
task copyAar << {
|
||||
copy {
|
||||
from "build/outputs/aar/widgets-release.aar"
|
||||
into "../build/"
|
||||
}
|
||||
copy {
|
||||
from "build/outputs/aar/widgets-release.aar"
|
||||
into "../build/"
|
||||
}
|
||||
}
|
||||
|
||||
assembleRelease.dependsOn(cleanBuildDir)
|
||||
copyAar.dependsOn(assembleRelease)
|
||||
build.dependsOn(copyAar)
|
||||
build.dependsOn(copyAar)
|
||||
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
|
||||
180
android/widgets/gradlew.bat
vendored
180
android/widgets/gradlew.bat
vendored
@@ -1,90 +1,90 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
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
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windowz variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
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
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windowz variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
|
||||
2
android/widgets/proguard-rules.pro
vendored
2
android/widgets/proguard-rules.pro
vendored
@@ -1,6 +1,6 @@
|
||||
# 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
|
||||
# in /home/plamen5kov/tools/android-sdk-linux/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the proguardFiles
|
||||
# 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);
|
||||
}
|
||||
}
|
||||
@@ -6,4 +6,4 @@
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
</manifest>
|
||||
@@ -88,7 +88,7 @@ public class Async
|
||||
OutputStream outStream = connection.getOutputStream();
|
||||
openedStreams.push(outStream);
|
||||
|
||||
OutputStreamWriter writer = new java.io.OutputStreamWriter(outStream);
|
||||
OutputStreamWriter writer = new OutputStreamWriter(outStream);
|
||||
openedStreams.push(writer);
|
||||
|
||||
writer.write((String) this.content);
|
||||
@@ -97,7 +97,7 @@ public class Async
|
||||
|
||||
public static class RequestResult
|
||||
{
|
||||
public static final class ByteArrayOutputStream2 extends java.io.ByteArrayOutputStream
|
||||
public static final class ByteArrayOutputStream2 extends ByteArrayOutputStream
|
||||
{
|
||||
public ByteArrayOutputStream2()
|
||||
{
|
||||
@@ -171,7 +171,7 @@ public class Async
|
||||
|
||||
openedStreams.push(inStream);
|
||||
|
||||
BufferedInputStream buffer = new java.io.BufferedInputStream(inStream, 4096);
|
||||
BufferedInputStream buffer = new BufferedInputStream(inStream, 4096);
|
||||
openedStreams.push(buffer);
|
||||
|
||||
ByteArrayOutputStream2 responseStream = contentLength != -1 ? new ByteArrayOutputStream2(contentLength) : new ByteArrayOutputStream2();
|
||||
@@ -363,7 +363,7 @@ public class Async
|
||||
InputStream stream = null;
|
||||
try
|
||||
{
|
||||
stream = new java.net.URL(params[0]).openStream();
|
||||
stream = new URL(params[0]).openStream();
|
||||
Bitmap bmp = BitmapFactory.decodeStream(stream);
|
||||
return bmp;
|
||||
}
|
||||
|
||||
@@ -159,9 +159,9 @@ public class BorderDrawable extends ColorDrawable {
|
||||
if (supportsPathOp) {
|
||||
// Path.Op can be used in API level 19+ to achieve the perfect geometry.
|
||||
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();
|
||||
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);
|
||||
canvas.drawPath(backgroundPath, backgroundImagePaint);
|
||||
} else {
|
||||
@@ -182,26 +182,26 @@ public class BorderDrawable extends ColorDrawable {
|
||||
borderPaint.setAntiAlias(true);
|
||||
|
||||
if (this.clipPath != null && !this.clipPath.isEmpty()) {
|
||||
borderPaint.setStyle(android.graphics.Paint.Style.STROKE);
|
||||
borderPaint.setStyle(Paint.Style.STROKE);
|
||||
borderPaint.setStrokeWidth(borderWidth);
|
||||
drawClipPath(this.clipPath, canvas, borderPaint, backgroundBoundsF, density);
|
||||
} else {
|
||||
if (outerRadius <= 0) {
|
||||
borderPaint.setStyle(android.graphics.Paint.Style.STROKE);
|
||||
borderPaint.setStyle(Paint.Style.STROKE);
|
||||
borderPaint.setStrokeWidth(borderWidth);
|
||||
canvas.drawRect(middleBoundsF, borderPaint);
|
||||
} else if (outerRadius >= borderWidth) {
|
||||
borderPaint.setStyle(android.graphics.Paint.Style.STROKE);
|
||||
borderPaint.setStyle(Paint.Style.STROKE);
|
||||
borderPaint.setStrokeWidth(borderWidth);
|
||||
float middleRadius = Math.max(0, outerRadius - halfBorderWidth);
|
||||
canvas.drawRoundRect(middleBoundsF, middleRadius, middleRadius, borderPaint);
|
||||
} else {
|
||||
Path borderPath = new Path();
|
||||
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);
|
||||
borderPath.addRect(borderInnerBoundsF, android.graphics.Path.Direction.CW);
|
||||
borderPaint.setStyle(android.graphics.Paint.Style.FILL);
|
||||
borderPath.addRect(borderInnerBoundsF, Path.Direction.CW);
|
||||
borderPaint.setStyle(Paint.Style.FILL);
|
||||
canvas.drawPath(borderPath, borderPaint);
|
||||
}
|
||||
}
|
||||
@@ -247,7 +247,7 @@ public class BorderDrawable extends ColorDrawable {
|
||||
top = cY - rY;
|
||||
right = (rX * 2) + left;
|
||||
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;
|
||||
case "polygon":
|
||||
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