Ankimobile. Now with BLING!

Index » Learning resources

 
Reply #1 - 2010 June 11, 1:07 pm
shinyclef Member
From: Japan Registered: 2009-02-27 Posts: 17

Ok, so that whole 'bling' thing... I didn't come up with it. Damien said it first. neutral
Well, anyway, I've been playing around with this idea for the past few hours about getting a little pic into the corner of my deck. After looking at gimp tutorials on layers and gradients and shadows and then tutorials on custom css and stuff (which turned out simpler than anticipated), I present to you, Ankimobile Pimped Edition.

http://dl.dropbox.com/u/7590004/Screenshots/ankimobile_beta20withpic.jpg
http://dl.dropbox.com/u/7590004/Screenshots/ankimobile_beta20withpic2.jpg

And one for the desktop:
http://dl.dropbox.com/u/7590004/Screens … ithpic.png

Please note that this version of ankimobile is still in beta. So the only thing I added was the little anime picture. This beta shouldn't take too long to be released, so, patience grasshopper.

Well, it's try number 1, and it's not gonna satisfy most of you guys cause the pic is linked by internet url, not locally. Good news is that locally will be able to work, I just haven't figured out the specifics. It will involve sending a pic over via a media sync and linking to it that way, but damien has mentioned javascrpt will be required.
---
EDIT: Now it's local and it works on non-jailbroken phones/pods too! No Javascript is required! It's pretty simple! See the end of the post for instructions!
---

Well, here's all I did.
I added this to the question field of my card template:
<img src="http://dl.dropbox.com/u/7590004/Pics/ankicorner1.png" style="position: absolute; top: 0px; left: 0px; z-index: 5;">

That z-index part is just to make sure the pic is on top of the background colour. This also means the pic will be on top of TEXT. I'm no pro so you guys can figure out the rest but, I've been talking with Damien and it's a simple matter to get the pic on top of the background and under the text. Although I think something was mentioned about removing the background info from fonts and putting it all in the template. That way you can specify the z-index I guess. But anyway, if you have plenty of white space up top (or bottom) you can do this no problem.

If you are jailbroken, you should be able to just drop a file into the resources folder of anki and it should link directly just fine.


Edit--------------------
If you are not jailbroken, follow these steps:

1: Drop the pics you want to use into a card to media sync them over to your phone/pod.
2: Sync.
3: Suspend that card so it doesn't come up in review.
4: Go to your media folder to find the files you need and copy the file names. They will be in hash. something like this but unique for your files: a9e6bef9b50d0374d9702dbd6950d2b6.jpg
5: Use that filename in your templates. Put the code in the question field of your card template.
Something like this:

Code:

<img src="a9e6bef9b50d0374d9702dbd6950d2b6.jpg" style="position: absolute; top: 0px; left: 0px; z-index: -1;">

You can have multiple pics in your deck using this method. See posts below for more.
---------------------

Now, who's got the best idea of what little pics, graphics, borders or whatever we can use to pimp out anki? big_smile

Last edited by shinyclef (2010 June 28, 12:25 pm)

Reply #2 - 2010 June 11, 1:51 pm
jettyke Member
From: 九州 Registered: 2008-04-07 Posts: 1194

Looks nice, seems like a way to add a little "spice" to the program

Reply #3 - 2010 June 11, 4:26 pm
Blahah Member
From: Cambridge, UK Registered: 2008-07-15 Posts: 715 Website

Nice. Set the z-index of the image to -1 to make it appear behind all the other elements.

Here is a stack of cards background on one of my decks.

Here's the bg image: http://dl.dropbox.com/u/6415847/bg.jpg

I need to disable the horizontal rule using mobilecss, but for some reason I can't find the Anki wiki entry about it.

Advertising (register and sign in to hide this)
JapanesePod101 Sponsor
 
Reply #4 - 2010 June 11, 4:28 pm
sikieiki Member
From: No Registered: 2009-11-05 Posts: 124

If you want to get it as a background image so that it goes under the text, you can look at the background-image/repeat css attribute. It would work but you would not be able to see text as well...

Reply #5 - 2010 June 11, 6:31 pm
Blahah Member
From: Cambridge, UK Registered: 2008-07-15 Posts: 715 Website

After experimenting with css backgrounds, you can easily set them using this code:

Code:

<style type="text/css">
body {background-image:url('http://dl.dropbox.com/u/6415847/stripe1.png');}
</style>

