Skip to content

Commit

Permalink
4 new menus based on material design
Browse files Browse the repository at this point in the history
  • Loading branch information
rgocal committed Nov 4, 2020
1 parent d9e2bea commit 1ebbeb1
Show file tree
Hide file tree
Showing 14 changed files with 62 additions and 69 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.gocalsd.dynamicpopupmenu.library;
package com.gsd.dynamicMenu;

import android.content.Context;
import android.graphics.drawable.Drawable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.gocalsd.dynamicpopupmenu.library.data;
package com.gsd.dynamicMenu.data;

import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.gocalsd.dynamicpopupmenu.library.data;
package com.gsd.dynamicMenu.data;

import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.gocalsd.dynamicpopupmenu.library.menus;
package com.gsd.dynamicMenu.menus;

import android.content.Context;
import android.graphics.Color;
Expand All @@ -20,20 +20,18 @@

import androidx.appcompat.widget.AppCompatImageView;

import com.gocalsd.dynamicpopupmenu.R;
import com.gocalsd.dynamicpopupmenu.library.PopupWindows;
import com.gocalsd.dynamicpopupmenu.library.data.ActionItem;
import com.gocalsd.dynamicpopupmenu.library.utils.ColorProvider;
import com.gocalsd.dynamicpopupmenu.library.views.ArrowDrawable;
import com.gocalsd.dynamicpopupmenu.library.views.GoogleTextView;

import com.google.android.material.shape.MaterialShapeDrawable;
import com.gsd.dynamicMenu.PopupWindows;
import com.gsd.dynamicMenu.data.ActionItem;
import com.gsd.dynamicMenu.utils.ColorProvider;
import com.gsd.dynamicMenu.views.ArrowDrawable;
import com.gsd.dynamicMenu.views.GoogleTextView;
import com.gsd.mpm.materialpopupmenu.R;

import java.util.ArrayList;
import java.util.List;

import static com.gocalsd.dynamicpopupmenu.library.views.ArrowDrawable.ARROW_DOWN;
import static com.gocalsd.dynamicpopupmenu.library.views.ArrowDrawable.ARROW_UP;

