Skip to content

Commit

Permalink
Add spinner view and improve annotations
Browse files Browse the repository at this point in the history
Refactor view package and add base views.
  • Loading branch information
pranavpandey committed Apr 17, 2021
1 parent 3e084dd commit d7669fb
Show file tree
Hide file tree
Showing 60 changed files with 757 additions and 194 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
import com.pranavpandey.android.dynamic.support.utils.DynamicResourceUtils;
import com.pranavpandey.android.dynamic.support.utils.DynamicScrollUtils;
import com.pranavpandey.android.dynamic.support.utils.DynamicTintUtils;
import com.pranavpandey.android.dynamic.support.view.DynamicInfoView;
import com.pranavpandey.android.dynamic.support.view.DynamicItemView;
import com.pranavpandey.android.dynamic.support.view.base.DynamicInfoView;
import com.pranavpandey.android.dynamic.support.view.base.DynamicItemView;
import com.pranavpandey.android.dynamic.support.widget.DynamicCardView;
import com.pranavpandey.android.dynamic.support.widget.DynamicMaterialCardView;
import com.pranavpandey.android.dynamic.support.widget.base.DynamicBackgroundWidget;
Expand Down Expand Up @@ -238,10 +238,10 @@ public static <T> void setScrollBarColorType(@Nullable T dynamic,
* @see DynamicColorView#setColor(int)
*/
public static @ColorInt <T> int getColor(@Nullable T dynamic, @ColorInt int defaultColor) {
if (dynamic instanceof DynamicWidget) {
return ((DynamicWidget) dynamic).getColor();
} else if (dynamic instanceof DynamicColorView) {
if (dynamic instanceof DynamicColorView) {
return ((DynamicColorView) dynamic).getColor();
} else if (dynamic instanceof DynamicWidget) {
return ((DynamicWidget) dynamic).getColor();
}

return defaultColor;
Expand All @@ -259,10 +259,10 @@ public static <T> void setScrollBarColorType(@Nullable T dynamic,
* @see DynamicItem#setColor(int)
*/
public static <T> void setColor(@Nullable T dynamic, @ColorInt int color) {
if (dynamic instanceof DynamicWidget) {
((DynamicWidget) dynamic).setColor(color);
} else if (dynamic instanceof DynamicColorView) {
if (dynamic instanceof DynamicColorView) {
((DynamicColorView) dynamic).setColor(color);
} else if (dynamic instanceof DynamicWidget) {
((DynamicWidget) dynamic).setColor(color);
} else if (dynamic instanceof DynamicItem) {
((DynamicItem) dynamic).setColor(color);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class DynamicColorsAdapter extends BaseAdapter {
/**
* Array of colors to be handled by this adapter.
*/
private @ColorInt Integer[] mData;
private Integer[] mData;

/**
* The selected color.
Expand Down Expand Up @@ -77,9 +77,8 @@ public class DynamicColorsAdapter extends BaseAdapter {
* @param alpha {@code true} to enable alpha for the color.
* @param dynamicColorListener The listener to get the callback when a color is selected.
*/
public DynamicColorsAdapter(@NonNull @ColorInt Integer[] colors,
@DynamicColorShape int colorShape, boolean alpha,
@NonNull DynamicColorListener dynamicColorListener) {
public DynamicColorsAdapter(@NonNull Integer[] colors, @DynamicColorShape int colorShape,
boolean alpha, @NonNull DynamicColorListener dynamicColorListener) {
this(colors, Theme.Color.UNKNOWN, colorShape, alpha,
Theme.Color.UNKNOWN, dynamicColorListener);
}
Expand All @@ -93,7 +92,7 @@ public DynamicColorsAdapter(@NonNull @ColorInt Integer[] colors,
* @param contrastWithColor The contrast with color for the swatches.
* @param dynamicColorListener The listener to get the callback when a color is selected.
*/
public DynamicColorsAdapter(@NonNull @ColorInt Integer[] colors,
public DynamicColorsAdapter(@NonNull Integer[] colors,
@DynamicColorShape int colorShape, boolean alpha, @ColorInt int contrastWithColor,
@NonNull DynamicColorListener dynamicColorListener) {
this(colors, Theme.Color.UNKNOWN, colorShape, alpha,
Expand All @@ -110,9 +109,9 @@ public DynamicColorsAdapter(@NonNull @ColorInt Integer[] colors,
* @param contrastWithColor The contrast with color for the swatches.
* @param dynamicColorListener The listener to get the callback when a color is selected.
*/
public DynamicColorsAdapter(@NonNull @ColorInt Integer[] colors,
@ColorInt int selectedColor, @DynamicColorShape int colorShape, boolean alpha,
@ColorInt int contrastWithColor, @NonNull DynamicColorListener dynamicColorListener) {
public DynamicColorsAdapter(@NonNull Integer[] colors, @ColorInt int selectedColor,
@DynamicColorShape int colorShape, boolean alpha, @ColorInt int contrastWithColor,
@NonNull DynamicColorListener dynamicColorListener) {
this.mData = colors;
this.mSelectedColor = selectedColor;
this.mColorShape = colorShape;
Expand Down Expand Up @@ -183,7 +182,7 @@ public long getItemId(int position) {
*
* @return The array of colors to be handled by this adapter.
*/
public @NonNull @ColorInt Integer[] getData() {
public @NonNull Integer[] getData() {
return mData;
}

Expand All @@ -192,7 +191,7 @@ public long getItemId(int position) {
*
* @param data The array of colors to be set.
*/
public void setData(@NonNull @ColorInt Integer[] data) {
public void setData(@NonNull Integer[] data) {
this.mData = data;

notifyDataSetChanged();
Expand Down

0 comments on commit d7669fb

Please sign in to comment.