Skip to content

Commit 1d51618

Browse files
author
javatechig
committed
Added Custom Sample
1 parent 6d52534 commit 1d51618

File tree

16 files changed

+179
-0
lines changed

16 files changed

+179
-0
lines changed

AndroidCustomFont/AndroidManifest.xml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.javatechig.droid.ui"
4+
android:versionCode="1"
5+
android:versionName="1.0" >
6+
7+
<uses-sdk
8+
android:minSdkVersion="8"
9+
android:targetSdkVersion="8" />
10+
11+
<application
12+
android:allowBackup="true"
13+
android:icon="@drawable/ic_launcher"
14+
android:label="@string/app_name"
15+
android:theme="@style/AppTheme" >
16+
<activity
17+
android:name="com.javatechig.droid.ui.MainActivity"
18+
android:label="@string/app_name" >
19+
<intent-filter>
20+
<action android:name="android.intent.action.MAIN" />
21+
22+
<category android:name="android.intent.category.LAUNCHER" />
23+
</intent-filter>
24+
</activity>
25+
</application>
26+
27+
</manifest>
87.1 KB
Binary file not shown.

AndroidCustomFont/ic_launcher-web.png

50.2 KB
Loading
377 KB
Binary file not shown.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# To enable ProGuard in your project, edit project.properties
2+
# to define the proguard.config property as described in that file.
3+
#
4+
# Add project specific ProGuard rules here.
5+
# By default, the flags in this file are appended to flags specified
6+
# in ${sdk.dir}/tools/proguard/proguard-android.txt
7+
# You can edit the include path and order by changing the ProGuard
8+
# include property in project.properties.
9+
#
10+
# For more details, see
11+
# http://developer.android.com/guide/developing/tools/proguard.html
12+
13+
# Add any project specific keep options here:
14+
15+
# If your project uses WebView with JS, uncomment the following
16+
# and specify the fully qualified class name to the JavaScript interface
17+
# class:
18+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19+
# public *;
20+
#}

AndroidCustomFont/project.properties

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# This file is automatically generated by Android Tools.
2+
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3+
#
4+
# This file must be checked in Version Control Systems.
5+
#
6+
# To customize properties used by the Ant build system edit
7+
# "ant.properties", and override values to adapt the script to your
8+
# project structure.
9+
#
10+
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11+
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12+
13+
# Project target.
14+
target=android-8
Loading
Loading
Loading
Loading
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:orientation="vertical"
6+
tools:context=".MainActivity"
7+
android:background="#0F0F0F">
8+
9+
<com.javatechig.droid.ui.CustomTextView
10+
android:layout_width="wrap_content"
11+
android:layout_height="wrap_content"
12+
android:text="@string/font_sample_text"
13+
android:textSize="18dp"
14+
android:textColor="#AAD4DE" />
15+
16+
<com.javatechig.droid.ui.CustomTextView
17+
android:layout_width="wrap_content"
18+
android:layout_height="wrap_content"
19+
android:text="@string/font_sample_text"
20+
android:textColor="#FFDE46"
21+
android:textSize="24dp"/>
22+
23+
<com.javatechig.droid.ui.CustomTextView
24+
android:layout_width="wrap_content"
25+
android:layout_height="wrap_content"
26+
android:text="@string/font_sample_text"
27+
android:textSize="30dp"
28+
android:textColor="#7FBA00"/>
29+
30+
</LinearLayout>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
2+
3+
<item
4+
android:id="@+id/menu_settings"
5+
android:orderInCategory="100"
6+
android:title="@string/menu_settings"/>
7+
8+
</menu>
Lines changed: 8 additions & 0 deletions
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">AndroidCustomFont</string>
5+
<string name="menu_settings">Settings</string>
6+
<string name="hello_world">Hello world!</string>
7+
<string name="font_sample_text">The quick brown fox jumps over the lazy dog.</string>
8+
</resources>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<resources>
2+
3+
<!--
4+
Base application theme, dependent on API level. This theme is replaced
5+
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
6+
-->
7+
<style name="AppBaseTheme" parent="android:Theme.Light">
8+
<!--
9+
Theme customizations available in newer API levels can go in
10+
res/values-vXX/styles.xml, while customizations related to
11+
backward-compatibility can go here.
12+
-->
13+
</style>
14+
15+
<!-- Application theme. -->
16+
<style name="AppTheme" parent="AppBaseTheme">
17+
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
18+
</style>
19+
20+
</resources>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.javatechig.droid.ui;
2+
3+
import android.content.Context;
4+
import android.graphics.Typeface;
5+
import android.util.AttributeSet;
6+
import android.widget.TextView;
7+
8+
public class CustomTextView extends TextView {
9+
10+
public CustomTextView(Context context) {
11+
super(context);
12+
setFont();
13+
}
14+
15+
public CustomTextView(Context context, AttributeSet attrs) {
16+
super(context, attrs);
17+
setFont();
18+
}
19+
20+
public CustomTextView(Context context, AttributeSet attrs, int defStyle) {
21+
super(context, attrs, defStyle);
22+
setFont();
23+
}
24+
25+
private void setFont() {
26+
Typeface font = Typeface.createFromAsset(getContext().getAssets(),
27+
"fonts/Maximum.ttf");
28+
setTypeface(font, Typeface.NORMAL);
29+
}
30+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.javatechig.droid.ui;
2+
3+
import android.os.Bundle;
4+
import android.app.Activity;
5+
import android.view.Menu;
6+
7+
public class MainActivity extends Activity {
8+
9+
@Override
10+
protected void onCreate(Bundle savedInstanceState) {
11+
super.onCreate(savedInstanceState);
12+
setContentView(R.layout.activity_main);
13+
}
14+
15+
@Override
16+
public boolean onCreateOptionsMenu(Menu menu) {
17+
// Inflate the menu; this adds items to the action bar if it is present.
18+
getMenuInflater().inflate(R.menu.activity_main, menu);
19+
return true;
20+
}
21+
22+
}

0 commit comments

Comments
 (0)