Skip to content

Commit

Permalink
update sample
Browse files Browse the repository at this point in the history
  • Loading branch information
王英豪 committed May 5, 2018
1 parent d59ae0c commit 23d9b73
Showing 1 changed file with 32 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,38 @@ public class BaseApplication extends Application {


private static final String TAG = "FloatWindow";

@Override
public void onCreate() {
super.onCreate();

ImageView imageView = new ImageView(getApplicationContext());
imageView.setImageResource(R.drawable.icon);

FloatWindow
.with(getApplicationContext())
.setView(imageView)
.setWidth(Screen.width, 0.2f) //设置悬浮控件宽高
.setHeight(Screen.width, 0.2f)
.setX(Screen.width, 0.8f)
.setY(Screen.height, 0.3f)
.setMoveType(MoveType.slide,100,-100)
.setMoveStyle(500, new BounceInterpolator())
.setFilter(true, A_Activity.class, C_Activity.class)
.setViewStateListener(mViewStateListener)
.setPermissionListener(mPermissionListener)
.setDesktopShow(true)
.build();


imageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(BaseApplication.this, "onClick", Toast.LENGTH_SHORT).show();
}
});
}

private PermissionListener mPermissionListener = new PermissionListener() {
@Override
public void onSuccess() {
Expand Down Expand Up @@ -72,38 +104,4 @@ public void onBackToDesktop() {
Log.d(TAG, "onBackToDesktop");
}
};

@Override
public void onCreate() {
super.onCreate();

ImageView imageView = new ImageView(getApplicationContext());
imageView.setImageResource(R.drawable.icon);

//效果图1
FloatWindow
.with(getApplicationContext())
.setView(imageView)
.setWidth(Screen.width, 0.2f) //设置悬浮控件宽高
.setHeight(Screen.width, 0.2f)
.setX(Screen.width, 0.8f)
.setY(Screen.height, 0.3f)
.setMoveType(MoveType.slide,100,-100)
.setMoveStyle(500, new BounceInterpolator())
.setFilter(true, A_Activity.class, C_Activity.class)
.setViewStateListener(mViewStateListener)
.setPermissionListener(mPermissionListener)
.setDesktopShow(true)
.build();

FloatWindow.get().isShowing();


imageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(BaseApplication.this, "onClick", Toast.LENGTH_SHORT).show();
}
});
}
}

0 comments on commit 23d9b73

Please sign in to comment.