Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Change implementation and more efficient

Change implementation and more efficient
  • Loading branch information...
commit 4ed74ca937fcf85faae4a5abf12ef6306b0baa53 0 parents
@lorensiuswlt authored
Showing with 1,131 additions and 0 deletions.
  1. +18 −0 AndroidManifest.xml
  2. BIN  bin/NewQuickAction3D.apk
  3. BIN  bin/classes.dex
  4. BIN  bin/net/londatiga/android/ActionItem.class
  5. BIN  bin/net/londatiga/android/NewQuickAction3DActivity$1.class
  6. BIN  bin/net/londatiga/android/NewQuickAction3DActivity$2.class
  7. BIN  bin/net/londatiga/android/NewQuickAction3DActivity$3.class
  8. BIN  bin/net/londatiga/android/NewQuickAction3DActivity$4.class
  9. BIN  bin/net/londatiga/android/NewQuickAction3DActivity.class
  10. BIN  bin/net/londatiga/android/PopupWindows$1.class
  11. BIN  bin/net/londatiga/android/PopupWindows.class
  12. BIN  bin/net/londatiga/android/QuickAction$1.class
  13. BIN  bin/net/londatiga/android/QuickAction$OnActionItemClickListener.class
  14. BIN  bin/net/londatiga/android/QuickAction.class
  15. BIN  bin/net/londatiga/android/R$anim.class
  16. BIN  bin/net/londatiga/android/R$attr.class
  17. BIN  bin/net/londatiga/android/R$drawable.class
  18. BIN  bin/net/londatiga/android/R$id.class
  19. BIN  bin/net/londatiga/android/R$layout.class
  20. BIN  bin/net/londatiga/android/R$string.class
  21. BIN  bin/net/londatiga/android/R$style.class
  22. BIN  bin/net/londatiga/android/R.class
  23. BIN  bin/resources.ap_
  24. +11 −0 default.properties
  25. +78 −0 gen/net/londatiga/android/R.java
  26. +40 −0 proguard.cfg
  27. +9 −0 res/anim/disappear.xml
  28. +14 −0 res/anim/grow_from_bottom.xml
  29. +14 −0 res/anim/grow_from_bottomleft_to_topright.xml
  30. +14 −0 res/anim/grow_from_bottomright_to_topleft.xml
  31. +14 −0 res/anim/grow_from_top.xml
  32. +14 −0 res/anim/grow_from_topleft_to_bottomright.xml
  33. +14 −0 res/anim/grow_from_topright_to_bottomleft.xml
  34. +14 −0 res/anim/pump_bottom.xml
  35. +14 −0 res/anim/pump_top.xml
  36. +7 −0 res/anim/rail.xml
  37. +14 −0 res/anim/shrink_from_bottom.xml
  38. +14 −0 res/anim/shrink_from_bottomleft_to_topright.xml
  39. +14 −0 res/anim/shrink_from_bottomright_to_topleft.xml
  40. +14 −0 res/anim/shrink_from_top.xml
  41. +14 −0 res/anim/shrink_from_topleft_to_bottomright.xml
  42. +14 −0 res/anim/shrink_from_topright_to_bottomleft.xml
  43. BIN  res/drawable-hdpi/icon.png
  44. BIN  res/drawable-ldpi/icon.png
  45. BIN  res/drawable-mdpi/icon.png
  46. +17 −0 res/drawable/action_item_btn.xml
  47. BIN  res/drawable/action_item_selected.9.png
  48. BIN  res/drawable/arrow_down.png
  49. BIN  res/drawable/arrow_up.png
  50. BIN  res/drawable/dashboard.png
  51. BIN  res/drawable/icon.png
  52. BIN  res/drawable/kontak.png
  53. BIN  res/drawable/popup.9.png
  54. +25 −0 res/layout/action_item.xml
  55. +44 −0 res/layout/main.xml
  56. +41 −0 res/layout/popup.xml
  57. +5 −0 res/values/strings.xml
  58. +50 −0 res/values/styles.xml
  59. +102 −0 src/net/londatiga/android/ActionItem.java
  60. +83 −0 src/net/londatiga/android/NewQuickAction3DActivity.java
  61. +134 −0 src/net/londatiga/android/PopupWindows.java
  62. +271 −0 src/net/londatiga/android/QuickAction.java
