Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/**
 * Appcelerator Titanium Mobile
 * Copyright (c) 2009-2012 by Appcelerator, Inc. All Rights Reserved.
 * Licensed under the terms of the Apache Public License
 * Please see the LICENSE included with this distribution for details.
 */

import android.graphics.Typeface;

public class Main {
    public static int toTypefaceStyle(String fontWeight, String fontStyle) {
        int style = Typeface.NORMAL;

        if (fontWeight != null) {
            if (fontWeight.equals("bold")) {
                if (fontStyle != null && fontStyle.equals("italic")) {
                    style = Typeface.BOLD_ITALIC;
                } else {
                    style = Typeface.BOLD;
                }
            } else if (fontStyle != null && fontStyle.equals("italic")) {
                style = Typeface.ITALIC;
            }
        } else if (fontStyle != null && fontStyle.equals("italic")) {
            style = Typeface.ITALIC;
        }
        return style;
    }
}