diff --git a/.gitignore b/.gitignore index 4e67847..d6b2dd1 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ demo/lib demo/platforms demo/node_modules node_modules +package-lock.json diff --git a/README.md b/README.md index b9ab754..581ceac 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ ![NativeScript image colors](https://raw.githubusercontent.com/TheOriginalJosh/nativescript-image-colors/master/screenshot.png) +This is the version migrated to Nativescript 6 ## Example diff --git a/demo/app/App_Resources/Android/AndroidManifest.xml b/demo/app/App_Resources/Android/src/main/AndroidManifest.xml similarity index 100% rename from demo/app/App_Resources/Android/AndroidManifest.xml rename to demo/app/App_Resources/Android/src/main/AndroidManifest.xml diff --git a/demo/app/App_Resources/Android/drawable-hdpi/background.png b/demo/app/App_Resources/Android/src/main/res/drawable-hdpi/background.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-hdpi/background.png rename to demo/app/App_Resources/Android/src/main/res/drawable-hdpi/background.png diff --git a/demo/app/App_Resources/Android/drawable-hdpi/icon.png b/demo/app/App_Resources/Android/src/main/res/drawable-hdpi/icon.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-hdpi/icon.png rename to demo/app/App_Resources/Android/src/main/res/drawable-hdpi/icon.png diff --git a/demo/app/App_Resources/Android/drawable-hdpi/logo.png b/demo/app/App_Resources/Android/src/main/res/drawable-hdpi/logo.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-hdpi/logo.png rename to demo/app/App_Resources/Android/src/main/res/drawable-hdpi/logo.png diff --git a/demo/app/App_Resources/Android/drawable-ldpi/background.png b/demo/app/App_Resources/Android/src/main/res/drawable-ldpi/background.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-ldpi/background.png rename to demo/app/App_Resources/Android/src/main/res/drawable-ldpi/background.png diff --git a/demo/app/App_Resources/Android/drawable-ldpi/icon.png b/demo/app/App_Resources/Android/src/main/res/drawable-ldpi/icon.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-ldpi/icon.png rename to demo/app/App_Resources/Android/src/main/res/drawable-ldpi/icon.png diff --git a/demo/app/App_Resources/Android/drawable-ldpi/logo.png b/demo/app/App_Resources/Android/src/main/res/drawable-ldpi/logo.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-ldpi/logo.png rename to demo/app/App_Resources/Android/src/main/res/drawable-ldpi/logo.png diff --git a/demo/app/App_Resources/Android/drawable-mdpi/background.png b/demo/app/App_Resources/Android/src/main/res/drawable-mdpi/background.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-mdpi/background.png rename to demo/app/App_Resources/Android/src/main/res/drawable-mdpi/background.png diff --git a/demo/app/App_Resources/Android/drawable-mdpi/icon.png b/demo/app/App_Resources/Android/src/main/res/drawable-mdpi/icon.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-mdpi/icon.png rename to demo/app/App_Resources/Android/src/main/res/drawable-mdpi/icon.png diff --git a/demo/app/App_Resources/Android/drawable-mdpi/logo.png b/demo/app/App_Resources/Android/src/main/res/drawable-mdpi/logo.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-mdpi/logo.png rename to demo/app/App_Resources/Android/src/main/res/drawable-mdpi/logo.png diff --git a/demo/app/App_Resources/Android/drawable-nodpi/splash_screen.xml b/demo/app/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml similarity index 100% rename from demo/app/App_Resources/Android/drawable-nodpi/splash_screen.xml rename to demo/app/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml diff --git a/demo/app/App_Resources/Android/drawable-xhdpi/background.png b/demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/background.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-xhdpi/background.png rename to demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/background.png diff --git a/demo/app/App_Resources/Android/drawable-xhdpi/icon.png b/demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-xhdpi/icon.png rename to demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png diff --git a/demo/app/App_Resources/Android/drawable-xhdpi/logo.png b/demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-xhdpi/logo.png rename to demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png diff --git a/demo/app/App_Resources/Android/drawable-xxhdpi/background.png b/demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-xxhdpi/background.png rename to demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png diff --git a/demo/app/App_Resources/Android/drawable-xxhdpi/icon.png b/demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-xxhdpi/icon.png rename to demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png diff --git a/demo/app/App_Resources/Android/drawable-xxhdpi/logo.png b/demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-xxhdpi/logo.png rename to demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png diff --git a/demo/app/App_Resources/Android/drawable-xxxhdpi/background.png b/demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-xxxhdpi/background.png rename to demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png diff --git a/demo/app/App_Resources/Android/drawable-xxxhdpi/icon.png b/demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-xxxhdpi/icon.png rename to demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png diff --git a/demo/app/App_Resources/Android/drawable-xxxhdpi/logo.png b/demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-xxxhdpi/logo.png rename to demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png diff --git a/demo/app/App_Resources/Android/values-v21/colors.xml b/demo/app/App_Resources/Android/src/main/res/values-v21/colors.xml similarity index 100% rename from demo/app/App_Resources/Android/values-v21/colors.xml rename to demo/app/App_Resources/Android/src/main/res/values-v21/colors.xml diff --git a/demo/app/App_Resources/Android/values-v21/styles.xml b/demo/app/App_Resources/Android/src/main/res/values-v21/styles.xml similarity index 100% rename from demo/app/App_Resources/Android/values-v21/styles.xml rename to demo/app/App_Resources/Android/src/main/res/values-v21/styles.xml diff --git a/demo/app/App_Resources/Android/values/colors.xml b/demo/app/App_Resources/Android/src/main/res/values/colors.xml similarity index 100% rename from demo/app/App_Resources/Android/values/colors.xml rename to demo/app/App_Resources/Android/src/main/res/values/colors.xml diff --git a/demo/app/App_Resources/Android/values/styles.xml b/demo/app/App_Resources/Android/src/main/res/values/styles.xml similarity index 100% rename from demo/app/App_Resources/Android/values/styles.xml rename to demo/app/App_Resources/Android/src/main/res/values/styles.xml diff --git a/demo/app/app.ts b/demo/app/app.ts index e445c16..d7438ca 100644 --- a/demo/app/app.ts +++ b/demo/app/app.ts @@ -7,7 +7,7 @@ purpose of the file is to pass control to the app’s first module. import "./bundle-config"; import * as app from 'application'; -app.start({ moduleName: 'main-page' }); +app._start({ moduleName: 'main-page' }); /* Do not place any code after the application has been started as it will not diff --git a/demo/app/main-page.ts b/demo/app/main-page.ts index 0d0b45c..08b557a 100644 --- a/demo/app/main-page.ts +++ b/demo/app/main-page.ts @@ -52,7 +52,7 @@ export class mainvm extends observable.Observable { break; } - console.log(JSON.stringify(colors.color1)); + console.log(JSON.stringify(colors.color1.hex)); this.tabView.backgroundColor = colors.color1; this.tabView.color = colors.color2; diff --git a/demo/app/package.json b/demo/app/package.json index fea657e..141a194 100644 --- a/demo/app/package.json +++ b/demo/app/package.json @@ -1,8 +1,9 @@ { "android": { - "v8Flags": "--expose_gc" + "v8Flags": "--expose_gc", + "markingMode": "none" }, "main": "app.js", "name": "tns-template-hello-world-ts", - "version": "3.1.1" -} \ No newline at end of file + "version": "3.1.2" +} diff --git a/demo/package.json b/demo/package.json index 495680c..2490771 100644 --- a/demo/package.json +++ b/demo/package.json @@ -6,23 +6,23 @@ "nativescript": { "id": "org.nativescript.demo", "tns-ios": { - "version": "3.1.0" + "version": "6.2.0" }, "tns-android": { - "version": "3.1.1" + "version": "6.2.0" } }, "dependencies": { - "nativescript-image-colors": "file:///Users/JoshSo/Code/NativeScript/nativescript-image-colors", + "nativescript-image-colors": "file:..", "nativescript-theme-core": "~1.0.2", - "tns-core-modules": "~3.1.0" + "tns-core-modules": "~6.2.0" }, "devDependencies": { "babel-traverse": "6.25.0", "babel-types": "6.25.0", "babylon": "6.17.4", "lazy": "1.0.11", - "nativescript-dev-typescript": "~0.5.0", - "typescript": "~2.2.1" + "typescript": "3.4.5", + "nativescript-dev-webpack": "~1.3.0" } } diff --git a/demo/tsconfig.tns.json b/demo/tsconfig.tns.json new file mode 100644 index 0000000..95f2ece --- /dev/null +++ b/demo/tsconfig.tns.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig", + "compilerOptions": { + "module": "es2015", + "moduleResolution": "node" + } +} diff --git a/index.ts b/index.ts index 250e4b9..9844368 100644 --- a/index.ts +++ b/index.ts @@ -1,5 +1,5 @@ import { ColorPalette } from './nativescript-image-colors.common'; import { Image } from 'ui/image'; export declare class ImageColors { - static getColorPalette(image: Image): IColorPalette; + static getColorPalette(image: Image): ColorPalette; } diff --git a/nativescript-image-colors.android.ts b/nativescript-image-colors.android.ts index 70fe505..2a6e1e1 100644 --- a/nativescript-image-colors.android.ts +++ b/nativescript-image-colors.android.ts @@ -3,6 +3,7 @@ import { Image } from 'tns-core-modules/ui/image'; import { Color } from 'tns-core-modules/color'; declare const android: any; +declare const global: any; export class ImageColors { public static getColorPalette(image: Image): ColorPalette { @@ -24,7 +25,7 @@ export class ImageColors { return returnPalette; } - let Palette = new android.support.v7.graphics.Palette.from(bmp).generate(); + let Palette = new global.androidx.palette.graphics.Palette.from(bmp).generate(); if (Palette != null) { let vibrantSwatch = Palette.getVibrantSwatch(); let darkVibrantSwatch = Palette.getDarkVibrantSwatch(); diff --git a/package.json b/package.json index 54d887a..2d4d590 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { "name": "nativescript-image-colors", - "version": "1.1.0", + "version": "2.0.0", "description": "NativeScript colors from images.", "main": "nativescript-image-colors.js", "typings": "index.d.ts", "nativescript": { "platforms": { - "android": "2.2.0", - "ios": "2.2.1" + "android": "6.2.0", + "ios": "6.2.0" } }, "scripts": { @@ -41,7 +41,7 @@ "homepage": "https://github.com/TheOriginalJosh/nativescript-image-colors", "readmeFilename": "README.md", "devDependencies": { - "tns-core-modules": "^3.1.0", + "tns-core-modules": "^6.2.0", "tns-platform-declarations": "3.1.0" }, "dependencies": { diff --git a/platforms/android/include.gradle b/platforms/android/include.gradle index 83c4169..10ca303 100644 --- a/platforms/android/include.gradle +++ b/platforms/android/include.gradle @@ -1,9 +1,5 @@ android { - productFlavors { - "nativescriptimagecolors" { - dimension "nativescriptimagecolors" - } - } + } dependencies { compile "com.android.support:palette-v7:24.1.1"