public class HorizontalPopupMenu extends PopupWindows implements OnDismissListener {

private View mArrowUp, mArrowDown;
Expand Down Expand Up @@ -83,8 +81,8 @@ public void setBackgroundColor(int scrollColor) {
mDrawableBody.setTint(scrollColor);
mScrollView.setBackground(mDrawableBody);

mArrowDown.setBackground(new ArrowDrawable(ARROW_DOWN, scrollColor, 1, ColorProvider.getDarkerShadeColor(scrollColor)));
mArrowUp.setBackground(new ArrowDrawable(ARROW_UP, scrollColor, 1, ColorProvider.getDarkerShadeColor(scrollColor)));
mArrowDown.setBackground(new ArrowDrawable(ArrowDrawable.getArrowDown(), scrollColor, 1, ColorProvider.getDarkerShadeColor(scrollColor)));
mArrowUp.setBackground(new ArrowDrawable(ArrowDrawable.getArrowDown(), scrollColor, 1, ColorProvider.getDarkerShadeColor(scrollColor)));
}

private int getMenuColor(){
Expand Down
27 changes: 12 additions & 15 deletions library/src/main/java/com/gsd/dynamicMenu/menus/PixelPopupMenu.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.gocalsd.dynamicpopupmenu.library.menus;
package com.gsd.dynamicMenu.menus;

import android.content.Context;
import android.graphics.Color;
Expand All @@ -22,21 +22,18 @@
import androidx.appcompat.widget.LinearLayoutCompat;
import androidx.core.graphics.ColorUtils;

import com.gocalsd.dynamicpopupmenu.R;
import com.gocalsd.dynamicpopupmenu.library.PopupWindows;
import com.gocalsd.dynamicpopupmenu.library.data.ActionItem;
import com.gocalsd.dynamicpopupmenu.library.data.SimpleActionItem;
import com.gocalsd.dynamicpopupmenu.library.utils.ColorProvider;
import com.gocalsd.dynamicpopupmenu.library.views.ArrowDrawable;
import com.gocalsd.dynamicpopupmenu.library.views.GoogleTextView;
import com.google.android.material.shape.MaterialShapeDrawable;
import com.gsd.dynamicMenu.PopupWindows;
import com.gsd.dynamicMenu.data.ActionItem;
import com.gsd.dynamicMenu.data.SimpleActionItem;
import com.gsd.dynamicMenu.utils.ColorProvider;
import com.gsd.dynamicMenu.views.ArrowDrawable;
import com.gsd.dynamicMenu.views.GoogleTextView;
import com.gsd.mpm.materialpopupmenu.R;

import java.util.ArrayList;
import java.util.List;

import static com.gocalsd.dynamicpopupmenu.library.views.ArrowDrawable.ARROW_DOWN;
import static com.gocalsd.dynamicpopupmenu.library.views.ArrowDrawable.ARROW_UP;

public class PixelPopupMenu extends PopupWindows implements PopupWindow.OnDismissListener {

private View mArrowUp, mArrowDown;
Expand Down Expand Up @@ -86,8 +83,8 @@ public void setBackgroundColor(int scrollColor) {

scrollHolder.setBackground(mDrawableBody);

mArrowDown.setBackground(new ArrowDrawable(ARROW_DOWN, scrollColor, 1, ColorProvider.getDarkerShadeColor(scrollColor)));
mArrowUp.setBackground(new ArrowDrawable(ARROW_UP, scrollColor, 1, ColorProvider.getDarkerShadeColor(scrollColor)));
mArrowDown.setBackground(new ArrowDrawable(ArrowDrawable.getArrowDown(), scrollColor, 1, ColorProvider.getDarkerShadeColor(scrollColor)));
mArrowUp.setBackground(new ArrowDrawable(ArrowDrawable.getArrowUp(), scrollColor, 1, ColorProvider.getDarkerShadeColor(scrollColor)));
}

private int getMenuColor(){
Expand Down Expand Up @@ -245,7 +242,7 @@ public void run() {
mVerticalChildPos++;
}

public void setOnActionItemClickListener(PixelPopupMenu.OnActionItemClickListener listener) {
public void setOnActionItemClickListener(OnActionItemClickListener listener) {
mItemClickListener = listener;
}

Expand Down Expand Up @@ -328,7 +325,7 @@ private void showArrow(int whichArrow, int requestedX) {
hideArrow.setVisibility(View.INVISIBLE);
}

public void setOnDismissListener(PixelPopupMenu.OnDismissListener listener) {
public void setOnDismissListener(OnDismissListener listener) {
setOnDismissListener(this);
mDismissListener = listener;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.gocalsd.dynamicpopupmenu.library.menus;
package com.gsd.dynamicMenu.menus;

import android.content.Context;
import android.graphics.Color;
Expand All @@ -13,29 +13,23 @@
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import android.widget.FrameLayout;
import android.widget.HorizontalScrollView;
import android.widget.PopupWindow;
import android.widget.ScrollView;

import androidx.appcompat.widget.AppCompatImageView;
import androidx.appcompat.widget.LinearLayoutCompat;
import androidx.constraintlayout.widget.ConstraintLayout;

import com.gocalsd.dynamicpopupmenu.R;
import com.gocalsd.dynamicpopupmenu.library.PopupWindows;
import com.gocalsd.dynamicpopupmenu.library.data.ActionItem;
import com.gocalsd.dynamicpopupmenu.library.utils.ColorProvider;
import com.gocalsd.dynamicpopupmenu.library.views.ArrowDrawable;
import com.gocalsd.dynamicpopupmenu.library.views.GoogleTextView;

import com.google.android.material.shape.MaterialShapeDrawable;
import com.gsd.dynamicMenu.PopupWindows;
import com.gsd.dynamicMenu.data.ActionItem;
import com.gsd.dynamicMenu.utils.ColorProvider;
import com.gsd.dynamicMenu.views.ArrowDrawable;
import com.gsd.dynamicMenu.views.GoogleTextView;
import com.gsd.mpm.materialpopupmenu.R;

import java.util.ArrayList;
import java.util.List;

import static com.gocalsd.dynamicpopupmenu.library.views.ArrowDrawable.ARROW_DOWN;
import static com.gocalsd.dynamicpopupmenu.library.views.ArrowDrawable.ARROW_UP;

public class VerticalListPopupMenu extends PopupWindows implements PopupWindow.OnDismissListener {

private View mArrowUp, mArrowDown;
Expand Down Expand Up @@ -75,8 +69,8 @@ public void setBackgroundColor(int scrollColor) {
mDrawableBody.setTint(scrollColor);
mScrollView.setBackground(mDrawableBody);

mArrowDown.setBackground(new ArrowDrawable(ARROW_DOWN, scrollColor, 1, ColorProvider.getDarkerShadeColor(scrollColor)));
mArrowUp.setBackground(new ArrowDrawable(ARROW_UP, scrollColor, 1, ColorProvider.getDarkerShadeColor(scrollColor)));
mArrowDown.setBackground(new ArrowDrawable(ArrowDrawable.getArrowDown(), scrollColor, 1, ColorProvider.getDarkerShadeColor(scrollColor)));
mArrowUp.setBackground(new ArrowDrawable(ArrowDrawable.getArrowUp(), scrollColor, 1, ColorProvider.getDarkerShadeColor(scrollColor)));
}

private int getMenuColor(){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.gocalsd.dynamicpopupmenu.library.menus;
package com.gsd.dynamicMenu.menus;

import android.content.Context;
import android.graphics.Color;
Expand All @@ -19,20 +19,16 @@
import androidx.appcompat.widget.AppCompatImageView;
import androidx.appcompat.widget.LinearLayoutCompat;

import com.gocalsd.dynamicpopupmenu.R;
import com.gocalsd.dynamicpopupmenu.library.PopupWindows;
import com.gocalsd.dynamicpopupmenu.library.data.ActionItem;
import com.gocalsd.dynamicpopupmenu.library.data.SimpleActionItem;
import com.gocalsd.dynamicpopupmenu.library.utils.ColorProvider;
import com.gocalsd.dynamicpopupmenu.library.views.ArrowDrawable;
import com.google.android.material.shape.MaterialShapeDrawable;
import com.gsd.dynamicMenu.PopupWindows;
import com.gsd.dynamicMenu.data.SimpleActionItem;
import com.gsd.dynamicMenu.utils.ColorProvider;
import com.gsd.dynamicMenu.views.ArrowDrawable;
import com.gsd.mpm.materialpopupmenu.R;

import java.util.ArrayList;
import java.util.List;

import static com.gocalsd.dynamicpopupmenu.library.views.ArrowDrawable.ARROW_DOWN;
import static com.gocalsd.dynamicpopupmenu.library.views.ArrowDrawable.ARROW_UP;

public class VerticalPopupMenu extends PopupWindows implements PopupWindow.OnDismissListener {

private View mArrowUp, mArrowDown;
Expand Down Expand Up @@ -72,8 +68,8 @@ public void setBackgroundColor(int scrollColor) {
mDrawableBody.setTint(scrollColor);
mScrollView.setBackground(mDrawableBody);

mArrowDown.setBackground(new ArrowDrawable(ARROW_DOWN, scrollColor, 1, ColorProvider.getDarkerShadeColor(scrollColor)));
mArrowUp.setBackground(new ArrowDrawable(ARROW_UP, scrollColor, 1, ColorProvider.getDarkerShadeColor(scrollColor)));
mArrowDown.setBackground(new ArrowDrawable(ArrowDrawable.getArrowDown(), scrollColor, 1, ColorProvider.getDarkerShadeColor(scrollColor)));
mArrowUp.setBackground(new ArrowDrawable(ArrowDrawable.getArrowUp(), scrollColor, 1, ColorProvider.getDarkerShadeColor(scrollColor)));
}

private int getMenuColor(){
Expand Down Expand Up @@ -151,7 +147,7 @@ public void run() {
mChildPos++;
}

public void setOnActionItemClickListener(VerticalPopupMenu.OnActionItemClickListener listener) {
public void setOnActionItemClickListener(OnActionItemClickListener listener) {
mItemClickListener = listener;
}

Expand Down Expand Up @@ -235,7 +231,7 @@ private void showArrow(int whichArrow, int requestedX) {
hideArrow.setVisibility(View.INVISIBLE);
}

public void setOnDismissListener(VerticalPopupMenu.OnDismissListener listener) {
public void setOnDismissListener(OnDismissListener listener) {
setOnDismissListener(this);
mDismissListener = listener;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.gocalsd.dynamicpopupmenu.library.utils;
package com.gsd.dynamicMenu.utils;

import android.graphics.Bitmap;
import android.graphics.Color;
Expand Down
14 changes: 11 additions & 3 deletions library/src/main/java/com/gsd/dynamicMenu/views/ArrowDrawable.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.gocalsd.dynamicpopupmenu.library.views;
package com.gsd.dynamicMenu.views;

import android.graphics.Canvas;
import android.graphics.Color;
Expand All @@ -13,8 +13,8 @@

public class ArrowDrawable extends ColorDrawable {

public static final int ARROW_UP = 1;
public static final int ARROW_DOWN = 2;
private static final int ARROW_UP = 1;
private static final int ARROW_DOWN = 2;

private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private final Paint mShadowPaint = new Paint(mPaint);
Expand Down Expand Up @@ -86,6 +86,14 @@ public void setColor(@ColorInt int color) {
mPaint.setColor(color);
}

public static int getArrowUp(){
return ARROW_UP;
}

public static int getArrowDown(){
return ARROW_DOWN;
}

@Override public void setColorFilter(ColorFilter colorFilter) {
mPaint.setColorFilter(colorFilter);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.gocalsd.dynamicpopupmenu.library.views;
package com.gsd.dynamicMenu.views;

import android.content.Context;
import android.graphics.Rect;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
android:layout_width="22dp"
android:layout_height="22dp"/>

<com.gocalsd.dynamicpopupmenu.library.views.GoogleTextView
<com.gsd.dynamicMenu.views.GoogleTextView
android:id="@+id/action_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand Down
2 changes: 1 addition & 1 deletion library/src/main/res/layout/pixel_quick_action_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:divider="@color/black"
app:divider="@android:color/background_dark"
app:dividerPadding="2dp"
app:showDividers="middle" />
</ScrollView>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
android:layout_width="28dp"
android:layout_height="28dp"/>

<com.gocalsd.dynamicpopupmenu.library.views.GoogleTextView
<com.gsd.dynamicMenu.views.GoogleTextView
android:id="@+id/action_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
android:id="@+id/tracks"
app:showDividers="middle"
app:dividerPadding="2dp"
app:divider="@color/black"
app:divider="@android:color/background_dark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"/>
Expand Down

0 comments on commit 1ebbeb1

Please sign in to comment.