Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit014e812

Browse files
committed
Sample app for testing Android events. Test thenativescript-vue#185 issue
1 parentbb265bd commit014e812

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
constVue=require('./nativescript-vue')
2+
constapplication=require('tns-core-modules/application')
3+
constplatform=require('tns-core-modules/platform')
4+
5+
Vue.config.silent=false
6+
Vue.config.debug=true
7+
8+
newVue({
9+
template:`
10+
<Frame>
11+
<Page>
12+
<ActionBar title="Android Event Test" />
13+
<StackLayout>
14+
<Label text="Event List:" />
15+
<ListView class="m-t-10" for="event in androidEvents">
16+
<v-template>
17+
<Label :text="event.eventName" />
18+
</v-template>
19+
</ListView>
20+
<StackLayout class="m-t-10" orientation="horizontal">
21+
<Label text="Switch for checking responsiveness" />
22+
<Switch v-model="switchValue" />
23+
</StackLayout>
24+
</StackLayout>
25+
</Page>
26+
</Frame>
27+
`,
28+
data:{
29+
androidEvents:[],
30+
switchValue:false
31+
},
32+
created(){
33+
if(platform.isAndroid){
34+
consteventTypes=[
35+
application.AndroidApplication.activityCreatedEvent,
36+
application.AndroidApplication.activityDestroyedEvent,
37+
application.AndroidApplication.activityStartedEvent,
38+
application.AndroidApplication.activityPausedEvent,
39+
application.AndroidApplication.activityResumedEvent,
40+
application.AndroidApplication.activityStoppedEvent,
41+
application.AndroidApplication.saveActivityStateEvent,
42+
application.AndroidApplication.activityResultEvent,
43+
application.AndroidApplication.activityBackPressedEvent
44+
]
45+
for(leti=0;i<eventTypes.length;i++){
46+
application.android.on(eventTypes[i],event=>{
47+
console.log(`Event:${event.eventName}, Activity:${event.activity}`)
48+
this.androidEvents.push(event)
49+
})
50+
}
51+
}
52+
}
53+
}).$start()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp