Plugins architecture for AnkiDroid?

1,281 views
Skip to first unread message

Nicolas Raoul

unread,
Apr 19, 2012, 7:18:29 AM4/19/12
to anki-a...@googlegroups.com
Hi all,

It would be great to have a "plugins" system in AnkiDroid.
That would allow us to have a light main app, with not too many options.
Things that could be plugins:
- Zeemote
- Tibetan support
- Timeboxing
- Additional themes
- Chess
- ...

That would make AnkiDroid more manageable for new users, and for developers.

Anyone knows a convenient way to have a plugins architecture in Android?
Last time I tried it was not easy...
For instance, adding buttons to the Study Options screen is not doable
with Content Providers and Intents, as far as I know.

Cheers!
Nicolas Raoul

Marek Jasovsky

unread,
Apr 19, 2012, 7:21:46 AM4/19/12
to anki-a...@googlegroups.com
Hi

great idea, thumbs up for tibetan support :)

btw, not sure about those buttons you mentioned. I suppose there could be a chance to do almost everything with plugins, if we choose the right way.

one of best plugin architecture examples is in my eyes Eclipse Framework.

and last thing... you sure, you want this for the 2.0 version? :)

greetings

Marek

Dňa 19. apríla 2012 13:18, Nicolas Raoul <nicola...@gmail.com> napísal(-a):
Nicolas Raoul

--
You received this message because you are subscribed to the Google Groups "AnkiDroid" group.
To post to this group, send an email to anki-a...@googlegroups.com.
To unsubscribe from this group, send email to anki-android...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/anki-android?hl=en-GB.


Nicolas Raoul

unread,
Apr 19, 2012, 8:32:16 AM4/19/12
to anki-a...@googlegroups.com
Thanks for your enthousiasm marek :-)

I meant:
The study options is defined by res/layout/studyoptions.xml
By inserting a plugin, could I make AnkiDroid use my
custom_studyoptions.xml file instead?

If you have time to investigate that, it would help a lot!

Cheers!
Nicolas Raoul

2012/4/19 Marek Jasovsky <jasovsk...@gmail.com>:

Marek Jasovsky

unread,
Apr 19, 2012, 8:40:01 AM4/19/12
to anki-a...@googlegroups.com
well... not sure if I am that much mistaken... but the layout is just a xml file, you are loading at some point in the code. you can load it statically or via inflater dynamically.

 if we provide an enhancement point in AnkiDroid for StudyOptions screen... now I even know which one it is :D ... then you can always decide to load another xml instead, e.g. the one loaded in the plugin. and you can tell, which buttons HAVE to be there, and you can have there some extra, which are then used by the plugin itself, during other events...

I mean, it's the same with voting buttons. you have few of them and all they make is decide during scheduling, when is the next time, the card should come. one class, one method and 1..n buttons, with grades from 0 to 100, which are given the scheduler and he returns time until the card is shown next time. there are that many dynamic things in AnkiDroid, that I suppose, this should be doable.

That would be really fast investigation :)

Dňa 19. apríla 2012 14:32, Nicolas Raoul <nicola...@gmail.com> napísal(-a):

Marek Jasovsky

unread,
Apr 19, 2012, 8:50:31 AM4/19/12
to anki-a...@googlegroups.com

Nicolas Raoul

unread,
Apr 20, 2012, 3:28:58 AM4/20/12
to anki-a...@googlegroups.com
Nice!

Elaborating on your LayoutInflater idea, I asked the question with
more details here:
http://stackoverflow.com/questions/10239596
No answer yet...

Cheers!
Nicolas Raoul

Jason Axelson

unread,
Apr 20, 2012, 3:52:53 AM4/20/12
to anki-a...@googlegroups.com
Can't think of an open source example right now, but tasker and
dolphin browser both have plugins. Although dolphin might be a better
example since the tasker plugins don't have any gui at all.

Also, maybe you could do something with Fragments.

Jason

Marek Jasovsky

unread,
Apr 21, 2012, 10:12:51 AM4/21/12
to anki-a...@googlegroups.com
It is indeed possible to load xml from other apk, but I have no idea, what will happen, as soon there is also a click-handler in that other apk. there are lot of calls to findViewById in AnkiDroid code and they cannot be used then, if we have custom layouts, etc distributed in different plugins.

so I continue digging around

Marek

Dňa 20. apríla 2012 9:52, Jason Axelson <boston...@gmail.com> napísal(-a):

