diff --git a/.classpath b/.classpath
index 6c635c0..6aed2eb 100644
--- a/.classpath
+++ b/.classpath
@@ -3,5 +3,6 @@
+
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 6f2b0c6..a7e1b8e 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -7,37 +7,43 @@
** Author: Lorensius W. L. T
**
*/
- -->
-
+-->
+
-
-
-
-
+ package="net.londatiga.android"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+
+
+
+
+
-
-
+
-
-
+
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 42d346d..7fd6b98 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,4 +13,5 @@ Version 1.0.0 *(2011-10-20)*
7. Updated NewQuickAction3DActivity to show the toast message based on label of action item clicked as you now have enough info in callback to do that generically
3. New listener to handle on dismiss event.
4. Fix force close that occured when tapping randomly on a view to show QuickAction dialog ([issue](https://github.com/lorensiuswlt/NewQuickAction3D/issues/2)). Thanx to [Zammbi](zammbi@gmail.com) for bug fixing..
-5. Add __Apache License, Version 2.0__ to this source code (see LICENSE.txt)
\ No newline at end of file
+5. Add __Apache License, Version 2.0__ to this source code (see LICENSE.txt)
+6. QuickAction was adapted to HD-screens. By Maksim Bartosh
diff --git a/README.md b/README.md
index f40bf29..15ae060 100644
--- a/README.md
+++ b/README.md
@@ -3,6 +3,15 @@ NewQuickAction
NewQuickAction is a small android library to create QuickAction dialog.
+Hi, i fixs bug in shown QuickAction at larges screens.
+
+QuickAction correctly shown at small screens, her width is width of screen.
+And QuickActtion correctly shown at large screen, and her width value is MAX_WIDTH_POPUP_WINDOWS constant. Arrow shown is correctly, too.
+
+Add constant MAX_WIDTH_POPUP_WINDOWS;
+Set min SDK version(API 7, as before) and target SDK version(API 15).
+
+
How to Use
==========
This repo includes a sample Activity (__ExampleActivity1.java__) to show how to use QuickAction.
@@ -79,6 +88,7 @@ Developed By
============
* Lorensius W. L. T -
+* Maksim Bartosh
Contributors
============
@@ -105,4 +115,4 @@ License
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
- limitations under the License.
\ No newline at end of file
+ limitations under the License.
diff --git a/bin/NewQuickAction.apk b/bin/NewQuickAction.apk
index 26b1593..022385d 100644
Binary files a/bin/NewQuickAction.apk and b/bin/NewQuickAction.apk differ
diff --git a/bin/classes.dex b/bin/classes.dex
index a116fe3..1ef9aaf 100644
Binary files a/bin/classes.dex and b/bin/classes.dex differ
diff --git a/bin/classes/net/londatiga/android/Example1Activity$1.class b/bin/classes/net/londatiga/android/Example1Activity$1.class
index 7870260..5d8d32f 100644
Binary files a/bin/classes/net/londatiga/android/Example1Activity$1.class and b/bin/classes/net/londatiga/android/Example1Activity$1.class differ
diff --git a/bin/classes/net/londatiga/android/Example1Activity$2.class b/bin/classes/net/londatiga/android/Example1Activity$2.class
index 692e104..59a599a 100644
Binary files a/bin/classes/net/londatiga/android/Example1Activity$2.class and b/bin/classes/net/londatiga/android/Example1Activity$2.class differ
diff --git a/bin/classes/net/londatiga/android/Example1Activity$3.class b/bin/classes/net/londatiga/android/Example1Activity$3.class
index 22138aa..036095d 100644
Binary files a/bin/classes/net/londatiga/android/Example1Activity$3.class and b/bin/classes/net/londatiga/android/Example1Activity$3.class differ
diff --git a/bin/classes/net/londatiga/android/Example1Activity$4.class b/bin/classes/net/londatiga/android/Example1Activity$4.class
index fe77212..54f8bad 100644
Binary files a/bin/classes/net/londatiga/android/Example1Activity$4.class and b/bin/classes/net/londatiga/android/Example1Activity$4.class differ
diff --git a/bin/classes/net/londatiga/android/Example1Activity.class b/bin/classes/net/londatiga/android/Example1Activity.class
index a0fe577..05fe8d0 100644
Binary files a/bin/classes/net/londatiga/android/Example1Activity.class and b/bin/classes/net/londatiga/android/Example1Activity.class differ
diff --git a/bin/classes/net/londatiga/android/Example2Activity$3.class b/bin/classes/net/londatiga/android/Example2Activity$3.class
index c590c49..bb48c30 100644
Binary files a/bin/classes/net/londatiga/android/Example2Activity$3.class and b/bin/classes/net/londatiga/android/Example2Activity$3.class differ
diff --git a/bin/classes/net/londatiga/android/Example2Activity.class b/bin/classes/net/londatiga/android/Example2Activity.class
index bc73cb5..2458af1 100644
Binary files a/bin/classes/net/londatiga/android/Example2Activity.class and b/bin/classes/net/londatiga/android/Example2Activity.class differ
diff --git a/bin/classes/net/londatiga/android/NewQAAdapter.class b/bin/classes/net/londatiga/android/NewQAAdapter.class
index 238844b..8d26c26 100644
Binary files a/bin/classes/net/londatiga/android/NewQAAdapter.class and b/bin/classes/net/londatiga/android/NewQAAdapter.class differ
diff --git a/bin/classes/net/londatiga/android/PopupWindows$1.class b/bin/classes/net/londatiga/android/PopupWindows$1.class
index d00b122..7cc85bc 100644
Binary files a/bin/classes/net/londatiga/android/PopupWindows$1.class and b/bin/classes/net/londatiga/android/PopupWindows$1.class differ
diff --git a/bin/classes/net/londatiga/android/PopupWindows.class b/bin/classes/net/londatiga/android/PopupWindows.class
index 9366af8..bffe605 100644
Binary files a/bin/classes/net/londatiga/android/PopupWindows.class and b/bin/classes/net/londatiga/android/PopupWindows.class differ
diff --git a/bin/classes/net/londatiga/android/QuickAction$1.class b/bin/classes/net/londatiga/android/QuickAction$1.class
index e4aa04c..cd1a28e 100644
Binary files a/bin/classes/net/londatiga/android/QuickAction$1.class and b/bin/classes/net/londatiga/android/QuickAction$1.class differ
diff --git a/bin/classes/net/londatiga/android/QuickAction$2$1.class b/bin/classes/net/londatiga/android/QuickAction$2$1.class
index bc95127..624055c 100644
Binary files a/bin/classes/net/londatiga/android/QuickAction$2$1.class and b/bin/classes/net/londatiga/android/QuickAction$2$1.class differ
diff --git a/bin/classes/net/londatiga/android/QuickAction$2.class b/bin/classes/net/londatiga/android/QuickAction$2.class
index 7008ca6..880435e 100644
Binary files a/bin/classes/net/londatiga/android/QuickAction$2.class and b/bin/classes/net/londatiga/android/QuickAction$2.class differ
diff --git a/bin/classes/net/londatiga/android/QuickAction.class b/bin/classes/net/londatiga/android/QuickAction.class
index 681458d..aaee5f1 100644
Binary files a/bin/classes/net/londatiga/android/QuickAction.class and b/bin/classes/net/londatiga/android/QuickAction.class differ
diff --git a/bin/classes/net/londatiga/android/QuickActionActivity.class b/bin/classes/net/londatiga/android/QuickActionActivity.class
index c7ba984..83aa42c 100644
Binary files a/bin/classes/net/londatiga/android/QuickActionActivity.class and b/bin/classes/net/londatiga/android/QuickActionActivity.class differ
diff --git a/bin/classes/net/londatiga/android/R$drawable.class b/bin/classes/net/londatiga/android/R$drawable.class
index 8833713..133bf6e 100644
Binary files a/bin/classes/net/londatiga/android/R$drawable.class and b/bin/classes/net/londatiga/android/R$drawable.class differ
diff --git a/bin/classes/net/londatiga/android/R$id.class b/bin/classes/net/londatiga/android/R$id.class
index 3a35afb..bfd1c36 100644
Binary files a/bin/classes/net/londatiga/android/R$id.class and b/bin/classes/net/londatiga/android/R$id.class differ
diff --git a/bin/classes/net/londatiga/android/R$layout.class b/bin/classes/net/londatiga/android/R$layout.class
index 843572f..1018006 100644
Binary files a/bin/classes/net/londatiga/android/R$layout.class and b/bin/classes/net/londatiga/android/R$layout.class differ
diff --git a/bin/classes/net/londatiga/android/R$string.class b/bin/classes/net/londatiga/android/R$string.class
index 571a47c..9f9f251 100644
Binary files a/bin/classes/net/londatiga/android/R$string.class and b/bin/classes/net/londatiga/android/R$string.class differ
diff --git a/bin/classes/net/londatiga/android/R$style.class b/bin/classes/net/londatiga/android/R$style.class
index 3d63c24..574110c 100644
Binary files a/bin/classes/net/londatiga/android/R$style.class and b/bin/classes/net/londatiga/android/R$style.class differ
diff --git a/bin/resources.ap_ b/bin/resources.ap_
index c546000..c18c3de 100644
Binary files a/bin/resources.ap_ and b/bin/resources.ap_ differ
diff --git a/gen/net/londatiga/android/R.java b/gen/net/londatiga/android/R.java
index def6e55..ddfb036 100644
--- a/gen/net/londatiga/android/R.java
+++ b/gen/net/londatiga/android/R.java
@@ -34,33 +34,34 @@ public static final class drawable {
public static final int icon=0x7f020005;
public static final int quickaction_arrow_down=0x7f020006;
public static final int quickaction_arrow_up=0x7f020007;
- public static final int quickaction_background=0x7f020008;
- public static final int quickaction_bottom_frame=0x7f020009;
- public static final int quickaction_slider_background=0x7f02000a;
- public static final int quickaction_slider_btn=0x7f02000b;
- public static final int quickaction_slider_btn_normal=0x7f02000c;
- public static final int quickaction_slider_btn_on=0x7f02000d;
- public static final int quickaction_slider_btn_pressed=0x7f02000e;
- public static final int quickaction_slider_btn_selected=0x7f02000f;
- public static final int quickaction_slider_grip_left=0x7f020010;
- public static final int quickaction_slider_grip_right=0x7f020011;
- public static final int quickaction_top_frame=0x7f020012;
- public static final int quickcontact_drop_shadow=0x7f020013;
- public static final int textfield_default=0x7f020014;
+ public static final int quickaction_bottom_frame=0x7f020008;
+ public static final int quickaction_slider_background=0x7f020009;
+ public static final int quickaction_slider_btn=0x7f02000a;
+ public static final int quickaction_slider_btn_normal=0x7f02000b;
+ public static final int quickaction_slider_btn_on=0x7f02000c;
+ public static final int quickaction_slider_btn_pressed=0x7f02000d;
+ public static final int quickaction_slider_btn_selected=0x7f02000e;
+ public static final int quickaction_slider_grip_left=0x7f02000f;
+ public static final int quickaction_slider_grip_right=0x7f020010;
+ public static final int quickaction_top_frame=0x7f020011;
+ public static final int quickcontact_drop_shadow=0x7f020012;
+ public static final int textfield_default=0x7f020013;
}
public static final class id {
- public static final int arrow_down=0x7f07000c;
- public static final int arrow_up=0x7f070008;
+ public static final int arrow_down=0x7f07000e;
+ public static final int arrow_up=0x7f07000a;
public static final int btn1=0x7f070002;
- public static final int btn2=0x7f070003;
- public static final int footer=0x7f07000b;
- public static final int header2=0x7f070007;
- public static final int i_more=0x7f070005;
+ public static final int btn2=0x7f070005;
+ public static final int btn3=0x7f070003;
+ public static final int btn4=0x7f070004;
+ public static final int footer=0x7f07000d;
+ public static final int header2=0x7f070009;
+ public static final int i_more=0x7f070007;
public static final int iv_icon=0x7f070000;
- public static final int l_list=0x7f070004;
- public static final int scroll=0x7f070009;
- public static final int t_name=0x7f070006;
- public static final int tracks=0x7f07000a;
+ public static final int l_list=0x7f070006;
+ public static final int scroll=0x7f07000b;
+ public static final int t_name=0x7f070008;
+ public static final int tracks=0x7f07000c;
public static final int tv_title=0x7f070001;
}
public static final class layout {
diff --git a/project.properties b/project.properties
index 5a70945..730e911 100644
--- a/project.properties
+++ b/project.properties
@@ -8,4 +8,4 @@
# project structure.
# Project target.
-target=android-7
+target=android-14
diff --git a/res/layout/example1.xml b/res/layout/example1.xml
index 09cdffb..469d45c 100644
--- a/res/layout/example1.xml
+++ b/res/layout/example1.xml
@@ -21,6 +21,24 @@
android:padding="30dp"
android:text="Button 1"/>
+
+
+
+
*
- * Contributors:
- * - Kevin Peck
+ * Contributors: - Kevin Peck
*/
public class QuickAction extends PopupWindows implements OnDismissListener {
private ImageView mArrowUp;
@@ -39,93 +38,101 @@ public class QuickAction extends PopupWindows implements OnDismissListener {
private ViewGroup mTrack;
private OnActionItemClickListener mItemClickListener;
private OnDismissListener mDismissListener;
-
+
private List mActionItemList = new ArrayList();
-
+
private boolean mDidAction;
private boolean mAnimateTrack;
-
- private int mChildPos;
- private int mAnimStyle;
-
+
+ private int mChildPos;
+ private int mAnimStyle;
+
public static final int ANIM_GROW_FROM_LEFT = 1;
public static final int ANIM_GROW_FROM_RIGHT = 2;
public static final int ANIM_GROW_FROM_CENTER = 3;
public static final int ANIM_AUTO = 4;
-
+
/**
* Constructor.
*
- * @param context Context
+ * @param context
+ * Context
*/
public QuickAction(Context context) {
super(context);
-
- inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- mTrackAnim = AnimationUtils.loadAnimation(context, R.anim.rail);
-
+ inflater = (LayoutInflater) context
+ .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+
+ mTrackAnim = AnimationUtils.loadAnimation(context, R.anim.rail);
+
mTrackAnim.setInterpolator(new Interpolator() {
public float getInterpolation(float t) {
- // Pushes past the target area, then snaps back into place.
- // Equation for graphing: 1.2-((x*1.6)-1.1)^2
+ // Pushes past the target area, then snaps back into place.
+ // Equation for graphing: 1.2-((x*1.6)-1.1)^2
final float inner = (t * 1.55f) - 1.1f;
-
- return 1.2f - inner * inner;
- }
+
+ return 1.2f - inner * inner;
+ }
});
-
+
setRootViewId(R.layout.quickaction);
-
- mAnimStyle = ANIM_AUTO;
- mAnimateTrack = true;
- mChildPos = 0;
+
+ mAnimStyle = ANIM_AUTO;
+ mAnimateTrack = true;
+ mChildPos = 0;
}
-
+
/**
- * Get action item at an index
- *
- * @param index Index of item (position from callback)
- *
- * @return Action Item at the position
- */
- public ActionItem getActionItem(int index) {
- return mActionItemList.get(index);
- }
-
+ * Get action item at an index
+ *
+ * @param index
+ * Index of item (position from callback)
+ *
+ * @return Action Item at the position
+ */
+ public ActionItem getActionItem(int index) {
+ return mActionItemList.get(index);
+ }
+
/**
* Set root view.
*
- * @param id Layout resource id
+ * @param id
+ * Layout resource id
*/
public void setRootViewId(int id) {
- mRootView = (ViewGroup) inflater.inflate(id, null);
- mTrack = (ViewGroup) mRootView.findViewById(R.id.tracks);
+ mRootView = (ViewGroup) inflater.inflate(id, null);
+ mTrack = (ViewGroup) mRootView.findViewById(R.id.tracks);
- mArrowDown = (ImageView) mRootView.findViewById(R.id.arrow_down);
- mArrowUp = (ImageView) mRootView.findViewById(R.id.arrow_up);
+ mArrowDown = (ImageView) mRootView.findViewById(R.id.arrow_down);
+ mArrowUp = (ImageView) mRootView.findViewById(R.id.arrow_up);
+
+ // This was previously defined on show() method, moved here to prevent
+ // force close that occured
+ // when tapping fastly on a view to show quickaction dialog.
+ // Thanx to zammbi (github.com/zammbi)
+ mRootView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
+ LayoutParams.WRAP_CONTENT));
- //This was previously defined on show() method, moved here to prevent force close that occured
- //when tapping fastly on a view to show quickaction dialog.
- //Thanx to zammbi (github.com/zammbi)
- mRootView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
-
setContentView(mRootView);
}
-
+
/**
* Animate track.
*
- * @param mAnimateTrack flag to animate track
+ * @param mAnimateTrack
+ * flag to animate track
*/
public void mAnimateTrack(boolean mAnimateTrack) {
this.mAnimateTrack = mAnimateTrack;
}
-
+
/**
* Set animation style.
*
- * @param mAnimStyle animation style, default is set to ANIM_AUTO
+ * @param mAnimStyle
+ * animation style, default is set to ANIM_AUTO
*/
public void setAnimStyle(int mAnimStyle) {
this.mAnimStyle = mAnimStyle;
@@ -134,194 +141,222 @@ public void setAnimStyle(int mAnimStyle) {
/**
* Add action item
*
- * @param action {@link ActionItem}
+ * @param action
+ * {@link ActionItem}
*/
public void addActionItem(ActionItem action) {
mActionItemList.add(action);
-
- String title = action.getTitle();
- Drawable icon = action.getIcon();
-
- View container = (View) inflater.inflate(R.layout.action_item, null);
-
- ImageView img = (ImageView) container.findViewById(R.id.iv_icon);
- TextView text = (TextView) container.findViewById(R.id.tv_title);
-
- if (icon != null) {
+
+ String title = action.getTitle();
+ Drawable icon = action.getIcon();
+
+ View container = (View) inflater.inflate(R.layout.action_item, null);
+
+ ImageView img = (ImageView) container.findViewById(R.id.iv_icon);
+ TextView text = (TextView) container.findViewById(R.id.tv_title);
+
+ if (icon != null) {
img.setImageDrawable(icon);
} else {
img.setVisibility(View.GONE);
}
-
+
if (title != null) {
text.setText(title);
} else {
text.setVisibility(View.GONE);
}
-
- final int pos = mChildPos;
- final int actionId = action.getActionId();
-
+
+ final int pos = mChildPos;
+ final int actionId = action.getActionId();
+
container.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (mItemClickListener != null) {
- mItemClickListener.onItemClick(QuickAction.this, pos, actionId);
- }
-
- if (!getActionItem(pos).isSticky()) {
- mDidAction = true;
-
- //workaround for transparent background bug
- //thx to Roman Wozniak
- v.post(new Runnable() {
- @Override
- public void run() {
- dismiss();
- }
- });
- }
+ mItemClickListener.onItemClick(QuickAction.this, pos,
+ actionId);
+ }
+
+ if (!getActionItem(pos).isSticky()) {
+ mDidAction = true;
+
+ // workaround for transparent background bug
+ // thx to Roman Wozniak
+ v.post(new Runnable() {
+ @Override
+ public void run() {
+ dismiss();
+ }
+ });
+ }
}
});
-
+
container.setFocusable(true);
container.setClickable(true);
-
- mTrack.addView(container, mChildPos+1);
-
+
+ mTrack.addView(container, mChildPos + 1);
+
mChildPos++;
}
-
+
public void setOnActionItemClickListener(OnActionItemClickListener listener) {
mItemClickListener = listener;
}
-
+
/**
* Show popup mWindow
*/
- public void show (View anchor) {
+ public void show(View anchor) {
preShow();
- int[] location = new int[2];
-
- mDidAction = false;
-
+ int[] location = new int[2];
+
+ mDidAction = false;
+
anchor.getLocationOnScreen(location);
- Rect anchorRect = new Rect(location[0], location[1], location[0] + anchor.getWidth(), location[1]
- + anchor.getHeight());
+ Rect anchorRect = new Rect(location[0], location[1], location[0]
+ + anchor.getWidth(), location[1] + anchor.getHeight());
- //mRootView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
- mRootView.measure(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
+ int screenWidth = mWindowManager.getDefaultDisplay().getWidth();
- int rootWidth = mRootView.getMeasuredWidth();
- int rootHeight = mRootView.getMeasuredHeight();
+ int w = screenWidth < MAX_WIDTH_POPUP_WINDOWS ? screenWidth : MAX_WIDTH_POPUP_WINDOWS;
+ mRootView.measure(w, LayoutParams.WRAP_CONTENT);
- int screenWidth = mWindowManager.getDefaultDisplay().getWidth();
- //int screenHeight = mWindowManager.getDefaultDisplay().getHeight();
+ int rootWidth = mRootView.getMeasuredWidth();
+ int rootHeight = mRootView.getMeasuredHeight();
- int xPos = (screenWidth - rootWidth) / 2;
- int yPos = anchorRect.top - rootHeight;
+ // int screenHeight = mWindowManager.getDefaultDisplay().getHeight();
- boolean onTop = true;
-
+ int xPos = location[0] + anchor.getWidth() / 2 - rootWidth / 2;
+ int yPos = anchorRect.top - rootHeight;
+
+ boolean onTop = true;
+ // left from 0
+ if (xPos < 0)
+ xPos = 0;
+ // right from widht screen
+ if (xPos + w > screenWidth)
+ xPos = screenWidth - w;
// display on bottom
if (rootHeight > anchor.getTop()) {
- yPos = anchorRect.bottom;
- onTop = false;
+ yPos = anchorRect.bottom;
+ onTop = false;
}
+ // if(location[0]> )
+ showArrow(((onTop) ? R.id.arrow_down : R.id.arrow_up),
+ anchorRect.centerX() - xPos);
- showArrow(((onTop) ? R.id.arrow_down : R.id.arrow_up), anchorRect.centerX());
-
setAnimationStyle(screenWidth, anchorRect.centerX(), onTop);
-
+
mWindow.showAtLocation(anchor, Gravity.NO_GRAVITY, xPos, yPos);
-
- if (mAnimateTrack) mTrack.startAnimation(mTrackAnim);
+ if (mAnimateTrack)
+ mTrack.startAnimation(mTrackAnim);
}
/**
* Set animation style
*
- * @param screenWidth Screen width
- * @param requestedX distance from left screen
- * @param onTop flag to indicate where the popup should be displayed. Set TRUE if displayed on top of anchor and vice versa
+ * @param screenWidth
+ * Screen width
+ * @param requestedX
+ * distance from left screen
+ * @param onTop
+ * flag to indicate where the popup should be displayed. Set TRUE
+ * if displayed on top of anchor and vice versa
*/
- private void setAnimationStyle(int screenWidth, int requestedX, boolean onTop) {
- int arrowPos = requestedX - mArrowUp.getMeasuredWidth()/2;
+ private void setAnimationStyle(int screenWidth, int requestedX,
+ boolean onTop) {
+ int arrowPos = requestedX - mArrowUp.getMeasuredWidth() / 2;
switch (mAnimStyle) {
case ANIM_GROW_FROM_LEFT:
- mWindow.setAnimationStyle((onTop) ? R.style.Animations_PopUpMenu_Left : R.style.Animations_PopDownMenu_Left);
+ mWindow.setAnimationStyle((onTop) ? R.style.Animations_PopUpMenu_Left
+ : R.style.Animations_PopDownMenu_Left);
break;
-
+
case ANIM_GROW_FROM_RIGHT:
- mWindow.setAnimationStyle((onTop) ? R.style.Animations_PopUpMenu_Right : R.style.Animations_PopDownMenu_Right);
+ mWindow.setAnimationStyle((onTop) ? R.style.Animations_PopUpMenu_Right
+ : R.style.Animations_PopDownMenu_Right);
break;
-
+
case ANIM_GROW_FROM_CENTER:
- mWindow.setAnimationStyle((onTop) ? R.style.Animations_PopUpMenu_Center : R.style.Animations_PopDownMenu_Center);
- break;
-
+ mWindow.setAnimationStyle((onTop) ? R.style.Animations_PopUpMenu_Center
+ : R.style.Animations_PopDownMenu_Center);
+ break;
+
case ANIM_AUTO:
- if (arrowPos <= screenWidth/4) {
- mWindow.setAnimationStyle((onTop) ? R.style.Animations_PopUpMenu_Left : R.style.Animations_PopDownMenu_Left);
- } else if (arrowPos > screenWidth/4 && arrowPos < 3 * (screenWidth/4)) {
- mWindow.setAnimationStyle((onTop) ? R.style.Animations_PopUpMenu_Center : R.style.Animations_PopDownMenu_Center);
+ if (arrowPos <= screenWidth / 4) {
+ mWindow.setAnimationStyle((onTop) ? R.style.Animations_PopUpMenu_Left
+ : R.style.Animations_PopDownMenu_Left);
+ } else if (arrowPos > screenWidth / 4
+ && arrowPos < 3 * (screenWidth / 4)) {
+ mWindow.setAnimationStyle((onTop) ? R.style.Animations_PopUpMenu_Center
+ : R.style.Animations_PopDownMenu_Center);
} else {
- mWindow.setAnimationStyle((onTop) ? R.style.Animations_PopDownMenu_Right : R.style.Animations_PopDownMenu_Right);
+ mWindow.setAnimationStyle((onTop) ? R.style.Animations_PopDownMenu_Right
+ : R.style.Animations_PopDownMenu_Right);
}
-
+
break;
}
}
-
+
/**
* Show arrow
*
- * @param whichArrow arrow type resource id
- * @param requestedX distance from left screen
+ * @param whichArrow
+ * arrow type resource id
+ * @param requestedX
+ * distance from left screen
*/
private void showArrow(int whichArrow, int requestedX) {
- final View showArrow = (whichArrow == R.id.arrow_up) ? mArrowUp : mArrowDown;
- final View hideArrow = (whichArrow == R.id.arrow_up) ? mArrowDown : mArrowUp;
-
- final int arrowWidth = mArrowUp.getMeasuredWidth();
-
- showArrow.setVisibility(View.VISIBLE);
-
- ViewGroup.MarginLayoutParams param = (ViewGroup.MarginLayoutParams)showArrow.getLayoutParams();
-
- param.leftMargin = requestedX - arrowWidth / 2;
-
- hideArrow.setVisibility(View.INVISIBLE);
- }
-
+ final View showArrow = (whichArrow == R.id.arrow_up) ? mArrowUp
+ : mArrowDown;
+ final View hideArrow = (whichArrow == R.id.arrow_up) ? mArrowDown
+ : mArrowUp;
+
+ final int arrowWidth = mArrowUp.getMeasuredWidth();
+
+ showArrow.setVisibility(View.VISIBLE);
+
+ ViewGroup.MarginLayoutParams param = (ViewGroup.MarginLayoutParams) showArrow
+ .getLayoutParams();
+
+ param.leftMargin = requestedX - arrowWidth / 2;
+
+ hideArrow.setVisibility(View.INVISIBLE);
+ }
+
/**
- * Set listener for window dismissed. This listener will only be fired if the quicakction dialog is dismissed
- * by clicking outside the dialog or clicking on sticky item.
+ * Set listener for window dismissed. This listener will only be fired if
+ * the quicakction dialog is dismissed by clicking outside the dialog or
+ * clicking on sticky item.
*/
public void setOnDismissListener(QuickAction.OnDismissListener listener) {
setOnDismissListener(this);
-
+
mDismissListener = listener;
}
-
+
@Override
public void onDismiss() {
if (!mDidAction && mDismissListener != null) {
mDismissListener.onDismiss();
}
}
-
+
/**
* Listener for item click
- *
+ *
*/
public interface OnActionItemClickListener {
- public abstract void onItemClick(QuickAction source, int pos, int actionId);
+ public abstract void onItemClick(QuickAction source, int pos,
+ int actionId);
}
-
+
/**
* Listener for window dismiss
*