use of fr.free.nrw.commons.modifications.TemplateRemoveModifier in project apps-android-commons by commons-app.
the class MultipleShareActivity method onCategoriesSave.
@Override
public void onCategoriesSave(ArrayList<String> categories) {
if (categories.size() > 0) {
ContentProviderClient client = getContentResolver().acquireContentProviderClient(ModificationsContentProvider.AUTHORITY);
for (Contribution contribution : photosList) {
ModifierSequence categoriesSequence = new ModifierSequence(contribution.getContentUri());
categoriesSequence.queueModifier(new CategoryModifier(categories.toArray(new String[] {})));
categoriesSequence.queueModifier(new TemplateRemoveModifier("Uncategorized"));
categoriesSequence.setContentProviderClient(client);
categoriesSequence.save();
}
}
// FIXME: Make sure that the content provider is up
// This is the wrong place for it, but bleh - better than not having it turned on by default for people who don't go throughl ogin
// Enable sync by default!
ContentResolver.setSyncAutomatically(app.getCurrentAccount(), ModificationsContentProvider.AUTHORITY, true);
EventLog.schema(CommonsApplication.EVENT_CATEGORIZATION_ATTEMPT).param("username", app.getCurrentAccount().name).param("categories-count", categories.size()).param("files-count", photosList.size()).param("source", Contribution.SOURCE_EXTERNAL).param("result", "queued").log();
finish();
}
use of fr.free.nrw.commons.modifications.TemplateRemoveModifier in project apps-android-commons by commons-app.
the class ShareActivity method onCategoriesSave.
@Override
public void onCategoriesSave(ArrayList<String> categories) {
if (categories.size() > 0) {
ModifierSequence categoriesSequence = new ModifierSequence(contribution.getContentUri());
categoriesSequence.queueModifier(new CategoryModifier(categories.toArray(new String[] {})));
categoriesSequence.queueModifier(new TemplateRemoveModifier("Uncategorized"));
categoriesSequence.setContentProviderClient(getContentResolver().acquireContentProviderClient(ModificationsContentProvider.AUTHORITY));
categoriesSequence.save();
}
// FIXME: Make sure that the content provider is up
// This is the wrong place for it, but bleh - better than not having it turned on by default for people who don't go throughl ogin
// Enable sync by default!
ContentResolver.setSyncAutomatically(app.getCurrentAccount(), ModificationsContentProvider.AUTHORITY, true);
EventLog.schema(CommonsApplication.EVENT_CATEGORIZATION_ATTEMPT).param("username", app.getCurrentAccount().name).param("categories-count", categories.size()).param("files-count", 1).param("source", contribution.getSource()).param("result", "queued").log();
finish();
}
Aggregations