Nicolas Raoul

unread,
Apr 25, 2012, 1:08:33 AM4/25/12
to anki-a...@googlegroups.com
Hi everyone,

Let's brainstorm on what parts of AnkiDroid should be made a plugin.
That will allow us to better imagine what the plugins architecture should be.
What do you think could be a plugin? (existing or future features)

Thanks a lot!
Nicolas Raoul

On Sat, Apr 21, 2012 at 11:12 PM, Marek Jasovsky

Marek Jasovsky

unread,
Apr 25, 2012, 1:27:38 AM4/25/12
to anki-a...@googlegroups.com

Good idea ;-)

I would say hebrew support, tibetan support, maybe card browser, scheduler and voting buttons... Layouts of screens... What do you think?

Regards

Marek

Dňa 25.4.2012 7:08, "Nicolas Raoul" <nicola...@gmail.com> napísal(-a):

Nicolas Raoul

unread,
Apr 25, 2012, 1:31:52 AM4/25/12
to anki-a...@googlegroups.com
Interesting! Could you please describe in more details how AnkiDroid
would perform with/without each plugin?

Cheers!
Nicolas Raoul

On Wed, Apr 25, 2012 at 2:27 PM, Marek Jasovsky

Damien Elmes

unread,
Apr 25, 2012, 1:34:35 AM4/25/12
to anki-a...@googlegroups.com
Based on http://mylifewithandroid.blogspot.jp/2010/06/plugins.html and
his follow-up post it looks like it could be doable but modifying
arbitrary aspects of the GUI might be difficult, and you may need to
resort to a set of hooks in the places that need to be modified.

Marek Jasovsky

unread,
Apr 25, 2012, 2:18:51 AM4/25/12
to anki-a...@googlegroups.com
Hi

what do you mean by arbitrary aspects?

I can load an xml from another apk and similarly to findViewById, we can use findViewByTag, to find any component inside xml. then you can do anything you want, with those layouts.

of course, for those parts of plugins, which require also some sort of interaction, some hooks will be necessary.

expansion of my previous post will follow

BR

Marek

Dňa 25. apríla 2012 7:34, Damien Elmes <res...@ichi2.net> napísal(-a):

iniju

unread,
Apr 25, 2012, 5:23:37 AM4/25/12
to anki-a...@googlegroups.com
Damien, this is a nice link, thanks!

- I'd like to see something the colouring trick that the anki desktop pinyin plugin does:
  A service that applies style colouring to specific card fields, based on the tone of the character in that field.
  Optionally, adding the sound in the sound field if it exists.
  This overrides the Card Editor and makes the changes every time the user edits the fields.
  Possible option to ask for user confirmation.
  As far as I can tell, no UI modification is required by this. The options of the plugin itself can be accessed from the plugin application.

- As said before, the Chess functionality can be a plugin:
  This is a simple service that takes a card's content and returns it modified accordingly adding an HTML rendering of  the chessboard position and other functionality (implemented in javascript).
  Again no UI modifications required. Options for the plugin itself live in its own activity.

Btw, I like this extra benefit of the plugin idea that the related options are decoupled from AnkiDroid (which has already slightly too rich options menu).

Cheers,
Kostas

Marek


>>> >> >>>> >> For more options, visit this group at
>>> >> >>>> >> http://groups.google.com/group/anki-android?hl=en-GB.
>>> >> >>>> >>
>>> >> >>>> >
>>> >> >>>> > --
>>> >> >>>> > You received this message because you are subscribed to the
>>> >> >>>> > Google
>>> >> >>>> > Groups
>>> >> >>>> > "AnkiDroid" group.
>>> >> >>>> > To post to this group, send an email to
>>> >> >>>> > anki-a...@googlegroups.com.
>>> >> >>>> > To unsubscribe from this group, send email to

>>> >> >>>> > For more options, visit this group at
>>> >> >>>> > http://groups.google.com/group/anki-android?hl=en-GB.
>>> >> >>>>
>>> >> >>>> --
>>> >> >>>> You received this message because you are subscribed to the Google
>>> >> >>>> Groups
>>> >> >>>> "AnkiDroid" group.
>>> >> >>>> To post to this group, send an email to
>>> >> >>>> anki-a...@googlegroups.com.
>>> >> >>>> To unsubscribe from this group, send email to

