content: package com.alium.orin.appwidgets;
  
  import android.app.PendingIntent;
  import android.appwidget.AppWidgetProvider;
  import android.content.ComponentName;
  import android.content.Context;
  import android.content.Intent;
  import android.graphics.Bitmap;
  import android.graphics.Canvas;
  import android.graphics.drawable.Drawable;
  
  /**
   * @author Karim Abou Zeid (kabouzeid)
   */
  public class BaseAppWidget extends AppWidgetProvider {
  
      protected static Bitmap createBitmap(Drawable drawable, float sizeMultiplier) {
          Bitmap bitmap = Bitmap.createBitmap((int) (drawable.getIntrinsicWidth() * sizeMultiplier), (int) (drawable.getIntrinsicHeight() * sizeMultiplier), Bitmap.Config.ARGB_8888);
          Canvas c = new Canvas(bitmap);
          drawable.setBounds(0, 0, c.getWidth(), c.getHeight());
          drawable.draw(c);
          return bitmap;
      }
  
      protected PendingIntent buildPendingIntent(Context context, final String action, final ComponentName serviceName) {
          Intent intent = new Intent(action);
          intent.setComponent(serviceName);
          return PendingIntent.getService(context, 0, intent, 0);
      }
  }
  