From e6041e1e5056b0a50b756518eb0a3e4b82ab10e7 Mon Sep 17 00:00:00 2001 From: Eugene Popovich Date: Fri, 25 Apr 2014 13:28:38 +0300 Subject: [PATCH] CountDown style like in ListViewAnimations (https://github.com/nhaarman/ListViewAnimations) library: - UndoBarController: removed mHideRunnable field - UndoBarController: added new fields mDismissStartMillis, mCountDownRunnable, mMessageCountdownView - UndoBarController: added mCountDownRunnable, mMessageCountdownView fields initialization to the constructor - UndoBarController: updated runnable reference for the removeCallback call in the undoBar method - UndoBarController: modified showUndoBar to adjust visibility and text of mMessageCountdownView if countDownFormatter is present in the style - UndoBarController: updated hide handler logic in the showUndoBar method - UndoBarController.CountDownRunnable: added - UndoBarStyle: added countDownFormatter field and its setter method - UndoBarStyle: added countDownFormatter support to parcelable implementation - res/layout/undobar.xml: reworked TextView part, added hidden countdown view below it - res/values/styles.xml: added UndoBarMessageContainer, UndoBarMessageCountdown, UndoBarMessageContainerClassic, UndoBarMessageCountdownClassic, UndoBarMessageContainerKitKat, UndoBarMessageCountdownKitKat styles demo: - MainActivity: added onClick handling for the button5 - UndoCountdownStyle: added - res/layout/activity_main.xml: added button5 declaration - res/values/strings.xml: added couple of string constants - res/values/styles.xml: added definition for the UndoBarMessageContainer and UndoBarMessageCountdown styles - AndroidManifest.xml: added UndoCountdownStyle activity declaration --- example/AndroidManifest.xml | 4 ++ example/res/layout/activity_main.xml | 8 +++ example/res/values/strings.xml | 9 +++ example/res/values/styles.xml | 9 ++- .../cocosw/undobar/example/MainActivity.java | 4 ++ .../undobar/example/UndoCountdownStyle.java | 65 +++++++++++++++++++ library/res/layout/undobar.xml | 19 ++++-- library/res/values/styles.xml | 32 +++++++-- .../com/cocosw/undobar/UndoBarController.java | 53 +++++++++++++-- .../src/com/cocosw/undobar/UndoBarStyle.java | 25 ++++++- 10 files changed, 208 insertions(+), 20 deletions(-) create mode 100644 example/src/com/cocosw/undobar/example/UndoCountdownStyle.java diff --git a/example/AndroidManifest.xml b/example/AndroidManifest.xml index 4d2d36c..fbb6c7c 100644 --- a/example/AndroidManifest.xml +++ b/example/AndroidManifest.xml @@ -23,6 +23,10 @@ android:name="com.cocosw.undobar.example.UndoStyle" android:label="@string/title_activity_undo_style" > + + diff --git a/example/res/layout/activity_main.xml b/example/res/layout/activity_main.xml index 9d09cd2..dc25981 100644 --- a/example/res/layout/activity_main.xml +++ b/example/res/layout/activity_main.xml @@ -33,4 +33,12 @@ android:layout_below="@+id/button3" android:layout_centerHorizontal="true" android:text="Customize style" /> +