Skip to content

Commit

Permalink
library: add undobar lib
Browse files Browse the repository at this point in the history
All credits to @soarcn

Signed-off-by: Blechd0se <alex.christ@hotmail.de>
  • Loading branch information
Blechd0se committed May 31, 2014
1 parent e11be4c commit 736f5f4
Show file tree
Hide file tree
Showing 55 changed files with 1,889 additions and 0 deletions.
18 changes: 18 additions & 0 deletions AeroControl/library/UndoBar/.gitignore
@@ -0,0 +1,18 @@
.DS_Store
gen
bin
out
*.iml
*.iws
*.ipr
build.xml
target
.idea
.classpath
.project
/res
build
/.gradle
project.properties
release.properties
local.properties
52 changes: 52 additions & 0 deletions AeroControl/library/UndoBar/.travis.yml
@@ -0,0 +1,52 @@
language: java
jdk: oraclejdk7
env:
matrix:
- ANDROID_SDKS=android-19,sysimg-19 ANDROID_TARGET=android-19 ANDROID_ABI=armeabi-v7a
global:
- secure: HL+OKBCpGbFB3h/0p63b5zZokMedeHfDv8gbi6HIHfoKyfxsLYZvoksEGnaeUXxjBbfJ0FGgFWh98+WoxT7rZ86TLSHK7QTQeZlvBeNVrIfgC3d4kHP+XLyg50wYOe/9fRSk9Hfp6AGHRwqq2+7yY+t0Ra2oKip56cB51rsnEWU=
- secure: RbXqRIUZgZABfN2aMHJO5cBaMTMFR42m7kh7Wibz8kdeL792MoIjIZRvTeYYKlW+dSU+FDj2dceJEGtbSEFxa6OLNCigGetN9F8aWB6ohTNK1DB79x0OykuywQeSSBT9MZebu8H63/hjUu8M7pzKaQHS8JqdaBg03jX4G1xjCp4=

before_install:
# Install base Android SDK
- sudo apt-get update -qq
- if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq --force-yes libgd2-xpm ia32-libs ia32-libs-multiarch > /dev/null; fi
- wget http://dl.google.com/android/android-sdk_r22.3-linux.tgz
- tar xzf android-sdk_r22.3-linux.tgz
- export ANDROID_HOME=$PWD/android-sdk-linux
- export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools

# Gradle
- wget http://services.gradle.org/distributions/gradle-1.10-bin.zip
- unzip gradle-1.10-bin.zip
- export GRADLE_HOME=$PWD/gradle-1.10
- export PATH=$GRADLE_HOME/bin:$PATH

# install android build tools
- wget https://dl-ssl.google.com/android/repository/build-tools_r19.0.1-linux.zip
- unzip build-tools_r19.0.1-linux.zip -d $ANDROID_HOME
- mkdir -p $ANDROID_HOME/build-tools/
- mv $ANDROID_HOME/android-4.4.2 $ANDROID_HOME/build-tools/19.0.1

# Install required components.
# For a full list, run `android list sdk -a --extended`
# Note that sysimg-18 downloads the ARM, x86 and MIPS images (we should optimize this).
# Other relevant API's
- echo yes | android update sdk --filter platform-tools --no-ui --force > /dev/null
- echo yes | android update sdk --filter android-18 --no-ui --force > /dev/null
- echo yes | android update sdk --filter android-19 --no-ui --force > /dev/null
- echo yes | android update sdk --filter sysimg-19 --no-ui --force > /dev/null
- echo yes | android update sdk --filter extra-android-support --no-ui --force > /dev/null
- echo yes | android update sdk --filter extra-android-m2repository --no-ui --force > /dev/null

# Create and start emulator
- echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI
- emulator -avd test -no-skin -no-audio -no-window &

before_script:
- chmod +x ci/wait_for_emulator.sh
- ci/wait_for_emulator.sh
- adb shell input keyevent 82 &

script:
- TERM=dumb gradle connectedInstrumentTest
89 changes: 89 additions & 0 deletions AeroControl/library/UndoBar/README.md
@@ -0,0 +1,89 @@
UndoBar
=======

