Skip to content

Commit

Permalink
Widget is now clickable
Browse files Browse the repository at this point in the history
  • Loading branch information
Saurabh Joshi committed May 24, 2014
1 parent eb0d857 commit b102399
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ else if (cur >= dat.getSubLength()){
//ONCLICK LISTENERS DONT CHANGE THESE
Intent clickIntent = new Intent(this.getApplicationContext(),ProviderWidget.class);
Intent clickIntent2 = new Intent(this.getApplicationContext(),ProviderWidget.class);
Intent open_Intent = new Intent(this.getApplicationContext(), SubjectDetails.class);

open_Intent.putExtra("clsnbr", sub.classnbr);

clickIntent.setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
clickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS,allWidgetIds);
Expand All @@ -88,10 +91,15 @@ else if (cur >= dat.getSubLength()){
clickIntent2.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS,allWidgetIds);
clickIntent2.putExtra("back",1);

PendingIntent open_pendingIntent = PendingIntent.getActivity(getApplicationContext(), 3, open_Intent, PendingIntent.FLAG_UPDATE_CURRENT);
PendingIntent pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, clickIntent,PendingIntent.FLAG_UPDATE_CURRENT);
PendingIntent pendingIntent2 = PendingIntent.getBroadcast(getApplicationContext(), 1, clickIntent2,PendingIntent.FLAG_UPDATE_CURRENT);
remoteViews.setOnClickPendingIntent(R.id.img_wid_nxt , pendingIntent);
remoteViews.setOnClickPendingIntent(R.id.img_wid_bck , pendingIntent2);
remoteViews.setOnClickPendingIntent(R.id.lbl_wid_sub, open_pendingIntent);
remoteViews.setOnClickPendingIntent(R.id.prg_wid_per, open_pendingIntent);
remoteViews.setOnClickPendingIntent(R.id.lbl_wid_slt, open_pendingIntent);
remoteViews.setOnClickPendingIntent(R.id.lbl_wid_per, open_pendingIntent);


appWidgetManager.updateAppWidget(widgetId, remoteViews);
Expand Down

0 comments on commit b102399

Please sign in to comment.