From 3dd958667280264c96edd5332badf4e6f37f99ab Mon Sep 17 00:00:00 2001 From: hoshikoo Date: Fri, 25 Sep 2015 23:06:34 -0400 Subject: [PATCH 1/3] add imageview animation to navDrawer --- .../c4q/nyc/chipchop/BuyActivity.java | 10 +++++- app/src/main/res/anim/rotate | 35 +++++++++++++++++++ app/src/main/res/layout/activity_buy.xml | 3 +- 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 app/src/main/res/anim/rotate diff --git a/app/src/main/java/madelyntav/c4q/nyc/chipchop/BuyActivity.java b/app/src/main/java/madelyntav/c4q/nyc/chipchop/BuyActivity.java index d2e598f..f01fe55 100644 --- a/app/src/main/java/madelyntav/c4q/nyc/chipchop/BuyActivity.java +++ b/app/src/main/java/madelyntav/c4q/nyc/chipchop/BuyActivity.java @@ -19,6 +19,8 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; +import android.view.animation.Animation; +import android.view.animation.AnimationUtils; import android.view.inputmethod.InputMethodManager; import android.widget.AdapterView; import android.widget.ArrayAdapter; @@ -226,12 +228,18 @@ public void onClick(View view) { new Toolbar(this), R.string.drawer_open, R.string.drawer_close) { + final ImageView myImage = (ImageView)findViewById(R.id.profile_image); public void onDrawerClosed(View view) { -// + myImage.setVisibility(View.INVISIBLE); } public void onDrawerOpened(View drawerView) { + + myImage.setVisibility(View.VISIBLE); + final Animation myRotation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.rotate); + myImage.startAnimation(myRotation); + sellButton = (Button) findViewById(R.id.sellButton); new MaterialShowcaseView.Builder(BuyActivity.this) diff --git a/app/src/main/res/anim/rotate b/app/src/main/res/anim/rotate new file mode 100644 index 0000000..b42feba --- /dev/null +++ b/app/src/main/res/anim/rotate @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/activity_buy.xml b/app/src/main/res/layout/activity_buy.xml index a30f69a..0d88c11 100644 --- a/app/src/main/res/layout/activity_buy.xml +++ b/app/src/main/res/layout/activity_buy.xml @@ -58,7 +58,8 @@ android:padding="15dp" android:layout_marginTop="25dp" app:border_color="#FFF" - android:layout_gravity="center_horizontal"/> + android:layout_gravity="center_horizontal" + android:visibility="invisible"/> Date: Sun, 27 Sep 2015 15:07:02 -0400 Subject: [PATCH 2/3] add more animation --- .../madelyntav/c4q/nyc/chipchop/BuyActivity.java | 7 +++++++ .../chipchop/fragments/Fragment_Buyer_Map.java | 3 ++- .../fragments/Fragment_Buyer_SellerProfile.java | 15 +++++++++++++++ app/src/main/res/anim/anim_scale.xml | 14 ++++++++++++++ app/src/main/res/anim/cycle.xml | 3 +++ app/src/main/res/anim/scale_fab_in.xml | 10 ++++++++++ app/src/main/res/anim/scale_fab_out.xml | 10 ++++++++++ app/src/main/res/anim/shake.xml | 9 +++++++++ app/src/main/res/drawable/roundedbutton.xml | 9 +++++++++ .../res/layout/fragment_buyer_seller_profile.xml | 3 ++- 10 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 app/src/main/res/anim/anim_scale.xml create mode 100644 app/src/main/res/anim/cycle.xml create mode 100644 app/src/main/res/anim/scale_fab_in.xml create mode 100644 app/src/main/res/anim/scale_fab_out.xml create mode 100644 app/src/main/res/anim/shake.xml create mode 100644 app/src/main/res/drawable/roundedbutton.xml diff --git a/app/src/main/java/madelyntav/c4q/nyc/chipchop/BuyActivity.java b/app/src/main/java/madelyntav/c4q/nyc/chipchop/BuyActivity.java index f01fe55..04eecd3 100644 --- a/app/src/main/java/madelyntav/c4q/nyc/chipchop/BuyActivity.java +++ b/app/src/main/java/madelyntav/c4q/nyc/chipchop/BuyActivity.java @@ -242,6 +242,10 @@ public void onDrawerOpened(View drawerView) { sellButton = (Button) findViewById(R.id.sellButton); + Animation shake = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.shake); + drawerUserNameTV.startAnimation(shake); + + new MaterialShowcaseView.Builder(BuyActivity.this) .setTarget(sellButton) .setMaskColour(R.drawable.showcase) @@ -300,6 +304,9 @@ public void run() { private void bindViews() { drawerUserNameTV = (TextView) findViewById(R.id.drawer_user_nameTV); + + + frameLayout = (FrameLayout) findViewById(R.id.sellerFrameLayout); DrawerLinear = (LinearLayout) findViewById(R.id.DrawerLinear); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); diff --git a/app/src/main/java/madelyntav/c4q/nyc/chipchop/fragments/Fragment_Buyer_Map.java b/app/src/main/java/madelyntav/c4q/nyc/chipchop/fragments/Fragment_Buyer_Map.java index bf62d5d..8c6cae4 100644 --- a/app/src/main/java/madelyntav/c4q/nyc/chipchop/fragments/Fragment_Buyer_Map.java +++ b/app/src/main/java/madelyntav/c4q/nyc/chipchop/fragments/Fragment_Buyer_Map.java @@ -7,7 +7,6 @@ import android.content.IntentSender; import android.content.SharedPreferences; import android.graphics.Color; -import android.graphics.drawable.Drawable; import android.location.Location; import android.location.LocationManager; import android.os.AsyncTask; @@ -121,6 +120,7 @@ private void setListeners() { public void onClick(View view) { // TODO: WRITE CODE TO REFRESH RECYCLERVIEW !! activity.replaceFragment(new Fragment_Buyer_Map()); + } }); @@ -216,6 +216,7 @@ private void bindViews() { arrowImage = (ImageView) root.findViewById(R.id.arrow_image); itemsRView = (RecyclerView) root.findViewById(R.id.buyers_orders_list); refreshButton = (FloatingActionButton) root.findViewById(R.id.refresh_button); + coordinatorLayoutView = root.findViewById(R.id.snackbarPosition); slidingPanel = (SlidingUpPanelLayout) root.findViewById(R.id.slidinglayout); diff --git a/app/src/main/java/madelyntav/c4q/nyc/chipchop/fragments/Fragment_Buyer_SellerProfile.java b/app/src/main/java/madelyntav/c4q/nyc/chipchop/fragments/Fragment_Buyer_SellerProfile.java index 7e53747..9401cce 100644 --- a/app/src/main/java/madelyntav/c4q/nyc/chipchop/fragments/Fragment_Buyer_SellerProfile.java +++ b/app/src/main/java/madelyntav/c4q/nyc/chipchop/fragments/Fragment_Buyer_SellerProfile.java @@ -12,6 +12,8 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.view.animation.Animation; +import android.view.animation.AnimationUtils; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RatingBar; @@ -161,8 +163,10 @@ private void setListeners() { cartButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { + BuyActivity activity = (BuyActivity) getActivity(); activity.replaceFragment(new Fragment_Buyer_ViewCart()); + } }); } @@ -179,9 +183,20 @@ private void bindViews(View root) { containingView.setVisibility(View.INVISIBLE); cartButton = (android.support.design.widget.FloatingActionButton) root.findViewById(R.id.viewCartButton); + + foodList = (RecyclerView) root.findViewById(R.id.seller_items_list); storeImage = (CircleImageView) root.findViewById(R.id.profile_image); + + storeImage.setVisibility(View.VISIBLE); + final Animation myRotation = AnimationUtils.loadAnimation(getActivity(), R.anim.rotate); + storeImage.startAnimation(myRotation); + + storeName = (TextView) root.findViewById(R.id.seller_name); + Animation shake = AnimationUtils.loadAnimation(getActivity(), R.anim.shake); + storeName.startAnimation(shake); + storeDescription = (TextView) root.findViewById(R.id.store_description); coordinatorLayoutView = root.findViewById(R.id.snackbarPosition); ratingBar = (RatingBar) root.findViewById(R.id.rating_bar); diff --git a/app/src/main/res/anim/anim_scale.xml b/app/src/main/res/anim/anim_scale.xml new file mode 100644 index 0000000..7371808 --- /dev/null +++ b/app/src/main/res/anim/anim_scale.xml @@ -0,0 +1,14 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/anim/cycle.xml b/app/src/main/res/anim/cycle.xml new file mode 100644 index 0000000..53e5e3f --- /dev/null +++ b/app/src/main/res/anim/cycle.xml @@ -0,0 +1,3 @@ + + diff --git a/app/src/main/res/anim/scale_fab_in.xml b/app/src/main/res/anim/scale_fab_in.xml new file mode 100644 index 0000000..920d266 --- /dev/null +++ b/app/src/main/res/anim/scale_fab_in.xml @@ -0,0 +1,10 @@ + + diff --git a/app/src/main/res/anim/scale_fab_out.xml b/app/src/main/res/anim/scale_fab_out.xml new file mode 100644 index 0000000..3787de8 --- /dev/null +++ b/app/src/main/res/anim/scale_fab_out.xml @@ -0,0 +1,10 @@ + + \ No newline at end of file diff --git a/app/src/main/res/anim/shake.xml b/app/src/main/res/anim/shake.xml new file mode 100644 index 0000000..0937541 --- /dev/null +++ b/app/src/main/res/anim/shake.xml @@ -0,0 +1,9 @@ + + \ No newline at end of file diff --git a/app/src/main/res/drawable/roundedbutton.xml b/app/src/main/res/drawable/roundedbutton.xml new file mode 100644 index 0000000..afe3971 --- /dev/null +++ b/app/src/main/res/drawable/roundedbutton.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_buyer_seller_profile.xml b/app/src/main/res/layout/fragment_buyer_seller_profile.xml index b5a736d..4ebd8f0 100644 --- a/app/src/main/res/layout/fragment_buyer_seller_profile.xml +++ b/app/src/main/res/layout/fragment_buyer_seller_profile.xml @@ -141,6 +141,7 @@ app:backgroundTint="#D42028" android:layout_above="@+id/seller_items_list" app:elevation="6dp" - app:pressedTranslationZ="12dp"/> + app:pressedTranslationZ="12dp" + app:layout_behavior="com.support.android.designlibdemo.ScrollAwareFABBehavior"/> \ No newline at end of file From 0ca19bd2acb848f574b4c77bad93c342058b36f0 Mon Sep 17 00:00:00 2001 From: hoshikoo Date: Sun, 27 Sep 2015 16:35:19 -0400 Subject: [PATCH 3/3] add animations to buttons --- .../fragments/Fragment_Buyer_Map.java | 11 +++- .../Fragment_Buyer_SellerProfile.java | 21 ++++--- .../fragments/Fragment_Buyer_ViewCart.java | 11 +++- app/src/main/res/drawable/roundedbutton.xml | 62 ++++++++++++++++--- .../res/layout/fragment_buyer__view_cart.xml | 30 +++++++-- .../main/res/layout/fragment_buyer_map.xml | 35 ++++++++--- .../layout/fragment_buyer_seller_profile.xml | 31 +++++++--- 7 files changed, 155 insertions(+), 46 deletions(-) diff --git a/app/src/main/java/madelyntav/c4q/nyc/chipchop/fragments/Fragment_Buyer_Map.java b/app/src/main/java/madelyntav/c4q/nyc/chipchop/fragments/Fragment_Buyer_Map.java index 8c6cae4..cc63c28 100644 --- a/app/src/main/java/madelyntav/c4q/nyc/chipchop/fragments/Fragment_Buyer_Map.java +++ b/app/src/main/java/madelyntav/c4q/nyc/chipchop/fragments/Fragment_Buyer_Map.java @@ -13,7 +13,6 @@ import android.os.Bundle; import android.os.Handler; import android.provider.Settings; -import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v4.app.Fragment; import android.support.v7.widget.LinearLayoutManager; @@ -24,6 +23,9 @@ import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; +import android.view.animation.Animation; +import android.view.animation.AnimationUtils; +import android.widget.ImageButton; import android.widget.ImageView; import android.widget.Toast; @@ -64,7 +66,7 @@ public class Fragment_Buyer_Map extends Fragment implements OnMapReadyCallback, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener { View coordinatorLayoutView; - FloatingActionButton refreshButton; + ImageButton refreshButton; ImageView arrowImage; public SlidingUpPanelLayout slidingPanel; public final static int CONNECTION_FAILURE_RESOLUTION_REQUEST = 9000; @@ -215,7 +217,10 @@ private void initializeMap() { private void bindViews() { arrowImage = (ImageView) root.findViewById(R.id.arrow_image); itemsRView = (RecyclerView) root.findViewById(R.id.buyers_orders_list); - refreshButton = (FloatingActionButton) root.findViewById(R.id.refresh_button); + refreshButton = (ImageButton) root.findViewById(R.id.refresh_button); + + final Animation myRotation = AnimationUtils.loadAnimation(getActivity(), R.anim.rotate); + refreshButton.startAnimation(myRotation); coordinatorLayoutView = root.findViewById(R.id.snackbarPosition); slidingPanel = (SlidingUpPanelLayout) root.findViewById(R.id.slidinglayout); diff --git a/app/src/main/java/madelyntav/c4q/nyc/chipchop/fragments/Fragment_Buyer_SellerProfile.java b/app/src/main/java/madelyntav/c4q/nyc/chipchop/fragments/Fragment_Buyer_SellerProfile.java index 9401cce..277238b 100644 --- a/app/src/main/java/madelyntav/c4q/nyc/chipchop/fragments/Fragment_Buyer_SellerProfile.java +++ b/app/src/main/java/madelyntav/c4q/nyc/chipchop/fragments/Fragment_Buyer_SellerProfile.java @@ -14,6 +14,7 @@ import android.view.ViewGroup; import android.view.animation.Animation; import android.view.animation.AnimationUtils; +import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RatingBar; @@ -40,7 +41,7 @@ public class Fragment_Buyer_SellerProfile extends Fragment { public static final String TAG = "fragment_buyer_seller_profile"; - android.support.design.widget.FloatingActionButton cartButton; + ImageButton cartButton; private ArrayList foodItems; private RecyclerView foodList; @@ -49,7 +50,7 @@ public class Fragment_Buyer_SellerProfile extends Fragment { View coordinatorLayoutView; CircleImageView storeImage; - TextView storeName,storeDescription; + TextView storeName,storeDescription, cookingStatus; TextView deliveryTV, pickupTV; RatingBar ratingBar; @@ -182,20 +183,22 @@ private void bindViews(View root) { containingView = (LinearLayout) root.findViewById(R.id.container); containingView.setVisibility(View.INVISIBLE); - cartButton = (android.support.design.widget.FloatingActionButton) root.findViewById(R.id.viewCartButton); - + cartButton = (ImageButton) root.findViewById(R.id.viewCartButton); + final Animation myRotation2 = AnimationUtils.loadAnimation(getActivity(), R.anim.rotate); + cartButton.startAnimation(myRotation2); foodList = (RecyclerView) root.findViewById(R.id.seller_items_list); storeImage = (CircleImageView) root.findViewById(R.id.profile_image); - storeImage.setVisibility(View.VISIBLE); - final Animation myRotation = AnimationUtils.loadAnimation(getActivity(), R.anim.rotate); - storeImage.startAnimation(myRotation); +// + cookingStatus =(TextView) root.findViewById(R.id.cooking_status); - storeName = (TextView) root.findViewById(R.id.seller_name); Animation shake = AnimationUtils.loadAnimation(getActivity(), R.anim.shake); - storeName.startAnimation(shake); + cookingStatus.startAnimation(shake); + + + storeName = (TextView) root.findViewById(R.id.seller_name); storeDescription = (TextView) root.findViewById(R.id.store_description); coordinatorLayoutView = root.findViewById(R.id.snackbarPosition); diff --git a/app/src/main/java/madelyntav/c4q/nyc/chipchop/fragments/Fragment_Buyer_ViewCart.java b/app/src/main/java/madelyntav/c4q/nyc/chipchop/fragments/Fragment_Buyer_ViewCart.java index cad4482..eef9526 100644 --- a/app/src/main/java/madelyntav/c4q/nyc/chipchop/fragments/Fragment_Buyer_ViewCart.java +++ b/app/src/main/java/madelyntav/c4q/nyc/chipchop/fragments/Fragment_Buyer_ViewCart.java @@ -12,6 +12,9 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.view.animation.Animation; +import android.view.animation.AnimationUtils; +import android.widget.ImageButton; import java.util.ArrayList; @@ -33,7 +36,7 @@ public class Fragment_Buyer_ViewCart extends Fragment { public static final String TAG = "fragment_buyer_view_cart"; public static final String FROM_CART = "from_cart"; - android.support.design.widget.FloatingActionButton checkoutButton; + ImageButton checkoutButton; private ArrayList cartItems; private RecyclerView cartList; private DBHelper dbHelper; @@ -98,10 +101,12 @@ private void setListAdapter() { } private void bindViews(View root) { - checkoutButton = (android.support.design.widget.FloatingActionButton) root.findViewById(R.id.checkoutButton); + checkoutButton = (ImageButton) root.findViewById(R.id.checkoutButton); + final Animation myRotation = AnimationUtils.loadAnimation(getActivity(), R.anim.rotate); + checkoutButton.startAnimation(myRotation); + cartList = (RecyclerView) root.findViewById(R.id.cart_list); coordinatorLayoutView = root.findViewById(R.id.snackbarPosition); - } private void initializeData() { diff --git a/app/src/main/res/drawable/roundedbutton.xml b/app/src/main/res/drawable/roundedbutton.xml index afe3971..cf75a05 100644 --- a/app/src/main/res/drawable/roundedbutton.xml +++ b/app/src/main/res/drawable/roundedbutton.xml @@ -1,9 +1,55 @@ - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_buyer__view_cart.xml b/app/src/main/res/layout/fragment_buyer__view_cart.xml index bcdcca5..734f78d 100644 --- a/app/src/main/res/layout/fragment_buyer__view_cart.xml +++ b/app/src/main/res/layout/fragment_buyer__view_cart.xml @@ -19,16 +19,34 @@ android:gravity="center_horizontal" android:id="@+id/cart_text"/> - + + + + + + + + + + + + android:layout_marginRight="25dp" + android:padding="15dp" + android:background = "@drawable/roundedbutton" + android:layout_above="@+id/seller_items_list" + android:elevation="6dp" + + /> - + + + + + + + + + + + + + + android:layout_marginEnd="5dp" + android:padding="15dp" + android:background = "@drawable/roundedbutton" + android:layout_above="@+id/seller_items_list" + android:elevation="6dp" + android:layout_marginTop="20dp" + android:layout_marginRight="20dp" + /> diff --git a/app/src/main/res/layout/fragment_buyer_seller_profile.xml b/app/src/main/res/layout/fragment_buyer_seller_profile.xml index 4ebd8f0..b8692eb 100644 --- a/app/src/main/res/layout/fragment_buyer_seller_profile.xml +++ b/app/src/main/res/layout/fragment_buyer_seller_profile.xml @@ -131,17 +131,32 @@ - + + + + + + + + + + + + + + android:elevation="6dp" + /> \ No newline at end of file