This is a implementation for Android advanced UI pattern undo-bar, used in Gmail app, create by roman nurik

UndoBar was modified from Roman(@romannurik)'s undobar concept (https://code.google.com/p/romannurik-code/), and backport it to Android 2.x and make it easier to use

![UndoBar Sample](https://github.com/soarcn/UndoBar/blob/master/art/kitkat.png?raw=true)
![UndoBar Sample](https://github.com/soarcn/UndoBar/blob/master/art/redo.png?raw=true)
![UndoBar Sample](https://github.com/soarcn/UndoBar/blob/master/art/refresh.png?raw=true)
![UndoBar Sample](https://github.com/soarcn/UndoBar/blob/master/art/customize.png?raw=true)


How to use this library
=======

- Download this library, import to your IDE (eclipse...) as a library project.
- Using Gradle(from 0.5):

```xml
compile 'com.cocosw:undobar:1.+@aar'
```

- Using Maven(<0.4)

```xml
<dependency>
<groupId>com.cocosw</groupId>
<artifactId>undobar</artifactId>
<version>0.4</version>
<type>apklib</type>
</dependency>
```



API
=======

- You can use UndoBar by just one line code

``` java
UndoBarController.show(getActivity(), "Undo-bar title" , listener, undoToken);
```
- You can also use UndoBar in builder style.

``` java
new UndoBar(getActivity()).message("Undo-bar title").listener(listener).show;
```

- UndoBar support customize style with background/icon/duration/animation attribution.
- UndoBar provides 3 default styles. You can use them for different purpose like undo,refresh, or just use it as replacement of Toasts.
- UndoBar will switch to KitKat look and feel in API-19 target.
- UndoBar will determine if tranlucent mode(4.4) is using and adjust its position.
- You can overwrite style in your project to change the look and feel. For example, you can use following lines in your style.xml to always use KitKat style UndoBar.

```xml
<style name="UndoBar" parent="UndoBarKitKat"/>
<style name="UndoBarMessage" parent="UndoBarMessageKitKat"/>
<style name="UndoBarButton" parent="UndoBarButtonKitKat"/>
```

Contribute
=======

- Feel free to fork it


Other
=======
- Works perfectly with Crouton/Menudrawer/ABS


License
=======

Copyright 2011, 2014 Liao Kai

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
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.
Binary file added AeroControl/library/UndoBar/art/customize.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AeroControl/library/UndoBar/art/kitkat.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AeroControl/library/UndoBar/art/redo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AeroControl/library/UndoBar/art/refresh.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AeroControl/library/UndoBar/art/undobar.9.psd
Binary file not shown.
Binary file added AeroControl/library/UndoBar/art/undobar.psd
Binary file not shown.
Binary file not shown.
50 changes: 50 additions & 0 deletions AeroControl/library/UndoBar/build.gradle
@@ -0,0 +1,50 @@
/*
* Copyright (C) 2014 Snowdream Mobile <yanghui1986527@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* 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.
*/

buildscript {
repositories {
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:+'
}
}

allprojects {
groupId = POM_GROUP_ID
artifactId = POM_ARTIFACT_ID
version = POM_VERSION

repositories {
mavenLocal()
mavenCentral()
maven { url "http://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "file:///D:/develop/mvn" }
maven { url "https://raw.github.com/soarcn/mvn/master" }
}

tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
}


task wrapper(type: Wrapper) {
gradleVersion = '1.12'
}


115 changes: 115 additions & 0 deletions AeroControl/library/UndoBar/checkstyle.xml
@@ -0,0 +1,115 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">

<module name="Checker">
<!--module name="NewlineAtEndOfFile"/-->
<module name="FileLength"/>
<module name="FileTabCharacter"/>

<!-- Trailing spaces -->
<module name="RegexpSingleline">
<property name="format" value="\s+$"/>
<property name="message" value="Line has trailing spaces."/>
</module>

<module name="TreeWalker">
<property name="cacheFile" value="${checkstyle.cache.file}"/>

<!-- Checks for Javadoc comments. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
<!--module name="JavadocMethod"/-->
<!--module name="JavadocType"/-->
<!--module name="JavadocVariable"/-->
<!--module name="JavadocStyle"/-->


<!-- Checks for Naming Conventions. -->
<!-- See http://checkstyle.sf.net/config_naming.html -->
<module name="ConstantName"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>


<!-- Checks for imports -->
<!-- See http://checkstyle.sf.net/config_import.html -->
<module name="AvoidStarImport"/>
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
<module name="RedundantImport"/>
<module name="UnusedImports"/>


<!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html -->
<!--module name="LineLength"/-->
<!--module name="MethodLength"/-->
<!--module name="ParameterNumber"/-->


<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<!--module name="EmptyForIteratorPad"/-->
<!--module name="MethodParamPad"/-->
<!--module name="NoWhitespaceAfter"/-->
<!--module name="NoWhitespaceBefore"/-->
<!--module name="OperatorWrap"/-->
<!--module name="ParenPad"/-->
<!--module name="TypecastParenPad"/-->
<!--module name="WhitespaceAfter"/-->
<!--module name="WhitespaceAround"/-->


<!-- Modifier Checks -->
<!-- See http://checkstyle.sf.net/config_modifiers.html -->
<!--module name="ModifierOrder"/-->
<!--module name="RedundantModifier"/-->


<!-- Checks for blocks. You know, those {}'s -->
<!-- See http://checkstyle.sf.net/config_blocks.html -->
<!--module name="AvoidNestedBlocks"/-->
<!--module name="EmptyBlock"/-->
<!--module name="LeftCurly"/-->
<!--module name="NeedBraces"/-->
<!--module name="RightCurly"/-->


<!-- Checks for common coding problems -->
<!-- See http://checkstyle.sf.net/config_coding.html -->
<!--module name="AvoidInlineConditionals"/-->
<!--module name="DoubleCheckedLocking"/--> <!-- MY FAVOURITE -->
<!--module name="EmptyStatement"/-->
<!--module name="EqualsHashCode"/-->
<!--module name="HiddenField"/-->
<!--module name="IllegalInstantiation"/-->
<!--module name="InnerAssignment"/-->
<!--module name="MagicNumber"/-->
<!--module name="MissingSwitchDefault"/-->
<!--module name="RedundantThrows"/-->
<!--module name="SimplifyBooleanExpression"/-->
<!--module name="SimplifyBooleanReturn"/-->

<!-- Checks for class design -->
<!-- See http://checkstyle.sf.net/config_design.html -->
<!--module name="DesignForExtension"/-->
<!--module name="FinalClass"/-->
<!--module name="HideUtilityClassConstructor"/-->
<!--module name="InterfaceIsType"/-->
<!--module name="VisibilityModifier"/-->


<!-- Miscellaneous other checks. -->
<!-- See http://checkstyle.sf.net/config_misc.html -->
<!--module name="ArrayTypeStyle"/-->
<!--module name="FinalParameters"/-->
<!--module name="TodoComment"/-->
<!--module name="UpperEll"/-->
</module>
</module>
42 changes: 42 additions & 0 deletions AeroControl/library/UndoBar/config/android-library.gradle
@@ -0,0 +1,42 @@
/*
* Copyright (C) 2014 Snowdream Mobile <yanghui1986527@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* 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.
*/

apply plugin: 'android-library'

archivesBaseName = POM_NAME

dependencies {
}

android {
compileSdkVersion Integer.parseInt(project.COMPILE_SDK_VERSION)
buildToolsVersion project.BUILD_TOOLS_VERSION

defaultConfig {
versionCode Integer.parseInt(project.VERSION_CODE)
versionName project.VERSION_NAME
minSdkVersion Integer.parseInt(project.MIN_SDK_VERSION)
targetSdkVersion Integer.parseInt(project.TARGET_SDK_VERSION)
}

packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}

0 comments on commit 736f5f4

Please sign in to comment.