public Button(Context context, AttributeSet attrs) { super(context, attrs); // return early for eclipse preview mode if (isInEditMode()) return; FontManager.getInstance().setFont(this, attrs); }
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); requestURL = getActivity().getResources().getString(R.string.serverURL) + "api/user/registerByFacebook"; ((Authentication) getActivity()).SetToolBarTitle("YOUR ACCOUNT"); txtBlurb = (TextView) getActivity().findViewById(R.id.yourAccountBlurb); txtBlurb.setTypeface(FontManager.setFont(getActivity(), FontManager.Font.MontSerratRegular)); btnSignUp = (Button) getActivity().findViewById(R.id.btnSignUp); btnSignUp.setTypeface(FontManager.setFont(getActivity(), FontManager.Font.OpenSansSemiBold)); txtLogin = (TextView) getActivity().findViewById(R.id.txtLogin); txtLogin.setTypeface(FontManager.setFont(getActivity(), FontManager.Font.OpenSansSemiBold)); txtLogin.setPaintFlags(txtLogin.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); btnSignUp.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Fragment signup = new SignUp(); FragmentTransaction signUpTransaction = getActivity().getSupportFragmentManager().beginTransaction(); signUpTransaction.replace(R.id.fragmentReplacer, signup); signUpTransaction.addToBackStack(null); signUpTransaction.commit(); } }); txtLogin.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Fragment login = new Login(); FragmentTransaction loginTransaction = getFragmentManager().beginTransaction(); loginTransaction.replace(R.id.fragmentReplacer, login); loginTransaction.addToBackStack(null); loginTransaction.commit(); } }); }
/** * Draws the menu to the screen. * * @param gameState the current state of the application * @param spriteBatch graphics context to draw to */ public void draw(GameScreen.GameState gameState, SpriteBatch spriteBatch) { for (ButtonBall option : mMenuOptionBalls) option.draw(spriteBatch, mTextureManager); FontManager.getDefaultFont() .draw( spriteBatch, "Tap to begin", GameScreen.getScreenWidth() / 2, GameScreen.getScreenHeight() / 2); }
public void prepareEmbeddingFont(String fontfamily, int fontSize) { flushAllUnusedFonts(); if (isFontLoaded(fontfamily, fontSize)) { return; } FontManager fontManager = facade.retrieveProxy(FontManager.NAME); FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter(); parameter.size = fontSize; FreeTypeFontGenerator generator = new FreeTypeFontGenerator(fontManager.getTTFByName(fontfamily)); BitmapFont font = generator.generateFont(parameter); addBitmapFont(fontfamily, parameter.size, font); }
FontStrike createStrike(FontStrikeDesc desc) { if (isBitmapDelegate) { return new NativeStrike(this, desc); } else { if (delegateFont == null) { delegateFont = FontManager.getDefaultPhysicalFont(); } FontStrike delegate = delegateFont.createStrike(desc); return new DelegateStrike(this, desc, delegate); } }
public FileHandle getTTFSafely(String fontName) throws IOException { FontManager fontManager = facade.retrieveProxy(FontManager.NAME); ProjectManager projectManager = facade.retrieveProxy(ProjectManager.NAME); String expectedPath = projectManager.getFreeTypeFontPath() + File.separator + fontName + ".ttf"; FileHandle expectedFile = Gdx.files.internal(expectedPath); if (!expectedFile.exists()) { // let's check if system fonts fot it HashMap<String, String> fonts = fontManager.getFontsMap(); if (fonts.containsKey(fontName)) { File source = new File(fonts.get(fontName)); FileUtils.copyFile(source, expectedFile.file()); expectedFile = Gdx.files.internal(expectedPath); } else { throw new FileNotFoundException(); } } return expectedFile; }
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); btnConnectWithFacebook = (LoginButton) getActivity().findViewById(R.id.btnConnectWithFacebok); btnConnectWithFacebook.setTypeface( FontManager.setFont(getActivity(), FontManager.Font.OpenSansSemiBold)); btnConnectWithFacebook.setReadPermissions(Arrays.asList("public_profile, email")); btnConnectWithFacebook.setFragment(this); btnConnectWithFacebook.registerCallback(callbackManager, callback); }
private void applyTextStyle(TextView tv, int styleId) { tv.setTextAppearance(getContext(), styleId); TypedArray a = getContext() .getTheme() .obtainStyledAttributes(styleId, R.styleable.CustTextView); // new int[] {R.attr.font} String font = a.getString(R.styleable.CustTextView_font); if (font != null) FontManager.setFont(tv, font); a.recycle(); }
public CharToGlyphMapper getMapper() { if (mapper == null) { if (isBitmapDelegate) { /* we are a delegate */ mapper = new NativeGlyphMapper(this); } else { /* we need to delegate */ delegateFont = FontManager.getDefaultPhysicalFont(); mapper = delegateFont.getMapper(); } } return mapper; }
/* */ public static FontScaler getScaler( Font2D paramFont2D, int paramInt1, boolean paramBoolean, int paramInt2) /* */ { /* 123 */ FontScaler localFontScaler = null; /* */ try /* */ { /* 126 */ Object[] arrayOfObject = { paramFont2D, Integer.valueOf(paramInt1), Boolean.valueOf(paramBoolean), Integer.valueOf(paramInt2) }; /* */ /* 128 */ localFontScaler = (FontScaler) scalerConstructor.newInstance(arrayOfObject); /* 129 */ Disposer.addObjectRecord(paramFont2D, localFontScaler); /* */ } catch (Throwable localThrowable) { /* 131 */ localFontScaler = nullScaler; /* */ /* 136 */ FontManager localFontManager = FontManagerFactory.getInstance(); /* 137 */ localFontManager.deRegisterBadFont(paramFont2D); /* */ } /* 139 */ return localFontScaler; /* */ }
PhysicalFont getDelegateFont() { if (delegateFont == null) { delegateFont = FontManager.getDefaultPhysicalFont(); } return delegateFont; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_send_mail_without_intent); txt = (TextView) findViewById(R.id.txt); Typeface iconFont = FontManager.getTypeface(this, FontManager.FONTAWESOME); FontManager.markAsIconContainer(findViewById(R.id.send), iconFont); FontManager.markAsIconContainer(findViewById(R.id.txtMyCart), iconFont); FontManager.markAsIconContainer(findViewById(R.id.txtAdProduct), iconFont); TextView txtAddProduct = (TextView) findViewById(R.id.txtAdProduct); txtAddProduct.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { Intent i = new Intent(getBaseContext(), AddNewProduct.class); startActivity(i); } }); TextView send = (TextView) findViewById(R.id.send); send.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub new Thread( new Runnable() { public void run() { try { GMailSender sender = new GMailSender("*****@*****.**", "activa4858"); StringBuilder mailText = new StringBuilder(); mailText.append("<html><body>"); Iterator myVeryOwnIterator = expandableListDetail.keySet().iterator(); while (myVeryOwnIterator.hasNext()) { String key = (String) myVeryOwnIterator.next(); mailText.append("<div style=\"color:#0000FF;\"><h4><b>"); mailText.append(key); mailText.append("</b></h4></div><table border=\"1\" width=\"400\" >"); mailText.append("<tr><th>Product</th><th>Quantity</th></tr>"); ArrayList<ShoppingList> lstShoppingList = (ArrayList<ShoppingList>) expandableListDetail.get(key); for (int i = 0; i < lstShoppingList.size(); i++) { mailText.append("<tr><td width=\"300\" >"); mailText.append(lstShoppingList.get(i)._Name); mailText.append("</td><td>"); mailText.append(lstShoppingList.get(i)._quantity); mailText.append("</td></tr>"); } mailText.append("</table></br>"); } mailText.append("</body></html>"); sender.sendMail( "My List", mailText.toString(), "*****@*****.**", "*****@*****.**"); } catch (Exception e) { Toast.makeText(getApplicationContext(), "Error", Toast.LENGTH_LONG) .show(); } } }) .start(); } }); DBMain db; db = new DBMain(context); try { db.createDB(); } catch (IOException ioe) { throw new Error("Database not created...."); } try { db.openDB(); } catch (Exception ex) { } db.getCategory(); expandableListView = (ExpandableListView) findViewById(R.id.expandableList); expandableListDetail = ExpandableListDataPump.getData(); expandableListTitle = new ArrayList(expandableListDetail.keySet()); adapter = new ExpandListAdapter(this, expandableListTitle, expandableListDetail); expandableListView.setAdapter(adapter); expandableListView.setOnGroupExpandListener( new ExpandableListView.OnGroupExpandListener() { @Override public void onGroupExpand(int groupPosition) {} }); expandableListView.setOnGroupCollapseListener( new ExpandableListView.OnGroupCollapseListener() { @Override public void onGroupCollapse(int groupPosition) { ExpandableListAdapter adapter = expandableListView.getExpandableListAdapter(); int childcount = adapter.getChildrenCount(groupPosition); String categoryName = adapter.getGroup(groupPosition).toString(); // .getGroup(groupPosition); // Log.d("test", groupName); for (int i = 0; i < childcount; i++) { ShoppingList lst = (ShoppingList) adapter.getChild(groupPosition, i); Log.d("test", lst._Name); Log.d("test", String.valueOf(lst._quantity)); } Log.d("test", "The Child Count is" + String.valueOf(childcount)); } }); expandableListView.setOnChildClickListener( new ExpandableListView.OnChildClickListener() { @Override public boolean onChildClick( ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { Log.d("test", "I am in child"); return false; } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mApp = (BTLedSignApp) getApplication(); setContentView(R.layout.btledsign_main); mViewBanner = (LedSignView) findViewById(R.id.ViewBanner); mViewBanner.setDisplay(mApp.getDisplay()); // Intent i = new Intent(this, TMAPLinkage.class); // startService(i); SeekBar speedBar = (SeekBar) findViewById(R.id.seekBarSpeed); if (speedBar != null) { speedBar.setOnSeekBarChangeListener( new SeekBar.OnSeekBarChangeListener() { @Override public void onStopTrackingTouch(SeekBar seekBar) { if (mBoolPlay) { if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { getWindow() .getDecorView() .setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); } } } @Override public void onStartTrackingTouch(SeekBar seekBar) {} @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { mIntPlaySpeed = progress; mViewBanner.setPlaySpeed(mIntPlaySpeed); Log.d(TAG, "H3 " + mIntPlaySpeed); if (mBTConnected) { byte[] bufSpeed = new byte[1]; bufSpeed[0] = (byte) (9 - mIntPlaySpeed); String str = String.format("VAL : %d", bufSpeed[0]); Log.d(TAG, str); // mApp.sendData(BTLedSignApp.IOCTL_LED_PLAY, bufSpeed, 20); } } }); speedBar.setProgress(0); } // Font List mHashFonts = FontManager.enumerateFonts(); if (mHashFonts != null) { Iterator<String> s = mHashFonts.keySet().iterator(); mSpinnerFont = (Spinner) findViewById(R.id.SpinnerFont); if (mSpinnerFont != null) { // mFontSelIdx = mFontSpinner.getSelectedItemPosition(); mArrayAdapterFont = new ArrayAdapter<String>(this, R.layout.font_list); if (mArrayAdapterFont != null) { mSpinnerFont.setAdapter(mArrayAdapterFont); String strFontFile; while (s.hasNext()) { strFontFile = s.next(); // Log.d("TEST", ">>>" + strFontFile + " : " + mFontList.get(strFontFile)); mArrayAdapterFont.add(strFontFile); } mArrayAdapterFont.sort(null); mSpinnerFont.setOnItemSelectedListener( new OnItemSelectedListener() { public void onItemSelected( AdapterView<?> parent, View view, int position, long id) { if (mFontSelIdx != position) { String strFontName; strFontName = (String) mSpinnerFont.getItemAtPosition(position); mFontSelIdx = position; LogUtil.d("SEL %s : %s", strFontName, mApp.getDisplay().getText()); mApp.getDisplay().setFontName(strFontName); mViewBanner.invalidate(); } } public void onNothingSelected(AdapterView<?> parent) {} }); } } } }
public void setFont(String fontPath) { FontManager.getInstance().setFont(this, fontPath); }