Skip to content

Commit 8c88113

Browse files
committed
Added animated EditText background drawable.
1 parent 45d6ce4 commit 8c88113

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+772
-392
lines changed

app/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 20
5+
buildToolsVersion "20.0.0"
6+
7+
defaultConfig {
8+
applicationId "ext.app"
9+
minSdkVersion 16
10+
targetSdkVersion 20
11+
versionCode 1
12+
versionName "1.0"
13+
}
14+
15+
compileOptions {
16+
sourceCompatibility JavaVersion.VERSION_1_7
17+
targetCompatibility JavaVersion.VERSION_1_7
18+
}
19+
buildTypes {
20+
release {
21+
runProguard false
22+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
23+
}
24+
}
25+
}
26+
27+
dependencies {
28+
compile fileTree(dir: 'libs', include: ['*.jar'])
29+
compile project(':lib')
30+
}

app/proguard-rules.pro

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in /Users/evelina/android/sdk/tools/proguard/proguard-android.txt
4+
# You can edit the include path and order by changing the proguardFiles
5+
# directive in build.gradle.
6+
#
7+
# For more details, see
8+
# http://developer.android.com/guide/developing/tools/proguard.html
9+
10+
# Add any project specific keep options here:
11+
12+
# If your project uses WebView with JS, uncomment the following
13+
# and specify the fully qualified class name to the JavaScript interface
14+
# class:
15+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16+
# public *;
17+
#}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package ext.sample;
2+
3+
import android.app.Application;
4+
import android.test.ApplicationTestCase;
5+
6+
/**
7+
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
8+
*/
9+
public class ApplicationTest extends ApplicationTestCase<Application> {
10+
public ApplicationTest() {
11+
super(Application.class);
12+
}
13+
}

app/src/main/AndroidManifest.xml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="ext.sample">
4+
5+
<application
6+
android:name=".App"
7+
android:allowBackup="true"
8+
android:icon="@drawable/ic_launcher"
9+
android:label="@string/app_name"
10+
android:theme="@style/AppTheme">
11+
<activity
12+
android:name="ext.sample.HomeActivity"
13+
android:label="@string/app_name">
14+
<intent-filter>
15+
<action android:name="android.intent.action.MAIN"/>
16+
17+
<category android:name="android.intent.category.LAUNCHER"/>
18+
</intent-filter>
19+
</activity>
20+
</application>
21+
22+
</manifest>

app/src/main/assets/fonts/Lobster.ttf

138 KB
Binary file not shown.
125 KB
Binary file not shown.
129 KB
Binary file not shown.
127 KB
Binary file not shown.

