Skip to content

Commit 0e5dcc6

Browse files
committed
test: demo app update
1 parent c72d7b9 commit 0e5dcc6

File tree

8 files changed

+32
-7
lines changed

8 files changed

+32
-7
lines changed

demo-vue/app/App_Resources/Android/app.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
android {
33
defaultConfig {
44
generatedDensities = []
5-
applicationId = "org.nativescript.demovuematerial"
5+
multiDexEnabled true
6+
applicationId = "org.nativescript.demovuematerial"
67

78
//override supported platforms
89
// ndk {

demo-vue/app/App_Resources/Android/values/styles.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<resources xmlns:android="http://schemas.android.com/apk/res/android">
33

44
<!-- theme to use FOR launch screen-->
5-
<style name="LaunchScreenThemeBase" parent="Theme.MaterialComponents.Light.NoActionBar">
5+
<style name="LaunchScreenThemeBase" parent="Theme.MaterialComponents.DayNight.NoActionBar">
66
<item name="toolbarStyle">@style/NativeScriptToolbarStyle</item>
77

88
<item name="colorPrimary">@color/ns_primary</item>
@@ -20,7 +20,7 @@
2020
</style>
2121

2222
<!-- theme to use AFTER launch screen is loaded-->
23-
<style name="AppThemeBase" parent="Theme.MaterialComponents.Light.NoActionBar">
23+
<style name="AppThemeBase" parent="Theme.MaterialComponents.DayNight.NoActionBar">
2424
<item name="toolbarStyle">@style/NativeScriptToolbarStyle</item>
2525

2626
<item name="colorPrimary">@color/ns_primary</item>

demo-vue/app/app.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
font-family: $mdi-fontFamily;
33
}
44

5+
label {
6+
color:black;
7+
.ns-dark & {
8+
color: red;
9+
}
10+
}
511
mdbutton,MDFloatingActionButton, MDCardView {
612
shape: cut;
713
}

demo-vue/app/main.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import BottomNavigationBarPlugin from '@nativescript-community/ui-material-botto
1919
import TabsPlugin from '@nativescript-community/ui-material-tabs/vue';
2020
import BottomNavigationPlugin from '@nativescript-community/ui-material-bottom-navigation/vue';
2121
import SpeedDialPlugin from '@nativescript-community/ui-material-speeddial/vue';
22+
import Theme from '@nativescript-community/css-theme';
2223

2324
installBottomSheet();
2425

@@ -56,8 +57,17 @@ themer.createShape('cut', {
5657
unit: '%'
5758
}
5859
});
60+
61+
if (global.isAndroid) {
62+
Application.on(Application.displayedEvent, () => {
63+
Theme.setMode(Theme.Auto);
64+
androidx.appcompat.app.AppCompatDelegate.setDefaultNightMode(androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
65+
});
66+
}
67+
5968
// import { getExamples } from './examples';
6069
import * as views from './views';
70+
import { Application } from '@nativescript/core';
6171

6272
// for (let item of getExamples()) {
6373
// Vue.component(item.component.name, item.component);

demo-vue/app/views/Home.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Application } from '@nativescript/core';
12
import { getExamples } from '../examples';
23

34
export default {
@@ -23,6 +24,11 @@ export default {
2324
examples: getExamples()
2425
};
2526
},
27+
mounted() {
28+
Application.on(Application.systemAppearanceChangedEvent, (event) => {
29+
this.$refs?.listView?.nativeView?.refresh();
30+
});
31+
},
2632
methods: {
2733
async goToExample(item) {
2834
console.log('goToExample', item.title);

demo-vue/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"main": "app/main",
66
"dependencies": {
77
"@mdi/font": "5.9.55",
8-
"@nativescript/core": "8.0.5",
8+
"@nativescript-community/css-theme": "^1.2.7",
99
"@nativescript-community/text": "1.4.11",
1010
"@nativescript-community/ui-material-activityindicator": "file:../packages/activityindicator",
1111
"@nativescript-community/ui-material-bottom-navigation": "file:../packages/bottom-navigation",
@@ -24,6 +24,7 @@
2424
"@nativescript-community/ui-material-tabs": "file:../packages/tabs",
2525
"@nativescript-community/ui-material-textfield": "file:../packages/textfield",
2626
"@nativescript-community/ui-material-textview": "file:../packages/textview",
27+
"@nativescript/core": "8.0.5",
2728
"@nativescript/iqkeyboardmanager": "^2.0.0",
2829
"@nativescript/theme": "3.0.1",
2930
"nativescript-vue": "~2.9.0",
@@ -39,7 +40,7 @@
3940
"sass-loader": "^11.0.1",
4041
"scss-symbols-parser": "^2.0.1",
4142
"string-replace-loader": "^3.0.1",
42-
"tns-ios":"6.5.4",
43+
"tns-ios": "6.5.4",
4344
"typescript": "^4.2.4",
4445
"vue": "^2.6.12",
4546
"vue-i18n": "^8.24.1",

src/bottom-navigation/index.android.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ export class BottomNavigation extends TabNavigationBase {
403403
// _onAttachedToWindow called from OS again after it was detach
404404
// still happens with androidx.fragment:1.3.2
405405
const activity = Application.android.foregroundActivity;
406-
if ((this._manager && this._manager.isDestroyed()) || !activity.getLifecycle().getCurrentState().isAtLeast(androidx.lifecycle.Lifecycle.State.STARTED)) {
406+
if ((this._manager && this._manager.isDestroyed()) || !activity.getLifecycle?.().getCurrentState().isAtLeast(androidx.lifecycle.Lifecycle.State.STARTED)) {
407407
return;
408408
}
409409

@@ -527,6 +527,7 @@ export class BottomNavigation extends TabNavigationBase {
527527

528528
//@ts-ignore
529529
const fragmentManager = this._getRootFragmentManager();
530+
console.log();
530531
let fragment: androidx.fragment.app.Fragment = fragmentManager.findFragmentByTag(name);
531532
if (fragment != null) {
532533
this.attachFragment(fragment);

src/tabs/tabs.android.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ export class Tabs extends TabsBase {
513513
// _onAttachedToWindow called from OS again after it was detach
514514
// still happens with androidx.fragment:1.3.2
515515
const activity = Application.android.foregroundActivity;
516-
if ((this._manager && this._manager.isDestroyed()) || !activity.getLifecycle().getCurrentState().isAtLeast(androidx.lifecycle.Lifecycle.State.STARTED)) {
516+
if ((this._manager && this._manager.isDestroyed()) || !activity.getLifecycle?.().getCurrentState().isAtLeast(androidx.lifecycle.Lifecycle.State.STARTED)) {
517517
return;
518518
}
519519

0 commit comments

Comments
 (0)