Java Code Examples for com.facebook.drawee.backends.pipeline.Fresco#initialize()

The following examples show how to use com.facebook.drawee.backends.pipeline.Fresco#initialize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java    From AndroidPlayground with MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ImagePipelineConfig config = ImagePipelineConfig.newBuilder(getApplicationContext())
            .setDownsampleEnabled(true)
            .setBitmapsConfig(Bitmap.Config.RGB_565)
            .build();
    Fresco.initialize(getApplication(), config);

    setContentView(R.layout.activity_main);

    showGif();

    showShapedDrawee();

    showInnerDrawee();
}
 
Example 2
Source File: FrescoModule.java    From react-native-GPay with MIT License 6 votes vote down vote up
@Override
public void initialize() {
  super.initialize();
  getReactApplicationContext().addLifecycleEventListener(this);
  if (!hasBeenInitialized()) {
    if (mConfig == null) {
      mConfig = getDefaultConfig(getReactApplicationContext());
    }
    Context context = getReactApplicationContext().getApplicationContext();
    Fresco.initialize(context, mConfig);
    sHasBeenInitialized = true;
  } else if (mConfig != null) {
    FLog.w(
        ReactConstants.TAG,
        "Fresco has already been initialized with a different config. "
        + "The new Fresco configuration will be ignored!");
  }
  mConfig = null;
}
 
Example 3
Source File: App.java    From materialup with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    Fresco.initialize(this);
    sThis = this;
    sPref = getSharedPreferences("andgoo", MODE_PRIVATE);
}
 
Example 4
Source File: MainActivity.java    From meiShi with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Fresco.initialize(this);
    setContentView(R.layout.activity_main);
    setStateBarColor(R.color.colorPrimaryDark);
    initView();
    requestPermission();
}
 
Example 5
Source File: App.java    From CanPhotos with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    sInstance = this;

    Fresco.initialize(this);
}
 
Example 6
Source File: FrescoImageLoader.java    From GalleryFinal with Apache License 2.0 5 votes vote down vote up
public FrescoImageLoader(Context context, Bitmap.Config config) {
    this.context = context;
    ImagePipelineConfig imagePipelineConfig = ImagePipelineConfig.newBuilder(context)
            .setBitmapsConfig(config)
            .build();
    Fresco.initialize(context, imagePipelineConfig);
}
 
Example 7
Source File: GalleryApplication.java    From CommentGallery with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    FLog.setMinimumLoggingLevel(FLog.VERBOSE);
    Set<RequestListener> listeners = new HashSet<>();
    listeners.add(new RequestLoggingListener());
    ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this)
            .setRequestListeners(listeners)
            .build();
    Fresco.initialize(this, config);
}
 
Example 8
Source File: ProfileFragment.java    From Flora with MIT License 5 votes vote down vote up
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_profile, null);
    Ophelia.bind(this, view);
    Fresco.initialize(getActivity());

    dragSquare.setCallback(this);
    return view;
}
 
Example 9
Source File: DemoApplication.java    From demo4Fish with MIT License 5 votes vote down vote up
private void init() {
    OkHttpClient mOkHttpClient = new OkHttpClient();
    ImagePipelineConfig imagePipelineConfig = OkHttpImagePipelineConfigFactory
            .newBuilder(this, mOkHttpClient)
            .setDownsampleEnabled(true)
            .build();
    Fresco.initialize(this, imagePipelineConfig);
}
 
Example 10
Source File: ZoomableActivity.java    From ZoomableDraweeView-sample with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Uri data = getIntent().getData();
    if (null == data) {
        throw new IllegalArgumentException("No data to display");
    }

    String title = getIntent().getStringExtra(KEY_TITLE);
    if (title != null) {
        setTitle(title);
    }

    Fresco.initialize(this);
    setContentView(R.layout.activity_zoomable);

    ZoomableDraweeView view = (ZoomableDraweeView) findViewById(R.id.zoomable);

    DraweeController ctrl = Fresco.newDraweeControllerBuilder().setUri(
            data).setTapToRetryEnabled(true).build();
    GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(getResources())
            .setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER)
            .setProgressBarImage(new ProgressBarDrawable())
            .build();

    view.setController(ctrl);
    view.setHierarchy(hierarchy);
}
 
Example 11
Source File: MainActivity.java    From AndroidPlayground with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);
    Fresco.initialize(getApplicationContext());
}
 
Example 12
Source File: CniaoApplication.java    From ImitateTaobaoApp with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    mInstance = this;
    initUser();
    Fresco.initialize(this);
}
 
