-
Notifications
You must be signed in to change notification settings - Fork 32
Fix android translucent flags #9
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,24 @@ | ||
| { | ||
| "nativescript": { | ||
| "id": "org.nativescript.demo", | ||
| "tns-android": { | ||
| "version": "2.0.0" | ||
| }, | ||
| "tns-ios": { | ||
| "version": "2.0.0" | ||
| } | ||
| }, | ||
| "dependencies": { | ||
| "nativescript-slides": "file:..", | ||
| "tns-core-modules": "2.0.0" | ||
| }, | ||
| "devDependencies": { | ||
| "babel-traverse": "6.9.0", | ||
| "babel-types": "6.9.0", | ||
| "babylon": "6.8.0", | ||
| "filewalker": "0.1.2", | ||
| "lazy": "1.0.11", | ||
| "nativescript-dev-typescript": "^0.3.1", | ||
| "typescript": "^1.8.7" | ||
| } | ||
| } | ||
| "nativescript": { | ||
| "id": "org.nativescript.demo", | ||
| "tns-android": { | ||
| "version": "2.0.0" | ||
| }, | ||
| "tns-ios": { | ||
| "version": "2.0.0" | ||
| } | ||
| }, | ||
| "dependencies": { | ||
| "nativescript-slides": "file:..", | ||
| "tns-core-modules": "^2.0.1" | ||
| }, | ||
| "devDependencies": { | ||
| "babel-traverse": "6.9.0", | ||
| "babel-types": "6.9.0", | ||
| "babylon": "6.8.0", | ||
| "filewalker": "0.1.2", | ||
| "lazy": "1.0.11", | ||
| "nativescript-dev-typescript": "^0.3.1", | ||
| "typescript": "^1.8.7" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,8 @@ import * as AnimationModule from 'ui/animation'; | |
| import * as gestures from 'ui/gestures'; | ||
| import {AnimationCurve} from 'ui/enums'; | ||
|
|
||
| const LayoutParams = android.view.WindowManager.LayoutParams; | ||
|
|
||
| export class Slide extends StackLayout { } | ||
|
|
||
| enum direction { | ||
|
|
@@ -31,7 +33,8 @@ export class SlideContainer extends AbsoluteLayout { | |
| private _pageWidth: number; | ||
| private _loop: boolean; | ||
| private _interval: number; | ||
| private _AndroidTransparentStatusBar: boolean; | ||
| private _androidTranslucentStatusBar: boolean; | ||
| private _androidTranslucentNavBar: boolean; | ||
| private timer_reference: number; | ||
|
|
||
| get interval() { | ||
|
|
@@ -50,12 +53,20 @@ export class SlideContainer extends AbsoluteLayout { | |
| this._loop = value; | ||
| } | ||
|
|
||
| get AndroidTransparentStatusBar() { | ||
| return this._AndroidTransparentStatusBar; | ||
| get androidTranslucentStatusBar() { | ||
| return this._androidTranslucentStatusBar; | ||
| } | ||
|
|
||
| set androidTranslucentStatusBar(value: boolean) { | ||
| this._androidTranslucentStatusBar = value; | ||
| } | ||
|
|
||
| set AndroidTransparentStatusBar(value: boolean) { | ||
| this._AndroidTransparentStatusBar = value; | ||
| get androidTranslucentNavBar() { | ||
| return this._androidTranslucentNavBar; | ||
| } | ||
|
|
||
| set androidTranslucentNavBar(value: boolean) { | ||
| this._androidTranslucentNavBar = value; | ||
| } | ||
|
|
||
| get pageWidth() { | ||
|
|
@@ -93,12 +104,19 @@ export class SlideContainer extends AbsoluteLayout { | |
| if (!this._loaded) { | ||
| this._loaded = true; | ||
|
|
||
| // Android Transparent Status Bar | ||
| if (this.AndroidTransparentStatusBar === true && app.android && Platform.device.sdkVersion >= '21') { | ||
| const View = android.view.View; | ||
| // Android Translucent bars API >= 19 only | ||
| if (this.androidTranslucentStatusBar === true || this._androidTranslucentNavBar === true && app.android && Platform.device.sdkVersion >= '19') { | ||
| let window = app.android.startActivity.getWindow(); | ||
| // set the status bar to Color.Transparent | ||
| window.setStatusBarColor(0x000000); | ||
|
|
||
| // check for status bar | ||
| if (this._androidTranslucentStatusBar === true) { | ||
| window.addFlags(LayoutParams.FLAG_TRANSLUCENT_STATUS); | ||
| } | ||
|
|
||
| // check for nav bar | ||
| if (this._androidTranslucentNavBar === true) { | ||
| window.addFlags(LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); | ||
| } | ||
| } | ||
|
|
||
| let slides: StackLayout[] = []; | ||
|
|
@@ -172,6 +190,16 @@ export class SlideContainer extends AbsoluteLayout { | |
| }); | ||
| } | ||
|
|
||
| public resetAndroidTranslucentFlags(): void { | ||
| if (this._androidTranslucentStatusBar === true) { | ||
| let window = app.android.startActivity.getWindow(); | ||
| window.clearFlags(LayoutParams.FLAG_TRANSLUCENT_STATUS); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this let window but up two lines or is window already available I'm getting a compiler error here. |
||
| } | ||
| if (this._androidTranslucentNavBar === true) { | ||
| window.clearFlags(LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); | ||
| } | ||
| } | ||
|
|
||
| private setupLeftPanel(): void { | ||
| this.direction = direction.none; | ||
| this.transitioning = false; | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
my android d.ts file doesn't have layoutParams, did you get yours from tns-platform-declarations... I think i'm behind.
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.
Should have it. But it won't have all the flags since it's API 17 and these
are 19.
On Fri, May 20, 2016, 5:56 AM Josh Sommer notifications@github.com wrote:
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.
It also won't have clearFlags() that was after android 17
On Fri, May 20, 2016, 6:37 AM Brad Martin bradwaynemartin@gmail.com wrote: