Created
December 11, 2010 14:38
-
-
Save jbrechtel/737396 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def createRemoteViews(): RemoteViews = { | |
val views = new RemoteViews(context.getPackageName(), R.layout.latest_apps) | |
views.removeAllViews(R.id.buttons) | |
dao.latestApps.take(4) foreach (appInfo => views.addView(R.id.buttons, createAppRemoteView(appInfo))) | |
views.setViewVisibility(R.id.buttons, android.view.View.VISIBLE) | |
return views | |
} | |
private def createAppRemoteView(appInfo: ApplicationInfo): RemoteViews = { | |
val views = new RemoteViews(context.getPackageName(), R.layout.app_button) | |
val uri = "android.resource://"+appInfo.packageName+"/"+appInfo.icon.toString | |
views.setImageViewUri(R.id.app_icon, Uri.parse(uri)) | |
views.setOnClickPendingIntent(R.id.app_container, pendingIntentForApp(appInfo)) | |
views.setTextViewText(R.id.app_label, appInfo.loadLabel(packageManager)) | |
return views | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment