Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
keyboardsurfer committed Feb 3, 2014
2 parents 6607d91 + ed7da31 commit c0efce4
Show file tree
Hide file tree
Showing 26 changed files with 130 additions and 101 deletions.
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Crouton
Copyright 2012 - 2013 Benjamin Weiss
Copyright 2012 - 2014 Benjamin Weiss

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
6 changes: 3 additions & 3 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ You can check some features in the Crouton Demo.
If you're already using Crouton and just want to download the latest version of the library, follow [this link](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22de.keyboardsurfer.android.widget%22).

## [Changelog](https://github.com/keyboardsurfer/Crouton/wiki/Changelog)
### Current version: 1.8.2
### Current version: 1.8.3

## Usage

Expand Down Expand Up @@ -101,7 +101,7 @@ Then declare Crouton within your dependencies:
```groovy
dependencies {
...
compile('de.keyboardsurfer.android.widget:crouton:1.8.1') {
compile('de.keyboardsurfer.android.widget:crouton:1.8.3') {
// exclusion is not neccessary, but generally a good idea.
exclude group: 'com.google.android', module: 'support-v4'
}
Expand Down Expand Up @@ -166,7 +166,7 @@ The build requires Gradle. Operations are very simple:
After putting Crouton in a repository you can add it as dependency.

```gradle
compile('de.keyboardsurfer.android.widget:crouton:1.8.1') {
compile('de.keyboardsurfer.android.widget:crouton:1.8.3') {
exclude group: 'com.google.android', module: 'support-v4'
}
```
Expand Down
28 changes: 14 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/*
* Copyright 2012 - 2013 Benjamin Weiss
*
* 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.
* Copyright 2012 - 2014 Benjamin Weiss
*
* 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.
*/


Expand All @@ -25,7 +25,7 @@ subprojects {
}

dependencies {
classpath 'com.android.tools.build:gradle:0.7+'
classpath 'com.android.tools.build:gradle:0.8+'
classpath 'com.github.dcendents:android-maven-plugin:1.0'
}
}
Expand Down
20 changes: 2 additions & 18 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
#
# Copyright 2012 - 2013 Benjamin Weiss
#
# 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.
#

#Fri Jan 10 13:11:21 CET 2014
#Mon Feb 03 17:16:48 CET 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.9-all.zip
distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-bin.zip
14 changes: 7 additions & 7 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013 Benjamin Weiss
* Copyright 2012 - 2014 Benjamin Weiss
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,21 +25,21 @@ android {
buildToolsVersion '19'
compileSdkVersion 19
defaultConfig {
versionCode 6
versionName "1.8.2"
versionCode 7
versionName "1.8.3"
minSdkVersion 8
targetSdkVersion 19
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
}

group = "de.keyboardsurfer.android.widget"
artifactId = "crouton"
version = "1.8.2"
version = "1.8.3"

android.libraryVariants.all { variant ->
def name = variant.buildType.name
Expand Down Expand Up @@ -84,7 +84,7 @@ artifacts {

task wrapper(type: Wrapper) {
description "Generates the gradle wrapper"
gradleVersion = "1.9"
gradleVersion = "1.10"
}


Expand Down
4 changes: 2 additions & 2 deletions library/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Jan 06 11:20:11 CET 2014
#Mon Feb 03 17:16:48 CET 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.9-bin.zip
distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-bin.zip
2 changes: 1 addition & 1 deletion library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2012 - 2013 Benjamin Weiss
~ Copyright 2012 - 2014 Benjamin Weiss
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013 Benjamin Weiss
* Copyright 2012 - 2014 Benjamin Weiss
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012 - 2013 Benjamin Weiss
* Copyright 2012 - 2014 Benjamin Weiss
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -830,7 +830,7 @@ private FrameLayout initializeCroutonViewGroup(Resources resources) {
new FrameLayout.LayoutParams(width != 0 ? width : FrameLayout.LayoutParams.MATCH_PARENT, height));

// set background
if (this.style.backgroundColorValue != -1) {
if (this.style.backgroundColorValue != Style.NOT_SET) {
croutonView.setBackgroundColor(this.style.backgroundColorValue);
} else {
croutonView.setBackgroundColor(resources.getColor(this.style.backgroundColorResourceId));
Expand Down Expand Up @@ -879,11 +879,11 @@ private RelativeLayout initializeContentView(final Resources resources) {
textParams.addRule(RelativeLayout.RIGHT_OF, image.getId());
}

if (this.style.gravity == Gravity.CENTER) {
if ((this.style.gravity & Gravity.CENTER) != 0) {
textParams.addRule(RelativeLayout.CENTER_IN_PARENT);
} else if (this.style.gravity == Gravity.CENTER_VERTICAL) {
} else if ((this.style.gravity & Gravity.CENTER_VERTICAL) != 0) {
textParams.addRule(RelativeLayout.CENTER_VERTICAL);
} else if (this.style.gravity == Gravity.CENTER_HORIZONTAL) {
} else if ((this.style.gravity & Gravity.CENTER_HORIZONTAL) != 0) {
textParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
}

Expand All @@ -899,7 +899,9 @@ private TextView initializeTextView(final Resources resources) {
text.setGravity(this.style.gravity);

// set the text color if set
if (this.style.textColorResourceId != 0) {
if (this.style.textColorValue != Style.NOT_SET) {
text.setTextColor(this.style.textColorValue);
} else if (this.style.textColorResourceId != 0) {
text.setTextColor(resources.getColor(this.style.textColorResourceId));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012 - 2013 Benjamin Weiss
* Copyright 2012 - 2014 Benjamin Weiss
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012 - 2013 Benjamin Weiss
* Copyright 2012 - 2014 Benjamin Weiss
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012 - 2013 Benjamin Weiss
* Copyright 2012 - 2014 Benjamin Weiss
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012 - 2013 Benjamin Weiss
* Copyright 2012 - 2014 Benjamin Weiss
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -24,6 +24,8 @@

/** The style for a {@link Crouton}. */
public class Style {

public static final int NOT_SET = -1;

public static final int holoRedLight = 0xffff4444;
public static final int holoGreenLight = 0xff99cc00;
Expand Down Expand Up @@ -71,7 +73,7 @@ public class Style {
/**
* The backgroundColorResourceValue's e.g. 0xffff4444;
* <p/>
* -1 for no value.
* NOT_SET for no value.
*/
final int backgroundColorValue;

Expand All @@ -85,6 +87,13 @@ public class Style {
*/
final int textColorResourceId;

/**
* The textColorResourceValue's e.g. 0xffff4444;
* <p/>
* NOT_SET for no value.
*/
final int textColorValue;

/** The height of the {@link Crouton} in pixels. */
final int heightInPixels;

Expand Down Expand Up @@ -143,6 +152,7 @@ private Style(final Builder builder) {
this.backgroundDrawableResourceId = builder.backgroundDrawableResourceId;
this.isTileEnabled = builder.isTileEnabled;
this.textColorResourceId = builder.textColorResourceId;
this.textColorValue = builder.textColorValue;
this.heightInPixels = builder.heightInPixels;
this.heightDimensionResId = builder.heightDimensionResId;
this.widthInPixels = builder.widthInPixels;
Expand Down Expand Up @@ -170,6 +180,7 @@ public static class Builder {
private int backgroundDrawableResourceId;
private boolean isTileEnabled;
private int textColorResourceId;
private int textColorValue;
private int heightInPixels;
private int heightDimensionResId;
private int widthInPixels;
Expand All @@ -193,9 +204,10 @@ public Builder() {
paddingInPixels = 10;
backgroundColorResourceId = android.R.color.holo_blue_light;
backgroundDrawableResourceId = 0;
backgroundColorValue = -1;
backgroundColorValue = NOT_SET;
isTileEnabled = false;
textColorResourceId = android.R.color.white;
textColorValue = NOT_SET;
heightInPixels = LayoutParams.WRAP_CONTENT;
widthInPixels = LayoutParams.MATCH_PARENT;
gravity = Gravity.CENTER;
Expand All @@ -217,6 +229,7 @@ public Builder(final Style baseStyle) {
backgroundDrawableResourceId = baseStyle.backgroundDrawableResourceId;
isTileEnabled = baseStyle.isTileEnabled;
textColorResourceId = baseStyle.textColorResourceId;
textColorValue = baseStyle.textColorValue;
heightInPixels = baseStyle.heightInPixels;
heightDimensionResId = baseStyle.heightDimensionResId;
widthInPixels = baseStyle.widthInPixels;
Expand Down Expand Up @@ -377,6 +390,19 @@ public Builder setTextColor(int textColor) {
return this;
}

/**
* Set the textColorResourceValue option of the {@link Crouton}.
*
* @param textColorValue
* The textColorResourceValue's e.g. 0xffff4444;
*
* @return the {@link Builder}.
*/
public Builder setTextColorValue(int textColorValue) {
this.textColorValue = textColorValue;
return this;
}

/**
* Set the gravity option for the {@link Crouton}.
*
Expand Down Expand Up @@ -488,6 +514,7 @@ public String toString() {
", backgroundColorValue=" + backgroundColorValue +
", isTileEnabled=" + isTileEnabled +
", textColorResourceId=" + textColorResourceId +
", textColorValue=" + textColorValue +
", heightInPixels=" + heightInPixels +
", heightDimensionResId=" + heightDimensionResId +
", widthInPixels=" + widthInPixels +
Expand Down
38 changes: 19 additions & 19 deletions sample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/*
* Copyright 2013 Benjamin Weiss
*
* 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.
*/
* Copyright 2012 - 2014 Benjamin Weiss
*
* 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'
version = '1.8.2'
version = '1.8.3'

buildscript {
repositories {
Expand Down Expand Up @@ -45,15 +45,15 @@ android {
compileSdkVersion 19

defaultConfig {
versionCode 12
versionName "1.8.2"
versionCode 13
versionName "1.8.3"
minSdkVersion 8
targetSdkVersion 19
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}

signingConfigs {
Expand Down
2 changes: 1 addition & 1 deletion sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2012 - 2013 Benjamin Weiss
~ Copyright 2012 - 2014 Benjamin Weiss
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
Expand Down
Loading

0 comments on commit c0efce4

Please sign in to comment.