com.facebook.imagepipeline.decoder.SimpleProgressiveJpegConfig Java Examples

The following examples show how to use com.facebook.imagepipeline.decoder.SimpleProgressiveJpegConfig. 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: MyApplication.java    From Mobike with Apache License 2.0 6 votes vote down vote up
private void initMyApplication() {
    //tencent bugly
    CrashReport.initCrashReport(getApplicationContext(), "e1a62089c6", false);
    //Fresco
    ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this)
            .setProgressiveJpegConfig(new SimpleProgressiveJpegConfig())
            .build();
    Fresco.initialize(this, config);
    //baidu map sdk
    SDKInitializer.initialize(this);
    //Bmob
    Bmob.initialize(this, "b0cb494256d9b86fc931ca930a055b75");
    //Logger
    Logger.addLogAdapter(new AndroidLogAdapter(){
        @Override
        public boolean isLoggable(int priority, String tag) {
            return true;// TODO: 2017/6/5
        }
    });
    //locail use data
    initUser();
}
 
Example #2
Source File: MyApplication.java    From TLint with Apache License 2.0 6 votes vote down vote up
private void initFrescoConfig() {
    final MemoryCacheParams bitmapCacheParams =
            new MemoryCacheParams(MAX_MEMORY_CACHE_SIZE, // Max total size of elements in the cache
                    Integer.MAX_VALUE,                     // Max entries in the cache
                    MAX_MEMORY_CACHE_SIZE, // Max total size of elements in eviction queue
                    Integer.MAX_VALUE,                     // Max length of eviction queue
                    Integer.MAX_VALUE);
    ImagePipelineConfig config = OkHttpImagePipelineConfigFactory.newBuilder(this, mOkHttpClient)
            .setProgressiveJpegConfig(new SimpleProgressiveJpegConfig())
            .setBitmapMemoryCacheParamsSupplier(new Supplier<MemoryCacheParams>() {
                public MemoryCacheParams get() {
                    return bitmapCacheParams;
                }
            })
            .setMainDiskCacheConfig(
                    DiskCacheConfig.newBuilder(this).setMaxCacheSize(MAX_DISK_CACHE_SIZE).build())
            .setDownsampleEnabled(true)
            .build();
    Fresco.initialize(this, config);
}
 
Example #3
Source File: MainApplication.java    From photo-viewer with Apache License 2.0 5 votes vote down vote up
@Override
    public void onCreate() {
        super.onCreate();
        SoLoader.init(this, /* native exopackage */ false);
        ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this)
                .setProgressiveJpegConfig(new SimpleProgressiveJpegConfig())
                .setResizeAndRotateEnabledForNetwork(true)
                .setDownsampleEnabled(true)
                .build();
//        debug
//        DraweeConfig draweeConfig = DraweeConfig.newBuilder()
//                .setDrawDebugOverlay(true)
//                .build();
        Fresco.initialize(this, config);
    }
 
Example #4
Source File: App.java    From LiuAGeAndroid with MIT License 5 votes vote down vote up
@Override
    public void onCreate() {
        super.onCreate();

        app = this;

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

        // 初始化app异常处理器 - 打包的时候开启
//        CrashHandler handler = CrashHandler.getInstance();
//        handler.init(getApplicationContext());

        // 初始化OkHttpUtils
        OkHttpClient okHttpClient = new OkHttpClient.Builder()
                .connectTimeout(10000L, TimeUnit.MILLISECONDS)
                .readTimeout(10000L, TimeUnit.MILLISECONDS)
                //其他配置
                .build();
        OkHttpUtils.initClient(okHttpClient);

        // 初始化Fresco
        ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this)
                .setProgressiveJpegConfig(new SimpleProgressiveJpegConfig())
                .build();
        Fresco.initialize(this, config);

        // 初始化ShareSDK
        ShareSDK.initSDK(this);

        // 初始化JPush
        JPushInterface.setDebugMode(true);
        JPushInterface.init(this);

        // 更新用户登录状态
        UserBean.updateUserInfoFromNetwork(new UserBean.OnUpdatedUserInfoListener());

    }
 
