Android Open Source - android-molecules-livewallpaper Molecule Name






From Project

Back to project page android-molecules-livewallpaper.

License

The source code is released under:

Copyright (c) 2012 Dominik Raymann <dominik.raymann@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "S...

If you think the Android project android-molecules-livewallpaper listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package ch.raymi.android.molecules;
//from   w w  w .  j  a  v  a2s  . c o  m
import org.jmol.api.JmolViewer;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;

public final class MoleculeName extends WallpaperElement {
  private final String mName;
  private final Paint mPaint;
  private final float mTextHeight;
  private final float mTextWidth;

  public MoleculeName(String name, long duration) {
    super("MoleculeName", duration);
    this.mName = name;
    this.mPaint = new Paint();
    this.mTextHeight = 36;
    mPaint.setColor(Color.WHITE);
    mPaint.setTextSize(mTextHeight);
    mPaint.setAntiAlias(true);
    this.mTextWidth = mPaint.measureText(mName);
  }

  @Override
  public void draw(Canvas c, JmolViewer v) {
    c.drawText(mName, (c.getWidth() - this.mTextWidth) / 2, (c.getHeight() - this.mTextHeight) / 2, mPaint);
  }

}




Java Source Code List

ch.raymi.android.molecules.AndroidPlatform.java
ch.raymi.android.molecules.Image.java
ch.raymi.android.molecules.MoleculeName.java
ch.raymi.android.molecules.Molecule.java
ch.raymi.android.molecules.MoleculesWallpaperPreferences.java
ch.raymi.android.molecules.MoleculesWallpaper.java
ch.raymi.android.molecules.WallpaperElement.java