use of org.wordpress.android.fluxc.model.TermModel in project WordPress-Android by wordpress-mobile.
the class SelectCategoriesActivity method saveAndFinish.
private void saveAndFinish() {
Bundle bundle = new Bundle();
updateSelectedCategoryList();
List<TermModel> categories = new ArrayList<>();
for (Long categoryRemoteId : mSelectedCategories) {
categories.add(mTaxonomyStore.getCategoryByRemoteId(mSite, categoryRemoteId));
}
bundle.putSerializable("selectedCategories", new ArrayList<>(categories));
Intent mIntent = new Intent();
mIntent.putExtras(bundle);
setResult(RESULT_OK, mIntent);
finish();
}
use of org.wordpress.android.fluxc.model.TermModel in project WordPress-Android by wordpress-mobile.
the class SelectCategoriesActivity method onActivityResult.
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (data != null) {
final Bundle extras = data.getExtras();
switch(requestCode) {
case ACTIVITY_REQUEST_CODE_ADD_CATEGORY:
if (resultCode == RESULT_OK) {
TermModel newCategory = (TermModel) extras.getSerializable(AddCategoryActivity.KEY_CATEGORY);
// Save selected categories
updateSelectedCategoryList();
mListScrollPositionManager.saveScrollOffset();
mSwipeToRefreshHelper.setRefreshing(true);
RemoteTermPayload payload = new RemoteTermPayload(newCategory, mSite);
mDispatcher.dispatch(TaxonomyActionBuilder.newPushTermAction(payload));
break;
}
}
}
}
Aggregations