Thursday, December 23, 2010

Grails Bean builder for Compass Search on Appengine using JPA

Need to put this down in case i forget

beans = {
    compass(org.compass.spring.LocalCompassBean){
mappingScan = "persisted"
compassSettings = ["compass.engine.connection":"gae://index",
"compass.executorManager.type":"disabled",
"compass.engine.store.gae.cacheMetaData":"true",
"compass.engine.store.gae.flushRate":"50"]
    }

    sameThreadParallelIndexExecutor(org.compass.gps.device.support.parallel.SameThreadParallelIndexExecutor){

    }

    jpaGpsDevice(org.compass.gps.device.jpa.JpaGpsDevice){
name="appengine"
entityManagerFactory = entityManagerFactory
parallelIndexExecutor = sameThreadParallelIndexExecutor
    }
  
    compassGps(org.compass.gps.impl.SingleCompassGps){
compass = compass
gpsDevices = [jpaGpsDevice]
    }
}

Sunday, December 5, 2010

Setting Solid Color to DrawableShape loaded from XML

So yea, tried to set a solid color to a ShapeDrawable resource loaded from XML
initially tried:

ShapeDrawable drawable = (ShapeDrawable)getResources().getDrawable(R.drawable.shape)
drawable.getPaint().setColor(color);

Didn't work,

So cast to GradientDrawable instead:
GradientDrawable drawable = (GradientDrawable)getResources().getDrawable(R.drawable.shape)
drawable.setColor(color);