app/src/main/java/ext/sample/App.java

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package ext.sample;
2+
3+
import android.app.Application;
4+
5+
import ext.extensions.typeface.FontManager;
6+
7+
/**
8+
* Created by evelina on 15/09/14.
9+
*/
10+
public class App extends Application {
11+
12+
@Override
13+
public void onCreate() {
14+
super.onCreate();
15+
FontManager.getInstance().addFontExtractor(CustomFonts.getInstance());
16+
}
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package ext.sample;
2+
3+
import java.util.ArrayList;
4+
import java.util.Arrays;
5+
6+
import ext.extensions.typeface.Font;
7+
import ext.extensions.typeface.FontExtractor;
8+
9+
/**
10+
* Created by evelina on 15/09/14.
11+
*/
12+
public class CustomFonts extends FontExtractor {
13+
14+
private static final CustomFonts INSTANCE = new CustomFonts();
15+
16+
public static CustomFonts getInstance() {
17+
return INSTANCE;
18+
}
19+
20+
@Override
21+
public Font[] getFonts() {
22+
ArrayList<Font> fonts = new ArrayList<Font>() {{
23+
addAll(Arrays.asList(RalewayFont.values()));
24+
addAll(Arrays.asList(LobsterFont.values()));
25+
}};
26+
return fonts.toArray(new Font[fonts.size()]);
27+
}
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package ext.sample;
2+
3+
import android.app.Activity;
4+
import android.os.Bundle;
5+
import android.view.Menu;
6+
import android.view.MenuItem;
7+
8+
9+
public class HomeActivity extends Activity {
10+
11+
@Override
12+
protected void onCreate(Bundle savedInstanceState) {
13+
super.onCreate(savedInstanceState);
14+
setContentView(R.layout.activity_home);
15+
}
16+
17+
18+
@Override
19+
public boolean onCreateOptionsMenu(Menu menu) {
20+
// Inflate the menu; this adds items to the action bar if it is present.
21+
getMenuInflater().inflate(R.menu.home, menu);
22+
return true;
23+
}
24+
25+
@Override
26+
public boolean onOptionsItemSelected(MenuItem item) {
27+
// Handle action bar item clicks here. The action bar will
28+
// automatically handle clicks on the Home/Up button, so long
29+
// as you specify a parent activity in AndroidManifest.xml.
30+
int id = item.getItemId();
31+
if (id == R.id.action_settings) {
32+
return true;
33+
}
34+
return super.onOptionsItemSelected(item);
35+
}
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package ext.sample;
2+
3+
import ext.extensions.typeface.Font;
4+
5+
/**
6+
* Created by evelina on 15/09/14.
7+
*/
8+
public enum LobsterFont implements Font {
9+
LOBSTER_NORMAL("fonts/Lobster.ttf");
10+
11+
private String mName;
12+
13+
LobsterFont(String name) {
14+
mName = name;
15+
}
16+
17+
@Override
18+
public String getName() {
19+
return mName;
20+
}
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package ext.sample;
2+
3+
import ext.extensions.typeface.Font;
4+
5+
/**
6+
* Created by evelina on 15/09/14.
7+
*/
8+
public enum RalewayFont implements Font {
9+
RALEWAY_BOLD("fonts/Raleway-Bold.ttf"),
10+
RALEWAY_NORMAL("fonts/Raleway-Regular.ttf"),
11+
RALEWAY_LIGHT("fonts/Raleway-Light.ttf");
12+
13+
private String mName;
14+
15+
RalewayFont(String name) {
16+
mName = name;
17+
}
18+
19+
@Override
20+
public String getName() {
21+
return mName;
22+
}
23+
}
9.18 KB
Loading
5.11 KB
Loading
Loading
18.9 KB
Loading
+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:orientation="vertical"
4+
android:layout_width="match_parent"
5+
android:layout_height="match_parent"
6+
android:paddingLeft="@dimen/activity_horizontal_margin"
7+
android:paddingRight="@dimen/activity_horizontal_margin"
8+
android:paddingTop="@dimen/activity_vertical_margin"
9+
android:paddingBottom="@dimen/activity_vertical_margin"
10+
tools:context=".HomeActivity">
11+
12+
13+
<ext.TextView
14+
android:layout_width="wrap_content"
15+
android:layout_height="wrap_content"
16+
android:layout_marginTop="16dp"
17+
android:text="Title Text"
18+
style="@style/TextViewStyle.Title"/>
19+
20+
<ext.TextView
21+
android:layout_width="wrap_content"
22+
android:layout_height="wrap_content"
23+
android:layout_marginTop="8dp"
24+
android:text="Normal text"/>
25+
26+
<ext.Button
27+
android:layout_width="wrap_content"
28+
android:layout_height="wrap_content"
29+
android:layout_marginTop="16dp"
30+
android:text="Beautiful Button"/>
31+
32+
<ext.EditText
33+
android:layout_width="match_parent"
34+
android:layout_height="wrap_content"
35+
android:layout_marginTop="20dp"
36+
android:hint="First input"/>
37+
38+
<ext.EditText
39+
android:layout_width="match_parent"
40+
android:layout_height="wrap_content"
41+
android:layout_marginTop="20dp"
42+
android:hint="Second input"/>
43+
44+
</LinearLayout>

app/src/main/res/menu/home.xml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<menu xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
tools:context=".HomeActivity" >
4+
<item android:id="@+id/action_settings"
5+
android:title="@string/action_settings"
6+
android:orderInCategory="100"
7+
android:showAsAction="never" />
8+
</menu>

app/src/main/res/values/dimens.xml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<resources>
2+
<!-- Default screen margins, per the Android Design guidelines. -->
3+
<dimen name="activity_horizontal_margin">16dp</dimen>
4+
<dimen name="activity_vertical_margin">16dp</dimen>
5+
</resources>

app/src/main/res/values/strings.xml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
4+
<string name="app_name">Ext Sample</string>
5+
<string name="hello_world">Hello world!</string>
6+
<string name="action_settings">Settings</string>
7+
8+
</resources>

app/src/main/res/values/styles.xml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<resources>
2+
3+
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
4+
<item name="colorPrimary">#9c0</item>
5+
<item name="colorPrimaryDark">#690</item>
6+
7+
<item name="android:textViewStyle">@style/TextViewStyle</item>
8+
<item name="android:editTextStyle">@style/EditTextStyle</item>
9+
<item name="android:buttonStyle">@style/ButtonStyle</item>
10+
</style>
11+
12+
<style name="TextAppearance">
13+
<item name="android:textSize">18sp</item>
14+
<item name="android:textColor">#333</item>
15+
<item name="android:fontFamily">fonts/Raleway-Regular.ttf</item>
16+
</style>
17+
18+
<style name="TextAppearance.Title">
19+
<item name="android:textSize">24sp</item>
20+
<item name="android:textColor">#555</item>
21+
<item name="android:fontFamily">fonts/Lobster.ttf</item>
22+
</style>
23+
24+
<style name="TextAppearance.Button">
25+
<item name="android:fontFamily">fonts/Raleway-Bold.ttf</item>
26+
</style>
27+
28+
<style name="TextViewStyle" parent="android:Widget.Holo.Light.TextView">
29+
<item name="extensions">font</item>
30+
<item name="android:textAppearance">@style/TextAppearance</item>
31+
</style>
32+
33+
<style name="TextViewStyle.Title">
34+
<item name="extensions">font|border</item>
35+
<item name="borderWidth">6dp</item>
36+
<item name="borderPosition">bottom</item>
37+
<item name="android:textAppearance">@style/TextAppearance.Title</item>
38+
</style>
39+
40+
<style name="ButtonStyle" parent="android:Widget.Holo.Light.Button">
41+
<item name="extensions">font|pushButton</item>
42+
<item name="pushDepth">4dp</item>
43+
<item name="pushCornerRadius">4dp</item>
44+
<item name="android:textAppearance">@style/TextAppearance.Button</item>
45+
<item name="android:textColor">@null</item>
46+
<item name="android:minWidth">200dp</item>
47+
<item name="android:minHeight">48dp</item>
48+
</style>
49+
50+
<style name="EditTextStyle" parent="android:Widget.Holo.EditText">
51+
<item name="extensions">font|animatedBackground</item>
52+
<item name="backgroundStrokeWidth">2dp</item>
53+
<item name="animatedBackgroundDrawable">ext.drawable.AnimatedEditTextBackgroundDrawable
54+
</item>
55+
<item name="animateFromCenter">true</item>
56+
<item name="android:textAppearance">@style/TextAppearance</item>
57+
<item name="android:background">@null</item>
58+
</style>
59+
60+
</resources>

build.gradle

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ buildscript {
66
}
77
dependencies {
88
classpath 'com.android.tools.build:gradle:0.12.2'
9-
10-
// NOTE: Do not place your application dependencies here; they belong
11-
// in the individual module build.gradle files
129
}
1310
}
1411

1512
allprojects {
1613
repositories {
14+
mavenLocal()
15+
mavenCentral()
1716
jcenter()
1817
}
1918
}

gradle.properties

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1818
# org.gradle.parallel=true
1919

20-
RELEASE_REPOSITORY_URL=http://nexus.int.lbi.co.uk/nexus/content/repositories/releases
21-
SNAPSHOT_REPOSITORY_URL=http://nexus.int.lbi.co.uk/nexus/content/repositories/snapshots
20+
RELEASE_REPOSITORY_URL=todo
21+
SNAPSHOT_REPOSITORY_URL=todo
2222

2323
GROUP=android.ext
2424
VERSION_NAME=1.0.0
2525

26-
POM_ARTIFACT_ID=android-widgets-ext
2726
POM_PACKAGING=aar
27+
POM_ARTIFACT_ID=android-widgets-ext
2828
POM_NAME=Android Widgets Extension Library
2929
POM_DESCRIPTION=A collection of reusable custom views
3030

0 commit comments

Comments
 (0)