forked from r0adkll/Slidr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Begun ground work on letting the developer submit a Configuration on …
…how the sliding mechanism works, such as it's touch size, slide start position (left, right, top, bottom), the status bar colors, and other small tweaks. reference to r0adkll#1
- Loading branch information
Showing
8 changed files
with
282 additions
and
11 deletions.
There are no files selected for viewing
Binary file not shown.
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
124 changes: 124 additions & 0 deletions
124
library/src/main/java/com/r0adkll/slidr/model/SlidrConfig.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,124 @@ | ||
package com.r0adkll.slidr.model; | ||
|
||
/** | ||
* This class contains the configuration information for all the options available in | ||
* this library | ||
* | ||
* Created by r0adkll on 1/12/15. | ||
*/ | ||
public class SlidrConfig { | ||
|
||
private int colorPrimary = -1; | ||
private int colorSecondary = -1; | ||
private SlidrPosition position = SlidrPosition.LEFT; | ||
private float touchSize = -1f; | ||
private float sensitivity = 1f; | ||
|
||
/** | ||
* Hidden Constructor | ||
* Use the builder pattern | ||
*/ | ||
private SlidrConfig(){} | ||
|
||
/** | ||
* Get the primary color that the slider will interpolate. That is this color is the color | ||
* of the status bar of the Activity you are returning to | ||
* | ||
* @return the primary status bar color | ||
*/ | ||
public int getPrimaryColor(){ | ||
return colorPrimary; | ||
} | ||
|
||
/** | ||
* Get the secondary color that the slider will interpolatel That is the color of the Activity | ||
* that you are making slidable | ||
* | ||
* @return the secondary status bar color | ||
*/ | ||
public int getSecondaryColor(){ | ||
return colorSecondary; | ||
} | ||
|
||
/** | ||
* Get the position of the slidable mechanism for this configuration. This is the position on | ||
* the screen that the user can swipe the activity away from | ||
* | ||
* @return the slider position | ||
*/ | ||
public SlidrPosition getPosition(){ | ||
return position; | ||
} | ||
|
||
/** | ||
* Get the touch 'width' to be used in the gesture detection. This value should incorporate with | ||
* the device's touch slop | ||
* | ||
* @return the touch area size | ||
*/ | ||
public float getTouchSize(){ | ||
return touchSize; | ||
} | ||
|
||
/** | ||
* Get the touch sensitivity set in the {@link android.support.v4.widget.ViewDragHelper} when | ||
* creating it. | ||
* | ||
* @return the touch sensitivity | ||
*/ | ||
public float getSensitivity(){ | ||
return sensitivity; | ||
} | ||
|
||
/** | ||
* Return whether or not the set status bar colors are valid | ||
* @return | ||
*/ | ||
public boolean areStatusBarColorsValid(){ | ||
return colorPrimary != -1 && colorSecondary != -1; | ||
} | ||
|
||
/** | ||
* The Builder for this configuration class. This is the only way to create a | ||
* configuration | ||
*/ | ||
public static class Builder{ | ||
|
||
private SlidrConfig config; | ||
|
||
public Builder(){ | ||
config = new SlidrConfig(); | ||
} | ||
|
||
public Builder setPrimaryColor(int color){ | ||
config.colorPrimary = color; | ||
return this; | ||
} | ||
|
||
public Builder setSecondaryColor(int color){ | ||
config.colorSecondary = color; | ||
return this; | ||
} | ||
|
||
public Builder setPosition(SlidrPosition position){ | ||
config.position = position; | ||
return this; | ||
} | ||
|
||
public Builder setTouchSize(float size){ | ||
config.touchSize = size; | ||
return this; | ||
} | ||
|
||
public Builder setSensitivity(float sensitivity){ | ||
config.sensitivity = sensitivity; | ||
return this; | ||
} | ||
|
||
public SlidrConfig build(){ | ||
return config; | ||
} | ||
|
||
} | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...ava/com/r0adkll/slidr/SlidrInterface.java → ...m/r0adkll/slidr/model/SlidrInterface.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package com.r0adkll.slidr; | ||
package com.r0adkll.slidr.model; | ||
|
||
/** | ||
* Created by r0adkll on 1/9/15. | ||
|
11 changes: 11 additions & 0 deletions
11
library/src/main/java/com/r0adkll/slidr/model/SlidrPosition.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,11 @@ | ||
package com.r0adkll.slidr.model; | ||
|
||
/** | ||
* Created by r0adkll on 1/12/15. | ||
*/ | ||
public enum SlidrPosition { | ||
LEFT, | ||
RIGHT, | ||
TOP, | ||
BOTTOM; | ||
} |
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