/*
* Copyright 2014 Google Inc. All rights reserved.
*
* 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.
*/
package com.google.samples.apps.iosched.util;
import android.annotation.TargetApi;
import android.app.ActivityOptions;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Build;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public class LUtils {
private static Typeface sMediumTypeface;
protected AppCompatActivity mActivity;
private LUtils(AppCompatActivity activity) {
mActivity = activity;
}
public static LUtils getInstance(AppCompatActivity activity) {
return new LUtils(activity);
}
private static boolean hasL() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
}
public void setMediumTypeface(TextView textView) {
if (hasL()) {
if (sMediumTypeface == null) {
sMediumTypeface = Typeface.create("sans-serif-medium", Typeface.NORMAL);
}
textView.setTypeface(sMediumTypeface);
} else {
textView.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);
}
}
}