Skip to content

Commit 52f9ffa

Browse files
Added a FloatingLabel template
Added a FloatingLabel template based on [Chris Banes code](https://gist.github.com/chrisbanes/11247418)
1 parent 8736a27 commit 52f9ffa

File tree

19 files changed

+519
-4
lines changed

19 files changed

+519
-4
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Change Log
2+
===============================================================================
3+
4+
Version 1.1 *(2014-04-30)*
5+
----------------------------
6+
* Added: `FloatingLabelLayout` [template](https://github.com/gabrielemariotti/AndroidStudioTemplate/tree/master/templates/custom/FloatingLabel)
7+
8+
9+
Version 1.0
10+
----------------------------
11+
* Initial release with SwipeRefreshLayout and Array Adapter templates

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,29 @@ Restart Android Studio, and you will find it in: **New -> Activity -> SwipeRefre
2929

3030
Copy the `custom` folder in your Android Studio installation in this folder: `<androidStudio-folder>/plugins/android/lib/templates/`
3131

32-
Restart Android Studio, and you will find it in: **New -> Adapter**
32+
Restart Android Studio, and you will find it in: **New -> xxxx**
3333

3434

3535
It contains these templates:
3636

3737
- **Array Adapter**: Creates a new Custom Array Adapter with a ViewHolder pattern.
3838

3939
- **Array Adapter + Activity**: Creates a new Custom Array Adapter with a ViewHolder pattern, and an Activity with a List.
40+
41+
- **FloatingLabelLayout**: Creates a Floating Label Layout based on [FloatingLabelLayout] code by [Chris Banes]. You can read more info in this [post](https://plus.google.com/+ChrisBanes/posts/5Ejaq51UWGo). ( in: **New -> Custom View**)
4042

4143

44+
## ChangeLog
45+
46+
* [Changelog:](https://github.com/gabrielemariotti/AndroidStudioTemplate/tree/master/CHANGELOG.md) A complete changelog
47+
48+
49+
Acknowledgements
50+
--------------------
51+
52+
* Thanks to [Chris Banes] for [FloatingLabelLayout] class.
53+
54+
4255
Credits
4356
-------
4457

@@ -79,3 +92,5 @@ License
7992

8093
[SwipeRefreshLayout]:https://github.com/gabrielemariotti/AndroidStudioTemplate#swiperefreshlayout
8194
[Custom]:https://github.com/gabrielemariotti/AndroidStudioTemplate#custom
95+
[Chris Banes]:https://plus.google.com/+ChrisBanes
96+
[FloatingLabelLayout]:https://gist.github.com/chrisbanes/11247418

templates/activities/SwipeRefreshLayout/template.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0"?>
22
<template
33
format="3"
4-
revision="4"
4+
revision="1"
55
name="SwipeRefreshLayout"
66
minApi="7"
77
minBuildApi="14"

templates/custom/ArrayAdapter/template.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0"?>
22
<template
33
format="4"
4-
revision="2"
4+
revision="1"
55
name="Custom ArrayAdapter"
66
description="Creates a new array adapter with the ViewHolder pattern"
77
minApi="7"

templates/custom/ArrayAdapterWithActivity/template.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0"?>
22
<template
33
format="3"
4-
revision="4"
4+
revision="1"
55
name="CustomArrayAdapter + Activity"
66
minApi="7"
77
minBuildApi="14"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0"?>
2+
<globals>
3+
<global id="manifestOut" value="${manifestDir}" />
4+
<global id="appCompat" value="${(minApiLevel lt 14)?string('1','')}" />
5+
<!-- e.g. getSupportActionBar vs. getActionBar -->
6+
<global id="Support" value="${(minApiLevel lt 14)?string('Support','')}" />
7+
<global id="srcOut" value="${srcDir}/${slashedPackageName(packageName)}" />
8+
<global id="resOut" value="${resDir}" />
9+
</globals>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0"?>
2+
<recipe>
3+
4+
<#if appCompat?has_content><dependency mavenUrl="com.android.support:appcompat-v7:19.+"/></#if>
5+
<dependency mavenUrl="com.android.support:support-v4:19.+"/>
6+
7+
<#if isActivityAdded>
8+
<merge from="AndroidManifest.xml.ftl"
9+
to="${escapeXmlAttribute(manifestOut)}/AndroidManifest.xml" />
10+
11+
<merge from="res/values/floatinglabel_strings.xml.ftl"
12+
to="${escapeXmlAttribute(resOut)}/values/floatinglabel_strings.xml" />
13+
14+
<merge from="res/values/dimens.xml.ftl"
15+
to="${escapeXmlAttribute(resOut)}/values/dimens.xml" />
16+
17+
<!-- Decide what kind of layout(s) to add -->
18+
<instantiate from="res/layout/floatinglabel_layout.xml.ftl"
19+
to="${escapeXmlAttribute(resOut)}/layout/${layoutActivityName}.xml" />
20+
21+
<!-- Decide which activity code to add -->
22+
<instantiate from="src/app_package/SimpleActivity.java.ftl"
23+
to="${escapeXmlAttribute(srcOut)}/${activityClass}.java" />
24+
25+
</#if>
26+
27+
<instantiate from="src/app_package/FloatLabelLayout.java.ftl"
28+
to="${escapeXmlAttribute(srcOut)}/${floatLabelLayoutClass}.java" />
29+
30+
<merge from="res/values/floatinglabel_attrs.xml.ftl"
31+
to="${escapeXmlAttribute(resOut)}/values/floatinglabel_attrs.xml" />
32+
33+
<merge from="res/color/floatinglabel_colors.xml.ftl"
34+
to="${escapeXmlAttribute(resOut)}/color/floatinglabel_colors.xml" />
35+
36+
<merge from="res/values/floatinglabel_styles.xml.ftl"
37+
to="${escapeXmlAttribute(resOut)}/values/floatinglabel_styles.xml" />
38+
39+
</recipe>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" >
2+
3+
<application>
4+
<activity android:name="${packageName}.${activityClass}"
5+
<#if isNewProject>
6+
android:label="@string/app_name"
7+
<#else>
8+
android:label="@string/title_${activityToLayout(activityClass)}"
9+
</#if>>
10+
11+
</activity>
12+
</application>
13+
14+
</manifest>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
dependencies {
2+
<#if dependencyList?? >
3+
<#list dependencyList as dependency>
4+
compile '${dependency}'
5+
</#list>
6+
</#if>
7+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Change this selector to customize your FloatingLabel
3+
4+
Original source: https://gist.github.com/chrisbanes/11247418
5+
Original blog: https://plus.google.com/+ChrisBanes/posts/5Ejaq51UWGo
6+
-->
7+
<selector xmlns:android="http://schemas.android.com/apk/res/android">
8+
9+
<!-- The color when activated/focused (usually your app's accent color) -->
10+
<item android:color="#0099CC" android:state_activated="true" />
11+
12+
<!-- The color when not activated/focused (usually grey) -->
13+
<item android:color="#FF888888" />
14+
15+
</selector>

0 commit comments

Comments
 (0)