Skip to content

Commit 860c8d3

Browse files
committed
fix mode of FullScreen
1 parent 95ed031 commit 860c8d3

File tree

5 files changed

+30
-3
lines changed

5 files changed

+30
-3
lines changed

Drag-FlowLayout/app/src/main/java/com/heaven7/android/BaseActivity.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,16 @@ protected void onCreate(Bundle savedInstanceState) {
3838
mToaster = new Toaster(this);
3939
mViewHelper = new ViewHelper(getWindow().getDecorView());
4040

41+
onPreSetContentView();
4142
setContentView(getlayoutId());
4243
ButterKnife.inject(this);
4344

4445
initView();
4546
initData(savedInstanceState);
4647
}
4748

49+
protected void onPreSetContentView(){}
50+
4851
@Override
4952
protected void onStop() {
5053
super.onStop();

Drag-FlowLayout/app/src/main/java/com/heaven7/android/drag/demo/DragFlowLayoutTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import android.os.Bundle;
44
import android.support.annotation.NonNull;
55
import android.view.View;
6+
import android.view.WindowManager;
67
import android.widget.TextView;
78

89
import com.heaven7.android.BaseActivity;
@@ -11,6 +12,7 @@
1112
import com.heaven7.android.dragflowlayout.DragFlowLayout;
1213
import com.heaven7.android.dragflowlayout.IDraggable;
1314
import com.heaven7.android.dragflowlayout.IViewObserver;
15+
import com.heaven7.android.transition.TransitionProvider;
1416
import com.heaven7.core.util.Logger;
1517

1618
import butterknife.InjectView;
@@ -32,8 +34,16 @@ protected int getlayoutId() {
3234
return R.layout.ac_drag_flow_test2;
3335
}
3436

37+
@Override
38+
protected void onPreSetContentView() {
39+
//test full screen
40+
getWindow().setFlags(WindowManager.LayoutParams. FLAG_FULLSCREEN ,
41+
WindowManager.LayoutParams. FLAG_FULLSCREEN);
42+
}
43+
3544
@Override
3645
protected void initView() {
46+
mDragflowLayout.setLayoutTransition(TransitionProvider.createTransition(this));
3747
mDragflowLayout.setOnItemClickListener(new ClickToDeleteItemListenerImpl(R.id.iv_close){
3848
@Override
3949
protected void onDeleteSuccess(DragFlowLayout dfl, View child, Object data) {

Drag-FlowLayout/dragflowlayout/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ android {
77
defaultConfig {
88
minSdkVersion 11
99
targetSdkVersion 23
10-
versionCode 163
11-
versionName "1.6.3"
10+
versionCode 165
11+
versionName "1.6.5"
1212
}
1313
buildTypes {
1414
release {

Drag-FlowLayout/dragflowlayout/src/main/java/com/heaven7/android/dragflowlayout/AlertWindowHelper.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.heaven7.android.dragflowlayout;
22

3+
import android.app.Activity;
34
import android.content.Context;
45
import android.graphics.PixelFormat;
56
import android.view.Gravity;
@@ -18,6 +19,7 @@ public class AlertWindowHelper {
1819
private final WindowManager.LayoutParams mParams;
1920
private final float mTouchSlop;
2021
private final int mStateBarHeight;
22+
private final boolean mFullScreen;
2123

2224
private View mView;
2325
private ICallback mCallback;
@@ -42,6 +44,8 @@ public AlertWindowHelper(Context context) {
4244
this.mParams = createWindowParams();
4345
this.mStateBarHeight = ViewUtils.getStatusHeight(context);
4446
this.mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
47+
this.mFullScreen = context instanceof Activity && (((Activity) context).getWindow()
48+
.getAttributes().flags & WindowManager.LayoutParams.FLAG_FULLSCREEN ) != 0 ;
4549
}
4650

4751
public View getView() {
@@ -157,7 +161,7 @@ public void releaseView() {
157161
* @return the really y position
158162
*/
159163
private int adjustY(int top) {
160-
return top - mStateBarHeight;
164+
return mFullScreen ? top : top - mStateBarHeight;
161165
}
162166

163167
private boolean checkTouchSlop(float dx, float dy) {

Drag-FlowLayout/dragflowlayout/src/main/java/com/heaven7/android/dragflowlayout/DefaultDragCallback.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ public View create(Void aVoid) {
2626
parent, false);
2727
}
2828

29+
@Override
30+
public View obtain() {
31+
final View view = super.obtain();
32+
if(view.getParent()!=null){
33+
sDebugger.d("obtain","------ parent =" + view.getParent());
34+
return obtain();
35+
}
36+
return view;
37+
}
38+
2939
@Override
3040
protected void onRecycleSuccess(View view) {
3141
removeFromParent(view);

0 commit comments

Comments
 (0)