Search in sources :

Example 1 with IBoxingCallback

use of com.bilibili.boxing.loader.IBoxingCallback in project boxing by Bilibili.

the class BoxingPicassoLoader method displayRaw.

@Override
public void displayRaw(@NonNull ImageView img, @NonNull String absPath, int width, int height, final IBoxingCallback callback) {
    String path = "file://" + absPath;
    RequestCreator creator = Picasso.with(img.getContext()).load(path);
    if (width > 0 && height > 0) {
        creator.transform(new BitmapTransform(width, height));
    }
    creator.into(img, new Callback() {

        @Override
        public void onSuccess() {
            if (callback != null) {
                callback.onSuccess();
            }
        }

        @Override
        public void onError() {
            if (callback != null) {
                callback.onFail(null);
            }
        }
    });
}
Also used : Callback(com.squareup.picasso.Callback) IBoxingCallback(com.bilibili.boxing.loader.IBoxingCallback) RequestCreator(com.squareup.picasso.RequestCreator)

Example 2 with IBoxingCallback

use of com.bilibili.boxing.loader.IBoxingCallback in project boxing by Bilibili.

the class BoxingPicassoLoader method displayRaw.

@Override
public void displayRaw(@NonNull ImageView img, @NonNull String absPath, final IBoxingCallback callback) {
    String path = "file://" + absPath;
    Picasso.with(img.getContext()).load(path).transform(new BitmapTransform(1080, 720)).into(img, new Callback() {

        @Override
        public void onSuccess() {
            if (callback != null) {
                callback.onSuccess();
            }
        }

        @Override
        public void onError() {
            if (callback != null) {
                callback.onFail(null);
            }
        }
    });
}
Also used : Callback(com.squareup.picasso.Callback) IBoxingCallback(com.bilibili.boxing.loader.IBoxingCallback)

Example 3 with IBoxingCallback

use of com.bilibili.boxing.loader.IBoxingCallback in project boxing by Bilibili.

the class TestBlankActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_boxing);
    BoxingMediaLoader.getInstance().init(new IBoxingMediaLoader() {

        @Override
        public void displayThumbnail(@NonNull ImageView img, @NonNull String absPath, int width, int height) {
        }

        @Override
        public void displayRaw(@NonNull ImageView img, @NonNull String absPath, int width, int height, IBoxingCallback callback) {
        }
    });
    BoxingViewFragment fragment = BoxingViewFragment.newInstance();
    fragment.setTitleTxt((TextView) findViewById(R.id.pick_album_txt));
    fragment.setPresenter(new PickerPresenter(fragment));
    fragment.setPickerConfig(new BoxingConfig(BoxingConfig.Mode.MULTI_IMG));
    final FragmentManager manager = getSupportFragmentManager();
    manager.beginTransaction().add(R.id.content_layout, fragment).commit();
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) BoxingConfig(com.bilibili.boxing.model.config.BoxingConfig) IBoxingCallback(com.bilibili.boxing.loader.IBoxingCallback) IBoxingMediaLoader(com.bilibili.boxing.loader.IBoxingMediaLoader) ImageView(android.widget.ImageView) BoxingViewFragment(com.bilibili.boxing_impl.ui.BoxingViewFragment) PickerPresenter(com.bilibili.boxing.presenter.PickerPresenter)

Aggregations

IBoxingCallback (com.bilibili.boxing.loader.IBoxingCallback)3 Callback (com.squareup.picasso.Callback)2 FragmentManager (android.support.v4.app.FragmentManager)1 ImageView (android.widget.ImageView)1 IBoxingMediaLoader (com.bilibili.boxing.loader.IBoxingMediaLoader)1 BoxingConfig (com.bilibili.boxing.model.config.BoxingConfig)1 PickerPresenter (com.bilibili.boxing.presenter.PickerPresenter)1 BoxingViewFragment (com.bilibili.boxing_impl.ui.BoxingViewFragment)1 RequestCreator (com.squareup.picasso.RequestCreator)1