提交 dc9d323f 编写于 作者: 杜庆泉's avatar 杜庆泉

nativepage 部分报错问题修复

上级 c14b2986
...@@ -19,7 +19,7 @@ export class DoAppWidget extends AppWidgetProvider { ...@@ -19,7 +19,7 @@ export class DoAppWidget extends AppWidgetProvider {
appWidgetManager: AppWidgetManager, appWidgetManager: AppWidgetManager,
appWidgetIds: IntArray appWidgetIds: IntArray
):void{ ):void{
console.log("dqqdo", "周期更新函数被触发") console.log("周期更新函数被触发")
// There may be multiple widgets active, so update all of them // There may be multiple widgets active, so update all of them
for (appWidgetId in appWidgetIds) { for (appWidgetId in appWidgetIds) {
updateAppWidget(context, appWidgetManager, appWidgetId) updateAppWidget(context, appWidgetManager, appWidgetId)
...@@ -28,12 +28,12 @@ export class DoAppWidget extends AppWidgetProvider { ...@@ -28,12 +28,12 @@ export class DoAppWidget extends AppWidgetProvider {
override onEnabled(_context: Context):void{ override onEnabled(_context: Context):void{
// Enter relevant functionality for when the first widget is created // Enter relevant functionality for when the first widget is created
console.log("dqqdo", "桌面组件被添加") console.log("桌面组件被添加")
} }
override onDisabled(_context: Context):void{ override onDisabled(_context: Context):void{
// Enter relevant functionality for when the last widget is disabled // Enter relevant functionality for when the last widget is disabled
console.log("dqqdo", "桌面组件被移除") console.log("桌面组件被移除")
} }
} }
......
...@@ -23,10 +23,7 @@ import { ...@@ -23,10 +23,7 @@ import {
import Service from 'android.app.Service'; import Service from 'android.app.Service';
import System from 'java.lang.System'; import System from 'java.lang.System';
import Looper from 'android.os.Looper';
import Class from 'java.lang.Class';
import Exception from 'java.lang.Exception'; import Exception from 'java.lang.Exception';
import PackageManager from 'android.content.pm.PackageManager';
import ResolveInfo from 'android.content.pm.ResolveInfo'; import ResolveInfo from 'android.content.pm.ResolveInfo';
import RecyclerView from 'androidx.recyclerview.widget.RecyclerView'; import RecyclerView from 'androidx.recyclerview.widget.RecyclerView';
import TextView from 'android.widget.TextView'; import TextView from 'android.widget.TextView';
...@@ -195,9 +192,10 @@ class CustomThread extends Thread{ ...@@ -195,9 +192,10 @@ class CustomThread extends Thread{
class FruitAdapter extends RecyclerView.Adapter<FruitAdapter.ViewHolder>{ class FruitAdapter extends RecyclerView.Adapter<FruitAdapter.ViewHolder>{
mFruitList: Array<String> mFruitList: Array<String> = []
constructor(param:Array<String>){ constructor(param:Array<String>){
super()
mFruitList = param mFruitList = param
} }
...@@ -240,24 +238,24 @@ class DemoActivity extends Activity{ ...@@ -240,24 +238,24 @@ class DemoActivity extends Activity{
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
this.setContentView(R.layout.demo_activity); this.setContentView(R.layout.demo_activity);
let btn_start_service_front = findViewById<Button>(R.id.btn_start_service_front); let btn_start_service_front = this.findViewById<Button>(R.id.btn_start_service_front);
btn_start_service_front.setOnClickListener(new StartServiceListener()); btn_start_service_front.setOnClickListener(new StartServiceListener());
let btn_start_screen_listen = findViewById<Button>(R.id.btn_start_screen_listen); let btn_start_screen_listen = this.findViewById<Button>(R.id.btn_start_screen_listen);
btn_start_screen_listen.setOnClickListener(new StartBroadcastListener()); btn_start_screen_listen.setOnClickListener(new StartBroadcastListener());
let btn_start_thread = findViewById<Button>(R.id.btn_start_thread); let btn_start_thread = this.findViewById<Button>(R.id.btn_start_thread);
btn_start_thread.setOnClickListener(new StartThreadListener()); btn_start_thread.setOnClickListener(new StartThreadListener());
let btn_finish_activity = findViewById<Button>(R.id.btn_finish_activity); let btn_finish_activity = this.findViewById<Button>(R.id.btn_finish_activity);
btn_finish_activity.setOnClickListener(new ActivityFinishListener(this)); btn_finish_activity.setOnClickListener(new ActivityFinishListener(this));
let recyclerView = findViewById<RecyclerView>(R.id.recycler_view) let recyclerView = this.findViewById<RecyclerView>(R.id.recycler_view)
let layoutManager = LinearLayoutManager(this); let layoutManager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(layoutManager); recyclerView.setLayoutManager(layoutManager);
let fruitAdapter = FruitAdapter(arrayListOf("香蕉","苹果","大鸭梨")); let fruitAdapter = new FruitAdapter(arrayListOf("香蕉","苹果","大鸭梨"));
recyclerView.setAdapter(fruitAdapter); recyclerView.setAdapter(fruitAdapter);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册