AviaryInc/Mobile-Feather-SDK-for-Android — Issue #6: feature request: order tool buttons based on order of “tools-list” list
Author: jeffargast
Created: 2011-10-20 13:30:24+00:00
State: open

When calling putExtras(“tools-list”) it would be nice if the order of the strings could determine the order of the buttons that appear in the Aviary photo editor.

For example, if I specified:

editIntent.putExtra("tools-list", new String[]{“DRAWING”, “MEME”, "CROP"});

The tools would appear in the order of Drawing, Meme, and then Crop.

I have locally changed the implementation of loadFilters in FeatherActivity to accomplish this:

private void loadFilters() {

EffectLoaderService service = (EffectLoaderService) mFilterManager.getService( EffectContext.EFFECT_LOADER );
List listEntries = new ArrayList();
EffectEntry[] entries = service.getEffects();

boolean has_stickers = service.hasStickers();

Map entryMap = new HashMap();

for ( int i = 0; i < entries.length; i++ ) {
FilterLoaderFactory.Filters entry_name = entries[i].name;
if ( mToolList != null && mToolList.size() > 0 ) {
if ( !mToolList.contains( entry_name.name() ) ) continue;
}

if ( !has_stickers ) {
if ( entry_name == FilterLoaderFactory.Filters.STICKERS ) {
continue;
}
}

entryMap.put(entry_name.name(), entries[i]);
}

if ( mToolList != null && mToolList.size() > 0 ) {
for ( String toolName: mToolList ) {
if ( !entryMap.containsKey(toolName) )
continue;

listEntries.add(entryMap.get(toolName));
}
} else {
for ( EffectEntry anEntry : entries ) {
if ( !entryMap.containsKey(anEntry.name.name()) )
continue;

listEntries.add(anEntry);
}
}

WorkspaceAdapter adapter = new WorkspaceAdapter( getBaseContext(), R.layout.feather_workspace_screen, -1, listEntries );
mWorkspace.setAdapter( adapter );

mArrowLeft.setEnabled( false );
mArrowRight.setEnabled( listEntries.size() > 4 );

if ( true ) {
return;
}
}