mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Merge pull request #3522 from NativeScript/status-bar-pick
Status bar pick
This commit is contained in:
19
.travis.yml
19
.travis.yml
@@ -37,16 +37,17 @@ before_script:
|
|||||||
- adb shell input keyevent 82 &
|
- adb shell input keyevent 82 &
|
||||||
script:
|
script:
|
||||||
- jdk_switcher use oraclejdk8
|
- jdk_switcher use oraclejdk8
|
||||||
- grunt default --verbose &&
|
- grunt default --verbose
|
||||||
FULL_PACKAGE_VERSION=`node -e 'console.log(require("./bin/dist/tns-core-modules/package.json").version);'` &&
|
- FULL_PACKAGE_VERSION=$(node build/version.js)
|
||||||
(cd tns-platform-declarations && npm pack) &&
|
- (cd tns-platform-declarations && npm pack)
|
||||||
wget -O ./nativescript.tgz "https://s3.amazonaws.com/nativescript-ci/build_result/nativescript.tgz" &&
|
- wget -O ./nativescript.tgz "https://s3.amazonaws.com/nativescript-ci/build_result/nativescript.tgz"
|
||||||
echo no | npm install -g nativescript.tgz --ignore-scripts > /dev/null && tns usage-reporting disable && tns error-reporting disable &&
|
- echo no | npm install -g nativescript.tgz --ignore-scripts
|
||||||
grunt buildOnlyTestsApp --verbose --platform=Android --modulesPath=./bin/dist/$PACKAGE_NAME-$FULL_PACKAGE_VERSION.tgz --runtimeVersion=$RUNTIMEVERSION --emuPId=.*emulator.* --avd=$AVD_NAME --showEmu=false > /dev/null &&
|
- tns usage-reporting disable && tns error-reporting disable
|
||||||
grunt runOnlyTestsApp --verbose --platform=Android --modulesPath=./bin/dist/$PACKAGE_NAME-$FULL_PACKAGE_VERSION.tgz --emuPId=.*emulator.* --avd=$AVD_NAME --showEmu=false
|
- grunt buildOnlyTestsApp --platform=Android --modulesPath=./bin/dist/$PACKAGE_NAME-$FULL_PACKAGE_VERSION.tgz --runtimeVersion=$RUNTIMEVERSION --emuPId=.*emulator.* --avd=$AVD_NAME --showEmu=false
|
||||||
|
- grunt runOnlyTestsApp --verbose --platform=Android --modulesPath=./bin/dist/$PACKAGE_NAME-$FULL_PACKAGE_VERSION.tgz --emuPId=.*emulator.* --avd=$AVD_NAME --showEmu=false
|
||||||
- node ./build/travis-scripts/check-testrun-broken.js
|
- node ./build/travis-scripts/check-testrun-broken.js
|
||||||
- adb pull /storage/sdcard/Documents/test-results.xml &&
|
- adb pull /storage/sdcard/Documents/test-results.xml
|
||||||
mv test-results.xml ~/test-run-results$PACKAGE_VERSION.xml
|
- mv test-results.xml ~/test-run-results$PACKAGE_VERSION.xml
|
||||||
before_deploy:
|
before_deploy:
|
||||||
- mv bin/dist/$PACKAGE_NAME-$FULL_PACKAGE_VERSION.tgz ../.deploymentpackage
|
- mv bin/dist/$PACKAGE_NAME-$FULL_PACKAGE_VERSION.tgz ../.deploymentpackage
|
||||||
- mv build ../
|
- mv build ../
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
<ActionBar title="Sample title" />
|
<ActionBar title="Sample title" />
|
||||||
</Page.actionBar>
|
</Page.actionBar>
|
||||||
|
|
||||||
|
<StackLayout padding="10">
|
||||||
|
<Label text="IOS and Android" fontSize="14"/>
|
||||||
<WrapLayout>
|
<WrapLayout>
|
||||||
<!-- status-bar-style -->
|
<!-- status-bar-style -->
|
||||||
<Button text="11" tap="applyTap" tag="status-bar-style: light;" style.fontSize="8" width="40" height="40" automationText="light;" />
|
<Button text="11" tap="applyTap" tag="status-bar-style: light;" style.fontSize="8" width="40" height="40" automationText="light;" />
|
||||||
@@ -13,13 +15,6 @@
|
|||||||
<Button text="21" tap="applyTapOnStyledActionBar" tag="status-bar-style: light;" style.fontSize="8" width="40" height="40" automationText="light-abb-ruby" />
|
<Button text="21" tap="applyTapOnStyledActionBar" tag="status-bar-style: light;" style.fontSize="8" width="40" height="40" automationText="light-abb-ruby" />
|
||||||
<Button text="22" tap="applyTapOnStyledActionBar" tag="status-bar-style: dark;" style.fontSize="8" width="40" height="40" automationText="dark-abb-ruby" />
|
<Button text="22" tap="applyTapOnStyledActionBar" tag="status-bar-style: dark;" style.fontSize="8" width="40" height="40" automationText="dark-abb-ruby" />
|
||||||
|
|
||||||
<!-- status-bar-style - action-bar - hidden -->
|
|
||||||
<Button text="31" tap="applyTapWithHiddenActionBar" tag="status-bar-style: light;" style.fontSize="8" width="40" height="40" automationText="light-ab-hidden" />
|
|
||||||
<Button text="32" tap="applyTapWithHiddenActionBar" tag="status-bar-style: dark;" style.fontSize="8" width="40" height="40" automationText="ark-ab-hidden" />
|
|
||||||
|
|
||||||
<!-- android-status-bar-background -->
|
|
||||||
<Button text="41" tap="applyTap" tag="android-status-bar-background: #E0115F;" style.fontSize="8" width="40" height="40" automationText="asbb-blue" />
|
|
||||||
|
|
||||||
<!-- status-bar-style - page - background -->
|
<!-- status-bar-style - page - background -->
|
||||||
<Button text="51" tap="applyTap" tag="status-bar-style: light;background-color: #E0115F;" style.fontSize="8" width="40" height="40" automationText="light-bckg-ruby" />
|
<Button text="51" tap="applyTap" tag="status-bar-style: light;background-color: #E0115F;" style.fontSize="8" width="40" height="40" automationText="light-bckg-ruby" />
|
||||||
<Button text="52" tap="applyTap" tag="status-bar-style: dark; background-color: #E0115F;" style.fontSize="8" width="40" height="40" automationText="dark-bckg-ruby" />
|
<Button text="52" tap="applyTap" tag="status-bar-style: dark; background-color: #E0115F;" style.fontSize="8" width="40" height="40" automationText="dark-bckg-ruby" />
|
||||||
@@ -34,5 +29,17 @@
|
|||||||
|
|
||||||
<Button text="73" tap="applyTapWithSpan" tag="status-bar-style: dark;background-color: yellow;" style.fontSize="8" width="40" height="40" automationText="light-ab-hidden-bckgsusb-true" />
|
<Button text="73" tap="applyTapWithSpan" tag="status-bar-style: dark;background-color: yellow;" style.fontSize="8" width="40" height="40" automationText="light-ab-hidden-bckgsusb-true" />
|
||||||
<Button text="74" tap="applyTapWithActionBarHiddenAndSpan" tag="status-bar-style: dark;background-color: yellow;" style.fontSize="8" width="40" height="40" automationText="dark-ab-hidden-bckgsusb-true" />
|
<Button text="74" tap="applyTapWithActionBarHiddenAndSpan" tag="status-bar-style: dark;background-color: yellow;" style.fontSize="8" width="40" height="40" automationText="dark-ab-hidden-bckgsusb-true" />
|
||||||
|
|
||||||
</WrapLayout>
|
</WrapLayout>
|
||||||
|
|
||||||
|
<Label text="Android" fontSize="14" marginTop="10"/>
|
||||||
|
<WrapLayout>
|
||||||
|
<!-- status-bar-style - action-bar - hidden -->
|
||||||
|
<Button text="31" tap="applyTapWithHiddenActionBar" tag="status-bar-style: light;" style.fontSize="8" width="40" height="40" automationText="light-ab-hidden" />
|
||||||
|
<Button text="32" tap="applyTapWithHiddenActionBar" tag="status-bar-style: dark;" style.fontSize="8" width="40" height="40" automationText="ark-ab-hidden" />
|
||||||
|
|
||||||
|
<!-- android-status-bar-background -->
|
||||||
|
<Button text="41" tap="applyTap" tag="android-status-bar-background: #E0115F;" style.fontSize="8" width="40" height="40" automationText="asbb-ruby" />
|
||||||
|
</WrapLayout>
|
||||||
|
</StackLayout>
|
||||||
</Page>
|
</Page>
|
||||||
2
build/version.js
Normal file
2
build/version.js
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
var fs = require("fs");
|
||||||
|
console.log(JSON.parse(fs.readFileSync("./bin/dist/tns-core-modules/package.json")).version);
|
||||||
@@ -427,10 +427,34 @@ export class ActionBarStyler implements style.Styler {
|
|||||||
(<android.support.v7.widget.Toolbar>v._nativeView).setTitleTextColor(nativeValue);
|
(<android.support.v7.widget.Toolbar>v._nativeView).setTitleTextColor(nativeValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// background-color
|
||||||
|
private static getBackgroundColorProperty(view: view.View): any {
|
||||||
|
let toolbar = <android.support.v7.widget.Toolbar>view._nativeView;
|
||||||
|
return toolbar.getBackground();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static setBackgroundColorProperty(v: view.View, newValue: any) {
|
||||||
|
var toolbar = (<android.support.v7.widget.Toolbar>v._nativeView);
|
||||||
|
if (toolbar) {
|
||||||
|
toolbar.setBackgroundColor(newValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static resetBackgroundColorProperty(v: view.View, nativeValue: any) {
|
||||||
|
var toolbar = (<android.support.v7.widget.Toolbar>v._nativeView);
|
||||||
|
if (toolbar) {
|
||||||
|
toolbar.setBackgroundColor(nativeValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static registerHandlers() {
|
public static registerHandlers() {
|
||||||
style.registerHandler(style.colorProperty, new style.StylePropertyChangedHandler(
|
style.registerHandler(style.colorProperty, new style.StylePropertyChangedHandler(
|
||||||
ActionBarStyler.setColorProperty,
|
ActionBarStyler.setColorProperty,
|
||||||
ActionBarStyler.resetColorProperty), "ActionBar");
|
ActionBarStyler.resetColorProperty), "ActionBar");
|
||||||
|
style.registerHandler(style.backgroundColorProperty, new style.StylePropertyChangedHandler(
|
||||||
|
ActionBarStyler.setBackgroundColorProperty,
|
||||||
|
ActionBarStyler.resetBackgroundColorProperty,
|
||||||
|
ActionBarStyler.getBackgroundColorProperty), "ActionBar");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -243,16 +243,20 @@ export class PageStyler implements style.Styler {
|
|||||||
|
|
||||||
// android-status-bar-background-property
|
// android-status-bar-background-property
|
||||||
private static setAndroidStatusBarBackgroundProperty(v: view.View, newValue: any) {
|
private static setAndroidStatusBarBackgroundProperty(v: view.View, newValue: any) {
|
||||||
|
if (platform.device.sdkVersion >= "21") {
|
||||||
let window = app.android.startActivity.getWindow();
|
let window = app.android.startActivity.getWindow();
|
||||||
let nativeColor = new colorModule.Color(newValue).android;
|
let nativeColor = new colorModule.Color(newValue).android;
|
||||||
window.setStatusBarColor(nativeColor);
|
window.setStatusBarColor(nativeColor);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static resetAndroidStatusBarBackgroundProperty(v: view.View, nativeValue: any) {
|
private static resetAndroidStatusBarBackgroundProperty(v: view.View, nativeValue: any) {
|
||||||
|
if (platform.device.sdkVersion >= "21") {
|
||||||
let window = app.android.startActivity.getWindow();
|
let window = app.android.startActivity.getWindow();
|
||||||
let nativeColor = (nativeValue instanceof colorModule.Color) ? (<colorModule.Color>nativeValue).android : new colorModule.Color(nativeValue).android;
|
let nativeColor = (nativeValue instanceof colorModule.Color) ? (<colorModule.Color>nativeValue).android : new colorModule.Color(nativeValue).android;
|
||||||
window.setStatusBarColor(nativeColor);
|
window.setStatusBarColor(nativeColor);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static getAndroidStatusBarBackgroundProperty(v: view.View): any {
|
private static getAndroidStatusBarBackgroundProperty(v: view.View): any {
|
||||||
let page = <Page>v;
|
let page = <Page>v;
|
||||||
|
|||||||
Reference in New Issue
Block a user