Search in sources :

Example 1 with Bitmap

use of android.graphics.Bitmap in project kickmaterial by byoutline.

the class RewardsListActivity method loadProjectData.

private void loadProjectData() {
    selectCategoryTv.setText(R.string.select_pledge);
    selectCategoryTv.setBackgroundColor(Color.TRANSPARENT);
    categoryCircleIv.setVisibility(View.GONE);
    Picasso.with(getApplicationContext()).load(project.getPhotoUrl()).into(new Target() {

        @Override
        public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
            selectedCategoryIv.setImageBitmap(bitmap);
            LUtils.toGrayscale(selectedCategoryIv);
            selectedCategoryIv.getDrawable().setColorFilter(ContextCompat.getColor(RewardsListActivity.this, R.color.green_dark), PorterDuff.Mode.MULTIPLY);
        }

        @Override
        public void onBitmapFailed(Drawable errorDrawable) {
            selectedCategoryIv.setImageResource(0);
        }

        @Override
        public void onPrepareLoad(Drawable placeHolderDrawable) {
            selectedCategoryIv.setImageResource(0);
        }
    });
}
Also used : Target(com.squareup.picasso.Target) Bitmap(android.graphics.Bitmap) Picasso(com.squareup.picasso.Picasso) Drawable(android.graphics.drawable.Drawable)

Example 2 with Bitmap

use of android.graphics.Bitmap in project kickmaterial by byoutline.

the class CircleTransition method captureStartValues.

@Override
public void captureStartValues(TransitionValues transitionValues) {
    final View view = transitionValues.view;
    if (view.getWidth() <= 0 || view.getHeight() <= 0) {
        return;
    }
    captureValues(transitionValues);
    Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    view.draw(canvas);
    transitionValues.values.put(PROPERTY_IMAGE, bitmap);
}
Also used : Bitmap(android.graphics.Bitmap) Canvas(android.graphics.Canvas) View(android.view.View)

Example 3 with Bitmap

use of android.graphics.Bitmap in project kickmaterial by byoutline.

the class CircleTransition method getStartView.

private View getStartView(ViewGroup sceneRoot, TransitionValues startValues, int[] sceneRootLoc, int[] startLoc) {
    Bitmap startImage = (Bitmap) startValues.values.get(PROPERTY_IMAGE);
    Drawable startBackground = new BitmapDrawable(startImage);
    final View startView = addViewToOverlay(sceneRoot, startImage.getWidth(), startImage.getHeight(), startBackground);
    int startTranslationX = startLoc[0] - sceneRootLoc[0];
    int startTranslationY = startLoc[1] - sceneRootLoc[1];
    startView.setTranslationX(startTranslationX);
    startView.setTranslationY(startTranslationY);
    return startView;
}
Also used : Bitmap(android.graphics.Bitmap) BitmapDrawable(android.graphics.drawable.BitmapDrawable) Drawable(android.graphics.drawable.Drawable) BitmapDrawable(android.graphics.drawable.BitmapDrawable) View(android.view.View)

Example 4 with Bitmap

use of android.graphics.Bitmap in project buck by facebook.

the class ExoMetaLogActivity method onCreate.

@Override
public void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    try {
        ApplicationInfo appInfo = getPackageManager().getApplicationInfo("buck.exotest", PackageManager.GET_META_DATA);
        Bitmap icon = getIcon(appInfo);
        Bitmap defaultIcon = ((BitmapDrawable) getPackageManager().getApplicationIcon(getApplicationInfo())).getBitmap();
        if (icon == null) {
            Log.i("EXOPACKAGE_TEST_META", "Found no icon");
        } else if (icon.sameAs(defaultIcon)) {
            Log.i("EXOPACKAGE_TEST_META", "Found default icon");
        } else {
            Log.i("EXOPACKAGE_TEST_META", "META_ICON=" + icon.getWidth() + "_" + icon.getHeight());
        }
        String name = getName(appInfo);
        if (name == null) {
            Log.i("EXOPACKAGE_TEST_META", "Found no name");
        } else {
            Log.i("EXOPACKAGE_TEST_META", "META_NAME=" + name);
        }
        String[] meta = getMeta(appInfo);
        if (meta == null) {
            Log.i("EXOPACKAGE_TEST_META", "Found no metadata");
        } else {
            String metaStr = "<";
            for (int i = 0; i < meta.length; i++) {
                metaStr += (i == 0 ? "" : ",") + meta[i];
            }
            metaStr += ">";
            Log.i("EXOPACKAGE_TEST_META", "META_DATA=" + metaStr);
        }
    } catch (Exception e) {
        Log.i("EXOPACKAGE_TEST_META_DEBUG", "Got an exception", e);
    }
    Log.i("EXOPACKAGE_TEST_META", "FINISHED");
    finish();
}
Also used : Bitmap(android.graphics.Bitmap) ApplicationInfo(android.content.pm.ApplicationInfo) BitmapDrawable(android.graphics.drawable.BitmapDrawable)

Example 5 with Bitmap

use of android.graphics.Bitmap in project UltimateAndroid by cymcsg.

the class Tile method decode.

public void decode(Context context, TileCache cache, BitmapDecoder decoder) {
    if (hasBitmap) {
        return;
    }
    if (cache != null) {
        Bitmap cached = cache.getBitmap(file);
        if (cached != null) {
            bitmap = cached;
            return;
        }
    }
    bitmap = decoder.decode(file, context);
    hasBitmap = (bitmap != null);
    if (cache != null) {
        cache.addBitmap(file, bitmap);
    }
}
Also used : Bitmap(android.graphics.Bitmap)

Aggregations

Bitmap (android.graphics.Bitmap)6901 Canvas (android.graphics.Canvas)1585 Paint (android.graphics.Paint)1262 BitmapDrawable (android.graphics.drawable.BitmapDrawable)742 IOException (java.io.IOException)701 Test (org.junit.Test)571 File (java.io.File)492 Matrix (android.graphics.Matrix)490 Rect (android.graphics.Rect)489 Drawable (android.graphics.drawable.Drawable)474 BitmapFactory (android.graphics.BitmapFactory)464 View (android.view.View)459 ImageView (android.widget.ImageView)395 Intent (android.content.Intent)385 InputStream (java.io.InputStream)316 FileOutputStream (java.io.FileOutputStream)300 Point (android.graphics.Point)272 Uri (android.net.Uri)259 RectF (android.graphics.RectF)255 FileNotFoundException (java.io.FileNotFoundException)251