Skip to content

Get Topbar shown status in card#6747

Merged
mikehardy merged 1 commit intoankidroid:masterfrom
krmanik:topbar-status
Jul 25, 2020
Merged

Get Topbar shown status in card#6747
mikehardy merged 1 commit intoankidroid:masterfrom
krmanik:topbar-status

Conversation

@krmanik
Copy link
Copy Markdown
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
Copy Markdown
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