Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get Topbar shown status in card #6747

Merged
merged 1 commit into from
Jul 25, 2020
Merged

Conversation

krmanik
Copy link
Member

@krmanik krmanik commented Jul 25, 2020

Pull Request template

Purpose / Description

It helps in dynamically show / hide deckname, card count and time at top using status of topbar and fullscreen like in image below.

<script>
if (!AnkiDroidJS.ankiIsTopbarShown() && AnkiDroidJS.ankiIsInFullscreen()) {
     showCustomTopDesign();
} 
// else hidden

function showCustomTopDesign() {
...
...
}
</script>

Fixes

Fixes Link to the issues.

Approach

Using JavascriptInterface

How Has This Been Tested?

Testes on emulator.

  1. Add to front/back side of card
<script>
console.log(AnkiDroidJS.ankiIsTopbarShown());
</script>

Learning (optional, can help others)

https://developer.android.com/reference/android/webkit/JavascriptInterface

Links to blog posts, patterns, libraries or addons used to solve this problem

Checklist

Please, go through these checks before submitting the PR.

  • [ x ] You have not changed whitespace unnecessarily (it makes diffs hard to read)
  • [ x ] You have a descriptive commit message with a short title (first line, max 50 chars).
  • [ x ] Your code follows the style of the project (e.g. never omit braces in if statements)
  • [ x ] You have commented your code, particularly in hard-to-understand areas
  • [ x ] You have performed a self-review of your own code

Copy link
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mikehardy mikehardy merged commit 20ffcfd into ankidroid:master Jul 25, 2020
@mikehardy mikehardy added this to the 2.13 release milestone Jul 25, 2020
@krmanik krmanik deleted the topbar-status branch July 26, 2020 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants