diff --git a/app/src/main/java/com/bell/floatlayoutdemo/MainService.java b/app/src/main/java/com/bell/floatlayoutdemo/MainService.java index 772bb10..8eb66c6 100644 --- a/app/src/main/java/com/bell/floatlayoutdemo/MainService.java +++ b/app/src/main/java/com/bell/floatlayoutdemo/MainService.java @@ -37,6 +37,9 @@ //状态栏高度. int statusBarHeight = -1; + //扩展的变量数 + int value = 0; + //不与Activity进行绑定. @Override public IBinder onBind(Intent intent) @@ -126,6 +129,9 @@ toucherLayout.findViewById(R.id.float_900).setOnClickListener(this); toucherLayout.findViewById(R.id.float_200).setOnClickListener(this); + toucherLayout.findViewById(R.id.add_50).setOnClickListener(this); + toucherLayout.findViewById(R.id.sub_50).setOnClickListener(this); + toucherLayout.findViewById(R.id.channel).setOnClickListener(this); /*imageButton1.setOnTouchListener(new View.OnTouchListener() { @@ -152,6 +158,12 @@ @Override public void onClick(View view) { switch (view.getId()){ + case R.id.add_50: + value+=50; + break; + case R.id.sub_50: + value-=50; + break; case R.id.float_200: ShellUtil.execShellCmd(getShellStr(200)); break; @@ -189,7 +201,8 @@ int r1 = getRadomInt(); int x1 = 700+r1; int y1 = 1800+r1; - int m1 = m+r1; + int m1 = m+value+r1; + value = 0; return "input swipe "+x1+" "+y1+" "+x1+" "+y1+" "+m1+""; } public int getRadomInt(){