Skip to content

Commit

Permalink
Merge pull request #15 from nispok/master
Browse files Browse the repository at this point in the history
2.1.1
  • Loading branch information
wmora committed Nov 19, 2014
2 parents d3502aa + 358b2c5 commit 14f14fc
Show file tree
Hide file tree
Showing 41 changed files with 501 additions and 465 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
.DS_Store
/build
*.iml
.navigation
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ language: android

env:
matrix:
- ANDROID_TARGET=android-19 ANDROID_ABI=armeabi-v7a
- ANDROID_TARGET=android-17 ANDROID_ABI=armeabi-v7a

branches:
only:
Expand All @@ -16,14 +16,14 @@ android:
- tools

# The BuildTools version used by your project
- build-tools-20.0.0
- build-tools-21.1.1

# The SDK version used to compile your project
- android-20
- android-21

# Specify at least one system image,
# if you need to run emulator(s) during your tests
- sys-img-armeabi-v7a-android-19
- sys-img-armeabi-v7a-android-17
- sys-img-x86-android-17

# Emulator Management: Create, Start and Wait
Expand All @@ -34,4 +34,4 @@ before_script:
- adb shell input keyevent 82 &

script:
- ./gradlew :lib:connectedAndroidTest
- ./gradlew :lib:connectedAndroidTest
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Snackbar
[![Build Status](https://travis-ci.org/wmora/snackbar.svg?branch=master)](https://travis-ci.org/wmora/snackbar)
[![Build Status](https://travis-ci.org/nispok/snackbar.svg?branch=master)](https://travis-ci.org/nispok/snackbar)

Library that implements <a href="http://www.google.com/design/spec/components/snackbars-and-toasts.html">Snackbars</a> from Google's <a href="http://www.google.com/design/spec/material-design/introduction.html">Material Design documentation</a>.

Expand All @@ -9,7 +9,7 @@ Library that implements <a href="http://www.google.com/design/spec/components/sn
You can import the library from source as a module or grab via Gradle:
<br />
```groovy
compile 'com.williammora:snackbar:1.4.0'
compile 'com.nispok:snackbar:2.1.1'
```
## Usage
<br />
Expand Down Expand Up @@ -79,23 +79,24 @@ Snackbar.with(getApplicationContext()) // context
}) // action button's ActionClickListener
.show(this); // activity where it is displayed
```
It uses [Roman Nurik's SwipeToDismiss sample code](https://github.com/romannurik/android-swipetodismiss) to implement the swipe-to-dimiss functionality. This is enabled by default. You can disable this if you don't want this functionality:<br />
It uses [Roman Nurik's SwipeToDismiss sample code](https://github.com/romannurik/android-swipetodismiss) to implement the swipe-to-dismiss functionality. This is enabled by default. You can disable this if you don't want this functionality:<br />
<br />
```java
Snackbar.with(SnackbarSampleActivity.this) // context
.text("Can't swipe this") // text to be displayed
.swipeToDismiss(false) // disable swipe-to-dismiss functionality
.show(this); // activity where it is displayed
```
If you would like to add features to it or report any bugs, refer to the [issues](https://github.com/wmora/snackbar/issues) section.<br /><br />
If you would like to add features to it or report any bugs, refer to the [issues](https://github.com/nispok/snackbar/issues) section.<br /><br />

# Examples
There's a sample app included in the project. [SnackbarSampleActivity](./sample/src/main/java/com/williammora/sample/snackbar/SnackbarSampleActivity.java) is where you want to start.
There's a sample app included in the project. [SnackbarSampleActivity](./sample/src/main/java/com/nispok/sample/snackbar/SnackbarSampleActivity.java) is where you want to start.

# Contributors
+ William Mora - [@_williammora](https://twitter.com/_williammora) - [email protected]
+ [William Mora](https://github.com/wmora) - [@_williammora](https://twitter.com/_williammora) - [email protected]
+ [Lewis Deane](https://github.com/lewisjdeane)
+ [Andrew Hughes](https://github.com/ashughes)
+ [David Richardson](https://github.com/davidjrichardson)

## License
[MIT](./LICENSE)
[MIT](./LICENSE)
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.13.2'
classpath 'com.android.tools.build:gradle:0.14.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
20 changes: 8 additions & 12 deletions lib/build.gradle
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
compileSdkVersion 21
buildToolsVersion "21.1.1"

defaultConfig {
applicationId "com.williammora.snackbar"
minSdkVersion 15
targetSdkVersion 20
versionCode 5
versionName "1.4.0"
applicationId "com.nispok.snackbar"
minSdkVersion 14
targetSdkVersion 21
versionCode 7
versionName "2.1.1"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
testHandleProfiling true
testFunctionalTest true
}
buildTypes {
release {
runProguard false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}

apply from: 'maven-push.gradle'
16 changes: 8 additions & 8 deletions lib/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
POM_NAME=Snackbar
POM_ARTIFACT_ID=snackbar
POM_PACKAGING=aar
GROUP=com.williammora
VERSION_NAME=1.4.0
GROUP=com.nispok
VERSION_NAME=2.1.1

POM_DESCRIPTION=Snackbar Android library
POM_URL=https://github.com/wmora/snackbar
POM_SCM_URL=https://github.com/wmora/snackbar
POM_SCM_CONNECTION=scm:hg:https://github.com/wmora/snackbar
POM_SCM_DEV_CONNECTION=scm:hg:https://github.com/wmora/snackbar
POM_URL=https://github.com/nispok/snackbar
POM_SCM_URL=https://github.com/nispok/snackbar
POM_SCM_CONNECTION=scm:hg:https://github.com/nispok/snackbar
POM_SCM_DEV_CONNECTION=scm:hg:https://github.com/nispok/snackbar
POM_LICENCE_NAME=MIT License
POM_LICENCE_URL=http://www.opensource.org/licenses/mit-license.php
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=wmora
POM_DEVELOPER_NAME=William Mora
POM_DEVELOPER_ID=nispok
POM_DEVELOPER_NAME=Nispok

SNAPSHOT_REPOSITORY_URL=https://oss.sonatype.org/content/repositories/snapshots
RELEASE_REPOSITORY_URL=https://oss.sonatype.org/service/local/staging/deploy/maven2
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.williammora.snackbar;
package com.nispok.snackbar;

import android.content.Context;
import android.graphics.Color;
import android.test.InstrumentationTestCase;

import com.nispok.snackbar.enums.SnackbarType;

public class SnackbarTests extends InstrumentationTestCase {

private Snackbar mSnackbar;
Expand All @@ -18,13 +20,13 @@ protected void setUp() throws Exception {
public void testSnackbarShouldBeSingleLineByDefault() {
mSnackbar = Snackbar.with(mContext);

assertEquals(Snackbar.SnackbarType.SINGLE_LINE, mSnackbar.getType());
assertEquals(SnackbarType.SINGLE_LINE, mSnackbar.getType());
}

public void testSnackbarTypeCanBeChanged() {
mSnackbar = Snackbar.with(mContext).type(Snackbar.SnackbarType.MULTI_LINE);
mSnackbar = Snackbar.with(mContext).type(SnackbarType.MULTI_LINE);

assertEquals(Snackbar.SnackbarType.MULTI_LINE, mSnackbar.getType());
assertEquals(SnackbarType.MULTI_LINE, mSnackbar.getType());
}

public void testSnackbarShouldHaveLongLengthDurationSetByDefault() {
Expand All @@ -51,12 +53,6 @@ public void testSnackbarTextColorCanBeChanged() {
assertEquals(Color.GREEN, mSnackbar.getTextColor());
}

public void testSnackbarActionColorShouldBeGreenByDefault() {
mSnackbar = Snackbar.with(mContext);

assertEquals(Color.GREEN, mSnackbar.getActionColor());
}

public void testSnackbarActionColorCanBeChanged() {
mSnackbar = Snackbar.with(mContext).actionColor(Color.BLUE);

Expand All @@ -81,14 +77,14 @@ public void testSnackbarCanBeCreatedWithMultipleCustomConfiguration() {
.textColor(Color.GREEN)
.text("Aloha!")
.actionLabel("Action")
.type(Snackbar.SnackbarType.MULTI_LINE)
.type(SnackbarType.MULTI_LINE)
.duration(Snackbar.SnackbarDuration.LENGTH_SHORT);

assertEquals(Color.BLUE, mSnackbar.getColor());
assertEquals(Color.GREEN, mSnackbar.getTextColor());
assertEquals("Aloha!", mSnackbar.getText());
assertEquals("Action", mSnackbar.getActionLabel());
assertEquals(Snackbar.SnackbarType.MULTI_LINE, mSnackbar.getType());
assertEquals(SnackbarType.MULTI_LINE, mSnackbar.getType());
assertEquals(Snackbar.SnackbarDuration.LENGTH_SHORT.getDuration(), mSnackbar.getDuration());
}

Expand All @@ -107,11 +103,11 @@ public void testSnackbarWithCustomDurationOverrideSnackbarDuration() {
assertEquals(1000l, mSnackbar.getDuration());
}

public void testSnackbarCanBeSetToDismissOnActionClicked() {
public void testSnackbarCanBeSetToNotDismissOnActionClicked() {
mSnackbar = Snackbar.with(mContext)
.dismissOnActionClicked(true);
.dismissOnActionClicked(false);

assertTrue(mSnackbar.shouldDismissOnActionClicked());
assertFalse(mSnackbar.shouldDismissOnActionClicked());
}

public void testSnackbarShouldBeDismissedOnActionClickedByDefault() {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<manifest package="com.williammora.snackbar">
<manifest package="com.nispok.snackbar">

<application />

Expand Down
Loading

0 comments on commit 14f14fc

Please sign in to comment.