Example 13
Source File: MYApplication.java    From FanXin-based-HuanXin with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    applicationContext = this;
    instance = this;

    /**
     * this function will initialize the HuanXin SDK
     * 
     * @return boolean true if caller can continue to call HuanXin related
     *         APIs after calling onInit, otherwise false.
     * 
     *         环信初始化SDK帮助函数
     *         返回true如果正确初始化,否则false,如果返回为false,请在后续的调用中不要调用任何和环信相关的代码
     * 
     *         for example: 例子:
     * 
     *         public class DemoHXSDKHelper extends HXSDKHelper
     * 
     *         HXHelper = new DemoHXSDKHelper();
     *         if(HXHelper.onInit(context)){ // do HuanXin related work }
     */
    hxSDKHelper.onInit(applicationContext);
    Fresco.initialize(this);
    initImage();
    getNowTime();
    CrashReport.initCrashReport(getApplicationContext(), "900019446", false);

}
 
Example 14
Source File: FrescoUtil.java    From MyImageUtil with Apache License 2.0 5 votes vote down vote up
/**
 * 初始化操作,在Application的onCreate方法中初始化,建议在子线程中进行
 *
 * 添加的依赖:
             compile 'com.facebook.fresco:fresco:0.12.0'
             // 在 API < 14 上的机器支持 WebP 时,需要添加
             compile 'com.facebook.fresco:animated-base-support:0.12.0'
             // 支持 GIF 动图,需要添加
             compile 'com.facebook.fresco:animated-gif:0.12.0'
             // 支持 WebP (静态图+动图),需要添加
             compile 'com.facebook.fresco:animated-webp:0.12.0'
             compile 'com.facebook.fresco:webpsupport:0.12.0'
             compile "com.facebook.fresco:imagepipeline-okhttp3:0.12.0+"
 * @param context
 * @param cacheSizeInM  磁盘缓存的大小,以M为单位

 */
public static void init(final Context context, int cacheSizeInM){
    isWWW = true;
    DiskCacheConfig diskCacheConfig = DiskCacheConfig.newBuilder(context)
            .setMaxCacheSize(cacheSizeInM*1024*1024)
            .setBaseDirectoryName(PHOTO_FRESCO)
            .setBaseDirectoryPathSupplier(new Supplier<File>() {
                @Override
                public File get() {
                    return context.getCacheDir();
                }
            })
            .build();
    MyImageCacheStatsTracker imageCacheStatsTracker = new MyImageCacheStatsTracker();


    OkHttpClient okHttpClient= getAllPassClient(context);


    ImagePipelineConfig config = OkHttpImagePipelineConfigFactory.newBuilder(context,okHttpClient)
   // ImagePipelineConfig config = ImagePipelineConfig.newBuilder(context)
            .setMainDiskCacheConfig(diskCacheConfig)
            .setImageCacheStatsTracker(imageCacheStatsTracker)
            .setDownsampleEnabled(true)//Downsampling,它处理图片的速度比常规的裁剪更快,
            // 并且同时支持PNG,JPG以及WEP格式的图片,非常强大,与ResizeOptions配合使用
            .setBitmapsConfig(Bitmap.Config.RGB_565)
            .build();
    Fresco.initialize(context, config);

    WindowManager wm = (WindowManager) context.getSystemService(
            Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    screenWidth = display.getWidth() - dip2px(context,15);
}
 
Example 15
Source File: RecyclerRendererApplication.java    From RecyclerRenderers with Apache License 2.0 4 votes vote down vote up
@Override public void onCreate() {
  super.onCreate();
  Fresco.initialize(getApplicationContext());
}
 
Example 16
Source File: LeisureApplication.java    From Leisure with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    AppContext = getApplicationContext();
    Fresco.initialize(AppContext);
}
 
Example 17
Source File: SprintNBA.java    From SprintNBA with Apache License 2.0 4 votes vote down vote up
private void initFresco() {
    ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this)
            .setProgressiveJpegConfig(new SimpleProgressiveJpegConfig())
            .build();
    Fresco.initialize(this, config);
}
 
Example 18
Source File: InitHelper.java    From AndroidAll with Apache License 2.0 4 votes vote down vote up
public static void initFresco(Context context) {
    Fresco.initialize(context.getApplicationContext());
}
 
Example 19
Source File: Application.java    From HideImageMaker with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    Fresco.initialize(this);
}
 
Example 20
Source File: MyApp.java    From Android-HTTPS-based-on-MVVM with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    Fresco.initialize(this);
}