diff --git a/app/src/main/java/com/willowtreeapps/spurceexampleapp/fragments/ViewFragment.java b/app/src/main/java/com/willowtreeapps/spurceexampleapp/fragments/ViewFragment.java index 8c5d8a2..51a948b 100644 --- a/app/src/main/java/com/willowtreeapps/spurceexampleapp/fragments/ViewFragment.java +++ b/app/src/main/java/com/willowtreeapps/spurceexampleapp/fragments/ViewFragment.java @@ -38,6 +38,7 @@ import android.widget.ArrayAdapter; import android.widget.CheckBox; import android.widget.CompoundButton; +import android.widget.EditText; import android.widget.GridLayout; import android.widget.LinearLayout; import android.widget.RadioGroup; @@ -88,6 +89,7 @@ public class ViewFragment extends Fragment implements RadioGroupGridLayout.OnCha private LinearLayout horizontalWeightLayout; private TextView animationEndText; private TextView seekBarTitle; + private EditText codeSample; private List children = new ArrayList<>(); private Animator[] animators; @@ -114,6 +116,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, @Nullable sortDropDown = (Spinner) container.findViewById(R.id.sort_selection); animationEndText = (TextView) container.findViewById(R.id.animation_end); seekBarTitle = (TextView) container.findViewById(R.id.seek_bar_title); + codeSample = (EditText) container.findViewById(R.id.code_sample); final int CHILD_VIEW_COUNT = parent.getColumnCount() * parent.getRowCount(); for (int i = 0; i < CHILD_VIEW_COUNT; i++) { @@ -363,14 +366,23 @@ private void setupSort() { switch (sortDropDown.getSelectedItemPosition()) { case DEFAULT_SORT: sortFunction = new DefaultSort(seekBar.getProgress()); + codeSample.setText(String.format(getResources().getString(R.string.default_sort_code), seekBar.getProgress())); break; case CORNERED_SORT: sortFunction = new CorneredSort(seekBar.getProgress(), linearReversed.isChecked(), corner); + codeSample.setText(String.format(getResources().getString(R.string.cornered_sort_code), + seekBar.getProgress(), + String.valueOf(linearReversed.isChecked()), + corner)); break; case CONTINUOUS_SORT: sortFunction = new ContinuousSort(seekBar.getProgress() * /*timePaddingOffset=*/20, linearReversed.isChecked(), positionalRadioGroup.getPosition()); + codeSample.setText(String.format(getResources().getString(R.string.continuous_sort_code), + seekBar.getProgress() * /*timePaddingOffset=*/20, + String.valueOf(linearReversed.isChecked()), + positionalRadioGroup.getPosition())); break; case CONTINUOUS_WEIGHTED_SORT: sortFunction = new ContinuousWeightedSort(seekBar.getProgress() * /*timePaddingOffset=*/20, @@ -378,21 +390,40 @@ private void setupSort() { positionalRadioGroup.getPosition(), horizontalWeight, verticalWeight); + codeSample.setText(String.format(getResources().getString(R.string.continuous_weighted_sort_code), + seekBar.getProgress() * /*timePaddingOffset=*/20, + String.valueOf(linearReversed.isChecked()), + positionalRadioGroup.getPosition(), + String.valueOf(horizontalWeight), + String.valueOf(verticalWeight))); break; case INLINE_SORT: sortFunction = new InlineSort(seekBar.getProgress(), linearReversed.isChecked(), corner); + codeSample.setText(String.format(getResources().getString(R.string.inline_sort_code), + seekBar.getProgress(), + String.valueOf(linearReversed.isChecked()), + corner)); break; case LINEAR_SORT: sortFunction = new LinearSort(seekBar.getProgress(), linearReversed.isChecked(), direction); + codeSample.setText(String.format(getResources().getString(R.string.linear_sort_code), + seekBar.getProgress(), + String.valueOf(linearReversed.isChecked()), + direction)); break; case RADIAL_SORT: sortFunction = new RadialSort(seekBar.getProgress(), linearReversed.isChecked(), positionalRadioGroup.getPosition()); + codeSample.setText(String.format(getResources().getString(R.string.radial_sort_code), seekBar.getProgress(), + String.valueOf(linearReversed.isChecked()), + positionalRadioGroup.getPosition())); break; case RANDOM_SORT: sortFunction = new RandomSort(seekBar.getProgress()); + codeSample.setText(String.format(getResources().getString(R.string.random_sort_code), seekBar.getProgress())); break; default: sortFunction = new DefaultSort(seekBar.getProgress()); + codeSample.setText(String.format(getResources().getString(R.string.default_sort_code), seekBar.getProgress())); break; } diff --git a/app/src/main/res/drawable/code_sample_background.xml b/app/src/main/res/drawable/code_sample_background.xml new file mode 100644 index 0000000..7366861 --- /dev/null +++ b/app/src/main/res/drawable/code_sample_background.xml @@ -0,0 +1,28 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_fragment.xml b/app/src/main/res/layout/activity_fragment.xml index 20eea4e..d0fa366 100644 --- a/app/src/main/res/layout/activity_fragment.xml +++ b/app/src/main/res/layout/activity_fragment.xml @@ -150,6 +150,23 @@ + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ce5b944..cecd216 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -69,4 +69,15 @@ Sort Function selection Select Cancel + + + Code Sample + new DefaultSort(%1$d); + new CorneredSort(%1$d, %2$s, CorneredSort.Corner.%3$s); + new ContinuousSort(%1$d, %2$s, RadialSort.Position.%3$s); + new ContinuousWeightedSort(%1$d, %2$s, RadialSort.Position.%3$s, %4$s, %5$s); + new InlineSort(%1$d, %2$s, CorneredSort.Corner.%3$s); + new LinearSort(%1$d, %2$s, LinearSort.Direction.%3$s); + new RadialSort(%1$d, %2$s, RadialSort.Position.%3$s); + new RandomSort(%1$d); diff --git a/docs/index-all.html b/docs/index-all.html new file mode 100644 index 0000000..053c30e --- /dev/null +++ b/docs/index-all.html @@ -0,0 +1,363 @@ + + + + + +Index (lib API) + + + + + + + + +
+ + + + + + + +
+ + +
A C D F G H I L M R S V  + + +

A

+
+
animateWith(Animator...) - Method in class com.willowtreeapps.spruce.Spruce.SpruceBuilder
+
+
Apply one to many animations to the ViewGroup
+
+
+ + + +

C

+
+
com.willowtreeapps.spruce - package com.willowtreeapps.spruce
+
 
+
com.willowtreeapps.spruce.animation - package com.willowtreeapps.spruce.animation
+
 
+
com.willowtreeapps.spruce.sort - package com.willowtreeapps.spruce.sort
+
 
+
ContinuousSort - Class in com.willowtreeapps.spruce.sort
+
 
+
ContinuousSort(long, boolean, RadialSort.Position) - Constructor for class com.willowtreeapps.spruce.sort.ContinuousSort
+
+
Establishes the delay between object animations and their starting position based on distance, + delay, and a value from the Position enum
+
+
ContinuousWeightedSort - Class in com.willowtreeapps.spruce.sort
+
 
+
ContinuousWeightedSort(long, boolean, RadialSort.Position, double, double) - Constructor for class com.willowtreeapps.spruce.sort.ContinuousWeightedSort
+
+
Establishes a weighted delay between object animations and their starting position based on distance, + delay, a value from the Position enum, a horizontal value of Weight and + a vertical Weight value from the Weight enum
+
+
CorneredSort - Class in com.willowtreeapps.spruce.sort
+
 
+
CorneredSort(long, boolean, CorneredSort.Corner) - Constructor for class com.willowtreeapps.spruce.sort.CorneredSort
+
+
Animates views in a corner like fashion.
+
+
CorneredSort.Corner - Enum in com.willowtreeapps.spruce.sort
+
 
+
+ + + +

D

+
+
DefaultAnimations - Class in com.willowtreeapps.spruce.animation
+
+
Convenience methods for retrieving default view animators
+
+
DefaultAnimations() - Constructor for class com.willowtreeapps.spruce.animation.DefaultAnimations
+
 
+
DefaultSort - Class in com.willowtreeapps.spruce.sort
+
 
+
DefaultSort(long) - Constructor for class com.willowtreeapps.spruce.sort.DefaultSort
+
+
Default sort; handles views with a provided offset delay
+
+
+ + + +

F

+
+
fadeAwayAnimator(View, long) - Static method in class com.willowtreeapps.spruce.animation.DefaultAnimations
+
 
+
fadeInAnimator(View, long) - Static method in class com.willowtreeapps.spruce.animation.DefaultAnimations
+
 
+
+ + + +

G

+
+
getDistanceBetweenPoints(PointF, PointF) - Method in class com.willowtreeapps.spruce.sort.LinearSort
+
 
+
getDistancePoint(ViewGroup, List<View>) - Method in class com.willowtreeapps.spruce.sort.CorneredSort
+
 
+
getDistancePoint(ViewGroup, List<View>) - Method in class com.willowtreeapps.spruce.sort.LinearSort
+
 
+
getDistancePoint(ViewGroup, List<View>) - Method in class com.willowtreeapps.spruce.sort.RadialSort
+
 
+
getTimeOffset() - Method in class com.willowtreeapps.spruce.sort.SpruceTimedView
+
 
+
getView() - Method in class com.willowtreeapps.spruce.sort.SpruceTimedView
+
 
+
getViewListWithTimeOffsets(ViewGroup, List<View>) - Method in class com.willowtreeapps.spruce.sort.ContinuousSort
+
 
+
getViewListWithTimeOffsets(ViewGroup, List<View>) - Method in class com.willowtreeapps.spruce.sort.ContinuousWeightedSort
+
 
+
getViewListWithTimeOffsets(ViewGroup, List<View>) - Method in class com.willowtreeapps.spruce.sort.CorneredSort
+
 
+
getViewListWithTimeOffsets(ViewGroup, List<View>) - Method in class com.willowtreeapps.spruce.sort.DefaultSort
+
 
+
getViewListWithTimeOffsets(ViewGroup, List<View>) - Method in class com.willowtreeapps.spruce.sort.InlineSort
+
 
+
getViewListWithTimeOffsets(ViewGroup, List<View>) - Method in class com.willowtreeapps.spruce.sort.LinearSort
+
 
+
getViewListWithTimeOffsets(ViewGroup, List<View>) - Method in class com.willowtreeapps.spruce.sort.RandomSort
+
 
+
getViewListWithTimeOffsets(ViewGroup, List<View>) - Method in class com.willowtreeapps.spruce.sort.SortFunction
+
+
Get a list of SpruceTimedView
+
+
growAnimator(View, long) - Static method in class com.willowtreeapps.spruce.animation.DefaultAnimations
+
 
+
+ + + +

H

+
+
HEAVY_WEIGHT - Static variable in class com.willowtreeapps.spruce.sort.ContinuousWeightedSort
+
 
+
+ + + +

I

+
+
InlineSort - Class in com.willowtreeapps.spruce.sort
+
 
+
InlineSort(long, boolean, CorneredSort.Corner) - Constructor for class com.willowtreeapps.spruce.sort.InlineSort
+
+
Animate child views from side to side (based on the provided corner parameter).
+
+
+ + + +

L

+
+
LIGHT_WEIGHT - Static variable in class com.willowtreeapps.spruce.sort.ContinuousWeightedSort
+
 
+
LinearSort - Class in com.willowtreeapps.spruce.sort
+
 
+
LinearSort(long, boolean, LinearSort.Direction) - Constructor for class com.willowtreeapps.spruce.sort.LinearSort
+
+
Establishes the delay between object animations and their direction based on distance, + delay, and a value from the Direction enum
+
+
LinearSort.Direction - Enum in com.willowtreeapps.spruce.sort
+
 
+
+ + + +

M

+
+
MEDIUM_WEIGHT - Static variable in class com.willowtreeapps.spruce.sort.ContinuousWeightedSort
+
 
+
+ + + +

R

+
+
RadialSort - Class in com.willowtreeapps.spruce.sort
+
 
+
RadialSort(long, boolean, RadialSort.Position) - Constructor for class com.willowtreeapps.spruce.sort.RadialSort
+
+
Establishes the delay between object animations and their starting position based on distance, + delay, and a value from the Position enum
+
+
RadialSort.Position - Enum in com.willowtreeapps.spruce.sort
+
 
+
RandomSort - Class in com.willowtreeapps.spruce.sort
+
 
+
RandomSort(long) - Constructor for class com.willowtreeapps.spruce.sort.RandomSort
+
+
Random sort pattern that utilizes shuffle()
+
+
+ + + +

S

+
+
shrinkAnimator(View, long) - Static method in class com.willowtreeapps.spruce.animation.DefaultAnimations
+
 
+
SortFunction - Class in com.willowtreeapps.spruce.sort
+
 
+
SortFunction() - Constructor for class com.willowtreeapps.spruce.sort.SortFunction
+
 
+
sortWith(SortFunction) - Method in class com.willowtreeapps.spruce.Spruce.SpruceBuilder
+
+
SortFunction to animate the ViewGroup
+
+
spinAnimator(View, long) - Static method in class com.willowtreeapps.spruce.animation.DefaultAnimations
+
 
+
Spruce - Class in com.willowtreeapps.spruce
+
 
+
Spruce.SpruceBuilder - Class in com.willowtreeapps.spruce
+
 
+
SpruceBuilder(ViewGroup) - Constructor for class com.willowtreeapps.spruce.Spruce.SpruceBuilder
+
+
SpruceBuilder constructor that takes a ViewGroup
+
+
SpruceTimedView - Class in com.willowtreeapps.spruce.sort
+
 
+
SpruceTimedView(View, long) - Constructor for class com.willowtreeapps.spruce.sort.SpruceTimedView
+
 
+
start() - Method in class com.willowtreeapps.spruce.Spruce.SpruceBuilder
+
+
Creates a Spruce instance and starts the sequence of animations
+
+
+ + + +

V

+
+
valueOf(String) - Static method in enum com.willowtreeapps.spruce.sort.CorneredSort.Corner
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum com.willowtreeapps.spruce.sort.LinearSort.Direction
+
+
Returns the enum constant of this type with the specified name.
+
+
valueOf(String) - Static method in enum com.willowtreeapps.spruce.sort.RadialSort.Position
+
+
Returns the enum constant of this type with the specified name.
+
+
values() - Static method in enum com.willowtreeapps.spruce.sort.CorneredSort.Corner
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum com.willowtreeapps.spruce.sort.LinearSort.Direction
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
values() - Static method in enum com.willowtreeapps.spruce.sort.RadialSort.Position
+
+
Returns an array containing the constants of this enum type, in +the order they are declared.
+
+
+A C D F G H I L M R S V 
+ +
+ + + + + + + +
+ + + +