This one uses a stripe pattern I made using the CSS stripe generator. Screen shot on the iPhone:
http://desmond.yfrog.com/Himg815/scaled.php?tn=0&amp;server=815&amp;filename=2cn.jpg&amp;xsize=640&amp;ysize=640

Oh, and the background from this site (http://forum.koohii.com/img/koohii/body_bg.gif) also works very nicely on AnkiMobile...
http://desmond.yfrog.com/Himg822/scaled.php?tn=0&amp;server=822&amp;filename=uoy.jpg&amp;xsize=640&amp;ysize=640

Last edited by Blahah (2010 June 11, 6:43 pm)

Reply #6 - 2010 June 13, 8:59 pm
shinyclef Member
From: Japan Registered: 2009-02-27 Posts: 17

But of an update here. I've been decorating a bit, and thinking about how this is gonna work, but you know what, I can't figure out how this is gonna work offline for non-jailbreaks. T_T At one stage I thought I had the answer, but I think I was wrong. I'm not sure, I'll need to double check.

Anyway, I got this working with all files local. No need for net connection.

http://dl.dropbox.com/u/7590004/Screenshots/Anki%20Themes/ankitheme_black_mobile2.png
http://dl.dropbox.com/u/7590004/Screenshots/Anki%20Themes/ankitheme_black_mobile4.png

The rest of the screens are here.
http://dl.dropbox.com/u/7590004/Screens … obile1.png
http://dl.dropbox.com/u/7590004/Screens … obile3.png
http://dl.dropbox.com/u/7590004/Screens … obile5.png
http://dl.dropbox.com/u/7590004/Screens … obile6.png
http://dl.dropbox.com/u/7590004/Screens … obile7.png

This is the code I used.

Code:

<img src="ankicorner2.png" style="position: absolute; top: 0px; left: 0px; z-index: -1;">
<img src="ankicorner2.png" style="position: absolute; bottom: 0px; right: 0px; z-index: -1;">
<img src="ankicorner3.png" style="position: absolute; bottom: 0px; left: 0px; z-index: -1;">
<img src="ankiback.png" style="position: absolute; bottom: 0px; right: 0px; z-index: -2;">

It's big a messy but I just put a couple of lines after it before where my card infomration goes to make it clear. You can put this code at the bottom too if you prefer.

These are the pics I used.
http://dl.dropbox.com/u/7590004/Japanes … orner1.png
http://dl.dropbox.com/u/7590004/Japanes … orner2.png
http://dl.dropbox.com/u/7590004/Japanes … orner3.png
http://dl.dropbox.com/u/7590004/Japanes … kiback.png

Now, my pod is jailbroken. All I did was drop the files linked there directly into each media folder of my decks that use them. That's all. I also put them into my destop media folder of course. Now, if you're thinking, why can't I use these by linking the hash files names and just media syncing them across... go ahead and try but I think there's something about anki stripping some code if you do so.
Actually, I thought I had that working... but I can't remember now. I'll test it out again later, or you can go ahead and try if you want.

If you're a phone user with internet connection, this method will work by just typing out a web address, as we have already seen in this thread by blahah's nice work there big_smile.

Anyway I just wanted to get this out there to demonstrate that pretty much anything is possible here...
This is an idea I played around with but decided not to go with so it never made it to my phone lol.
http://dl.dropbox.com/u/7590004/Screens … esktop.png

Anyway, it IS possible to do this offline for non-jailbreaks, but if the easy way I mentioned above doesn't work, then a little bit of javascript may be necessary, and that's something I don't know how to do, so I wouldn't be able to take it further.

Is this something people would wanna try if it were easy to do offline?
My theme may be a 'little bit' cluttered lol, but I kinda like it now ^^;; although I do miss that little anime girl lol.

Reply #7 - 2010 June 13, 10:10 pm
kazelee Rater Mode
From: ohlrite Registered: 2008-06-18 Posts: 2132 Website

I want.

TOT

Reply #8 - 2010 June 14, 1:25 am
vileru Member
From: Cambridge, MA Registered: 2009-07-08 Posts: 750

@shinyclef
How'd you get that awesome font working for Ankimobile?

Reply #9 - 2010 June 14, 1:42 am
shinyclef Member
From: Japan Registered: 2009-02-27 Posts: 17

The real question is how did I install custom fonts on ipod/phone. And the answer is jailbreak, sorry T_T.

Last edited by shinyclef (2010 June 14, 1:43 am)

Reply #10 - 2010 June 14, 2:18 pm
vileru Member
From: Cambridge, MA Registered: 2009-07-08 Posts: 750

shinyclef wrote:

The real question is how did I install custom fonts on ipod/phone. And the answer is jailbreak, sorry T_T.

My phone is already jailbroken. What's the next step?

Reply #11 - 2010 June 14, 3:00 pm
Hashiriya Member
From: Georgia Registered: 2008-04-14 Posts: 1072

i too have a jailbroken ipod touch... please tell us the next step and the name of the font you are currently using!

Reply #12 - 2010 June 14, 3:35 pm
shinyclef Member
From: Japan Registered: 2009-02-27 Posts: 17

I'm using Epson Kaisho for the green questions and Epson Gyosho for the blue
answers.
You can find them here in the EPSON pack. Don't download yet...
http://www.wazu.jp/gallery/Fonts_Japanese.html

Installing custom fonts on iPod touch/iPhone requires a jailbreak.
Next step, the actuall font installation, is a little bit harder...

Firstly, you'll need fonts without japanese characters in the font names for them to work on iPod, which means you'll need to edit the font names, or, download these! big_smile The ones you want are EPSONTruePrint (Kaisho) and EPSONSemiCursive (Gyosho).
https://dl.dropbox.com/u/7590004/Fonts/ … enames.htm

Now, the hard part is the actual installation. This tutorial should cover it pretty well.
http://blog.gauravgiri.com/2008/08/tuto … to-iphone/

With the part where you need to edit the CGFontCache.plist file...
The two entries for these fonts at the end of the first section should look something like this:

Code:

        <key>EPSONTruePrint</key>
        <string>/System/Library/Fonts/Cache/EPSONTruePrint.ttf</string>
        <key>EPSONSemiCursive</key>
        <string>/System/Library/Fonts/Cache/EPSONSemiCursive.ttf</string>

And at the end of the second section something like this:

Code:

        <key>EPSONTruePrint</key>
        <dict>
            <key>Plain</key>
            <string>EPSONTruePrint</string>
        </dict>
        <key>EPSONSemiCursive</key>
        <dict>
            <key>Plain</key>
            <string>EPSONSemiCursive</string>
        </dict>

The end of the file will include an additional two </dict> lines. Make sure you keep them in without getting yourself mixed up ^^;

The entire end of my file starting from my custom fonts (I have three customs) looks like this:

Code:

        <key>EPSONTruePrint</key>
        <dict>
            <key>Plain</key>
            <string>EPSONTruePrint</string>
        </dict>
        <key>EPSONSemiCursive</key>
        <dict>
            <key>Plain</key>
            <string>EPSONSemiCursive</string>
        </dict>
        <key>EPSONThickTextbook</key>
        <dict>
            <key>Plain</key>
            <string>EPSONThickTextbook</string>
        </dict>
    </dict>
</dict>
</plist>

The tutorial I linked says to create a new folder for your custom fonts, but I didn't do that. I just dumped them in the same folder as the rest, and my code reflects that with my file path (/System/Library/Fonts/Cache/EPSONTruePrint.ttf). Just make sure if you copy mine, you dump the fonts into that Cache folder. If you wanna make your own folder then update that filepath.

But seriously, once you've done this once, it'll become easy if you wanna install fonts in the future. But I haven't found the need for new fonts for a long time. Read the guide, it's good. big_smile.
So edit the plist file, drop the fonts into the fonts folder via SSH or however you navigate, choose the font in your deck and anki will display it.

Let me know if it works, and post a pic or something big_smile.
For you jailbreakers, the above 'themes' idea works totally offline, so if you give that a try, post a pic or two!

PS. Here is an alternative for the broken link in step 6.
http://iappcat.com/plist/bin2xml

Last edited by shinyclef (2013 March 07, 6:58 am)

Reply #13 - 2010 June 15, 9:42 am
vileru Member
From: Cambridge, MA Registered: 2009-07-08 Posts: 750

@shinyclef

Did you convert the .plist file into XML and back into binary when you edited it? I followed the tutorial's instructions, but I think I went wrong when converting the .plist file since my phone became stuck on the loading screen when I respringed after copying and pasting the new .plist file.

Reply #14 - 2010 June 15, 9:58 am
Blahah Member
From: Cambridge, UK Registered: 2008-07-15 Posts: 715 Website

I didn't need to convert the plist at all - I'm on a mac so just used the plist editor and copied the edited plist back to the iphone.

Reply #15 - 2010 June 15, 11:23 am
vileru Member
From: Cambridge, MA Registered: 2009-07-08 Posts: 750

Blahah wrote:

I didn't need to convert the plist at all - I'm on a mac so just used the plist editor and copied the edited plist back to the iphone.

I just downloaded a plist editor for windows. I'll try my luck again and report my results here.

Reply #16 - 2010 June 16, 11:10 am
shinyclef Member
From: Japan Registered: 2009-02-27 Posts: 17

Oh, well what I did was just use a site to convet from binary to plain text, edit it, and send to the pod. I never converted it back to binary. I just use a text editor on my non-binary file now every time I want to make a change (which is rarely). A plist editor will probably work just fine too! I use notepad2.

If it hung, there must have been an error in the file. Maybe it couldn't find the font the plist file was pointing to?  don't know if that would cause it though. there might just have been a basic error somewhere.
If you definitely didn't make an error, maybe the program you are using is adding some text to the file that's not displayed? To be honest I'm not sure.

Did you get it working?

Oh, also, did you try restarting instead of just respringing?

Last edited by shinyclef (2010 June 16, 11:11 am)

Reply #17 - 2010 June 16, 1:42 pm
Blahah Member
From: Cambridge, UK Registered: 2008-07-15 Posts: 715 Website

The problem is definitely that you are converting it back to a plist format - just leave it in the xml format with a plist extension and edit in a text editor.

Reply #18 - 2010 June 16, 2:29 pm
JimmySeal Member
From: Kyoto Registered: 2006-03-28 Posts: 2279

Please excuse the n00b question, but what are you using to edit the HTML of your decks' templates?

Last edited by JimmySeal (2010 June 16, 2:33 pm)

Reply #19 - 2010 June 16, 2:33 pm
JimmySeal Member
From: Kyoto Registered: 2006-03-28 Posts: 2279

Blahah wrote:

I need to disable the horizontal rule using mobilecss, but for some reason I can't find the Anki wiki entry about it.

http://ichi2.net/anki/wiki/AnkiMobile

Scroll down to the bottom.

Reply #20 - 2010 June 17, 4:29 am
Blahah Member
From: Cambridge, UK Registered: 2008-07-15 Posts: 715 Website

JimmySeal wrote:

Please excuse the n00b question, but what are you using to edit the HTML of your decks' templates?

Just edit the template in Anki. Open your deck, then go to:
Settings > Deck Properties...
Select your active model, e.g. Japanese or Heisig, click 'edit'.
Press the 'card templates' tab button at the top.
HTML goes in either of the fields (question/answer).

Reply #21 - 2010 June 17, 5:07 am
JimmySeal Member
From: Kyoto Registered: 2006-03-28 Posts: 2279

Brilliant!  Would not have thought of that.  Thanks.

Reply #22 - 2010 June 20, 1:27 pm
vileru Member
From: Cambridge, MA Registered: 2009-07-08 Posts: 750

@skinyclef + Blahah

It's working! I held it off for a while since I had to spend almost an hour restoring my iPhone last time I tried. This time, I managed to successfully install the fonts in a matter of minutes thanks to your combined efforts. Reviewing has never been this sexy before ^_^ Thank you!

Reply #23 - 2010 June 22, 9:33 am
shinyclef Member
From: Japan Registered: 2009-02-27 Posts: 17

vileru. you got any screenshots happening? what fonts are you using?
I'm glad you got it working!

Last edited by shinyclef (2010 June 22, 9:34 am)

Reply #24 - 2010 June 22, 11:48 am
vileru Member
From: Cambridge, MA Registered: 2009-07-08 Posts: 750

shinyclef wrote:

vileru. you got any screenshots happening? what fonts are you using?
I'm glad you got it working!

I'm not sure how to take a screenshot of my iPhone, but I know it's possible. Could you point me in the right direction? Anyway, I'm using the exact same fonts as you, and even the same colors XD I liked your setup a lot, so I saw no reason to change it.

Reply #25 - 2010 June 22, 2:53 pm
Blahah Member
From: Cambridge, UK Registered: 2008-07-15 Posts: 715 Website

Just press the home button and the lock button (on the top right of the phone) simultaneously. You will hear a camera sound and a screenshot will be saved to your pictures folder. You can sync your itunes to get it, or upload it somewhere or email it to yourself.