Example #5
Source File: HavenApp.java    From haven with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    mPrefs = new PreferenceManager(this);

    ImagePipelineConfig.Builder b = ImagePipelineConfig.newBuilder(this);
    ImagePipelineConfig config = b
            .setProgressiveJpegConfig(new SimpleProgressiveJpegConfig())
            .setResizeAndRotateEnabledForNetwork(true)
            .setDownsampleEnabled(true)
            .build();

    Fresco.initialize(this,config);

    try {
        ImagePipelineNativeLoader.load();
    } catch (UnsatisfiedLinkError e) {
        Fresco.shutDown();
        b.experiment().setNativeCodeDisabled(true);
        config = b.build();
        Fresco.initialize(this, config);
        e.printStackTrace();
    }

    AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);

    if (mPrefs.getRemoteAccessActive())
        startServer();

    havenApp = this;
    dataBaseInstance = HavenEventDB.getDatabase(this);

    JobManager.create(this).addJobCreator(new HavenJobCreator());
}
 
Example #6
Source File: BaoKanApp.java    From BaoKanAndroid with MIT License 5 votes vote down vote up
@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);

        // 初始化app异常处理器 - 打包的时候开启
        CrashHandler handler = CrashHandler.getInstance();
        handler.init(getApplicationContext());

//        OkHttpClient okHttpClient = new OkHttpClient.Builder()
//                .connectTimeout(10000L, TimeUnit.MILLISECONDS)
//                .readTimeout(10000L, TimeUnit.MILLISECONDS)
//                //其他配置
//                .build();
//        OkHttpUtils.initClient(okHttpClient);

        // 初始化ShareSDK
        ShareSDK.initSDK(this);

    }
 
Example #7
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 #8
Source File: ImagePipelineConfig.java    From FanXin-based-HuanXin with GNU General Public License v2.0 4 votes vote down vote up
private static ProgressiveJpegConfig getDefaultProgressiveJpegConfig() {
  // By default, don't return images progressively at all.
  return new SimpleProgressiveJpegConfig(
      Collections.unmodifiableList(new ArrayList<Integer>()), 0);
}
 
Example #9
Source File: DecodeProducerTest.java    From fresco with MIT License 4 votes vote down vote up
@Before
public void setUp() throws Exception {
  MockitoAnnotations.initMocks(this);
  mProgressiveJpegConfig =
      new SimpleProgressiveJpegConfig(
          new SimpleProgressiveJpegConfig.DynamicValueConfig() {
            public List<Integer> getScansToDecode() {
              return Arrays.asList(PREVIEW_SCAN, GOOD_ENOUGH_SCAN);
            }

            public int getGoodEnoughScanNumber() {
              return GOOD_ENOUGH_SCAN;
            }
          });

  PowerMockito.mockStatic(ProgressiveJpegParser.class);
  PowerMockito.whenNew(ProgressiveJpegParser.class)
      .withAnyArguments()
      .thenReturn(mProgressiveJpegParser);
  PowerMockito.mockStatic(JobScheduler.class);
  PowerMockito.whenNew(JobScheduler.class).withAnyArguments().thenReturn(mJobScheduler);

  when(mConfig.getExperiments()).thenReturn(mPipelineExperiments);

  mDecodeProducer =
      new DecodeProducer(
          mByteArrayPool,
          mExecutor,
          mImageDecoder,
          mProgressiveJpegConfig,
          false, /* Set downsampleEnabled to false */
          false, /* Set resizeAndRotateForNetwork to false */
          false, /* We don't cancel when the request is cancelled */
          mInputProducer,
          MAX_BITMAP_SIZE,
          new CloseableReferenceFactory(new NoOpCloseableReferenceLeakTracker()));

  PooledByteBuffer pooledByteBuffer = mockPooledByteBuffer(IMAGE_SIZE);
  mByteBufferRef = CloseableReference.of(pooledByteBuffer);
  mEncodedImage = new EncodedImage(mByteBufferRef);
  mEncodedImage.setImageFormat(DefaultImageFormats.JPEG);
  mEncodedImage.setWidth(IMAGE_WIDTH);
  mEncodedImage.setHeight(IMAGE_HEIGHT);
  mEncodedImage.setRotationAngle(IMAGE_ROTATION_ANGLE);
  mEncodedImage.setExifOrientation(IMAGE_EXIF_ORIENTATION);
}