@@ -2,16 +2,16 @@ import { EventData } from '@nativescript/core/data/observable';
22import { Button } from '@nativescript/core/ui/button' ;
33import { GridLayout } from '@nativescript/core/ui/layouts/grid-layout' ;
44import { Label } from '@nativescript/core/ui/label' ;
5- import * as imageModel from '@nativescript-community/ui-image' ;
5+ import { Img , getImagePipeline } from '@nativescript-community/ui-image' ;
66import { writeToOutputLabel } from './appLogger' ;
77
88const src = 'https://raw.githubusercontent.com/nativescript-community/ui-image/master/examples-data/breakfast1.jpg' ;
99
1010export function onCheckCache ( args : EventData ) {
1111 const button = args . object as Button ;
1212 const gridLayout = button . parent as GridLayout ;
13- const imageView = gridLayout . getViewById ( 'imageView' ) ;
14- const imagePipeLine = imageModel . getImagePipeline ( ) ;
13+ const imageView = gridLayout . getViewById ( 'imageView' ) as Img ;
14+ const imagePipeLine = getImagePipeline ( ) ;
1515 const isInCache = imagePipeLine . isInBitmapMemoryCache ( src ) ;
1616 writeToOutputLabel ( imageView , '>>>>> Image is in the Bitmap memory cache - ' + isInCache ) ;
1717
@@ -25,8 +25,8 @@ export function onCheckCache(args: EventData) {
2525export function onClearCache ( args : EventData ) {
2626 const button = args . object as Button ;
2727 const gridLayout = button . parent as GridLayout ;
28- const imageView = gridLayout . getViewById ( 'imageView' ) ;
29- const imagePipeLine = imageModel . getImagePipeline ( ) ;
28+ const imageView = gridLayout . getViewById ( 'imageView' ) as Img ;
29+ const imagePipeLine = getImagePipeline ( ) ;
3030 writeToOutputLabel ( imageView , '>>>>> Clearning cache' ) ;
3131
3232 imagePipeLine . clearCaches ( ) ;
@@ -35,15 +35,15 @@ export function onClearCache(args: EventData) {
3535export function onSetImage ( args : EventData ) {
3636 const button = args . object as Button ;
3737 const gridLayout = button . parent as GridLayout ;
38- const imageView = gridLayout . getViewById ( 'imageView' ) ;
38+ const imageView = gridLayout . getViewById ( 'imageView' ) as Img ;
3939 imageView . src = null ;
4040 imageView . src = src ;
4141}
4242
4343export function onResetImage ( args : EventData ) {
4444 const button = args . object as Button ;
4545 const gridLayout = button . parent as GridLayout ;
46- const imageView = gridLayout . getViewById ( 'imageView' ) ;
46+ const imageView = gridLayout . getViewById ( 'imageView' ) as Img ;
4747 writeToOutputLabel ( imageView , ">>>>> Refreshing cache and 'src'" ) ;
4848
4949 imageView . updateImageUri ( ) ;
0 commit comments