-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 value of fullscreen status in JavaScript #6470
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Optional comment
|
||
@JavascriptInterface | ||
public boolean ankiIsInFullscreen() { | ||
isInFullscreen = !getSupportActionBar().isShowing(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now used in 3 places - might be best to extract it to a method inside AbstractFlashcardViewer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to extract inside ocreate
but AnkiDroid crash everytime.
Edit:
Extracted to a function, now working
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
most of the interesting stuff in AnkiDroid activities needs to be done in (or called from / after) onCollectionLoaded
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood, But now I have extracted it inside onCollectionLoaded
but always getting false
value.
So, may be extracting to function is good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
I know you have a stack of related PRs @infinyte7 - bear with us while we go through them all, I continue to appreciate the real effort you have put in / are putting in for the JS API init stuff. I believe being an "anki template developer" is going to be a real thing after this, which is exciting to me as it will help us keep UI work (and associated complaints) down in the core so we can focus on the actual scheduling - a win/win
Pull Request template
Purpose / Description
When adding some function / text eg.
showAnswer();
then user have to turn on full screen.But if user turn off full screen then for hiding that buttons / text, there is way to know if full screen or not in JavaScript.
Fixes
Fixes Link to the issues.
Approach
Using
JavascriptInterface
, passingAction Bar isShowing
How Has This Been Tested?
Tested on emulator
false
whenAction Bar
showingtrue
whenAction Bar
not showingLearning (optional, can help others)
Describe the research stage
Links to blog posts, patterns, libraries or addons used to solve this problem
Checklist
Please, go through these checks before submitting the PR.
if
statements)