Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a FloatingLabel template based on [Chris Banes code](https://gist.github.com/chrisbanes/11247418)
- Loading branch information
1 parent
8736a27
commit 52f9ffa
Showing
19 changed files
with
519 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Change Log | ||
=============================================================================== | ||
|
||
Version 1.1 *(2014-04-30)* | ||
---------------------------- | ||
* Added: `FloatingLabelLayout` [template](https://github.com/gabrielemariotti/AndroidStudioTemplate/tree/master/templates/custom/FloatingLabel) | ||
|
||
|
||
Version 1.0 | ||
---------------------------- | ||
* Initial release with SwipeRefreshLayout and Array Adapter templates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0"?> | ||
<globals> | ||
<global id="manifestOut" value="${manifestDir}" /> | ||
<global id="appCompat" value="${(minApiLevel lt 14)?string('1','')}" /> | ||
<!-- e.g. getSupportActionBar vs. getActionBar --> | ||
<global id="Support" value="${(minApiLevel lt 14)?string('Support','')}" /> | ||
<global id="srcOut" value="${srcDir}/${slashedPackageName(packageName)}" /> | ||
<global id="resOut" value="${resDir}" /> | ||
</globals> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?xml version="1.0"?> | ||
<recipe> | ||
|
||
<#if appCompat?has_content><dependency mavenUrl="com.android.support:appcompat-v7:19.+"/></#if> | ||
<dependency mavenUrl="com.android.support:support-v4:19.+"/> | ||
|
||
<#if isActivityAdded> | ||
<merge from="AndroidManifest.xml.ftl" | ||
to="${escapeXmlAttribute(manifestOut)}/AndroidManifest.xml" /> | ||
|
||
<merge from="res/values/floatinglabel_strings.xml.ftl" | ||
to="${escapeXmlAttribute(resOut)}/values/floatinglabel_strings.xml" /> | ||
|
||
<merge from="res/values/dimens.xml.ftl" | ||
to="${escapeXmlAttribute(resOut)}/values/dimens.xml" /> | ||
|
||
<!-- Decide what kind of layout(s) to add --> | ||
<instantiate from="res/layout/floatinglabel_layout.xml.ftl" | ||
to="${escapeXmlAttribute(resOut)}/layout/${layoutActivityName}.xml" /> | ||
|
||
<!-- Decide which activity code to add --> | ||
<instantiate from="src/app_package/SimpleActivity.java.ftl" | ||
to="${escapeXmlAttribute(srcOut)}/${activityClass}.java" /> | ||
|
||
</#if> | ||
|
||
<instantiate from="src/app_package/FloatLabelLayout.java.ftl" | ||
to="${escapeXmlAttribute(srcOut)}/${floatLabelLayoutClass}.java" /> | ||
|
||
<merge from="res/values/floatinglabel_attrs.xml.ftl" | ||
to="${escapeXmlAttribute(resOut)}/values/floatinglabel_attrs.xml" /> | ||
|
||
<merge from="res/color/floatinglabel_colors.xml.ftl" | ||
to="${escapeXmlAttribute(resOut)}/color/floatinglabel_colors.xml" /> | ||
|
||
<merge from="res/values/floatinglabel_styles.xml.ftl" | ||
to="${escapeXmlAttribute(resOut)}/values/floatinglabel_styles.xml" /> | ||
|
||
</recipe> |
14 changes: 14 additions & 0 deletions
14
templates/custom/FloatingLabel/root/AndroidManifest.xml.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" > | ||
|
||
<application> | ||
<activity android:name="${packageName}.${activityClass}" | ||
<#if isNewProject> | ||
android:label="@string/app_name" | ||
<#else> | ||
android:label="@string/title_${activityToLayout(activityClass)}" | ||
</#if>> | ||
|
||
</activity> | ||
</application> | ||
|
||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
dependencies { | ||
<#if dependencyList?? > | ||
<#list dependencyList as dependency> | ||
compile '${dependency}' | ||
</#list> | ||
</#if> | ||
} |
15 changes: 15 additions & 0 deletions
15
templates/custom/FloatingLabel/root/res/color/floatinglabel_colors.xml.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Change this selector to customize your FloatingLabel | ||
Original source: https://gist.github.com/chrisbanes/11247418 | ||
Original blog: https://plus.google.com/+ChrisBanes/posts/5Ejaq51UWGo | ||
--> | ||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<!-- The color when activated/focused (usually your app's accent color) --> | ||
<item android:color="#0099CC" android:state_activated="true" /> | ||
|
||
<!-- The color when not activated/focused (usually grey) --> | ||
<item android:color="#FF888888" /> | ||
|
||
</selector> |
44 changes: 44 additions & 0 deletions
44
templates/custom/FloatingLabel/root/res/layout/floatinglabel_layout.xml.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:orientation="vertical" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<${packageName}.${floatLabelLayoutClass} | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
app:floatLabelTextAppearance="@style/TextAppearance.YourApp.FloatLabel"> | ||
|
||
<EditText | ||
android:id="@+id/edit_username" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:hint="@string/account_username_hint" | ||
android:singleLine="true" | ||
android:inputType="textNoSuggestions" | ||
android:imeOptions="actionNext" | ||
android:nextFocusDown="@+id/edit_password" /> | ||
|
||
</${packageName}.${floatLabelLayoutClass}> | ||
|
||
<${packageName}.${floatLabelLayoutClass} | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
app:floatLabelTextAppearance="@style/TextAppearance.YourApp.FloatLabel"> | ||
|
||
<EditText | ||
android:id="@+id/edit_password" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:hint="@string/account_password_hint" | ||
android:singleLine="true" | ||
android:inputType="textNoSuggestions" | ||
android:imeOptions="actionDone" /> | ||
|
||
</${packageName}.${floatLabelLayoutClass}> | ||
|
||
</LinearLayout> |
7 changes: 7 additions & 0 deletions
7
templates/custom/FloatingLabel/root/res/values/dimens.xml.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<resources> | ||
<!-- Default screen margins, per the Android Design guidelines. --> | ||
<dimen name="activity_horizontal_margin">16dp</dimen> | ||
<dimen name="activity_vertical_margin">16dp</dimen> | ||
|
||
|
||
</resources> |
27 changes: 27 additions & 0 deletions
27
templates/custom/FloatingLabel/root/res/values/floatinglabel_attrs.xml.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
Original source: https://gist.github.com/chrisbanes/11247418 | ||
Original blog: https://plus.google.com/+ChrisBanes/posts/5Ejaq51UWGo | ||
Copyright (C) 2014 Chris Banes | ||
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. | ||
--> | ||
<resources> | ||
|
||
<declare-styleable name="FloatLabelLayout"> | ||
<attr name="floatLabelTextAppearance" format="reference" /> | ||
<attr name="floatLabelSidePadding" format="reference|dimension" /> | ||
</declare-styleable> | ||
|
||
</resources> |
11 changes: 11 additions & 0 deletions
11
templates/custom/FloatingLabel/root/res/values/floatinglabel_strings.xml.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<resources> | ||
<#if !isNewProject> | ||
<string name="title_${activityToLayout(activityClass)}">${escapeXmlString(activityTitle)}</string> | ||
</#if> | ||
|
||
<!-- Custom strings for floating label example --> | ||
<string name="account_username_hint">Username</string> | ||
<string name="account_password_hint">Password</string> | ||
|
||
|
||
</resources> |
14 changes: 14 additions & 0 deletions
14
templates/custom/FloatingLabel/root/res/values/floatinglabel_styles.xml.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
|
||
<!-- Change this style to customize your FloatingLabel | ||
Original source: https://gist.github.com/chrisbanes/11247418 | ||
Original blog: https://plus.google.com/+ChrisBanes/posts/5Ejaq51UWGo | ||
--> | ||
<style name="TextAppearance.YourApp.FloatLabel" parent="android:TextAppearance.Small"> | ||
<item name="android:textColor">@color/floatinglabel_colors</item> | ||
<item name="android:textSize">11sp</item> | ||
<item name="android:textStyle">bold</item> | ||
</style> | ||
</resources> |
Oops, something went wrong.