>>> >> >>>> For more options, visit this group at
>>> >> >>>> http://groups.google.com/group/anki-android?hl=en-GB.
>>> >> >>>>
>>> >> >>>
>>> >> >>
>>> >> >> --
>>> >> >> You received this message because you are subscribed to the Google
>>> >> >> Groups
>>> >> >> "AnkiDroid" group.
>>> >> >> To post to this group, send an email to
>>> >> >> anki-a...@googlegroups.com.
>>> >> >> To unsubscribe from this group, send email to

>>> >> >> For more options, visit this group at
>>> >> >> http://groups.google.com/group/anki-android?hl=en-GB.
>>> >> >
>>> >> > --
>>> >> > You received this message because you are subscribed to the Google
>>> >> > Groups "AnkiDroid" group.
>>> >> > To post to this group, send an email to
>>> >> > anki-a...@googlegroups.com.
>>> >> > To unsubscribe from this group, send email to

>>> >> > For more options, visit this group at
>>> >> > http://groups.google.com/group/anki-android?hl=en-GB.
>>> >> >
>>> >>
>>> >> --
>>> >> You received this message because you are subscribed to the Google
>>> >> Groups
>>> >> "AnkiDroid" group.
>>> >> To post to this group, send an email to anki-a...@googlegroups.com.
>>> >> To unsubscribe from this group, send email to

>>> >> For more options, visit this group at
>>> >> http://groups.google.com/group/anki-android?hl=en-GB.
>>> >>
>>> >
>>> > --
>>> > You received this message because you are subscribed to the Google
>>> > Groups
>>> > "AnkiDroid" group.
>>> > To post to this group, send an email to anki-a...@googlegroups.com.
>>> > To unsubscribe from this group, send email to

>>> > For more options, visit this group at
>>> > http://groups.google.com/group/anki-android?hl=en-GB.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "AnkiDroid" group.
>>> To post to this group, send an email to anki-a...@googlegroups.com.
>>> To unsubscribe from this group, send email to

>>> For more options, visit this group at
>>> http://groups.google.com/group/anki-android?hl=en-GB.
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "AnkiDroid" group.
>> To post to this group, send an email to anki-a...@googlegroups.com.
>> To unsubscribe from this group, send email to

>> For more options, visit this group at
>> http://groups.google.com/group/anki-android?hl=en-GB.
>
> --
> You received this message because you are subscribed to the Google Groups "AnkiDroid" group.
> To post to this group, send an email to anki-a...@googlegroups.com.
> To unsubscribe from this group, send email to anki-android+unsubscribe@googlegroups.com.

> For more options, visit this group at http://groups.google.com/group/anki-android?hl=en-GB.
>

--
You received this message because you are subscribed to the Google Groups "AnkiDroid" group.
To post to this group, send an email to anki-a...@googlegroups.com.
To unsubscribe from this group, send email to anki-android+unsubscribe@googlegroups.com.

Marek Jasovsky

unread,
Apr 25, 2012, 7:46:03 AM4/25/12
to anki-a...@googlegroups.com
Hi everyone.

ok, here comes the promised description of the plugins:

Hebrew support:
- custom renderer to solve (somehow) the RTL text issues,
- maybe custom font in card browser.

Tibetan support:
- tibetan keyboard included
- tibetan font for whole UI, including Card Browser
- automatic transcription for tibetan fields

layouts... speaks for itself.

voting buttons and scheduler...
- custom layout of voting buttons, other count than 4, e.g.
- custom scheduler based on those new buttons, which can calculate time, when the card is due for next time...

card browser itself...
- custom layout
- custom functionality of card browser, based on content provided from main app

something like that

marek

Dňa 25. apríla 2012 11:23, iniju <inigo....@gmail.com> napísal(-a):
To view this discussion on the web, visit https://groups.google.com/d/msg/anki-android/-/EB-MpBnN82sJ.

To post to this group, send an email to anki-a...@googlegroups.com.
To unsubscribe from this group, send email to anki-android...@googlegroups.com.

Wisam

unread,
Apr 25, 2012, 11:16:27 AM4/25/12
to anki-a...@googlegroups.com
How about calling them Extensions instead?
People are familiar with Firefox and Chrome extensions. Plus it would be nice to have a searchable and centralized place to look for those with icons, description...etc
This way the core can be tighter and manageable by the programmers and if someone needs a Zeemote they can add that plug-in or remove it. I never used it but it is still sitting there.
Reply all
Reply to author
Forward
0 new messages