-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:ppamorim/Dragger
- Loading branch information
Showing
18 changed files
with
393 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
app/src/main/java/com/github/ppamorim/dragger/LazyActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.github.ppamorim.dragger; | ||
|
||
import android.os.Bundle; | ||
import android.os.Handler; | ||
import butterknife.ButterKnife; | ||
import com.github.ppamorim.dragger.app.R; | ||
|
||
public class LazyActivity extends LazyDraggerActivity { | ||
|
||
@Override public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.layout_content); | ||
ButterKnife.inject(this); | ||
} | ||
|
||
@Override protected void onPostCreate(Bundle savedInstanceState) { | ||
super.onPostCreate(savedInstanceState); | ||
new Handler().postDelayed(new Runnable() { | ||
@Override public void run() { | ||
expand(); | ||
} | ||
}, 1000); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<com.github.ppamorim.dragger.LazyDraggerView xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:dragger_layout="http://schemas.android.com/apk/res-auto" | ||
android:id="@+id/dragger_view" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
dragger_layout:shadow_view_id="@+id/shadow_view" | ||
dragger_layout:drag_view_id="@+id/drag_view"> | ||
|
||
<FrameLayout | ||
android:id="@+id/shadow_view" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:visibility="invisible"/> | ||
|
||
<FrameLayout | ||
android:id="@+id/drag_view" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"/> | ||
|
||
</com.github.ppamorim.dragger.LazyDraggerView> |
19 changes: 19 additions & 0 deletions
19
dragger/src/main/java/com/github/ppamorim/dragger/BaseDraggerActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.github.ppamorim.dragger; | ||
|
||
import android.support.v7.app.AppCompatActivity; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
|
||
public class BaseDraggerActivity extends AppCompatActivity { | ||
|
||
public int shadowResID = -1; | ||
|
||
public void setShadowView(int shadowResID) { | ||
this.shadowResID = shadowResID; | ||
} | ||
|
||
public View inflateLayout(int layoutResID) { | ||
return LayoutInflater.from(this).inflate(layoutResID, null); | ||
} | ||
|
||
} |
68 changes: 68 additions & 0 deletions
68
dragger/src/main/java/com/github/ppamorim/dragger/BaseDraggerPanel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package com.github.ppamorim.dragger; | ||
|
||
import android.content.Context; | ||
import android.content.res.TypedArray; | ||
import android.util.AttributeSet; | ||
import android.view.View; | ||
import android.widget.FrameLayout; | ||
|
||
public class BaseDraggerPanel extends FrameLayout { | ||
|
||
private static final float DEFAULT_DRAG_LIMIT = 0.5f; | ||
private static final int DEFAULT_DRAG_POSITION = DraggerPosition.TOP.ordinal(); | ||
|
||
public TypedArray attributes; | ||
public float draggerLimit; | ||
public int draggerPosition; | ||
|
||
public FrameLayout dragView; | ||
public FrameLayout shadowView; | ||
|
||
public BaseDraggerPanel(Context context) { | ||
super(context); | ||
} | ||
|
||
public BaseDraggerPanel(Context context, AttributeSet attrs) { | ||
super(context, attrs); | ||
} | ||
|
||
public BaseDraggerPanel(Context context, AttributeSet attrs, int defStyle) { | ||
super(context, attrs, defStyle); | ||
} | ||
|
||
/** | ||
* Apply all the custom view configuration and inflate the main view. The view won't be | ||
* visible if this method is not called. | ||
*/ | ||
public void initializeView(int layoutId) { | ||
inflate(getContext(), layoutId, this); | ||
dragView = (FrameLayout) findViewById(R.id.drag_view); | ||
shadowView = (FrameLayout) findViewById(R.id.shadow_view); | ||
} | ||
|
||
public void addViewOnShadow(View view) { | ||
eraseViewIfNeeded(shadowView); | ||
shadowView.addView(view); | ||
} | ||
|
||
public void addViewOnDrag(View view) { | ||
eraseViewIfNeeded(dragView); | ||
dragView.addView(view); | ||
} | ||
|
||
public void eraseViewIfNeeded(FrameLayout frameLayout) { | ||
if (frameLayout.getChildCount() > 0) { | ||
frameLayout.removeAllViews(); | ||
} | ||
} | ||
|
||
public void initializeAttributes(AttributeSet attrs) { | ||
attributes = getContext().obtainStyledAttributes(attrs, R.styleable.dragger_layout); | ||
if (attributes != null) { | ||
draggerLimit = attributes.getFloat(R.styleable.dragger_layout_drag_limit, DEFAULT_DRAG_LIMIT); | ||
draggerPosition = | ||
attributes.getInt(R.styleable.dragger_layout_drag_position, DEFAULT_DRAG_POSITION); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.