This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyLibrary { | |
public static final String XMLNS = "http://mylib.com/schema" | |
} | |
// in widget class | |
public class MyWidget { | |
public MyWidget(Context context, AttributeSet attrs) { | |
// don't use obtainStyledAttributes, but getAttributeResourceValue: | |
int myAttr = attrs.getAttributeResourceValue(MyLibrary.XMLNS, "myAttr", -1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onHandleIntent(Intent intent) { | |
this.nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); | |
int jobId = intent.getIntExtra(JOB_ID_EXTRA, -1); | |
QypeModel model = intent.getParcelableExtra(MODEL_EXTRA); | |
if (model instanceof Place) { | |
this.uploadStrategy = new PlacePhotoUploadStrategy((Place) model); | |
} else if (model instanceof User) { | |
this.uploadStrategy = new UserPhotoUploadStrategy((User) model); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# patch OAuth class to be able to create multipart requests (required for image uploading) | |
# NOTE that for my purpose I simply made it "auto-sensing" that an image is passed and | |
# only then creates a multipart body. You may simply want to use some flag instead or whatever. | |
module OAuth | |
class Consumer | |
alias_method :create_default_http_request, :create_http_request | |
protected | |
def create_http_request(http_method, path, *arguments) | |
# CHANGE THIS -- I only did this because it was for a quick-and-dirty script that had to upload pictures |
NewerOlder