diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/MainActivity.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/MainActivity.java index f103af36..c6f2081c 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/MainActivity.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/MainActivity.java @@ -110,7 +110,15 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen setTitle(R.string.title_conversation_list); mSlidingMenu = (SlidingMenu) findViewById(R.id.sliding_menu); - setupSlidingMenu(); + setSlidingTabEnabled(mPrefs.getBoolean(SettingsFragment.SLIDING_TAB, false)); + mSlidingMenu.setOnOpenListener(this); + mSlidingMenu.setOnCloseListener(this); + mSlidingMenu.setOnOpenedListener(this); + mSlidingMenu.setOnClosedListener(this); + mSlidingMenu.setContent(); + mSlidingMenu.setMenu(); + mSlidingMenu.showContent(false); + mSlidingMenu.showMenu(false); setupFragments(savedInstanceState); onNewIntent(getIntent()); @@ -219,30 +227,10 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen startActivityForResult(welcomeIntent, WelcomeActivity.WELCOME_REQUEST_CODE); } - public SlidingMenu getSlidingMenu() { - return mSlidingMenu; - } - public void showMenu() { mSlidingMenu.showMenu(); } - private void setupSlidingMenu() { - setSlidingTabEnabled(mPrefs.getBoolean(SettingsFragment.SLIDING_TAB, false)); - mSlidingMenu.setBehindScrollScale(0.5f); - mSlidingMenu.setFadeDegree(0.5f); - mSlidingMenu.setOnOpenListener(this); - mSlidingMenu.setOnCloseListener(this); - mSlidingMenu.setOnOpenedListener(this); - mSlidingMenu.setOnClosedListener(this); - mSlidingMenu.setShadowDrawable(R.drawable.shadow_slidingmenu); - mSlidingMenu.setShadowWidthRes(R.dimen.shadow_width); - mSlidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN); - mSlidingMenu.setContent(R.layout.content_frame); - mSlidingMenu.setMenu(R.layout.menu_frame); - mSlidingMenu.showMenu(false); - } - /** * Configured the sliding menu view to peek the content or not. * @@ -250,11 +238,8 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen */ public void setSlidingTabEnabled(boolean slidingTabEnabled) { if (slidingTabEnabled) { - mSlidingMenu.setShadowDrawable(R.drawable.shadow_slidingmenu); - mSlidingMenu.setShadowWidth(Units.dpToPx(this, 8)); mSlidingMenu.setBehindOffset(Units.dpToPx(this, 48)); } else { - mSlidingMenu.setShadowWidth(0); mSlidingMenu.setBehindOffset(0); } } @@ -275,10 +260,6 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen return super.onPrepareOptionsMenu(menu); } - public Fragment getConversationList() { - return mConversationList; - } - public Fragment getContent() { return (Fragment) mContent; } diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/view/slidingmenu/CustomViewAbove.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/view/slidingmenu/CustomViewAbove.java index 82b2a882..66ef5bee 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/view/slidingmenu/CustomViewAbove.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/view/slidingmenu/CustomViewAbove.java @@ -2,12 +2,10 @@ package com.moez.QKSMS.ui.view.slidingmenu; import android.content.Context; import android.graphics.Canvas; -import android.graphics.Rect; import android.os.Build; import android.support.v4.view.KeyEventCompat; import android.support.v4.view.MotionEventCompat; import android.support.v4.view.VelocityTrackerCompat; -import android.support.v4.view.ViewCompat; import android.support.v4.view.ViewConfigurationCompat; import android.util.AttributeSet; import android.util.FloatMath; @@ -23,9 +21,6 @@ import android.view.ViewGroup; import android.view.animation.Interpolator; import android.widget.Scroller; -import java.util.ArrayList; -import java.util.List; - public class CustomViewAbove extends ViewGroup { private static final String TAG = "CustomViewAbove"; @@ -36,13 +31,7 @@ public class CustomViewAbove extends ViewGroup { private static final int MAX_SETTLE_DURATION = 350; // ms private static final int MIN_DISTANCE_FOR_FLING = 25; // dips - private static final Interpolator sInterpolator = new Interpolator() { - // See [1] for explanation for the 0.63 * t. - // http://www.wolframalpha.com/input/?i=graph+1%2B%28t-1%29%5E5%2C+1%2B%28t*0.63-1%29%5E5+from+t+%3D+0+to+1 - public float getInterpolation(float t) { - return (float) Math.pow(0.63 * t - 1.0f, 5) + 1.0f; - } - }; + private static final Interpolator sInterpolator = t -> (float) Math.pow(0.63 * t - 1.0f, 5) + 1.0f; private View mContent; @@ -82,21 +71,13 @@ public class CustomViewAbove extends ViewGroup { private int mFlingDistance; private CustomViewBehind mViewBehind; - // private int mMode; - private boolean mEnabled = true; private OnPageChangeListener mOnPageChangeListener; private OnPageChangeListener mInternalPageChangeListener; - // private OnCloseListener mCloseListener; - // private OnOpenListener mOpenListener; private SlidingMenu.OnClosedListener mClosedListener; private SlidingMenu.OnOpenedListener mOpenedListener; - private List mIgnoredViews = new ArrayList<>(); - - // private int mScrollState = SCROLL_STATE_IDLE; - /** * Callback interface for responding to changing state of the selected page. */ @@ -111,7 +92,7 @@ public class CustomViewAbove extends ViewGroup { * @param positionOffset Value from [0, 1) indicating the offset from the page at position. * @param positionOffsetPixels Value in pixels indicating the offset from position. */ - public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels); + void onPageScrolled(int position, float positionOffset, int positionOffsetPixels); /** * This method will be invoked when a new page becomes selected. Animation is not @@ -119,7 +100,7 @@ public class CustomViewAbove extends ViewGroup { * * @param position Position index of the new selected page. */ - public void onPageSelected(int position, boolean anim); + void onPageSelected(int position, boolean anim); } @@ -138,10 +119,6 @@ public class CustomViewAbove extends ViewGroup { // This space for rent } - public void onPageScrollStateChanged(int state) { - // This space for rent - } - } public CustomViewAbove(Context context) { @@ -227,8 +204,7 @@ public class CustomViewAbove extends ViewGroup { setCurrentItemInternal(item, smoothScroll, always, velocity, false); } - void setCurrentItemInternal(int item, boolean smoothScroll, boolean always, int velocity, - boolean notify) { + void setCurrentItemInternal(int item, boolean smoothScroll, boolean always, int velocity, boolean notify) { if (!always && mCurItem == item) { setScrollingCacheEnabled(false); @@ -275,15 +251,6 @@ public class CustomViewAbove extends ViewGroup { mOnPageChangeListener = listener; } - /* - public void setOnOpenListener(OnOpenListener l) { - mOpenListener = l; - } - - public void setOnCloseListener(OnCloseListener l) { - mCloseListener = l; - } - */ public void setOnOpenedListener(SlidingMenu.OnOpenedListener l) { mOpenedListener = l; } @@ -304,20 +271,6 @@ public class CustomViewAbove extends ViewGroup { return oldListener; } - public void addIgnoredView(View v) { - if (!mIgnoredViews.contains(v)) { - mIgnoredViews.add(v); - } - } - - public void removeIgnoredView(View v) { - mIgnoredViews.remove(v); - } - - public void clearIgnoredViews() { - mIgnoredViews.clear(); - } - // We want the duration of the page snap animation to be influenced by the distance that // the screen has to travel, however, we don't want this duration to be effected in a // purely linear fashion. Instead, we use this method to moderate the effect that the distance @@ -325,7 +278,7 @@ public class CustomViewAbove extends ViewGroup { float distanceInfluenceForSnapDuration(float f) { f -= 0.5f; // center the values about 0. f *= 0.3f * Math.PI / 2.0f; - return (float) FloatMath.sin(f); + return FloatMath.sin(f); } public int getDestScrollX(int page) { @@ -347,23 +300,10 @@ public class CustomViewAbove extends ViewGroup { return mViewBehind.getAbsRightBound(mContent); } - public int getContentLeft() { - return mContent.getLeft() + mContent.getPaddingLeft(); - } - public boolean isMenuOpen() { return mCurItem == 0 || mCurItem == 2; } - private boolean isInIgnoredView(MotionEvent ev) { - Rect rect = new Rect(); - for (View v : mIgnoredViews) { - v.getHitRect(rect); - if (rect.contains((int) ev.getX(), (int) ev.getY())) return true; - } - return false; - } - public int getBehindWidth() { if (mViewBehind == null) { return 0; @@ -372,35 +312,6 @@ public class CustomViewAbove extends ViewGroup { } } - public int getChildWidth(int i) { - switch (i) { - case 0: - return getBehindWidth(); - case 1: - return mContent.getWidth(); - default: - return 0; - } - } - - public boolean isSlidingEnabled() { - return mEnabled; - } - - public void setSlidingEnabled(boolean b) { - mEnabled = b; - } - - /** - * Like {@link View#scrollBy}, but scroll smoothly instead of immediately. - * - * @param x the number of pixels to scroll by on the X axis - * @param y the number of pixels to scroll by on the Y axis - */ - void smoothScrollTo(int x, int y) { - smoothScrollTo(x, y, 0); - } - /** * Like {@link View#scrollBy}, but scroll smoothly instead of immediately. * @@ -444,8 +355,6 @@ public class CustomViewAbove extends ViewGroup { if (velocity > 0) { duration = 4 * Math.round(1000 * Math.abs(distance / velocity)); } else { - final float pageDelta = (float) Math.abs(dx) / width; - duration = (int) ((pageDelta + 1) * 100); duration = MAX_SETTLE_DURATION; } duration = Math.min(duration, MAX_SETTLE_DURATION); @@ -487,8 +396,7 @@ public class CustomViewAbove extends ViewGroup { // Make sure scroll position is set correctly. if (w != oldw) { // [ChrisJ] - This fixes the onConfiguration change for orientation issue.. - // maybe worth having a look why the recomputeScroll pos is screwing - // up? + // maybe worth having a look why the recomputeScroll pos is screwing up? completeScroll(); scrollTo(getDestScrollX(mCurItem), getScrollY()); } @@ -501,13 +409,6 @@ public class CustomViewAbove extends ViewGroup { mContent.layout(0, 0, width, height); } - public void setAboveOffset(int i) { - // RelativeLayout.LayoutParams params = ((RelativeLayout.LayoutParams)mContent.getLayoutParams()); - // params.setMargins(i, params.topMargin, params.rightMargin, params.bottomMargin); - mContent.setPadding(i, mContent.getPaddingTop(), - mContent.getPaddingRight(), mContent.getPaddingBottom()); - } - @Override public void computeScroll() { @@ -587,35 +488,12 @@ public class CustomViewAbove extends ViewGroup { mScrolling = false; } - protected int mTouchMode = SlidingMenu.TOUCHMODE_MARGIN; - - public void setTouchMode(int i) { - mTouchMode = i; - } - - public int getTouchMode() { - return mTouchMode; - } - private boolean thisTouchAllowed(MotionEvent ev) { - int x = (int) (ev.getX() + mScrollX); - if (isMenuOpen()) { - return mViewBehind.menuOpenTouchAllowed(mContent, mCurItem, x); - } else { - switch (mTouchMode) { - case SlidingMenu.TOUCHMODE_FULLSCREEN: - return !isInIgnoredView(ev); - case SlidingMenu.TOUCHMODE_NONE: - return false; - case SlidingMenu.TOUCHMODE_MARGIN: - return mViewBehind.marginTouchAllowed(mContent, x); - } - } - return false; + return !isMenuOpen(); } private boolean thisSlideAllowed(float dx) { - boolean allowed = false; + boolean allowed; if (isMenuOpen()) { allowed = mViewBehind.menuOpenSlideAllowed(dx); } else { @@ -641,9 +519,6 @@ public class CustomViewAbove extends ViewGroup { @Override public boolean onInterceptTouchEvent(MotionEvent ev) { - if (!mEnabled) - return false; - final int action = ev.getAction() & MotionEventCompat.ACTION_MASK; if (DEBUG) @@ -695,15 +570,9 @@ public class CustomViewAbove extends ViewGroup { @Override public boolean onTouchEvent(MotionEvent ev) { - if (!mEnabled) - return false; - if (!mIsBeingDragged && !thisTouchAllowed(ev)) return false; - // if (!mIsBeingDragged && !mQuickReturn) - // return false; - final int action = ev.getAction(); if (mVelocityTracker == null) { @@ -841,7 +710,7 @@ public class CustomViewAbove extends ViewGroup { targetPage += 1; } } else { - targetPage = (int) Math.round(mCurItem + pageOffset); + targetPage = Math.round(mCurItem + pageOffset); } return targetPage; } @@ -855,8 +724,6 @@ public class CustomViewAbove extends ViewGroup { super.dispatchDraw(canvas); // Draw the margin drawable if needed. mViewBehind.drawShadow(mContent, canvas); - mViewBehind.drawFade(mContent, canvas, getPercentOpen()); - mViewBehind.drawSelector(mContent, canvas, getPercentOpen()); } // variables for drawing @@ -910,38 +777,6 @@ public class CustomViewAbove extends ViewGroup { } } - /** - * Tests scrollability within child views of v given a delta of dx. - * - * @param v View to test for horizontal scrollability - * @param checkV Whether the view v passed should itself be checked for scrollability (true), - * or just its children (false). - * @param dx Delta scrolled in pixels - * @param x X coordinate of the active touch point - * @param y Y coordinate of the active touch point - * @return true if child views of v can be scrolled by delta of dx. - */ - protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) { - if (v instanceof ViewGroup) { - final ViewGroup group = (ViewGroup) v; - final int scrollX = v.getScrollX(); - final int scrollY = v.getScrollY(); - final int count = group.getChildCount(); - // Count backwards - let topmost views consume scroll distance first. - for (int i = count - 1; i >= 0; i--) { - final View child = group.getChildAt(i); - if (x + scrollX >= child.getLeft() && x + scrollX < child.getRight() && - y + scrollY >= child.getTop() && y + scrollY < child.getBottom() && - canScroll(child, true, dx, x + scrollX - child.getLeft(), - y + scrollY - child.getTop())) { - return true; - } - } - } - - return checkV && ViewCompat.canScrollHorizontally(v, -dx); - } - @Override public boolean dispatchKeyEvent(KeyEvent event) { diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/view/slidingmenu/CustomViewBehind.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/view/slidingmenu/CustomViewBehind.java index 8775f9e5..8e260044 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/view/slidingmenu/CustomViewBehind.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/view/slidingmenu/CustomViewBehind.java @@ -1,32 +1,19 @@ package com.moez.QKSMS.ui.view.slidingmenu; import android.content.Context; -import android.graphics.Bitmap; import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.Paint; import android.graphics.drawable.Drawable; import android.util.AttributeSet; -import android.util.TypedValue; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; -import com.moez.QKSMS.R; +import com.moez.QKSMS.common.utils.Units; public class CustomViewBehind extends ViewGroup { - private static final String TAG = "CustomViewBehind"; - private static final int MARGIN_THRESHOLD = 48; // dips - private int mTouchMode = SlidingMenu.TOUCHMODE_MARGIN; - - private CustomViewAbove mViewAbove; - private View mContent; - private View mSecondaryContent; - private int mMarginThreshold; private int mWidthOffset; - private SlidingMenu.CanvasTransformer mTransformer; private boolean mChildrenEnabled; public CustomViewBehind(Context context) { @@ -35,16 +22,7 @@ public class CustomViewBehind extends ViewGroup { public CustomViewBehind(Context context, AttributeSet attrs) { super(context, attrs); - mMarginThreshold = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, - MARGIN_THRESHOLD, getResources().getDisplayMetrics()); - } - - public void setCustomViewAbove(CustomViewAbove customViewAbove) { - mViewAbove = customViewAbove; - } - - public void setCanvasTransformer(SlidingMenu.CanvasTransformer t) { - mTransformer = t; + mShadowWidth = Units.dpToPx(getContext(), 8); } public void setWidthOffset(int i) { @@ -52,21 +30,14 @@ public class CustomViewBehind extends ViewGroup { requestLayout(); } - public void setMarginThreshold(int marginThreshold) { - mMarginThreshold = marginThreshold; - } - - public int getMarginThreshold() { - return mMarginThreshold; - } - public int getBehindWidth() { return mContent.getWidth(); } public void setContent(View v) { - if (mContent != null) + if (mContent != null) { removeView(mContent); + } mContent = v; addView(mContent); } @@ -82,8 +53,6 @@ public class CustomViewBehind extends ViewGroup { @Override public void scrollTo(int x, int y) { super.scrollTo(x, y); - if (mTransformer != null) - invalidate(); } @Override @@ -98,13 +67,7 @@ public class CustomViewBehind extends ViewGroup { @Override protected void dispatchDraw(Canvas canvas) { - if (mTransformer != null) { - canvas.save(); - mTransformer.transformCanvas(canvas, mViewAbove.getPercentOpen()); - super.dispatchDraw(canvas); - canvas.restore(); - } else - super.dispatchDraw(canvas); + super.dispatchDraw(canvas); } @Override @@ -124,63 +87,23 @@ public class CustomViewBehind extends ViewGroup { mContent.measure(contentWidth, contentHeight); } - /** - * Determines the location of the menu(s): left only, right only, or on both left and right. - */ - private int mMode; - private boolean mFadeEnabled; - private final Paint mFadePaint = new Paint(); private float mScrollScale; private Drawable mShadowDrawable; private int mShadowWidth; - private float mFadeDegree; - - public void setMode(int mode) { - if (mode == SlidingMenu.LEFT || mode == SlidingMenu.RIGHT) { - if (mContent != null) - mContent.setVisibility(View.VISIBLE); - } - mMode = mode; - } - - public int getMode() { - return mMode; - } public void setScrollScale(float scrollScale) { mScrollScale = scrollScale; } - public float getScrollScale() { - return mScrollScale; - } - public void setShadowDrawable(Drawable shadow) { mShadowDrawable = shadow; invalidate(); } - public void setShadowWidth(int width) { - mShadowWidth = width; - invalidate(); - } - - public void setFadeEnabled(boolean b) { - mFadeEnabled = b; - } - - public void setFadeDegree(float degree) { - if (degree > 1.0f || degree < 0.0f) - throw new IllegalStateException("The BehindFadeDegree must be between 0.0f and 1.0f"); - mFadeDegree = degree; - } - public int getMenuPage(int page) { page = (page > 1) ? 2 : ((page < 1) ? 0 : page); - if (mMode == SlidingMenu.LEFT && page > 1) { + if (page > 1) { return 0; - } else if (mMode == SlidingMenu.RIGHT && page < 1) { - return 2; } else { return page; } @@ -188,96 +111,27 @@ public class CustomViewBehind extends ViewGroup { public void scrollBehindTo(View content, int x, int y) { int vis = View.VISIBLE; - if (mMode == SlidingMenu.LEFT) { - if (x >= content.getLeft()) vis = View.INVISIBLE; - scrollTo((int) ((x + getBehindWidth()) * mScrollScale), y); - } else if (mMode == SlidingMenu.RIGHT) { - if (x <= content.getLeft()) vis = View.INVISIBLE; - scrollTo((int) (getBehindWidth() - getWidth() + - (x - getBehindWidth()) * mScrollScale), y); - } else if (mMode == SlidingMenu.LEFT_RIGHT) { - mContent.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); - } else { - scrollTo((int) (getBehindWidth() - getWidth() + - (x - getBehindWidth()) * mScrollScale), y); - } - } + if (x >= content.getLeft()) vis = View.INVISIBLE; + scrollTo((int) ((x + getBehindWidth()) * mScrollScale), y); setVisibility(vis); } public int getMenuLeft(View content, int page) { - if (mMode == SlidingMenu.LEFT) { - switch (page) { - case 0: - return content.getLeft() - getBehindWidth(); - case 2: - return content.getLeft(); - } - } else if (mMode == SlidingMenu.RIGHT) { - switch (page) { - case 0: - return content.getLeft(); - case 2: - return content.getLeft() + getBehindWidth(); - } - } else if (mMode == SlidingMenu.LEFT_RIGHT) { - switch (page) { - case 0: - return content.getLeft() - getBehindWidth(); - case 2: - return content.getLeft() + getBehindWidth(); - } + switch (page) { + case 0: + return content.getLeft() - getBehindWidth(); + case 2: + return content.getLeft(); } return content.getLeft(); } public int getAbsLeftBound(View content) { - if (mMode == SlidingMenu.LEFT || mMode == SlidingMenu.LEFT_RIGHT) { - return content.getLeft() - getBehindWidth(); - } else if (mMode == SlidingMenu.RIGHT) { - return content.getLeft(); - } - return 0; + return content.getLeft() - getBehindWidth(); } public int getAbsRightBound(View content) { - if (mMode == SlidingMenu.LEFT) { - return content.getLeft(); - } else if (mMode == SlidingMenu.RIGHT || mMode == SlidingMenu.LEFT_RIGHT) { - return content.getLeft() + getBehindWidth(); - } - return 0; - } - - public boolean marginTouchAllowed(View content, int x) { - int left = content.getLeft(); - int right = content.getRight(); - if (mMode == SlidingMenu.LEFT) { - return (x >= left && x <= mMarginThreshold + left); - } else if (mMode == SlidingMenu.RIGHT) { - return (x <= right && x >= right - mMarginThreshold); - } else if (mMode == SlidingMenu.LEFT_RIGHT) { - return (x >= left && x <= mMarginThreshold + left) || - (x <= right && x >= right - mMarginThreshold); - } - return false; - } - - public void setTouchMode(int i) { - mTouchMode = i; - } - - public boolean menuOpenTouchAllowed(View content, int currPage, float x) { - switch (mTouchMode) { - case SlidingMenu.TOUCHMODE_FULLSCREEN: - return true; - case SlidingMenu.TOUCHMODE_MARGIN: - return menuTouchInQuickReturn(content, currPage, x); - } - return false; + return content.getLeft(); } /** @@ -288,125 +142,22 @@ public class CustomViewBehind extends ViewGroup { * @param x the position of the touch */ public boolean menuTouchInQuickReturn(View content, int currPage, float x) { - if (mMode == SlidingMenu.LEFT || (mMode == SlidingMenu.LEFT_RIGHT && currPage == 0)) { - return x >= content.getLeft(); - } else if (mMode == SlidingMenu.RIGHT || (mMode == SlidingMenu.LEFT_RIGHT && currPage == 2)) { - return x <= content.getRight(); - } - return false; + return x >= content.getLeft(); } public boolean menuClosedSlideAllowed(float dx) { - if (mMode == SlidingMenu.LEFT) { - return dx > 0; - } else if (mMode == SlidingMenu.RIGHT) { - return dx < 0; - } else if (mMode == SlidingMenu.LEFT_RIGHT) { - return true; - } - return false; + return dx > 0; } public boolean menuOpenSlideAllowed(float dx) { - if (mMode == SlidingMenu.LEFT) { - return dx < 0; - } else if (mMode == SlidingMenu.RIGHT) { - return dx > 0; - } else if (mMode == SlidingMenu.LEFT_RIGHT) { - return true; - } - return false; + return dx < 0; } public void drawShadow(View content, Canvas canvas) { if (mShadowDrawable == null || mShadowWidth <= 0) return; - int left = 0; - if (mMode == SlidingMenu.LEFT) { - left = content.getLeft() - mShadowWidth; - } else if (mMode == SlidingMenu.RIGHT) { - left = content.getRight(); - } else if (mMode == SlidingMenu.LEFT_RIGHT) { - left = content.getLeft() - mShadowWidth; - } + int left = content.getLeft() - mShadowWidth; mShadowDrawable.setBounds(left, 0, left + mShadowWidth, getHeight()); mShadowDrawable.draw(canvas); } - public void drawFade(View content, Canvas canvas, float openPercent) { - if (!mFadeEnabled) return; - final int alpha = (int) (mFadeDegree * 255 * Math.abs(1 - openPercent)); - mFadePaint.setColor(Color.argb(alpha, 0, 0, 0)); - int left = 0; - int right = 0; - if (mMode == SlidingMenu.LEFT) { - left = content.getLeft() - getBehindWidth(); - right = content.getLeft(); - } else if (mMode == SlidingMenu.RIGHT) { - left = content.getRight(); - right = content.getRight() + getBehindWidth(); - } else if (mMode == SlidingMenu.LEFT_RIGHT) { - left = content.getLeft() - getBehindWidth(); - right = content.getLeft(); - canvas.drawRect(left, 0, right, getHeight(), mFadePaint); - left = content.getRight(); - right = content.getRight() + getBehindWidth(); - } - canvas.drawRect(left, 0, right, getHeight(), mFadePaint); - } - - private boolean mSelectorEnabled = true; - private Bitmap mSelectorDrawable; - private View mSelectedView; - - public void drawSelector(View content, Canvas canvas, float openPercent) { - if (!mSelectorEnabled) return; - if (mSelectorDrawable != null && mSelectedView != null) { - String tag = (String) mSelectedView.getTag(R.id.selected_view); - if (tag.equals(TAG + "SelectedView")) { - canvas.save(); - int left, right, offset; - offset = (int) (mSelectorDrawable.getWidth() * openPercent); - if (mMode == SlidingMenu.LEFT) { - right = content.getLeft(); - left = right - offset; - canvas.clipRect(left, 0, right, getHeight()); - canvas.drawBitmap(mSelectorDrawable, left, getSelectorTop(), null); - } else if (mMode == SlidingMenu.RIGHT) { - left = content.getRight(); - right = left + offset; - canvas.clipRect(left, 0, right, getHeight()); - canvas.drawBitmap(mSelectorDrawable, right - mSelectorDrawable.getWidth(), getSelectorTop(), null); - } - canvas.restore(); - } - } - } - - public void setSelectorEnabled(boolean b) { - mSelectorEnabled = b; - } - - public void setSelectedView(View v) { - if (mSelectedView != null) { - mSelectedView.setTag(R.id.selected_view, null); - mSelectedView = null; - } - if (v != null && v.getParent() != null) { - mSelectedView = v; - mSelectedView.setTag(R.id.selected_view, TAG + "SelectedView"); - invalidate(); - } - } - - private int getSelectorTop() { - int y = mSelectedView.getTop(); - y += (mSelectedView.getHeight() - mSelectorDrawable.getHeight()) / 2; - return y; - } - - public void setSelectorBitmap(Bitmap b) { - mSelectorDrawable = b; - refreshDrawableState(); - } - } diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/view/slidingmenu/SlidingMenu.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/view/slidingmenu/SlidingMenu.java index 1d2695ef..eb4a8230 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/view/slidingmenu/SlidingMenu.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/view/slidingmenu/SlidingMenu.java @@ -1,79 +1,29 @@ package com.moez.QKSMS.ui.view.slidingmenu; import android.annotation.SuppressLint; -import android.annotation.TargetApi; -import android.app.Activity; import android.content.Context; -import android.content.res.TypedArray; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.graphics.Canvas; -import android.graphics.Point; import android.graphics.Rect; -import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Parcel; import android.os.Parcelable; import android.support.v4.content.ContextCompat; import android.util.AttributeSet; -import android.view.Display; import android.view.LayoutInflater; import android.view.View; -import android.view.ViewGroup; -import android.view.WindowManager; -import android.widget.FrameLayout; import android.widget.RelativeLayout; import com.moez.QKSMS.R; +import com.moez.QKSMS.common.utils.Units; import com.moez.QKSMS.ui.view.slidingmenu.CustomViewAbove.OnPageChangeListener; -import java.lang.reflect.Method; - /** * Stripped down version of Jeremy Feinstein's SlidingMenu library */ public class SlidingMenu extends RelativeLayout { - private static final String TAG = "SlidingMenu"; - public static final int SLIDING_WINDOW = 0; - public static final int SLIDING_CONTENT = 1; private boolean mActionbarOverlay = false; - /** - * Constant value for use with setTouchModeAbove(). Allows the SlidingMenu to be opened with a swipe - * gesture on the screen's margin - */ - public static final int TOUCHMODE_MARGIN = 0; - - /** - * Constant value for use with setTouchModeAbove(). Allows the SlidingMenu to be opened with a swipe - * gesture anywhere on the screen - */ - public static final int TOUCHMODE_FULLSCREEN = 1; - - /** - * Constant value for use with setTouchModeAbove(). Denies the SlidingMenu to be opened with a swipe - * gesture - */ - public static final int TOUCHMODE_NONE = 2; - - /** - * Constant value for use with setMode(). Puts the menu to the left of the content. - */ - public static final int LEFT = 0; - - /** - * Constant value for use with setMode(). Puts the menu to the right of the content. - */ - public static final int RIGHT = 1; - - /** - * Constant value for use with setMode(). Puts menus to the left and right of the content. - */ - public static final int LEFT_RIGHT = 2; - private CustomViewAbove mViewAbove; - private CustomViewBehind mViewBehind; private OnOpenListener mOpenListener; @@ -95,7 +45,7 @@ public class SlidingMenu extends RelativeLayout { /** * On open. */ - public void onOpen(); + void onOpen(); } /** @@ -114,7 +64,7 @@ public class SlidingMenu extends RelativeLayout { /** * On opened. */ - public void onOpened(); + void onOpened(); } /** @@ -133,7 +83,7 @@ public class SlidingMenu extends RelativeLayout { /** * On close. */ - public void onClose(); + void onClose(); } /** @@ -152,21 +102,7 @@ public class SlidingMenu extends RelativeLayout { /** * On closed. */ - public void onClosed(); - } - - /** - * The Interface CanvasTransformer. - */ - public interface CanvasTransformer { - - /** - * Transform canvas. - * - * @param canvas the canvas - * @param percentOpen the percent open - */ - public void transformCanvas(Canvas canvas, float percentOpen); + void onClosed(); } /** @@ -178,17 +114,6 @@ public class SlidingMenu extends RelativeLayout { this(context, null); } - /** - * Instantiates a new SlidingMenu and attach to Activity. - * - * @param activity the activity to attach slidingmenu - * @param slideStyle the slidingmenu style - */ - public SlidingMenu(Activity activity, int slideStyle) { - this(activity, null); - this.attachToActivity(activity, slideStyle); - } - /** * Instantiates a new SlidingMenu. * @@ -215,15 +140,14 @@ public class SlidingMenu extends RelativeLayout { LayoutParams aboveParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); mViewAbove = new CustomViewAbove(context); addView(mViewAbove, aboveParams); - // register the CustomViewBehind with the CustomViewAbove + mViewBehind.setScrollScale(0.5f); + mViewBehind.setShadowDrawable(ContextCompat.getDrawable(getContext(), R.drawable.shadow_slidingmenu)); mViewAbove.setCustomViewBehind(mViewBehind); - mViewBehind.setCustomViewAbove(mViewAbove); mViewAbove.setOnPageChangeListener(new OnPageChangeListener() { public static final int POSITION_OPEN = 0; public static final int POSITION_CLOSE = 1; - public void onPageScrolled(int position, float positionOffset, - int positionOffsetPixels) { + public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } public void onPageSelected(int position, boolean anim) { @@ -239,112 +163,6 @@ public class SlidingMenu extends RelativeLayout { } }); - // now style everything! - TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.SlidingMenu); - // set the above and behind views if defined in xml - int mode = ta.getInt(R.styleable.SlidingMenu_mode, LEFT); - setMode(mode); - int viewAbove = ta.getResourceId(R.styleable.SlidingMenu_viewAbove, -1); - if (viewAbove != -1) { - setContent(viewAbove); - } else { - setContent(new FrameLayout(context)); - } - int viewBehind = ta.getResourceId(R.styleable.SlidingMenu_viewBehind, -1); - if (viewBehind != -1) { - setMenu(viewBehind); - } else { - setMenu(new FrameLayout(context)); - } - int touchModeAbove = ta.getInt(R.styleable.SlidingMenu_touchModeAbove, TOUCHMODE_MARGIN); - setTouchModeAbove(touchModeAbove); - int touchModeBehind = ta.getInt(R.styleable.SlidingMenu_touchModeBehind, TOUCHMODE_MARGIN); - setTouchModeBehind(touchModeBehind); - - int offsetBehind = (int) ta.getDimension(R.styleable.SlidingMenu_behindOffset, -1); - int widthBehind = (int) ta.getDimension(R.styleable.SlidingMenu_behindWidth, -1); - if (offsetBehind != -1 && widthBehind != -1) - throw new IllegalStateException("Cannot set both behindOffset and behindWidth for a SlidingMenu"); - else if (offsetBehind != -1) - setBehindOffset(offsetBehind); - else if (widthBehind != -1) - setBehindWidth(widthBehind); - else - setBehindOffset(0); - float scrollOffsetBehind = ta.getFloat(R.styleable.SlidingMenu_behindScrollScale, 0.33f); - setBehindScrollScale(scrollOffsetBehind); - int shadowRes = ta.getResourceId(R.styleable.SlidingMenu_shadowDrawable, -1); - if (shadowRes != -1) { - setShadowDrawable(shadowRes); - } - int shadowWidth = (int) ta.getDimension(R.styleable.SlidingMenu_shadowWidth, 0); - setShadowWidth(shadowWidth); - boolean fadeEnabled = ta.getBoolean(R.styleable.SlidingMenu_fadeEnabled, true); - setFadeEnabled(fadeEnabled); - float fadeDeg = ta.getFloat(R.styleable.SlidingMenu_fadeDegree, 0.33f); - setFadeDegree(fadeDeg); - boolean selectorEnabled = ta.getBoolean(R.styleable.SlidingMenu_selectorEnabled, false); - setSelectorEnabled(selectorEnabled); - int selectorRes = ta.getResourceId(R.styleable.SlidingMenu_selectorDrawable, -1); - if (selectorRes != -1) - setSelectorDrawable(selectorRes); - ta.recycle(); - } - - /** - * Attaches the SlidingMenu to an entire Activity - * - * @param activity the Activity - * @param slideStyle either SLIDING_CONTENT or SLIDING_WINDOW - */ - public void attachToActivity(Activity activity, int slideStyle) { - attachToActivity(activity, slideStyle, false); - } - - /** - * Attaches the SlidingMenu to an entire Activity - * - * @param activity the Activity - * @param slideStyle either SLIDING_CONTENT or SLIDING_WINDOW - * @param actionbarOverlay whether or not the ActionBar is overlaid - */ - public void attachToActivity(Activity activity, int slideStyle, boolean actionbarOverlay) { - if (slideStyle != SLIDING_WINDOW && slideStyle != SLIDING_CONTENT) - throw new IllegalArgumentException("slideStyle must be either SLIDING_WINDOW or SLIDING_CONTENT"); - - if (getParent() != null) - throw new IllegalStateException("This SlidingMenu appears to already be attached"); - - // get the window background - TypedArray a = activity.getTheme().obtainStyledAttributes(new int[]{android.R.attr.windowBackground}); - int background = a.getResourceId(0, 0); - a.recycle(); - - switch (slideStyle) { - case SLIDING_WINDOW: - mActionbarOverlay = false; - ViewGroup decor = (ViewGroup) activity.getWindow().getDecorView(); - ViewGroup decorChild = (ViewGroup) decor.getChildAt(0); - // save ActionBar themes that have transparent assets - decorChild.setBackgroundResource(background); - decor.removeView(decorChild); - decor.addView(this); - setContent(decorChild); - break; - case SLIDING_CONTENT: - mActionbarOverlay = actionbarOverlay; - // take the above view out of - ViewGroup contentParent = (ViewGroup) activity.findViewById(android.R.id.content); - contentParent.addView(LayoutInflater.from(getContext()).inflate(R.layout.toolbar, contentParent, false)); - View content = contentParent.getChildAt(0); - contentParent.removeView(content); - contentParent.addView(this); - setContent(content); - // save people from having transparent backgrounds - if (content.getBackground() == null) - content.setBackgroundResource(background); - break; - } } /** @@ -353,18 +171,8 @@ public class SlidingMenu extends RelativeLayout { * * @param res the new content */ - public void setContent(int res) { - setContent(LayoutInflater.from(getContext()).inflate(res, null)); - } - - /** - * Set the above view content to the given View. - * - * @param view The desired content to display. - */ - public void setContent(View view) { - mViewAbove.setContent(view); - showContent(); + public void setContent() { + mViewAbove.setContent(LayoutInflater.from(getContext()).inflate(R.layout.content_frame, null)); } /** @@ -382,17 +190,8 @@ public class SlidingMenu extends RelativeLayout { * * @param res the new content */ - public void setMenu(int res) { - setMenu(LayoutInflater.from(getContext()).inflate(res, null)); - } - - /** - * Set the behind view (menu) content to the given View. - * - * @param view The desired content to display. - */ - public void setMenu(View v) { - mViewBehind.setContent(v); + public void setMenu() { + mViewBehind.setContent(LayoutInflater.from(getContext()).inflate(R.layout.menu_frame, null)); } /** @@ -404,65 +203,6 @@ public class SlidingMenu extends RelativeLayout { return mViewBehind.getContent(); } - - /** - * Sets the sliding enabled. - * - * @param b true to enable sliding, false to disable it. - */ - public void setSlidingEnabled(boolean b) { - mViewAbove.setSlidingEnabled(b); - } - - /** - * Checks if is sliding enabled. - * - * @return true, if is sliding enabled - */ - public boolean isSlidingEnabled() { - return mViewAbove.isSlidingEnabled(); - } - - /** - * Sets which side the SlidingMenu should appear on. - * - * @param mode must be either SlidingMenu.LEFT or SlidingMenu.RIGHT - */ - public void setMode(int mode) { - if (mode != LEFT && mode != RIGHT && mode != LEFT_RIGHT) { - throw new IllegalStateException("SlidingMenu mode must be LEFT, RIGHT, or LEFT_RIGHT"); - } - mViewBehind.setMode(mode); - } - - /** - * Returns the current side that the SlidingMenu is on. - * - * @return the current mode, either SlidingMenu.LEFT or SlidingMenu.RIGHT - */ - public int getMode() { - return mViewBehind.getMode(); - } - - /** - * Sets whether or not the SlidingMenu is in static mode (i.e. nothing is moving and everything is showing) - * - * @param b true to set static mode, false to disable static mode. - */ - public void setStatic(boolean b) { - if (b) { - setSlidingEnabled(false); - mViewAbove.setCustomViewBehind(null); - mViewAbove.setCurrentItem(1); - // mViewBehind.setCurrentItem(0); - } else { - mViewAbove.setCurrentItem(1); - // mViewBehind.setCurrentItem(1); - mViewAbove.setCustomViewBehind(mViewBehind); - setSlidingEnabled(true); - } - } - /** * Opens the menu and shows the menu view. */ @@ -476,7 +216,7 @@ public class SlidingMenu extends RelativeLayout { * @param animate true to animate the transition, false to ignore animation */ public void showMenu(boolean animate) { - mViewAbove.setCurrentItem(0, animate); + mViewAbove.setCurrentItem(0, animate, true); } /** @@ -524,15 +264,6 @@ public class SlidingMenu extends RelativeLayout { return mViewAbove.getCurrentItem() == 0 || mViewAbove.getCurrentItem() == 2; } - /** - * Gets the behind offset. - * - * @return The margin on the right of the screen that the behind view scrolls to - */ - public int getBehindOffset() { - return ((LayoutParams) mViewBehind.getLayoutParams()).rightMargin; - } - /** * Sets the behind offset. * @@ -547,282 +278,12 @@ public class SlidingMenu extends RelativeLayout { mViewBehind.setWidthOffset(i); } - /** - * Sets the behind offset. - * - * @param resID The dimension resource id to be set as the behind offset. - * The menu, when open, will leave this width margin on the right of the screen. - */ - public void setBehindOffsetRes(int resID) { - int i = (int) getContext().getResources().getDimension(resID); - setBehindOffset(i); - } - - /** - * Sets the above offset. - * - * @param i the new above offset, in pixels - */ - public void setAboveOffset(int i) { - mViewAbove.setAboveOffset(i); - } - - /** - * Sets the above offset. - * - * @param resID The dimension resource id to be set as the above offset. - */ - public void setAboveOffsetRes(int resID) { - int i = (int) getContext().getResources().getDimension(resID); - setAboveOffset(i); - } - - /** - * Sets the behind width. - * - * @param i The width the Sliding Menu will open to, in pixels - */ - @SuppressWarnings("deprecation") - public void setBehindWidth(int i) { - int width; - Display display = ((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE)) - .getDefaultDisplay(); - try { - Class cls = Display.class; - Class[] parameterTypes = {Point.class}; - Point parameter = new Point(); - Method method = cls.getMethod("getSize", parameterTypes); - method.invoke(display, parameter); - width = parameter.x; - } catch (Exception e) { - width = display.getWidth(); - } - setBehindOffset(width - i); - } - - /** - * Sets the behind width. - * - * @param res The dimension resource id to be set as the behind width offset. - * The menu, when open, will open this wide. - */ - public void setBehindWidthRes(int res) { - int i = (int) getContext().getResources().getDimension(res); - setBehindWidth(i); - } - - /** - * Gets the behind scroll scale. - * - * @return The scale of the parallax scroll - */ - public float getBehindScrollScale() { - return mViewBehind.getScrollScale(); - } - - /** - * Gets the touch mode margin threshold - * - * @return the touch mode margin threshold - */ - public int getTouchmodeMarginThreshold() { - return mViewBehind.getMarginThreshold(); - } - - /** - * Set the touch mode margin threshold - * - * @param touchmodeMarginThreshold - */ - public void setTouchmodeMarginThreshold(int touchmodeMarginThreshold) { - mViewBehind.setMarginThreshold(touchmodeMarginThreshold); - } - - /** - * Sets the behind scroll scale. - * - * @param f The scale of the parallax scroll (i.e. 1.0f scrolls 1 pixel for every - * 1 pixel that the above view scrolls and 0.0f scrolls 0 pixels) - */ - public void setBehindScrollScale(float f) { - if (f < 0 && f > 1) - throw new IllegalStateException("ScrollScale must be between 0 and 1"); - mViewBehind.setScrollScale(f); - } - - /** - * Sets the behind canvas transformer. - * - * @param t the new behind canvas transformer - */ - public void setBehindCanvasTransformer(CanvasTransformer t) { - mViewBehind.setCanvasTransformer(t); - } - - /** - * Gets the touch mode above. - * - * @return the touch mode above - */ - public int getTouchModeAbove() { - return mViewAbove.getTouchMode(); - } - - /** - * Controls whether the SlidingMenu can be opened with a swipe gesture. - * Options are {@link #TOUCHMODE_MARGIN TOUCHMODE_MARGIN}, {@link #TOUCHMODE_FULLSCREEN TOUCHMODE_FULLSCREEN}, - * or {@link #TOUCHMODE_NONE TOUCHMODE_NONE} - * - * @param i the new touch mode - */ - public void setTouchModeAbove(int i) { - if (i != TOUCHMODE_FULLSCREEN && i != TOUCHMODE_MARGIN - && i != TOUCHMODE_NONE) { - throw new IllegalStateException("TouchMode must be set to either" + - "TOUCHMODE_FULLSCREEN or TOUCHMODE_MARGIN or TOUCHMODE_NONE."); - } - mViewAbove.setTouchMode(i); - } - - /** - * Controls whether the SlidingMenu can be opened with a swipe gesture. - * Options are {@link #TOUCHMODE_MARGIN TOUCHMODE_MARGIN}, {@link #TOUCHMODE_FULLSCREEN TOUCHMODE_FULLSCREEN}, - * or {@link #TOUCHMODE_NONE TOUCHMODE_NONE} - * - * @param i the new touch mode - */ - public void setTouchModeBehind(int i) { - if (i != TOUCHMODE_FULLSCREEN && i != TOUCHMODE_MARGIN - && i != TOUCHMODE_NONE) { - throw new IllegalStateException("TouchMode must be set to either" + - "TOUCHMODE_FULLSCREEN or TOUCHMODE_MARGIN or TOUCHMODE_NONE."); - } - mViewBehind.setTouchMode(i); - } - - /** - * Sets the shadow drawable. - * - * @param resId the resource ID of the new shadow drawable - */ - public void setShadowDrawable(int resId) { - setShadowDrawable(ContextCompat.getDrawable(getContext(), resId)); - } - - /** - * Sets the shadow drawable. - * - * @param d the new shadow drawable - */ - public void setShadowDrawable(Drawable d) { - mViewBehind.setShadowDrawable(d); - } - - /** - * Sets the shadow width. - * - * @param resId The dimension resource id to be set as the shadow width. - */ - public void setShadowWidthRes(int resId) { - setShadowWidth((int) getResources().getDimension(resId)); - } - - /** - * Sets the shadow width. - * - * @param pixels the new shadow width, in pixels - */ - public void setShadowWidth(int pixels) { - mViewBehind.setShadowWidth(pixels); - } - - /** - * Enables or disables the SlidingMenu's fade in and out - * - * @param b true to enable fade, false to disable it - */ - public void setFadeEnabled(boolean b) { - mViewBehind.setFadeEnabled(b); - } - - /** - * Sets how much the SlidingMenu fades in and out. Fade must be enabled, see - * {@link #setFadeEnabled(boolean) setFadeEnabled(boolean)} - * - * @param f the new fade degree, between 0.0f and 1.0f - */ - public void setFadeDegree(float f) { - mViewBehind.setFadeDegree(f); - } - - /** - * Enables or disables whether the selector is drawn - * - * @param b true to draw the selector, false to not draw the selector - */ - public void setSelectorEnabled(boolean b) { - mViewBehind.setSelectorEnabled(true); - } - - /** - * Sets the selected view. The selector will be drawn here - * - * @param v the new selected view - */ - public void setSelectedView(View v) { - mViewBehind.setSelectedView(v); - } - - /** - * Sets the selector drawable. - * - * @param res a resource ID for the selector drawable - */ - public void setSelectorDrawable(int res) { - mViewBehind.setSelectorBitmap(BitmapFactory.decodeResource(getResources(), res)); - } - - /** - * Sets the selector drawable. - * - * @param b the new selector bitmap - */ - public void setSelectorBitmap(Bitmap b) { - mViewBehind.setSelectorBitmap(b); - } - - /** - * Add a View ignored by the Touch Down event when mode is Fullscreen - * - * @param v a view to be ignored - */ - public void addIgnoredView(View v) { - mViewAbove.addIgnoredView(v); - } - - /** - * Remove a View ignored by the Touch Down event when mode is Fullscreen - * - * @param v a view not wanted to be ignored anymore - */ - public void removeIgnoredView(View v) { - mViewAbove.removeIgnoredView(v); - } - - /** - * Clear the list of Views ignored by the Touch Down event when mode is Fullscreen - */ - public void clearIgnoredViews() { - mViewAbove.clearIgnoredViews(); - } - /** * Sets the OnOpenListener. {@link OnOpenListener#onOpen() OnOpenListener.onOpen()} will be called when the SlidingMenu is opened * * @param listener the new OnOpenListener */ public void setOnOpenListener(OnOpenListener listener) { - //mViewAbove.setOnOpenListener(listener); mOpenListener = listener; } @@ -833,7 +294,6 @@ public class SlidingMenu extends RelativeLayout { * @param listener the new setOnCloseListener */ public void setOnCloseListener(OnCloseListener listener) { - //mViewAbove.setOnCloseListener(listener); mCloseListener = listener; } @@ -932,7 +392,6 @@ public class SlidingMenu extends RelativeLayout { return true; } - @TargetApi(Build.VERSION_CODES.HONEYCOMB) public void manageLayers(float percentOpen) { if (Build.VERSION.SDK_INT < 11) return; diff --git a/QKSMS/src/main/res/values/attrs.xml b/QKSMS/src/main/res/values/attrs.xml index 5af737fd..5a63fd08 100644 --- a/QKSMS/src/main/res/values/attrs.xml +++ b/QKSMS/src/main/res/values/attrs.xml @@ -66,32 +66,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file