update the widgets properly

This commit is contained in:
tibbi 2016-02-14 20:02:35 +01:00
parent 7cace2b5bc
commit e19a02c017
1 changed files with 6 additions and 2 deletions

View File

@ -51,13 +51,17 @@ public class MyWidgetProvider extends AppWidgetProvider implements MyCamera {
@Override @Override
public void enableFlashlight() { public void enableFlashlight() {
remoteViews.setImageViewResource(R.id.toggle_btn, R.mipmap.flashlight_big_on); remoteViews.setImageViewResource(R.id.toggle_btn, R.mipmap.flashlight_big_on);
widgetManager.updateAppWidget(widgetIds, remoteViews); for (int widgetId : widgetIds) {
widgetManager.updateAppWidget(widgetId, remoteViews);
}
} }
@Override @Override
public void disableFlashlight() { public void disableFlashlight() {
remoteViews.setImageViewResource(R.id.toggle_btn, R.mipmap.flashlight_big_off); remoteViews.setImageViewResource(R.id.toggle_btn, R.mipmap.flashlight_big_off);
widgetManager.updateAppWidget(widgetIds, remoteViews); for (int widgetId : widgetIds) {
widgetManager.updateAppWidget(widgetId, remoteViews);
}
cameraImpl.releaseCamera(); cameraImpl.releaseCamera();
} }