|
|
@@ -49,9 +49,6 @@ public class FloatService extends Service implements View.OnClickListener {
|
|
|
|
|
|
//状态栏高度.
|
|
|
int statusBarHeight = -1;
|
|
|
- private Point mSize;
|
|
|
- private View mLeft;
|
|
|
- private View mRight;
|
|
|
|
|
|
//不与Activity进行绑定.
|
|
|
@Override
|
|
|
@@ -63,7 +60,6 @@ public class FloatService extends Service implements View.OnClickListener {
|
|
|
public void onCreate() {
|
|
|
super.onCreate();
|
|
|
Log.i(TAG, "MainService Created");
|
|
|
- mSize = DeviceInfo.getDeviceSize(this);
|
|
|
createToucher();
|
|
|
startTimer();
|
|
|
}
|
|
|
@@ -84,7 +80,14 @@ public class FloatService extends Service implements View.OnClickListener {
|
|
|
.subscribe(new Action1<Long>() {
|
|
|
@Override
|
|
|
public void call(Long aLong) {
|
|
|
+
|
|
|
Jump2View.getInstance().startAccessibility(getApplication());
|
|
|
+
|
|
|
+ }
|
|
|
+ }, new Action1<Throwable>() {
|
|
|
+ @Override
|
|
|
+ public void call(Throwable throwable) {
|
|
|
+ throwable.printStackTrace();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@@ -143,41 +146,10 @@ public class FloatService extends Service implements View.OnClickListener {
|
|
|
Log.i(TAG, "状态栏高度为:" + statusBarHeight);
|
|
|
|
|
|
//浮动窗口按钮.
|
|
|
- floaticon = (ImageView) mFloatwindow.findViewById(R.id.floate_icon);
|
|
|
- mLeft = mFloatwindow.findViewById(R.id.ll_info_left);
|
|
|
- mRight = mFloatwindow.findViewById(R.id.ll_info_right);
|
|
|
- ImageView imgCommitRight = (ImageView) mFloatwindow.findViewById(R.id.img_commit_right);
|
|
|
- ImageView imgCommitLeft = (ImageView) mFloatwindow.findViewById(R.id.img_commit_left);
|
|
|
- ImageView imgOpenRight = (ImageView) mFloatwindow.findViewById(R.id.img_open_right);
|
|
|
- ImageView imgOpenLeft = (ImageView) mFloatwindow.findViewById(R.id.img_open_left);
|
|
|
-
|
|
|
- imgCommitRight.setOnClickListener(this);
|
|
|
- imgCommitLeft.setOnClickListener(this);
|
|
|
- imgOpenRight.setOnClickListener(this);
|
|
|
- imgOpenLeft.setOnClickListener(this);
|
|
|
- floaticon.setOnClickListener(this);
|
|
|
-
|
|
|
- floaticon.setOnTouchListener(new View.OnTouchListener() {
|
|
|
- @Override
|
|
|
- public boolean onTouch(View v, MotionEvent event) {
|
|
|
- params.x = (int) event.getRawX() - 20;
|
|
|
- params.y = (int) event.getRawY() - 20 - statusBarHeight;
|
|
|
- mWm.updateViewLayout(mFloatwindow, params);
|
|
|
- switch (event.getAction()) {
|
|
|
- case MotionEvent.ACTION_UP:
|
|
|
- case MotionEvent.ACTION_CANCEL:
|
|
|
- int x = (int) event.getRawX();
|
|
|
- if (x > mSize.x / 2) {
|
|
|
- params.x = mSize.x;
|
|
|
- } else {
|
|
|
- params.x = 0;
|
|
|
- }
|
|
|
- mWm.updateViewLayout(mFloatwindow, params);
|
|
|
- break;
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
- });
|
|
|
+ floaticon = mFloatwindow.findViewById(R.id.floate_icon);
|
|
|
+ floaticon.setAlpha(0.0f);
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|