Search in sources :

Example 11 with BoxingConfig

use of com.bilibili.boxing.model.config.BoxingConfig in project boxing by Bilibili.

the class AbsBoxingActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    AbsBoxingViewFragment view = onCreateBoxingView(getSelectedMedias(getIntent()));
    BoxingConfig pickerConfig = BoxingManager.getInstance().getBoxingConfig();
    view.setPresenter(new PickerPresenter(view));
    view.setPickerConfig(pickerConfig);
    Boxing.get().setupFragment(view, this);
}
Also used : BoxingConfig(com.bilibili.boxing.model.config.BoxingConfig) PickerPresenter(com.bilibili.boxing.presenter.PickerPresenter)

Example 12 with BoxingConfig

use of com.bilibili.boxing.model.config.BoxingConfig in project boxing by Bilibili.

the class AbsBoxingViewFragment method onCreate.

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    BoxingConfig config;
    if (savedInstanceState != null) {
        config = savedInstanceState.getParcelable(Boxing.EXTRA_CONFIG);
    } else {
        config = BoxingManager.getInstance().getBoxingConfig();
    }
    setPickerConfig(config);
    onCreateWithSelectedMedias(savedInstanceState, parseSelectedMedias(savedInstanceState, getArguments()));
    super.onCreate(savedInstanceState);
    initCameraPhotoPicker(savedInstanceState);
}
Also used : BoxingConfig(com.bilibili.boxing.model.config.BoxingConfig)

Example 13 with BoxingConfig

use of com.bilibili.boxing.model.config.BoxingConfig in project boxing by Bilibili.

the class ConfigTest method testImageSelectionRes.

@Test
public void testImageSelectionRes() {
    mPickerManager.setBoxingConfig(new BoxingConfig(BoxingConfig.Mode.MULTI_IMG));
    BoxingConfig config = mPickerManager.getBoxingConfig();
    assertEquals(config.getMediaCheckedRes(), 0);
    assertEquals(BoxingResHelper.getMediaCheckedRes(), R.drawable.ic_boxing_checked);
    mPickerManager.setBoxingConfig(new BoxingConfig(BoxingConfig.Mode.MULTI_IMG).withMediaCheckedRes(R.drawable.ic_boxing_broken_image));
    config = mPickerManager.getBoxingConfig();
    assertEquals(config.getMediaCheckedRes(), R.drawable.ic_boxing_broken_image);
    assertEquals(BoxingResHelper.getMediaCheckedRes(), R.drawable.ic_boxing_broken_image);
    mPickerManager.setBoxingConfig(new BoxingConfig(BoxingConfig.Mode.MULTI_IMG));
    config = mPickerManager.getBoxingConfig();
    assertEquals(config.getMediaUnCheckedRes(), 0);
    assertEquals(BoxingResHelper.getMediaUncheckedRes(), R.drawable.shape_boxing_unchecked);
    mPickerManager.setBoxingConfig(new BoxingConfig(BoxingConfig.Mode.MULTI_IMG).withMediaUncheckedRes(R.drawable.ic_boxing_broken_image));
    config = mPickerManager.getBoxingConfig();
    assertEquals(config.getMediaUnCheckedRes(), R.drawable.ic_boxing_broken_image);
    assertEquals(BoxingResHelper.getMediaUncheckedRes(), R.drawable.ic_boxing_broken_image);
}
Also used : BoxingConfig(com.bilibili.boxing.model.config.BoxingConfig) Test(org.junit.Test)

Example 14 with BoxingConfig

use of com.bilibili.boxing.model.config.BoxingConfig in project boxing by Bilibili.

the class ConfigTest method testPlaceHolder.

@Test
public void testPlaceHolder() {
    mPickerManager.setBoxingConfig(new BoxingConfig(BoxingConfig.Mode.MULTI_IMG));
    BoxingConfig config = mPickerManager.getBoxingConfig();
    assertEquals(config.getMediaPlaceHolderRes(), 0);
    mPickerManager.setBoxingConfig(new BoxingConfig(BoxingConfig.Mode.MULTI_IMG).withMediaPlaceHolderRes(R.drawable.ic_boxing_broken_image));
    config = mPickerManager.getBoxingConfig();
    assertEquals(config.getMediaPlaceHolderRes(), R.drawable.ic_boxing_broken_image);
    mPickerManager.setBoxingConfig(new BoxingConfig(BoxingConfig.Mode.MULTI_IMG));
    config = mPickerManager.getBoxingConfig();
    assertEquals(config.getAlbumPlaceHolderRes(), 0);
    mPickerManager.setBoxingConfig(new BoxingConfig(BoxingConfig.Mode.MULTI_IMG).withAlbumPlaceHolderRes(R.drawable.ic_boxing_broken_image));
    config = mPickerManager.getBoxingConfig();
    assertEquals(config.getAlbumPlaceHolderRes(), R.drawable.ic_boxing_broken_image);
}
Also used : BoxingConfig(com.bilibili.boxing.model.config.BoxingConfig) Test(org.junit.Test)

Example 15 with BoxingConfig

use of com.bilibili.boxing.model.config.BoxingConfig in project boxing by Bilibili.

the class ConfigTest method testVideoDuration.

@Test
public void testVideoDuration() {
    mPickerManager.setBoxingConfig(new BoxingConfig(BoxingConfig.Mode.VIDEO));
    BoxingConfig config = mPickerManager.getBoxingConfig();
    assertEquals(config.getVideoDurationRes(), 0);
    mPickerManager.setBoxingConfig(new BoxingConfig(BoxingConfig.Mode.MULTI_IMG).withVideoDurationRes(R.drawable.ic_boxing_broken_image));
    config = mPickerManager.getBoxingConfig();
    assertEquals(config.getVideoDurationRes(), R.drawable.ic_boxing_broken_image);
}
Also used : BoxingConfig(com.bilibili.boxing.model.config.BoxingConfig) Test(org.junit.Test)

Aggregations

BoxingConfig (com.bilibili.boxing.model.config.BoxingConfig)25 Test (org.junit.Test)14 Intent (android.content.Intent)7 BoxingCropOption (com.bilibili.boxing.model.config.BoxingCropOption)7 BaseMedia (com.bilibili.boxing.model.entity.BaseMedia)6 BoxingActivity (com.bilibili.boxing_impl.ui.BoxingActivity)6 Uri (android.net.Uri)4 PickerPresenter (com.bilibili.boxing.presenter.PickerPresenter)4 ArrayList (java.util.ArrayList)4 ContentResolver (android.content.ContentResolver)3 ImageMedia (com.bilibili.boxing.model.entity.impl.ImageMedia)3 MockContentResolver (android.test.mock.MockContentResolver)2 ImageView (android.widget.ImageView)2 VideoMedia (com.bilibili.boxing.model.entity.impl.VideoMedia)2 List (java.util.List)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 PrepareOnlyThisForTest (org.powermock.core.classloader.annotations.PrepareOnlyThisForTest)2 BottomSheetBehavior (android.support.design.widget.BottomSheetBehavior)1 FragmentManager (android.support.v4.app.FragmentManager)1 View (android.view.View)1