Created
January 14, 2015 23:57
-
-
Save cbedoy/979a4773377687f51c4d to your computer and use it in GitHub Desktop.
Service To Set Support Font To all text view on deferents font settings - Avoid alter viewcontrollers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.res.Configuration; | |
import android.util.TypedValue; | |
import android.widget.TextView; | |
import org.pademobile.application.ApplicationLoader; | |
/** | |
* Created by Carlos Bedoy on 1/14/15. | |
* <p/> | |
* Mobile App Developer - Bills Android | |
* <p/> | |
* Pademobile | |
*/ | |
public class FontSupportedService | |
{ | |
private static Configuration mConfiguration; | |
private static float mFontScale; | |
//LEFT MENU | |
public static float LEFT_MENU_SIZE = 20; | |
public static float LEFT_MENU_DIVIDER = 16; | |
//LOGIN VIEWCONTROLLER | |
public static float LOGIN_VIEW_CONTROLLER_BUTTON = 20; | |
public static float LOGIN_VIEW_CONTROLLER_FIELDS = 18; | |
public static float LOGIN_VIEW_CONTROLLER_NAME_SERVICE = 14; | |
public static float LOGIN_VIEW_CONTROLLER_AMOUNT = 32; | |
public static float LOGIN_VIEW_CONTROLLER_CURRENCY = 14; | |
public static float LOGIN_VIEW_CONTROLLER_OR_TEXT = 14; | |
//SIGN UP VIEW CONTROLLER + KEYBOARD | |
public static float KEYBOARD_VIEW_BUTTON = 32; | |
public static float SIGN_UP_SMALL_TEXT = 14; | |
public static float SIGN_UP_RESEND_CODE = 18; | |
public static float SIGN_UP_FIELDS = 20; | |
public static float SIGN_UP_TITLES = 30; | |
//WALLET SELECTOR | |
public static float WALLET_SELECTOR_TITLE = 24; | |
public static float WALLET_SELECTOR_MESSAGE = 16; | |
public static float WALLET_SELECTOR_TEXT_CELL = 16; | |
public static float WALLET_SELECTOR_DIALOG_TITLE = 20; | |
public static float WALLET_SELECTOR_DIALOG_MESSAGE = 16; | |
//DETAIL SERVICE VIEW CONTROLLER | |
public static float DETAIL_SERVICE_AMOUNT_VIEW_TEXT = 20; | |
public static float DETAIL_SERVICE_PAY_SERVICE_TEXT = 20; | |
public static float DETAIL_SERVICE_NAME_SERVICE = 16; | |
public static float DETAIL_SERVICE_TITLE = 16; | |
public static float DETAIL_SERVICE_MESSAGE = 18; | |
//NOTIFICATION MESSAGES | |
public static float NOTIFICATION_MESSAGES_TITLE = 16; | |
public static float NOTIFICATION_MESSAGES_MESSAGE = 16; | |
public static float NOTIFICATION_MESSAGES_BUTTONS = 16; | |
public static float NOTIFICATION_MESSAGES_LOADER_TEXT = 18; | |
//PAYMENT SELECTOR | |
public static float PAYMENT_SELECTOR_BUTTONS = 20; | |
public static float PAYMENT_SELECTOR_FEE_VALUE = 14; | |
//PAYMENT ORIGINS NORMAL FLOW | |
public static float PAYMENT_ORIGINS_CELL_AMOUNT = 18; | |
public static float PAYMENT_ORIGINS_CELL_NAME = 14; | |
public static float PAYMENT_ORIGINS_TITLE = 18; | |
public static float PAYMENT_ORIGINS_NAME_SERVICE = 14; | |
public static float PAYMENT_ORIGINS_AMOUNT = 32; | |
public static float PAYMENT_ORIGINS_CURRENCY = 14; | |
public static float PAYMENT_ORIGINS_BUTTONS = 20; | |
//COUNTRY SELECTOR | |
public static float COUNTRY_SELECTOR_ACTION_BAR = 20; | |
public static float COUNTRY_SELECTOR_DIVIDER = 24; | |
public static float COUNTRY_SELECTOR_COUNTRY = 18; | |
public static float COUNTRY_SELECTOR_SEARCH = 18; | |
// | |
public static void init() | |
{ | |
mConfiguration = ApplicationLoader.mainContext.getResources().getConfiguration(); | |
mFontScale = mConfiguration.fontScale; | |
} | |
public static void supportTextViewWithFontSize(TextView textView, float fontSize) | |
{ | |
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize / mFontScale); | |
} | |
public static void doInit(){ | |
mConfiguration = null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment