當前位置: 首頁>>代碼示例>>Java>>正文


Java Fresco類代碼示例

本文整理匯總了Java中com.facebook.drawee.backends.pipeline.Fresco的典型用法代碼示例。如果您正苦於以下問題:Java Fresco類的具體用法?Java Fresco怎麽用?Java Fresco使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Fresco類屬於com.facebook.drawee.backends.pipeline包,在下文中一共展示了Fresco類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onViewCreated

import com.facebook.drawee.backends.pipeline.Fresco; //導入依賴的package包/類
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
  SimpleDraweeView simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view);

  ImageDecodeOptions imageDecodeOptionsWithCustomDecoder = new ImageDecodeOptionsBuilder()
      .setCustomImageDecoder(CUSTOM_COLOR_DECODER)
      .build();

  AbstractDraweeController controller = Fresco.newDraweeControllerBuilder()
      .setImageRequest(
          ImageRequestBuilder.newBuilderWithResourceId(R.raw.custom_color1)
              .setImageDecodeOptions(imageDecodeOptionsWithCustomDecoder)
              .build())
      .build();
  simpleDraweeView.setController(controller);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:17,代碼來源:ImageFormatOverrideExample.java

示例2: onCreate

import com.facebook.drawee.backends.pipeline.Fresco; //導入依賴的package包/類
@Override
public void onCreate() {
    super.onCreate();
    app=this;
    getScreen(this);
    Fresco.initialize(this);
    Recovery.getInstance()
            .debug(true)
            .recoverInBackground(false)
            .recoverStack(true)
            .mainPage(MainActivity.class)
            .init(this);
    String[] urls = getResources().getStringArray(R.array.url);
    String[] tips = getResources().getStringArray(R.array.title);
    List list = Arrays.asList(urls);
    images = new ArrayList(list);
    List list1 = Arrays.asList(tips);
    titles= new ArrayList(list1);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:20,代碼來源:App.java

示例3: init

import com.facebook.drawee.backends.pipeline.Fresco; //導入依賴的package包/類
private void init(Context context) {
    ImagePipelineConfig.Builder builder = ImagePipelineConfig.newBuilder(context)
            .setDownsampleEnabled(true);
    String cache = BoxingFileHelper.getCacheDir(context);

    if (TextUtils.isEmpty(cache)) {
        throw new IllegalStateException("the cache dir is null");
    }
    if (cache != null) {
        DiskCacheConfig diskCacheConfig = DiskCacheConfig.newBuilder(context)
                .setBaseDirectoryPath(new File(cache))
                .setBaseDirectoryName(IMAGE_PIPELINE_CACHE_DIR)
                .setMaxCacheSize(MAX_DISK_CACHE_SIZE)
                .setMaxCacheSizeOnLowDiskSpace(MAX_DISK_CACHE_LOW_SIZE)
                .setMaxCacheSizeOnVeryLowDiskSpace(MAX_DISK_CACHE_VERYLOW_SIZE)
                .build();
        builder.setMainDiskCacheConfig(diskCacheConfig);
    }
    ImagePipelineConfig config = builder.build();
    Fresco.initialize(context, config);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:22,代碼來源:BoxingFrescoLoader.java

示例4: onCreate

import com.facebook.drawee.backends.pipeline.Fresco; //導入依賴的package包/類
@Override
protected void onCreate(Bundle arg0) {
    super.onCreate(arg0);

    try {
        if (!Fresco.hasBeenInitialized()) {
            UdeskSDKManager.getInstance().init(this);
        }
        setContentView(R.layout.udesk_zoom_imageview);
        zoomImageView = (PhotoDraweeView) findViewById(R.id.udesk_zoom_imageview);
        Bundle bundle = getIntent().getExtras();
        uri = bundle.getParcelable("image_path");
        UdeskUtil.loadImage(zoomImageView, uri);
        saveIdBtn = findViewById(R.id.udesk_zoom_save);
        saveIdBtn.setOnClickListener(this);
    } catch (Exception e) {
        e.printStackTrace();
    }catch (OutOfMemoryError error){
        error.printStackTrace();
    }

}
 
開發者ID:lennyup,項目名稱:react-native-udesk,代碼行數:23,代碼來源:UdeskZoomImageActivty.java

示例5: onBind

import com.facebook.drawee.backends.pipeline.Fresco; //導入依賴的package包/類
@Override
protected void onBind(String uriString) {
  Uri uri = Uri.parse(uriString);
  ImageRequestBuilder imageRequestBuilder =
      ImageRequestBuilder.newBuilderWithSource(uri);
  if (UriUtil.isNetworkUri(uri)) {
    imageRequestBuilder.setProgressiveRenderingEnabled(true);
  } else {
    imageRequestBuilder.setResizeOptions(new ResizeOptions(
        mImageView.getLayoutParams().width,
        mImageView.getLayoutParams().height));
  }
  DraweeController draweeController = Fresco.newDraweeControllerBuilder()
      .setImageRequest(imageRequestBuilder.build())
      .setOldController(mImageView.getController())
      .setControllerListener(mImageView.getListener())
      .setAutoPlayAnimations(true)
      .build();
  mImageView.setController(draweeController);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:21,代碼來源:FrescoHolder.java

示例6: initAnimation

import com.facebook.drawee.backends.pipeline.Fresco; //導入依賴的package包/類
@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
private void initAnimation(View view) {
  mSimpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view);
  mSimpleDraweeView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
  DraweeController controller = Fresco.newDraweeControllerBuilder()
      .setOldController(mSimpleDraweeView.getController())
      .setUri(URI_KEYFRAMES_ANIMATION)
      .setAutoPlayAnimations(true)
      .build();
  mSimpleDraweeView.setController(controller);

  final SwitchCompat switchBackground = (SwitchCompat) view.findViewById(R.id.switch_background);
  switchBackground.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
    @Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
      mSimpleDraweeView.getHierarchy().setBackgroundImage(isChecked
          ? new CheckerBoardDrawable(getResources())
          : null);
    }
  });
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:22,代碼來源:ImageFormatKeyframesFragment.java

