@@ -332,49 +332,49 @@ export const needRequestImage = function (target: any, propertyKey: string | Sym
332332 } ;
333333} ;
334334
335- type DraweeView = new ( owner : Img , context ) => com . facebook . drawee . view . SimpleDraweeView ;
336- // eslint-disable-next-line no-redeclare
337- let DraweeView : DraweeView ;
338- function initializeDraweeView ( ) {
339- if ( DraweeView ) {
340- return ;
341- }
342- @NativeClass
343- class DraweeViewImpl extends com . facebook . drawee . view . SimpleDraweeView {
344- constructor ( public owner : Img , context : android . content . Context ) {
345- super ( context ) ;
346- return global . __native ( this ) ;
347- }
348- public onMeasure ( widthMeasureSpec : number , heightMeasureSpec : number ) {
349- const width = Utils . layout . getMeasureSpecSize ( widthMeasureSpec ) ;
350- const widthMode = Utils . layout . getMeasureSpecMode ( widthMeasureSpec ) ;
351- const height = Utils . layout . getMeasureSpecSize ( heightMeasureSpec ) ;
352- const heightMode = Utils . layout . getMeasureSpecMode ( heightMeasureSpec ) ;
353- const aspectRatio = this . getAspectRatio ( ) ;
354- CLog ( CLogTypes . info , 'onMeasure' , this . owner . src , widthMeasureSpec , heightMeasureSpec , width , height , aspectRatio ) ;
355- if ( aspectRatio > 0 ) {
356- const finiteWidth : boolean = widthMode === Utils . layout . EXACTLY ;
357- const finiteHeight : boolean = heightMode === Utils . layout . EXACTLY ;
358- // let scale: { width; height };
359- if ( ( this as any ) . imageWidth && ( this as any ) . imageHeight ) {
360- // scale = this.owner.computeScaleFactor(width, height, finiteWidth, finiteHeight, (this as any).imageWidth, (this as any).imageHeight, aspectRatio);
361- if ( ! finiteWidth ) {
362- widthMeasureSpec = Utils . layout . makeMeasureSpec ( height * aspectRatio , Utils . layout . EXACTLY ) ;
363- }
364- if ( ! finiteHeight ) {
365- heightMeasureSpec = Utils . layout . makeMeasureSpec ( width / aspectRatio , Utils . layout . EXACTLY ) ;
366- }
367- }
368- CLog ( CLogTypes . info , 'onMeasure scale' , this . owner . src , aspectRatio , finiteWidth , finiteHeight , width , height , ( this as any ) . imageWidth , ( this as any ) . imageHeight ) ;
369- }
370- super . onMeasure ( widthMeasureSpec , heightMeasureSpec ) ;
371- }
372- }
373- DraweeView = DraweeViewImpl as any ;
374- }
335+ // type DraweeView = new (owner: Img, context) => com.facebook.drawee.view.SimpleDraweeView;
336+ // // eslint-disable-next-line no-redeclare
337+ // let DraweeView: DraweeView;
338+ // function initializeDraweeView() {
339+ // if (DraweeView) {
340+ // return;
341+ // }
342+ // @NativeClass
343+ // class DraweeViewImpl extends com.facebook.drawee.view.SimpleDraweeView {
344+ // constructor(public owner: Img, context: android.content.Context) {
345+ // super(context);
346+ // return global.__native(this);
347+ // }
348+ // public onMeasure(widthMeasureSpec: number, heightMeasureSpec: number) {
349+ // const width = Utils.layout.getMeasureSpecSize(widthMeasureSpec);
350+ // const widthMode = Utils.layout.getMeasureSpecMode(widthMeasureSpec);
351+ // const height = Utils.layout.getMeasureSpecSize(heightMeasureSpec);
352+ // const heightMode = Utils.layout.getMeasureSpecMode(heightMeasureSpec);
353+ // const aspectRatio = this.getAspectRatio();
354+ // CLog(CLogTypes.info, 'onMeasure', this.owner.src, widthMeasureSpec, heightMeasureSpec, width, height, aspectRatio);
355+ // if (aspectRatio > 0) {
356+ // const finiteWidth: boolean = widthMode === Utils.layout.EXACTLY;
357+ // const finiteHeight: boolean = heightMode === Utils.layout.EXACTLY;
358+ // // let scale: { width; height };
359+ // if ((this as any).imageWidth && (this as any).imageHeight) {
360+ // // scale = this.owner.computeScaleFactor(width, height, finiteWidth, finiteHeight, (this as any).imageWidth, (this as any).imageHeight, aspectRatio);
361+ // if (!finiteWidth) {
362+ // widthMeasureSpec = Utils.layout.makeMeasureSpec(height * aspectRatio, Utils.layout.EXACTLY);
363+ // }
364+ // if (!finiteHeight) {
365+ // heightMeasureSpec = Utils.layout.makeMeasureSpec(width / aspectRatio, Utils.layout.EXACTLY);
366+ // }
367+ // }
368+ // CLog(CLogTypes.info, 'onMeasure scale', this.owner.src, aspectRatio, finiteWidth, finiteHeight, width, height, (this as any).imageWidth, (this as any).imageHeight);
369+ // }
370+ // super.onMeasure(widthMeasureSpec, heightMeasureSpec);
371+ // }
372+ // }
373+ // DraweeView = DraweeViewImpl as any;
374+ // }
375375
376376export class Img extends ImageBase {
377- nativeViewProtected : com . facebook . drawee . view . SimpleDraweeView ;
377+ nativeViewProtected : com . nativescript . image . DraweeView ;
378378 isLoading = false ;
379379
380380 _canRequestImage = true ;
@@ -403,14 +403,14 @@ export class Img extends ImageBase {
403403 if ( ! initialized ) {
404404 initialize ( initializeConfig ) ;
405405 }
406- initializeDraweeView ( ) ;
407- return new DraweeView ( this , this . _context ) ;
406+ // initializeDraweeView();
407+ return new com . nativescript . image . DraweeView ( this . _context ) ;
408408 }
409409 updateViewSize ( imageInfo ) {
410410 const draweeView = this . nativeViewProtected ;
411411 if ( imageInfo != null ) {
412- ( draweeView as any ) . imageWidth = imageInfo . getWidth ( ) ;
413- ( draweeView as any ) . imageHeight = imageInfo . getHeight ( ) ;
412+ draweeView . imageWidth = imageInfo . getWidth ( ) ;
413+ draweeView . imageHeight = imageInfo . getHeight ( ) ;
414414 }
415415 if ( ! this . aspectRatio && imageInfo != null ) {
416416 const ratio = imageInfo . getWidth ( ) / imageInfo . getHeight ( ) ;
0 commit comments