mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 03:28:52 +01:00
Remove code for secondary menu
This commit is contained in:
@@ -75,22 +75,6 @@ public class CustomViewBehind extends ViewGroup {
|
||||
return mContent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the secondary (right) menu for use when setMode is called with SlidingMenu.LEFT_RIGHT.
|
||||
*
|
||||
* @param v the right menu
|
||||
*/
|
||||
public void setSecondaryContent(View v) {
|
||||
if (mSecondaryContent != null)
|
||||
removeView(mSecondaryContent);
|
||||
mSecondaryContent = v;
|
||||
addView(mSecondaryContent);
|
||||
}
|
||||
|
||||
public View getSecondaryContent() {
|
||||
return mSecondaryContent;
|
||||
}
|
||||
|
||||
public void setChildrenEnabled(boolean enabled) {
|
||||
mChildrenEnabled = enabled;
|
||||
}
|
||||
@@ -128,8 +112,6 @@ public class CustomViewBehind extends ViewGroup {
|
||||
final int width = r - l;
|
||||
final int height = b - t;
|
||||
mContent.layout(0, 0, width - mWidthOffset, height);
|
||||
if (mSecondaryContent != null)
|
||||
mSecondaryContent.layout(0, 0, width - mWidthOffset, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -140,8 +122,6 @@ public class CustomViewBehind extends ViewGroup {
|
||||
final int contentWidth = getChildMeasureSpec(widthMeasureSpec, 0, width - mWidthOffset);
|
||||
final int contentHeight = getChildMeasureSpec(heightMeasureSpec, 0, height);
|
||||
mContent.measure(contentWidth, contentHeight);
|
||||
if (mSecondaryContent != null)
|
||||
mSecondaryContent.measure(contentWidth, contentHeight);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -152,7 +132,6 @@ public class CustomViewBehind extends ViewGroup {
|
||||
private final Paint mFadePaint = new Paint();
|
||||
private float mScrollScale;
|
||||
private Drawable mShadowDrawable;
|
||||
private Drawable mSecondaryShadowDrawable;
|
||||
private int mShadowWidth;
|
||||
private float mFadeDegree;
|
||||
|
||||
@@ -160,8 +139,6 @@ public class CustomViewBehind extends ViewGroup {
|
||||
if (mode == SlidingMenu.LEFT || mode == SlidingMenu.RIGHT) {
|
||||
if (mContent != null)
|
||||
mContent.setVisibility(View.VISIBLE);
|
||||
if (mSecondaryContent != null)
|
||||
mSecondaryContent.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
mMode = mode;
|
||||
}
|
||||
@@ -183,11 +160,6 @@ public class CustomViewBehind extends ViewGroup {
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void setSecondaryShadowDrawable(Drawable shadow) {
|
||||
mSecondaryShadowDrawable = shadow;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void setShadowWidth(int width) {
|
||||
mShadowWidth = width;
|
||||
invalidate();
|
||||
@@ -225,7 +197,6 @@ public class CustomViewBehind extends ViewGroup {
|
||||
(x - getBehindWidth()) * mScrollScale), y);
|
||||
} else if (mMode == SlidingMenu.LEFT_RIGHT) {
|
||||
mContent.setVisibility(x >= content.getLeft() ? View.INVISIBLE : View.VISIBLE);
|
||||
mSecondaryContent.setVisibility(x <= content.getLeft() ? View.INVISIBLE : View.VISIBLE);
|
||||
vis = x == 0 ? View.INVISIBLE : View.VISIBLE;
|
||||
if (x <= content.getLeft()) {
|
||||
scrollTo((int) ((x + getBehindWidth()) * mScrollScale), y);
|
||||
@@ -355,11 +326,6 @@ public class CustomViewBehind extends ViewGroup {
|
||||
} else if (mMode == SlidingMenu.RIGHT) {
|
||||
left = content.getRight();
|
||||
} else if (mMode == SlidingMenu.LEFT_RIGHT) {
|
||||
if (mSecondaryShadowDrawable != null) {
|
||||
left = content.getRight();
|
||||
mSecondaryShadowDrawable.setBounds(left, 0, left + mShadowWidth, getHeight());
|
||||
mSecondaryShadowDrawable.draw(canvas);
|
||||
}
|
||||
left = content.getLeft() - mShadowWidth;
|
||||
}
|
||||
mShadowDrawable.setBounds(left, 0, left + mShadowWidth, getHeight());
|
||||
|
||||
@@ -78,8 +78,6 @@ public class SlidingMenu extends RelativeLayout {
|
||||
|
||||
private OnOpenListener mOpenListener;
|
||||
private OnOpenedListener mOpenedListener;
|
||||
private OnOpenListener mSecondaryOpenListener;
|
||||
private OnOpenedListener mSecondaryOpenedListener;
|
||||
private OnCloseListener mCloseListener;
|
||||
private OnClosedListener mClosedListener;
|
||||
|
||||
@@ -223,7 +221,6 @@ public class SlidingMenu extends RelativeLayout {
|
||||
mViewAbove.setOnPageChangeListener(new OnPageChangeListener() {
|
||||
public static final int POSITION_OPEN = 0;
|
||||
public static final int POSITION_CLOSE = 1;
|
||||
public static final int POSITION_SECONDARY_OPEN = 2;
|
||||
|
||||
public void onPageScrolled(int position, float positionOffset,
|
||||
int positionOffsetPixels) {
|
||||
@@ -238,10 +235,6 @@ public class SlidingMenu extends RelativeLayout {
|
||||
mCloseListener.onClose();
|
||||
} else if (position == POSITION_CLOSE && mClosedListener != null) {
|
||||
mClosedListener.onClosed();
|
||||
} else if (position == POSITION_SECONDARY_OPEN && mSecondaryOpenListener != null && anim) {
|
||||
mSecondaryOpenListener.onOpen();
|
||||
} else if (position == POSITION_SECONDARY_OPEN && mSecondaryOpenedListener != null) {
|
||||
mSecondaryOpenedListener.onOpened();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -411,35 +404,6 @@ public class SlidingMenu extends RelativeLayout {
|
||||
return mViewBehind.getContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the secondary behind view (right menu) content from a layout resource. The resource will be inflated, adding all top-level views
|
||||
* to the behind view.
|
||||
*
|
||||
* @param res the new content
|
||||
*/
|
||||
public void setSecondaryMenu(int res) {
|
||||
setSecondaryMenu(LayoutInflater.from(getContext()).inflate(res, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the secondary behind view (right menu) content to the given View.
|
||||
*
|
||||
* @param view The desired content to display.
|
||||
*/
|
||||
public void setSecondaryMenu(View v) {
|
||||
mViewBehind.setSecondaryContent(v);
|
||||
// mViewBehind.invalidate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the current secondary menu (right).
|
||||
*
|
||||
* @return the current menu
|
||||
*/
|
||||
public View getSecondaryMenu() {
|
||||
return mViewBehind.getSecondaryContent();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the sliding enabled.
|
||||
@@ -515,24 +479,6 @@ public class SlidingMenu extends RelativeLayout {
|
||||
mViewAbove.setCurrentItem(0, animate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the menu and shows the secondary menu view. Will default to the regular menu
|
||||
* if there is only one.
|
||||
*/
|
||||
public void showSecondaryMenu() {
|
||||
showSecondaryMenu(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the menu and shows the secondary (right) menu view. Will default to the regular menu
|
||||
* if there is only one.
|
||||
*
|
||||
* @param animate true to animate the transition, false to ignore animation
|
||||
*/
|
||||
public void showSecondaryMenu(boolean animate) {
|
||||
mViewAbove.setCurrentItem(2, animate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the menu and shows the above view.
|
||||
*/
|
||||
@@ -578,15 +524,6 @@ public class SlidingMenu extends RelativeLayout {
|
||||
return mViewAbove.getCurrentItem() == 0 || mViewAbove.getCurrentItem() == 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is the behind view showing.
|
||||
*
|
||||
* @return Whether or not the behind view is showing
|
||||
*/
|
||||
public boolean isSecondaryMenuShowing() {
|
||||
return mViewAbove.getCurrentItem() == 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the behind offset.
|
||||
*
|
||||
@@ -781,24 +718,6 @@ public class SlidingMenu extends RelativeLayout {
|
||||
mViewBehind.setShadowDrawable(d);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the secondary (right) shadow drawable.
|
||||
*
|
||||
* @param resId the resource ID of the new shadow drawable
|
||||
*/
|
||||
public void setSecondaryShadowDrawable(int resId) {
|
||||
setSecondaryShadowDrawable(ContextCompat.getDrawable(getContext(), resId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the secondary (right) shadow drawable.
|
||||
*
|
||||
* @param d the new shadow drawable
|
||||
*/
|
||||
public void setSecondaryShadowDrawable(Drawable d) {
|
||||
mViewBehind.setSecondaryShadowDrawable(d);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the shadow width.
|
||||
*
|
||||
@@ -908,26 +827,6 @@ public class SlidingMenu extends RelativeLayout {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the OnOpenListener for secondary menu {@link OnOpenListener#onOpen() OnOpenListener.onOpen()} will be called when the secondary SlidingMenu is opened
|
||||
*
|
||||
* @param listener the new OnOpenListener
|
||||
*/
|
||||
|
||||
public void setSecondaryOnOpenListener(OnOpenListener listener) {
|
||||
mSecondaryOpenListener = listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the OnOpenedListener for the secondary menu. {@link OnOpenedListener#onOpened() OnOpenedListener.onOpened()} will be called after the secondary SlidingMenu is opened
|
||||
*
|
||||
* @param listener the new OnOpenedListener
|
||||
*/
|
||||
public void setSecondaryOnOpenedListener(OnOpenedListener listener) {
|
||||
mSecondaryOpenedListener = listener;
|
||||
mViewAbove.setOnOpenedListener(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the OnCloseListener. {@link OnCloseListener#onClose() OnCloseListener.onClose()} will be called when any one of the SlidingMenu is closed
|
||||
*
|
||||
@@ -1041,14 +940,9 @@ public class SlidingMenu extends RelativeLayout {
|
||||
final int layerType = layer ? View.LAYER_TYPE_HARDWARE : View.LAYER_TYPE_NONE;
|
||||
|
||||
if (layerType != getContent().getLayerType()) {
|
||||
getHandler().post(new Runnable() {
|
||||
public void run() {
|
||||
getContent().setLayerType(layerType, null);
|
||||
getMenu().setLayerType(layerType, null);
|
||||
if (getSecondaryMenu() != null) {
|
||||
getSecondaryMenu().setLayerType(layerType, null);
|
||||
}
|
||||
}
|
||||
getHandler().post(() -> {
|
||||
getContent().setLayerType(layerType, null);
|
||||
getMenu().setLayerType(layerType, null);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user