Search in sources :

Example 1 with PickerPresenter

use of com.bilibili.boxing.presenter.PickerPresenter 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 2 with PickerPresenter

use of com.bilibili.boxing.presenter.PickerPresenter in project boxing by Bilibili.

the class PickerPresenterTest method setupMockAndViews.

@Before
public void setupMockAndViews() {
    MockitoAnnotations.initMocks(this);
    PowerMockito.mockStatic(BoxingManager.class);
    PowerMockito.mockStatic(TextUtils.class);
    PowerMockito.when(BoxingManager.getInstance()).thenReturn(mPickerManager);
    mPresenter = new PickerPresenter(mView);
    MockContentResolver contentResolver = new MockContentResolver();
    Mockito.when(mView.getAppCr()).thenReturn(contentResolver);
    PowerMockito.when(TextUtils.isEmpty(any(CharSequence.class))).thenAnswer(new Answer<Boolean>() {

        @Override
        public Boolean answer(InvocationOnMock invocation) throws Throwable {
            CharSequence charSequence = (CharSequence) invocation.getArguments()[0];
            return !(charSequence != null && charSequence.length() > 0);
        }
    });
}
Also used : InvocationOnMock(org.mockito.invocation.InvocationOnMock) PickerPresenter(com.bilibili.boxing.presenter.PickerPresenter) MockContentResolver(android.test.mock.MockContentResolver) Before(org.junit.Before)

Example 3 with PickerPresenter

use of com.bilibili.boxing.presenter.PickerPresenter 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, 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)

Example 4 with PickerPresenter

use of com.bilibili.boxing.presenter.PickerPresenter in project boxing by Bilibili.

the class AbsBoxingViewActivity method onCreate.

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

Example 5 with PickerPresenter

use of com.bilibili.boxing.presenter.PickerPresenter in project boxing by Bilibili.

the class Boxing method setupFragment.

/**
     * set up a subclass of {@link AbsBoxingViewFragment} without a {@link AbsBoxingActivity}.
     *
     * @param fragment         subclass of {@link AbsBoxingViewFragment}
     * @param onFinishListener a listener fo media result
     */
public void setupFragment(@NonNull AbsBoxingViewFragment fragment, OnBoxingFinishListener onFinishListener) {
    fragment.setPresenter(new PickerPresenter(fragment));
    fragment.setOnFinishListener(onFinishListener);
}
Also used : PickerPresenter(com.bilibili.boxing.presenter.PickerPresenter)

Aggregations

PickerPresenter (com.bilibili.boxing.presenter.PickerPresenter)5 BoxingConfig (com.bilibili.boxing.model.config.BoxingConfig)3 FragmentManager (android.support.v4.app.FragmentManager)1 MockContentResolver (android.test.mock.MockContentResolver)1 ImageView (android.widget.ImageView)1 IBoxingCallback (com.bilibili.boxing.loader.IBoxingCallback)1 IBoxingMediaLoader (com.bilibili.boxing.loader.IBoxingMediaLoader)1 BoxingViewFragment (com.bilibili.boxing_impl.ui.BoxingViewFragment)1 Before (org.junit.Before)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1