18 AndroidManifest.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="net.londatiga.android"
+ android:versionCode="1"
+ android:versionName="1.0">
+ <uses-sdk android:minSdkVersion="7" />
+
+ <application android:icon="@drawable/icon" android:label="@string/app_name">
+ <activity android:name=".NewQuickAction3DActivity"
+ android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+
+ </application>
+</manifest>
BIN  bin/NewQuickAction3D.apk
Binary file not shown
BIN  bin/classes.dex
Binary file not shown
BIN  bin/net/londatiga/android/ActionItem.class
Binary file not shown
BIN  bin/net/londatiga/android/NewQuickAction3DActivity$1.class
Binary file not shown
BIN  bin/net/londatiga/android/NewQuickAction3DActivity$2.class
Binary file not shown
BIN  bin/net/londatiga/android/NewQuickAction3DActivity$3.class
Binary file not shown
BIN  bin/net/londatiga/android/NewQuickAction3DActivity$4.class
Binary file not shown
BIN  bin/net/londatiga/android/NewQuickAction3DActivity.class
Binary file not shown
BIN  bin/net/londatiga/android/PopupWindows$1.class
Binary file not shown
BIN  bin/net/londatiga/android/PopupWindows.class
Binary file not shown
BIN  bin/net/londatiga/android/QuickAction$1.class
Binary file not shown
BIN  bin/net/londatiga/android/QuickAction$OnActionItemClickListener.class
Binary file not shown
BIN  bin/net/londatiga/android/QuickAction.class
Binary file not shown
BIN  bin/net/londatiga/android/R$anim.class
Binary file not shown
BIN  bin/net/londatiga/android/R$attr.class
Binary file not shown
BIN  bin/net/londatiga/android/R$drawable.class
Binary file not shown
BIN  bin/net/londatiga/android/R$id.class
Binary file not shown
BIN  bin/net/londatiga/android/R$layout.class
Binary file not shown
BIN  bin/net/londatiga/android/R$string.class
Binary file not shown
BIN  bin/net/londatiga/android/R$style.class
Binary file not shown
BIN  bin/net/londatiga/android/R.class
Binary file not shown
BIN  bin/resources.ap_
Binary file not shown
11 default.properties
@@ -0,0 +1,11 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system use,
+# "build.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=android-7
78 gen/net/londatiga/android/R.java
@@ -0,0 +1,78 @@
+/* AUTO-GENERATED FILE. DO NOT MODIFY.
+ *
+ * This class was automatically generated by the
+ * aapt tool from the resource data it found. It
+ * should not be modified by hand.
+ */
+
+package net.londatiga.android;
+
+public final class R {
+ public static final class anim {
+ public static final int disappear=0x7f040000;
+ public static final int grow_from_bottom=0x7f040001;
+ public static final int grow_from_bottomleft_to_topright=0x7f040002;
+ public static final int grow_from_bottomright_to_topleft=0x7f040003;
+ public static final int grow_from_top=0x7f040004;
+ public static final int grow_from_topleft_to_bottomright=0x7f040005;
+ public static final int grow_from_topright_to_bottomleft=0x7f040006;
+ public static final int pump_bottom=0x7f040007;
+ public static final int pump_top=0x7f040008;
+ public static final int rail=0x7f040009;
+ public static final int shrink_from_bottom=0x7f04000a;
+ public static final int shrink_from_bottomleft_to_topright=0x7f04000b;
+ public static final int shrink_from_bottomright_to_topleft=0x7f04000c;
+ public static final int shrink_from_top=0x7f04000d;
+ public static final int shrink_from_topleft_to_bottomright=0x7f04000e;
+ public static final int shrink_from_topright_to_bottomleft=0x7f04000f;
+ }
+ public static final class attr {
+ }
+ public static final class drawable {
+ public static final int action_item_btn=0x7f020000;
+ public static final int action_item_selected=0x7f020001;
+ public static final int arrow_down=0x7f020002;
+ public static final int arrow_up=0x7f020003;
+ public static final int dashboard=0x7f020004;
+ public static final int icon=0x7f020005;
+ public static final int kontak=0x7f020006;
+ public static final int popup=0x7f020007;
+ }
+ public static final class id {
+ public static final int arrow_down=0x7f070008;
+ public static final int arrow_up=0x7f070007;
+ public static final int btn1=0x7f070002;
+ public static final int btn2=0x7f070003;
+ public static final int btn3=0x7f070004;
+ public static final int iv_icon=0x7f070000;
+ public static final int scroller=0x7f070005;
+ public static final int tracks=0x7f070006;
+ public static final int tv_title=0x7f070001;
+ }
+ public static final class layout {
+ public static final int action_item=0x7f030000;
+ public static final int main=0x7f030001;
+ public static final int popup=0x7f030002;
+ }
+ public static final class string {
+ public static final int app_name=0x7f050001;
+ public static final int hello=0x7f050000;
+ }
+ public static final class style {
+ public static final int Animations=0x7f060000;
+ /** PopDownMenu
+ */
+ public static final int Animations_PopDownMenu=0x7f060001;
+ public static final int Animations_PopDownMenu_Center=0x7f060002;
+ public static final int Animations_PopDownMenu_Left=0x7f060003;
+ public static final int Animations_PopDownMenu_Reflect=0x7f060005;
+ public static final int Animations_PopDownMenu_Right=0x7f060004;
+ /** PopUpMenu
+ */
+ public static final int Animations_PopUpMenu=0x7f060006;
+ public static final int Animations_PopUpMenu_Center=0x7f060007;
+ public static final int Animations_PopUpMenu_Left=0x7f060008;
+ public static final int Animations_PopUpMenu_Reflect=0x7f06000a;
+ public static final int Animations_PopUpMenu_Right=0x7f060009;
+ }
+}
40 proguard.cfg
@@ -0,0 +1,40 @@
+-optimizationpasses 5
+-dontusemixedcaseclassnames
+-dontskipnonpubliclibraryclasses
+-dontpreverify
+-verbose
+-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
+
+-keep public class * extends android.app.Activity
+-keep public class * extends android.app.Application
+-keep public class * extends android.app.Service
+-keep public class * extends android.content.BroadcastReceiver
+-keep public class * extends android.content.ContentProvider
+-keep public class * extends android.app.backup.BackupAgentHelper
+-keep public class * extends android.preference.Preference
+-keep public class com.android.vending.licensing.ILicensingService
+
+-keepclasseswithmembernames class * {
+ native <methods>;
+}
+
+-keepclasseswithmembers class * {
+ public <init>(android.content.Context, android.util.AttributeSet);
+}
+
+-keepclasseswithmembers class * {
+ public <init>(android.content.Context, android.util.AttributeSet, int);
+}
+
+-keepclassmembers class * extends android.app.Activity {
+ public void *(android.view.View);
+}
+
+-keepclassmembers enum * {
+ public static **[] values();
+ public static ** valueOf(java.lang.String);
+}
+
+-keep class * implements android.os.Parcelable {
+ public static final android.os.Parcelable$Creator *;
+}
9 res/anim/disappear.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <alpha
+ android:interpolator="@android:anim/decelerate_interpolator"
+ android:fromAlpha="1.0" android:toAlpha="0.0"
+ android:duration="400"
+ />
+</set>
14 res/anim/grow_from_bottom.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <scale
+ android:fromXScale="0.3" android:toXScale="1.0"
+ android:fromYScale="0.3" android:toYScale="1.0"
+ android:pivotX="50%" android:pivotY="100%"
+ android:duration="@android:integer/config_shortAnimTime"
+ />
+ <alpha
+ android:interpolator="@android:anim/decelerate_interpolator"
+ android:fromAlpha="0.0" android:toAlpha="1.0"
+ android:duration="@android:integer/config_shortAnimTime"
+ />
+</set>
14 res/anim/grow_from_bottomleft_to_topright.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <scale
+ android:fromXScale="0.3" android:toXScale="1.0"
+ android:fromYScale="0.3" android:toYScale="1.0"
+ android:pivotX="0%" android:pivotY="50%"
+ android:duration="@android:integer/config_shortAnimTime"
+ />
+ <alpha
+ android:interpolator="@android:anim/decelerate_interpolator"
+ android:fromAlpha="0.0" android:toAlpha="1.0"
+ android:duration="@android:integer/config_shortAnimTime"
+ />
+</set>
14 res/anim/grow_from_bottomright_to_topleft.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <scale
+ android:fromXScale="0.3" android:toXScale="1.0"
+ android:fromYScale="0.3" android:toYScale="1.0"
+ android:pivotX="100%" android:pivotY="50%"
+ android:duration="@android:integer/config_shortAnimTime"
+ />
+ <alpha
+ android:interpolator="@android:anim/decelerate_interpolator"
+ android:fromAlpha="0.0" android:toAlpha="1.0"
+ android:duration="@android:integer/config_shortAnimTime"
+ />
+</set>
14 res/anim/grow_from_top.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <scale
+ android:fromXScale="0.3" android:toXScale="1.0"
+ android:fromYScale="0.3" android:toYScale="1.0"
+ android:pivotX="50%" android:pivotY="0%"
+ android:duration="@android:integer/config_shortAnimTime"
+ />
+ <alpha
+ android:interpolator="@android:anim/decelerate_interpolator"
+ android:fromAlpha="0.0" android:toAlpha="1.0"
+ android:duration="@android:integer/config_shortAnimTime"
+ />
+</set>
14 res/anim/grow_from_topleft_to_bottomright.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <scale
+ android:fromXScale="0.3" android:toXScale="1.0"
+ android:fromYScale="0.3" android:toYScale="1.0"
+ android:pivotX="0%" android:pivotY="0%"
+ android:duration="@android:integer/config_shortAnimTime"
+ />
+ <alpha
+ android:interpolator="@android:anim/decelerate_interpolator"
+ android:fromAlpha="0.0" android:toAlpha="1.0"
+ android:duration="@android:integer/config_shortAnimTime"
+ />
+</set>
14 res/anim/grow_from_topright_to_bottomleft.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <scale
+ android:fromXScale="0.3" android:toXScale="1.0"
+ android:fromYScale="0.3" android:toYScale="1.0"
+ android:pivotX="100%" android:pivotY="0%"
+ android:duration="@android:integer/config_shortAnimTime"
+ />
+ <alpha
+ android:interpolator="@android:anim/decelerate_interpolator"
+ android:fromAlpha="0.0" android:toAlpha="1.0"
+ android:duration="@android:integer/config_shortAnimTime"
+ />
+</set>
14 res/anim/pump_bottom.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <scale
+ android:fromXScale="1.1" android:toXScale="1.0"
+ android:fromYScale="1.1" android:toYScale="1.0"
+ android:pivotX="50%" android:pivotY="100%"
+ android:duration="@android:integer/config_shortAnimTime"
+ />
+ <alpha
+ android:interpolator="@android:anim/decelerate_interpolator"
+ android:fromAlpha="0.0" android:toAlpha="1.0"
+ android:duration="@android:integer/config_shortAnimTime"
+ />
+</set>
14 res/anim/pump_top.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <scale
+ android:fromXScale="1.1" android:toXScale="1.0"
+ android:fromYScale="1.1" android:toYScale="1.0"
+ android:pivotX="50%" android:pivotY="0%"
+ android:duration="@android:integer/config_shortAnimTime"
+ />
+ <alpha
+ android:interpolator="@android:anim/decelerate_interpolator"
+ android:fromAlpha="0.0" android:toAlpha="1.0"
+ android:duration="@android:integer/config_shortAnimTime"
+ />
+</set>
7 res/anim/rail.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<translate
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:fromXDelta="100%p"
+ android:toXDelta="0"
+ android:duration="325" />
14 res/anim/shrink_from_bottom.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <scale
+ android:fromXScale="1.0" android:toXScale="0.3"
+ android:fromYScale="1.0" android:toYScale="0.3"
+ android:pivotX="50%" android:pivotY="0%"
+ android:duration="@android:integer/config_shortAnimTime"
+ />
+ <alpha
+ android:interpolator="@android:anim/accelerate_interpolator"
+ android:fromAlpha="1.0" android:toAlpha="0.0"
+ android:duration="@android:integer/config_shortAnimTime"
+ />
+</set>
14 res/anim/shrink_from_bottomleft_to_topright.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <scale
+ android:fromXScale="1.0" android:toXScale="0.3"
+ android:fromYScale="1.0" android:toYScale="0.3"
+ android:pivotX="100%" android:pivotY="0%"
+ android:duration="@android:integer/config_shortAnimTime"
+ />
+ <alpha
+ android:interpolator="@android:anim/accelerate_interpolator"
+ android:fromAlpha="1.0" android:toAlpha="0.0"
+ android:duration="@android:integer/config_shortAnimTime"
+ />
+</set>
14 res/anim/shrink_from_bottomright_to_topleft.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <scale
+ android:fromXScale="1.0" android:toXScale="0.3"
+ android:fromYScale="1.0" android:toYScale="0.3"
+ android:pivotX="0%" android:pivotY="0%"
+ android:duration="@android:integer/config_shortAnimTime"
+ />
+ <alpha
+ android:interpolator="@android:anim/accelerate_interpolator"
+ android:fromAlpha="1.0" android:toAlpha="0.0"
+ android:duration="@android:integer/config_shortAnimTime"
+ />
+</set>
14 res/anim/shrink_from_top.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <scale
+ android:fromXScale="1.0" android:toXScale="0.3"
+ android:fromYScale="1.0" android:toYScale="0.3"
+ android:pivotX="50%" android:pivotY="100%"
+ android:duration="@android:integer/config_shortAnimTime"
+ />
+ <alpha
+ android:interpolator="@android:anim/accelerate_interpolator"
+ android:fromAlpha="1.0" android:toAlpha="0.0"
+ android:duration="@android:integer/config_shortAnimTime"
+ />
+</set>
14 res/anim/shrink_from_topleft_to_bottomright.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <scale
+ android:fromXScale="1.0" android:toXScale="0.3"
+ android:fromYScale="1.0" android:toYScale="0.3"
+ android:pivotX="100%" android:pivotY="100%"
+ android:duration="@android:integer/config_shortAnimTime"
+ />
+ <alpha
+ android:interpolator="@android:anim/accelerate_interpolator"
+ android:fromAlpha="1.0" android:toAlpha="0.0"
+ android:duration="@android:integer/config_shortAnimTime"
+ />
+</set>
14 res/anim/shrink_from_topright_to_bottomleft.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <scale
+ android:fromXScale="1.0" android:toXScale="0.3"
+ android:fromYScale="1.0" android:toYScale="0.3"
+ android:pivotX="0%" android:pivotY="100%"
+ android:duration="@android:integer/config_shortAnimTime"
+ />
+ <alpha
+ android:interpolator="@android:anim/accelerate_interpolator"
+ android:fromAlpha="1.0" android:toAlpha="0.0"
+ android:duration="@android:integer/config_shortAnimTime"
+ />
+</set>
BIN  res/drawable-hdpi/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  res/drawable-ldpi/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  res/drawable-mdpi/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 res/drawable/action_item_btn.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:dither="true">
+
+ <item
+ android:state_window_focused="false"
+ android:drawable="@android:color/transparent" />
+ <item
+ android:state_pressed="true"
+ android:drawable="@drawable/action_item_selected"/>
+ <item
+ android:state_focused="true"
+ android:drawable="@drawable/action_item_selected"/>
+ <item
+ android:drawable="@android:color/transparent"/>
+
+</selector>
BIN  res/drawable/action_item_selected.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  res/drawable/arrow_down.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  res/drawable/arrow_up.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  res/drawable/dashboard.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  res/drawable/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  res/drawable/kontak.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  res/drawable/popup.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 res/layout/action_item.xml
@@ -0,0 +1,25 @@
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="horizontal"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:clickable="true"
+ android:focusable="true"
+ android:background="@drawable/action_item_btn">
+
+ <ImageView
+ android:id="@+id/iv_icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ <TextView
+ android:id="@+id/tv_title"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:gravity="center_vertical"
+ android:paddingLeft="5dip"
+ android:paddingRight="10dip"
+ android:text="Chart"
+ android:textColor="#fff"/>
+
+</LinearLayout>
44 res/layout/main.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="vertical">
+
+ <LinearLayout
+ android:orientation="horizontal"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:layout_weight="1">
+
+ <Button
+ android:id="@+id/btn1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Button 1" />
+
+ <Button
+ android:id="@+id/btn2"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="Button 2" />
+
+ </LinearLayout>
+
+ <LinearLayout
+
+ android:orientation="horizontal"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:layout_weight="1">
+
+ <Button
+ android:id="@+id/btn3"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="right"
+ android:text="Button 3" />
+
+ </LinearLayout>
+
+</LinearLayout>
41 res/layout/popup.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ >
+
+ <ScrollView
+ android:id="@+id/scroller"
+ android:layout_marginTop="16dip"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:background="@drawable/popup"
+ android:fadingEdgeLength="5dip"
+ android:scrollbars="none">
+
+ <LinearLayout
+ android:id="@+id/tracks"
+ android:orientation="vertical"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:padding="10dip"/>
+
+ </ScrollView >
+
+ <ImageView
+ android:id="@+id/arrow_up"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/arrow_up" />
+
+ <ImageView
+ android:id="@+id/arrow_down"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/scroller"
+ android:layout_marginTop="-4dip"
+ android:src="@drawable/arrow_down" />
+
+</RelativeLayout>
5 res/values/strings.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="hello">Hello World, NewQA!</string>
+ <string name="app_name">Gallery3D Like QuickAction Demo</string>
+</resources>
50 res/values/styles.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <style name="Animations" />
+
+ <!-- PopDownMenu -->
+ <style name="Animations.PopDownMenu" />
+
+ <style name="Animations.PopDownMenu.Center">
+ <item name="@android:windowEnterAnimation">@anim/grow_from_top</item>
+ <item name="@android:windowExitAnimation">@anim/shrink_from_bottom</item>
+ </style>
+
+ <style name="Animations.PopDownMenu.Left">
+ <item name="@android:windowEnterAnimation">@anim/grow_from_topleft_to_bottomright</item>
+ <item name="@android:windowExitAnimation">@anim/shrink_from_bottomright_to_topleft</item>
+ </style>
+
+ <style name="Animations.PopDownMenu.Right">
+ <item name="@android:windowEnterAnimation">@anim/grow_from_topright_to_bottomleft</item>
+ <item name="@android:windowExitAnimation">@anim/shrink_from_bottomleft_to_topright</item>
+ </style>
+
+ <style name="Animations.PopDownMenu.Reflect">
+ <item name="@android:windowEnterAnimation">@anim/pump_top</item>
+ <item name="@android:windowExitAnimation">@anim/disappear</item>
+ </style>
+
+ <!-- PopUpMenu -->
+ <style name="Animations.PopUpMenu" />
+
+ <style name="Animations.PopUpMenu.Center">
+ <item name="@android:windowEnterAnimation">@anim/grow_from_bottom</item>
+ <item name="@android:windowExitAnimation">@anim/shrink_from_top</item>
+ </style>
+
+ <style name="Animations.PopUpMenu.Left">
+ <item name="@android:windowEnterAnimation">@anim/grow_from_bottomleft_to_topright</item>
+ <item name="@android:windowExitAnimation">@anim/shrink_from_topright_to_bottomleft</item>
+ </style>
+
+ <style name="Animations.PopUpMenu.Right">
+ <item name="@android:windowEnterAnimation">@anim/grow_from_bottomright_to_topleft</item>
+ <item name="@android:windowExitAnimation">@anim/shrink_from_topleft_to_bottomright</item>
+ </style>
+
+ <style name="Animations.PopUpMenu.Reflect">
+ <item name="@android:windowEnterAnimation">@anim/pump_bottom</item>
+ <item name="@android:windowExitAnimation">@anim/disappear</item>
+ </style>
+</resources>
102 src/net/londatiga/android/ActionItem.java
@@ -0,0 +1,102 @@
+package net.londatiga.android;
+
+import android.graphics.drawable.Drawable;
+import android.graphics.Bitmap;
+
+/**
+ * Action item, displayed as menu with icon and text.
+ *
+ * @author Lorensius. W. L. T
+ *
+ */
+public class ActionItem {
+ private Drawable icon;
+ private Bitmap thumb;
+ private String title;
+ private boolean selected;
+
+ /**
+ * Constructor
+ */
+ public ActionItem() {}
+
+ /**
+ * Constructor
+ *
+ * @param icon {@link Drawable} action icon
+ */
+ public ActionItem(Drawable icon) {
+ this.icon = icon;
+ }
+
+ /**
+ * Set action title
+ *
+ * @param title action title
+ */
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ /**
+ * Get action title
+ *
+ * @return action title
+ */
+ public String getTitle() {
+ return this.title;
+ }
+
+ /**
+ * Set action icon
+ *
+ * @param icon {@link Drawable} action icon
+ */
+ public void setIcon(Drawable icon) {
+ this.icon = icon;
+ }
+
+ /**
+ * Get action icon
+ * @return {@link Drawable} action icon
+ */
+ public Drawable getIcon() {
+ return this.icon;
+ }
+
+ /**
+ * Set selected flag;
+ *
+ * @param selected Flag to indicate the item is selected
+ */
+ public void setSelected(boolean selected) {
+ this.selected = selected;
+ }
+
+ /**
+ * Check if item is selected
+ *
+ * @return true or false
+ */
+ public boolean isSelected() {
+ return this.selected;
+ }
+
+ /**
+ * Set thumb
+ *
+ * @param thumb Thumb image
+ */
+ public void setThumb(Bitmap thumb) {
+ this.thumb = thumb;
+ }
+
+ /**
+ * Get thumb image
+ *
+ * @return Thumb image
+ */
+ public Bitmap getThumb() {
+ return this.thumb;
+ }
+}
83 src/net/londatiga/android/NewQuickAction3DActivity.java
@@ -0,0 +1,83 @@
+package net.londatiga.android;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+import android.view.View;
+import android.view.View.OnClickListener;
+
+import android.widget.Button;
+import android.widget.Toast;
+
+/**
+ * Gallery 3D like quickaction.
+ *
+ * This example shows how to use Gallery3D like quickaction.
+ *
+ * @author Lorensius W. L. T <lorenz@londatiga.net>
+ *
+ */
+public class NewQuickAction3DActivity extends Activity {
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.main);
+
+ //dashboard action item
+ ActionItem dashboard = new ActionItem();
+
+ dashboard.setTitle("Dashboard");
+ dashboard.setIcon(getResources().getDrawable(R.drawable.dashboard));
+
+ //user action item
+ ActionItem user = new ActionItem();
+
+ user.setTitle("Users & Groups");
+ user.setIcon(getResources().getDrawable(R.drawable.kontak));
+
+ //create quickaction
+ final QuickAction quickAction = new QuickAction(this);
+
+ quickAction.addActionItem(dashboard);
+ quickAction.addActionItem(user);
+
+ quickAction.setOnActionItemClickListener(new QuickAction.OnActionItemClickListener() {
+ @Override
+ public void onItemClick(int pos) {
+ if (pos == 0) {
+ Toast.makeText(NewQuickAction3DActivity.this, "Dashboard item selected", Toast.LENGTH_SHORT).show();
+ } else {
+ Toast.makeText(NewQuickAction3DActivity.this, "User item selected", Toast.LENGTH_SHORT).show();
+ }
+ }
+ });
+
+ Button btn1 = (Button) this.findViewById(R.id.btn1);
+ btn1.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ quickAction.show(v);
+ }
+ });
+
+ Button btn2 = (Button) this.findViewById(R.id.btn2);
+ btn2.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ quickAction.show(v);
+ }
+ });
+
+ Button btn3 = (Button) this.findViewById(R.id.btn3);
+ btn3.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ quickAction.show(v);
+ quickAction.setAnimStyle(QuickAction.ANIM_REFLECT);
+ }
+ });
+
+ }
+}
134 src/net/londatiga/android/PopupWindows.java
@@ -0,0 +1,134 @@
+package net.londatiga.android;
+
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable;
+
+import android.view.LayoutInflater;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.WindowManager;
+import android.view.View.OnTouchListener;
+
+import android.widget.PopupWindow;
+import android.content.Context;
+
+/**
+ * Custom popup window.
+ *
+ * @author Lorensius W. L. T <lorenz@londatiga.net>
+ *
+ */
+public class PopupWindows {
+ protected Context mContext;
+ protected PopupWindow mWindow;
+ protected View mRootView;
+ protected Drawable mBackground = null;
+ protected WindowManager mWindowManager;
+
+ /**
+ * Constructor.
+ *
+ * @param context Context
+ */
+ public PopupWindows(Context context) {
+ mContext = context;
+ mWindow = new PopupWindow(context);
+
+ mWindow.setTouchInterceptor(new OnTouchListener() {
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
+ mWindow.dismiss();
+
+ return true;
+ }
+
+ return false;
+ }
+ });
+
+ mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
+ }
+
+ /**
+ * On dismiss
+ */
+ protected void onDismiss() {
+ }
+
+ /**
+ * On show
+ */
+ protected void onShow() {
+ }
+
+ /**
+ * On pre show
+ */
+ protected void preShow() {
+ if (mRootView == null)
+ throw new IllegalStateException("setContentView was not called with a view to display.");
+
+ onShow();
+
+ if (mBackground == null)
+ mWindow.setBackgroundDrawable(new BitmapDrawable());
+ else
+ mWindow.setBackgroundDrawable(mBackground);
+
+ mWindow.setWidth(WindowManager.LayoutParams.WRAP_CONTENT);
+ mWindow.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
+ mWindow.setTouchable(true);
+ mWindow.setFocusable(true);
+ mWindow.setOutsideTouchable(true);
+
+ mWindow.setContentView(mRootView);
+ }
+
+ /**
+ * Set background drawable.
+ *
+ * @param background Background drawable
+ */
+ public void setBackgroundDrawable(Drawable background) {
+ mBackground = background;
+ }
+
+ /**
+ * Set content view.
+ *
+ * @param root Root view
+ */
+ public void setContentView(View root) {
+ mRootView = root;
+
+ mWindow.setContentView(root);
+ }
+
+ /**
+ * Set content view.
+ *
+ * @param layoutResID Resource id
+ */
+ public void setContentView(int layoutResID) {
+ LayoutInflater inflator = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+
+ setContentView(inflator.inflate(layoutResID, null));
+ }
+
+ /**
+ * Set listener on window dismissed.
+ *
+ * @param listener
+ */
+ public void setOnDismissListener(PopupWindow.OnDismissListener listener) {
+ mWindow.setOnDismissListener(listener);
+ }
+
+ /**
+ * Dismiss the popup window.
+ */
+ public void dismiss() {
+ mWindow.dismiss();
+ }
+}
271 src/net/londatiga/android/QuickAction.java
@@ -0,0 +1,271 @@
+package net.londatiga.android;
+
+import android.content.Context;
+
+import android.graphics.Rect;
+import android.graphics.drawable.Drawable;
+
+import android.widget.ImageView;
+import android.widget.TextView;
+import android.widget.ScrollView;
+
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup.LayoutParams;
+import android.view.ViewGroup;
+
+/**
+ * Popup window, shows action list as icon and text like the one in Gallery3D app.
+ *
+ * @author Lorensius. W. T
+ */
+public class QuickAction extends PopupWindows {
+ private View mRootView;
+ private ImageView mArrowUp;
+ private ImageView mArrowDown;
+ private LayoutInflater inflater;
+ private ViewGroup mTrack;
+ private ScrollView mScroller;
+ private OnActionItemClickListener mListener;
+
+ protected static final int ANIM_GROW_FROM_LEFT = 1;
+ protected static final int ANIM_GROW_FROM_RIGHT = 2;
+ protected static final int ANIM_GROW_FROM_CENTER = 3;
+ protected static final int ANIM_REFLECT = 4;
+ protected static final int ANIM_AUTO = 5;
+
+ private int mChildPos;
+ private int animStyle;
+
+ /**
+ * Constructor.
+ *
+ * @param context Context
+ */
+ public QuickAction(Context context) {
+ super(context);
+
+ inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+
+ setRootViewId(R.layout.popup);
+
+ animStyle = ANIM_AUTO;
+ mChildPos = 0;
+ }
+
+ /**
+ * Set root view.
+ *
+ * @param id Layout resource id
+ */
+ public void setRootViewId(int id) {
+ 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);
+
+ mScroller = (ScrollView) mRootView.findViewById(R.id.scroller);
+
+ setContentView(mRootView);
+ }
+
+ /**
+ * Set animation style
+ *
+ * @param animStyle animation style, default is set to ANIM_AUTO
+ */
+ public void setAnimStyle(int animStyle) {
+ this.animStyle = animStyle;
+ }
+
+ /**
+ * Set listener for action item clicked.
+ *
+ * @param listener Listener
+ */
+ public void setOnActionItemClickListener(OnActionItemClickListener listener) {
+ mListener = listener;
+ }
+
+ /**
+ * Add action item
+ *
+ * @param action {@link ActionItem}
+ */
+ public void addActionItem(ActionItem 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)
+ img.setImageDrawable(icon);
+ else
+ img.setVisibility(View.GONE);
+
+ if (title != null)
+ text.setText(title);
+ else
+ text.setVisibility(View.GONE);
+
+ final int pos = mChildPos;
+
+ container.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (mListener != null) mListener.onItemClick(pos);
+
+ dismiss();
+ }
+ });
+
+ container.setFocusable(true);
+ container.setClickable(true);
+
+ mTrack.addView(container, mChildPos);
+
+ mChildPos++;
+ }
+
+ /**
+ * Show popup window. Popup is automatically positioned, on top or bottom of anchor view.
+ *
+ */
+ public void show (View anchor) {
+ preShow();
+
+ int xPos, yPos;
+
+ int[] location = new int[2];
+
+ anchor.getLocationOnScreen(location);
+
+ 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 rootHeight = mRootView.getMeasuredHeight();
+ int rootWidth = mRootView.getMeasuredWidth();
+
+ int screenWidth = mWindowManager.getDefaultDisplay().getWidth();
+ int screenHeight = mWindowManager.getDefaultDisplay().getHeight();
+
+ //automatically get X coord of popup (top left)
+ if ((anchorRect.left + rootWidth) > screenWidth) {
+ xPos = anchorRect.left - (rootWidth-anchor.getWidth());
+ } else {
+ if (anchor.getWidth() > rootWidth) {
+ xPos = anchorRect.centerX() - (rootWidth/2);
+ } else {
+ xPos = anchorRect.left;
+ }
+ }
+
+ int dyTop = anchorRect.top;
+ int dyBottom = screenHeight - anchorRect.bottom;
+
+ boolean onTop = (dyTop > dyBottom) ? true : false;
+
+ if (onTop) {
+ if (rootHeight > dyTop) {
+ yPos = 15;
+ LayoutParams l = mScroller.getLayoutParams();
+ l.height = dyTop - anchor.getHeight();
+ } else {
+ yPos = anchorRect.top - rootHeight;
+ }
+ } else {
+ yPos = anchorRect.bottom;
+
+ if (rootHeight > dyBottom) {
+ LayoutParams l = mScroller.getLayoutParams();
+ l.height = dyBottom;
+ }
+ }
+
+ showArrow(((onTop) ? R.id.arrow_down : R.id.arrow_up), anchorRect.centerX()-xPos);
+
+ setAnimationStyle(screenWidth, anchorRect.centerX(), onTop);
+
+ mWindow.showAtLocation(anchor, Gravity.NO_GRAVITY, xPos, yPos);
+ }
+
+ /**
+ * Set animation style
+ *
+ * @param screenWidth screen width
+ * @param requestedX distance from left edge
+ * @param onTop flag to indicate where the popup should be displayed. Set TRUE if displayed on top of anchor view
+ * and vice versa
+ */
+ private void setAnimationStyle(int screenWidth, int requestedX, boolean onTop) {
+ int arrowPos = requestedX - mArrowUp.getMeasuredWidth()/2;
+
+ switch (animStyle) {
+ case ANIM_GROW_FROM_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);
+ break;
+
+ case ANIM_GROW_FROM_CENTER:
+ mWindow.setAnimationStyle((onTop) ? R.style.Animations_PopUpMenu_Center : R.style.Animations_PopDownMenu_Center);
+ break;
+
+ case ANIM_REFLECT:
+ mWindow.setAnimationStyle((onTop) ? R.style.Animations_PopUpMenu_Reflect : R.style.Animations_PopDownMenu_Reflect);
+ 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);
+ } else {
+ mWindow.setAnimationStyle((onTop) ? R.style.Animations_PopUpMenu_Right : R.style.Animations_PopDownMenu_Right);
+ }
+
+ break;
+ }
+ }
+
+ /**
+ * Show arrow
+ *
+ * @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);
+ }
+
+ /**
+ * Listener for item click
+ *
+ */
+ public interface OnActionItemClickListener {
+ public abstract void onItemClick(int pos);
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.