コード例 #1
0
ファイル: Hardware.java プロジェクト: apuder/TRS-80
 private void generateASCIIFont(AsyncTask task) {
   String ascii =
       " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
   Paint p = new Paint();
   p.setTextAlign(Align.CENTER);
   Typeface tf = Fonts.getTypeface(configuration.getModel());
   p.setTypeface(tf);
   p.setTextScaleX(1.0f);
   p.setColor(configuration.getCharacterColorAsRGB());
   p.setAntiAlias(true);
   setFontSize(p);
   int xPos = trsCharWidth / 2;
   int yPos = (int) ((trsCharHeight / 2) - ((p.descent() + p.ascent()) / 2));
   for (int i = 0; i < ascii.length(); i++) {
     if (task.isCancelled()) {
       return;
     }
     Bitmap b = Bitmap.createBitmap(trsCharWidth, trsCharHeight, Bitmap.Config.RGB_565);
     Canvas c = new Canvas(b);
     c.drawColor(configuration.getScreenColorAsRGB());
     c.drawText(ascii.substring(i, i + 1), xPos, yPos, p);
     font[i + 32] = b;
   }
   // Use space for all other characters
   for (int i = 0; i < font.length; i++) {
     if (font[i] == null) {
       font[i] = font[32];
     }
   }
 }
コード例 #2
0
ファイル: SplashActivity.java プロジェクト: siren186/troj_an
 private void unInit() {
   if (null != mInitTask) {
     if (!mInitTask.isCancelled()) {
       mInitTask.cancel(true);
     }
     mInitTask = null;
   }
 }
コード例 #3
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.signup);

    setTitle(R.string.signUp);
    // Re-task if the request was cancelled.
    mSignupTask = (SignupTask) getLastNonConfigurationInstance();
    if (mSignupTask != null && mSignupTask.isCancelled()) {
      AppLog.d(CLASSTAG, "SignupTask previously cancelled, trying again.");
      mSignupTask = new SignupTask().execute();
    }

    setupUi();
  }
コード例 #4
0
ファイル: Hardware.java プロジェクト: apuder/TRS-80
  private void generateGraphicsFont(AsyncTask task) {
    Paint p = new Paint();
    for (int i = 128; i <= 191; i++) {
      if (task.isCancelled()) {
        return;
      }
      Bitmap b = Bitmap.createBitmap(trsCharWidth, trsCharHeight, Bitmap.Config.RGB_565);
      Canvas c = new Canvas(b);
      c.drawColor(configuration.getScreenColorAsRGB());
      p.setColor(configuration.getCharacterColorAsRGB());
      Rect r = new Rect();
      // Top-left
      if ((i & 1) != 0) {
        r.left = r.top = 0;
        r.right = trsCharWidth / 2;
        r.bottom = trsCharHeight / 3;
        c.drawRect(r, p);
      }

      // Top-right
      if ((i & 2) != 0) {
        r.left = trsCharWidth / 2;
        r.right = trsCharWidth;
        r.top = 0;
        r.bottom = trsCharHeight / 3;
        c.drawRect(r, p);
      }

      // Middle-left
      if ((i & 4) != 0) {
        r.left = 0;
        r.right = trsCharWidth / 2;
        r.top = trsCharHeight / 3;
        r.bottom = trsCharHeight / 3 * 2;
        c.drawRect(r, p);
      }

      // Middle-right
      if ((i & 8) != 0) {
        r.left = trsCharWidth / 2;
        r.right = trsCharWidth;
        r.top = trsCharHeight / 3;
        r.bottom = trsCharHeight / 3 * 2;
        c.drawRect(r, p);
      }

      // Bottom-left
      if ((i & 16) != 0) {
        r.left = 0;
        r.right = trsCharWidth / 2;
        r.top = trsCharHeight / 3 * 2;
        r.bottom = trsCharHeight;
        c.drawRect(r, p);
      }

      // Bottom-right
      if ((i & 32) != 0) {
        r.left = trsCharWidth / 2;
        r.right = trsCharWidth;
        r.top = trsCharHeight / 3 * 2;
        r.bottom = trsCharHeight;
        c.drawRect(r, p);
      }

      font[i] = b;
    }
  }
コード例 #5
0
 private void cancelPrimitiveRootFinder() {
   if (finderTask != null && !finderTask.isCancelled()) {
     finderTask.cancel(true);
   }
 }