Skip to content

Commit

Permalink
fix mode of FullScreen
Browse files Browse the repository at this point in the history
  • Loading branch information
LightSun committed Sep 5, 2016
1 parent 95ed031 commit 860c8d3
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,16 @@ protected void onCreate(Bundle savedInstanceState) {
mToaster = new Toaster(this);
mViewHelper = new ViewHelper(getWindow().getDecorView());

onPreSetContentView();
setContentView(getlayoutId());
ButterKnife.inject(this);

initView();
initData(savedInstanceState);
}

protected void onPreSetContentView(){}

@Override
protected void onStop() {
super.onStop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.View;
import android.view.WindowManager;
import android.widget.TextView;

import com.heaven7.android.BaseActivity;
Expand All @@ -11,6 +12,7 @@
import com.heaven7.android.dragflowlayout.DragFlowLayout;
import com.heaven7.android.dragflowlayout.IDraggable;
import com.heaven7.android.dragflowlayout.IViewObserver;
import com.heaven7.android.transition.TransitionProvider;
import com.heaven7.core.util.Logger;

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

@Override
protected void onPreSetContentView() {
//test full screen
getWindow().setFlags(WindowManager.LayoutParams. FLAG_FULLSCREEN ,
WindowManager.LayoutParams. FLAG_FULLSCREEN);
}

@Override
protected void initView() {
mDragflowLayout.setLayoutTransition(TransitionProvider.createTransition(this));
mDragflowLayout.setOnItemClickListener(new ClickToDeleteItemListenerImpl(R.id.iv_close){
@Override
protected void onDeleteSuccess(DragFlowLayout dfl, View child, Object data) {
Expand Down
4 changes: 2 additions & 2 deletions Drag-FlowLayout/dragflowlayout/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
defaultConfig {
minSdkVersion 11
targetSdkVersion 23
versionCode 163
versionName "1.6.3"
versionCode 165
versionName "1.6.5"
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.heaven7.android.dragflowlayout;

import android.app.Activity;
import android.content.Context;
import android.graphics.PixelFormat;
import android.view.Gravity;
Expand All @@ -18,6 +19,7 @@ public class AlertWindowHelper {
private final WindowManager.LayoutParams mParams;
private final float mTouchSlop;
private final int mStateBarHeight;
private final boolean mFullScreen;

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

public View getView() {
Expand Down Expand Up @@ -157,7 +161,7 @@ public void releaseView() {
* @return the really y position
*/
private int adjustY(int top) {
return top - mStateBarHeight;
return mFullScreen ? top : top - mStateBarHeight;
}

private boolean checkTouchSlop(float dx, float dy) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ public View create(Void aVoid) {
parent, false);
}

@Override
public View obtain() {
final View view = super.obtain();
if(view.getParent()!=null){
sDebugger.d("obtain","------ parent =" + view.getParent());
return obtain();
}
return view;
}

@Override
protected void onRecycleSuccess(View view) {
removeFromParent(view);
Expand Down

0 comments on commit 860c8d3

Please sign in to comment.