Skip to content

Instantly share code, notes, and snippets.

@kennydude
Created March 4, 2013 12:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kennydude/5081991 to your computer and use it in GitHub Desktop.
Save kennydude/5081991 to your computer and use it in GitHub Desktop.
Custom style *should work roughly*
public static class BigPictureStyle extends Style {
private Bitmap mPicture;
private Bitmap mBigLargeIcon;
private boolean mBigLargeIconSet = false;
public BigPictureStyle() {
}
public BigPictureStyle(Builder builder) {
setBuilder(builder);
}
/**
* Overrides ContentTitle in the big form of the template.
* This defaults to the value passed to setContentTitle().
*/
public BigPictureStyle setBigContentTitle(CharSequence title) {
internalSetBigContentTitle(title);
return this;
}
/**
* Set the first line of text after the detail section in the big form of the template.
*/
public BigPictureStyle setSummaryText(CharSequence cs) {
internalSetSummaryText(cs);
return this;
}
/**
* Provide the bitmap to be used as the payload for the BigPicture notification.
*/
public BigPictureStyle bigPicture(Bitmap b) {
mPicture = b;
return this;
}
/**
* Override the large icon when the big notification is shown.
*/
public BigPictureStyle bigLargeIcon(Bitmap b) {
mBigLargeIconSet = true;
mBigLargeIcon = b;
return this;
}
private RemoteViews makeBigContentView() {
RemoteViews contentView = getStandardView(R.layout.notification_template_big_picture);
contentView.setImageViewBitmap(R.id.big_picture, mPicture);
return contentView;
}
@Override
public Notification build() {
checkBuilder();
Notification wip = mBuilder.build();
if (mBigLargeIconSet ) {
mBuilder.mLargeIcon = mBigLargeIcon;
}
wip.bigContentView = makeBigContentView();
return wip;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment