# Aard 2 for Android _Aard 2 for Android_ is a successor to [Aard Dictionary for Android](https://github.com/aarddict/android). It comes with redesigned user interface, bookmarks, history and a better [dictionary storage format](https://github.com/itkach/slob). ## Download - [Aard 2 for Android](https://github.com/itkach/aard2-android/releases) - [Dictionaries](https://github.com/itkach/slob/wiki/Dictionaries) ## Features ### Lookup Lookup queries are punctuation, diacritics and case insensitive. Lookup Lookup Lookup ### Bookmarks and History Visited articles are automatically added to history and appear in the History tab. Articles can also be bookmarked (tap the Bookmark icon when viewing an article). Bookmarked articles appear in the Bookmarks tab. Bookmarks and history can be filtered and sorted by time or article title. Both bookmarks and history are limited to a thousand most recently used items. To remove a single bookmark or history record, swipe the list item left or right. Several records can be removed at once: long tap a list item to enter selection mode, tap the items to be removed, tap the Trash Can icon and confirm. A bookmark can also be removed by tapping the Bookmark icon when viewing an article. Bookmarks Swipe to delete Select and delete History ### Dictionary Management Dictionaries are added by selecting dictionary files using Android's document chooser. Note that the application itself does not download dictionary files. Opened dictionaries can be reordered by dragging them by the handle at the right of each row. Lookup results of equal match strength from multiple dictionaries are presented in the order of dictionaries in the dictionary list. Each dictionary can be marked to also be used for random article lookup. Dictionaries can also be deactivated (turned off). Turned off dictionaries do not participate in word lookup or random article lookup, but are still available when opening articles from bookmarks, history or when following links in other articles. Unwanted dictionaries can also be completely removed from the program (but dictionary files are not deleted). Dictionaries Dictionary options ### Article Appearance Dictionaries may include alternate style sheets. Custom style sheets can also be added via the Settings tab. The article menu's "Style..." entry lists the dictionary's built-in styles alongside any user styles. Some example user styles to use or start from: - [examples/dark.css](examples/dark.css): a dark version of any dictionary, for dictionaries without a dark style of their own - [examples/grayscale.css](examples/grayscale.css): any dictionary in shades of gray - [examples/beige.css](examples/beige.css): dark brown text on a beige background, for Wikipedia, Wiktionary and other MediaWiki-based dictionaries Download one and add it with Settings → User Styles → Add. A user style is named after its file, without the `.css` extension. Article menu Select style ### Text Size Article text size can be adjusted with a slider, available as "Text size" in the article menu. Text size ### Following the Device Color Scheme Aard 2 follows the device's system colors (Material You): its accent and surface colors are derived from the current system theme. Color scheme Color scheme Color scheme Color scheme Color scheme Color scheme ### Math Mathematical [formulas in Wikipedia](https://meta.wikimedia.org/wiki/Help:Displaying_a_formula) articles are rendered as text using [MathJax](http://www.mathjax.org/) — scalable, styleable, beautiful on any screen. Math Math ### Random Article Tapping the dice icon in the main view finds a random title in an active dictionary and opens the corresponding article. Random lookup can optionally be limited to only the dictionaries marked for it (see Dictionary Management). ### Volume Buttons Navigation When viewing articles, volume up/down buttons scroll article content or, if at the bottom (top) of the page, move to the next (previous) article. Long press scrolls all the way to the bottom (top). In the main view volume buttons cycle through tabs. This behavior can be disabled in settings. ### Full-screen Mode Articles can be viewed in full screen for distraction-free reading. Toggle it from the article menu; a floating button in the corner brings the toolbar back. In landscape orientation articles switch to full screen automatically — this can be turned off in settings. Full screen Full screen, landscape ### Navigate to Top While scrolling a long article, a floating button appears in the corner to jump back to the top. Navigate to top ### Clipboard Auto-Paste Text from clipboard can be automatically pasted into the lookup field (unless it contains a Web address, email or phone number). This behavior is off by default and can be enabled in settings. ### External Link Sharing Some dictionaries (such as Mediawiki based ones — Wikipedia, Wiktionary etc.) contain external links. Long tap on the link to share it without opening in a browser first. ### Settings The Settings tab collects the application's options: interface style (light, dark, or same as the device), when to load remote content, whether to use only dictionaries marked for random lookup, volume-button navigation, automatic full screen in landscape, clipboard auto-paste, history recording, and user style sheets. Settings ## Requested Permissions ### android.permission.INTERNET Aard 2 uses local embedded web server to provide article content. This permission is necessary to run the server. Also, articles may reference remote content such as images. This permission is necessary to load it. ### android.permission.ACCESS_NETWORK_STATE User chooses when to allow loading remote content: always, when on Wi-Fi or never. This permission is necessary to determine network connection state. ## Developing Aard 2 is built with [Gradle](http://www.gradle.org). Aard 2 depends on projects [slobj](https://github.com/itkach/slobj) and [slobber](https://github.com/itkach/slobber). Get the source code: ```sh mkdir aard2 cd aard2 git clone https://github.com/itkach/slobj.git git clone https://github.com/itkach/slobber.git git clone https://github.com/itkach/aard2-android.git ``` Open [Android Studio](https://developer.android.com/sdk/installing/studio.html), go to _File_, _Open..._, select _aard2-android_ directory and click _Open_. To build the APK on the command line: ```sh cd aard2-android ./gradlew build ``` To install the APK: ```sh adb install -r build/outputs/apk/aard2-android-debug.apk ``` Unit tests are in `test/` and run on the JVM with [Robolectric](https://robolectric.org), no device needed (`./gradlew build` runs them too): ```sh ./gradlew testDebugUnitTest ``` The test dictionaries in `test/resources` are generated by `test/mkfixtures.py`. ### Developer helpers Common maintenance tasks are wrapped in a small `./d` front door; run `./d` with no arguments to list them. After cloning, run once per machine: ```sh ./d enable-hooks # point git at the tracked hooks in githooks/ ``` Other commands include `./d mk-release [version]` (bump the version, record dependency revisions, and create the release commit and tag), and the regenerators `./d mk-webp` and `./d mk-phosphor`. Because `slobj` and `slobber` are built from the sibling checkouts above, their exact revisions aren't captured by the build itself. `source-deps.json` records them, and the pre-commit hook enabled by `./d enable-hooks` keeps it current on every commit — so run `./d enable-hooks` before committing, or your commits won't record the dependency revisions they were built against. That hook also refuses to commit while `slobj` or `slobber` has uncommitted or untracked changes, since the recorded revision wouldn't then match what was built (bypass with `git commit --no-verify`). ## Launching from Other Applications Aard 2 lookup can be initiated from other applications, either through standard _Share_ action or directly, if application implemented an action to start Aard 2 with lookup intent. Sharing a Wikipedia, Wiktionary or other MediaWiki article link (for example, from a browser while offline) opens that article, preferring the dictionary made from the same site and scrolling to the linked section, if any. Applications can launch Aard 2 lookup by starting activity with intent `aard2.lookup` with text to look up passed as an extra string parameter [SearchManager.QUERY](http://developer.android.com/reference/android/app/SearchManager.html#QUERY). For example: ```java Intent intent = new Intent("aard2.lookup"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtra(SearchManager.QUERY, "Foo Bar"); startActivity(intent); ``` Same thing from a command line using _adb_: ```sh adb shell am start -a aard2.lookup -f 335544320 -e query "Foo Bar" ```