Skip to content
Browse files

added custom font to login screen and actionbar

  • Loading branch information...
1 parent e163b19 commit 29d1224bdd89d3b36bcd7e721d17edf330b2f1d9 @nitindhar7 committed Dec 13, 2011
View
93 gen/com/kampr/R.java
@@ -98,8 +98,9 @@
}
public static final class id {
public static final int actionbar=0x7f070001;
+ public static final int actionbar_byline=0x7f07002f;
public static final int actionbar_logo=0x7f070002;
- public static final int body=0x7f07002f;
+ public static final int body=0x7f070030;
public static final int code_content=0x7f070012;
public static final int code_date=0x7f070008;
public static final int code_description=0x7f070013;
@@ -133,31 +134,31 @@
public static final int link_user_icon=0x7f070026;
public static final int link_user_name=0x7f070028;
public static final int link_user_top=0x7f070027;
- public static final int login_label_password=0x7f070032;
- public static final int login_label_username=0x7f070030;
- public static final int login_password=0x7f070033;
- public static final int login_submit=0x7f070034;
- public static final int login_username=0x7f070031;
+ public static final int login_label_password=0x7f070033;
+ public static final int login_label_username=0x7f070031;
+ public static final int login_password=0x7f070034;
+ public static final int login_submit=0x7f070035;
+ public static final int login_username=0x7f070032;
public static final int post_comments=0x7f07000f;
public static final int post_comments_count=0x7f07000e;
public static final int post_date=0x7f070022;
- public static final int post_item=0x7f070035;
- public static final int post_item_comments=0x7f070044;
- public static final int post_item_comments_count=0x7f070045;
- public static final int post_item_content=0x7f07003e;
- public static final int post_item_counts=0x7f07003f;
- public static final int post_item_date=0x7f07003c;
- public static final int post_item_details=0x7f070039;
- public static final int post_item_divider=0x7f07003d;
- public static final int post_item_graphics=0x7f070037;
- public static final int post_item_likes=0x7f070042;
- public static final int post_item_likes_count=0x7f070043;
- public static final int post_item_sections=0x7f070036;
- public static final int post_item_title=0x7f07003a;
- public static final int post_item_user_icon=0x7f070038;
- public static final int post_item_username=0x7f07003b;
- public static final int post_item_views=0x7f070040;
- public static final int post_item_views_count=0x7f070041;
+ public static final int post_item=0x7f070036;
+ public static final int post_item_comments=0x7f070045;
+ public static final int post_item_comments_count=0x7f070046;
+ public static final int post_item_content=0x7f07003f;
+ public static final int post_item_counts=0x7f070040;
+ public static final int post_item_date=0x7f07003d;
+ public static final int post_item_details=0x7f07003a;
+ public static final int post_item_divider=0x7f07003e;
+ public static final int post_item_graphics=0x7f070038;
+ public static final int post_item_likes=0x7f070043;
+ public static final int post_item_likes_count=0x7f070044;
+ public static final int post_item_sections=0x7f070037;
+ public static final int post_item_title=0x7f07003b;
+ public static final int post_item_user_icon=0x7f070039;
+ public static final int post_item_username=0x7f07003c;
+ public static final int post_item_views=0x7f070041;
+ public static final int post_item_views_count=0x7f070042;
public static final int post_likes=0x7f07000b;
public static final int post_likes_count=0x7f07000a;
public static final int post_title=0x7f07001e;
@@ -166,30 +167,30 @@
public static final int post_user_name=0x7f070021;
public static final int post_views=0x7f07000d;
public static final int post_views_count=0x7f07000c;
- public static final int posts_menu_logout=0x7f07005c;
- public static final int question=0x7f070046;
- public static final int question_content=0x7f07004f;
- public static final int question_content_scroll=0x7f07004e;
- public static final int question_date=0x7f07004c;
- public static final int question_nav=0x7f07004d;
- public static final int question_title=0x7f070047;
- public static final int question_user=0x7f070048;
- public static final int question_user_icon=0x7f070049;
- public static final int question_user_name=0x7f07004b;
- public static final int question_user_top=0x7f07004a;
+ public static final int posts_menu_logout=0x7f07005d;
+ public static final int question=0x7f070047;
+ public static final int question_content=0x7f070050;
+ public static final int question_content_scroll=0x7f07004f;
+ public static final int question_date=0x7f07004d;
+ public static final int question_nav=0x7f07004e;
+ public static final int question_title=0x7f070048;
+ public static final int question_user=0x7f070049;
+ public static final int question_user_icon=0x7f07004a;
+ public static final int question_user_name=0x7f07004c;
+ public static final int question_user_top=0x7f07004b;
public static final int snap=0x7f070000;
- public static final int snap_date=0x7f070055;
- public static final int snap_description=0x7f07005a;
- public static final int snap_description_scroll=0x7f070057;
- public static final int snap_image=0x7f070058;
- public static final int snap_large_url=0x7f070059;
- public static final int snap_nav=0x7f070056;
- public static final int snap_title=0x7f070050;
- public static final int snap_user=0x7f070051;
- public static final int snap_user_icon=0x7f070052;
- public static final int snap_user_name=0x7f070054;
- public static final int snap_user_top=0x7f070053;
- public static final int webview=0x7f07005b;
+ public static final int snap_date=0x7f070056;
+ public static final int snap_description=0x7f07005b;
+ public static final int snap_description_scroll=0x7f070058;
+ public static final int snap_image=0x7f070059;
+ public static final int snap_large_url=0x7f07005a;
+ public static final int snap_nav=0x7f070057;
+ public static final int snap_title=0x7f070051;
+ public static final int snap_user=0x7f070052;
+ public static final int snap_user_icon=0x7f070053;
+ public static final int snap_user_name=0x7f070055;
+ public static final int snap_user_top=0x7f070054;
+ public static final int webview=0x7f07005c;
}
public static final class layout {
public static final int code=0x7f030000;
View
9 res/layout/main.xml
@@ -29,25 +29,26 @@
android:shadowRadius="1"
android:text="Kampr"
android:textColor="#FFF"
- android:textSize="55sp"
- android:textStyle="bold" />
+ android:textSize="65sp"
+ android:textStyle="bold" android:typeface="normal"/>
<TextView
+ android:id="@+id/actionbar_byline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:minHeight="125dp"
android:paddingLeft="18dp"
- android:paddingTop="80dp"
android:paddingRight="10dp"
+ android:paddingTop="80dp"
android:shadowColor="#333"
android:shadowDx="1"
android:shadowDy="1"
android:shadowRadius="1"
android:text="Forrst Client for Android"
android:textColor="#FFF"
- android:textSize="15sp" />
+ android:textSize="20sp" android:typeface="normal"/>
<!-- <TextView
android:id="@+id/actionbar_settings"
View
22 src/com/kampr/KamprActivity.java
@@ -1,7 +1,5 @@
package com.kampr;
-import com.kampr.util.NetworkUtils;
-
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
@@ -15,15 +13,23 @@
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
+import android.widget.TextView;
import android.widget.Toast;
+import com.kampr.util.LayoutUtils;
+import com.kampr.util.NetworkUtils;
+
public class KamprActivity extends Activity implements OnClickListener, OnKeyListener {
public static final String KAMPR_APP_PREFS = "KamprAppPrefs";
private final int LOGIN_RESULT_CODE = 1;
private final int ENTER_KEY_CODE = 66;
+ private TextView _actionbarLogo;
+ private TextView _actionbarByline;
+ private TextView _loginLabelUsername;
+ private TextView _loginLabelPassword;
private EditText _loginUsername;
private EditText _loginPassword;
private Button _loginSubmit;
@@ -42,13 +48,25 @@ public void onCreate(Bundle savedInstanceState) {
else {
setContentView(R.layout.main);
+ _actionbarLogo = (TextView)findViewById(R.id.actionbar_logo);
+ _actionbarByline = (TextView)findViewById(R.id.actionbar_byline);
+ _loginLabelUsername = (TextView)findViewById(R.id.login_label_username);
+ _loginLabelPassword = (TextView)findViewById(R.id.login_label_password);
_loginUsername = (EditText)findViewById(R.id.login_username);
_loginPassword = (EditText)findViewById(R.id.login_password);
_loginSubmit = (Button)findViewById(R.id.login_submit);
_loginSubmit.setOnClickListener(this);
_loginUsername.setOnKeyListener(this);
_loginPassword.setOnKeyListener(this);
+
+ LayoutUtils.setFont(this, _actionbarLogo, LayoutUtils.FONT_BOLD);
+ LayoutUtils.setFont(this, _actionbarByline);
+ LayoutUtils.setFont(this, _loginSubmit);
+ LayoutUtils.setFont(this, _loginLabelUsername);
+ LayoutUtils.setFont(this, _loginLabelPassword);
+ LayoutUtils.setFont(this, _loginUsername);
+ LayoutUtils.setFont(this, _loginPassword);
}
}
View
2 src/com/kampr/PostsActivity.java
@@ -18,6 +18,7 @@
import com.kampr.tabs.LinksActivity;
import com.kampr.tabs.QuestionsActivity;
import com.kampr.tabs.SnapsActivity;
+import com.kampr.util.LayoutUtils;
public class PostsActivity extends TabActivity {
@@ -55,6 +56,7 @@ public void onCreate(Bundle savedInstanceState) {
_tabHost = getTabHost();
_actionbarLogo = (TextView) findViewById(R.id.actionbar_logo);
+ LayoutUtils.setFont(this, _actionbarLogo, LayoutUtils.FONT_BOLD);
_allTabLayout = new LinearLayout(this);
_allTabLayout.setBackgroundResource(R.drawable.tab_selected);
View
5 src/com/kampr/posts/CommentsActivity.java
@@ -26,6 +26,7 @@
import com.kampr.models.Comment;
import com.kampr.runnables.CommentsRunnable;
import com.kampr.util.ImageUtils;
+import com.kampr.util.LayoutUtils;
import com.kampr.util.NetworkUtils;
public class CommentsActivity extends ListActivity {
@@ -34,6 +35,7 @@
protected static SimpleDateFormat _dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ private TextView _actionbarLogo;
private TextView _postTitleView;
private TextView _postUsernameView;
private TextView _postDateView;
@@ -69,6 +71,7 @@ public void onCreate(Bundle savedInstanceState) {
_postCreatedAt = getIntent().getStringExtra("post_created_at");
_postUserIcon = ImageUtils.getBitmapFromByteArray(getIntent().getByteArrayExtra("post_user_icon"));
+ _actionbarLogo = (TextView) findViewById(R.id.actionbar_logo);
_postTitleView = (TextView) findViewById(R.id.post_title);
_postUsernameView = (TextView) findViewById(R.id.post_user_name);
_postDateView = (TextView) findViewById(R.id.post_date);
@@ -86,6 +89,8 @@ public void onCreate(Bundle savedInstanceState) {
_dialog = ProgressDialog.show(CommentsActivity.this, "", "Loading...", true);
+ LayoutUtils.setFont(this, _actionbarLogo, LayoutUtils.FONT_BOLD);
+
_handler = new CommentsHandler(this, _dialog, _comments, _listOfComments, _userIcons);
_fetchCommentsThread = new Thread(new CommentsRunnable(this, _handler, _listOfComments, _userIcons, _postId));
_fetchCommentsThread.start();
View
5 src/com/kampr/posts/PostActivity.java
@@ -23,6 +23,7 @@
import com.kampr.LogoutActivity;
import com.kampr.R;
import com.kampr.models.PropertyContainer;
+import com.kampr.util.LayoutUtils;
public class PostActivity extends Activity implements OnClickListener {
@@ -43,16 +44,20 @@
protected TextView _postViewsCount;
protected TextView _postCommentsCount;
protected TextView _postComments;
+ protected TextView _actionbarLogo;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ _actionbarLogo = (TextView) findViewById(R.id.actionbar_logo);
_postComments = (TextView) findViewById(R.id.post_comments);
_postLikesCount = (TextView) findViewById(R.id.post_likes_count);
_postViewsCount = (TextView) findViewById(R.id.post_views_count);
_postCommentsCount = (TextView) findViewById(R.id.post_comments_count);
_postCommentsCount.setOnClickListener(this);
_postComments.setOnClickListener(this);
+
+ LayoutUtils.setFont(this, _actionbarLogo, LayoutUtils.FONT_BOLD);
_post = (PropertyContainer) getIntent().getSerializableExtra("post");
}
View
49 src/com/kampr/util/LayoutUtils.java
@@ -1,10 +1,17 @@
package com.kampr.util;
+import android.content.Context;
+import android.graphics.Typeface;
import android.text.Spannable;
import android.text.TextPaint;
import android.text.style.URLSpan;
+import android.widget.Button;
+import android.widget.TextView;
public class LayoutUtils extends URLSpan {
+
+ public static final String FONT_REGULAR = "qlassik_regular.ttf";
+ public static final String FONT_BOLD = "qlassik_bold.ttf";
public LayoutUtils(String url) {
super(url);
@@ -32,5 +39,47 @@ public static void removeUnderlines(Spannable text) {
text.setSpan(span, start, end, 0);
}
}
+
+ /**
+ * Set the font on a textview using the regular font as default
+ * @param context
+ * @param textview
+ */
+ public static void setFont(Context context, TextView textview) {
+ Typeface font = Typeface.createFromAsset(context.getAssets(), FONT_REGULAR);
+ textview.setTypeface(font);
+ }
+
+ /**
+ * Set the font on a textview
+ * @param context
+ * @param button
+ * @param asset name of the font to use
+ */
+ public static void setFont(Context context, TextView textview, String asset) {
+ Typeface font = Typeface.createFromAsset(context.getAssets(), asset);
+ textview.setTypeface(font);
+ }
+
+ /**
+ * Set the font on a textview using the regular font as default
+ * @param context
+ * @param button
+ */
+ public static void setFont(Context context, Button button) {
+ Typeface font = Typeface.createFromAsset(context.getAssets(), FONT_REGULAR);
+ button.setTypeface(font);
+ }
+
+ /**
+ * Set the font on a button
+ * @param context
+ * @param button
+ * @param asset name of the font to use
+ */
+ public static void setFont(Context context, Button button, String asset) {
+ Typeface font = Typeface.createFromAsset(context.getAssets(), asset);
+ button.setTypeface(font);
+ }
}

0 comments on commit 29d1224

Please sign in to comment.
Something went wrong with that request. Please try again.