示例7: onCreate

import com.facebook.drawee.backends.pipeline.Fresco; //導入依賴的package包/類
@Override
public void onCreate() {
    super.onCreate();
    sContext = this;
    appComponent = DaggerAppComponent.builder()
            .baseComponent(baseComponent)
            .build();

    Fresco.initialize(getApplicationContext(),
            ImagePipelineFactory.imagePipelineConfig(getApplicationContext()
                    , getAppComponent().okHttpClient()
                    , getCacheDir().getAbsolutePath()));

    //ImageLoader初始化
    ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(this).build();
    ImageLoader.getInstance().init(configuration);

    DBManager.init(this);
    if (AccountHelper.isLogin())
        DBManager.initDefaultRealm(AccountHelper.getCurrentUid(), APPRealmMigration.VERSION, new APPRealmMigration());
    startService(new Intent(this, InitializeIntentService.class));
}
 
開發者ID:Jusenr,項目名稱:androidgithub,代碼行數:23,代碼來源:PTApplication.java

示例8: loadThumb

import com.facebook.drawee.backends.pipeline.Fresco; //導入依賴的package包/類
private void loadThumb(
    SimpleDraweeView draweeView,
    Size size,
    ImageRequest.RequestLevel requestLevel) {
  ImageRequest request = ImageRequestBuilder.newBuilderWithSource(size.uri)
      .setMediaVariations(MediaVariations.newBuilderForMediaId(MEDIA_ID)
          .setForceRequestForSpecifiedUri(true)
          .build())
      .setLowestPermittedRequestLevel(requestLevel)
      .setResizeOptions(new ResizeOptions(draweeView.getWidth(), draweeView.getHeight()))
      .setCacheChoice(size.cacheChoice)
      .build();
  DraweeController controller = Fresco.newDraweeControllerBuilder()
      .setImageRequest(request)
      .setOldController(draweeView.getController())
      .build();
  draweeView.setController(controller);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:19,代碼來源:MediaVariationsFragment.java

示例9: setImageSmall

import com.facebook.drawee.backends.pipeline.Fresco; //導入依賴的package包/類
public static void setImageSmall(String url,
                                 SimpleDraweeView simpleDraweeView,
                                 int width,
                                 int height,
                                 SquareRelativeLayout relativeLayout, boolean playGif) {

    Uri uri = Uri.parse(url);
    ImageRequest request = ImageRequestBuilder
            .newBuilderWithSource(uri)
            .setRotationOptions(RotationOptions.autoRotate())
            .setResizeOptions(new ResizeOptions(width, height))
            .setLowestPermittedRequestLevel(ImageRequest.RequestLevel.FULL_FETCH)
            .build();
    DraweeController controller = Fresco.newDraweeControllerBuilder()
            .setTapToRetryEnabled(true)
            .setImageRequest(request)
            .setAutoPlayAnimations(playGif)
            .setOldController(simpleDraweeView.getController())
            .build();
    relativeLayout.setLayoutParams(new RelativeLayout.LayoutParams(width - 5, height));
    simpleDraweeView.setController(controller);
}
 
開發者ID:Loofer,項目名稱:Watermark,代碼行數:23,代碼來源:FrescoImageLoader.java

示例10: onCreate

import com.facebook.drawee.backends.pipeline.Fresco; //導入依賴的package包/類
@Override
public void onCreate() {
  super.onCreate();
  final Config config = Config.load(this);
  ImagePipelineConfig.Builder imagePipelineConfigBuilder = ImagePipelineConfig.newBuilder(this)
      .setResizeAndRotateEnabledForNetwork(false)
      .setDownsampleEnabled(config.downsampling);
  if (WebpSupportStatus.sIsWebpSupportRequired) {
    imagePipelineConfigBuilder.experiment().setWebpSupportEnabled(config.webpSupportEnabled);
  }
  if (config.decodingThreadCount == 0) {
    imagePipelineConfigBuilder.setExecutorSupplier(
        new DefaultExecutorSupplier(Const.NUMBER_OF_PROCESSORS));
  } else {
    imagePipelineConfigBuilder.setExecutorSupplier(
        new ScrollPerfExecutorSupplier(Const.NUMBER_OF_PROCESSORS, config.decodingThreadCount));
  }
  imagePipelineConfigBuilder.experiment().setDecodeCancellationEnabled(config.decodeCancellation);
  DraweeConfig draweeConfig = DraweeConfig.newBuilder()
      .setDrawDebugOverlay(config.draweeOverlayEnabled)
      .build();
  Fresco.initialize(this, imagePipelineConfigBuilder.build(), draweeConfig);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:24,代碼來源:ScrollPerfApplication.java

示例11: setIconSource

import com.facebook.drawee.backends.pipeline.Fresco; //導入依賴的package包/類
private void setIconSource(ReadableMap source, IconControllerListener controllerListener,
                           DraweeHolder holder) {
    String uri = source != null ? source.getString("uri") : null;

    if (uri == null) {
        controllerListener.setIconImageInfo(null);
        controllerListener.setDrawable(null);
    } else if (uri.startsWith("http://") || uri.startsWith("https://") ||
            uri.startsWith("file://")) {
        controllerListener.setIconImageInfo(getIconImageInfo(source));
        DraweeController controller = Fresco.newDraweeControllerBuilder()
                .setUri(Uri.parse(uri))
                .setControllerListener(controllerListener)
                .setOldController(holder.getController())
                .build();
        holder.setController(controller);
        holder.getTopLevelDrawable().setVisible(true, true);
    } else {
        controllerListener.setDrawable(getDrawableByName(uri));
    }
}
 
開發者ID:timomeh,項目名稱:react-native-android-bottom-navigation,代碼行數:22,代碼來源:RNBottomNavigation.java

示例12: FrescoInit

import com.facebook.drawee.backends.pipeline.Fresco; //導入依賴的package包/類
private void FrescoInit() {
    DiskCacheConfig diskCacheConfig = DiskCacheConfig.newBuilder(this)
            .setMaxCacheSize(40 * ByteConstants.MB)
            .setBaseDirectoryPathSupplier(new Supplier<File>() {
                @Override
                public File get() {
                    return getCacheDir();
                }
            })
            .build();

    final FrescoCacheParams bitmapCacheParams = new FrescoCacheParams(activityManager);
    //Set<RequestListener> listeners = new HashSet<>();
    ImagePipelineConfig imagePipelineConfig = OkHttpImagePipelineConfigFactory.newBuilder(this, RetrofitClient.getInstance().getOkHttpClient())
            .setMainDiskCacheConfig(diskCacheConfig)
            .setBitmapMemoryCacheParamsSupplier(bitmapCacheParams)
            .setDownsampleEnabled(true)
            .build();
    Fresco.initialize(this, imagePipelineConfig);
}
 
開發者ID:nowandfurure,項目名稱:richeditor,代碼行數:21,代碼來源:AppManager.java

示例13: displayImage

import com.facebook.drawee.backends.pipeline.Fresco; //導入依賴的package包/類
private void displayImage(SimpleDraweeView draweeView, String url) {
    GenericDraweeHierarchy hierarchy = draweeView.getHierarchy();
    //設置占位圖
    if (hierarchy == null) {
        hierarchy = GenericDraweeHierarchyBuilder.newInstance(getResources())
                .setPlaceholderImage(getResources().getDrawable(R.mipmap.ic_launcher)
                        , ScalingUtils.ScaleType.CENTER).build();
        draweeView.setHierarchy(hierarchy);
    } else {
        hierarchy.setPlaceholderImage(getResources().getDrawable(R.mipmap.ic_launcher)
                , ScalingUtils.ScaleType.CENTER);
    }

    //構建ImageRequestBuilder,傳入請求Uri
    ImageRequestBuilder requestBuilder = ImageRequestBuilder.newBuilderWithSource(Uri.parse(url));
    //構建Controller
    DraweeController controller = Fresco.newDraweeControllerBuilder()
            .setOldController(draweeView.getController())
            .setImageRequest(requestBuilder.build())
            .build();
    //設置圖片,Fresco設置顯示圖片都是通過Controller來實現
    draweeView.setController(controller);
}
 
開發者ID:idisfkj,項目名稱:Zoomable,代碼行數:24,代碼來源:MainActivity.java

示例14: instantiateItem

import com.facebook.drawee.backends.pipeline.Fresco; //導入依賴的package包/類
@Override
public Object instantiateItem(ViewGroup container, int position) {
    View view = LayoutInflater.from(mContext).inflate(R.layout.zoomable_view_pager_item, null);
    ZoomableDraweeView zoomableDraweeView = (ZoomableDraweeView) view.findViewById(R.id.zoomable_image);
    //允許縮放時切換
    zoomableDraweeView.setAllowTouchInterceptionWhileZoomed(true);
    //長按
    zoomableDraweeView.setIsLongpressEnabled(false);
    //雙擊擊放大或縮小
    zoomableDraweeView.setTapListener(new DoubleTapGestureListener(zoomableDraweeView));

    DraweeController draweeController = Fresco.newDraweeControllerBuilder()
            .setUri(mPaths.get(position))
            .build();
    //加載圖片
    zoomableDraweeView.setController(draweeController);
    container.addView(view);
    view.requestLayout();
    return view;
}
 
開發者ID:idisfkj,項目名稱:Zoomable,代碼行數:21,代碼來源:ZoomableViewPagerAdapter.java

示例15: onCreate

import com.facebook.drawee.backends.pipeline.Fresco; //導入依賴的package包/類
@Override
public void onCreate() {
    super.onCreate();

    app = this;

    // 存放所有activity的集合
    mActivityList = new ArrayList<>();

    // 漸進式圖片
    ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this)
            .setProgressiveJpegConfig(new SimpleProgressiveJpegConfig())
            .build();
    Fresco.initialize(this, config);

}
 
開發者ID:6ag,項目名稱:jiansan-java,代碼行數:17,代碼來源:App.java


注:本文中的com.facebook.drawee.backends.pipeline.Fresco類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。